Completed
Branch BUG-10375-migrations-not-repor... (1e9646)
by
unknown
62:53 queued 49:42
created
modules/ticket_selector/TicketSelectorIframe.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\libraries\iframe_display\Iframe;
5 5
 
6 6
 if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-    exit( 'No direct script access allowed' );
7
+	exit( 'No direct script access allowed' );
8 8
 }
9 9
 
10 10
 
@@ -21,64 +21,64 @@  discard block
 block discarded – undo
21 21
 class TicketSelectorIframe extends Iframe
22 22
 {
23 23
 
24
-    /**
25
-     * TicketSelectorIframe constructor.
26
-     *
27
-     * @throws \DomainException
28
-     * @throws \EE_Error
29
-     */
30
-    public function __construct()
31
-    {
32
-        \EE_Registry::instance()->REQ->set_espresso_page( true );
33
-        /** @type \EEM_Event $EEM_Event */
34
-        $EEM_Event = \EE_Registry::instance()->load_model( 'Event' );
35
-        $event = $EEM_Event->get_one_by_ID(
36
-            \EE_Registry::instance()->REQ->get( 'event', 0 )
37
-        );
38
-        $ticket_selector = new DisplayTicketSelector();
39
-        $ticket_selector->setIframe( true );
40
-        parent::__construct(
41
-            esc_html__( 'Ticket Selector', 'event_espresso' ),
42
-            $ticket_selector->display( $event )
43
-        );
44
-        $this->addStylesheets(
45
-            apply_filters(
46
-                'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
47
-                array(
48
-                    'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL
49
-                                               . 'ticket_selector_embed.css?ver='
50
-                                               . EVENT_ESPRESSO_VERSION,
51
-                    'ticket_selector'       => TICKET_SELECTOR_ASSETS_URL
52
-                                               . 'ticket_selector.css?ver='
53
-                                               . EVENT_ESPRESSO_VERSION,
54
-                ),
55
-                $this
56
-            )
57
-        );
58
-        if ( ! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) {
59
-            $this->addStylesheets( array('site_theme' => '' ) );
60
-        }
61
-        $this->addScripts(
62
-            apply_filters(
63
-                'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
64
-                array(
65
-                    'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL
66
-                                                      . 'ticket_selector_iframe_embed.js?ver='
67
-                                                      . EVENT_ESPRESSO_VERSION,
68
-                ),
69
-                $this
70
-            )
71
-        );
72
-        $this->addLocalizedVars(
73
-            array(
74
-                'ticket_selector_iframe' => true,
75
-                'EEDTicketSelectorMsg'   => __(
76
-                    'Please choose at least one ticket before continuing.',
77
-                    'event_espresso'
78
-                ),
79
-            )
80
-        );
81
-    }
24
+	/**
25
+	 * TicketSelectorIframe constructor.
26
+	 *
27
+	 * @throws \DomainException
28
+	 * @throws \EE_Error
29
+	 */
30
+	public function __construct()
31
+	{
32
+		\EE_Registry::instance()->REQ->set_espresso_page( true );
33
+		/** @type \EEM_Event $EEM_Event */
34
+		$EEM_Event = \EE_Registry::instance()->load_model( 'Event' );
35
+		$event = $EEM_Event->get_one_by_ID(
36
+			\EE_Registry::instance()->REQ->get( 'event', 0 )
37
+		);
38
+		$ticket_selector = new DisplayTicketSelector();
39
+		$ticket_selector->setIframe( true );
40
+		parent::__construct(
41
+			esc_html__( 'Ticket Selector', 'event_espresso' ),
42
+			$ticket_selector->display( $event )
43
+		);
44
+		$this->addStylesheets(
45
+			apply_filters(
46
+				'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
47
+				array(
48
+					'ticket_selector_embed' => TICKET_SELECTOR_ASSETS_URL
49
+											   . 'ticket_selector_embed.css?ver='
50
+											   . EVENT_ESPRESSO_VERSION,
51
+					'ticket_selector'       => TICKET_SELECTOR_ASSETS_URL
52
+											   . 'ticket_selector.css?ver='
53
+											   . EVENT_ESPRESSO_VERSION,
54
+				),
55
+				$this
56
+			)
57
+		);
58
+		if ( ! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) {
59
+			$this->addStylesheets( array('site_theme' => '' ) );
60
+		}
61
+		$this->addScripts(
62
+			apply_filters(
63
+				'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
64
+				array(
65
+					'ticket_selector_iframe_embed' => TICKET_SELECTOR_ASSETS_URL
66
+													  . 'ticket_selector_iframe_embed.js?ver='
67
+													  . EVENT_ESPRESSO_VERSION,
68
+				),
69
+				$this
70
+			)
71
+		);
72
+		$this->addLocalizedVars(
73
+			array(
74
+				'ticket_selector_iframe' => true,
75
+				'EEDTicketSelectorMsg'   => __(
76
+					'Please choose at least one ticket before continuing.',
77
+					'event_espresso'
78
+				),
79
+			)
80
+		);
81
+	}
82 82
 
83 83
 }
