Completed
Branch BUG-10381-asset-loading (0f96c1)
by
unknown
60:43 queued 48:13
created

EspressoTicketSelector   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 4
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTag() 0 4 1
A initializeShortcode() 0 4 1
A processShortcode() 0 10 2
1
<?php
2
namespace EventEspresso\core\domain\entities\shortcodes;
3
4
use EE_Registry;
5
use EventEspresso\core\services\shortcodes\EspressoShortcode;
6
7
defined('EVENT_ESPRESSO_VERSION') || exit;
8
9
10
11
/**
12
 * Class EspressoTicketSelector
13
 * ESPRESSO_TICKET_SELECTOR shortcode
14
 *
15
 * @package       Event Espresso
16
 * @author        Brent Christensen
17
 * @since         $VID:$
18
 */
19
class EspressoTicketSelector extends EspressoShortcode
20
{
21
22
23
24
    /**
25
     * the actual shortcode tag that gets registered with WordPress
26
     *
27
     * @return string
28
     */
29
    public function getTag()
30
    {
31
        return 'ESPRESSO_TICKET_SELECTOR';
32
    }
33
34
35
36
    /**
37
     * a place for adding any initialization code that needs to run prior to wp_header().
38
     * this may be required for shortcodes that utilize a corresponding module,
39
     * and need to enqueue assets for that module
40
     *
41
     * @return void
42
     */
43
    public function initializeShortcode()
44
    {
45
        add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
46
    }
47
48
49
50
    /**
51
     * callback that runs when the shortcode is encountered in post content.
52
     * IMPORTANT !!!
53
     * remember that shortcode content should be RETURNED and NOT echoed out
54
     *
55
     * @param array $attributes
56
     * @return string
57
     */
58
    public function processShortcode($attributes = array())
59
    {
60
        extract($attributes, EXTR_OVERWRITE);
61
        $event_id = isset($event_id) ? $event_id : 0;
62
        $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id);
63
        ob_start();
64
        do_action('AHEE_event_details_before_post', $event_id);
65
        espresso_ticket_selector($event);
66
        do_action('AHEE_event_details_after_post');
67
        return ob_get_clean();    }
68
}
69
// End of file EspressoTicketSelector.php
70
// Location: EventEspresso\core\domain\entities\shortcodes/EspressoTicketSelector.php