Tribe__Tickets_Plus__QR::inject_qr( $ticket )
Generates the QR image, stores is locally and injects it into the tickets email
Contents
Parameters
- $ticket
-
(Required) array
Return
(string)
Source
File: src/Tribe/QR.php
public function inject_qr( $ticket ) {
// if gzuncompress doesn't exist, we can't render QR codes
if ( ! function_exists( 'gzuncompress' ) ) {
Tribe__Main::instance()->log_warning( __( 'Could not render QR code because gzuncompress() is not available', 'event-tickets-plus' ), __CLASS__ );
return;
}
$enabled = tribe_get_option( 'tickets-enable-qr-codes', true );
/**
* Filters the QR enabled value
*
* @since 4.8.2
*
* @param bool $enabled The bool that comes from the options
* @param array $ticket The ticket
*/
$enabled = apply_filters( 'tribe_tickets_plus_qr_enabled', $enabled, $ticket );
if ( empty( $enabled ) ) {
return;
}
$link = $this->_get_link( $ticket['qr_ticket_id'], $ticket['event_id'], $ticket['security_code'] );
$qr = $this->_get_image( $link );
if ( ! $qr ) {
return;
}
// echo QR template for email
tribe_tickets_get_template_part( 'tickets-plus/email-qr', null, array( 'qr' => $qr ), true );
}
Changelog
| Version | Description |
|---|---|
| 5.8.0 | Introduced. |