84 84
 // End of file TicketSelectorIframe.php
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\libraries\iframe_display\Iframe;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-    exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+    exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function __construct()
31 31
     {
32
-        \EE_Registry::instance()->REQ->set_espresso_page( true );
32
+        \EE_Registry::instance()->REQ->set_espresso_page(true);
33 33
         /** @type \EEM_Event $EEM_Event */
34
-        $EEM_Event = \EE_Registry::instance()->load_model( 'Event' );
34
+        $EEM_Event = \EE_Registry::instance()->load_model('Event');
35 35
         $event = $EEM_Event->get_one_by_ID(
36
-            \EE_Registry::instance()->REQ->get( 'event', 0 )
36
+            \EE_Registry::instance()->REQ->get('event', 0)
37 37
         );
38 38
         $ticket_selector = new DisplayTicketSelector();
39
-        $ticket_selector->setIframe( true );
39
+        $ticket_selector->setIframe(true);
40 40
         parent::__construct(
41
-            esc_html__( 'Ticket Selector', 'event_espresso' ),
42
-            $ticket_selector->display( $event )
41
+            esc_html__('Ticket Selector', 'event_espresso'),
42
+            $ticket_selector->display($event)
43 43
         );
44 44
         $this->addStylesheets(
45 45
             apply_filters(
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             )
57 57
         );
58 58
         if ( ! apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__load_theme_css', false, $this)) {
59
-            $this->addStylesheets( array('site_theme' => '' ) );
59
+            $this->addStylesheets(array('site_theme' => ''));
60 60
         }
61 61
         $this->addScripts(
62 62
             apply_filters(
Please login to merge, or discard this patch.
display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php 2 patches
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -17,151 +17,151 @@  discard block
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * enqueues css and js, so that this can be called statically
22
-     */
23
-    public static function enqueue_styles_and_scripts()
24
-    {
25
-        wp_register_style(
26
-            'checkbox_dropdown_selector',
27
-            EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css',
28
-            array('espresso_default'),
29
-            EVENT_ESPRESSO_VERSION
30
-        );
31
-        wp_enqueue_style('checkbox_dropdown_selector');
32
-        wp_register_script(
33
-            'checkbox_dropdown_selector',
34
-            EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js',
35
-            array('jquery'),
36
-            EVENT_ESPRESSO_VERSION,
37
-            true
38
-        );
39
-        wp_enqueue_script('checkbox_dropdown_selector');
40
-    }
41
-
42
-
43
-
44
-    /**
45
-     * Informs the rest of the forms system what CSS and JS is needed to display the input
46
-     */
47
-    public function enqueue_js(){
48
-        EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
49
-    }
50
-
51
-
52
-
53
-    /**
54
-     * callback for Iframe::addStylesheets() child class methods
55
-     *
56
-     * @param array $iframe_css
57
-     * @return array
58
-     */
59
-    public function iframe_css(array $iframe_css){
60
-        $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css';
61
-        return $iframe_css;
62
-    }
63
-
64
-
65
-
66
-    /**
67
-     * callback for Iframe::addScripts() child class methods
68
-     *
69
-     * @param array $iframe_js
70
-     * @return array
71
-     */
72
-    public function iframe_js(array $iframe_js){
73
-        $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js';
74
-        return $iframe_js;
75
-    }
76
-
77
-
78
-    /**
79
-     * @throws EE_Error
80
-     * @return string of html to display the field
81
-     */
82
-    public function display()
83
-    {
84
-        $input = $this->get_input();
85
-        $select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : '';
86
-        // $multi = count( $input->options() ) > 1 ? TRUE : FALSE;
87
-        $input->set_label_sizes();
88
-        $label_size_class = $input->get_label_size_class();
89
-        if ( ! is_array($input->raw_value()) && $input->raw_value() !== null) {
90
-            EE_Error::doing_it_wrong(
91
-                'EE_Checkbox_Display_Strategy::display()',
92
-                sprintf(
93
-                    esc_html__(
94
-                        'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"',
95
-                        'event_espresso'
96
-                    ),
97
-                    $input->html_id(),
98
-                    var_export($input->raw_value(), true),
99
-                    $input->html_name() . '[]'
100
-                ),
101
-                '4.8.1'
102
-            );
103
-        }
104
-
105
-
106
-        $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv');
107
-        $html .= '<button id="' . $input->html_id() . '-btn"';
108
-        // $html .= ' name="' . $input->html_name() . '"';
109
-        $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"';
110
-        $html .= ' style="' . $input->html_style() . '"';
111
-        $html .= ' data-target="' . $input->html_id() . '-options-dv"';
112
-        $html .= ' ' . $input->html_other_attributes() . '>';
113
-        $html .= '<span class="checkbox-dropdown-selector-selected-spn">';
114
-        $html .= $select_button_text;
115
-        $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>';
116
-        $html .= '</button>';
117
-        $html .= EEH_HTML::div(
118
-            '',
119
-            $input->html_id() . '-options-dv',
120
-            'checkbox-dropdown-selector'
121
-        );
122
-        $html .= EEH_HTML::link(
123
-            '',
124
-            '<span class="dashicons dashicons-no"></span>',
125
-            esc_html__('close datetime selector', 'event_espresso'),
126
-            '',
127
-            'close-espresso-notice'
128
-        );
129
-        $html .= EEH_HTML::ul();
130
-        $input_raw_value = (array)$input->raw_value();
131
-        foreach ($input->options() as $value => $display_text) {
132
-            $html .= EEH_HTML::li();
133
-            $value = $input->get_normalization_strategy()->unnormalize_one($value);
134
-            $html_id = $this->get_sub_input_id($value);
135
-            $html .= EEH_HTML::nl(0, 'checkbox');
136
-            $html .= '<label for="'
137
-                     . $html_id
138
-                     . '" id="'
139
-                     . $html_id
140
-                     . '-lbl" class="ee-checkbox-label-after'
141
-                     . $label_size_class
142
-                     . '">';
143
-            $html .= EEH_HTML::nl(1, 'checkbox');
144
-            $html .= '<input type="checkbox"';
145
-            $html .= ' name="' . $input->html_name() . '[]"';
146
-            $html .= ' id="' . $html_id . '"';
147
-            $html .= ' class="' . $input->html_class() . '-option"';
148
-            $html .= ' style="' . $input->html_style() . '"';
149
-            $html .= ' value="' . esc_attr($value) . '"';
150
-            $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
151
-                ? ' checked="checked"'
152
-                : '';
153
-            $html .= ' ' . $this->_input->other_html_attributes();
154
-            $html .= '>';
155
-            $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>';
156
-            $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
157
-            $html .= EEH_HTML::lix();
158
-        }
159
-        $html .= EEH_HTML::ulx();
160
-        $html .= EEH_HTML::divx();
161
-        $html .= EEH_HTML::divx();
162
-        $html .= \EEH_HTML::br();
163
-        return $html;
164
-    }
20
+	/**
21
+	 * enqueues css and js, so that this can be called statically
22
+	 */
23
+	public static function enqueue_styles_and_scripts()
24
+	{
25
+		wp_register_style(
26
+			'checkbox_dropdown_selector',
27
+			EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css',
28
+			array('espresso_default'),
29
+			EVENT_ESPRESSO_VERSION
30
+		);
31
+		wp_enqueue_style('checkbox_dropdown_selector');
32
+		wp_register_script(
33
+			'checkbox_dropdown_selector',
34
+			EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js',
35
+			array('jquery'),
36
+			EVENT_ESPRESSO_VERSION,
37
+			true
38
+		);
39
+		wp_enqueue_script('checkbox_dropdown_selector');
40
+	}
41
+
42
+
43
+
44
+	/**
45
+	 * Informs the rest of the forms system what CSS and JS is needed to display the input
46
+	 */
47
+	public function enqueue_js(){
48
+		EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
49
+	}
50
+
51
+
52
+
53
+	/**
54
+	 * callback for Iframe::addStylesheets() child class methods
55
+	 *
56
+	 * @param array $iframe_css
57
+	 * @return array
58
+	 */
59
+	public function iframe_css(array $iframe_css){
60
+		$iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css';
61
+		return $iframe_css;
62
+	}
63
+
64
+
65
+
66
+	/**
67
+	 * callback for Iframe::addScripts() child class methods
68
+	 *
69
+	 * @param array $iframe_js
70
+	 * @return array
71
+	 */
72
+	public function iframe_js(array $iframe_js){
73
+		$iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js';
74
+		return $iframe_js;
75
+	}
76
+
77
+
78
+	/**
79
+	 * @throws EE_Error
80
+	 * @return string of html to display the field
81
+	 */
82
+	public function display()
83
+	{
84
+		$input = $this->get_input();
85
+		$select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : '';
86
+		// $multi = count( $input->options() ) > 1 ? TRUE : FALSE;
87
+		$input->set_label_sizes();
88
+		$label_size_class = $input->get_label_size_class();
89
+		if ( ! is_array($input->raw_value()) && $input->raw_value() !== null) {
90
+			EE_Error::doing_it_wrong(
91
+				'EE_Checkbox_Display_Strategy::display()',
92
+				sprintf(
93
+					esc_html__(
94
+						'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"',
95
+						'event_espresso'
96
+					),
97
+					$input->html_id(),
98
+					var_export($input->raw_value(), true),
99
+					$input->html_name() . '[]'
100
+				),
101
+				'4.8.1'
102
+			);
103
+		}
104
+
105
+
106
+		$html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv');
107
+		$html .= '<button id="' . $input->html_id() . '-btn"';
108
+		// $html .= ' name="' . $input->html_name() . '"';
109
+		$html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"';
110
+		$html .= ' style="' . $input->html_style() . '"';
111
+		$html .= ' data-target="' . $input->html_id() . '-options-dv"';
112
+		$html .= ' ' . $input->html_other_attributes() . '>';
113
+		$html .= '<span class="checkbox-dropdown-selector-selected-spn">';
114
+		$html .= $select_button_text;
115
+		$html .= '</span> <span class="dashicons dashicons-arrow-down"></span>';
116
+		$html .= '</button>';
117
+		$html .= EEH_HTML::div(
118
+			'',
119
+			$input->html_id() . '-options-dv',
120
+			'checkbox-dropdown-selector'
121
+		);
122
+		$html .= EEH_HTML::link(
123
+			'',
124
+			'<span class="dashicons dashicons-no"></span>',
125
+			esc_html__('close datetime selector', 'event_espresso'),
126
+			'',
127
+			'close-espresso-notice'
128
+		);
129
+		$html .= EEH_HTML::ul();
130
+		$input_raw_value = (array)$input->raw_value();
131
+		foreach ($input->options() as $value => $display_text) {
132
+			$html .= EEH_HTML::li();
133
+			$value = $input->get_normalization_strategy()->unnormalize_one($value);
134
+			$html_id = $this->get_sub_input_id($value);
135
+			$html .= EEH_HTML::nl(0, 'checkbox');
136
+			$html .= '<label for="'
137
+					 . $html_id
138
+					 . '" id="'
139
+					 . $html_id
140
+					 . '-lbl" class="ee-checkbox-label-after'
141
+					 . $label_size_class
142
+					 . '">';
143
+			$html .= EEH_HTML::nl(1, 'checkbox');
144
+			$html .= '<input type="checkbox"';
145
+			$html .= ' name="' . $input->html_name() . '[]"';
146
+			$html .= ' id="' . $html_id . '"';
147
+			$html .= ' class="' . $input->html_class() . '-option"';
148
+			$html .= ' style="' . $input->html_style() . '"';
149
+			$html .= ' value="' . esc_attr($value) . '"';
150
+			$html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
151
+				? ' checked="checked"'
152
+				: '';
153
+			$html .= ' ' . $this->_input->other_html_attributes();
154
+			$html .= '>';
155
+			$html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>';
156
+			$html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
157
+			$html .= EEH_HTML::lix();
158
+		}
159
+		$html .= EEH_HTML::ulx();
160
+		$html .= EEH_HTML::divx();
161
+		$html .= EEH_HTML::divx();
162
+		$html .= \EEH_HTML::br();
163
+		return $html;
164
+	}
165 165
 
166 166
 
167 167
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
     {
25 25
         wp_register_style(
26 26
             'checkbox_dropdown_selector',
27
-            EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css',
27
+            EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css',
28 28
             array('espresso_default'),
29 29
             EVENT_ESPRESSO_VERSION
30 30
         );
31 31
         wp_enqueue_style('checkbox_dropdown_selector');
32 32
         wp_register_script(
33 33
             'checkbox_dropdown_selector',
34
-            EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js',
34
+            EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js',
35 35
             array('jquery'),
36 36
             EVENT_ESPRESSO_VERSION,
37 37
             true
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     /**
45 45
      * Informs the rest of the forms system what CSS and JS is needed to display the input
46 46
      */
47
-    public function enqueue_js(){
47
+    public function enqueue_js() {
48 48
         EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
49 49
     }
50 50
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
      * @param array $iframe_css
57 57
      * @return array
58 58
      */
59
-    public function iframe_css(array $iframe_css){
60
-        $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css';
59
+    public function iframe_css(array $iframe_css) {
60
+        $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css';
61 61
         return $iframe_css;
62 62
     }
63 63
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
      * @param array $iframe_js
70 70
      * @return array
71 71
      */
72
-    public function iframe_js(array $iframe_js){
73
-        $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js';
72
+    public function iframe_js(array $iframe_js) {
73
+        $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js';
74 74
         return $iframe_js;
75 75
     }
76 76
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                     ),
97 97
                     $input->html_id(),
98 98
                     var_export($input->raw_value(), true),
99
-                    $input->html_name() . '[]'
99
+                    $input->html_name().'[]'
100 100
                 ),
101 101
                 '4.8.1'
102 102
             );
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 
105 105
 
106 106
         $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv');
107
-        $html .= '<button id="' . $input->html_id() . '-btn"';
107
+        $html .= '<button id="'.$input->html_id().'-btn"';
108 108
         // $html .= ' name="' . $input->html_name() . '"';
109
-        $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"';
110
-        $html .= ' style="' . $input->html_style() . '"';
111
-        $html .= ' data-target="' . $input->html_id() . '-options-dv"';
112
-        $html .= ' ' . $input->html_other_attributes() . '>';
109
+        $html .= ' class="'.$input->html_class().' checkbox-dropdown-selector-btn button-secondary button"';
110
+        $html .= ' style="'.$input->html_style().'"';
111
+        $html .= ' data-target="'.$input->html_id().'-options-dv"';
112
+        $html .= ' '.$input->html_other_attributes().'>';
113 113
         $html .= '<span class="checkbox-dropdown-selector-selected-spn">';
114 114
         $html .= $select_button_text;
115 115
         $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>';
116 116
         $html .= '</button>';
117 117
         $html .= EEH_HTML::div(
118 118
             '',
119
-            $input->html_id() . '-options-dv',
119
+            $input->html_id().'-options-dv',
120 120
             'checkbox-dropdown-selector'
121 121
         );
122 122
         $html .= EEH_HTML::link(
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             'close-espresso-notice'
128 128
         );
129 129
         $html .= EEH_HTML::ul();
130
-        $input_raw_value = (array)$input->raw_value();
130
+        $input_raw_value = (array) $input->raw_value();
131 131
         foreach ($input->options() as $value => $display_text) {
132 132
             $html .= EEH_HTML::li();
133 133
             $value = $input->get_normalization_strategy()->unnormalize_one($value);
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
                      . '">';
143 143
             $html .= EEH_HTML::nl(1, 'checkbox');
144 144
             $html .= '<input type="checkbox"';
145
-            $html .= ' name="' . $input->html_name() . '[]"';
146
-            $html .= ' id="' . $html_id . '"';
147
-            $html .= ' class="' . $input->html_class() . '-option"';
148
-            $html .= ' style="' . $input->html_style() . '"';
149
-            $html .= ' value="' . esc_attr($value) . '"';
145
+            $html .= ' name="'.$input->html_name().'[]"';
146
+            $html .= ' id="'.$html_id.'"';
147
+            $html .= ' class="'.$input->html_class().'-option"';
148
+            $html .= ' style="'.$input->html_style().'"';
149
+            $html .= ' value="'.esc_attr($value).'"';
150 150
             $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
151 151
                 ? ' checked="checked"'
152 152
                 : '';
153
-            $html .= ' ' . $this->_input->other_html_attributes();
153
+            $html .= ' '.$this->_input->other_html_attributes();
154 154
             $html .= '>';
155
-            $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>';
156
-            $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
155
+            $html .= '<span class="datetime-selector-option-text-spn">'.$display_text.'</span>';
156
+            $html .= EEH_HTML::nl(-1, 'checkbox').'</label>';
157 157
             $html .= EEH_HTML::lix();
158 158
         }
159 159
         $html .= EEH_HTML::ulx();
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorStandard.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -17,127 +17,127 @@
 block discarded – undo
17 17
 class TicketSelectorStandard extends TicketSelector
18 18
 {
19 19
 
20
-    /**
21
-     * @var string $date_format
22
-     */
23
-    protected $date_format;
24
-
25
-    /**
26
-     * @var string $time_format
27
-     */
28
-    protected $time_format;
29
-
30
-    /**
31
-     * @var \EE_Ticket_Selector_Config $ticket_selector_config
32
-     */
33
-    protected $ticket_selector_config;
34
-
35
-    /**
36
-     * @var \EE_Tax_Config $tax_config
37
-     */
38
-    protected $tax_config;
39
-
40
-
41
-
42
-    /**
43
-     * TicketSelectorSimple constructor.
44
-     *
45
-     * @param \EE_Event                  $event
46
-     * @param \EE_Ticket[]               $tickets
47
-     * @param int                        $max_attendees
48
-     * @param array                      $template_args
49
-     * @param string                     $date_format
50
-     * @param string                     $time_format
51
-     * @param \EE_Ticket_Selector_Config $ticket_selector_config
52
-     * @param \EE_Tax_Config             $tax_config
53
-     */
54
-    public function __construct(
55
-        \EE_Event $event,
56
-        array $tickets,
57
-        $max_attendees,
58
-        array $template_args,
59
-        $date_format = 'Y-m-d',
60
-        $time_format = 'g:i a',
61
-        \EE_Ticket_Selector_Config $ticket_selector_config = null,
62
-        \EE_Tax_Config $tax_config = null
63
-    ) {
64
-        $this->date_format = $date_format;
65
-        $this->time_format = $time_format;
66
-        // get EE_Ticket_Selector_Config and TicketDetails
67
-        $this->ticket_selector_config = isset (\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)
68
-            ? \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector
69
-            : new \EE_Ticket_Selector_Config();
70
-        // $template_settings->setDatetimeSelectorThreshold(2);
71
-        // \EEH_Debug_Tools::printr($template_settings->getShowDatetimeSelector(), 'getShowDatetimeSelector', __FILE__, __LINE__);
72
-        // \EEH_Debug_Tools::printr($template_settings->getDatetimeSelectorThreshold(), 'getDatetimeSelectorThreshold', __FILE__, __LINE__);
73
-        $this->tax_config = isset (\EE_Registry::instance()->CFG->tax_settings)
74
-            ? \EE_Registry::instance()->CFG->tax_settings
75
-            : new \EE_Tax_Config();
76
-        parent::__construct($event, $tickets, $max_attendees, $template_args);
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * sets any and all template args that are required for this Ticket Selector
83
-     *
84
-     * @return void
85
-     * @throws \EE_Error
86
-     */
87
-    protected function addTemplateArgs()
88
-    {
89
-        $row = 1;
90
-        $ticket_row_html = '';
91
-        $required_ticket_sold_out = false;
92
-        // flag to indicate that at least one taxable ticket has been encountered
93
-        $taxable_tickets = false;
94
-        $datetime_selector = null;
95
-        $this->template_args['datetime_selector'] = '';
96
-        if (
97
-            $this->ticket_selector_config->getShowDatetimeSelector()
98
-            !== \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
99
-        ) {
100
-            $datetime_selector = new DatetimeSelector(
101
-                $this->event,
102
-                $this->tickets,
103
-                $this->ticket_selector_config,
104
-                $this->date_format,
105
-                $this->time_format
106
-            );
107
-            $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
108
-        }
109
-        // loop through tickets
110
-        foreach ($this->tickets as $TKT_ID => $ticket) {
111
-            if ($ticket instanceof \EE_Ticket) {
112
-                $cols = 2;
113
-                $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets;
114
-                $ticket_selector_row = new TicketSelectorRowStandard(
115
-                    $ticket,
116
-                    new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
117
-                    $this->ticket_selector_config,
118
-                    $this->tax_config,
119
-                    $this->max_attendees,
120
-                    $row,
121
-                    $cols,
122
-                    $required_ticket_sold_out,
123
-                    $this->template_args['event_status'],
124
-                    $this->template_args['date_format'],
125
-                    $datetime_selector instanceof DatetimeSelector
126
-                        ? $datetime_selector->getTicketDatetimeClasses($ticket)
127
-                        : ''
128
-                );
129
-                $ticket_row_html .= $ticket_selector_row->getHtml();
130
-                $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
131
-                $row++;
132
-            }
133
-        }
134
-        $this->template_args['row'] = $row;
135
-        $this->template_args['ticket_row_html'] = $ticket_row_html;
136
-        $this->template_args['taxable_tickets'] = $taxable_tickets;
137
-        $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
138
-        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php';
139
-        remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
140
-    }
20
+	/**
21
+	 * @var string $date_format
22
+	 */
23
+	protected $date_format;
24
+
25
+	/**
26
+	 * @var string $time_format
27
+	 */
28
+	protected $time_format;
29
+
30
+	/**
31
+	 * @var \EE_Ticket_Selector_Config $ticket_selector_config
32
+	 */
33
+	protected $ticket_selector_config;
34
+
35
+	/**
36
+	 * @var \EE_Tax_Config $tax_config
37
+	 */
38
+	protected $tax_config;
39
+
40
+
41
+
42
+	/**
43
+	 * TicketSelectorSimple constructor.
44
+	 *
45
+	 * @param \EE_Event                  $event
46
+	 * @param \EE_Ticket[]               $tickets
47
+	 * @param int                        $max_attendees
48
+	 * @param array                      $template_args
49
+	 * @param string                     $date_format
50
+	 * @param string                     $time_format
51
+	 * @param \EE_Ticket_Selector_Config $ticket_selector_config
52
+	 * @param \EE_Tax_Config             $tax_config
53
+	 */
54
+	public function __construct(
55
+		\EE_Event $event,
56
+		array $tickets,
57
+		$max_attendees,
58
+		array $template_args,
59
+		$date_format = 'Y-m-d',
60
+		$time_format = 'g:i a',
61
+		\EE_Ticket_Selector_Config $ticket_selector_config = null,
62
+		\EE_Tax_Config $tax_config = null
63
+	) {
64
+		$this->date_format = $date_format;
65
+		$this->time_format = $time_format;
66
+		// get EE_Ticket_Selector_Config and TicketDetails
67
+		$this->ticket_selector_config = isset (\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)
68
+			? \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector
69
+			: new \EE_Ticket_Selector_Config();
70
+		// $template_settings->setDatetimeSelectorThreshold(2);
71
+		// \EEH_Debug_Tools::printr($template_settings->getShowDatetimeSelector(), 'getShowDatetimeSelector', __FILE__, __LINE__);
72
+		// \EEH_Debug_Tools::printr($template_settings->getDatetimeSelectorThreshold(), 'getDatetimeSelectorThreshold', __FILE__, __LINE__);
73
+		$this->tax_config = isset (\EE_Registry::instance()->CFG->tax_settings)
74
+			? \EE_Registry::instance()->CFG->tax_settings
75
+			: new \EE_Tax_Config();
76
+		parent::__construct($event, $tickets, $max_attendees, $template_args);
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * sets any and all template args that are required for this Ticket Selector
83
+	 *
84
+	 * @return void
85
+	 * @throws \EE_Error
86
+	 */
87
+	protected function addTemplateArgs()
88
+	{
89
+		$row = 1;
90
+		$ticket_row_html = '';
91
+		$required_ticket_sold_out = false;
92
+		// flag to indicate that at least one taxable ticket has been encountered
93
+		$taxable_tickets = false;
94
+		$datetime_selector = null;
95
+		$this->template_args['datetime_selector'] = '';
96
+		if (
97
+			$this->ticket_selector_config->getShowDatetimeSelector()
98
+			!== \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
99
+		) {
100
+			$datetime_selector = new DatetimeSelector(
101
+				$this->event,
102
+				$this->tickets,
103
+				$this->ticket_selector_config,
104
+				$this->date_format,
105
+				$this->time_format
106
+			);
107
+			$this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
108
+		}
109
+		// loop through tickets
110
+		foreach ($this->tickets as $TKT_ID => $ticket) {
111
+			if ($ticket instanceof \EE_Ticket) {
112
+				$cols = 2;
113
+				$taxable_tickets = $ticket->taxable() ? true : $taxable_tickets;
114
+				$ticket_selector_row = new TicketSelectorRowStandard(
115
+					$ticket,
116
+					new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
117
+					$this->ticket_selector_config,
118
+					$this->tax_config,
119
+					$this->max_attendees,
120
+					$row,
121
+					$cols,
122
+					$required_ticket_sold_out,
123
+					$this->template_args['event_status'],
124
+					$this->template_args['date_format'],
125
+					$datetime_selector instanceof DatetimeSelector
126
+						? $datetime_selector->getTicketDatetimeClasses($ticket)
127
+						: ''
128
+				);
129
+				$ticket_row_html .= $ticket_selector_row->getHtml();
130
+				$required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
131
+				$row++;
132
+			}
133
+		}
134
+		$this->template_args['row'] = $row;
135
+		$this->template_args['ticket_row_html'] = $ticket_row_html;
136
+		$this->template_args['taxable_tickets'] = $taxable_tickets;
137
+		$this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
138
+		$this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php';
139
+		remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
140
+	}
141 141
 
142 142
 
143 143
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
         $this->template_args['ticket_row_html'] = $ticket_row_html;
136 136
         $this->template_args['taxable_tickets'] = $taxable_tickets;
137 137
         $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
138
-        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php';
138
+        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'standard_ticket_selector.template.php';
139 139
         remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
140 140
     }
141 141
 
Please login to merge, or discard this patch.
core/EE_Cron_Tasks.core.php 2 patches
Indentation   +465 added lines, -465 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -12,165 +12,165 @@  discard block
 block discarded – undo
12 12
 class EE_Cron_Tasks extends EE_Base
13 13
 {
14 14
 
15
-    /**
16
-     * WordPress doesn't allow duplicate crons within 10 minutes of the original,
17
-     * so we'll set our retry time for just over 10 minutes to avoid that
18
-     */
19
-    const reschedule_timeout = 605;
20
-
21
-
22
-    /**
23
-     * @var EE_Cron_Tasks
24
-     */
25
-    private static $_instance;
26
-
27
-
28
-    /**
29
-     * @return EE_Cron_Tasks
30
-     */
31
-    public static function instance()
32
-    {
33
-        if ( ! self::$_instance instanceof EE_Cron_Tasks) {
34
-            self::$_instance = new self();
35
-        }
36
-        return self::$_instance;
37
-    }
38
-
39
-
40
-    /**
41
-     * @access private
42
-     */
43
-    private function __construct()
44
-    {
45
-        do_action('AHEE_log', __CLASS__, __FUNCTION__);
46
-        // verify that WP Cron is enabled
47
-        if (
48
-            defined('DISABLE_WP_CRON')
49
-            && DISABLE_WP_CRON
50
-            && is_admin()
51
-            && ! get_option('ee_disabled_wp_cron_check')
52
-        ) {
53
-            /**
54
-             * This needs to be delayed until after the config is loaded because EE_Cron_Tasks is constructed before
55
-             * config is loaded.
56
-             * This is intentionally using a anonymous function so that its not easily de-registered.  Client code
57
-             * wanting to not have this functionality can just register its own action at a priority after this one to
58
-             * reverse any changes.
59
-             */
60
-            add_action('AHEE__EE_System__load_core_configuration__complete', function () {
61
-                EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request = true;
62
-                EE_Registry::instance()->NET_CFG->update_config(true, false);
63
-                add_option('ee_disabled_wp_cron_check', 1, '', false);
64
-            });
65
-        }
66
-        // UPDATE TRANSACTION WITH PAYMENT
67
-        add_action(
68
-            'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
69
-            array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'),
70
-            10, 2
71
-        );
72
-        // FINALIZE ABANDONED TRANSACTIONS
73
-        add_action(
74
-            'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
75
-            array('EE_Cron_Tasks', 'check_for_abandoned_transactions'),
76
-            10, 1
77
-        );
15
+	/**
16
+	 * WordPress doesn't allow duplicate crons within 10 minutes of the original,
17
+	 * so we'll set our retry time for just over 10 minutes to avoid that
18
+	 */
19
+	const reschedule_timeout = 605;
20
+
21
+
22
+	/**
23
+	 * @var EE_Cron_Tasks
24
+	 */
25
+	private static $_instance;
26
+
27
+
28
+	/**
29
+	 * @return EE_Cron_Tasks
30
+	 */
31
+	public static function instance()
32
+	{
33
+		if ( ! self::$_instance instanceof EE_Cron_Tasks) {
34
+			self::$_instance = new self();
35
+		}
36
+		return self::$_instance;
37
+	}
38
+
39
+
40
+	/**
41
+	 * @access private
42
+	 */
43
+	private function __construct()
44
+	{
45
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
46
+		// verify that WP Cron is enabled
47
+		if (
48
+			defined('DISABLE_WP_CRON')
49
+			&& DISABLE_WP_CRON
50
+			&& is_admin()
51
+			&& ! get_option('ee_disabled_wp_cron_check')
52
+		) {
53
+			/**
54
+			 * This needs to be delayed until after the config is loaded because EE_Cron_Tasks is constructed before
55
+			 * config is loaded.
56
+			 * This is intentionally using a anonymous function so that its not easily de-registered.  Client code
57
+			 * wanting to not have this functionality can just register its own action at a priority after this one to
58
+			 * reverse any changes.
59
+			 */
60
+			add_action('AHEE__EE_System__load_core_configuration__complete', function () {
61
+				EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request = true;
62
+				EE_Registry::instance()->NET_CFG->update_config(true, false);
63
+				add_option('ee_disabled_wp_cron_check', 1, '', false);
64
+			});
65
+		}
66
+		// UPDATE TRANSACTION WITH PAYMENT
67
+		add_action(
68
+			'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
69
+			array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'),
70
+			10, 2
71
+		);
72
+		// FINALIZE ABANDONED TRANSACTIONS
73
+		add_action(
74
+			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
75
+			array('EE_Cron_Tasks', 'check_for_abandoned_transactions'),
76
+			10, 1
77
+		);
78 78
 		// EXPIRED TRANSACTION CHECK
79 79
 		add_action(
80 80
 			'AHEE__EE_Cron_Tasks__expired_transaction_check',
81 81
 			array( 'EE_Cron_Tasks', 'expired_transaction_check' ),
82 82
 			10, 1
83 83
 		);
84
-        // CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA
85
-        add_action(
86
-            'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
87
-            array('EE_Cron_Tasks', 'clean_out_junk_transactions')
88
-        );
89
-        // logging
90
-        add_action(
91
-            'AHEE__EE_System__load_core_configuration__complete',
92
-            array('EE_Cron_Tasks', 'log_scheduled_ee_crons')
93
-        );
94
-        EE_Registry::instance()->load_lib('Messages_Scheduler');
95
-        //clean out old gateway logs
96
-        add_action(
97
-            'AHEE_EE_Cron_Tasks__clean_out_old_gateway_logs',
98
-            array('EE_Cron_Tasks', 'clean_out_old_gateway_logs')
99
-        );
100
-    }
101
-
102
-
103
-    /**
104
-     * @access protected
105
-     * @return void
106
-     */
107
-    public static function log_scheduled_ee_crons()
108
-    {
109
-        $ee_crons = array(
110
-            'AHEE__EE_Cron_Tasks__update_transaction_with_payment',
111
-            'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
112
-            'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
113
-        );
114
-        $crons = (array) get_option('cron');
115
-        if ( ! is_array($crons)) {
116
-            return;
117
-        }
118
-        foreach ($crons as $timestamp => $cron) {
119
-            foreach ($ee_crons as $ee_cron) {
120
-                if (isset($cron[$ee_cron]) && is_array($cron[$ee_cron])) {
121
-                    do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron');
122
-                    foreach ($cron[$ee_cron] as $ee_cron_details) {
123
-                        if ( ! empty($ee_cron_details['args'])) {
124
-                            do_action(
125
-                                'AHEE_log',
126
-                                __CLASS__,
127
-                                __FUNCTION__,
128
-                                print_r($ee_cron_details['args'], true),
129
-                                "{$ee_cron} args"
130
-                            );
131
-                        }
132
-                    }
133
-                }
134
-            }
135
-        }
136
-    }
137
-
138
-
139
-
140
-    /**
141
-     * reschedule_cron_for_transactions_if_maintenance_mode
142
-     * if Maintenance Mode is active, this will reschedule a cron to run again in 10 minutes
143
-     *
144
-     * @param string $cron_task
145
-     * @param array  $TXN_IDs
146
-     * @return bool
147
-     * @throws \DomainException
148
-     */
84
+		// CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA
85
+		add_action(
86
+			'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
87
+			array('EE_Cron_Tasks', 'clean_out_junk_transactions')
88
+		);
89
+		// logging
90
+		add_action(
91
+			'AHEE__EE_System__load_core_configuration__complete',
92
+			array('EE_Cron_Tasks', 'log_scheduled_ee_crons')
93
+		);
94
+		EE_Registry::instance()->load_lib('Messages_Scheduler');
95
+		//clean out old gateway logs
96
+		add_action(
97
+			'AHEE_EE_Cron_Tasks__clean_out_old_gateway_logs',
98
+			array('EE_Cron_Tasks', 'clean_out_old_gateway_logs')
99
+		);
100
+	}
101
+
102
+
103
+	/**
104
+	 * @access protected
105
+	 * @return void
106
+	 */
107
+	public static function log_scheduled_ee_crons()
108
+	{
109
+		$ee_crons = array(
110
+			'AHEE__EE_Cron_Tasks__update_transaction_with_payment',
111
+			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
112
+			'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
113
+		);
114
+		$crons = (array) get_option('cron');
115
+		if ( ! is_array($crons)) {
116
+			return;
117
+		}
118
+		foreach ($crons as $timestamp => $cron) {
119
+			foreach ($ee_crons as $ee_cron) {
120
+				if (isset($cron[$ee_cron]) && is_array($cron[$ee_cron])) {
121
+					do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron');
122
+					foreach ($cron[$ee_cron] as $ee_cron_details) {
123
+						if ( ! empty($ee_cron_details['args'])) {
124
+							do_action(
125
+								'AHEE_log',
126
+								__CLASS__,
127
+								__FUNCTION__,
128
+								print_r($ee_cron_details['args'], true),
129
+								"{$ee_cron} args"
130
+							);
131
+						}
132
+					}
133
+				}
134
+			}
135
+		}
136
+	}
137
+
138
+
139
+
140
+	/**
141
+	 * reschedule_cron_for_transactions_if_maintenance_mode
142
+	 * if Maintenance Mode is active, this will reschedule a cron to run again in 10 minutes
143
+	 *
144
+	 * @param string $cron_task
145
+	 * @param array  $TXN_IDs
146
+	 * @return bool
147
+	 * @throws \DomainException
148
+	 */
149 149
 	public static function reschedule_cron_for_transactions_if_maintenance_mode( $cron_task, array $TXN_IDs ) {
150
-        if( ! method_exists('EE_Cron_Tasks', $cron_task)) {
151
-            throw new \DomainException(
152
-                sprintf(
153
-                    __('"%1$s" is not valid method on EE_Cron_Tasks.', 'event_espresso'),
154
-                    $cron_task
155
-                )
156
-            );
157
-        }
150
+		if( ! method_exists('EE_Cron_Tasks', $cron_task)) {
151
+			throw new \DomainException(
152
+				sprintf(
153
+					__('"%1$s" is not valid method on EE_Cron_Tasks.', 'event_espresso'),
154
+					$cron_task
155
+				)
156
+			);
157
+		}
158 158
 		// reschedule the cron if we can't hit the db right now
159 159
 		if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
160 160
 			foreach( $TXN_IDs as $TXN_ID => $additional_vars ) {
161
-                // ensure $additional_vars is an array
162
-                $additional_vars = is_array($additional_vars) ? $additional_vars : array($additional_vars);
161
+				// ensure $additional_vars is an array
162
+				$additional_vars = is_array($additional_vars) ? $additional_vars : array($additional_vars);
163 163
 				// reset cron job for the TXN
164
-                call_user_func_array(
165
-                    array('EE_Cron_Tasks', $cron_task),
166
-                    array_merge(
167
-                        array(
168
-                            time() + (10 * MINUTE_IN_SECONDS),
169
-                            $TXN_ID
170
-                        ),
171
-                        $additional_vars
172
-                    )
173
-                );
164
+				call_user_func_array(
165
+					array('EE_Cron_Tasks', $cron_task),
166
+					array_merge(
167
+						array(
168
+							time() + (10 * MINUTE_IN_SECONDS),
169
+							$TXN_ID
170
+						),
171
+						$additional_vars
172
+					)
173
+				);
174 174
 			}
175 175
 			return true;
176 176
 		}
@@ -180,85 +180,85 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
 
183
-    /****************  UPDATE TRANSACTION WITH PAYMENT ****************/
184
-
185
-
186
-    /**
187
-     * array of TXN IDs and the payment
188
-     *
189
-     * @var array
190
-     */
191
-    protected static $_update_transactions_with_payment = array();
192
-
193
-
194
-    /**
195
-     * schedule_update_transaction_with_payment
196
-     * sets a wp_schedule_single_event() for updating any TXNs that may
197
-     * require updating due to recently received payments
198
-     *
199
-     * @param int $timestamp
200
-     * @param int $TXN_ID
201
-     * @param int $PAY_ID
202
-     */
203
-    public static function schedule_update_transaction_with_payment(
204
-        $timestamp,
205
-        $TXN_ID,
206
-        $PAY_ID
207
-    ) {
208
-        do_action('AHEE_log', __CLASS__, __FUNCTION__);
209
-        // validate $TXN_ID and $timestamp
210
-        $TXN_ID    = absint($TXN_ID);
211
-        $timestamp = absint($timestamp);
212
-        if ($TXN_ID && $timestamp) {
213
-            wp_schedule_single_event(
214
-                $timestamp,
215
-                'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
216
-                array($TXN_ID, $PAY_ID)
217
-            );
218
-        }
219
-    }
220
-
221
-
222
-    /**
223
-     * setup_update_for_transaction_with_payment
224
-     * this is the callback for the action hook:
225
-     * 'AHEE__EE_Cron_Tasks__update_transaction_with_payment'
226
-     * which is setup by EE_Cron_Tasks::schedule_update_transaction_with_payment().
227
-     * The passed TXN_ID and associated payment gets added to an array, and then
228
-     * the EE_Cron_Tasks::update_transaction_with_payment() function is hooked into
229
-     * 'shutdown' which will actually handle the processing of any
230
-     * transactions requiring updating, because doing so now would be too early
231
-     * and the required resources may not be available
232
-     *
233
-     * @param int $TXN_ID
234
-     * @param int $PAY_ID
235
-     */
236
-    public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $PAY_ID = 0)
237
-    {
238
-        do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
239
-        if (absint($TXN_ID)) {
240
-            self::$_update_transactions_with_payment[$TXN_ID] = $PAY_ID;
241
-            add_action(
242
-                'shutdown',
243
-                array('EE_Cron_Tasks', 'update_transaction_with_payment'),
244
-                5
245
-            );
246
-        }
247
-    }
248
-
249
-
250
-    /**
251
-     * update_transaction_with_payment
252
-     * loops through the self::$_abandoned_transactions array
253
-     * and attempts to finalize any TXNs that have not been completed
254
-     * but have had their sessions expired, most likely due to a user not
255
-     * returning from an off-site payment gateway
256
-     *
257
-     * @throws \EE_Error
258
-     */
259
-    public static function update_transaction_with_payment()
260
-    {
261
-        do_action('AHEE_log', __CLASS__, __FUNCTION__);
183
+	/****************  UPDATE TRANSACTION WITH PAYMENT ****************/
184
+
185
+
186
+	/**
187
+	 * array of TXN IDs and the payment
188
+	 *
189
+	 * @var array
190
+	 */
191
+	protected static $_update_transactions_with_payment = array();
192
+
193
+
194
+	/**
195
+	 * schedule_update_transaction_with_payment
196
+	 * sets a wp_schedule_single_event() for updating any TXNs that may
197
+	 * require updating due to recently received payments
198
+	 *
199
+	 * @param int $timestamp
200
+	 * @param int $TXN_ID
201
+	 * @param int $PAY_ID
202
+	 */
203
+	public static function schedule_update_transaction_with_payment(
204
+		$timestamp,
205
+		$TXN_ID,
206
+		$PAY_ID
207
+	) {
208
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
209
+		// validate $TXN_ID and $timestamp
210
+		$TXN_ID    = absint($TXN_ID);
211
+		$timestamp = absint($timestamp);
212
+		if ($TXN_ID && $timestamp) {
213
+			wp_schedule_single_event(
214
+				$timestamp,
215
+				'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
216
+				array($TXN_ID, $PAY_ID)
217
+			);
218
+		}
219
+	}
220
+
221
+
222
+	/**
223
+	 * setup_update_for_transaction_with_payment
224
+	 * this is the callback for the action hook:
225
+	 * 'AHEE__EE_Cron_Tasks__update_transaction_with_payment'
226
+	 * which is setup by EE_Cron_Tasks::schedule_update_transaction_with_payment().
227
+	 * The passed TXN_ID and associated payment gets added to an array, and then
228
+	 * the EE_Cron_Tasks::update_transaction_with_payment() function is hooked into
229
+	 * 'shutdown' which will actually handle the processing of any
230
+	 * transactions requiring updating, because doing so now would be too early
231
+	 * and the required resources may not be available
232
+	 *
233
+	 * @param int $TXN_ID
234
+	 * @param int $PAY_ID
235
+	 */
236
+	public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $PAY_ID = 0)
237
+	{
238
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
239
+		if (absint($TXN_ID)) {
240
+			self::$_update_transactions_with_payment[$TXN_ID] = $PAY_ID;
241
+			add_action(
242
+				'shutdown',
243
+				array('EE_Cron_Tasks', 'update_transaction_with_payment'),
244
+				5
245
+			);
246
+		}
247
+	}
248
+
249
+
250
+	/**
251
+	 * update_transaction_with_payment
252
+	 * loops through the self::$_abandoned_transactions array
253
+	 * and attempts to finalize any TXNs that have not been completed
254
+	 * but have had their sessions expired, most likely due to a user not
255
+	 * returning from an off-site payment gateway
256
+	 *
257
+	 * @throws \EE_Error
258
+	 */
259
+	public static function update_transaction_with_payment()
260
+	{
261
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
262 262
 		if (
263 263
 			// are there any TXNs that need cleaning up ?
264 264
 			empty( self::$_update_transactions_with_payment )
@@ -268,119 +268,119 @@  discard block
 block discarded – undo
268 268
 				self::$_update_transactions_with_payment
269 269
 			)
270 270
 		) {
271
-            return;
272
-        }
273
-        /** @type EE_Payment_Processor $payment_processor */
274
-        $payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
275
-        // set revisit flag for payment processor
276
-        $payment_processor->set_revisit(false);
277
-        // load EEM_Transaction
278
-        EE_Registry::instance()->load_model('Transaction');
279
-        foreach (self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID) {
280
-            // reschedule the cron if we can't hit the db right now
281
-            if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
282
-                // reset cron job for updating the TXN
283
-                EE_Cron_Tasks::schedule_update_transaction_with_payment(
284
-                    time() + EE_Cron_Tasks::reschedule_timeout,
285
-                    $TXN_ID,
286
-                    $PAY_ID
287
-                );
288
-                continue;
289
-            }
290
-            $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
291
-            $payment     = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
292
-            // verify transaction
293
-            if ($transaction instanceof EE_Transaction && $payment instanceof EE_Payment) {
294
-                // now try to update the TXN with any payments
295
-                $payment_processor->update_txn_based_on_payment($transaction, $payment, true, true);
296
-            }
297
-            unset(self::$_update_transactions_with_payment[$TXN_ID]);
298
-        }
299
-    }
300
-
301
-
302
-
303
-    /************  END OF UPDATE TRANSACTION WITH PAYMENT  ************/
304
-
305
-
306
-    /*****************  FINALIZE ABANDONED TRANSACTIONS *****************/
307
-
308
-
309
-    /**
310
-     * array of TXN IDs
311
-     *
312
-     * @var array
313
-     */
314
-    protected static $_abandoned_transactions = array();
315
-
316
-
317
-    /**
318
-     * schedule_finalize_abandoned_transactions_check
319
-     * sets a wp_schedule_single_event() for finalizing any TXNs that may
320
-     * have been abandoned during the registration process
321
-     *
322
-     * @param int $timestamp
323
-     * @param int $TXN_ID
324
-     */
325
-    public static function schedule_finalize_abandoned_transactions_check(
326
-        $timestamp,
327
-        $TXN_ID
328
-    ) {
329
-        // validate $TXN_ID and $timestamp
330
-        $TXN_ID    = absint($TXN_ID);
331
-        $timestamp = absint($timestamp);
332
-        do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
333
-        if ($TXN_ID && $timestamp) {
334
-            wp_schedule_single_event(
335
-                $timestamp,
336
-                'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
337
-                array($TXN_ID)
338
-            );
339
-        }
340
-    }
341
-
342
-
343
-    /**
344
-     * check_for_abandoned_transactions
345
-     * this is the callback for the action hook:
346
-     * 'AHEE__EE_Cron_Tasks__espresso_finalize_abandoned_transactions'
347
-     * which is utilized by wp_schedule_single_event()
348
-     * in EE_SPCO_Reg_Step_Payment_Options::_post_payment_processing().
349
-     * The passed TXN_ID gets added to an array, and then the
350
-     * espresso_finalize_abandoned_transactions() function is hooked into
351
-     * 'AHEE__EE_System__core_loaded_and_ready' which will actually handle the
352
-     * processing of any abandoned transactions, because doing so now would be
353
-     * too early and the required resources may not be available
354
-     *
355
-     * @param int $TXN_ID
356
-     */
357
-    public static function check_for_abandoned_transactions($TXN_ID = 0)
358
-    {
359
-        do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
360
-        if (absint($TXN_ID)) {
361
-            self::$_abandoned_transactions[] = $TXN_ID;
362
-            add_action(
363
-                'shutdown',
364
-                array('EE_Cron_Tasks', 'finalize_abandoned_transactions'),
365
-                5
366
-            );
367
-        }
368
-    }
369
-
370
-
371
-    /**
372
-     * finalize_abandoned_transactions
373
-     * loops through the self::$_abandoned_transactions array
374
-     * and attempts to finalize any TXNs that have not been completed
375
-     * but have had their sessions expired, most likely due to a user not
376
-     * returning from an off-site payment gateway
377
-     *
378
-     * @throws \EE_Error
379
-     */
380
-    public static function finalize_abandoned_transactions()
381
-    {
382
-        do_action('AHEE_log', __CLASS__, __FUNCTION__);
383
-        if (
271
+			return;
272
+		}
273
+		/** @type EE_Payment_Processor $payment_processor */
274
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
275
+		// set revisit flag for payment processor
276
+		$payment_processor->set_revisit(false);
277
+		// load EEM_Transaction
278
+		EE_Registry::instance()->load_model('Transaction');
279
+		foreach (self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID) {
280
+			// reschedule the cron if we can't hit the db right now
281
+			if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
282
+				// reset cron job for updating the TXN
283
+				EE_Cron_Tasks::schedule_update_transaction_with_payment(
284
+					time() + EE_Cron_Tasks::reschedule_timeout,
285
+					$TXN_ID,
286
+					$PAY_ID
287
+				);
288
+				continue;
289
+			}
290
+			$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
291
+			$payment     = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
292
+			// verify transaction
293
+			if ($transaction instanceof EE_Transaction && $payment instanceof EE_Payment) {
294
+				// now try to update the TXN with any payments
295
+				$payment_processor->update_txn_based_on_payment($transaction, $payment, true, true);
296
+			}
297
+			unset(self::$_update_transactions_with_payment[$TXN_ID]);
298
+		}
299
+	}
300
+
301
+
302
+
303
+	/************  END OF UPDATE TRANSACTION WITH PAYMENT  ************/
304
+
305
+
306
+	/*****************  FINALIZE ABANDONED TRANSACTIONS *****************/
307
+
308
+
309
+	/**
310
+	 * array of TXN IDs
311
+	 *
312
+	 * @var array
313
+	 */
314
+	protected static $_abandoned_transactions = array();
315
+
316
+
317
+	/**
318
+	 * schedule_finalize_abandoned_transactions_check
319
+	 * sets a wp_schedule_single_event() for finalizing any TXNs that may
320
+	 * have been abandoned during the registration process
321
+	 *
322
+	 * @param int $timestamp
323
+	 * @param int $TXN_ID
324
+	 */
325
+	public static function schedule_finalize_abandoned_transactions_check(
326
+		$timestamp,
327
+		$TXN_ID
328
+	) {
329
+		// validate $TXN_ID and $timestamp
330
+		$TXN_ID    = absint($TXN_ID);
331
+		$timestamp = absint($timestamp);
332
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
333
+		if ($TXN_ID && $timestamp) {
334
+			wp_schedule_single_event(
335
+				$timestamp,
336
+				'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
337
+				array($TXN_ID)
338
+			);
339
+		}
340
+	}
341
+
342
+
343
+	/**
344
+	 * check_for_abandoned_transactions
345
+	 * this is the callback for the action hook:
346
+	 * 'AHEE__EE_Cron_Tasks__espresso_finalize_abandoned_transactions'
347
+	 * which is utilized by wp_schedule_single_event()
348
+	 * in EE_SPCO_Reg_Step_Payment_Options::_post_payment_processing().
349
+	 * The passed TXN_ID gets added to an array, and then the
350
+	 * espresso_finalize_abandoned_transactions() function is hooked into
351
+	 * 'AHEE__EE_System__core_loaded_and_ready' which will actually handle the
352
+	 * processing of any abandoned transactions, because doing so now would be
353
+	 * too early and the required resources may not be available
354
+	 *
355
+	 * @param int $TXN_ID
356
+	 */
357
+	public static function check_for_abandoned_transactions($TXN_ID = 0)
358
+	{
359
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
360
+		if (absint($TXN_ID)) {
361
+			self::$_abandoned_transactions[] = $TXN_ID;
362
+			add_action(
363
+				'shutdown',
364
+				array('EE_Cron_Tasks', 'finalize_abandoned_transactions'),
365
+				5
366
+			);
367
+		}
368
+	}
369
+
370
+
371
+	/**
372
+	 * finalize_abandoned_transactions
373
+	 * loops through the self::$_abandoned_transactions array
374
+	 * and attempts to finalize any TXNs that have not been completed
375
+	 * but have had their sessions expired, most likely due to a user not
376
+	 * returning from an off-site payment gateway
377
+	 *
378
+	 * @throws \EE_Error
379
+	 */
380
+	public static function finalize_abandoned_transactions()
381
+	{
382
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
383
+		if (
384 384
 			// are there any TXNs that need cleaning up ?
385 385
 			empty( self::$_abandoned_transactions )
386 386
 			// reschedule the cron if we can't hit the db right now
@@ -389,45 +389,45 @@  discard block
 block discarded – undo
389 389
 				self::$_abandoned_transactions
390 390
 			)
391 391
 		) {
392
-            return;
393
-        }
394
-        /** @type EE_Transaction_Processor $transaction_processor */
395
-        $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
396
-        // set revisit flag for txn processor
397
-        $transaction_processor->set_revisit(false);
398
-        /** @type EE_Payment_Processor $payment_processor */
399
-        $payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
400
-        // load EEM_Transaction
401
-        EE_Registry::instance()->load_model('Transaction');
402
-        foreach (self::$_abandoned_transactions as $TXN_ID) {
403
-            do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
404
-            // reschedule the cron if we can't hit the db right now
405
-            if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
406
-                // reset cron job for finalizing the TXN
407
-                EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
408
-                    time() + EE_Cron_Tasks::reschedule_timeout,
409
-                    $TXN_ID
410
-                );
411
-                continue;
412
-            }
413
-            $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
414
-            // verify transaction
415
-            if ($transaction instanceof EE_Transaction) {
416
-                // don't finalize the TXN if it has already been completed
417
-                if ($transaction->all_reg_steps_completed() === true) {
418
-                    continue;
419
-                }
420
-                // let's simulate an IPN here which will trigger any notifications that need to go out
421
-                $payment_processor->update_txn_based_on_payment($transaction, $transaction->last_payment(), true,
422
-                    true);
423
-            }
424
-            unset(self::$_abandoned_transactions[$TXN_ID]);
425
-        }
426
-    }
427
-
428
-
429
-
430
-    /*************  END OF FINALIZE ABANDONED TRANSACTIONS  *************/
392
+			return;
393
+		}
394
+		/** @type EE_Transaction_Processor $transaction_processor */
395
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
396
+		// set revisit flag for txn processor
397
+		$transaction_processor->set_revisit(false);
398
+		/** @type EE_Payment_Processor $payment_processor */
399
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
400
+		// load EEM_Transaction
401
+		EE_Registry::instance()->load_model('Transaction');
402
+		foreach (self::$_abandoned_transactions as $TXN_ID) {
403
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
404
+			// reschedule the cron if we can't hit the db right now
405
+			if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
406
+				// reset cron job for finalizing the TXN
407
+				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
408
+					time() + EE_Cron_Tasks::reschedule_timeout,
409
+					$TXN_ID
410
+				);
411
+				continue;
412
+			}
413
+			$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
414
+			// verify transaction
415
+			if ($transaction instanceof EE_Transaction) {
416
+				// don't finalize the TXN if it has already been completed
417
+				if ($transaction->all_reg_steps_completed() === true) {
418
+					continue;
419
+				}
420
+				// let's simulate an IPN here which will trigger any notifications that need to go out
421
+				$payment_processor->update_txn_based_on_payment($transaction, $transaction->last_payment(), true,
422
+					true);
423
+			}
424
+			unset(self::$_abandoned_transactions[$TXN_ID]);
425
+		}
426
+	}
427
+
428
+
429
+
430
+	/*************  END OF FINALIZE ABANDONED TRANSACTIONS  *************/
431 431
 
