Completed
Branch BUG-10381-asset-loading (2d15a5)
by
unknown
127:00 queued 116:19
created

EspressoCheckout::processShortcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
rs 10
1
<?php
2
namespace EventEspresso\core\domain\entities\shortcodes;
3
4
use EE_Registry;
5
use EED_Single_Page_Checkout;
6
use EventEspresso\core\services\shortcodes\EspressoShortcode;
7
8
defined('EVENT_ESPRESSO_VERSION') || exit;
9
10
11
12
/**
13
 * Class EspressoCheckout
14
 * ESPRESSO_CHECKOUT shortcode for connecting with SPCO
15
 *
16
 * @package       Event Espresso
17
 * @author        Brent Christensen
18
 * @since         4.9.26
19
 */
20
class EspressoCheckout extends EspressoShortcode
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_CHECKOUT';
32
    }
33
34
35
36
    /**
37
     * the time in seconds to cache the results of the processShortcode() method
38
     * 0 means the processShortcode() results will NOT be cached at all
39
     *
40
     * @return int
41
     */
42
    public function cacheExpiration()
43
    {
44
        return 0;
45
    }
46
47
48
    /**
49
     * a place for adding any initialization code that needs to run prior to wp_header().
50
     * this may be required for shortcodes that utilize a corresponding module,
51
     * and need to enqueue assets for that module
52
     *
53
     * @return void
54
     * @throws \EE_Error
55
     */
56
    public function initializeShortcode()
57
    {
58
        global $wp_query;
59
        EED_Single_Page_Checkout::init($wp_query);
60
    }
61
62
63
64
    /**
65
     * callback that runs when the shortcode is encountered in post content.
66
     * IMPORTANT !!!
67
     * remember that shortcode content should be RETURNED and NOT echoed out
68
     *
69
     * @param array $attributes
70
     * @return string
71
     */
72
    public function processShortcode($attributes = array())
73
    {
74
        return EE_Registry::instance()->REQ->get_output();
75
    }
76
77
78
79
}
80
// End of file EspressoCheckout.php
81
// Location: EventEspresso\core\domain\entities\shortcodes/EspressoCheckout.php