432 432
 
433 433
 	/*****************  EXPIRED TRANSACTION CHECK *****************/
@@ -496,12 +496,12 @@  discard block
 block discarded – undo
496 496
 
497 497
 
498 498
 
499
-    /**
500
-     * process_expired_transactions
501
-     * loops through the self::$_expired_transactions array and processes any failed TXNs
502
-     *
503
-     * @throws \EE_Error
504
-     */
499
+	/**
500
+	 * process_expired_transactions
501
+	 * loops through the self::$_expired_transactions array and processes any failed TXNs
502
+	 *
503
+	 * @throws \EE_Error
504
+	 */
505 505
 	public static function process_expired_transactions() {
506 506
 		if (
507 507
 			// are there any TXNs that need cleaning up ?
@@ -512,58 +512,58 @@  discard block
 block discarded – undo
512 512
 				self::$_expired_transactions
513 513
 			)
514 514
 		) {
515
-            return;
516
-        }
517
-        /** @type EE_Transaction_Processor $transaction_processor */
518
-        $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
519
-        // set revisit flag for txn processor
520
-        $transaction_processor->set_revisit( false );
521
-         // load EEM_Transaction
522
-        EE_Registry::instance()->load_model( 'Transaction' );
523
-        foreach ( self::$_expired_transactions as $TXN_ID ) {
524
-            $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
525
-            // verify transaction and whether it is failed or not
526
-            if ( $transaction instanceof EE_Transaction) {
527
-                switch( $transaction->status_ID() ) {
528
-                    // Completed TXNs
529
-                    case EEM_Transaction::complete_status_code :
530
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__completed_transaction', $transaction );
531
-                        break;
532
-                    // Overpaid TXNs
533
-                    case EEM_Transaction::overpaid_status_code :
534
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__overpaid_transaction', $transaction );
535
-                        break;
536
-                    // Incomplete TXNs
537
-                    case EEM_Transaction::incomplete_status_code :
538
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', $transaction );
539
-                        // todo : merge the finalize_abandoned_transactions cron into this one...
540
-                        // todo : move business logic into EE_Transaction_Processor for finalizing abandoned transactions
541
-                        break;
542
-                    // Failed TXNs
543
-                    case EEM_Transaction::failed_status_code :
544
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', $transaction );
545
-                        // todo : perform garbage collection here and remove clean_out_junk_transactions()
546
-                        //$registrations = $transaction->registrations();
547
-                        //if ( ! empty( $registrations ) ) {
548
-                        //	foreach ( $registrations as $registration ) {
549
-                        //		if ( $registration instanceof EE_Registration ) {
550
-                        //$delete_registration = true;
551
-                        //if ( $registration->attendee() instanceof EE_Attendee ) {
552
-                        //	$delete_registration = false;
553
-                        //}
554
-                        //if ( $delete_registration ) {
555
-                        //	$registration->delete_permanently();
556
-                        //	$registration->delete_related_permanently();
557
-                        //}
558
-                        //		}
559
-                        //	}
560
-                        //}
561
-                        break;
562
-                }
563
-
564
-            }
565
-            unset( self::$_expired_transactions[ $TXN_ID ] );
566
-        }
515
+			return;
516
+		}
517
+		/** @type EE_Transaction_Processor $transaction_processor */
518
+		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
519
+		// set revisit flag for txn processor
520
+		$transaction_processor->set_revisit( false );
521
+		 // load EEM_Transaction
522
+		EE_Registry::instance()->load_model( 'Transaction' );
523
+		foreach ( self::$_expired_transactions as $TXN_ID ) {
524
+			$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
525
+			// verify transaction and whether it is failed or not
526
+			if ( $transaction instanceof EE_Transaction) {
527
+				switch( $transaction->status_ID() ) {
528
+					// Completed TXNs
529
+					case EEM_Transaction::complete_status_code :
530
+						do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__completed_transaction', $transaction );
531
+						break;
532
+					// Overpaid TXNs
533
+					case EEM_Transaction::overpaid_status_code :
534
+						do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__overpaid_transaction', $transaction );
535
+						break;
536
+					// Incomplete TXNs
537
+					case EEM_Transaction::incomplete_status_code :
538
+						do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', $transaction );
539
+						// todo : merge the finalize_abandoned_transactions cron into this one...
540
+						// todo : move business logic into EE_Transaction_Processor for finalizing abandoned transactions
541
+						break;
542
+					// Failed TXNs
543
+					case EEM_Transaction::failed_status_code :
544
+						do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', $transaction );
545
+						// todo : perform garbage collection here and remove clean_out_junk_transactions()
546
+						//$registrations = $transaction->registrations();
547
+						//if ( ! empty( $registrations ) ) {
548
+						//	foreach ( $registrations as $registration ) {
549
+						//		if ( $registration instanceof EE_Registration ) {
550
+						//$delete_registration = true;
551
+						//if ( $registration->attendee() instanceof EE_Attendee ) {
552
+						//	$delete_registration = false;
553
+						//}
554
+						//if ( $delete_registration ) {
555
+						//	$registration->delete_permanently();
556
+						//	$registration->delete_related_permanently();
557
+						//}
558
+						//		}
559
+						//	}
560
+						//}
561
+						break;
562
+				}
563
+
564
+			}
565
+			unset( self::$_expired_transactions[ $TXN_ID ] );
566
+		}
567 567
 	}
568 568
 
569 569
 
@@ -571,33 +571,33 @@  discard block
 block discarded – undo
571 571
 	/*************  END OF EXPIRED TRANSACTION CHECK  *************/
572 572
 
573 573
 
574
-    /************* START CLEAN UP BOT TRANSACTIONS **********************/
575
-
576
-    //when a transaction is initially made, schedule this check.
577
-    //if it has NO REG data by the time it has expired, forget about it
578
-    public static function clean_out_junk_transactions()
579
-    {
580
-        if (EE_Maintenance_Mode::instance()->models_can_query()) {
581
-            EEM_Transaction::instance('')->delete_junk_transactions();
582
-            EEM_Registration::instance('')->delete_registrations_with_no_transaction();
583
-            EEM_Line_Item::instance('')->delete_line_items_with_no_transaction();
584
-        }
585
-    }
586
-
587
-
588
-
589
-    /**
590
-     * Deletes old gateway logs. After about a week we usually don't need them for debugging. But folks can filter that.
591
-     */
592
-    public static function clean_out_old_gateway_logs(){
593
-        if (EE_Maintenance_Mode::instance()->models_can_query()) {
594
-            $time_diff_for_comparison = apply_filters(
595
-                'FHEE__EE_Cron_Tasks__clean_out_old_gateway_logs__time_diff_for_comparison',
596
-                "-1 week"
597
-            );
598
-            EEM_Change_Log::instance()->delete_gateway_logs_older_than(new DateTime($time_diff_for_comparison));
599
-        }
600
-    }
574
+	/************* START CLEAN UP BOT TRANSACTIONS **********************/
575
+
576
+	//when a transaction is initially made, schedule this check.
577
+	//if it has NO REG data by the time it has expired, forget about it
578
+	public static function clean_out_junk_transactions()
579
+	{
580
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
581
+			EEM_Transaction::instance('')->delete_junk_transactions();
582
+			EEM_Registration::instance('')->delete_registrations_with_no_transaction();
583
+			EEM_Line_Item::instance('')->delete_line_items_with_no_transaction();
584
+		}
585
+	}
586
+
587
+
588
+
589
+	/**
590
+	 * Deletes old gateway logs. After about a week we usually don't need them for debugging. But folks can filter that.
591
+	 */
592
+	public static function clean_out_old_gateway_logs(){
593
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
594
+			$time_diff_for_comparison = apply_filters(
595
+				'FHEE__EE_Cron_Tasks__clean_out_old_gateway_logs__time_diff_for_comparison',
596
+				"-1 week"
597
+			);
598
+			EEM_Change_Log::instance()->delete_gateway_logs_older_than(new DateTime($time_diff_for_comparison));
599
+		}
600
+	}
601 601
 
602 602
 
603 603
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
              * wanting to not have this functionality can just register its own action at a priority after this one to
58 58
              * reverse any changes.
59 59
              */
60
-            add_action('AHEE__EE_System__load_core_configuration__complete', function () {
60
+            add_action('AHEE__EE_System__load_core_configuration__complete', function() {
61 61
                 EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request = true;
62 62
                 EE_Registry::instance()->NET_CFG->update_config(true, false);
63 63
                 add_option('ee_disabled_wp_cron_check', 1, '', false);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		// EXPIRED TRANSACTION CHECK
79 79
 		add_action(
80 80
 			'AHEE__EE_Cron_Tasks__expired_transaction_check',
81
-			array( 'EE_Cron_Tasks', 'expired_transaction_check' ),
81
+			array('EE_Cron_Tasks', 'expired_transaction_check'),
82 82
 			10, 1
83 83
 		);
84 84
         // CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
      * @return bool
147 147
      * @throws \DomainException
148 148
      */
149
-	public static function reschedule_cron_for_transactions_if_maintenance_mode( $cron_task, array $TXN_IDs ) {
150
-        if( ! method_exists('EE_Cron_Tasks', $cron_task)) {
149
+	public static function reschedule_cron_for_transactions_if_maintenance_mode($cron_task, array $TXN_IDs) {
150
+        if ( ! method_exists('EE_Cron_Tasks', $cron_task)) {
151 151
             throw new \DomainException(
152 152
                 sprintf(
153 153
                     __('"%1$s" is not valid method on EE_Cron_Tasks.', 'event_espresso'),
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
             );
157 157
         }
158 158
 		// reschedule the cron if we can't hit the db right now
159
-		if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
160
-			foreach( $TXN_IDs as $TXN_ID => $additional_vars ) {
159
+		if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
160
+			foreach ($TXN_IDs as $TXN_ID => $additional_vars) {
161 161
                 // ensure $additional_vars is an array
162 162
                 $additional_vars = is_array($additional_vars) ? $additional_vars : array($additional_vars);
163 163
 				// reset cron job for the TXN
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         do_action('AHEE_log', __CLASS__, __FUNCTION__);
262 262
 		if (
263 263
 			// are there any TXNs that need cleaning up ?
264
-			empty( self::$_update_transactions_with_payment )
264
+			empty(self::$_update_transactions_with_payment)
265 265
 			// reschedule the cron if we can't hit the db right now
266 266
 			|| EE_Cron_Tasks::reschedule_cron_for_transactions_if_maintenance_mode(
267 267
 				'schedule_update_transaction_with_payment',
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         do_action('AHEE_log', __CLASS__, __FUNCTION__);
383 383
         if (
384 384
 			// are there any TXNs that need cleaning up ?
385
-			empty( self::$_abandoned_transactions )
385
+			empty(self::$_abandoned_transactions)
386 386
 			// reschedule the cron if we can't hit the db right now
387 387
 			|| EE_Cron_Tasks::reschedule_cron_for_transactions_if_maintenance_mode(
388 388
 				'schedule_finalize_abandoned_transactions_check',
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
 		$TXN_ID
456 456
 	) {
457 457
 		// validate $TXN_ID and $timestamp
458
-		$TXN_ID = absint( $TXN_ID );
459
-		$timestamp = absint( $timestamp );
460
-		if ( $TXN_ID && $timestamp ) {
458
+		$TXN_ID = absint($TXN_ID);
459
+		$timestamp = absint($timestamp);
460
+		if ($TXN_ID && $timestamp) {
461 461
 			wp_schedule_single_event(
462 462
 				$timestamp,
463 463
 				'AHEE__EE_Cron_Tasks__expired_transaction_check',
464
-				array( $TXN_ID )
464
+				array($TXN_ID)
465 465
 			);
466 466
 		}
467 467
 	}
@@ -483,12 +483,12 @@  discard block
 block discarded – undo
483 483
 	 *
484 484
 	 * @param int $TXN_ID
485 485
 	 */
486
-	public static function expired_transaction_check( $TXN_ID = 0 ) {
487
-		if ( absint( $TXN_ID )) {
488
-			self::$_expired_transactions[ $TXN_ID ]  = $TXN_ID;
486
+	public static function expired_transaction_check($TXN_ID = 0) {
487
+		if (absint($TXN_ID)) {
488
+			self::$_expired_transactions[$TXN_ID] = $TXN_ID;
489 489
 			add_action(
490 490
 				'shutdown',
491
-				array( 'EE_Cron_Tasks', 'process_expired_transactions' ),
491
+				array('EE_Cron_Tasks', 'process_expired_transactions'),
492 492
 				5
493 493
 			);
494 494
 		}
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	public static function process_expired_transactions() {
506 506
 		if (
507 507
 			// are there any TXNs that need cleaning up ?
508
-			empty( self::$_expired_transactions )
508
+			empty(self::$_expired_transactions)
509 509
 			// reschedule the cron if we can't hit the db right now
510 510
 			|| EE_Cron_Tasks::reschedule_cron_for_transactions_if_maintenance_mode(
511 511
 				'schedule_expired_transaction_check',
@@ -515,33 +515,33 @@  discard block
 block discarded – undo
515 515
             return;
516 516
         }
517 517
         /** @type EE_Transaction_Processor $transaction_processor */
518
-        $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
518
+        $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
519 519
         // set revisit flag for txn processor
520
-        $transaction_processor->set_revisit( false );
520
+        $transaction_processor->set_revisit(false);
521 521
          // load EEM_Transaction
522
-        EE_Registry::instance()->load_model( 'Transaction' );
523
-        foreach ( self::$_expired_transactions as $TXN_ID ) {
524
-            $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
522
+        EE_Registry::instance()->load_model('Transaction');
523
+        foreach (self::$_expired_transactions as $TXN_ID) {
524
+            $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
525 525
             // verify transaction and whether it is failed or not
526
-            if ( $transaction instanceof EE_Transaction) {
527
-                switch( $transaction->status_ID() ) {
526
+            if ($transaction instanceof EE_Transaction) {
527
+                switch ($transaction->status_ID()) {
528 528
                     // Completed TXNs
529 529
                     case EEM_Transaction::complete_status_code :
530
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__completed_transaction', $transaction );
530
+                        do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__completed_transaction', $transaction);
531 531
                         break;
532 532
                     // Overpaid TXNs
533 533
                     case EEM_Transaction::overpaid_status_code :
534
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__overpaid_transaction', $transaction );
534
+                        do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__overpaid_transaction', $transaction);
535 535
                         break;
536 536
                     // Incomplete TXNs
537 537
                     case EEM_Transaction::incomplete_status_code :
538
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', $transaction );
538
+                        do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', $transaction);
539 539
                         // todo : merge the finalize_abandoned_transactions cron into this one...
540 540
                         // todo : move business logic into EE_Transaction_Processor for finalizing abandoned transactions
541 541
                         break;
542 542
                     // Failed TXNs
543 543
                     case EEM_Transaction::failed_status_code :
544
-                        do_action( 'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', $transaction );
544
+                        do_action('AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', $transaction);
545 545
                         // todo : perform garbage collection here and remove clean_out_junk_transactions()
546 546
                         //$registrations = $transaction->registrations();
547 547
                         //if ( ! empty( $registrations ) ) {
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
                 }
563 563
 
564 564
             }
565
-            unset( self::$_expired_transactions[ $TXN_ID ] );
565
+            unset(self::$_expired_transactions[$TXN_ID]);
566 566
         }
567 567
 	}
568 568
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     /**
590 590
      * Deletes old gateway logs. After about a week we usually don't need them for debugging. But folks can filter that.
591 591
      */
592
-    public static function clean_out_old_gateway_logs(){
592
+    public static function clean_out_old_gateway_logs() {
593 593
         if (EE_Maintenance_Mode::instance()->models_can_query()) {
594 594
             $time_diff_for_comparison = apply_filters(
595 595
                 'FHEE__EE_Cron_Tasks__clean_out_old_gateway_logs__time_diff_for_comparison',
Please login to merge, or discard this patch.
core/db_models/EEM_Change_Log.model.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -174,22 +174,22 @@
 block discarded – undo
174 174
 
175 175
 
176 176
 
177
-    /**
178
-     * Executes a database query to delete gateway logs. Does not affect model objects, so if you attempt to use
179
-     * models after this, they may be out-of-sync with the database
180
-     * @param DateTime $datetime
181
-     * @return false|int
182
-     */
177
+	/**
178
+	 * Executes a database query to delete gateway logs. Does not affect model objects, so if you attempt to use
179
+	 * models after this, they may be out-of-sync with the database
180
+	 * @param DateTime $datetime
181
+	 * @return false|int
182
+	 */
183 183
 	public function delete_gateway_logs_older_than(DateTime $datetime ) {
184
-	    global $wpdb;
185
-        return $wpdb->query(
186
-            $wpdb->prepare(
187
-                'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s',
188
-                EEM_Change_Log::type_gateway,
189
-                $datetime->format(EE_Datetime_Field::mysql_timestamp_format)
190
-            )
191
-        );
192
-    }
184
+		global $wpdb;
185
+		return $wpdb->query(
186
+			$wpdb->prepare(
187
+				'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s',
188
+				EEM_Change_Log::type_gateway,
189
+				$datetime->format(EE_Datetime_Field::mysql_timestamp_format)
190
+			)
191
+		);
192
+	}
193 193
 
194 194
 
195 195
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Change_Log extends EEM_Base{
28
+class EEM_Change_Log extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * the related object was created log type
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	 *	@access protected
69 69
 	 *	@return EEM_Change_Log
70 70
 	 */
71
-	protected function __construct( $timezone = null ){
71
+	protected function __construct($timezone = null) {
72 72
 		global $current_user;
73
-		$this->singular_item = __('Log','event_espresso');
74
-		$this->plural_item = __('Logs','event_espresso');
73
+		$this->singular_item = __('Log', 'event_espresso');
74
+		$this->plural_item = __('Logs', 'event_espresso');
75 75
 		$this->_tables = array(
76 76
 			'Log'=> new EE_Primary_Table('esp_log', 'LOG_ID')
77 77
 		);
78 78
 		$models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
79 79
 		$this->_fields = array(
80 80
 			'Log'=>array(
81
-				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID','event_espresso')),
82
-				'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now ),
83
-				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL,$models_this_can_attach_to),
81
+				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID', 'event_espresso')),
82
+				'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now),
83
+				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL, $models_this_can_attach_to),
84 84
 				'OBJ_type'=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Object Type", 'event_espresso'), true, NULL, $models_this_can_attach_to),
85 85
 				'LOG_type'=>new EE_Enum_Text_Field('LOG_type', __("Type of log entry", "event_espresso"), false, self::type_debug,
86 86
 						array(
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 							self::type_gateway=> __("Gateway Interaction (IPN or Direct Payment)", 'event_espresso'),
93 93
 							)),
94 94
 				'LOG_message'=>new EE_Maybe_Serialized_Text_Field('LOG_message', __("Log Message (body)", 'event_espresso'), true),
95
-				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true ),
95
+				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true),
96 96
 
97 97
 			));
98 98
 		$this->_model_relations = array();
99
-		foreach($models_this_can_attach_to as $model){
100
-			if( $model == 'WP_User' ){
101
-				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
99
+		foreach ($models_this_can_attach_to as $model) {
100
+			if ($model == 'WP_User') {
101
+				$this->_model_relations[$model] = new EE_Belongs_To_Relation();
102
+			}elseif ($model != 'Change_Log') {
103 103
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 104
 			}
105 105
 		}
106 106
 		//use completely custom caps for this
107 107
 		$this->_cap_restriction_generators = false;
108 108
 		//caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing
109
-		foreach( $this->_cap_contexts_to_cap_action_map as $cap_context => $action ) {
110
-			$this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] = new EE_Return_None_Where_Conditions();
109
+		foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) {
110
+			$this->_cap_restrictions[$cap_context][EE_Restriction_Generator_Base::get_default_restrictions_cap()] = new EE_Return_None_Where_Conditions();
111 111
 		}
112
-		parent::__construct( $timezone );
112
+		parent::__construct($timezone);
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @param EE_Base_Class $related_model_obj
120 120
 	 * @return EE_Change_Log
121 121
 	 */
122
-	public function log($log_type,$message,$related_model_obj){
123
-		if($related_model_obj instanceof EE_Base_Class){
122
+	public function log($log_type, $message, $related_model_obj) {
123
+		if ($related_model_obj instanceof EE_Base_Class) {
124 124
 			$obj_id = $related_model_obj->ID();
125 125
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
126
-		}else{
126
+		} else {
127 127
 			$obj_id = NULL;
128 128
 			$obj_type = NULL;
129 129
 		}
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @throws EE_Error
148 148
 	 * @return EE_Change_Log
149 149
 	 */
150
-	public function gateway_log( $message, $related_obj_id, $related_obj_type ){
151
-		if( ! EE_Registry::instance()->is_model_name($related_obj_type)){
152
-			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"),$related_obj_type));
150
+	public function gateway_log($message, $related_obj_id, $related_obj_type) {
151
+		if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) {
152
+			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type));
153 153
 		}
154 154
 		$log = EE_Change_Log::new_instance(array(
155 155
 				'LOG_type'=>EEM_Change_Log::type_gateway,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param array $query_params @see EEM_Base::get_all
169 169
 	 * @return array of arrays
170 170
 	 */
171
-	public function get_all_efficiently($query_params){
171
+	public function get_all_efficiently($query_params) {
172 172
 		return $this->_get_all_wpdb_results($query_params);
173 173
 	}
174 174
 
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
      * @param DateTime $datetime
181 181
      * @return false|int
182 182
      */
183
-	public function delete_gateway_logs_older_than(DateTime $datetime ) {
183
+	public function delete_gateway_logs_older_than(DateTime $datetime) {
184 184
 	    global $wpdb;
185 185
         return $wpdb->query(
186 186
             $wpdb->prepare(
187
-                'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s',
187
+                'DELETE FROM '.$this->table().' WHERE LOG_type = %s AND LOG_time < %s',
188 188
                 EEM_Change_Log::type_gateway,
189 189
                 $datetime->format(EE_Datetime_Field::mysql_timestamp_format)
190 190
             )
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * _find_common_base_path
305 305
      * given two paths, this determines if there is a common base path between the two
306 306
      *
307
-     * @param array $paths
307
+     * @param string[] $paths
308 308
      * @return string
309 309
      */
310 310
     protected static function _find_common_base_path($paths)
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
335 335
      * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
336 336
      *                                      not found or is not readable
337
-     * @return mixed string
337
+     * @return string string
338 338
      * @throws \DomainException
339 339
      */
340 340
 	public static function display_template(
Please login to merge, or discard this patch.
Indentation   +930 added lines, -930 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Event Espresso
@@ -16,35 +16,35 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 if ( ! function_exists('espresso_get_template_part')) {
19
-    /**
20
-     * espresso_get_template_part
21
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
22
-     * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
23
-     *
24
-     * @param string $slug The slug name for the generic template.
25
-     * @param string $name The name of the specialised template.
26
-     * @return string        the html output for the formatted money value
27
-     */
28
-    function espresso_get_template_part($slug = null, $name = null)
29
-    {
30
-        EEH_Template::get_template_part($slug, $name);
31
-    }
19
+	/**
20
+	 * espresso_get_template_part
21
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
22
+	 * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
23
+	 *
24
+	 * @param string $slug The slug name for the generic template.
25
+	 * @param string $name The name of the specialised template.
26
+	 * @return string        the html output for the formatted money value
27
+	 */
28
+	function espresso_get_template_part($slug = null, $name = null)
29
+	{
30
+		EEH_Template::get_template_part($slug, $name);
31
+	}
32 32
 }
33 33
 
34 34
 
35 35
 if ( ! function_exists('espresso_get_object_css_class')) {
36
-    /**
37
-     * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38
-     *
39
-     * @param EE_Base_Class $object the EE object the css class is being generated for
40
-     * @param  string       $prefix added to the beginning of the generated class
41
-     * @param  string       $suffix added to the end of the generated class
42
-     * @return string
43
-     */
44
-    function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
45
-    {
46
-        return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47
-    }
36
+	/**
37
+	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38
+	 *
39
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
40
+	 * @param  string       $prefix added to the beginning of the generated class
41
+	 * @param  string       $suffix added to the end of the generated class
42
+	 * @return string
43
+	 */
44
+	function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
45
+	{
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47
+	}
48 48
 }
49 49
 
50 50
 
@@ -59,650 +59,650 @@  discard block
 block discarded – undo
59 59
 class EEH_Template
60 60
 {
61 61
 
62
-    private static $_espresso_themes = array();
63
-
64
-
65
-    /**
66
-     *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
67
-     *
68
-     * @return boolean
69
-     */
70
-    public static function is_espresso_theme()
71
-    {
72
-        return wp_get_theme()->get('TextDomain') == 'event_espresso' ? true : false;
73
-    }
74
-
75
-    /**
76
-     *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
77
-     *    load it's functions.php file ( if not already loaded )
78
-     *
79
-     * @return void
80
-     */
81
-    public static function load_espresso_theme_functions()
82
-    {
83
-        if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
84
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php')) {
85
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php');
86
-            }
87
-        }
88
-    }
89
-
90
-
91
-    /**
92
-     *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
93
-     *
94
-     * @return array
95
-     */
96
-    public static function get_espresso_themes()
97
-    {
98
-        if (empty(EEH_Template::$_espresso_themes)) {
99
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
100
-            if (empty($espresso_themes)) {
101
-                return array();
102
-            }
103
-            if (($key = array_search('global_assets', $espresso_themes)) !== false) {
104
-                unset($espresso_themes[$key]);
105
-            }
106
-            EEH_Template::$_espresso_themes = array();
107
-            foreach ($espresso_themes as $espresso_theme) {
108
-                EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
109
-            }
110
-        }
111
-        return EEH_Template::$_espresso_themes;
112
-    }
113
-
114
-
115
-    /**
116
-     * EEH_Template::get_template_part
117
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
118
-     * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
119
-     * filtering based off of the entire template part name
120
-     *
121
-     * @param string $slug The slug name for the generic template.
122
-     * @param string $name The name of the specialised template.
123
-     * @param array  $template_args
124
-     * @param bool   $return_string
125
-     * @return string        the html output for the formatted money value
126
-     */
127
-    public static function get_template_part(
128
-        $slug = null,
129
-        $name = null,
130
-        $template_args = array(),
131
-        $return_string = false
132
-    ) {
133
-        do_action("get_template_part_{$slug}-{$name}", $slug, $name);
134
-        $templates = array();
135
-        $name      = (string)$name;
136
-        if ($name != '') {
137
-            $templates[] = "{$slug}-{$name}.php";
138
-        }
139
-        // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
140
-        if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
141
-            EEH_Template::locate_template($templates, $template_args, true, $return_string);
142
-        }
143
-    }
144
-
145
-
146
-    /**
147
-     *    locate_template
148
-     *    locate a template file by looking in the following places, in the following order:
149
-     *        <server path up to>/wp-content/themes/<current active WordPress theme>/
150
-     *        <assumed full absolute server path>
151
-     *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
152
-     *        <server path up to>/wp-content/uploads/espresso/templates/
153
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
154
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
155
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/
156
-     *    as soon as the template is found in one of these locations, it will be returned or loaded
157
-     *        Example:
158
-     *          You are using the WordPress Twenty Sixteen theme,
159
-     *        and you want to customize the "some-event.template.php" template,
160
-     *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
161
-     *          Assuming WP is installed on your server in the "/home/public_html/" folder,
162
-     *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
163
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
164
-     *        /relative/path/to/some-event.template.php
165
-     *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
166
-     *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
167
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
168
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
169
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
170
-     *          Had you passed an absolute path to your template that was in some other location,
171
-     *        ie: "/absolute/path/to/some-event.template.php"
172
-     *          then the search would have been :
173
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
174
-     *        /absolute/path/to/some-event.template.php
175
-     *          and stopped there upon finding it in the second location
176
-     *
177
-     * @param array|string $templates       array of template file names including extension (or just a single string)
178
-     * @param  array       $template_args   an array of arguments to be extracted for use in the template
179
-     * @param  boolean     $load            whether to pass the located template path on to the
180
-     *                                      EEH_Template::display_template() method or simply return it
181
-     * @param  boolean     $return_string   whether to send output immediately to screen, or capture and return as a
182
-     *                                      string
183
-     * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
184
-     *                                      generate a custom template or not. Used in places where you don't actually
185
-     *                                      load the template, you just want to know if there's a custom version of it.
186
-     * @return mixed
187
-     */
188
-    public static function locate_template(
189
-        $templates = array(),
190
-        $template_args = array(),
191
-        $load = true,
192
-        $return_string = true,
193
-        $check_if_custom = false
194
-    ) {
195
-        // first use WP locate_template to check for template in the current theme folder
196
-        $template_path = locate_template($templates);
197
-
198
-        if ($check_if_custom && ! empty($template_path)) {
199
-            return true;
200
-        }
201
-
202
-        // not in the theme
203
-        if (empty($template_path)) {
204
-            // not even a template to look for ?
205
-            if (empty($templates)) {
206
-                // get post_type
207
-                $post_type = EE_Registry::instance()->REQ->get('post_type');
208
-                // get array of EE Custom Post Types
209
-                $EE_CPTs = EE_Register_CPTs::get_CPTs();
210
-                // build template name based on request
211
-                if (isset($EE_CPTs[$post_type])) {
212
-                    $archive_or_single = is_archive() ? 'archive' : '';
213
-                    $archive_or_single = is_single() ? 'single' : $archive_or_single;
214
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
215
-                }
216
-            }
217
-            // currently active EE template theme
218
-            $current_theme = EE_Config::get_current_theme();
219
-
220
-            // array of paths to folders that may contain templates
221
-            $template_folder_paths = array(
222
-                // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
223
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
224
-                // then in the root of the /wp-content/uploads/espresso/templates/ folder
225
-                EVENT_ESPRESSO_TEMPLATE_DIR,
226
-            );
227
-
228
-            //add core plugin folders for checking only if we're not $check_if_custom
229
-            if ( ! $check_if_custom) {
230
-                $core_paths            = array(
231
-                    // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
232
-                    EE_PUBLIC . $current_theme,
233
-                    // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
234
-                    EE_TEMPLATES . $current_theme,
235
-                    // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
236
-                    EE_PLUGIN_DIR_PATH,
237
-                );
238
-                $template_folder_paths = array_merge($template_folder_paths, $core_paths);
239
-            }
240
-
241
-            // now filter that array
242
-            $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths',
243
-                $template_folder_paths);
244
-            $templates             = is_array($templates) ? $templates : array($templates);
245
-            $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
246
-            // array to hold all possible template paths
247
-            $full_template_paths = array();
248
-
249
-            // loop through $templates
250
-            foreach ($templates as $template) {
251
-                // normalize directory separators
252
-                $template                      = EEH_File::standardise_directory_separators($template);
253
-                $file_name                     = basename($template);
254
-                $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
255
-                // while looping through all template folder paths
256
-                foreach ($template_folder_paths as $template_folder_path) {
257
-                    // normalize directory separators
258
-                    $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
259
-                    // determine if any common base path exists between the two paths
260
-                    $common_base_path = EEH_Template::_find_common_base_path(
261
-                        array($template_folder_path, $template_path_minus_file_name)
262
-                    );
263
-                    if ($common_base_path !== '') {
264
-                        // both paths have a common base, so just tack the filename onto our search path
265
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
266
-                    } else {
267
-                        // no common base path, so let's just concatenate
268
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
269
-                    }
270
-                    // build up our template locations array by adding our resolved paths
271
-                    $full_template_paths[] = $resolved_path;
272
-                }
273
-                // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
274
-                array_unshift($full_template_paths, $template);
275
-                // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
276
-                array_unshift($full_template_paths, get_stylesheet_directory() . DS . $file_name);
277
-            }
278
-            // filter final array of full template paths
279
-            $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths',
280
-                $full_template_paths, $file_name);
281
-            // now loop through our final array of template location paths and check each location
282
-            foreach ((array)$full_template_paths as $full_template_path) {
283
-                if (is_readable($full_template_path)) {
284
-                    $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
285
-                    break;
286
-                }
287
-            }
288
-        }
289
-
290
-        // hook that can be used to display the full template path that will be used
291
-        do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
292
-
293
-        // if we got it and you want to see it...
294
-        if ($template_path && $load && ! $check_if_custom) {
295
-            if ($return_string) {
296
-                return EEH_Template::display_template($template_path, $template_args, true);
297
-            } else {
298
-                EEH_Template::display_template($template_path, $template_args, false);
299
-            }
300
-        }
301
-        return $check_if_custom && ! empty($template_path) ? true : $template_path;
302
-    }
303
-
304
-
305
-    /**
306
-     * _find_common_base_path
307
-     * given two paths, this determines if there is a common base path between the two
308
-     *
309
-     * @param array $paths
310
-     * @return string
311
-     */
312
-    protected static function _find_common_base_path($paths)
313
-    {
314
-        $last_offset      = 0;
315
-        $common_base_path = '';
316
-        while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
317
-            $dir_length = $index - $last_offset + 1;
318
-            $directory  = substr($paths[0], $last_offset, $dir_length);
319
-            foreach ($paths as $path) {
320
-                if (substr($path, $last_offset, $dir_length) != $directory) {
321
-                    return $common_base_path;
322
-                }
323
-            }
324
-            $common_base_path .= $directory;
325
-            $last_offset = $index + 1;
326
-        }
327
-        return substr($common_base_path, 0, -1);
328
-    }
329
-
330
-
331
-    /**
332
-     * load and display a template
333
-     *
334
-     * @param bool|string $template_path server path to the file to be loaded, including file name and extension
335
-     * @param  array      $template_args an array of arguments to be extracted for use in the template
336
-     * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
337
-     * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
338
-     *                                      not found or is not readable
339
-     * @return mixed string
340
-     * @throws \DomainException
341
-     */
62
+	private static $_espresso_themes = array();
63
+
64
+
65
+	/**
66
+	 *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
67
+	 *
68
+	 * @return boolean
69
+	 */
70
+	public static function is_espresso_theme()
71
+	{
72
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? true : false;
73
+	}
74
+
75
+	/**
76
+	 *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
77
+	 *    load it's functions.php file ( if not already loaded )
78
+	 *
79
+	 * @return void
80
+	 */
81
+	public static function load_espresso_theme_functions()
82
+	{
83
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
84
+			if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php')) {
85
+				require_once(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php');
86
+			}
87
+		}
88
+	}
89
+
90
+
91
+	/**
92
+	 *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
93
+	 *
94
+	 * @return array
95
+	 */
96
+	public static function get_espresso_themes()
97
+	{
98
+		if (empty(EEH_Template::$_espresso_themes)) {
99
+			$espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
100
+			if (empty($espresso_themes)) {
101
+				return array();
102
+			}
103
+			if (($key = array_search('global_assets', $espresso_themes)) !== false) {
104
+				unset($espresso_themes[$key]);
105
+			}
106
+			EEH_Template::$_espresso_themes = array();
107
+			foreach ($espresso_themes as $espresso_theme) {
108
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
109
+			}
110
+		}
111
+		return EEH_Template::$_espresso_themes;
112
+	}
113
+
114
+
115
+	/**
116
+	 * EEH_Template::get_template_part
117
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
118
+	 * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
119
+	 * filtering based off of the entire template part name
120
+	 *
121
+	 * @param string $slug The slug name for the generic template.
122
+	 * @param string $name The name of the specialised template.
123
+	 * @param array  $template_args
124
+	 * @param bool   $return_string
125
+	 * @return string        the html output for the formatted money value
126
+	 */
127
+	public static function get_template_part(
128
+		$slug = null,
129
+		$name = null,
130
+		$template_args = array(),
131
+		$return_string = false
132
+	) {
133
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
134
+		$templates = array();
135
+		$name      = (string)$name;
136
+		if ($name != '') {
137
+			$templates[] = "{$slug}-{$name}.php";
138
+		}
139
+		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
140
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
141
+			EEH_Template::locate_template($templates, $template_args, true, $return_string);
142
+		}
143
+	}
144
+
145
+
146
+	/**
147
+	 *    locate_template
148
+	 *    locate a template file by looking in the following places, in the following order:
149
+	 *        <server path up to>/wp-content/themes/<current active WordPress theme>/
150
+	 *        <assumed full absolute server path>
151
+	 *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
152
+	 *        <server path up to>/wp-content/uploads/espresso/templates/
153
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
154
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
155
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/
156
+	 *    as soon as the template is found in one of these locations, it will be returned or loaded
157
+	 *        Example:
158
+	 *          You are using the WordPress Twenty Sixteen theme,
159
+	 *        and you want to customize the "some-event.template.php" template,
160
+	 *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
161
+	 *          Assuming WP is installed on your server in the "/home/public_html/" folder,
162
+	 *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
163
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
164
+	 *        /relative/path/to/some-event.template.php
165
+	 *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
166
+	 *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
167
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
168
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
169
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
170
+	 *          Had you passed an absolute path to your template that was in some other location,
171
+	 *        ie: "/absolute/path/to/some-event.template.php"
172
+	 *          then the search would have been :
173
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
174
+	 *        /absolute/path/to/some-event.template.php
175
+	 *          and stopped there upon finding it in the second location
176
+	 *
177
+	 * @param array|string $templates       array of template file names including extension (or just a single string)
178
+	 * @param  array       $template_args   an array of arguments to be extracted for use in the template
179
+	 * @param  boolean     $load            whether to pass the located template path on to the
180
+	 *                                      EEH_Template::display_template() method or simply return it
181
+	 * @param  boolean     $return_string   whether to send output immediately to screen, or capture and return as a
182
+	 *                                      string
183
+	 * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
184
+	 *                                      generate a custom template or not. Used in places where you don't actually
185
+	 *                                      load the template, you just want to know if there's a custom version of it.
186
+	 * @return mixed
187
+	 */
188
+	public static function locate_template(
189
+		$templates = array(),
190
+		$template_args = array(),
191
+		$load = true,
192
+		$return_string = true,
193
+		$check_if_custom = false
194
+	) {
195
+		// first use WP locate_template to check for template in the current theme folder
196
+		$template_path = locate_template($templates);
197
+
198
+		if ($check_if_custom && ! empty($template_path)) {
199
+			return true;
200
+		}
201
+
202
+		// not in the theme
203
+		if (empty($template_path)) {
204
+			// not even a template to look for ?
205
+			if (empty($templates)) {
206
+				// get post_type
207
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
208
+				// get array of EE Custom Post Types
209
+				$EE_CPTs = EE_Register_CPTs::get_CPTs();
210
+				// build template name based on request
211
+				if (isset($EE_CPTs[$post_type])) {
212
+					$archive_or_single = is_archive() ? 'archive' : '';
213
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
214
+					$templates         = $archive_or_single . '-' . $post_type . '.php';
215
+				}
216
+			}
217
+			// currently active EE template theme
218
+			$current_theme = EE_Config::get_current_theme();
219
+
220
+			// array of paths to folders that may contain templates
221
+			$template_folder_paths = array(
222
+				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
223
+				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
224
+				// then in the root of the /wp-content/uploads/espresso/templates/ folder
225
+				EVENT_ESPRESSO_TEMPLATE_DIR,
226
+			);
227
+
228
+			//add core plugin folders for checking only if we're not $check_if_custom
229
+			if ( ! $check_if_custom) {
230
+				$core_paths            = array(
231
+					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
232
+					EE_PUBLIC . $current_theme,
233
+					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
234
+					EE_TEMPLATES . $current_theme,
235
+					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
236
+					EE_PLUGIN_DIR_PATH,
237
+				);
238
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
239
+			}
240
+
241
+			// now filter that array
242
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths',
243
+				$template_folder_paths);
244
+			$templates             = is_array($templates) ? $templates : array($templates);
245
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
246
+			// array to hold all possible template paths
247
+			$full_template_paths = array();
248
+
249
+			// loop through $templates
250
+			foreach ($templates as $template) {
251
+				// normalize directory separators
252
+				$template                      = EEH_File::standardise_directory_separators($template);
253
+				$file_name                     = basename($template);
254
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
255
+				// while looping through all template folder paths
256
+				foreach ($template_folder_paths as $template_folder_path) {
257
+					// normalize directory separators
258
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
259
+					// determine if any common base path exists between the two paths
260
+					$common_base_path = EEH_Template::_find_common_base_path(
261
+						array($template_folder_path, $template_path_minus_file_name)
262
+					);
263
+					if ($common_base_path !== '') {
264
+						// both paths have a common base, so just tack the filename onto our search path
265
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
266
+					} else {
267
+						// no common base path, so let's just concatenate
268
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
269
+					}
270
+					// build up our template locations array by adding our resolved paths
271
+					$full_template_paths[] = $resolved_path;
272
+				}
273
+				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
274
+				array_unshift($full_template_paths, $template);
275
+				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
276
+				array_unshift($full_template_paths, get_stylesheet_directory() . DS . $file_name);
277
+			}
278
+			// filter final array of full template paths
279
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths',
280
+				$full_template_paths, $file_name);
281
+			// now loop through our final array of template location paths and check each location
282
+			foreach ((array)$full_template_paths as $full_template_path) {
283
+				if (is_readable($full_template_path)) {
284
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
285
+					break;
286
+				}
287
+			}
288
+		}
289
+
290
+		// hook that can be used to display the full template path that will be used
291
+		do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
292
+
293
+		// if we got it and you want to see it...
294
+		if ($template_path && $load && ! $check_if_custom) {
295
+			if ($return_string) {
296
+				return EEH_Template::display_template($template_path, $template_args, true);
297
+			} else {
298
+				EEH_Template::display_template($template_path, $template_args, false);
299
+			}
300
+		}
301
+		return $check_if_custom && ! empty($template_path) ? true : $template_path;
302
+	}
303
+
304
+
305
+	/**
306
+	 * _find_common_base_path
307
+	 * given two paths, this determines if there is a common base path between the two
308
+	 *
309
+	 * @param array $paths
310
+	 * @return string
311
+	 */
312
+	protected static function _find_common_base_path($paths)
313
+	{
314
+		$last_offset      = 0;
315
+		$common_base_path = '';
316
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
317
+			$dir_length = $index - $last_offset + 1;
318
+			$directory  = substr($paths[0], $last_offset, $dir_length);
319
+			foreach ($paths as $path) {
320
+				if (substr($path, $last_offset, $dir_length) != $directory) {
321
+					return $common_base_path;
322
+				}
323
+			}
324
+			$common_base_path .= $directory;
325
+			$last_offset = $index + 1;
326
+		}
327
+		return substr($common_base_path, 0, -1);
328
+	}
329
+
330
+
331
+	/**
332
+	 * load and display a template
333
+	 *
334
+	 * @param bool|string $template_path server path to the file to be loaded, including file name and extension
335
+	 * @param  array      $template_args an array of arguments to be extracted for use in the template
336
+	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
337
+	 * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
338
+	 *                                      not found or is not readable
339
+	 * @return mixed string
340
+	 * @throws \DomainException
341
+	 */
342 342
 	public static function display_template(
343
-        $template_path    = false,
344
-        $template_args    = array(),
345
-        $return_string    = false,
346
-        $throw_exceptions = false
347
-    ) {
348
-
349
-        /**
350
-         * These two filters are intended for last minute changes to templates being loaded and/or template arg
351
-         * modifications.  NOTE... modifying these things can cause breakage as most templates running through
352
-         * the display_template method are templates we DON'T want modified (usually because of js
353
-         * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
354
-         * using this.
355
-         *
356
-         * @since 4.6.0
357
-         */
358
-        $template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
359
-        $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
360
-
361
-        // you gimme nuttin - YOU GET NUTTIN !!
362
-        if ( ! $template_path || ! is_readable($template_path)) {
363
-            return '';
364
-        }
365
-        // if $template_args are not in an array, then make it so
366
-        if ( ! is_array($template_args) && ! is_object($template_args)) {
367
-            $template_args = array($template_args);
368
-        }
369
-        extract( $template_args, EXTR_SKIP );
370
-        // ignore whether template is accessible ?
371
-        if ( $throw_exceptions && ! is_readable( $template_path ) ) {
372
-            throw new \DomainException(
373
-                    esc_html__(
374
-                            'Invalid, unreadable, or missing file.',
375
-                            'event_espresso'
376
-                    )
377
-            );
378
-        }
379
-
380
-
381
-        if ($return_string) {
382
-            // because we want to return a string, we are going to capture the output
383
-            ob_start();
384
-            include($template_path);
385
-            return ob_get_clean();
386
-        } else {
387
-            include($template_path);
388
-        }
389
-        return '';
390
-    }
391
-
392
-
393
-    /**
394
-     * get_object_css_class - attempts to generate a css class based on the type of EE object passed
395
-     *
396
-     * @param EE_Base_Class $object the EE object the css class is being generated for
397
-     * @param  string       $prefix added to the beginning of the generated class
398
-     * @param  string       $suffix added to the end of the generated class
399
-     * @return string
400
-     */
401
-    public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
402
-    {
403
-        // in the beginning...
404
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
405
-        // da muddle
406
-        $class = '';
407
-        // the end
408
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
409
-        // is the passed object an EE object ?
410
-        if ($object instanceof EE_Base_Class) {
411
-            // grab the exact type of object
412
-            $obj_class = get_class($object);
413
-            // depending on the type of object...
414
-            switch ($obj_class) {
415
-                // no specifics just yet...
416
-                default :
417
-                    $class = strtolower(str_replace('_', '-', $obj_class));
418
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
419
-
420
-            }
421
-        }
422
-        return $prefix . $class . $suffix;
423
-    }
424
-
425
-
426
-
427
-    /**
428
-     * EEH_Template::format_currency
429
-     * This helper takes a raw float value and formats it according to the default config country currency settings, or
430
-     * the country currency settings from the supplied country ISO code
431
-     *
432
-     * @param  float   $amount       raw money value
433
-     * @param  boolean $return_raw   whether to return the formatted float value only with no currency sign or code
434
-     * @param  boolean $display_code whether to display the country code (USD). Default = TRUE
435
-     * @param string   $CNT_ISO      2 letter ISO code for a country
436
-     * @param string   $cur_code_span_class
437
-     * @return string        the html output for the formatted money value
438
-     * @throws \EE_Error
439
-     */
440
-    public static function format_currency(
441
-        $amount = null,
442
-        $return_raw = false,
443
-        $display_code = true,
444
-        $CNT_ISO = '',
445
-        $cur_code_span_class = 'currency-code'
446
-    ) {
447
-        // ensure amount was received
448
-        if ($amount === null) {
449
-            $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
450
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
451
-            return '';
452
-        }
453
-        //ensure amount is float
454
-        $amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float)$amount);
455
-        $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
456
-        // filter raw amount (allows 0.00 to be changed to "free" for example)
457
-        $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
458
-        // still a number or was amount converted to a string like "free" ?
459
-        if (is_float($amount_formatted)) {
460
-            // was a country ISO code passed ? if so generate currency config object for that country
461
-            $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
462
-            // verify results
463
-            if ( ! $mny instanceof EE_Currency_Config) {
464
-                // set default config country currency settings
465
-                $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
466
-                    ? EE_Registry::instance()->CFG->currency
467
-                    : new EE_Currency_Config();
468
-            }
469
-            // format float
470
-            $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
471
-            // add formatting ?
472
-            if ( ! $return_raw) {
473
-                // add currency sign
474
-                if ($mny->sign_b4) {
475
-                    if ($amount >= 0) {
476
-                        $amount_formatted = $mny->sign . $amount_formatted;
477
-                    } else {
478
-                        $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
479
-                    }
480
-
481
-                } else {
482
-                    $amount_formatted = $amount_formatted . $mny->sign;
483
-                }
484
-
485
-                // filter to allow global setting of display_code
486
-                $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
487
-
488
-                // add currency code ?
489
-                $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
490
-            }
491
-            // filter results
492
-            $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted',
493
-                $amount_formatted, $mny, $return_raw);
494
-        }
495
-        // clean up vars
496
-        unset($mny);
497
-        // return formatted currency amount
498
-        return $amount_formatted;
499
-    }
500
-
501
-
502
-    /**
503
-     * This function is used for outputting the localized label for a given status id in the schema requested (and
504
-     * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
505
-     * related status model or model object (i.e. in documentation etc.)
506
-     *
507
-     * @param  string  $status_id Status ID matching a registered status in the esp_status table.  If there is no
508
-     *                            match, then 'Unknown' will be returned.
509
-     * @param  boolean $plural    Whether to return plural or not
510
-     * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
511
-     * @return string             The localized label for the status id.
512
-     */
513
-    public static function pretty_status($status_id, $plural = false, $schema = 'upper')
514
-    {
515
-        /** @type EEM_Status $EEM_Status */
516
-        $EEM_Status = EE_Registry::instance()->load_model('Status');
517
-        $status     = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural,
518
-            $schema);
519
-        return $status[$status_id];
520
-    }
521
-
522
-
523
-    /**
524
-     * This helper just returns a button or link for the given parameters
525
-     *
526
-     * @param  string $url   the url for the link
527
-     * @param  string $label What is the label you want displayed for the button
528
-     * @param  string $class what class is used for the button (defaults to 'button-primary')
529
-     * @param string  $icon
530
-     * @param string  $title
531
-     * @return string the html output for the button
532
-     */
533
-    public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '')
534
-    {
535
-        $icon_html = '';
536
-        if ( ! empty($icon)) {
537
-            $dashicons = preg_split("(ee-icon |dashicons )", $icon);
538
-            $dashicons = array_filter($dashicons);
539
-            $count     = count($dashicons);
540
-            $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
541
-            foreach ($dashicons as $dashicon) {
542
-                $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
543
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
544
-            }
545
-            $icon_html .= $count > 1 ? '</span>' : '';
546
-        }
547
-        $label  = ! empty($icon) ? $icon_html . $label : $label;
548
-        $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>';
549
-        return $button;
550
-    }
551
-
552
-
553
-    /**
554
-     * This returns a generated link that will load the related help tab on admin pages.
555
-     *
556
-     * @param  string     $help_tab_id the id for the connected help tab
557
-     * @param bool|string $page        The page identifier for the page the help tab is on
558
-     * @param bool|string $action      The action (route) for the admin page the help tab is on.
559
-     * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
560
-     * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
561
-     * @return string              generated link
562
-     */
563
-    public static function get_help_tab_link(
564
-        $help_tab_id,
565
-        $page = false,
566
-        $action = false,
567
-        $icon_style = false,
568
-        $help_text = false
569
-    ) {
570
-
571
-        if ( ! $page) {
572
-            $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
573
-        }
574
-
575
-        if ( ! $action) {
576
-            $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
577
-        }
578
-
579
-        $action = empty($action) ? 'default' : $action;
580
-
581
-
582
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
583
-        $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
584
-        $help_text    = ! $help_text ? '' : $help_text;
585
-        return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
586
-                'event_espresso') . '" > ' . $help_text . ' </a>';
587
-    }
588
-
589
-
590
-    /**
591
-     * This helper generates the html structure for the jquery joyride plugin with the given params.
592
-     *
593
-     * @link http://zurb.com/playground/jquery-joyride-feature-tour-plugin
594
-     * @see  EE_Admin_Page->_stop_callback() for the construct expected for the $stops param.
595
-     * @param EE_Help_Tour
596
-     * @return string         html
597
-     */
598
-    public static function help_tour_stops_generator(EE_Help_Tour $tour)
599
-    {
600
-        $id    = $tour->get_slug();
601
-        $stops = $tour->get_stops();
602
-
603
-        $content = '<ol style="display:none" id="' . $id . '">';
604
-
605
-        foreach ($stops as $stop) {
606
-            $data_id    = ! empty($stop['id']) ? ' data-id="' . $stop['id'] . '"' : '';
607
-            $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="' . $stop['class'] . '"' : '';
608
-
609
-            //if container is set to modal then let's make sure we set the options accordingly
610
-            if (empty($data_id) && empty($data_class)) {
611
-                $stop['options']['modal']  = true;
612
-                $stop['options']['expose'] = true;
613
-            }
614
-
615
-            $custom_class  = ! empty($stop['custom_class']) ? ' class="' . $stop['custom_class'] . '"' : '';
616
-            $button_text   = ! empty($stop['button_text']) ? ' data-button="' . $stop['button_text'] . '"' : '';
617
-            $inner_content = isset($stop['content']) ? $stop['content'] : '';
618
-
619
-            //options
620
-            if (isset($stop['options']) && is_array($stop['options'])) {
621
-                $options = ' data-options="';
622
-                foreach ($stop['options'] as $option => $value) {
623
-                    $options .= $option . ':' . $value . ';';
624
-                }
625
-                $options .= '"';
626
-            } else {
627
-                $options = '';
628
-            }
629
-
630
-            //let's put all together
631
-            $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
632
-        }
633
-
634
-        $content .= '</ol>';
635
-        return $content;
636
-    }
637
-
638
-
639
-    /**
640
-     * This is a helper method to generate a status legend for a given status array.
641
-     * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
642
-     * status_array.
643
-     *
644
-     * @param  array  $status_array  array of statuses that will make up the legend. In format:
645
-     *                               array(
646
-     *                               'status_item' => 'status_name'
647
-     *                               )
648
-     * @param  string $active_status This is used to indicate what the active status is IF that is to be highlighted in
649
-     *                               the legend.
650
-     * @throws EE_Error
651
-     * @return string               html structure for status.
652
-     */
653
-    public static function status_legend($status_array, $active_status = '')
654
-    {
655
-        if ( ! is_array($status_array)) {
656
-            throw new EE_Error(esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
657
-                'event_espresso'));
658
-        }
659
-
660
-        $setup_array = array();
661
-        foreach ($status_array as $item => $status) {
662
-            $setup_array[$item] = array(
663
-                'class'  => 'ee-status-legend ee-status-legend-' . $status,
664
-                'desc'   => EEH_Template::pretty_status($status, false, 'sentence'),
665
-                'status' => $status,
666
-            );
667
-        }
668
-
669
-        $content = '<div class="ee-list-table-legend-container">' . "\n";
670
-        $content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n";
671
-        $content .= '<dl class="ee-list-table-legend">' . "\n\t";
672
-        foreach ($setup_array as $item => $details) {
673
-            $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
674
-            $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
675
-            $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
676
-            $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
677
-            $content .= '</dt>' . "\n";
678
-        }
679
-        $content .= '</dl>' . "\n";
680
-        $content .= '</div>' . "\n";
681
-        return $content;
682
-    }
683
-
684
-
685
-    /**
686
-     * Gets HTML for laying out a deeply-nested array (and objects) in a format
687
-     * that's nice for presenting in the wp admin
688
-     *
689
-     * @param mixed $data
690
-     * @return string
691
-     */
692
-    public static function layout_array_as_table($data)
693
-    {
694
-        if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
695
-            $data = (array)$data;
696
-        }
697
-        ob_start();
698
-        if (is_array($data)) {
699
-            if (EEH_Array::is_associative_array($data)) {
700
-                ?>
343
+		$template_path    = false,
344
+		$template_args    = array(),
345
+		$return_string    = false,
346
+		$throw_exceptions = false
347
+	) {
348
+
349
+		/**
350
+		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
351
+		 * modifications.  NOTE... modifying these things can cause breakage as most templates running through
352
+		 * the display_template method are templates we DON'T want modified (usually because of js
353
+		 * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
354
+		 * using this.
355
+		 *
356
+		 * @since 4.6.0
357
+		 */
358
+		$template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
359
+		$template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
360
+
361
+		// you gimme nuttin - YOU GET NUTTIN !!
362
+		if ( ! $template_path || ! is_readable($template_path)) {
363
+			return '';
364
+		}
365
+		// if $template_args are not in an array, then make it so
366
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
367
+			$template_args = array($template_args);
368
+		}
369
+		extract( $template_args, EXTR_SKIP );
370
+		// ignore whether template is accessible ?
371
+		if ( $throw_exceptions && ! is_readable( $template_path ) ) {
372
+			throw new \DomainException(
373
+					esc_html__(
374
+							'Invalid, unreadable, or missing file.',
375
+							'event_espresso'
376
+					)
377
+			);
378
+		}
379
+
380
+
381
+		if ($return_string) {
382
+			// because we want to return a string, we are going to capture the output
383
+			ob_start();
384
+			include($template_path);
385
+			return ob_get_clean();
386
+		} else {
387
+			include($template_path);
388
+		}
389
+		return '';
390
+	}
391
+
392
+
393
+	/**
394
+	 * get_object_css_class - attempts to generate a css class based on the type of EE object passed
395
+	 *
396
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
397
+	 * @param  string       $prefix added to the beginning of the generated class
398
+	 * @param  string       $suffix added to the end of the generated class
399
+	 * @return string
400
+	 */
401
+	public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
402
+	{
403
+		// in the beginning...
404
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
405
+		// da muddle
406
+		$class = '';
407
+		// the end
408
+		$suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
409
+		// is the passed object an EE object ?
410
+		if ($object instanceof EE_Base_Class) {
411
+			// grab the exact type of object
412
+			$obj_class = get_class($object);
413
+			// depending on the type of object...
414
+			switch ($obj_class) {
415
+				// no specifics just yet...
416
+				default :
417
+					$class = strtolower(str_replace('_', '-', $obj_class));
418
+					$class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
419
+
420
+			}
421
+		}
422
+		return $prefix . $class . $suffix;
423
+	}
424
+
425
+
426
+
427
+	/**
428
+	 * EEH_Template::format_currency
429
+	 * This helper takes a raw float value and formats it according to the default config country currency settings, or
430
+	 * the country currency settings from the supplied country ISO code
431
+	 *
432
+	 * @param  float   $amount       raw money value
433
+	 * @param  boolean $return_raw   whether to return the formatted float value only with no currency sign or code
434
+	 * @param  boolean $display_code whether to display the country code (USD). Default = TRUE
435
+	 * @param string   $CNT_ISO      2 letter ISO code for a country
436
+	 * @param string   $cur_code_span_class
437
+	 * @return string        the html output for the formatted money value
438
+	 * @throws \EE_Error
439
+	 */
440
+	public static function format_currency(
441
+		$amount = null,
442
+		$return_raw = false,
443
+		$display_code = true,
444
+		$CNT_ISO = '',
445
+		$cur_code_span_class = 'currency-code'
446
+	) {
447
+		// ensure amount was received
448
+		if ($amount === null) {
449
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
450
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
451
+			return '';
452
+		}
453
+		//ensure amount is float
454
+		$amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float)$amount);
455
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
456
+		// filter raw amount (allows 0.00 to be changed to "free" for example)
457
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
458
+		// still a number or was amount converted to a string like "free" ?
459
+		if (is_float($amount_formatted)) {
460
+			// was a country ISO code passed ? if so generate currency config object for that country
461
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
462
+			// verify results
463
+			if ( ! $mny instanceof EE_Currency_Config) {
464
+				// set default config country currency settings
465
+				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
466
+					? EE_Registry::instance()->CFG->currency
467
+					: new EE_Currency_Config();
468
+			}
469
+			// format float
470
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
471
+			// add formatting ?
472
+			if ( ! $return_raw) {
473
+				// add currency sign
474
+				if ($mny->sign_b4) {
475
+					if ($amount >= 0) {
476
+						$amount_formatted = $mny->sign . $amount_formatted;
477
+					} else {
478
+						$amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
479
+					}
480
+
481
+				} else {
482
+					$amount_formatted = $amount_formatted . $mny->sign;
483
+				}
484
+
485
+				// filter to allow global setting of display_code
486
+				$display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
487
+
488
+				// add currency code ?
489
+				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
490
+			}
491
+			// filter results
492
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted',
493
+				$amount_formatted, $mny, $return_raw);
494
+		}
495
+		// clean up vars
496
+		unset($mny);
497
+		// return formatted currency amount
498
+		return $amount_formatted;
499
+	}
500
+
501
+
502
+	/**
503
+	 * This function is used for outputting the localized label for a given status id in the schema requested (and
504
+	 * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
505
+	 * related status model or model object (i.e. in documentation etc.)
506
+	 *
507
+	 * @param  string  $status_id Status ID matching a registered status in the esp_status table.  If there is no
508
+	 *                            match, then 'Unknown' will be returned.
509
+	 * @param  boolean $plural    Whether to return plural or not
510
+	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
511
+	 * @return string             The localized label for the status id.
512
+	 */
513
+	public static function pretty_status($status_id, $plural = false, $schema = 'upper')
514
+	{
515
+		/** @type EEM_Status $EEM_Status */
516
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
517
+		$status     = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural,
518
+			$schema);
519
+		return $status[$status_id];
520
+	}
521
+
522
+
523
+	/**
524
+	 * This helper just returns a button or link for the given parameters
525
+	 *
526
+	 * @param  string $url   the url for the link
527
+	 * @param  string $label What is the label you want displayed for the button
528
+	 * @param  string $class what class is used for the button (defaults to 'button-primary')
529
+	 * @param string  $icon
530
+	 * @param string  $title
531
+	 * @return string the html output for the button
532
+	 */
533
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '')
534
+	{
535
+		$icon_html = '';
536
+		if ( ! empty($icon)) {
537
+			$dashicons = preg_split("(ee-icon |dashicons )", $icon);
538
+			$dashicons = array_filter($dashicons);
539
+			$count     = count($dashicons);
540
+			$icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
541
+			foreach ($dashicons as $dashicon) {
542
+				$type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
543
+				$icon_html .= '<span class="' . $type . $dashicon . '"></span>';
544
+			}
545
+			$icon_html .= $count > 1 ? '</span>' : '';
546
+		}
547
+		$label  = ! empty($icon) ? $icon_html . $label : $label;
548
+		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>';
549
+		return $button;
550
+	}
551
+
552
+
553
+	/**
554
+	 * This returns a generated link that will load the related help tab on admin pages.
555
+	 *
556
+	 * @param  string     $help_tab_id the id for the connected help tab
557
+	 * @param bool|string $page        The page identifier for the page the help tab is on
558
+	 * @param bool|string $action      The action (route) for the admin page the help tab is on.
559
+	 * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
560
+	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
561
+	 * @return string              generated link
562
+	 */
563
+	public static function get_help_tab_link(
564
+		$help_tab_id,
565
+		$page = false,
566
+		$action = false,
567
+		$icon_style = false,
568
+		$help_text = false
569
+	) {
570
+
571
+		if ( ! $page) {
572
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
573
+		}
574
+
575
+		if ( ! $action) {
576
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
577
+		}
578
+
579
+		$action = empty($action) ? 'default' : $action;
580
+
581
+
582
+		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
583
+		$icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
584
+		$help_text    = ! $help_text ? '' : $help_text;
585
+		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
586
+				'event_espresso') . '" > ' . $help_text . ' </a>';
587
+	}
588
+
589
+
590
+	/**
591
+	 * This helper generates the html structure for the jquery joyride plugin with the given params.
592
+	 *
593
+	 * @link http://zurb.com/playground/jquery-joyride-feature-tour-plugin
594
+	 * @see  EE_Admin_Page->_stop_callback() for the construct expected for the $stops param.
595
+	 * @param EE_Help_Tour
596
+	 * @return string         html
597
+	 */
598
+	public static function help_tour_stops_generator(EE_Help_Tour $tour)
599
+	{
600
+		$id    = $tour->get_slug();
601
+		$stops = $tour->get_stops();
602
+
603
+		$content = '<ol style="display:none" id="' . $id . '">';
604
+
605
+		foreach ($stops as $stop) {
606
+			$data_id    = ! empty($stop['id']) ? ' data-id="' . $stop['id'] . '"' : '';
607
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="' . $stop['class'] . '"' : '';
608
+
609
+			//if container is set to modal then let's make sure we set the options accordingly
610
+			if (empty($data_id) && empty($data_class)) {
611
+				$stop['options']['modal']  = true;
612
+				$stop['options']['expose'] = true;
613
+			}
614
+
615
+			$custom_class  = ! empty($stop['custom_class']) ? ' class="' . $stop['custom_class'] . '"' : '';
616
+			$button_text   = ! empty($stop['button_text']) ? ' data-button="' . $stop['button_text'] . '"' : '';
617
+			$inner_content = isset($stop['content']) ? $stop['content'] : '';
618
+
619
+			//options
620
+			if (isset($stop['options']) && is_array($stop['options'])) {
621
+				$options = ' data-options="';
622
+				foreach ($stop['options'] as $option => $value) {
623
+					$options .= $option . ':' . $value . ';';
624
+				}
625
+				$options .= '"';
626
+			} else {
627
+				$options = '';
628
+			}
629
+
630
+			//let's put all together
631
+			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
632
+		}
633
+
634
+		$content .= '</ol>';
635
+		return $content;
636
+	}
637
+
638
+
639
+	/**
640
+	 * This is a helper method to generate a status legend for a given status array.
641
+	 * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
642
+	 * status_array.
643
+	 *
644
+	 * @param  array  $status_array  array of statuses that will make up the legend. In format:
645
+	 *                               array(
646
+	 *                               'status_item' => 'status_name'
647
+	 *                               )
648
+	 * @param  string $active_status This is used to indicate what the active status is IF that is to be highlighted in
649
+	 *                               the legend.
650
+	 * @throws EE_Error
651
+	 * @return string               html structure for status.
652
+	 */
653
+	public static function status_legend($status_array, $active_status = '')
654
+	{
655
+		if ( ! is_array($status_array)) {
656
+			throw new EE_Error(esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
657
+				'event_espresso'));
658
+		}
659
+
660
+		$setup_array = array();
661
+		foreach ($status_array as $item => $status) {
662
+			$setup_array[$item] = array(
663
+				'class'  => 'ee-status-legend ee-status-legend-' . $status,
664
+				'desc'   => EEH_Template::pretty_status($status, false, 'sentence'),
665
+				'status' => $status,
666
+			);
667
+		}
668
+
669
+		$content = '<div class="ee-list-table-legend-container">' . "\n";
670
+		$content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n";
671
+		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
672
+		foreach ($setup_array as $item => $details) {
673
+			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
674
+			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
675
+			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
676
+			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
677
+			$content .= '</dt>' . "\n";
678
+		}
679
+		$content .= '</dl>' . "\n";
680
+		$content .= '</div>' . "\n";
681
+		return $content;
682
+	}
683
+
684
+
685
+	/**
686
+	 * Gets HTML for laying out a deeply-nested array (and objects) in a format
687
+	 * that's nice for presenting in the wp admin
688
+	 *
689
+	 * @param mixed $data
690
+	 * @return string
691
+	 */
692
+	public static function layout_array_as_table($data)
693
+	{
694
+		if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
695
+			$data = (array)$data;
696
+		}
697
+		ob_start();
698
+		if (is_array($data)) {
699
+			if (EEH_Array::is_associative_array($data)) {
700
+				?>
701 701
                 <table class="widefat">
702 702
                     <tbody>
703 703
                     <?php
704
-                    foreach ($data as $data_key => $data_values) {
705
-                        ?>
704
+					foreach ($data as $data_key => $data_values) {
705
+						?>
706 706
                         <tr>
707 707
                             <td>
708 708
                                 <?php echo $data_key; ?>
@@ -712,248 +712,248 @@  discard block
 block discarded – undo
712 712
                             </td>
713 713
                         </tr>
714 714
                         <?php
715
-                    } ?>
715
+					} ?>
716 716
                     </tbody>
717 717
                 </table>
718 718
                 <?php
719
-            } else {
720
-                ?>
719
+			} else {
720
+				?>
721 721
                 <ul>
722 722
                     <?php
723
-                    foreach ($data as $datum) {
724
-                        echo "<li>";
725
-                        echo self::layout_array_as_table($datum);
726
-                        echo "</li>";
727
-                    } ?>
723
+					foreach ($data as $datum) {
724
+						echo "<li>";
725
+						echo self::layout_array_as_table($datum);
726
+						echo "</li>";
727
+					} ?>
728 728
                 </ul>
729 729
                 <?php
730
-            }
731
-        } else {
732
-            //simple value
733
-            echo esc_html($data);
734
-        }
735
-        return ob_get_clean();
736
-    }
737
-
738
-
739
-    /**
740
-     * wrapper for self::get_paging_html() that simply echos the generated paging html
741
-     *
742
-     * @since 4.4.0
743
-     * @see   self:get_paging_html() for argument docs.
744
-     * @param        $total_items
745
-     * @param        $current
746
-     * @param        $per_page
747
-     * @param        $url
748
-     * @param bool   $show_num_field
749
-     * @param string $paged_arg_name
750
-     * @param array  $items_label
751
-     * @return string
752
-     */
753
-    public static function paging_html(
754
-        $total_items,
755
-        $current,
756
-        $per_page,
757
-        $url,
758
-        $show_num_field = true,
759
-        $paged_arg_name = 'paged',
760
-        $items_label = array()
761
-    ) {
762
-        echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name,
763
-            $items_label);
764
-    }
765
-
766
-
767
-    /**
768
-     * A method for generating paging similar to WP_List_Table
769
-     *
770
-     * @since    4.4.0
771
-     * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
772
-     * @param  integer $total_items     How many total items there are to page.
773
-     * @param  integer $current         What the current page is.
774
-     * @param  integer $per_page        How many items per page.
775
-     * @param  string  $url             What the base url for page links is.
776
-     * @param  boolean $show_num_field  Whether to show the input for changing page number.
777
-     * @param  string  $paged_arg_name  The name of the key for the paged query argument.
778
-     * @param  array   $items_label     An array of singular/plural values for the items label:
779
-     *                                  array(
780
-     *                                  'single' => 'item',
781
-     *                                  'plural' => 'items'
782
-     *                                  )
783
-     * @return  string
784
-     */
785
-    public static function get_paging_html(
786
-        $total_items,
787
-        $current,
788
-        $per_page,
789
-        $url,
790
-        $show_num_field = true,
791
-        $paged_arg_name = 'paged',
792
-        $items_label = array()
793
-    ) {
794
-        $page_links     = array();
795
-        $disable_first  = $disable_last = '';
796
-        $total_items    = (int)$total_items;
797
-        $per_page       = (int)$per_page;
798
-        $current        = (int)$current;
799
-        $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
800
-
801
-        //filter items_label
802
-        $items_label = apply_filters(
803
-            'FHEE__EEH_Template__get_paging_html__items_label',
804
-            $items_label
805
-        );
806
-
807
-        if (empty($items_label)
808
-            || ! is_array($items_label)
809
-            || ! isset($items_label['single'])
810
-            || ! isset($items_label['plural'])
811
-        ) {
812
-            $items_label = array(
813
-                'single' => __('1 item', 'event_espresso'),
814
-                'plural' => __('%s items', 'event_espresso'),
815
-            );
816
-        } else {
817
-            $items_label = array(
818
-                'single' => '1 ' . esc_html($items_label['single']),
819
-                'plural' => '%s ' . esc_html($items_label['plural']),
820
-            );
821
-        }
822
-
823
-        $total_pages = ceil($total_items / $per_page);
824
-
825
-        if ($total_pages <= 1) {
826
-            return '';
827
-        }
828
-
829
-        $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
830
-
831
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
832
-
833
-        if ($current === 1) {
834
-            $disable_first = ' disabled';
835
-        }
836
-        if ($current == $total_pages) {
837
-            $disable_last = ' disabled';
838
-        }
839
-
840
-        $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
841
-            'first-page' . $disable_first,
842
-            esc_attr__('Go to the first page'),
843
-            esc_url(remove_query_arg($paged_arg_name, $url)),
844
-            '&laquo;'
845
-        );
846
-
847
-        $page_links[] = sprintf(
848
-            '<a class="%s" title="%s" href="%s">%s</a>',
849
-            'prev-page' . $disable_first,
850
-            esc_attr__('Go to the previous page'),
851
-            esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
852
-            '&lsaquo;'
853
-        );
854
-
855
-        if ( ! $show_num_field) {
856
-            $html_current_page = $current;
857
-        } else {
858
-            $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
859
-                esc_attr__('Current page'),
860
-                $current,
861
-                strlen($total_pages)
862
-            );
863
-        }
864
-
865
-        $html_total_pages = sprintf(
866
-            '<span class="total-pages">%s</span>',
867
-            number_format_i18n($total_pages)
868
-        );
869
-        $page_links[]     = sprintf(
870
-            _x('%3$s%1$s of %2$s%4$s', 'paging'),
871
-            $html_current_page,
872
-            $html_total_pages,
873
-            '<span class="paging-input">',
874
-            '</span>'
875
-        );
876
-
877
-        $page_links[] = sprintf(
878
-            '<a class="%s" title="%s" href="%s">%s</a>',
879
-            'next-page' . $disable_last,
880
-            esc_attr__('Go to the next page'),
881
-            esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
882
-            '&rsaquo;'
883
-        );
884
-
885
-        $page_links[] = sprintf(
886
-            '<a class="%s" title="%s" href="%s">%s</a>',
887
-            'last-page' . $disable_last,
888
-            esc_attr__('Go to the last page'),
889
-            esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
890
-            '&raquo;'
891
-        );
892
-
893
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
894
-        // set page class
895
-        if ($total_pages) {
896
-            $page_class = $total_pages < 2 ? ' one-page' : '';
897
-        } else {
898
-            $page_class = ' no-pages';
899
-        }
900
-
901
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
902
-    }
903
-
904
-
905
-    /**
906
-     * @param string $wrap_class
907
-     * @param string $wrap_id
908
-     * @return string
909
-     */
910
-    public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array())
911
-    {
912
-        $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
913
-        if (
914
-            ! $admin &&
915
-            ! apply_filters(
916
-                'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
917
-                EE_Registry::instance()->CFG->admin->show_reg_footer
918
-            )
919
-        ) {
920
-            return '';
921
-        }
922
-        $tag        = $admin ? 'span' : 'div';
923
-        $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
924
-        $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
925
-        $attributes .= ! empty($wrap_class)
926
-            ? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
927
-            : ' class="powered-by-event-espresso-credit"';
928
-        $query_args = array_merge(
929
-            array(
930
-                'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
931
-                'utm_source'   => 'powered_by_event_espresso',
932
-                'utm_medium'   => 'link',
933
-                'utm_campaign' => 'powered_by',
934
-            ),
935
-            $query_args
936
-        );
937
-        $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text',
938
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso');
939
-        $url        = add_query_arg($query_args, 'https://eventespresso.com/');
940
-        $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
941
-        return (string)apply_filters(
942
-            'FHEE__EEH_Template__powered_by_event_espresso__html',
943
-            sprintf(
944
-                esc_html_x(
945
-                    '%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
946
-                    'Online event registration and ticketing powered by [link to eventespresso.com]',
947
-                    'event_espresso'
948
-                ),
949
-                "<{$tag}{$attributes}>",
950
-                "<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
951
-                $admin ? '' : '<br />'
952
-            ),
953
-            $wrap_class,
954
-            $wrap_id
955
-        );
956
-    }
730
+			}
731
+		} else {
732
+			//simple value
733
+			echo esc_html($data);
734
+		}
735
+		return ob_get_clean();
736
+	}
737
+
738
+
739
+	/**
740
+	 * wrapper for self::get_paging_html() that simply echos the generated paging html
741
+	 *
742
+	 * @since 4.4.0
743
+	 * @see   self:get_paging_html() for argument docs.
744
+	 * @param        $total_items
745
+	 * @param        $current
746
+	 * @param        $per_page
747
+	 * @param        $url
748
+	 * @param bool   $show_num_field
749
+	 * @param string $paged_arg_name
750
+	 * @param array  $items_label
751
+	 * @return string
752
+	 */
753
+	public static function paging_html(
754
+		$total_items,
755
+		$current,
756
+		$per_page,
757
+		$url,
758
+		$show_num_field = true,
759
+		$paged_arg_name = 'paged',
760
+		$items_label = array()
761
+	) {
762
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name,
763
+			$items_label);
764
+	}
765
+
766
+
767
+	/**
768
+	 * A method for generating paging similar to WP_List_Table
769
+	 *
770
+	 * @since    4.4.0
771
+	 * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
772
+	 * @param  integer $total_items     How many total items there are to page.
773
+	 * @param  integer $current         What the current page is.
774
+	 * @param  integer $per_page        How many items per page.
775
+	 * @param  string  $url             What the base url for page links is.
776
+	 * @param  boolean $show_num_field  Whether to show the input for changing page number.
777
+	 * @param  string  $paged_arg_name  The name of the key for the paged query argument.
778
+	 * @param  array   $items_label     An array of singular/plural values for the items label:
779
+	 *                                  array(
780
+	 *                                  'single' => 'item',
781
+	 *                                  'plural' => 'items'
782
+	 *                                  )
783
+	 * @return  string
784
+	 */
785
+	public static function get_paging_html(
786
+		$total_items,
787
+		$current,
788
+		$per_page,
789
+		$url,
790
+		$show_num_field = true,
791
+		$paged_arg_name = 'paged',
792
+		$items_label = array()
793
+	) {
794
+		$page_links     = array();
795
+		$disable_first  = $disable_last = '';
796
+		$total_items    = (int)$total_items;
797
+		$per_page       = (int)$per_page;
798
+		$current        = (int)$current;
799
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
800
+
801
+		//filter items_label
802
+		$items_label = apply_filters(
803
+			'FHEE__EEH_Template__get_paging_html__items_label',
804
+			$items_label
805
+		);
806
+
807
+		if (empty($items_label)
808
+			|| ! is_array($items_label)
809
+			|| ! isset($items_label['single'])
810
+			|| ! isset($items_label['plural'])
811
+		) {
812
+			$items_label = array(
813
+				'single' => __('1 item', 'event_espresso'),
814
+				'plural' => __('%s items', 'event_espresso'),
815
+			);
816
+		} else {
817
+			$items_label = array(
818
+				'single' => '1 ' . esc_html($items_label['single']),
819
+				'plural' => '%s ' . esc_html($items_label['plural']),
820
+			);
821
+		}
822
+
823
+		$total_pages = ceil($total_items / $per_page);
824
+
825
+		if ($total_pages <= 1) {
826
+			return '';
827
+		}
828
+
829
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
830
+
831
+		$output = '<span class="displaying-num">' . $item_label . '</span>';
832
+
833
+		if ($current === 1) {
834
+			$disable_first = ' disabled';
835
+		}
836
+		if ($current == $total_pages) {
837
+			$disable_last = ' disabled';
838
+		}
839
+
840
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
841
+			'first-page' . $disable_first,
842
+			esc_attr__('Go to the first page'),
843
+			esc_url(remove_query_arg($paged_arg_name, $url)),
844
+			'&laquo;'
845
+		);
846
+
847
+		$page_links[] = sprintf(
848
+			'<a class="%s" title="%s" href="%s">%s</a>',
849
+			'prev-page' . $disable_first,
850
+			esc_attr__('Go to the previous page'),
851
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
852
+			'&lsaquo;'
853
+		);
854
+
855
+		if ( ! $show_num_field) {
856
+			$html_current_page = $current;
857
+		} else {
858
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
859
+				esc_attr__('Current page'),
860
+				$current,
861
+				strlen($total_pages)
862
+			);
863
+		}
864
+
865
+		$html_total_pages = sprintf(
866
+			'<span class="total-pages">%s</span>',
867
+			number_format_i18n($total_pages)
868
+		);
869
+		$page_links[]     = sprintf(
870
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
871
+			$html_current_page,
872
+			$html_total_pages,
873
+			'<span class="paging-input">',
874
+			'</span>'
875
+		);
876
+
877
+		$page_links[] = sprintf(
878
+			'<a class="%s" title="%s" href="%s">%s</a>',
879
+			'next-page' . $disable_last,
880
+			esc_attr__('Go to the next page'),
881
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
882
+			'&rsaquo;'
883
+		);
884
+
885
+		$page_links[] = sprintf(
886
+			'<a class="%s" title="%s" href="%s">%s</a>',
887
+			'last-page' . $disable_last,
888
+			esc_attr__('Go to the last page'),
889
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
890
+			'&raquo;'
891
+		);
892
+
893
+		$output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
894
+		// set page class
895
+		if ($total_pages) {
896
+			$page_class = $total_pages < 2 ? ' one-page' : '';
897
+		} else {
898
+			$page_class = ' no-pages';
899
+		}
900
+
901
+		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
902
+	}
903
+
904
+
905
+	/**
906
+	 * @param string $wrap_class
907
+	 * @param string $wrap_id
908
+	 * @return string
909
+	 */
910
+	public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array())
911
+	{
912
+		$admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
913
+		if (
914
+			! $admin &&
915
+			! apply_filters(
916
+				'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
917
+				EE_Registry::instance()->CFG->admin->show_reg_footer
918
+			)
919
+		) {
920
+			return '';
921
+		}
922
+		$tag        = $admin ? 'span' : 'div';
923
+		$attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
924
+		$wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
925
+		$attributes .= ! empty($wrap_class)
926
+			? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
927
+			: ' class="powered-by-event-espresso-credit"';
928
+		$query_args = array_merge(
929
+			array(
930
+				'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
931
+				'utm_source'   => 'powered_by_event_espresso',
932
+				'utm_medium'   => 'link',
933
+				'utm_campaign' => 'powered_by',
934
+			),
935
+			$query_args
936
+		);
937
+		$powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text',
938
+			$admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso');
939
+		$url        = add_query_arg($query_args, 'https://eventespresso.com/');
940
+		$url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
941
+		return (string)apply_filters(
942
+			'FHEE__EEH_Template__powered_by_event_espresso__html',
943
+			sprintf(
944
+				esc_html_x(
945
+					'%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
946
+					'Online event registration and ticketing powered by [link to eventespresso.com]',
947
+					'event_espresso'
948
+				),
949
+				"<{$tag}{$attributes}>",
950
+				"<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
951
+				$admin ? '' : '<br />'
952
+			),
953
+			$wrap_class,
954
+			$wrap_id
955
+		);
956
+	}
957 957
 
958 958
 
959 959
 } //end EEH_Template class
@@ -962,33 +962,33 @@  discard block
 block discarded – undo
962 962
 
963 963
 
964 964
 if ( ! function_exists('espresso_pagination')) {
965
-    /**
966
-     *    espresso_pagination
967
-     *
968
-     * @access    public
969
-     * @return    void
970
-     */
971
-    function espresso_pagination()
972
-    {
973
-        global $wp_query;
974
-        $big        = 999999999; // need an unlikely integer
975
-        $pagination = paginate_links(
976
-            array(
977
-                'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
978
-                'format'       => '?paged=%#%',
979
-                'current'      => max(1, get_query_var('paged')),
980
-                'total'        => $wp_query->max_num_pages,
981
-                'show_all'     => true,
982
-                'end_size'     => 10,
983
-                'mid_size'     => 6,
984
-                'prev_next'    => true,
985
-                'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
986
-                'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
987
-                'type'         => 'plain',
988
-                'add_args'     => false,
989
-                'add_fragment' => '',
990
-            )
991
-        );
992
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : '';
993
-    }
965
+	/**
966
+	 *    espresso_pagination
967
+	 *
968
+	 * @access    public
969
+	 * @return    void
970
+	 */
971
+	function espresso_pagination()
972
+	{
973
+		global $wp_query;
974
+		$big        = 999999999; // need an unlikely integer
975
+		$pagination = paginate_links(
976
+			array(
977
+				'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
978
+				'format'       => '?paged=%#%',
979
+				'current'      => max(1, get_query_var('paged')),
980
+				'total'        => $wp_query->max_num_pages,
981
+				'show_all'     => true,
982
+				'end_size'     => 10,
983
+				'mid_size'     => 6,
984
+				'prev_next'    => true,
985
+				'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
986
+				'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
987
+				'type'         => 'plain',
988
+				'add_args'     => false,
989
+				'add_fragment' => '',
990
+			)
991
+		);
992
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : '';
993
+	}
994 994
 }
995 995
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined('EVENT_ESPRESSO_VERSION')) {
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3 3
     exit('NO direct script access allowed');
4 4
 }
5 5
 /**
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     public static function load_espresso_theme_functions()
82 82
     {
83 83
         if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
84
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php')) {
85
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php');
84
+            if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
85
+                require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
86 86
             }
87 87
         }
88 88
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public static function get_espresso_themes()
97 97
     {
98 98
         if (empty(EEH_Template::$_espresso_themes)) {
99
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
99
+            $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
100 100
             if (empty($espresso_themes)) {
101 101
                 return array();
102 102
             }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     ) {
133 133
         do_action("get_template_part_{$slug}-{$name}", $slug, $name);
134 134
         $templates = array();
135
-        $name      = (string)$name;
135
+        $name      = (string) $name;
136 136
         if ($name != '') {
137 137
             $templates[] = "{$slug}-{$name}.php";
138 138
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                 if (isset($EE_CPTs[$post_type])) {
212 212
                     $archive_or_single = is_archive() ? 'archive' : '';
213 213
                     $archive_or_single = is_single() ? 'single' : $archive_or_single;
214
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
214
+                    $templates         = $archive_or_single.'-'.$post_type.'.php';
215 215
                 }
216 216
             }
217 217
             // currently active EE template theme
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
             // array of paths to folders that may contain templates
221 221
             $template_folder_paths = array(
222 222
                 // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
223
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
223
+                EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
224 224
                 // then in the root of the /wp-content/uploads/espresso/templates/ folder
225 225
                 EVENT_ESPRESSO_TEMPLATE_DIR,
226 226
             );
227 227
 
228 228
             //add core plugin folders for checking only if we're not $check_if_custom
229 229
             if ( ! $check_if_custom) {
230
-                $core_paths            = array(
230
+                $core_paths = array(
231 231
                     // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
232
-                    EE_PUBLIC . $current_theme,
232
+                    EE_PUBLIC.$current_theme,
233 233
                     // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
234
-                    EE_TEMPLATES . $current_theme,
234
+                    EE_TEMPLATES.$current_theme,
235 235
                     // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
236 236
                     EE_PLUGIN_DIR_PATH,
237 237
                 );
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
                     );
263 263
                     if ($common_base_path !== '') {
264 264
                         // both paths have a common base, so just tack the filename onto our search path
265
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
265
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
266 266
                     } else {
267 267
                         // no common base path, so let's just concatenate
268
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
268
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
269 269
                     }
270 270
                     // build up our template locations array by adding our resolved paths
271 271
                     $full_template_paths[] = $resolved_path;
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
                 // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
274 274
                 array_unshift($full_template_paths, $template);
275 275
                 // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
276
-                array_unshift($full_template_paths, get_stylesheet_directory() . DS . $file_name);
276
+                array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
277 277
             }
278 278
             // filter final array of full template paths
279 279
             $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths',
280 280
                 $full_template_paths, $file_name);
281 281
             // now loop through our final array of template location paths and check each location
282
-            foreach ((array)$full_template_paths as $full_template_path) {
282
+            foreach ((array) $full_template_paths as $full_template_path) {
283 283
                 if (is_readable($full_template_path)) {
284 284
                     $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
285 285
                     break;
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
         if ( ! is_array($template_args) && ! is_object($template_args)) {
367 367
             $template_args = array($template_args);
368 368
         }
369
-        extract( $template_args, EXTR_SKIP );
369
+        extract($template_args, EXTR_SKIP);
370 370
         // ignore whether template is accessible ?
371
-        if ( $throw_exceptions && ! is_readable( $template_path ) ) {
371
+        if ($throw_exceptions && ! is_readable($template_path)) {
372 372
             throw new \DomainException(
373 373
                     esc_html__(
374 374
                             'Invalid, unreadable, or missing file.',
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
     public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
402 402
     {
403 403
         // in the beginning...
404
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
404
+        $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
405 405
         // da muddle
406 406
         $class = '';
407 407
         // the end
408
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
408
+        $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
409 409
         // is the passed object an EE object ?
410 410
         if ($object instanceof EE_Base_Class) {
411 411
             // grab the exact type of object
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
                 // no specifics just yet...
416 416
                 default :
417 417
                     $class = strtolower(str_replace('_', '-', $obj_class));
418
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
418
+                    $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
419 419
 
420 420
             }
421 421
         }
422
-        return $prefix . $class . $suffix;
422
+        return $prefix.$class.$suffix;
423 423
     }
424 424
 
425 425
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
             return '';
452 452
         }
453 453
         //ensure amount is float
454
-        $amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float)$amount);
454
+        $amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
455 455
         $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
456 456
         // filter raw amount (allows 0.00 to be changed to "free" for example)
457 457
         $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
@@ -473,20 +473,20 @@  discard block
 block discarded – undo
473 473
                 // add currency sign
474 474
                 if ($mny->sign_b4) {
475 475
                     if ($amount >= 0) {
476
-                        $amount_formatted = $mny->sign . $amount_formatted;
476
+                        $amount_formatted = $mny->sign.$amount_formatted;
477 477
                     } else {
478
-                        $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
478
+                        $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
479 479
                     }
480 480
 
481 481
                 } else {
482
-                    $amount_formatted = $amount_formatted . $mny->sign;
482
+                    $amount_formatted = $amount_formatted.$mny->sign;
483 483
                 }
484 484
 
485 485
                 // filter to allow global setting of display_code
486 486
                 $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
487 487
 
488 488
                 // add currency code ?
489
-                $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
489
+                $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
490 490
             }
491 491
             // filter results
492 492
             $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted',
@@ -540,12 +540,12 @@  discard block
 block discarded – undo
540 540
             $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
541 541
             foreach ($dashicons as $dashicon) {
542 542
                 $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
543
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
543
+                $icon_html .= '<span class="'.$type.$dashicon.'"></span>';
544 544
             }
545 545
             $icon_html .= $count > 1 ? '</span>' : '';
546 546
         }
547
-        $label  = ! empty($icon) ? $icon_html . $label : $label;
548
-        $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>';
547
+        $label  = ! empty($icon) ? $icon_html.$label : $label;
548
+        $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>';
549 549
         return $button;
550 550
     }
551 551
 
@@ -579,11 +579,11 @@  discard block
 block discarded – undo
579 579
         $action = empty($action) ? 'default' : $action;
580 580
 
581 581
 
582
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
582
+        $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
583 583
         $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
584 584
         $help_text    = ! $help_text ? '' : $help_text;
585
-        return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
586
-                'event_espresso') . '" > ' . $help_text . ' </a>';
585
+        return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
586
+                'event_espresso').'" > '.$help_text.' </a>';
587 587
     }
588 588
 
589 589
 
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
         $id    = $tour->get_slug();
601 601
         $stops = $tour->get_stops();
602 602
 
603
-        $content = '<ol style="display:none" id="' . $id . '">';
603
+        $content = '<ol style="display:none" id="'.$id.'">';
604 604
 
605 605
         foreach ($stops as $stop) {
606
-            $data_id    = ! empty($stop['id']) ? ' data-id="' . $stop['id'] . '"' : '';
607
-            $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="' . $stop['class'] . '"' : '';
606
+            $data_id    = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
607
+            $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
608 608
 
609 609
             //if container is set to modal then let's make sure we set the options accordingly
610 610
             if (empty($data_id) && empty($data_class)) {
@@ -612,15 +612,15 @@  discard block
 block discarded – undo
612 612
                 $stop['options']['expose'] = true;
613 613
             }
614 614
 
615
-            $custom_class  = ! empty($stop['custom_class']) ? ' class="' . $stop['custom_class'] . '"' : '';
616
-            $button_text   = ! empty($stop['button_text']) ? ' data-button="' . $stop['button_text'] . '"' : '';
615
+            $custom_class  = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
616
+            $button_text   = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
617 617
             $inner_content = isset($stop['content']) ? $stop['content'] : '';
618 618
 
619 619
             //options
620 620
             if (isset($stop['options']) && is_array($stop['options'])) {
621 621
                 $options = ' data-options="';
622 622
                 foreach ($stop['options'] as $option => $value) {
623
-                    $options .= $option . ':' . $value . ';';
623
+                    $options .= $option.':'.$value.';';
624 624
                 }
625 625
                 $options .= '"';
626 626
             } else {
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
             }
629 629
 
630 630
             //let's put all together
631
-            $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
631
+            $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
632 632
         }
633 633
 
634 634
         $content .= '</ol>';
@@ -660,24 +660,24 @@  discard block
 block discarded – undo
660 660
         $setup_array = array();
661 661
         foreach ($status_array as $item => $status) {
662 662
             $setup_array[$item] = array(
663
-                'class'  => 'ee-status-legend ee-status-legend-' . $status,
663
+                'class'  => 'ee-status-legend ee-status-legend-'.$status,
664 664
                 'desc'   => EEH_Template::pretty_status($status, false, 'sentence'),
665 665
                 'status' => $status,
666 666
             );
667 667
         }
668 668
 
669
-        $content = '<div class="ee-list-table-legend-container">' . "\n";
670
-        $content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n";
671
-        $content .= '<dl class="ee-list-table-legend">' . "\n\t";
669
+        $content = '<div class="ee-list-table-legend-container">'."\n";
670
+        $content .= '<h4 class="status-legend-title">'.esc_html__('Status Legend', 'event_espresso').'</h4>'."\n";
671
+        $content .= '<dl class="ee-list-table-legend">'."\n\t";
672 672
         foreach ($setup_array as $item => $details) {
673 673
             $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
674
-            $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
675
-            $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
676
-            $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
677
-            $content .= '</dt>' . "\n";
674
+            $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
675
+            $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
676
+            $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
677
+            $content .= '</dt>'."\n";
678 678
         }
679
-        $content .= '</dl>' . "\n";
680
-        $content .= '</div>' . "\n";
679
+        $content .= '</dl>'."\n";
680
+        $content .= '</div>'."\n";
681 681
         return $content;
682 682
     }
683 683
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
     public static function layout_array_as_table($data)
693 693
     {
694 694
         if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
695
-            $data = (array)$data;
695
+            $data = (array) $data;
696 696
         }
697 697
         ob_start();
698 698
         if (is_array($data)) {
@@ -793,9 +793,9 @@  discard block
 block discarded – undo
793 793
     ) {
794 794
         $page_links     = array();
795 795
         $disable_first  = $disable_last = '';
796
-        $total_items    = (int)$total_items;
797
-        $per_page       = (int)$per_page;
798
-        $current        = (int)$current;
796
+        $total_items    = (int) $total_items;
797
+        $per_page       = (int) $per_page;
798
+        $current        = (int) $current;
799 799
         $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
800 800
 
801 801
         //filter items_label
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
             );
816 816
         } else {
817 817
             $items_label = array(
818
-                'single' => '1 ' . esc_html($items_label['single']),
819
-                'plural' => '%s ' . esc_html($items_label['plural']),
818
+                'single' => '1 '.esc_html($items_label['single']),
819
+                'plural' => '%s '.esc_html($items_label['plural']),
820 820
             );
821 821
         }
822 822
 
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 
829 829
         $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
830 830
 
831
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
831
+        $output = '<span class="displaying-num">'.$item_label.'</span>';
832 832
 
833 833
         if ($current === 1) {
834 834
             $disable_first = ' disabled';
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
         }
839 839
 
840 840
         $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
841
-            'first-page' . $disable_first,
841
+            'first-page'.$disable_first,
842 842
             esc_attr__('Go to the first page'),
843 843
             esc_url(remove_query_arg($paged_arg_name, $url)),
844 844
             '&laquo;'
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 
847 847
         $page_links[] = sprintf(
848 848
             '<a class="%s" title="%s" href="%s">%s</a>',
849
-            'prev-page' . $disable_first,
849
+            'prev-page'.$disable_first,
850 850
             esc_attr__('Go to the previous page'),
851 851
             esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
852 852
             '&lsaquo;'
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
             '<span class="total-pages">%s</span>',
867 867
             number_format_i18n($total_pages)
868 868
         );
869
-        $page_links[]     = sprintf(
869
+        $page_links[] = sprintf(
870 870
             _x('%3$s%1$s of %2$s%4$s', 'paging'),
871 871
             $html_current_page,
872 872
             $html_total_pages,
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
         $page_links[] = sprintf(
878 878
             '<a class="%s" title="%s" href="%s">%s</a>',
879
-            'next-page' . $disable_last,
879
+            'next-page'.$disable_last,
880 880
             esc_attr__('Go to the next page'),
881 881
             esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
882 882
             '&rsaquo;'
@@ -884,13 +884,13 @@  discard block
 block discarded – undo
884 884
 
885 885
         $page_links[] = sprintf(
886 886
             '<a class="%s" title="%s" href="%s">%s</a>',
887
-            'last-page' . $disable_last,
887
+            'last-page'.$disable_last,
888 888
             esc_attr__('Go to the last page'),
889 889
             esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
890 890
             '&raquo;'
891 891
         );
892 892
 
893
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
893
+        $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
894 894
         // set page class
895 895
         if ($total_pages) {
896 896
             $page_class = $total_pages < 2 ? ' one-page' : '';
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
             $page_class = ' no-pages';
899 899
         }
900 900
 
901
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
901
+        return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
902 902
     }
903 903
 
904 904
 
@@ -935,10 +935,10 @@  discard block
 block discarded – undo
935 935
             $query_args
936 936
         );
937 937
         $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text',
938
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso');
938
+            $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso');
939 939
         $url        = add_query_arg($query_args, 'https://eventespresso.com/');
940 940
         $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
941
-        return (string)apply_filters(
941
+        return (string) apply_filters(
942 942
             'FHEE__EEH_Template__powered_by_event_espresso__html',
943 943
             sprintf(
944 944
                 esc_html_x(
@@ -989,6 +989,6 @@  discard block
 block discarded – undo
989 989
                 'add_fragment' => '',
990 990
             )
991 991
         );
992
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : '';
992
+        echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : '';
993 993
     }
994 994
 }
995 995
\ No newline at end of file
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * process_ticket_selections
199 199
 	 *
200 200
 	 * @access        public
201
-	 * @return        array  or FALSE
201
+	 * @return        boolean|null  or FALSE
202 202
 	 * @throws \EE_Error
203 203
 	 */
204 204
 	public function process_ticket_selections() {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      * cancel_ticket_selections
213 213
      *
214 214
      * @access        public
215
-     * @return        string
215
+     * @return        false|null
216 216
      */
217 217
     public static function cancel_ticket_selections()
218 218
     {
Please login to merge, or discard this patch.
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class EED_Ticket_Selector extends  EED_Module {
24 24
 
25
-    /**
26
-     * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector
27
-     */
28
-    private static $ticket_selector;
25
+	/**
26
+	 * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector
27
+	 */
28
+	private static $ticket_selector;
29 29
 
30
-    /**
31
-     * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button
32
-     */
33
-    private static $iframe_embed_button;
30
+	/**
31
+	 * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button
32
+	 */
33
+	private static $iframe_embed_button;
34 34
 
35 35
 
36 36
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 		// routing
62 62
 		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
63 63
 		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
64
-        EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
65
-        add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
64
+		EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
65
+		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
66 66
 		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
67
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 );
68
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
69
-        EED_Ticket_Selector::loadIframeAssets();
70
-    }
67
+		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 );
68
+		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
69
+		EED_Ticket_Selector::loadIframeAssets();
70
+	}
71 71
 
72 72
 
73 73
 
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 			10
87 87
 		);
88 88
 
89
-        /**
90
-         * Make sure assets for the ticket selector are loaded on the espresso registrations route so  admin side
91
-         * registrations work.
92
-         */
89
+		/**
90
+		 * Make sure assets for the ticket selector are loaded on the espresso registrations route so  admin side
91
+		 * registrations work.
92
+		 */
93 93
 		add_action(
94
-		    'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration',
95
-            array('EED_Ticket_Selector', 'set_definitions'),
96
-            10
97
-        );
98
-    }
94
+			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration',
95
+			array('EED_Ticket_Selector', 'set_definitions'),
96
+			10
97
+		);
98
+	}
99 99
 
100 100
 
101 101
 
@@ -111,23 +111,23 @@  discard block
 block discarded – undo
111 111
 
112 112
 		//if config is not set, initialize
113 113
 		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
114
-            \EED_Ticket_Selector::instance()->set_config();
115
-            \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
114
+			\EED_Ticket_Selector::instance()->set_config();
115
+			\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
116 116
 		}
117 117
 	}
118 118
 
119 119
 
120 120
 
121 121
 	/**
122
-     * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector
123
-     */
124
-    public static function ticketSelector()
125
-    {
126
-        if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) {
127
-            EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector();
128
-        }
129
-        return EED_Ticket_Selector::$ticket_selector;
130
-    }
122
+	 * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector
123
+	 */
124
+	public static function ticketSelector()
125
+	{
126
+		if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) {
127
+			EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector();
128
+		}
129
+		return EED_Ticket_Selector::$ticket_selector;
130
+	}
131 131
 
132 132
 
133 133
 	/**
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
 
183
-    /**
184
-     *    creates buttons for selecting number of attendees for an event
185
-     *
186
-     * @access    public
187
-     * @param    WP_Post|int $event
188
-     * @param    bool        $view_details
189
-     * @return    string
190
-     * @throws \EE_Error
191
-     */
183
+	/**
184
+	 *    creates buttons for selecting number of attendees for an event
185
+	 *
186
+	 * @access    public
187
+	 * @param    WP_Post|int $event
188
+	 * @param    bool        $view_details
189
+	 * @return    string
190
+	 * @throws \EE_Error
191
+	 */
192 192
 	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
193 193
 		return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details );
194 194
 	}
@@ -209,233 +209,233 @@  discard block
 block discarded – undo
209 209
 
210 210
 
211 211
 
212
-    /**
213
-     * cancel_ticket_selections
214
-     *
215
-     * @access        public
216
-     * @return        string
217
-     */
218
-    public static function cancel_ticket_selections()
219
-    {
220
-        $form = new ProcessTicketSelector();
221
-        return $form->cancelTicketSelections();
222
-    }
212
+	/**
213
+	 * cancel_ticket_selections
214
+	 *
215
+	 * @access        public
216
+	 * @return        string
217
+	 */
218
+	public static function cancel_ticket_selections()
219
+	{
220
+		$form = new ProcessTicketSelector();
221
+		return $form->cancelTicketSelections();
222
+	}
223 223
 
224 224
 
225 225
 
226 226
 	/**
227
-	* @return void
228
-	*/
227
+	 * @return void
228
+	 */
229 229
 	public static function translate_js_strings() {
230
-        EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__(
231
-            'please select a datetime', 'event_espresso'
232
-        );
233
-    }
230
+		EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__(
231
+			'please select a datetime', 'event_espresso'
232
+		);
233
+	}
234 234
 
235 235
 
236 236
 
237 237
 	/**
238
-	* 	load js
239
-	*
240
-	* 	@access 		public
241
-	* 	@return 		void
242
-	*/
238
+	 * 	load js
239
+	 *
240
+	 * 	@access 		public
241
+	 * 	@return 		void
242
+	 */
243 243
 	public static function load_tckt_slctr_assets() {
244 244
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
245
-            // add some style
245
+			// add some style
246 246
 			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
247 247
 			wp_enqueue_style('ticket_selector');
248 248
 			// make it dance
249 249
 			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
250 250
 			wp_enqueue_script('ticket_selector');
251
-            require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
252
-            \EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
253
-        }
251
+			require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
252
+			\EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
253
+		}
254
+	}
255
+
256
+
257
+
258
+	/**
259
+	 * @return void
260
+	 */
261
+	public static function loadIframeAssets()
262
+	{
263
+		// for event lists
264
+		add_filter(
265
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
266
+			array('EED_Ticket_Selector', 'iframeCss')
267
+		);
268
+		add_filter(
269
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
270
+			array('EED_Ticket_Selector', 'iframeJs')
271
+		);
272
+		// for ticket selectors
273
+		add_filter(
274
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
275
+			array('EED_Ticket_Selector', 'iframeCss')
276
+		);
277
+		add_filter(
278
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
279
+			array('EED_Ticket_Selector', 'iframeJs')
280
+		);
281
+	}
282
+
283
+
284
+
285
+	/**
286
+	 * Informs the rest of the forms system what CSS and JS is needed to display the input
287
+	 *
288
+	 * @param array $iframe_css
289
+	 * @return array
290
+	 */
291
+	public static function iframeCss(array $iframe_css)
292
+	{
293
+		$iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css';
294
+		return $iframe_css;
254 295
 	}
255 296
 
256 297
 
257 298
 
258
-    /**
259
-     * @return void
260
-     */
261
-    public static function loadIframeAssets()
262
-    {
263
-        // for event lists
264
-        add_filter(
265
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
266
-            array('EED_Ticket_Selector', 'iframeCss')
267
-        );
268
-        add_filter(
269
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
270
-            array('EED_Ticket_Selector', 'iframeJs')
271
-        );
272
-        // for ticket selectors
273
-        add_filter(
274
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
275
-            array('EED_Ticket_Selector', 'iframeCss')
276
-        );
277
-        add_filter(
278
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
279
-            array('EED_Ticket_Selector', 'iframeJs')
280
-        );
281
-    }
282
-
283
-
284
-
285
-    /**
286
-     * Informs the rest of the forms system what CSS and JS is needed to display the input
287
-     *
288
-     * @param array $iframe_css
289
-     * @return array
290
-     */
291
-    public static function iframeCss(array $iframe_css)
292
-    {
293
-        $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css';
294
-        return $iframe_css;
295
-    }
296
-
297
-
298
-
299
-    /**
300
-     * Informs the rest of the forms system what CSS and JS is needed to display the input
301
-     *
302
-     * @param array $iframe_js
303
-     * @return array
304
-     */
305
-    public static function iframeJs(array $iframe_js)
306
-    {
307
-        $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js';
308
-        return $iframe_js;
309
-    }
299
+	/**
300
+	 * Informs the rest of the forms system what CSS and JS is needed to display the input
301
+	 *
302
+	 * @param array $iframe_js
303
+	 * @return array
304
+	 */
305
+	public static function iframeJs(array $iframe_js)
306
+	{
307
+		$iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js';
308
+		return $iframe_js;
309
+	}
310 310
 
311 311
 
312 312
 	/****************************** DEPRECATED ******************************/
313 313
 
314 314
 
315 315
 
316
-    /**
317
-     * @deprecated
318
-     * @return string
319
-     * @throws \EE_Error
320
-     */
321
-    public static function display_view_details_btn()
322
-    {
323
-        // todo add doing_it_wrong() notice during next major version
324
-        return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton();
325
-    }
326
-
327
-
328
-
329
-    /**
330
-     * @deprecated
331
-     * @return string
332
-     * @throws \EE_Error
333
-     */
334
-    public static function display_ticket_selector_submit()
335
-    {
336
-        // todo add doing_it_wrong() notice during next major version
337
-        return EED_Ticket_Selector::ticketSelector()->displaySubmitButton();
338
-    }
339
-
340
-
341
-
342
-    /**
343
-     * @deprecated
344
-     * @param string $permalink_string
345
-     * @param int    $id
346
-     * @param string $new_title
347
-     * @param string $new_slug
348
-     * @return string
349
-     */
350
-    public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '')
351
-    {
352
-        // todo add doing_it_wrong() notice during next major version
353
-        if (
354
-        	\EE_Registry::instance()->REQ->get('page') === 'espresso_events'
355
-        	&& \EE_Registry::instance()->REQ->get('action') === 'edit'
356
-        ) {
357
-            $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
358
-            $iframe_embed_button->addEventEditorIframeEmbedButton();
359
-        }
360
-        return '';
361
-    }
362
-
363
-
364
-
365
-    /**
366
-     * @deprecated
367
-     * @param int    $ID
368
-     * @param string $external_url
369
-     * @return string
370
-     */
371
-    public static function ticket_selector_form_open($ID = 0, $external_url = '')
372
-    {
373
-        // todo add doing_it_wrong() notice during next major version
374
-        return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url);
375
-    }
376
-
377
-
378
-
379
-    /**
380
-     * @deprecated
381
-     * @return string
382
-     */
383
-    public static function ticket_selector_form_close()
384
-    {
385
-        // todo add doing_it_wrong() notice during next major version
386
-        return EED_Ticket_Selector::ticketSelector()->formClose();
387
-    }
388
-
389
-
390
-
391
-    /**
392
-     * @deprecated
393
-     * @return string
394
-     */
395
-    public static function no_tkt_slctr_end_dv()
396
-    {
397
-        // todo add doing_it_wrong() notice during next major version
398
-        return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv();
399
-    }
400
-
401
-
402
-
403
-    /**
404
-     * @deprecated 4.9.13
405
-     * @return string
406
-     */
407
-    public static function tkt_slctr_end_dv()
408
-    {
409
-        return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
410
-    }
411
-
412
-
413
-
414
-    /**
415
-     * @deprecated
416
-     * @return string
417
-     */
418
-    public static function clear_tkt_slctr()
419
-    {
420
-        return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
421
-    }
422
-
423
-
424
-
425
-    /**
426
-     * @deprecated
427
-     */
428
-    public static function load_tckt_slctr_assets_admin()
429
-    {
430
-        // todo add doing_it_wrong() notice during next major version
431
-	    if (
432
-		    \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events'
433
-		    && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit'
434
-	    ) {
435
-		    $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
436
-            $iframe_embed_button->embedButtonAssets();
437
-        }
438
-    }
316
+	/**
317
+	 * @deprecated
318
+	 * @return string
319
+	 * @throws \EE_Error
320
+	 */
321
+	public static function display_view_details_btn()
322
+	{
323
+		// todo add doing_it_wrong() notice during next major version
324
+		return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton();
325
+	}
326
+
327
+
328
+
329
+	/**
330
+	 * @deprecated
331
+	 * @return string
332
+	 * @throws \EE_Error
333
+	 */
334
+	public static function display_ticket_selector_submit()
335
+	{
336
+		// todo add doing_it_wrong() notice during next major version
337
+		return EED_Ticket_Selector::ticketSelector()->displaySubmitButton();
338
+	}
339
+
340
+
341
+
342
+	/**
343
+	 * @deprecated
344
+	 * @param string $permalink_string
345
+	 * @param int    $id
346
+	 * @param string $new_title
347
+	 * @param string $new_slug
348
+	 * @return string
349
+	 */
350
+	public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '')
351
+	{
352
+		// todo add doing_it_wrong() notice during next major version
353
+		if (
354
+			\EE_Registry::instance()->REQ->get('page') === 'espresso_events'
355
+			&& \EE_Registry::instance()->REQ->get('action') === 'edit'
356
+		) {
357
+			$iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
358
+			$iframe_embed_button->addEventEditorIframeEmbedButton();
359
+		}
360
+		return '';
361
+	}
362
+
363
+
364
+
365
+	/**
366
+	 * @deprecated
367
+	 * @param int    $ID
368
+	 * @param string $external_url
369
+	 * @return string
370
+	 */
371
+	public static function ticket_selector_form_open($ID = 0, $external_url = '')
372
+	{
373
+		// todo add doing_it_wrong() notice during next major version
374
+		return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url);
375
+	}
376
+
377
+
378
+
379
+	/**
380
+	 * @deprecated
381
+	 * @return string
382
+	 */
383
+	public static function ticket_selector_form_close()
384
+	{
385
+		// todo add doing_it_wrong() notice during next major version
386
+		return EED_Ticket_Selector::ticketSelector()->formClose();
387
+	}
388
+
389
+
390
+
391
+	/**
392
+	 * @deprecated
393
+	 * @return string
394
+	 */
395
+	public static function no_tkt_slctr_end_dv()
396
+	{
397
+		// todo add doing_it_wrong() notice during next major version
398
+		return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv();
399
+	}
400
+
401
+
402
+
403
+	/**
404
+	 * @deprecated 4.9.13
405
+	 * @return string
406
+	 */
407
+	public static function tkt_slctr_end_dv()
408
+	{
409
+		return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
410
+	}
411
+
412
+
413
+
414
+	/**
415
+	 * @deprecated
416
+	 * @return string
417
+	 */
418
+	public static function clear_tkt_slctr()
419
+	{
420
+		return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
421
+	}
422
+
423
+
424
+
425
+	/**
426
+	 * @deprecated
427
+	 */
428
+	public static function load_tckt_slctr_assets_admin()
429
+	{
430
+		// todo add doing_it_wrong() notice during next major version
431
+		if (
432
+			\EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events'
433
+			&& \EE_Registry::instance()->REQ->get( 'action' ) === 'edit'
434
+		) {
435
+			$iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
436
+			$iframe_embed_button->embedButtonAssets();
437
+		}
438
+	}
439 439
 
440 440
 
441 441
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\modules\ticket_selector\TicketSelectorIframe;
4 4
 use EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Ticket_Selector
39 39
 	 */
40 40
 	public static function instance() {
41
-		return parent::get_instance( __CLASS__ );
41
+		return parent::get_instance(__CLASS__);
42 42
 	}
43 43
 
44 44
 
45 45
 
46
-	protected function set_config(){
47
-		$this->set_config_section( 'template_settings' );
48
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
49
-		$this->set_config_name( 'EED_Ticket_Selector' );
46
+	protected function set_config() {
47
+		$this->set_config_section('template_settings');
48
+		$this->set_config_class('EE_Ticket_Selector_Config');
49
+		$this->set_config_name('EED_Ticket_Selector');
50 50
 	}
51 51
 
52 52
 
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public static function set_hooks() {
61 61
 		// routing
62
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
63
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
62
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
63
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
64 64
         EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
65
-        add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
66
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
67
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 );
68
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
65
+        add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
66
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
67
+        add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'translate_js_strings'), 0);
68
+        add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
69 69
         EED_Ticket_Selector::loadIframeAssets();
70 70
     }
71 71
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		// to load assets for "espresso_events" page on the "edit" route (action)
83 83
 		add_action(
84 84
 			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__edit',
85
-			array( 'EED_Ticket_Selector', 'ticket_selector_iframe_embed_button' ),
85
+			array('EED_Ticket_Selector', 'ticket_selector_iframe_embed_button'),
86 86
 			10
87 87
 		);
88 88
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	 *  @return 	void
107 107
 	 */
108 108
 	public static function set_definitions() {
109
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
110
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
109
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
110
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
111 111
 
112 112
 		//if config is not set, initialize
113
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
113
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config) {
114 114
             \EED_Ticket_Selector::instance()->set_config();
115 115
             \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
116 116
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	@param	WP $WP
138 138
 	 * 	@return void
139 139
 	 */
140
-	public function run( $WP ) {}
140
+	public function run($WP) {}
141 141
 
142 142
 
143 143
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return \EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton
146 146
 	 */
147 147
 	public static function getIframeEmbedButton() {
148
-		if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton ) {
148
+		if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) {
149 149
 			self::$iframe_embed_button = new TicketSelectorIframeEmbedButton();
150 150
 		}
151 151
 		return self::$iframe_embed_button;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
      * @return    string
190 190
      * @throws \EE_Error
191 191
      */
192
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
193
-		return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details );
192
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
193
+		return EED_Ticket_Selector::ticketSelector()->display($event, $view_details);
194 194
 	}
195 195
 
196 196
 
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 	* 	@return 		void
242 242
 	*/
243 243
 	public static function load_tckt_slctr_assets() {
244
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
244
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
245 245
             // add some style
246
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
246
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
247 247
 			wp_enqueue_style('ticket_selector');
248 248
 			// make it dance
249
-			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
249
+			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js', array('espresso_core'), '', TRUE);
250 250
 			wp_enqueue_script('ticket_selector');
251
-            require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
251
+            require_once(EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
252 252
             \EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
253 253
         }
254 254
 	}
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      */
291 291
     public static function iframeCss(array $iframe_css)
292 292
     {
293
-        $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css';
293
+        $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css';
294 294
         return $iframe_css;
295 295
     }
296 296
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public static function iframeJs(array $iframe_js)
306 306
     {
307
-        $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js';
307
+        $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js';
308 308
         return $iframe_js;
309 309
     }
310 310
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
     {
430 430
         // todo add doing_it_wrong() notice during next major version
431 431
 	    if (
432
-		    \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events'
433
-		    && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit'
432
+		    \EE_Registry::instance()->REQ->get('page') === 'espresso_events'
433
+		    && \EE_Registry::instance()->REQ->get('action') === 'edit'
434 434
 	    ) {
435 435
 		    $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
436 436
             $iframe_embed_button->embedButtonAssets();
Please login to merge, or discard this patch.
core/services/database/TableAnalysis.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -105,29 +105,29 @@
 block discarded – undo
105 105
 
106 106
 
107 107
 
108
-    /**
109
-     * @param $table_name
110
-     * @param $index_name
111
-     * @return array of columns used on that index, Each entry is an object with the following properties {
112
-     *  @type string Table
113
-     *  @type string Non_unique "0" or "1"
114
-     *  @type string Key_name
115
-     *  @type string Seq_in_index
116
-     *  @type string Column_name
117
-     *  @type string Collation
118
-     *  @type string Cardinality
119
-     *  @type string Sub_part on a column, usually this is just the number of characters from this column to use in indexing
120
-     *  @type string|null Packed
121
-     *  @type string Null
122
-     *  @type string Index_type
123
-     *  @type string Comment
124
-     *  @type string Index_comment
125
-     * }
126
-     */
108
+	/**
109
+	 * @param $table_name
110
+	 * @param $index_name
111
+	 * @return array of columns used on that index, Each entry is an object with the following properties {
112
+	 *  @type string Table
113
+	 *  @type string Non_unique "0" or "1"
114
+	 *  @type string Key_name
115
+	 *  @type string Seq_in_index
116
+	 *  @type string Column_name
117
+	 *  @type string Collation
118
+	 *  @type string Cardinality
119
+	 *  @type string Sub_part on a column, usually this is just the number of characters from this column to use in indexing
120
+	 *  @type string|null Packed
121
+	 *  @type string Null
122
+	 *  @type string Index_type
123
+	 *  @type string Comment
124
+	 *  @type string Index_comment
125
+	 * }
126
+	 */
127 127
 	public function showIndexes($table_name, $index_name){
128
-	    global $wpdb;
129
-        $table_name = $this->ensureTableNameHasPrefix($table_name);
130
-        $index_exists_query = "SHOW INDEX FROM {$table_name} WHERE Key_name = '{$index_name}'";
131
-        return $wpdb->get_results($index_exists_query);
132
-    }
128
+		global $wpdb;
129
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
130
+		$index_exists_query = "SHOW INDEX FROM {$table_name} WHERE Key_name = '{$index_name}'";
131
+		return $wpdb->get_results($index_exists_query);
132
+	}
133 133
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 * @param string $table_name
25 25
 	 * @return string $tableName, having ensured it has the wpdb prefix on the front
26 26
 	 */
27
-	public function ensureTableNameHasPrefix( $table_name )
27
+	public function ensureTableNameHasPrefix($table_name)
28 28
 	{
29 29
 		global $wpdb;
30
-		return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
30
+		return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
31 31
 	}
32 32
 
33 33
 
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 * @param string $table_name
40 40
 	 * @return bool
41 41
 	 */
42
-	public function tableIsEmpty( $table_name )
42
+	public function tableIsEmpty($table_name)
43 43
 	{
44 44
 		global $wpdb;
45
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
46
-		if ( $this->tableExists( $table_name ) ) {
47
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
48
-			return absint( $count ) === 0 ? true : false;
45
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
46
+		if ($this->tableExists($table_name)) {
47
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
48
+			return absint($count) === 0 ? true : false;
49 49
 		}
50 50
 		return false;
51 51
 	}
@@ -60,24 +60,24 @@  discard block
 block discarded – undo
60 60
 	 * @param $table_name
61 61
 	 * @return bool
62 62
 	 */
63
-	public function tableExists( $table_name )
63
+	public function tableExists($table_name)
64 64
 	{
65 65
 		global $wpdb, $EZSQL_ERROR;
66
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
66
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
67 67
 		//ignore if this causes an sql error
68 68
 		$old_error = $wpdb->last_error;
69 69
 		$old_suppress_errors = $wpdb->suppress_errors();
70
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
70
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
71 71
 		$ezsql_error_cache = $EZSQL_ERROR;
72
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
73
-		$wpdb->show_errors( $old_show_errors_value );
74
-		$wpdb->suppress_errors( $old_suppress_errors );
72
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
73
+		$wpdb->show_errors($old_show_errors_value);
74
+		$wpdb->suppress_errors($old_suppress_errors);
75 75
 		$new_error = $wpdb->last_error;
76 76
 		$wpdb->last_error = $old_error;
77 77
 		$EZSQL_ERROR = $ezsql_error_cache;
78 78
 		//if there was a table doesn't exist error
79
-		if( ! empty( $new_error ) ) {
80
-			if(
79
+		if ( ! empty($new_error)) {
80
+			if (
81 81
 				in_array(
82 82
 					\EEH_Activation::last_wpdb_error_code(),
83 83
 					array(
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 					)
88 88
 				)
89 89
 				||
90
-				preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string
90
+				preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string
91 91
 			) {
92 92
 				return false;
93 93
 			} else {
94 94
 				//log this because that's weird. Just use the normal PHP error log
95 95
 				error_log(
96 96
 					sprintf(
97
-						__( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ),
97
+						__('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'),
98 98
 					$new_error
99 99
 					)
100 100
 				);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      *  @type string Index_comment
125 125
      * }
126 126
      */
127
-	public function showIndexes($table_name, $index_name){
127
+	public function showIndexes($table_name, $index_name) {
128 128
 	    global $wpdb;
129 129
         $table_name = $this->ensureTableNameHasPrefix($table_name);
130 130
         $index_exists_query = "SHOW INDEX FROM {$table_name} WHERE Key_name = '{$index_name}'";
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -390,43 +390,43 @@
 block discarded – undo
390 390
 			),
391 391
 			'EE_Data_Migration_Class_Base' => array(
392 392
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
393
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
393
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
394 394
 			),
395 395
 			'EE_DMS_Core_4_1_0' => array(
396 396
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
397
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
397
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
398 398
 			),
399 399
 			'EE_DMS_Core_4_2_0' => array(
400 400
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
401
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
401
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
402 402
 			),
403 403
 			'EE_DMS_Core_4_3_0' => array(
404 404
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
405
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
405
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
406 406
 			),
407 407
 			'EE_DMS_Core_4_4_0' => array(
408 408
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
409
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
409
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
410 410
 			),
411 411
 			'EE_DMS_Core_4_5_0' => array(
412 412
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
413
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
413
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
414 414
 			),
415 415
 			'EE_DMS_Core_4_6_0' => array(
416 416
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
417
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
417
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
418 418
 			),
419 419
 			'EE_DMS_Core_4_7_0' => array(
420 420
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
421
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
421
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
422 422
 			),
423 423
 			'EE_DMS_Core_4_8_0' => array(
424 424
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
425
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
425
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
426 426
 			),
427 427
 			'EE_DMS_Core_4_9_0' => array(
428 428
 				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
429
-                'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
429
+				'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache,
430 430
 			),
431 431
 		);
432 432
 	}
Please login to merge, or discard this patch.