Completed
Branch ADMIN-REFRESH (27e72b)
by
unknown
05:04 queued 02:25
created
core/helpers/EEH_Money.helper.php 1 patch
Indentation   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -12,241 +12,241 @@
 block discarded – undo
12 12
 class EEH_Money extends EEH_Base
13 13
 {
14 14
 
15
-    /**
16
-     * This removes all localized money formatting from the incoming value
17
-     * Note: uses this site's currency settings for deciding what is considered a
18
-     * "thousands separator" (usually the character "," )
19
-     * and what is a "decimal mark" (usually the character ".")
20
-     *
21
-     * @param int|float|string $money_value
22
-     * @param string           $CNT_ISO
23
-     * @return float
24
-     * @throws EE_Error
25
-     */
26
-    public static function strip_localized_money_formatting($money_value, $CNT_ISO = '')
27
-    {
28
-        $currency_config = EEH_Money::get_currency_config($CNT_ISO);
29
-        $money_value = str_replace(
30
-            array(
31
-                $currency_config->thsnds,
32
-                $currency_config->dec_mrk,
33
-            ),
34
-            array(
35
-                '', // remove thousands separator
36
-                '.', // convert decimal mark to what PHP expects
37
-            ),
38
-            $money_value
39
-        );
40
-        $money_value = filter_var(
41
-            $money_value,
42
-            FILTER_SANITIZE_NUMBER_FLOAT,
43
-            FILTER_FLAG_ALLOW_FRACTION
44
-        );
45
-        return $money_value;
46
-    }
15
+	/**
16
+	 * This removes all localized money formatting from the incoming value
17
+	 * Note: uses this site's currency settings for deciding what is considered a
18
+	 * "thousands separator" (usually the character "," )
19
+	 * and what is a "decimal mark" (usually the character ".")
20
+	 *
21
+	 * @param int|float|string $money_value
22
+	 * @param string           $CNT_ISO
23
+	 * @return float
24
+	 * @throws EE_Error
25
+	 */
26
+	public static function strip_localized_money_formatting($money_value, $CNT_ISO = '')
27
+	{
28
+		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
29
+		$money_value = str_replace(
30
+			array(
31
+				$currency_config->thsnds,
32
+				$currency_config->dec_mrk,
33
+			),
34
+			array(
35
+				'', // remove thousands separator
36
+				'.', // convert decimal mark to what PHP expects
37
+			),
38
+			$money_value
39
+		);
40
+		$money_value = filter_var(
41
+			$money_value,
42
+			FILTER_SANITIZE_NUMBER_FLOAT,
43
+			FILTER_FLAG_ALLOW_FRACTION
44
+		);
45
+		return $money_value;
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * This converts an incoming localized money value into a standard float item (to three decimal places)
51
-     * Only use this if you know the $money_value follows your currency configuration's
52
-     * settings. Note: this uses this site's currency settings for deciding what is considered a
53
-     * "thousands separator" (usually the character "," )
54
-     * and what is a "decimal mark" (usually the character ".")
55
-     *
56
-     * @param int|string $money_value
57
-     * @return float
58
-     * @throws EE_Error
59
-     */
60
-    public static function convert_to_float_from_localized_money($money_value)
61
-    {
62
-        // float it! and round to three decimal places
63
-        return round((float) EEH_Money::strip_localized_money_formatting($money_value), 3);
64
-    }
49
+	/**
50
+	 * This converts an incoming localized money value into a standard float item (to three decimal places)
51
+	 * Only use this if you know the $money_value follows your currency configuration's
52
+	 * settings. Note: this uses this site's currency settings for deciding what is considered a
53
+	 * "thousands separator" (usually the character "," )
54
+	 * and what is a "decimal mark" (usually the character ".")
55
+	 *
56
+	 * @param int|string $money_value
57
+	 * @return float
58
+	 * @throws EE_Error
59
+	 */
60
+	public static function convert_to_float_from_localized_money($money_value)
61
+	{
62
+		// float it! and round to three decimal places
63
+		return round((float) EEH_Money::strip_localized_money_formatting($money_value), 3);
64
+	}
65 65
 
66 66
 
67
-    /**
68
-     * For comparing floats. Default operator is '=', but see the $operator below for all options.
69
-     * This should be used to compare floats instead of normal '==' because floats
70
-     * are inherently imprecise, and so you can sometimes have two floats that appear to be identical
71
-     * but actually differ by 0.00000001.
72
-     *
73
-     * @see http://biostall.com/php-function-to-compare-floating-point-numbers
74
-     * @param float  $float1
75
-     * @param float  $float2
76
-     * @param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne
77
-     * @return bool whether the equation is true or false
78
-     * @throws EE_Error
79
-     */
80
-    public static function compare_floats($float1, $float2, $operator = '=')
81
-    {
82
-        // Check numbers to 5 digits of precision
83
-        $epsilon = 0.00001;
84
-        $float1 = (float) $float1;
85
-        $float2 = (float) $float2;
86
-        switch ($operator) {
87
-            // equal
88
-            case '=':
89
-            case '==':
90
-            case '===':
91
-            case 'eq':
92
-                if (abs($float1 - $float2) < $epsilon) {
93
-                    return true;
94
-                }
95
-                break;
96
-            // less than
97
-            case '<':
98
-            case 'lt':
99
-                if (abs($float1 - $float2) < $epsilon) {
100
-                    return false;
101
-                }
102
-                if ($float1 < $float2) {
103
-                    return true;
104
-                }
105
-                break;
106
-            // less than or equal
107
-            case '<=':
108
-            case 'lte':
109
-                if (
110
-                    self::compare_floats($float1, $float2, '<')
111
-                    || self::compare_floats($float1, $float2, '=')
112
-                ) {
113
-                    return true;
114
-                }
115
-                break;
116
-            // greater than
117
-            case '>':
118
-            case 'gt':
119
-                if (abs($float1 - $float2) < $epsilon) {
120
-                    return false;
121
-                }
122
-                if ($float1 > $float2) {
123
-                    return true;
124
-                }
125
-                break;
126
-            // greater than or equal
127
-            case '>=':
128
-            case 'gte':
129
-                if (
130
-                    self::compare_floats($float1, $float2, '>')
131
-                    || self::compare_floats($float1, $float2, '=')
132
-                ) {
133
-                    return true;
134
-                }
135
-                break;
136
-            case '<>':
137
-            case '!=':
138
-            case '!==':
139
-            case 'ne':
140
-                if (abs($float1 - $float2) > $epsilon) {
141
-                    return true;
142
-                }
143
-                break;
144
-            default:
145
-                throw new EE_Error(
146
-                    sprintf(
147
-                        esc_html__(
148
-                            "Unknown operator %s in EEH_Money::compare_floats()",
149
-                            'event_espresso'
150
-                        ),
151
-                        $operator
152
-                    )
153
-                );
154
-        }
155
-        return false;
156
-    }
67
+	/**
68
+	 * For comparing floats. Default operator is '=', but see the $operator below for all options.
69
+	 * This should be used to compare floats instead of normal '==' because floats
70
+	 * are inherently imprecise, and so you can sometimes have two floats that appear to be identical
71
+	 * but actually differ by 0.00000001.
72
+	 *
73
+	 * @see http://biostall.com/php-function-to-compare-floating-point-numbers
74
+	 * @param float  $float1
75
+	 * @param float  $float2
76
+	 * @param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne
77
+	 * @return bool whether the equation is true or false
78
+	 * @throws EE_Error
79
+	 */
80
+	public static function compare_floats($float1, $float2, $operator = '=')
81
+	{
82
+		// Check numbers to 5 digits of precision
83
+		$epsilon = 0.00001;
84
+		$float1 = (float) $float1;
85
+		$float2 = (float) $float2;
86
+		switch ($operator) {
87
+			// equal
88
+			case '=':
89
+			case '==':
90
+			case '===':
91
+			case 'eq':
92
+				if (abs($float1 - $float2) < $epsilon) {
93
+					return true;
94
+				}
95
+				break;
96
+			// less than
97
+			case '<':
98
+			case 'lt':
99
+				if (abs($float1 - $float2) < $epsilon) {
100
+					return false;
101
+				}
102
+				if ($float1 < $float2) {
103
+					return true;
104
+				}
105
+				break;
106
+			// less than or equal
107
+			case '<=':
108
+			case 'lte':
109
+				if (
110
+					self::compare_floats($float1, $float2, '<')
111
+					|| self::compare_floats($float1, $float2, '=')
112
+				) {
113
+					return true;
114
+				}
115
+				break;
116
+			// greater than
117
+			case '>':
118
+			case 'gt':
119
+				if (abs($float1 - $float2) < $epsilon) {
120
+					return false;
121
+				}
122
+				if ($float1 > $float2) {
123
+					return true;
124
+				}
125
+				break;
126
+			// greater than or equal
127
+			case '>=':
128
+			case 'gte':
129
+				if (
130
+					self::compare_floats($float1, $float2, '>')
131
+					|| self::compare_floats($float1, $float2, '=')
132
+				) {
133
+					return true;
134
+				}
135
+				break;
136
+			case '<>':
137
+			case '!=':
138
+			case '!==':
139
+			case 'ne':
140
+				if (abs($float1 - $float2) > $epsilon) {
141
+					return true;
142
+				}
143
+				break;
144
+			default:
145
+				throw new EE_Error(
146
+					sprintf(
147
+						esc_html__(
148
+							"Unknown operator %s in EEH_Money::compare_floats()",
149
+							'event_espresso'
150
+						),
151
+						$operator
152
+					)
153
+				);
154
+		}
155
+		return false;
156
+	}
157 157
 
158 158
 
159
-    /**
160
-     * This returns a localized format string suitable for jQplot.
161
-     *
162
-     * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
163
-     *                         Otherwise will use currency settings for current active country on site.
164
-     * @return string
165
-     * @throws EE_Error
166
-     */
167
-    public static function get_format_for_jqplot($CNT_ISO = '')
168
-    {
169
-        // default format
170
-        $format = 'f';
171
-        $currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO);
172
-        // first get the decimal place and number of places
173
-        $format = "%'." . $currency_config->dec_plc . $format;
174
-        // currency symbol on right side.
175
-        $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
176
-        return $format;
177
-    }
159
+	/**
160
+	 * This returns a localized format string suitable for jQplot.
161
+	 *
162
+	 * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
163
+	 *                         Otherwise will use currency settings for current active country on site.
164
+	 * @return string
165
+	 * @throws EE_Error
166
+	 */
167
+	public static function get_format_for_jqplot($CNT_ISO = '')
168
+	{
169
+		// default format
170
+		$format = 'f';
171
+		$currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO);
172
+		// first get the decimal place and number of places
173
+		$format = "%'." . $currency_config->dec_plc . $format;
174
+		// currency symbol on right side.
175
+		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
176
+		return $format;
177
+	}
178 178
 
179 179
 
180
-    /**
181
-     * This returns a localized format string suitable for usage with the Google Charts API format param.
182
-     *
183
-     * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
184
-     *                         Otherwise will use currency settings for current active country on site.
185
-     *                         Note: GoogleCharts uses ICU pattern set
186
-     *                         (@return array
187
-     * @throws EE_Error
188
-     * @see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
189
-     */
190
-    public static function get_format_for_google_charts($CNT_ISO = '')
191
-    {
192
-        $currency_config = EEH_Money::get_currency_config($CNT_ISO);
193
-        $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0');
194
-        // first get the decimal place and number of places
195
-        $format = '#,##0.' . $decimal_places_placeholder;
196
-        // currency symbol on right side.
197
-        $format = $currency_config->sign_b4
198
-            ? $currency_config->sign . $format
199
-            : $format
200
-              . $currency_config->sign;
201
-        $formatterObject = array(
202
-            'decimalSymbol'  => $currency_config->dec_mrk,
203
-            'groupingSymbol' => $currency_config->thsnds,
204
-            'fractionDigits' => $currency_config->dec_plc,
205
-        );
206
-        if ($currency_config->sign_b4) {
207
-            $formatterObject['prefix'] = $currency_config->sign;
208
-        } else {
209
-            $formatterObject['suffix'] = $currency_config->sign;
210
-        }
211
-        return array(
212
-            'format'          => $format,
213
-            'formatterObject' => $formatterObject,
214
-        );
215
-    }
180
+	/**
181
+	 * This returns a localized format string suitable for usage with the Google Charts API format param.
182
+	 *
183
+	 * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
184
+	 *                         Otherwise will use currency settings for current active country on site.
185
+	 *                         Note: GoogleCharts uses ICU pattern set
186
+	 *                         (@return array
187
+	 * @throws EE_Error
188
+	 * @see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
189
+	 */
190
+	public static function get_format_for_google_charts($CNT_ISO = '')
191
+	{
192
+		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
193
+		$decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0');
194
+		// first get the decimal place and number of places
195
+		$format = '#,##0.' . $decimal_places_placeholder;
196
+		// currency symbol on right side.
197
+		$format = $currency_config->sign_b4
198
+			? $currency_config->sign . $format
199
+			: $format
200
+			  . $currency_config->sign;
201
+		$formatterObject = array(
202
+			'decimalSymbol'  => $currency_config->dec_mrk,
203
+			'groupingSymbol' => $currency_config->thsnds,
204
+			'fractionDigits' => $currency_config->dec_plc,
205
+		);
206
+		if ($currency_config->sign_b4) {
207
+			$formatterObject['prefix'] = $currency_config->sign;
208
+		} else {
209
+			$formatterObject['suffix'] = $currency_config->sign;
210
+		}
211
+		return array(
212
+			'format'          => $format,
213
+			'formatterObject' => $formatterObject,
214
+		);
215
+	}
216 216
 
217 217
 
218
-    /**
219
-     * @param string $CNT_ISO
220
-     * @return EE_Currency_Config
221
-     * @throws EE_Error
222
-     */
223
-    public static function get_currency_config($CNT_ISO = '')
224
-    {
225
-        // if CNT_ISO passed lets try to get currency settings for it.
226
-        $currency_config = $CNT_ISO !== ''
227
-            ? new EE_Currency_Config($CNT_ISO)
228
-            : null;
229
-        // default currency settings for site if not set
230
-        if (! $currency_config instanceof EE_Currency_Config) {
231
-            $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
232
-                ? EE_Registry::instance()->CFG->currency
233
-                : new EE_Currency_Config();
234
-        }
235
-        return $currency_config;
236
-    }
218
+	/**
219
+	 * @param string $CNT_ISO
220
+	 * @return EE_Currency_Config
221
+	 * @throws EE_Error
222
+	 */
223
+	public static function get_currency_config($CNT_ISO = '')
224
+	{
225
+		// if CNT_ISO passed lets try to get currency settings for it.
226
+		$currency_config = $CNT_ISO !== ''
227
+			? new EE_Currency_Config($CNT_ISO)
228
+			: null;
229
+		// default currency settings for site if not set
230
+		if (! $currency_config instanceof EE_Currency_Config) {
231
+			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
232
+				? EE_Registry::instance()->CFG->currency
233
+				: new EE_Currency_Config();
234
+		}
235
+		return $currency_config;
236
+	}
237 237
 
238 238
 
239
-    /**
240
-     * @param string|null $CNT_ISO
241
-     * @param bool        $as_decimal if false [default] will return the number of decimal places ex: 1, 2, 3
242
-     *                                if true, will return the subunits as a decimal fraction ex: .1, .01, .001
243
-     * @return float
244
-     * @throws EE_Error
245
-     * @since $VID:$
246
-     */
247
-    public static function getCurrencySubUnits(?string $CNT_ISO = '', bool $as_decimal = false): float
248
-    {
249
-        $currency_config = EEH_Money::get_currency_config($CNT_ISO);
250
-        return $as_decimal ? pow(10, ($currency_config->dec_plc * -1)) : $currency_config->dec_plc;
251
-    }
239
+	/**
240
+	 * @param string|null $CNT_ISO
241
+	 * @param bool        $as_decimal if false [default] will return the number of decimal places ex: 1, 2, 3
242
+	 *                                if true, will return the subunits as a decimal fraction ex: .1, .01, .001
243
+	 * @return float
244
+	 * @throws EE_Error
245
+	 * @since $VID:$
246
+	 */
247
+	public static function getCurrencySubUnits(?string $CNT_ISO = '', bool $as_decimal = false): float
248
+	{
249
+		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
250
+		return $as_decimal ? pow(10, ($currency_config->dec_plc * -1)) : $currency_config->dec_plc;
251
+	}
252 252
 }
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 2 patches
Indentation   +996 added lines, -996 removed lines patch added patch discarded remove patch
@@ -6,36 +6,36 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\services\request\RequestInterface;
7 7
 
8 8
 if (! function_exists('espresso_get_template_part')) {
9
-    /**
10
-     * espresso_get_template_part
11
-     * 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
12
-     * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
13
-     *
14
-     * @param string $slug The slug name for the generic template.
15
-     * @param string $name The name of the specialised template.
16
-     */
17
-    function espresso_get_template_part($slug = null, $name = null)
18
-    {
19
-        EEH_Template::get_template_part($slug, $name);
20
-    }
9
+	/**
10
+	 * espresso_get_template_part
11
+	 * 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
12
+	 * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
13
+	 *
14
+	 * @param string $slug The slug name for the generic template.
15
+	 * @param string $name The name of the specialised template.
16
+	 */
17
+	function espresso_get_template_part($slug = null, $name = null)
18
+	{
19
+		EEH_Template::get_template_part($slug, $name);
20
+	}
21 21
 }
22 22
 
23 23
 
24 24
 if (! function_exists('espresso_get_object_css_class')) {
25
-    /**
26
-     * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
27
-     *
28
-     * @param EE_Base_Class $object the EE object the css class is being generated for
29
-     * @param string        $prefix added to the beginning of the generated class
30
-     * @param string        $suffix added to the end of the generated class
31
-     * @return string
32
-     * @throws EE_Error
33
-     * @throws ReflectionException
34
-     */
35
-    function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
36
-    {
37
-        return EEH_Template::get_object_css_class($object, $prefix, $suffix);
38
-    }
25
+	/**
26
+	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
27
+	 *
28
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
29
+	 * @param string        $prefix added to the beginning of the generated class
30
+	 * @param string        $suffix added to the end of the generated class
31
+	 * @return string
32
+	 * @throws EE_Error
33
+	 * @throws ReflectionException
34
+	 */
35
+	function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
36
+	{
37
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
38
+	}
39 39
 }
40 40
 
41 41
 
@@ -50,710 +50,710 @@  discard block
 block discarded – undo
50 50
 class EEH_Template
51 51
 {
52 52
 
53
-    private static $_espresso_themes = [];
54
-
55
-
56
-    /**
57
-     *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
58
-     *
59
-     * @return boolean
60
-     */
61
-    public static function is_espresso_theme()
62
-    {
63
-        return wp_get_theme()->get('TextDomain') === 'event_espresso';
64
-    }
65
-
66
-
67
-    /**
68
-     *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
69
-     *    load its functions.php file ( if not already loaded )
70
-     *
71
-     * @return void
72
-     */
73
-    public static function load_espresso_theme_functions()
74
-    {
75
-        if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
77
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
78
-            }
79
-        }
80
-    }
81
-
82
-
83
-    /**
84
-     *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
85
-     *
86
-     * @return array
87
-     */
88
-    public static function get_espresso_themes()
89
-    {
90
-        if (empty(EEH_Template::$_espresso_themes)) {
91
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
92
-            if (empty($espresso_themes)) {
93
-                return [];
94
-            }
95
-            if (($key = array_search('global_assets', $espresso_themes)) !== false) {
96
-                unset($espresso_themes[ $key ]);
97
-            }
98
-            EEH_Template::$_espresso_themes = [];
99
-            foreach ($espresso_themes as $espresso_theme) {
100
-                EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
101
-            }
102
-        }
103
-        return EEH_Template::$_espresso_themes;
104
-    }
105
-
106
-
107
-    /**
108
-     * EEH_Template::get_template_part
109
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
110
-     * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
111
-     * filtering based off of the entire template part name
112
-     *
113
-     * @param string $slug The slug name for the generic template.
114
-     * @param string $name The name of the specialised template.
115
-     * @param array  $template_args
116
-     * @param bool   $return_string
117
-     * @return string        the html output for the formatted money value
118
-     */
119
-    public static function get_template_part(
120
-        $slug = null,
121
-        $name = null,
122
-        $template_args = [],
123
-        $return_string = false
124
-    ) {
125
-        do_action("get_template_part_{$slug}-{$name}", $slug, $name);
126
-        $templates = [];
127
-        $name      = (string) $name;
128
-        if ($name != '') {
129
-            $templates[] = "{$slug}-{$name}.php";
130
-        }
131
-        // allow template parts to be turned off via something like:
132
-        // add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-        if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
134
-            return EEH_Template::locate_template($templates, $template_args, true, $return_string);
135
-        }
136
-        return '';
137
-    }
138
-
139
-
140
-    /**
141
-     *    locate_template
142
-     *    locate a template file by looking in the following places, in the following order:
143
-     *        <server path up to>/wp-content/themes/<current active WordPress theme>/
144
-     *        <assumed full absolute server path>
145
-     *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
146
-     *        <server path up to>/wp-content/uploads/espresso/templates/
147
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
148
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
149
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/
150
-     *    as soon as the template is found in one of these locations, it will be returned or loaded
151
-     *        Example:
152
-     *          You are using the WordPress Twenty Sixteen theme,
153
-     *        and you want to customize the "some-event.template.php" template,
154
-     *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
155
-     *          Assuming WP is installed on your server in the "/home/public_html/" folder,
156
-     *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
157
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
158
-     *        /relative/path/to/some-event.template.php
159
-     *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
160
-     *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
161
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
162
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
163
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
164
-     *          Had you passed an absolute path to your template that was in some other location,
165
-     *        ie: "/absolute/path/to/some-event.template.php"
166
-     *          then the search would have been :
167
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
168
-     *        /absolute/path/to/some-event.template.php
169
-     *          and stopped there upon finding it in the second location
170
-     *
171
-     * @param array|string $templates       array of template file names including extension (or just a single string)
172
-     * @param array        $template_args   an array of arguments to be extracted for use in the template
173
-     * @param boolean      $load            whether to pass the located template path on to the
174
-     *                                      EEH_Template::display_template() method or simply return it
175
-     * @param boolean      $return_string   whether to send output immediately to screen, or capture and return as a
176
-     *                                      string
177
-     * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
178
-     *                                      generate a custom template or not. Used in places where you don't actually
179
-     *                                      load the template, you just want to know if there's a custom version of it.
180
-     * @return mixed
181
-     * @throws DomainException
182
-     * @throws InvalidArgumentException
183
-     * @throws InvalidDataTypeException
184
-     * @throws InvalidInterfaceException
185
-     */
186
-    public static function locate_template(
187
-        $templates = [],
188
-        $template_args = [],
189
-        $load = true,
190
-        $return_string = true,
191
-        $check_if_custom = false
192
-    ) {
193
-        // first use WP locate_template to check for template in the current theme folder
194
-        $template_path = locate_template($templates);
195
-
196
-        if ($check_if_custom && ! empty($template_path)) {
197
-            return true;
198
-        }
199
-
200
-        // not in the theme
201
-        if (empty($template_path)) {
202
-            // not even a template to look for ?
203
-            if (empty($templates)) {
204
-                $loader = LoaderFactory::getLoader();
205
-                /** @var RequestInterface $request */
206
-                $request = $loader->getShared(RequestInterface::class);
207
-                // get post_type
208
-                $post_type = $request->getRequestParam('post_type');
209
-                /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
210
-                $custom_post_types = $loader->getShared(
211
-                    'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
212
-                );
213
-                // get array of EE Custom Post Types
214
-                $EE_CPTs = $custom_post_types->getDefinitions();
215
-                // build template name based on request
216
-                if (isset($EE_CPTs[ $post_type ])) {
217
-                    $archive_or_single = is_archive() ? 'archive' : '';
218
-                    $archive_or_single = is_single() ? 'single' : $archive_or_single;
219
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
220
-                }
221
-            }
222
-            // currently active EE template theme
223
-            $current_theme = EE_Config::get_current_theme();
224
-
225
-            // array of paths to folders that may contain templates
226
-            $template_folder_paths = [
227
-                // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
228
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
229
-                // then in the root of the /wp-content/uploads/espresso/templates/ folder
230
-                EVENT_ESPRESSO_TEMPLATE_DIR,
231
-            ];
232
-
233
-            // add core plugin folders for checking only if we're not $check_if_custom
234
-            if (! $check_if_custom) {
235
-                $core_paths            = [
236
-                    // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
237
-                    EE_PUBLIC . $current_theme,
238
-                    // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
239
-                    EE_TEMPLATES . $current_theme,
240
-                    // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
241
-                    EE_PLUGIN_DIR_PATH,
242
-                ];
243
-                $template_folder_paths = array_merge($template_folder_paths, $core_paths);
244
-            }
245
-
246
-            // now filter that array
247
-            $template_folder_paths = apply_filters(
248
-                'FHEE__EEH_Template__locate_template__template_folder_paths',
249
-                $template_folder_paths
250
-            );
251
-            $templates             = is_array($templates) ? $templates : [$templates];
252
-            $template_folder_paths =
253
-                is_array($template_folder_paths) ? $template_folder_paths : [$template_folder_paths];
254
-            // array to hold all possible template paths
255
-            $full_template_paths = [];
256
-            $file_name           = '';
257
-
258
-            // loop through $templates
259
-            foreach ($templates as $template) {
260
-                // normalize directory separators
261
-                $template                      = EEH_File::standardise_directory_separators($template);
262
-                $file_name                     = basename($template);
263
-                $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
264
-                // while looping through all template folder paths
265
-                foreach ($template_folder_paths as $template_folder_path) {
266
-                    // normalize directory separators
267
-                    $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
268
-                    // determine if any common base path exists between the two paths
269
-                    $common_base_path = EEH_Template::_find_common_base_path(
270
-                        [$template_folder_path, $template_path_minus_file_name]
271
-                    );
272
-                    if ($common_base_path !== '') {
273
-                        // both paths have a common base, so just tack the filename onto our search path
274
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
275
-                    } else {
276
-                        // no common base path, so let's just concatenate
277
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
278
-                    }
279
-                    // build up our template locations array by adding our resolved paths
280
-                    $full_template_paths[] = $resolved_path;
281
-                }
282
-                // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
283
-                array_unshift($full_template_paths, $template);
284
-                // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
285
-                array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
286
-            }
287
-            // filter final array of full template paths
288
-            $full_template_paths = apply_filters(
289
-                'FHEE__EEH_Template__locate_template__full_template_paths',
290
-                $full_template_paths,
291
-                $file_name
292
-            );
293
-            // now loop through our final array of template location paths and check each location
294
-            foreach ((array) $full_template_paths as $full_template_path) {
295
-                if (is_readable($full_template_path)) {
296
-                    $template_path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $full_template_path);
297
-                    break;
298
-                }
299
-            }
300
-        }
301
-
302
-        // hook that can be used to display the full template path that will be used
303
-        do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
304
-
305
-        // if we got it and you want to see it...
306
-        if ($template_path && $load && ! $check_if_custom) {
307
-            if ($return_string) {
308
-                return EEH_Template::display_template($template_path, $template_args, true);
309
-            }
310
-            EEH_Template::display_template($template_path, $template_args);
311
-        }
312
-        return $check_if_custom && ! empty($template_path) ? true : $template_path;
313
-    }
314
-
315
-
316
-    /**
317
-     * _find_common_base_path
318
-     * given two paths, this determines if there is a common base path between the two
319
-     *
320
-     * @param array $paths
321
-     * @return string
322
-     */
323
-    protected static function _find_common_base_path($paths)
324
-    {
325
-        $last_offset      = 0;
326
-        $common_base_path = '';
327
-        while (($index = strpos($paths[0], '/', $last_offset)) !== false) {
328
-            $dir_length = $index - $last_offset + 1;
329
-            $directory  = substr($paths[0], $last_offset, $dir_length);
330
-            foreach ($paths as $path) {
331
-                if (substr($path, $last_offset, $dir_length) != $directory) {
332
-                    return $common_base_path;
333
-                }
334
-            }
335
-            $common_base_path .= $directory;
336
-            $last_offset      = $index + 1;
337
-        }
338
-        return substr($common_base_path, 0, -1);
339
-    }
340
-
341
-
342
-    /**
343
-     * load and display a template
344
-     *
345
-     * @param bool|string $template_path    server path to the file to be loaded, including file name and extension
346
-     * @param array       $template_args    an array of arguments to be extracted for use in the template
347
-     * @param boolean     $return_string    whether to send output immediately to screen, or capture and return as a
348
-     *                                      string
349
-     * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
350
-     *                                      not found or is not readable
351
-     * @return string
352
-     * @throws DomainException
353
-     */
354
-    public static function display_template(
355
-        $template_path = false,
356
-        $template_args = [],
357
-        $return_string = false,
358
-        $throw_exceptions = false
359
-    ) {
360
-
361
-        /**
362
-         * These two filters are intended for last minute changes to templates being loaded and/or template arg
363
-         * modifications.  NOTE... modifying these things can cause breakage as most templates running through
364
-         * the display_template method are templates we DON'T want modified (usually because of js
365
-         * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
366
-         * using this.
367
-         *
368
-         * @since 4.6.0
369
-         */
370
-        $template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
371
-        $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
372
-
373
-        // you gimme nuttin - YOU GET NUTTIN !!
374
-        if (! $template_path || ! is_readable($template_path)) {
375
-            // ignore whether template is accessible ?
376
-            if ($throw_exceptions) {
377
-                throw new DomainException(
378
-                    esc_html__('Invalid, unreadable, or missing file.', 'event_espresso')
379
-                );
380
-            }
381
-            return '';
382
-        }
383
-        // if $template_args are not in an array, then make it so
384
-        if (! is_array($template_args) && ! is_object($template_args)) {
385
-            $template_args = [$template_args];
386
-        }
387
-        extract($template_args, EXTR_SKIP);
388
-
389
-        if ($return_string) {
390
-            // because we want to return a string, we are going to capture the output
391
-            ob_start();
392
-            include($template_path);
393
-            return ob_get_clean();
394
-        }
395
-        include($template_path);
396
-        return '';
397
-    }
398
-
399
-
400
-    /**
401
-     * get_object_css_class - attempts to generate a css class based on the type of EE object passed
402
-     *
403
-     * @param EE_Base_Class $object the EE object the css class is being generated for
404
-     * @param string        $prefix added to the beginning of the generated class
405
-     * @param string        $suffix added to the end of the generated class
406
-     * @return string
407
-     * @throws EE_Error
408
-     * @throws ReflectionException
409
-     */
410
-    public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
411
-    {
412
-        // in the beginning...
413
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
414
-        // da muddle
415
-        $class = '';
416
-        // the end
417
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
418
-        // is the passed object an EE object ?
419
-        if ($object instanceof EE_Base_Class) {
420
-            // grab the exact type of object
421
-            $obj_class = get_class($object);
422
-            // depending on the type of object...
423
-            switch ($obj_class) {
424
-                // no specifics just yet...
425
-                default:
426
-                    $class = strtolower(str_replace('_', '-', $obj_class));
427
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
428
-            }
429
-        }
430
-        return $prefix . $class . $suffix;
431
-    }
432
-
433
-
434
-    /**
435
-     * EEH_Template::format_currency
436
-     * This helper takes a raw float value and formats it according to the default config country currency settings, or
437
-     * the country currency settings from the supplied country ISO code
438
-     *
439
-     * @param float   $amount       raw money value
440
-     * @param boolean $return_raw   whether to return the formatted float value only with no currency sign or code
441
-     * @param boolean $display_code whether to display the country code (USD). Default = TRUE
442
-     * @param string  $CNT_ISO      2 letter ISO code for a country
443
-     * @param string  $cur_code_span_class
444
-     * @return string        the html output for the formatted money value
445
-     */
446
-    public static function format_currency(
447
-        $amount = null,
448
-        $return_raw = false,
449
-        $display_code = true,
450
-        $CNT_ISO = '',
451
-        $cur_code_span_class = 'currency-code'
452
-    ) {
453
-        // ensure amount was received
454
-        if ($amount === null) {
455
-            $msg = esc_html__('In order to format currency, an amount needs to be passed.', 'event_espresso');
456
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
457
-            return '';
458
-        }
459
-        // ensure amount is float
460
-        $amount  = (float) apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
461
-        $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
462
-        // filter raw amount (allows 0.00 to be changed to "free" for example)
463
-        $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
464
-        // still a number, or was amount converted to a string like "free" ?
465
-        if (! is_float($amount_formatted)) {
466
-            return esc_html($amount_formatted);
467
-        }
468
-        try {
469
-            // was a country ISO code passed ? if so generate currency config object for that country
470
-            $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
471
-        } catch (Exception $e) {
472
-            // eat exception
473
-            $mny = null;
474
-        }
475
-        // verify results
476
-        if (! $mny instanceof EE_Currency_Config) {
477
-            // set default config country currency settings
478
-            $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
479
-                ? EE_Registry::instance()->CFG->currency
480
-                : new EE_Currency_Config();
481
-        }
482
-        // format float
483
-        $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
484
-        // add formatting ?
485
-        if (! $return_raw) {
486
-            // add currency sign
487
-            if ($mny->sign_b4) {
488
-                if ($amount >= 0) {
489
-                    $amount_formatted = $mny->sign . $amount_formatted;
490
-                } else {
491
-                    $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
492
-                }
493
-            } else {
494
-                $amount_formatted = $amount_formatted . $mny->sign;
495
-            }
496
-
497
-            // filter to allow global setting of display_code
498
-            $display_code = (bool) apply_filters(
499
-                'FHEE__EEH_Template__format_currency__display_code',
500
-                $display_code
501
-            );
502
-
503
-            // add currency code ?
504
-            $amount_formatted = $display_code
505
-                ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>'
506
-                : $amount_formatted;
507
-        }
508
-        // filter results
509
-        $amount_formatted = apply_filters(
510
-            'FHEE__EEH_Template__format_currency__amount_formatted',
511
-            $amount_formatted,
512
-            $mny,
513
-            $return_raw
514
-        );
515
-        // clean up vars
516
-        unset($mny);
517
-        // return formatted currency amount
518
-        return $amount_formatted;
519
-    }
520
-
521
-
522
-    /**
523
-     * This function is used for outputting the localized label for a given status id in the schema requested (and
524
-     * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
525
-     * related status model or model object (i.e. in documentation etc.)
526
-     *
527
-     * @param string  $status_id  Status ID matching a registered status in the esp_status table.  If there is no
528
-     *                            match, then 'Unknown' will be returned.
529
-     * @param boolean $plural     Whether to return plural or not
530
-     * @param string  $schema     'UPPER', 'lower', or 'Sentence'
531
-     * @return string             The localized label for the status id.
532
-     * @throws EE_Error
533
-     */
534
-    public static function pretty_status($status_id, $plural = false, $schema = 'upper')
535
-    {
536
-        $status = EEM_Status::instance()->localized_status(
537
-            [$status_id => esc_html__('unknown', 'event_espresso')],
538
-            $plural,
539
-            $schema
540
-        );
541
-        return $status[ $status_id ];
542
-    }
543
-
544
-
545
-    /**
546
-     * This helper just returns a button or link for the given parameters
547
-     *
548
-     * @param string $url   the url for the link, note that `esc_url` will be called on it
549
-     * @param string $label What is the label you want displayed for the button
550
-     * @param string $class what class is used for the button (defaults to 'button--primary')
551
-     * @param string $icon
552
-     * @param string $title
553
-     * @return string the html output for the button
554
-     */
555
-    public static function get_button_or_link($url, $label, $class = 'button button--primary', $icon = '', $title = '')
556
-    {
557
-        $icon_html = '';
558
-        if (! empty($icon)) {
559
-            $dashicons = preg_split("(ee-icon |dashicons )", $icon);
560
-            $dashicons = array_filter($dashicons);
561
-            $count     = count($dashicons);
562
-            $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
563
-            foreach ($dashicons as $dashicon) {
564
-                $type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
565
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
566
-            }
567
-            $icon_html .= $count > 1 ? '</span>' : '';
568
-        }
569
-        // sanitize & escape
570
-        $id    = sanitize_title_with_dashes($label);
571
-        $url   = esc_url_raw($url);
572
-        $class = esc_attr($class);
573
-        $title = esc_attr($title);
574
-        $class .= $title ? ' ee-aria-tooltip' : '';
575
-        $title = $title ? " aria-label='{$title}'" : '';
576
-        $label = esc_html($label);
577
-        return "<a id='{$id}' href='{$url}' class='{$class}'{$title}>{$icon_html}{$label}</a>";
578
-    }
579
-
580
-
581
-    /**
582
-     * This returns a generated link that will load the related help tab on admin pages.
583
-     *
584
-     * @param string      $help_tab_id the id for the connected help tab
585
-     * @param bool|string $page        The page identifier for the page the help tab is on
586
-     * @param bool|string $action      The action (route) for the admin page the help tab is on.
587
-     * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
588
-     * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
589
-     * @return string              generated link
590
-     */
591
-    public static function get_help_tab_link(
592
-        $help_tab_id,
593
-        $page = false,
594
-        $action = false,
595
-        $icon_style = false,
596
-        $help_text = false
597
-    ) {
598
-        global $allowedtags;
599
-        /** @var RequestInterface $request */
600
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
601
-        $page    = $page ?: $request->getRequestParam('page', '', 'key');
602
-        $action  = $action ?: $request->getRequestParam('action', 'default', 'key');
603
-
604
-
605
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
606
-        $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
607
-        $help_text    = ! $help_text ? '' : $help_text;
608
-        return '<a id="'
609
-               . esc_attr($help_tab_lnk)
610
-               . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'
611
-               . esc_attr($icon)
612
-               . '" title="'
613
-               . esc_attr__(
614
-                   'Click to open the \'Help\' tab for more information about this feature.',
615
-                   'event_espresso'
616
-               )
617
-               . '" > '
618
-               . wp_kses($help_text, $allowedtags)
619
-               . ' </a>';
620
-    }
621
-
622
-
623
-    /**
624
-     * This helper generates the html structure for the jquery joyride plugin with the given params.
625
-     *
626
-     * @link http://zurb.com/playground/jquery-joyride-feature-tour-plugin
627
-     * @see  EE_Admin_Page->_stop_callback() for the construct expected for the $stops param.
628
-     * @param EE_Help_Tour
629
-     * @return string         html
630
-     * @throws EE_Error
631
-     */
632
-    public static function help_tour_stops_generator(EE_Help_Tour $tour)
633
-    {
634
-        global $allowedtags;
635
-        $id    = $tour->get_slug();
636
-        $stops = $tour->get_stops();
637
-
638
-        $content = '<ol style="display:none" id="' . esc_attr($id) . '">';
639
-
640
-        foreach ($stops as $stop) {
641
-            $data_id    = ! empty($stop['id'])
642
-                ? ' data-id="' . esc_attr($stop['id']) . '"'
643
-                : '';
644
-
645
-            $data_class = empty($data_id) && ! empty($stop['class'])
646
-                ? ' data-class="' . esc_attr($stop['class']) . '"'
647
-                : '';
648
-
649
-            // if container is set to modal then let's make sure we set the options accordingly
650
-            if (empty($data_id) && empty($data_class)) {
651
-                $stop['options']['modal']  = true;
652
-                $stop['options']['expose'] = true;
653
-            }
654
-
655
-            $custom_class  = ! empty($stop['custom_class'])
656
-                ? ' class="' . esc_attr($stop['custom_class']) . '"'
657
-                : '';
658
-            $button_text   = ! empty($stop['button_text'])
659
-                ? ' data-button="' . esc_html($stop['button_text']) . '"'
660
-                : '';
661
-            $inner_content = isset($stop['content']) ? wp_kses($stop['content'], $allowedtags) : '';
662
-
663
-            // options
664
-            if (isset($stop['options']) && is_array($stop['options'])) {
665
-                $options = ' data-options="';
666
-                foreach ($stop['options'] as $option => $value) {
667
-                    $options .= esc_attr($option) . ':' . esc_attr($value) . ';';
668
-                }
669
-                $options .= '"';
670
-            } else {
671
-                $options = '';
672
-            }
673
-
674
-            // let's put all together
675
-            $content .= '<li'
676
-                        . $data_id
677
-                        . $data_class
678
-                        . $custom_class
679
-                        . $button_text
680
-                        . $options
681
-                        . '>'
682
-                        . $inner_content
683
-                        . '</li>';
684
-        }
685
-
686
-        $content .= '</ol>';
687
-        return $content;
688
-    }
689
-
690
-
691
-    /**
692
-     * This is a helper method to generate a status legend for a given status array.
693
-     * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
694
-     * status_array.
695
-     *
696
-     * @param array  $status_array   array of statuses that will make up the legend. In format:
697
-     *                               array(
698
-     *                               'status_item' => 'status_name'
699
-     *                               )
700
-     * @param string $active_status  This is used to indicate what the active status is IF that is to be highlighted in
701
-     *                               the legend.
702
-     * @return string               html structure for status.
703
-     * @throws EE_Error
704
-     */
705
-    public static function status_legend($status_array, $active_status = '')
706
-    {
707
-        if (! is_array($status_array)) {
708
-            throw new EE_Error(
709
-                esc_html__(
710
-                    'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
711
-                    'event_espresso'
712
-                )
713
-            );
714
-        }
715
-
716
-        $content = '
53
+	private static $_espresso_themes = [];
54
+
55
+
56
+	/**
57
+	 *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
58
+	 *
59
+	 * @return boolean
60
+	 */
61
+	public static function is_espresso_theme()
62
+	{
63
+		return wp_get_theme()->get('TextDomain') === 'event_espresso';
64
+	}
65
+
66
+
67
+	/**
68
+	 *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
69
+	 *    load its functions.php file ( if not already loaded )
70
+	 *
71
+	 * @return void
72
+	 */
73
+	public static function load_espresso_theme_functions()
74
+	{
75
+		if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
+			if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
77
+				require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
78
+			}
79
+		}
80
+	}
81
+
82
+
83
+	/**
84
+	 *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
85
+	 *
86
+	 * @return array
87
+	 */
88
+	public static function get_espresso_themes()
89
+	{
90
+		if (empty(EEH_Template::$_espresso_themes)) {
91
+			$espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
92
+			if (empty($espresso_themes)) {
93
+				return [];
94
+			}
95
+			if (($key = array_search('global_assets', $espresso_themes)) !== false) {
96
+				unset($espresso_themes[ $key ]);
97
+			}
98
+			EEH_Template::$_espresso_themes = [];
99
+			foreach ($espresso_themes as $espresso_theme) {
100
+				EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
101
+			}
102
+		}
103
+		return EEH_Template::$_espresso_themes;
104
+	}
105
+
106
+
107
+	/**
108
+	 * EEH_Template::get_template_part
109
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
110
+	 * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
111
+	 * filtering based off of the entire template part name
112
+	 *
113
+	 * @param string $slug The slug name for the generic template.
114
+	 * @param string $name The name of the specialised template.
115
+	 * @param array  $template_args
116
+	 * @param bool   $return_string
117
+	 * @return string        the html output for the formatted money value
118
+	 */
119
+	public static function get_template_part(
120
+		$slug = null,
121
+		$name = null,
122
+		$template_args = [],
123
+		$return_string = false
124
+	) {
125
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
126
+		$templates = [];
127
+		$name      = (string) $name;
128
+		if ($name != '') {
129
+			$templates[] = "{$slug}-{$name}.php";
130
+		}
131
+		// allow template parts to be turned off via something like:
132
+		// add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
134
+			return EEH_Template::locate_template($templates, $template_args, true, $return_string);
135
+		}
136
+		return '';
137
+	}
138
+
139
+
140
+	/**
141
+	 *    locate_template
142
+	 *    locate a template file by looking in the following places, in the following order:
143
+	 *        <server path up to>/wp-content/themes/<current active WordPress theme>/
144
+	 *        <assumed full absolute server path>
145
+	 *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
146
+	 *        <server path up to>/wp-content/uploads/espresso/templates/
147
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
148
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
149
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/
150
+	 *    as soon as the template is found in one of these locations, it will be returned or loaded
151
+	 *        Example:
152
+	 *          You are using the WordPress Twenty Sixteen theme,
153
+	 *        and you want to customize the "some-event.template.php" template,
154
+	 *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
155
+	 *          Assuming WP is installed on your server in the "/home/public_html/" folder,
156
+	 *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
157
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
158
+	 *        /relative/path/to/some-event.template.php
159
+	 *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
160
+	 *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
161
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
162
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
163
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
164
+	 *          Had you passed an absolute path to your template that was in some other location,
165
+	 *        ie: "/absolute/path/to/some-event.template.php"
166
+	 *          then the search would have been :
167
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
168
+	 *        /absolute/path/to/some-event.template.php
169
+	 *          and stopped there upon finding it in the second location
170
+	 *
171
+	 * @param array|string $templates       array of template file names including extension (or just a single string)
172
+	 * @param array        $template_args   an array of arguments to be extracted for use in the template
173
+	 * @param boolean      $load            whether to pass the located template path on to the
174
+	 *                                      EEH_Template::display_template() method or simply return it
175
+	 * @param boolean      $return_string   whether to send output immediately to screen, or capture and return as a
176
+	 *                                      string
177
+	 * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
178
+	 *                                      generate a custom template or not. Used in places where you don't actually
179
+	 *                                      load the template, you just want to know if there's a custom version of it.
180
+	 * @return mixed
181
+	 * @throws DomainException
182
+	 * @throws InvalidArgumentException
183
+	 * @throws InvalidDataTypeException
184
+	 * @throws InvalidInterfaceException
185
+	 */
186
+	public static function locate_template(
187
+		$templates = [],
188
+		$template_args = [],
189
+		$load = true,
190
+		$return_string = true,
191
+		$check_if_custom = false
192
+	) {
193
+		// first use WP locate_template to check for template in the current theme folder
194
+		$template_path = locate_template($templates);
195
+
196
+		if ($check_if_custom && ! empty($template_path)) {
197
+			return true;
198
+		}
199
+
200
+		// not in the theme
201
+		if (empty($template_path)) {
202
+			// not even a template to look for ?
203
+			if (empty($templates)) {
204
+				$loader = LoaderFactory::getLoader();
205
+				/** @var RequestInterface $request */
206
+				$request = $loader->getShared(RequestInterface::class);
207
+				// get post_type
208
+				$post_type = $request->getRequestParam('post_type');
209
+				/** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
210
+				$custom_post_types = $loader->getShared(
211
+					'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
212
+				);
213
+				// get array of EE Custom Post Types
214
+				$EE_CPTs = $custom_post_types->getDefinitions();
215
+				// build template name based on request
216
+				if (isset($EE_CPTs[ $post_type ])) {
217
+					$archive_or_single = is_archive() ? 'archive' : '';
218
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
219
+					$templates         = $archive_or_single . '-' . $post_type . '.php';
220
+				}
221
+			}
222
+			// currently active EE template theme
223
+			$current_theme = EE_Config::get_current_theme();
224
+
225
+			// array of paths to folders that may contain templates
226
+			$template_folder_paths = [
227
+				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
228
+				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
229
+				// then in the root of the /wp-content/uploads/espresso/templates/ folder
230
+				EVENT_ESPRESSO_TEMPLATE_DIR,
231
+			];
232
+
233
+			// add core plugin folders for checking only if we're not $check_if_custom
234
+			if (! $check_if_custom) {
235
+				$core_paths            = [
236
+					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
237
+					EE_PUBLIC . $current_theme,
238
+					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
239
+					EE_TEMPLATES . $current_theme,
240
+					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
241
+					EE_PLUGIN_DIR_PATH,
242
+				];
243
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
244
+			}
245
+
246
+			// now filter that array
247
+			$template_folder_paths = apply_filters(
248
+				'FHEE__EEH_Template__locate_template__template_folder_paths',
249
+				$template_folder_paths
250
+			);
251
+			$templates             = is_array($templates) ? $templates : [$templates];
252
+			$template_folder_paths =
253
+				is_array($template_folder_paths) ? $template_folder_paths : [$template_folder_paths];
254
+			// array to hold all possible template paths
255
+			$full_template_paths = [];
256
+			$file_name           = '';
257
+
258
+			// loop through $templates
259
+			foreach ($templates as $template) {
260
+				// normalize directory separators
261
+				$template                      = EEH_File::standardise_directory_separators($template);
262
+				$file_name                     = basename($template);
263
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
264
+				// while looping through all template folder paths
265
+				foreach ($template_folder_paths as $template_folder_path) {
266
+					// normalize directory separators
267
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
268
+					// determine if any common base path exists between the two paths
269
+					$common_base_path = EEH_Template::_find_common_base_path(
270
+						[$template_folder_path, $template_path_minus_file_name]
271
+					);
272
+					if ($common_base_path !== '') {
273
+						// both paths have a common base, so just tack the filename onto our search path
274
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
275
+					} else {
276
+						// no common base path, so let's just concatenate
277
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
278
+					}
279
+					// build up our template locations array by adding our resolved paths
280
+					$full_template_paths[] = $resolved_path;
281
+				}
282
+				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
283
+				array_unshift($full_template_paths, $template);
284
+				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
285
+				array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
286
+			}
287
+			// filter final array of full template paths
288
+			$full_template_paths = apply_filters(
289
+				'FHEE__EEH_Template__locate_template__full_template_paths',
290
+				$full_template_paths,
291
+				$file_name
292
+			);
293
+			// now loop through our final array of template location paths and check each location
294
+			foreach ((array) $full_template_paths as $full_template_path) {
295
+				if (is_readable($full_template_path)) {
296
+					$template_path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $full_template_path);
297
+					break;
298
+				}
299
+			}
300
+		}
301
+
302
+		// hook that can be used to display the full template path that will be used
303
+		do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
304
+
305
+		// if we got it and you want to see it...
306
+		if ($template_path && $load && ! $check_if_custom) {
307
+			if ($return_string) {
308
+				return EEH_Template::display_template($template_path, $template_args, true);
309
+			}
310
+			EEH_Template::display_template($template_path, $template_args);
311
+		}
312
+		return $check_if_custom && ! empty($template_path) ? true : $template_path;
313
+	}
314
+
315
+
316
+	/**
317
+	 * _find_common_base_path
318
+	 * given two paths, this determines if there is a common base path between the two
319
+	 *
320
+	 * @param array $paths
321
+	 * @return string
322
+	 */
323
+	protected static function _find_common_base_path($paths)
324
+	{
325
+		$last_offset      = 0;
326
+		$common_base_path = '';
327
+		while (($index = strpos($paths[0], '/', $last_offset)) !== false) {
328
+			$dir_length = $index - $last_offset + 1;
329
+			$directory  = substr($paths[0], $last_offset, $dir_length);
330
+			foreach ($paths as $path) {
331
+				if (substr($path, $last_offset, $dir_length) != $directory) {
332
+					return $common_base_path;
333
+				}
334
+			}
335
+			$common_base_path .= $directory;
336
+			$last_offset      = $index + 1;
337
+		}
338
+		return substr($common_base_path, 0, -1);
339
+	}
340
+
341
+
342
+	/**
343
+	 * load and display a template
344
+	 *
345
+	 * @param bool|string $template_path    server path to the file to be loaded, including file name and extension
346
+	 * @param array       $template_args    an array of arguments to be extracted for use in the template
347
+	 * @param boolean     $return_string    whether to send output immediately to screen, or capture and return as a
348
+	 *                                      string
349
+	 * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
350
+	 *                                      not found or is not readable
351
+	 * @return string
352
+	 * @throws DomainException
353
+	 */
354
+	public static function display_template(
355
+		$template_path = false,
356
+		$template_args = [],
357
+		$return_string = false,
358
+		$throw_exceptions = false
359
+	) {
360
+
361
+		/**
362
+		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
363
+		 * modifications.  NOTE... modifying these things can cause breakage as most templates running through
364
+		 * the display_template method are templates we DON'T want modified (usually because of js
365
+		 * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
366
+		 * using this.
367
+		 *
368
+		 * @since 4.6.0
369
+		 */
370
+		$template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
371
+		$template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
372
+
373
+		// you gimme nuttin - YOU GET NUTTIN !!
374
+		if (! $template_path || ! is_readable($template_path)) {
375
+			// ignore whether template is accessible ?
376
+			if ($throw_exceptions) {
377
+				throw new DomainException(
378
+					esc_html__('Invalid, unreadable, or missing file.', 'event_espresso')
379
+				);
380
+			}
381
+			return '';
382
+		}
383
+		// if $template_args are not in an array, then make it so
384
+		if (! is_array($template_args) && ! is_object($template_args)) {
385
+			$template_args = [$template_args];
386
+		}
387
+		extract($template_args, EXTR_SKIP);
388
+
389
+		if ($return_string) {
390
+			// because we want to return a string, we are going to capture the output
391
+			ob_start();
392
+			include($template_path);
393
+			return ob_get_clean();
394
+		}
395
+		include($template_path);
396
+		return '';
397
+	}
398
+
399
+
400
+	/**
401
+	 * get_object_css_class - attempts to generate a css class based on the type of EE object passed
402
+	 *
403
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
404
+	 * @param string        $prefix added to the beginning of the generated class
405
+	 * @param string        $suffix added to the end of the generated class
406
+	 * @return string
407
+	 * @throws EE_Error
408
+	 * @throws ReflectionException
409
+	 */
410
+	public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
411
+	{
412
+		// in the beginning...
413
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
414
+		// da muddle
415
+		$class = '';
416
+		// the end
417
+		$suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
418
+		// is the passed object an EE object ?
419
+		if ($object instanceof EE_Base_Class) {
420
+			// grab the exact type of object
421
+			$obj_class = get_class($object);
422
+			// depending on the type of object...
423
+			switch ($obj_class) {
424
+				// no specifics just yet...
425
+				default:
426
+					$class = strtolower(str_replace('_', '-', $obj_class));
427
+					$class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
428
+			}
429
+		}
430
+		return $prefix . $class . $suffix;
431
+	}
432
+
433
+
434
+	/**
435
+	 * EEH_Template::format_currency
436
+	 * This helper takes a raw float value and formats it according to the default config country currency settings, or
437
+	 * the country currency settings from the supplied country ISO code
438
+	 *
439
+	 * @param float   $amount       raw money value
440
+	 * @param boolean $return_raw   whether to return the formatted float value only with no currency sign or code
441
+	 * @param boolean $display_code whether to display the country code (USD). Default = TRUE
442
+	 * @param string  $CNT_ISO      2 letter ISO code for a country
443
+	 * @param string  $cur_code_span_class
444
+	 * @return string        the html output for the formatted money value
445
+	 */
446
+	public static function format_currency(
447
+		$amount = null,
448
+		$return_raw = false,
449
+		$display_code = true,
450
+		$CNT_ISO = '',
451
+		$cur_code_span_class = 'currency-code'
452
+	) {
453
+		// ensure amount was received
454
+		if ($amount === null) {
455
+			$msg = esc_html__('In order to format currency, an amount needs to be passed.', 'event_espresso');
456
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
457
+			return '';
458
+		}
459
+		// ensure amount is float
460
+		$amount  = (float) apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
461
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
462
+		// filter raw amount (allows 0.00 to be changed to "free" for example)
463
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
464
+		// still a number, or was amount converted to a string like "free" ?
465
+		if (! is_float($amount_formatted)) {
466
+			return esc_html($amount_formatted);
467
+		}
468
+		try {
469
+			// was a country ISO code passed ? if so generate currency config object for that country
470
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
471
+		} catch (Exception $e) {
472
+			// eat exception
473
+			$mny = null;
474
+		}
475
+		// verify results
476
+		if (! $mny instanceof EE_Currency_Config) {
477
+			// set default config country currency settings
478
+			$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
479
+				? EE_Registry::instance()->CFG->currency
480
+				: new EE_Currency_Config();
481
+		}
482
+		// format float
483
+		$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
484
+		// add formatting ?
485
+		if (! $return_raw) {
486
+			// add currency sign
487
+			if ($mny->sign_b4) {
488
+				if ($amount >= 0) {
489
+					$amount_formatted = $mny->sign . $amount_formatted;
490
+				} else {
491
+					$amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
492
+				}
493
+			} else {
494
+				$amount_formatted = $amount_formatted . $mny->sign;
495
+			}
496
+
497
+			// filter to allow global setting of display_code
498
+			$display_code = (bool) apply_filters(
499
+				'FHEE__EEH_Template__format_currency__display_code',
500
+				$display_code
501
+			);
502
+
503
+			// add currency code ?
504
+			$amount_formatted = $display_code
505
+				? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>'
506
+				: $amount_formatted;
507
+		}
508
+		// filter results
509
+		$amount_formatted = apply_filters(
510
+			'FHEE__EEH_Template__format_currency__amount_formatted',
511
+			$amount_formatted,
512
+			$mny,
513
+			$return_raw
514
+		);
515
+		// clean up vars
516
+		unset($mny);
517
+		// return formatted currency amount
518
+		return $amount_formatted;
519
+	}
520
+
521
+
522
+	/**
523
+	 * This function is used for outputting the localized label for a given status id in the schema requested (and
524
+	 * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
525
+	 * related status model or model object (i.e. in documentation etc.)
526
+	 *
527
+	 * @param string  $status_id  Status ID matching a registered status in the esp_status table.  If there is no
528
+	 *                            match, then 'Unknown' will be returned.
529
+	 * @param boolean $plural     Whether to return plural or not
530
+	 * @param string  $schema     'UPPER', 'lower', or 'Sentence'
531
+	 * @return string             The localized label for the status id.
532
+	 * @throws EE_Error
533
+	 */
534
+	public static function pretty_status($status_id, $plural = false, $schema = 'upper')
535
+	{
536
+		$status = EEM_Status::instance()->localized_status(
537
+			[$status_id => esc_html__('unknown', 'event_espresso')],
538
+			$plural,
539
+			$schema
540
+		);
541
+		return $status[ $status_id ];
542
+	}
543
+
544
+
545
+	/**
546
+	 * This helper just returns a button or link for the given parameters
547
+	 *
548
+	 * @param string $url   the url for the link, note that `esc_url` will be called on it
549
+	 * @param string $label What is the label you want displayed for the button
550
+	 * @param string $class what class is used for the button (defaults to 'button--primary')
551
+	 * @param string $icon
552
+	 * @param string $title
553
+	 * @return string the html output for the button
554
+	 */
555
+	public static function get_button_or_link($url, $label, $class = 'button button--primary', $icon = '', $title = '')
556
+	{
557
+		$icon_html = '';
558
+		if (! empty($icon)) {
559
+			$dashicons = preg_split("(ee-icon |dashicons )", $icon);
560
+			$dashicons = array_filter($dashicons);
561
+			$count     = count($dashicons);
562
+			$icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
563
+			foreach ($dashicons as $dashicon) {
564
+				$type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
565
+				$icon_html .= '<span class="' . $type . $dashicon . '"></span>';
566
+			}
567
+			$icon_html .= $count > 1 ? '</span>' : '';
568
+		}
569
+		// sanitize & escape
570
+		$id    = sanitize_title_with_dashes($label);
571
+		$url   = esc_url_raw($url);
572
+		$class = esc_attr($class);
573
+		$title = esc_attr($title);
574
+		$class .= $title ? ' ee-aria-tooltip' : '';
575
+		$title = $title ? " aria-label='{$title}'" : '';
576
+		$label = esc_html($label);
577
+		return "<a id='{$id}' href='{$url}' class='{$class}'{$title}>{$icon_html}{$label}</a>";
578
+	}
579
+
580
+
581
+	/**
582
+	 * This returns a generated link that will load the related help tab on admin pages.
583
+	 *
584
+	 * @param string      $help_tab_id the id for the connected help tab
585
+	 * @param bool|string $page        The page identifier for the page the help tab is on
586
+	 * @param bool|string $action      The action (route) for the admin page the help tab is on.
587
+	 * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
588
+	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
589
+	 * @return string              generated link
590
+	 */
591
+	public static function get_help_tab_link(
592
+		$help_tab_id,
593
+		$page = false,
594
+		$action = false,
595
+		$icon_style = false,
596
+		$help_text = false
597
+	) {
598
+		global $allowedtags;
599
+		/** @var RequestInterface $request */
600
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
601
+		$page    = $page ?: $request->getRequestParam('page', '', 'key');
602
+		$action  = $action ?: $request->getRequestParam('action', 'default', 'key');
603
+
604
+
605
+		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
606
+		$icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
607
+		$help_text    = ! $help_text ? '' : $help_text;
608
+		return '<a id="'
609
+			   . esc_attr($help_tab_lnk)
610
+			   . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'
611
+			   . esc_attr($icon)
612
+			   . '" title="'
613
+			   . esc_attr__(
614
+				   'Click to open the \'Help\' tab for more information about this feature.',
615
+				   'event_espresso'
616
+			   )
617
+			   . '" > '
618
+			   . wp_kses($help_text, $allowedtags)
619
+			   . ' </a>';
620
+	}
621
+
622
+
623
+	/**
624
+	 * This helper generates the html structure for the jquery joyride plugin with the given params.
625
+	 *
626
+	 * @link http://zurb.com/playground/jquery-joyride-feature-tour-plugin
627
+	 * @see  EE_Admin_Page->_stop_callback() for the construct expected for the $stops param.
628
+	 * @param EE_Help_Tour
629
+	 * @return string         html
630
+	 * @throws EE_Error
631
+	 */
632
+	public static function help_tour_stops_generator(EE_Help_Tour $tour)
633
+	{
634
+		global $allowedtags;
635
+		$id    = $tour->get_slug();
636
+		$stops = $tour->get_stops();
637
+
638
+		$content = '<ol style="display:none" id="' . esc_attr($id) . '">';
639
+
640
+		foreach ($stops as $stop) {
641
+			$data_id    = ! empty($stop['id'])
642
+				? ' data-id="' . esc_attr($stop['id']) . '"'
643
+				: '';
644
+
645
+			$data_class = empty($data_id) && ! empty($stop['class'])
646
+				? ' data-class="' . esc_attr($stop['class']) . '"'
647
+				: '';
648
+
649
+			// if container is set to modal then let's make sure we set the options accordingly
650
+			if (empty($data_id) && empty($data_class)) {
651
+				$stop['options']['modal']  = true;
652
+				$stop['options']['expose'] = true;
653
+			}
654
+
655
+			$custom_class  = ! empty($stop['custom_class'])
656
+				? ' class="' . esc_attr($stop['custom_class']) . '"'
657
+				: '';
658
+			$button_text   = ! empty($stop['button_text'])
659
+				? ' data-button="' . esc_html($stop['button_text']) . '"'
660
+				: '';
661
+			$inner_content = isset($stop['content']) ? wp_kses($stop['content'], $allowedtags) : '';
662
+
663
+			// options
664
+			if (isset($stop['options']) && is_array($stop['options'])) {
665
+				$options = ' data-options="';
666
+				foreach ($stop['options'] as $option => $value) {
667
+					$options .= esc_attr($option) . ':' . esc_attr($value) . ';';
668
+				}
669
+				$options .= '"';
670
+			} else {
671
+				$options = '';
672
+			}
673
+
674
+			// let's put all together
675
+			$content .= '<li'
676
+						. $data_id
677
+						. $data_class
678
+						. $custom_class
679
+						. $button_text
680
+						. $options
681
+						. '>'
682
+						. $inner_content
683
+						. '</li>';
684
+		}
685
+
686
+		$content .= '</ol>';
687
+		return $content;
688
+	}
689
+
690
+
691
+	/**
692
+	 * This is a helper method to generate a status legend for a given status array.
693
+	 * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
694
+	 * status_array.
695
+	 *
696
+	 * @param array  $status_array   array of statuses that will make up the legend. In format:
697
+	 *                               array(
698
+	 *                               'status_item' => 'status_name'
699
+	 *                               )
700
+	 * @param string $active_status  This is used to indicate what the active status is IF that is to be highlighted in
701
+	 *                               the legend.
702
+	 * @return string               html structure for status.
703
+	 * @throws EE_Error
704
+	 */
705
+	public static function status_legend($status_array, $active_status = '')
706
+	{
707
+		if (! is_array($status_array)) {
708
+			throw new EE_Error(
709
+				esc_html__(
710
+					'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
711
+					'event_espresso'
712
+				)
713
+			);
714
+		}
715
+
716
+		$content = '
717 717
             <div class="ee-list-table-legend-container">
718 718
                 <h4 class="status-legend-title">
719 719
                     ' . esc_html__('Status Legend', 'event_espresso') . '
720 720
                 </h4>
721 721
                 <dl class="ee-list-table-legend">';
722 722
 
723
-        foreach ($status_array as $item => $status) {
724
-            $active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
725
-            $content      .= '
723
+		foreach ($status_array as $item => $status) {
724
+			$active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
725
+			$content      .= '
726 726
                     <dt id="' . esc_attr('ee-legend-item-tooltip-' . $item) . '" ' . $active_class . '>
727 727
                         <span class="' . esc_attr('ee-status-legend ee-status-bg--' . $status) . '"></span>
728 728
                         <span class="ee-legend-description">
729 729
                             ' . EEH_Template::pretty_status($status, false, 'sentence') . '
730 730
                         </span>
731 731
                     </dt>';
732
-        }
732
+		}
733 733
 
734
-        $content .= '
734
+		$content .= '
735 735
                 </dl>
736 736
             </div>
737 737
 ';
738
-        return $content;
739
-    }
740
-
741
-
742
-    /**
743
-     * Gets HTML for laying out a deeply-nested array (and objects) in a format
744
-     * that's nice for presenting in the wp admin
745
-     *
746
-     * @param mixed $data
747
-     * @return string
748
-     */
749
-    public static function layout_array_as_table($data)
750
-    {
751
-        if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
752
-            $data = (array) $data;
753
-        }
754
-        ob_start();
755
-        if (is_array($data)) {
756
-            if (EEH_Array::is_associative_array($data)) { ?>
738
+		return $content;
739
+	}
740
+
741
+
742
+	/**
743
+	 * Gets HTML for laying out a deeply-nested array (and objects) in a format
744
+	 * that's nice for presenting in the wp admin
745
+	 *
746
+	 * @param mixed $data
747
+	 * @return string
748
+	 */
749
+	public static function layout_array_as_table($data)
750
+	{
751
+		if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
752
+			$data = (array) $data;
753
+		}
754
+		ob_start();
755
+		if (is_array($data)) {
756
+			if (EEH_Array::is_associative_array($data)) { ?>
757 757
                 <table class="widefat">
758 758
                     <tbody>
759 759
                     <?php foreach ($data as $data_key => $data_values) { ?>
@@ -771,292 +771,292 @@  discard block
 block discarded – undo
771 771
             <?php } else { ?>
772 772
                 <ul>
773 773
                     <?php
774
-                    foreach ($data as $datum) {
775
-                        echo "<li>";
776
-                        echo self::layout_array_as_table($datum);
777
-                        echo "</li>";
778
-                    } ?>
774
+					foreach ($data as $datum) {
775
+						echo "<li>";
776
+						echo self::layout_array_as_table($datum);
777
+						echo "</li>";
778
+					} ?>
779 779
                 </ul>
780 780
             <?php }
781
-        } else {
782
-            // simple value
783
-            echo esc_html($data);
784
-        }
785
-        return ob_get_clean();
786
-    }
787
-
788
-
789
-    /**
790
-     * wrapper for self::get_paging_html() that simply echos the generated paging html
791
-     *
792
-     * @param        $total_items
793
-     * @param        $current
794
-     * @param        $per_page
795
-     * @param        $url
796
-     * @param bool   $show_num_field
797
-     * @param string $paged_arg_name
798
-     * @param array  $items_label
799
-     * @see   self:get_paging_html() for argument docs.
800
-     * @since 4.4.0
801
-     */
802
-    public static function paging_html(
803
-        $total_items,
804
-        $current,
805
-        $per_page,
806
-        $url,
807
-        $show_num_field = true,
808
-        $paged_arg_name = 'paged',
809
-        $items_label = []
810
-    ) {
811
-        echo self::get_paging_html(
812
-            $total_items,
813
-            $current,
814
-            $per_page,
815
-            $url,
816
-            $show_num_field,
817
-            $paged_arg_name,
818
-            $items_label
819
-        );
820
-    }
821
-
822
-
823
-    /**
824
-     * A method for generating paging similar to WP_List_Table
825
-     *
826
-     * @param integer $total_items      How many total items there are to page.
827
-     * @param integer $current          What the current page is.
828
-     * @param integer $per_page         How many items per page.
829
-     * @param string  $url              What the base url for page links is.
830
-     * @param boolean $show_num_field   Whether to show the input for changing page number.
831
-     * @param string  $paged_arg_name   The name of the key for the paged query argument.
832
-     * @param array   $items_label      An array of singular/plural values for the items label:
833
-     *                                  array(
834
-     *                                  'single' => 'item',
835
-     *                                  'plural' => 'items'
836
-     *                                  )
837
-     * @return  string
838
-     * @since    4.4.0
839
-     * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
840
-     */
841
-    public static function get_paging_html(
842
-        $total_items,
843
-        $current,
844
-        $per_page,
845
-        $url,
846
-        $show_num_field = true,
847
-        $paged_arg_name = 'paged',
848
-        $items_label = []
849
-    ) {
850
-        $page_links     = [];
851
-        $disable_first  = $disable_last = '';
852
-        $total_items    = (int) $total_items;
853
-        $per_page       = (int) $per_page;
854
-        $current        = (int) $current;
855
-        $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
856
-
857
-        // filter items_label
858
-        $items_label = apply_filters(
859
-            'FHEE__EEH_Template__get_paging_html__items_label',
860
-            $items_label
861
-        );
862
-
863
-        if (
864
-            empty($items_label)
865
-            || ! is_array($items_label)
866
-            || ! isset($items_label['single'])
867
-            || ! isset($items_label['plural'])
868
-        ) {
869
-            $items_label = [
870
-                'single' => esc_html__('1 item', 'event_espresso'),
871
-                'plural' => esc_html__('%s items', 'event_espresso'),
872
-            ];
873
-        } else {
874
-            $items_label = [
875
-                'single' => '1 ' . esc_html($items_label['single']),
876
-                'plural' => '%s ' . esc_html($items_label['plural']),
877
-            ];
878
-        }
879
-
880
-        $total_pages = ceil($total_items / $per_page);
881
-
882
-        if ($total_pages <= 1) {
883
-            return '';
884
-        }
885
-
886
-        $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
887
-
888
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
889
-
890
-        if ($current === 1) {
891
-            $disable_first = ' disabled';
892
-        }
893
-        if ($current == $total_pages) {
894
-            $disable_last = ' disabled';
895
-        }
896
-
897
-        $page_links[] = sprintf(
898
-            "<a class='%s' title='%s' href='%s'>%s</a>",
899
-            'first-page' . $disable_first,
900
-            esc_attr__('Go to the first page', 'event_espresso'),
901
-            esc_url_raw(remove_query_arg($paged_arg_name, $url)),
902
-            '&laquo;'
903
-        );
904
-
905
-        $page_links[] = sprintf(
906
-            '<a class="%s" title="%s" href="%s">%s</a>',
907
-            'prev-page' . $disable_first,
908
-            esc_attr__('Go to the previous page', 'event_espresso'),
909
-            esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
910
-            '&lsaquo;'
911
-        );
912
-
913
-        if (! $show_num_field) {
914
-            $html_current_page = $current;
915
-        } else {
916
-            $html_current_page = sprintf(
917
-                "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
918
-                esc_attr__('Current page', 'event_espresso'),
919
-                esc_attr($current),
920
-                strlen($total_pages)
921
-            );
922
-        }
923
-
924
-        $html_total_pages = sprintf(
925
-            '<span class="total-pages">%s</span>',
926
-            number_format_i18n($total_pages)
927
-        );
928
-        $page_links[]     = sprintf(
929
-            _x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
930
-            $html_current_page,
931
-            $html_total_pages,
932
-            '<span class="paging-input">',
933
-            '</span>'
934
-        );
935
-
936
-        $page_links[] = sprintf(
937
-            '<a class="%s" title="%s" href="%s">%s</a>',
938
-            'next-page' . $disable_last,
939
-            esc_attr__('Go to the next page', 'event_espresso'),
940
-            esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
941
-            '&rsaquo;'
942
-        );
943
-
944
-        $page_links[] = sprintf(
945
-            '<a class="%s" title="%s" href="%s">%s</a>',
946
-            'last-page' . $disable_last,
947
-            esc_attr__('Go to the last page', 'event_espresso'),
948
-            esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
949
-            '&raquo;'
950
-        );
951
-
952
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
953
-        // set page class
954
-        if ($total_pages) {
955
-            $page_class = $total_pages < 2 ? ' one-page' : '';
956
-        } else {
957
-            $page_class = ' no-pages';
958
-        }
959
-
960
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
961
-    }
962
-
963
-
964
-    /**
965
-     * @param string $wrap_class
966
-     * @param string $wrap_id
967
-     * @return string
968
-     */
969
-    public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = [])
970
-    {
971
-        $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
972
-        if (
973
-            ! $admin
974
-            && ! apply_filters(
975
-                'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
976
-                EE_Registry::instance()->CFG->admin->show_reg_footer
977
-            )
978
-        ) {
979
-            return '';
980
-        }
981
-        $tag        = $admin ? 'span' : 'div';
982
-        $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
983
-        $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
984
-        $attributes .= ! empty($wrap_class)
985
-            ? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
986
-            : ' class="powered-by-event-espresso-credit"';
987
-        $query_args = array_merge(
988
-            [
989
-                'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
990
-                'utm_source'   => 'powered_by_event_espresso',
991
-                'utm_medium'   => 'link',
992
-                'utm_campaign' => 'powered_by',
993
-            ],
994
-            $query_args
995
-        );
996
-        $powered_by = apply_filters(
997
-            'FHEE__EEH_Template__powered_by_event_espresso_text',
998
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
999
-        );
1000
-        $url        = add_query_arg($query_args, 'https://eventespresso.com/');
1001
-        $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
1002
-        return (string) apply_filters(
1003
-            'FHEE__EEH_Template__powered_by_event_espresso__html',
1004
-            sprintf(
1005
-                esc_html_x(
1006
-                    '%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
1007
-                    'Online event registration and ticketing powered by [link to eventespresso.com]',
1008
-                    'event_espresso'
1009
-                ),
1010
-                "<{$tag}{$attributes}>",
1011
-                "<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
1012
-                $admin ? '' : '<br />'
1013
-            ),
1014
-            $wrap_class,
1015
-            $wrap_id
1016
-        );
1017
-    }
1018
-
1019
-
1020
-    /**
1021
-     * @param string $image_name
1022
-     * @return string|null
1023
-     * @since   4.10.14.p
1024
-     */
1025
-    public static function getScreenshotUrl($image_name)
1026
-    {
1027
-        return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
1028
-    }
781
+		} else {
782
+			// simple value
783
+			echo esc_html($data);
784
+		}
785
+		return ob_get_clean();
786
+	}
787
+
788
+
789
+	/**
790
+	 * wrapper for self::get_paging_html() that simply echos the generated paging html
791
+	 *
792
+	 * @param        $total_items
793
+	 * @param        $current
794
+	 * @param        $per_page
795
+	 * @param        $url
796
+	 * @param bool   $show_num_field
797
+	 * @param string $paged_arg_name
798
+	 * @param array  $items_label
799
+	 * @see   self:get_paging_html() for argument docs.
800
+	 * @since 4.4.0
801
+	 */
802
+	public static function paging_html(
803
+		$total_items,
804
+		$current,
805
+		$per_page,
806
+		$url,
807
+		$show_num_field = true,
808
+		$paged_arg_name = 'paged',
809
+		$items_label = []
810
+	) {
811
+		echo self::get_paging_html(
812
+			$total_items,
813
+			$current,
814
+			$per_page,
815
+			$url,
816
+			$show_num_field,
817
+			$paged_arg_name,
818
+			$items_label
819
+		);
820
+	}
821
+
822
+
823
+	/**
824
+	 * A method for generating paging similar to WP_List_Table
825
+	 *
826
+	 * @param integer $total_items      How many total items there are to page.
827
+	 * @param integer $current          What the current page is.
828
+	 * @param integer $per_page         How many items per page.
829
+	 * @param string  $url              What the base url for page links is.
830
+	 * @param boolean $show_num_field   Whether to show the input for changing page number.
831
+	 * @param string  $paged_arg_name   The name of the key for the paged query argument.
832
+	 * @param array   $items_label      An array of singular/plural values for the items label:
833
+	 *                                  array(
834
+	 *                                  'single' => 'item',
835
+	 *                                  'plural' => 'items'
836
+	 *                                  )
837
+	 * @return  string
838
+	 * @since    4.4.0
839
+	 * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
840
+	 */
841
+	public static function get_paging_html(
842
+		$total_items,
843
+		$current,
844
+		$per_page,
845
+		$url,
846
+		$show_num_field = true,
847
+		$paged_arg_name = 'paged',
848
+		$items_label = []
849
+	) {
850
+		$page_links     = [];
851
+		$disable_first  = $disable_last = '';
852
+		$total_items    = (int) $total_items;
853
+		$per_page       = (int) $per_page;
854
+		$current        = (int) $current;
855
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
856
+
857
+		// filter items_label
858
+		$items_label = apply_filters(
859
+			'FHEE__EEH_Template__get_paging_html__items_label',
860
+			$items_label
861
+		);
862
+
863
+		if (
864
+			empty($items_label)
865
+			|| ! is_array($items_label)
866
+			|| ! isset($items_label['single'])
867
+			|| ! isset($items_label['plural'])
868
+		) {
869
+			$items_label = [
870
+				'single' => esc_html__('1 item', 'event_espresso'),
871
+				'plural' => esc_html__('%s items', 'event_espresso'),
872
+			];
873
+		} else {
874
+			$items_label = [
875
+				'single' => '1 ' . esc_html($items_label['single']),
876
+				'plural' => '%s ' . esc_html($items_label['plural']),
877
+			];
878
+		}
879
+
880
+		$total_pages = ceil($total_items / $per_page);
881
+
882
+		if ($total_pages <= 1) {
883
+			return '';
884
+		}
885
+
886
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
887
+
888
+		$output = '<span class="displaying-num">' . $item_label . '</span>';
889
+
890
+		if ($current === 1) {
891
+			$disable_first = ' disabled';
892
+		}
893
+		if ($current == $total_pages) {
894
+			$disable_last = ' disabled';
895
+		}
896
+
897
+		$page_links[] = sprintf(
898
+			"<a class='%s' title='%s' href='%s'>%s</a>",
899
+			'first-page' . $disable_first,
900
+			esc_attr__('Go to the first page', 'event_espresso'),
901
+			esc_url_raw(remove_query_arg($paged_arg_name, $url)),
902
+			'&laquo;'
903
+		);
904
+
905
+		$page_links[] = sprintf(
906
+			'<a class="%s" title="%s" href="%s">%s</a>',
907
+			'prev-page' . $disable_first,
908
+			esc_attr__('Go to the previous page', 'event_espresso'),
909
+			esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
910
+			'&lsaquo;'
911
+		);
912
+
913
+		if (! $show_num_field) {
914
+			$html_current_page = $current;
915
+		} else {
916
+			$html_current_page = sprintf(
917
+				"<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
918
+				esc_attr__('Current page', 'event_espresso'),
919
+				esc_attr($current),
920
+				strlen($total_pages)
921
+			);
922
+		}
923
+
924
+		$html_total_pages = sprintf(
925
+			'<span class="total-pages">%s</span>',
926
+			number_format_i18n($total_pages)
927
+		);
928
+		$page_links[]     = sprintf(
929
+			_x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
930
+			$html_current_page,
931
+			$html_total_pages,
932
+			'<span class="paging-input">',
933
+			'</span>'
934
+		);
935
+
936
+		$page_links[] = sprintf(
937
+			'<a class="%s" title="%s" href="%s">%s</a>',
938
+			'next-page' . $disable_last,
939
+			esc_attr__('Go to the next page', 'event_espresso'),
940
+			esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
941
+			'&rsaquo;'
942
+		);
943
+
944
+		$page_links[] = sprintf(
945
+			'<a class="%s" title="%s" href="%s">%s</a>',
946
+			'last-page' . $disable_last,
947
+			esc_attr__('Go to the last page', 'event_espresso'),
948
+			esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
949
+			'&raquo;'
950
+		);
951
+
952
+		$output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
953
+		// set page class
954
+		if ($total_pages) {
955
+			$page_class = $total_pages < 2 ? ' one-page' : '';
956
+		} else {
957
+			$page_class = ' no-pages';
958
+		}
959
+
960
+		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
961
+	}
962
+
963
+
964
+	/**
965
+	 * @param string $wrap_class
966
+	 * @param string $wrap_id
967
+	 * @return string
968
+	 */
969
+	public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = [])
970
+	{
971
+		$admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
972
+		if (
973
+			! $admin
974
+			&& ! apply_filters(
975
+				'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
976
+				EE_Registry::instance()->CFG->admin->show_reg_footer
977
+			)
978
+		) {
979
+			return '';
980
+		}
981
+		$tag        = $admin ? 'span' : 'div';
982
+		$attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
983
+		$wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
984
+		$attributes .= ! empty($wrap_class)
985
+			? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
986
+			: ' class="powered-by-event-espresso-credit"';
987
+		$query_args = array_merge(
988
+			[
989
+				'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
990
+				'utm_source'   => 'powered_by_event_espresso',
991
+				'utm_medium'   => 'link',
992
+				'utm_campaign' => 'powered_by',
993
+			],
994
+			$query_args
995
+		);
996
+		$powered_by = apply_filters(
997
+			'FHEE__EEH_Template__powered_by_event_espresso_text',
998
+			$admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
999
+		);
1000
+		$url        = add_query_arg($query_args, 'https://eventespresso.com/');
1001
+		$url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
1002
+		return (string) apply_filters(
1003
+			'FHEE__EEH_Template__powered_by_event_espresso__html',
1004
+			sprintf(
1005
+				esc_html_x(
1006
+					'%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
1007
+					'Online event registration and ticketing powered by [link to eventespresso.com]',
1008
+					'event_espresso'
1009
+				),
1010
+				"<{$tag}{$attributes}>",
1011
+				"<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
1012
+				$admin ? '' : '<br />'
1013
+			),
1014
+			$wrap_class,
1015
+			$wrap_id
1016
+		);
1017
+	}
1018
+
1019
+
1020
+	/**
1021
+	 * @param string $image_name
1022
+	 * @return string|null
1023
+	 * @since   4.10.14.p
1024
+	 */
1025
+	public static function getScreenshotUrl($image_name)
1026
+	{
1027
+		return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
1028
+	}
1029 1029
 }
1030 1030
 
1031 1031
 
1032 1032
 if (! function_exists('espresso_pagination')) {
1033
-    /**
1034
-     *    espresso_pagination
1035
-     *
1036
-     * @access    public
1037
-     * @return    void
1038
-     */
1039
-    function espresso_pagination()
1040
-    {
1041
-        global $wp_query;
1042
-        $big        = 999999999; // need an unlikely integer
1043
-        $pagination = paginate_links(
1044
-            [
1045
-                'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
1046
-                'format'       => '?paged=%#%',
1047
-                'current'      => max(1, get_query_var('paged')),
1048
-                'total'        => $wp_query->max_num_pages,
1049
-                'show_all'     => true,
1050
-                'end_size'     => 10,
1051
-                'mid_size'     => 6,
1052
-                'prev_next'    => true,
1053
-                'prev_text'    => esc_html__('&lsaquo; PREV', 'event_espresso'),
1054
-                'next_text'    => esc_html__('NEXT &rsaquo;', 'event_espresso'),
1055
-                'type'         => 'plain',
1056
-                'add_args'     => false,
1057
-                'add_fragment' => '',
1058
-            ]
1059
-        );
1060
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
1061
-    }
1033
+	/**
1034
+	 *    espresso_pagination
1035
+	 *
1036
+	 * @access    public
1037
+	 * @return    void
1038
+	 */
1039
+	function espresso_pagination()
1040
+	{
1041
+		global $wp_query;
1042
+		$big        = 999999999; // need an unlikely integer
1043
+		$pagination = paginate_links(
1044
+			[
1045
+				'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
1046
+				'format'       => '?paged=%#%',
1047
+				'current'      => max(1, get_query_var('paged')),
1048
+				'total'        => $wp_query->max_num_pages,
1049
+				'show_all'     => true,
1050
+				'end_size'     => 10,
1051
+				'mid_size'     => 6,
1052
+				'prev_next'    => true,
1053
+				'prev_text'    => esc_html__('&lsaquo; PREV', 'event_espresso'),
1054
+				'next_text'    => esc_html__('NEXT &rsaquo;', 'event_espresso'),
1055
+				'type'         => 'plain',
1056
+				'add_args'     => false,
1057
+				'add_fragment' => '',
1058
+			]
1059
+		);
1060
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
1061
+	}
1062 1062
 }
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use EventEspresso\core\services\loaders\LoaderFactory;
6 6
 use EventEspresso\core\services\request\RequestInterface;
7 7
 
8
-if (! function_exists('espresso_get_template_part')) {
8
+if ( ! function_exists('espresso_get_template_part')) {
9 9
     /**
10 10
      * espresso_get_template_part
11 11
      * 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
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 }
22 22
 
23 23
 
24
-if (! function_exists('espresso_get_object_css_class')) {
24
+if ( ! function_exists('espresso_get_object_css_class')) {
25 25
     /**
26 26
      * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
27 27
      *
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public static function load_espresso_theme_functions()
74 74
     {
75
-        if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
77
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
75
+        if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
76
+            if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().'/functions.php')) {
77
+                require_once(EE_PUBLIC.EE_Config::get_current_theme().'/functions.php');
78 78
             }
79 79
         }
80 80
     }
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
     public static function get_espresso_themes()
89 89
     {
90 90
         if (empty(EEH_Template::$_espresso_themes)) {
91
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
91
+            $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
92 92
             if (empty($espresso_themes)) {
93 93
                 return [];
94 94
             }
95 95
             if (($key = array_search('global_assets', $espresso_themes)) !== false) {
96
-                unset($espresso_themes[ $key ]);
96
+                unset($espresso_themes[$key]);
97 97
             }
98 98
             EEH_Template::$_espresso_themes = [];
99 99
             foreach ($espresso_themes as $espresso_theme) {
100
-                EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
100
+                EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
101 101
             }
102 102
         }
103 103
         return EEH_Template::$_espresso_themes;
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
                 // get array of EE Custom Post Types
214 214
                 $EE_CPTs = $custom_post_types->getDefinitions();
215 215
                 // build template name based on request
216
-                if (isset($EE_CPTs[ $post_type ])) {
216
+                if (isset($EE_CPTs[$post_type])) {
217 217
                     $archive_or_single = is_archive() ? 'archive' : '';
218 218
                     $archive_or_single = is_single() ? 'single' : $archive_or_single;
219
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
219
+                    $templates         = $archive_or_single.'-'.$post_type.'.php';
220 220
                 }
221 221
             }
222 222
             // currently active EE template theme
@@ -225,18 +225,18 @@  discard block
 block discarded – undo
225 225
             // array of paths to folders that may contain templates
226 226
             $template_folder_paths = [
227 227
                 // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
228
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
228
+                EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
229 229
                 // then in the root of the /wp-content/uploads/espresso/templates/ folder
230 230
                 EVENT_ESPRESSO_TEMPLATE_DIR,
231 231
             ];
232 232
 
233 233
             // add core plugin folders for checking only if we're not $check_if_custom
234
-            if (! $check_if_custom) {
235
-                $core_paths            = [
234
+            if ( ! $check_if_custom) {
235
+                $core_paths = [
236 236
                     // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
237
-                    EE_PUBLIC . $current_theme,
237
+                    EE_PUBLIC.$current_theme,
238 238
                     // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
239
-                    EE_TEMPLATES . $current_theme,
239
+                    EE_TEMPLATES.$current_theme,
240 240
                     // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
241 241
                     EE_PLUGIN_DIR_PATH,
242 242
                 ];
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
                     );
272 272
                     if ($common_base_path !== '') {
273 273
                         // both paths have a common base, so just tack the filename onto our search path
274
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
274
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
275 275
                     } else {
276 276
                         // no common base path, so let's just concatenate
277
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
277
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
278 278
                     }
279 279
                     // build up our template locations array by adding our resolved paths
280 280
                     $full_template_paths[] = $resolved_path;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                 // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
283 283
                 array_unshift($full_template_paths, $template);
284 284
                 // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
285
-                array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
285
+                array_unshift($full_template_paths, get_stylesheet_directory().'/'.$file_name);
286 286
             }
287 287
             // filter final array of full template paths
288 288
             $full_template_paths = apply_filters(
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 }
334 334
             }
335 335
             $common_base_path .= $directory;
336
-            $last_offset      = $index + 1;
336
+            $last_offset = $index + 1;
337 337
         }
338 338
         return substr($common_base_path, 0, -1);
339 339
     }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
372 372
 
373 373
         // you gimme nuttin - YOU GET NUTTIN !!
374
-        if (! $template_path || ! is_readable($template_path)) {
374
+        if ( ! $template_path || ! is_readable($template_path)) {
375 375
             // ignore whether template is accessible ?
376 376
             if ($throw_exceptions) {
377 377
                 throw new DomainException(
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             return '';
382 382
         }
383 383
         // if $template_args are not in an array, then make it so
384
-        if (! is_array($template_args) && ! is_object($template_args)) {
384
+        if ( ! is_array($template_args) && ! is_object($template_args)) {
385 385
             $template_args = [$template_args];
386 386
         }
387 387
         extract($template_args, EXTR_SKIP);
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
     public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
411 411
     {
412 412
         // in the beginning...
413
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
413
+        $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
414 414
         // da muddle
415 415
         $class = '';
416 416
         // the end
417
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
417
+        $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
418 418
         // is the passed object an EE object ?
419 419
         if ($object instanceof EE_Base_Class) {
420 420
             // grab the exact type of object
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
                 // no specifics just yet...
425 425
                 default:
426 426
                     $class = strtolower(str_replace('_', '-', $obj_class));
427
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
427
+                    $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
428 428
             }
429 429
         }
430
-        return $prefix . $class . $suffix;
430
+        return $prefix.$class.$suffix;
431 431
     }
432 432
 
433 433
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         // filter raw amount (allows 0.00 to be changed to "free" for example)
463 463
         $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
464 464
         // still a number, or was amount converted to a string like "free" ?
465
-        if (! is_float($amount_formatted)) {
465
+        if ( ! is_float($amount_formatted)) {
466 466
             return esc_html($amount_formatted);
467 467
         }
468 468
         try {
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             $mny = null;
474 474
         }
475 475
         // verify results
476
-        if (! $mny instanceof EE_Currency_Config) {
476
+        if ( ! $mny instanceof EE_Currency_Config) {
477 477
             // set default config country currency settings
478 478
             $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
479 479
                 ? EE_Registry::instance()->CFG->currency
@@ -482,16 +482,16 @@  discard block
 block discarded – undo
482 482
         // format float
483 483
         $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
484 484
         // add formatting ?
485
-        if (! $return_raw) {
485
+        if ( ! $return_raw) {
486 486
             // add currency sign
487 487
             if ($mny->sign_b4) {
488 488
                 if ($amount >= 0) {
489
-                    $amount_formatted = $mny->sign . $amount_formatted;
489
+                    $amount_formatted = $mny->sign.$amount_formatted;
490 490
                 } else {
491
-                    $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
491
+                    $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
492 492
                 }
493 493
             } else {
494
-                $amount_formatted = $amount_formatted . $mny->sign;
494
+                $amount_formatted = $amount_formatted.$mny->sign;
495 495
             }
496 496
 
497 497
             // filter to allow global setting of display_code
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
             // add currency code ?
504 504
             $amount_formatted = $display_code
505
-                ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>'
505
+                ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>'
506 506
                 : $amount_formatted;
507 507
         }
508 508
         // filter results
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
             $plural,
539 539
             $schema
540 540
         );
541
-        return $status[ $status_id ];
541
+        return $status[$status_id];
542 542
     }
543 543
 
544 544
 
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
     public static function get_button_or_link($url, $label, $class = 'button button--primary', $icon = '', $title = '')
556 556
     {
557 557
         $icon_html = '';
558
-        if (! empty($icon)) {
558
+        if ( ! empty($icon)) {
559 559
             $dashicons = preg_split("(ee-icon |dashicons )", $icon);
560 560
             $dashicons = array_filter($dashicons);
561 561
             $count     = count($dashicons);
562 562
             $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
563 563
             foreach ($dashicons as $dashicon) {
564
-                $type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
565
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
564
+                $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
565
+                $icon_html .= '<span class="'.$type.$dashicon.'"></span>';
566 566
             }
567 567
             $icon_html .= $count > 1 ? '</span>' : '';
568 568
         }
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         $action  = $action ?: $request->getRequestParam('action', 'default', 'key');
603 603
 
604 604
 
605
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
605
+        $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
606 606
         $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
607 607
         $help_text    = ! $help_text ? '' : $help_text;
608 608
         return '<a id="'
@@ -635,15 +635,15 @@  discard block
 block discarded – undo
635 635
         $id    = $tour->get_slug();
636 636
         $stops = $tour->get_stops();
637 637
 
638
-        $content = '<ol style="display:none" id="' . esc_attr($id) . '">';
638
+        $content = '<ol style="display:none" id="'.esc_attr($id).'">';
639 639
 
640 640
         foreach ($stops as $stop) {
641
-            $data_id    = ! empty($stop['id'])
642
-                ? ' data-id="' . esc_attr($stop['id']) . '"'
641
+            $data_id = ! empty($stop['id'])
642
+                ? ' data-id="'.esc_attr($stop['id']).'"'
643 643
                 : '';
644 644
 
645 645
             $data_class = empty($data_id) && ! empty($stop['class'])
646
-                ? ' data-class="' . esc_attr($stop['class']) . '"'
646
+                ? ' data-class="'.esc_attr($stop['class']).'"'
647 647
                 : '';
648 648
 
649 649
             // if container is set to modal then let's make sure we set the options accordingly
@@ -653,10 +653,10 @@  discard block
 block discarded – undo
653 653
             }
654 654
 
655 655
             $custom_class  = ! empty($stop['custom_class'])
656
-                ? ' class="' . esc_attr($stop['custom_class']) . '"'
656
+                ? ' class="'.esc_attr($stop['custom_class']).'"'
657 657
                 : '';
658 658
             $button_text   = ! empty($stop['button_text'])
659
-                ? ' data-button="' . esc_html($stop['button_text']) . '"'
659
+                ? ' data-button="'.esc_html($stop['button_text']).'"'
660 660
                 : '';
661 661
             $inner_content = isset($stop['content']) ? wp_kses($stop['content'], $allowedtags) : '';
662 662
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
             if (isset($stop['options']) && is_array($stop['options'])) {
665 665
                 $options = ' data-options="';
666 666
                 foreach ($stop['options'] as $option => $value) {
667
-                    $options .= esc_attr($option) . ':' . esc_attr($value) . ';';
667
+                    $options .= esc_attr($option).':'.esc_attr($value).';';
668 668
                 }
669 669
                 $options .= '"';
670 670
             } else {
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
      */
705 705
     public static function status_legend($status_array, $active_status = '')
706 706
     {
707
-        if (! is_array($status_array)) {
707
+        if ( ! is_array($status_array)) {
708 708
             throw new EE_Error(
709 709
                 esc_html__(
710 710
                     'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
@@ -716,17 +716,17 @@  discard block
 block discarded – undo
716 716
         $content = '
717 717
             <div class="ee-list-table-legend-container">
718 718
                 <h4 class="status-legend-title">
719
-                    ' . esc_html__('Status Legend', 'event_espresso') . '
719
+                    ' . esc_html__('Status Legend', 'event_espresso').'
720 720
                 </h4>
721 721
                 <dl class="ee-list-table-legend">';
722 722
 
723 723
         foreach ($status_array as $item => $status) {
724 724
             $active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
725
-            $content      .= '
726
-                    <dt id="' . esc_attr('ee-legend-item-tooltip-' . $item) . '" ' . $active_class . '>
727
-                        <span class="' . esc_attr('ee-status-legend ee-status-bg--' . $status) . '"></span>
725
+            $content .= '
726
+                    <dt id="' . esc_attr('ee-legend-item-tooltip-'.$item).'" '.$active_class.'>
727
+                        <span class="' . esc_attr('ee-status-legend ee-status-bg--'.$status).'"></span>
728 728
                         <span class="ee-legend-description">
729
-                            ' . EEH_Template::pretty_status($status, false, 'sentence') . '
729
+                            ' . EEH_Template::pretty_status($status, false, 'sentence').'
730 730
                         </span>
731 731
                     </dt>';
732 732
         }
@@ -872,8 +872,8 @@  discard block
 block discarded – undo
872 872
             ];
873 873
         } else {
874 874
             $items_label = [
875
-                'single' => '1 ' . esc_html($items_label['single']),
876
-                'plural' => '%s ' . esc_html($items_label['plural']),
875
+                'single' => '1 '.esc_html($items_label['single']),
876
+                'plural' => '%s '.esc_html($items_label['plural']),
877 877
             ];
878 878
         }
879 879
 
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
         $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
887 887
 
888
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
888
+        $output = '<span class="displaying-num">'.$item_label.'</span>';
889 889
 
890 890
         if ($current === 1) {
891 891
             $disable_first = ' disabled';
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 
897 897
         $page_links[] = sprintf(
898 898
             "<a class='%s' title='%s' href='%s'>%s</a>",
899
-            'first-page' . $disable_first,
899
+            'first-page'.$disable_first,
900 900
             esc_attr__('Go to the first page', 'event_espresso'),
901 901
             esc_url_raw(remove_query_arg($paged_arg_name, $url)),
902 902
             '&laquo;'
@@ -904,13 +904,13 @@  discard block
 block discarded – undo
904 904
 
905 905
         $page_links[] = sprintf(
906 906
             '<a class="%s" title="%s" href="%s">%s</a>',
907
-            'prev-page' . $disable_first,
907
+            'prev-page'.$disable_first,
908 908
             esc_attr__('Go to the previous page', 'event_espresso'),
909 909
             esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
910 910
             '&lsaquo;'
911 911
         );
912 912
 
913
-        if (! $show_num_field) {
913
+        if ( ! $show_num_field) {
914 914
             $html_current_page = $current;
915 915
         } else {
916 916
             $html_current_page = sprintf(
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
             '<span class="total-pages">%s</span>',
926 926
             number_format_i18n($total_pages)
927 927
         );
928
-        $page_links[]     = sprintf(
928
+        $page_links[] = sprintf(
929 929
             _x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
930 930
             $html_current_page,
931 931
             $html_total_pages,
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 
936 936
         $page_links[] = sprintf(
937 937
             '<a class="%s" title="%s" href="%s">%s</a>',
938
-            'next-page' . $disable_last,
938
+            'next-page'.$disable_last,
939 939
             esc_attr__('Go to the next page', 'event_espresso'),
940 940
             esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
941 941
             '&rsaquo;'
@@ -943,13 +943,13 @@  discard block
 block discarded – undo
943 943
 
944 944
         $page_links[] = sprintf(
945 945
             '<a class="%s" title="%s" href="%s">%s</a>',
946
-            'last-page' . $disable_last,
946
+            'last-page'.$disable_last,
947 947
             esc_attr__('Go to the last page', 'event_espresso'),
948 948
             esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
949 949
             '&raquo;'
950 950
         );
951 951
 
952
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
952
+        $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
953 953
         // set page class
954 954
         if ($total_pages) {
955 955
             $page_class = $total_pages < 2 ? ' one-page' : '';
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
             $page_class = ' no-pages';
958 958
         }
959 959
 
960
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
960
+        return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
961 961
     }
962 962
 
963 963
 
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
         );
996 996
         $powered_by = apply_filters(
997 997
             'FHEE__EEH_Template__powered_by_event_espresso_text',
998
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
998
+            $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'
999 999
         );
1000 1000
         $url        = add_query_arg($query_args, 'https://eventespresso.com/');
1001 1001
         $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
@@ -1024,12 +1024,12 @@  discard block
 block discarded – undo
1024 1024
      */
1025 1025
     public static function getScreenshotUrl($image_name)
1026 1026
     {
1027
-        return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
1027
+        return esc_url_raw(EE_GLOBAL_ASSETS_URL.'images/screenshots/'.$image_name.'.jpg');
1028 1028
     }
1029 1029
 }
1030 1030
 
1031 1031
 
1032
-if (! function_exists('espresso_pagination')) {
1032
+if ( ! function_exists('espresso_pagination')) {
1033 1033
     /**
1034 1034
      *    espresso_pagination
1035 1035
      *
@@ -1057,6 +1057,6 @@  discard block
 block discarded – undo
1057 1057
                 'add_fragment' => '',
1058 1058
             ]
1059 1059
         );
1060
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
1060
+        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">'.$pagination.'</div>' : '';
1061 1061
     }
1062 1062
 }
Please login to merge, or discard this patch.
core/libraries/iframe_display/IframeEmbedButton.php 2 patches
Indentation   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -17,272 +17,272 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * @var string $iframe_name
22
-     */
23
-    private $iframe_name;
20
+	/**
21
+	 * @var string $iframe_name
22
+	 */
23
+	private $iframe_name;
24 24
 
25
-    /**
26
-     * @var string $route_name
27
-     */
28
-    private $route_name;
25
+	/**
26
+	 * @var string $route_name
27
+	 */
28
+	private $route_name;
29 29
 
30
-    /**
31
-     * @var string $slug
32
-     */
33
-    private $slug;
30
+	/**
31
+	 * @var string $slug
32
+	 */
33
+	private $slug;
34 34
 
35
-    /**
36
-     * @var boolean $append_filterable_content
37
-     */
38
-    private $append_filterable_content;
35
+	/**
36
+	 * @var boolean $append_filterable_content
37
+	 */
38
+	private $append_filterable_content;
39 39
 
40 40
 
41
-    /**
42
-     * IframeEmbedButton constructor.
43
-     *
44
-     * @param string $iframe_name i18n name for the iframe. This will be used in HTML
45
-     * @param string $route_name  the name of the registered route
46
-     * @param string $slug        URL slug used for the thing the iframe button is being embedded in.
47
-     *                            will most likely be "event" since that's the only usage atm
48
-     */
49
-    public function __construct($iframe_name, $route_name, $slug = 'event')
50
-    {
51
-        $this->iframe_name = $iframe_name;
52
-        $this->route_name = $route_name;
53
-        $this->slug = $slug;
54
-    }
41
+	/**
42
+	 * IframeEmbedButton constructor.
43
+	 *
44
+	 * @param string $iframe_name i18n name for the iframe. This will be used in HTML
45
+	 * @param string $route_name  the name of the registered route
46
+	 * @param string $slug        URL slug used for the thing the iframe button is being embedded in.
47
+	 *                            will most likely be "event" since that's the only usage atm
48
+	 */
49
+	public function __construct($iframe_name, $route_name, $slug = 'event')
50
+	{
51
+		$this->iframe_name = $iframe_name;
52
+		$this->route_name = $route_name;
53
+		$this->slug = $slug;
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * Adds an iframe embed code button to the Event editor.
59
-     */
60
-    public function addEventEditorIframeEmbedButtonFilter()
61
-    {
62
-        // add button for iframe code to event editor.
63
-        add_filter(
64
-            'get_sample_permalink_html',
65
-            array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'),
66
-            10,
67
-            2
68
-        );
69
-        add_action(
70
-            'admin_enqueue_scripts',
71
-            array($this, 'embedButtonAssets'),
72
-            10
73
-        );
74
-    }
57
+	/**
58
+	 * Adds an iframe embed code button to the Event editor.
59
+	 */
60
+	public function addEventEditorIframeEmbedButtonFilter()
61
+	{
62
+		// add button for iframe code to event editor.
63
+		add_filter(
64
+			'get_sample_permalink_html',
65
+			array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'),
66
+			10,
67
+			2
68
+		);
69
+		add_action(
70
+			'admin_enqueue_scripts',
71
+			array($this, 'embedButtonAssets'),
72
+			10
73
+		);
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @param $permalink_string
79
-     * @param $id
80
-     * @return string
81
-     */
82
-    public function appendIframeEmbedButtonToSamplePermalinkHtml($permalink_string, $id)
83
-    {
84
-        return $this->eventEditorIframeEmbedButton(
85
-            $permalink_string,
86
-            $id
87
-        );
88
-    }
77
+	/**
78
+	 * @param $permalink_string
79
+	 * @param $id
80
+	 * @return string
81
+	 */
82
+	public function appendIframeEmbedButtonToSamplePermalinkHtml($permalink_string, $id)
83
+	{
84
+		return $this->eventEditorIframeEmbedButton(
85
+			$permalink_string,
86
+			$id
87
+		);
88
+	}
89 89
 
90 90
 
91
-    /**
92
-     * iframe embed code button to the Event editor.
93
-     *
94
-     * @param string $permalink_string
95
-     * @param int    $id
96
-     * @return string
97
-     */
98
-    public function eventEditorIframeEmbedButton(
99
-        $permalink_string,
100
-        $id
101
-    ) {
102
-        // make sure this is ONLY when editing and the event id has been set.
103
-        if (! empty($id)) {
104
-            $post = get_post($id);
105
-            // if NOT event then let's get out.
106
-            if ($post->post_type !== 'espresso_events') {
107
-                return $permalink_string;
108
-            }
109
-            $permalink_string .= $this->embedButtonHtml([$this->slug => $id]);
110
-        }
111
-        return $permalink_string;
112
-    }
91
+	/**
92
+	 * iframe embed code button to the Event editor.
93
+	 *
94
+	 * @param string $permalink_string
95
+	 * @param int    $id
96
+	 * @return string
97
+	 */
98
+	public function eventEditorIframeEmbedButton(
99
+		$permalink_string,
100
+		$id
101
+	) {
102
+		// make sure this is ONLY when editing and the event id has been set.
103
+		if (! empty($id)) {
104
+			$post = get_post($id);
105
+			// if NOT event then let's get out.
106
+			if ($post->post_type !== 'espresso_events') {
107
+				return $permalink_string;
108
+			}
109
+			$permalink_string .= $this->embedButtonHtml([$this->slug => $id]);
110
+		}
111
+		return $permalink_string;
112
+	}
113 113
 
114 114
 
115
-    /**
116
-     * Adds an iframe embed code button via a WP do_action() as determined by the first parameter
117
-     *
118
-     * @param string $action name of the WP do_action() to hook into
119
-     */
120
-    public function addActionIframeEmbedButton($action)
121
-    {
122
-        // add button for iframe code to event editor.
123
-        add_action(
124
-            $action,
125
-            array($this, 'addActionIframeEmbedButtonCallback'),
126
-            10,
127
-            2
128
-        );
129
-    }
115
+	/**
116
+	 * Adds an iframe embed code button via a WP do_action() as determined by the first parameter
117
+	 *
118
+	 * @param string $action name of the WP do_action() to hook into
119
+	 */
120
+	public function addActionIframeEmbedButton($action)
121
+	{
122
+		// add button for iframe code to event editor.
123
+		add_action(
124
+			$action,
125
+			array($this, 'addActionIframeEmbedButtonCallback'),
126
+			10,
127
+			2
128
+		);
129
+	}
130 130
 
131 131
 
132
-    /**
133
-     * @return void
134
-     */
135
-    public function addActionIframeEmbedButtonCallback()
136
-    {
137
-        echo $this->embedButtonHtml(); // already escaped
138
-    }
132
+	/**
133
+	 * @return void
134
+	 */
135
+	public function addActionIframeEmbedButtonCallback()
136
+	{
137
+		echo $this->embedButtonHtml(); // already escaped
138
+	}
139 139
 
140 140
 
141
-    /**
142
-     * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter
143
-     *
144
-     * @param string $filter     name of the WP apply_filters() to hook into
145
-     * @param bool   $append     if true, will add iframe embed button to end of content,
146
-     *                           else if false, will add to the beginning of the content
147
-     */
148
-    public function addFilterIframeEmbedButton($filter, $append = true)
149
-    {
150
-        $this->append_filterable_content = $append;
151
-        // add button for iframe code to event editor.
152
-        add_filter(
153
-            $filter,
154
-            array($this, 'addFilterIframeEmbedButtonCallback'),
155
-            10
156
-        );
157
-    }
141
+	/**
142
+	 * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter
143
+	 *
144
+	 * @param string $filter     name of the WP apply_filters() to hook into
145
+	 * @param bool   $append     if true, will add iframe embed button to end of content,
146
+	 *                           else if false, will add to the beginning of the content
147
+	 */
148
+	public function addFilterIframeEmbedButton($filter, $append = true)
149
+	{
150
+		$this->append_filterable_content = $append;
151
+		// add button for iframe code to event editor.
152
+		add_filter(
153
+			$filter,
154
+			array($this, 'addFilterIframeEmbedButtonCallback'),
155
+			10
156
+		);
157
+	}
158 158
 
159 159
 
160
-    /**
161
-     * @param array|string $filterable_content
162
-     * @return array|string
163
-     */
164
-    public function addFilterIframeEmbedButtonCallback($filterable_content)
165
-    {
166
-        $embedButtonHtml = $this->embedButtonHtml();
167
-        if (is_array($filterable_content)) {
168
-            $filterable_content = $this->append_filterable_content
169
-                ? $filterable_content + array($this->route_name => $embedButtonHtml)
170
-                : array($this->route_name => $embedButtonHtml) + $filterable_content;
171
-        } else {
172
-            $filterable_content = $this->append_filterable_content
173
-                ? $filterable_content . $embedButtonHtml
174
-                : $embedButtonHtml . $filterable_content;
175
-        }
176
-        return $filterable_content;
177
-    }
160
+	/**
161
+	 * @param array|string $filterable_content
162
+	 * @return array|string
163
+	 */
164
+	public function addFilterIframeEmbedButtonCallback($filterable_content)
165
+	{
166
+		$embedButtonHtml = $this->embedButtonHtml();
167
+		if (is_array($filterable_content)) {
168
+			$filterable_content = $this->append_filterable_content
169
+				? $filterable_content + array($this->route_name => $embedButtonHtml)
170
+				: array($this->route_name => $embedButtonHtml) + $filterable_content;
171
+		} else {
172
+			$filterable_content = $this->append_filterable_content
173
+				? $filterable_content . $embedButtonHtml
174
+				: $embedButtonHtml . $filterable_content;
175
+		}
176
+		return $filterable_content;
177
+	}
178 178
 
179 179
 
180
-    /**
181
-     * iframe_embed_html
182
-     *
183
-     * @param array  $query_args
184
-     * @param string $button_class
185
-     * @return string
186
-     */
187
-    public function embedButtonHtml($query_args = array(), $button_class = '')
188
-    {
189
-        // incoming args will replace the defaults listed here in the second array (union preserves first array)
190
-        $query_args = (array) $query_args + array($this->route_name => 'iframe');
191
-        $query_args = (array) apply_filters(
192
-            'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args',
193
-            $query_args
194
-        );
195
-        // add this route to our localized vars
196
-        $iframe_module_routes                      = EE_Registry::$i18n_js_strings['iframe_module_routes'] ?? [];
197
-        $iframe_module_routes[ $this->route_name ] = $this->route_name;
198
-        EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes;
199
-        $route_name = esc_attr($this->route_name);
200
-        $iframe_url = esc_url_raw(add_query_arg($query_args, site_url()));
180
+	/**
181
+	 * iframe_embed_html
182
+	 *
183
+	 * @param array  $query_args
184
+	 * @param string $button_class
185
+	 * @return string
186
+	 */
187
+	public function embedButtonHtml($query_args = array(), $button_class = '')
188
+	{
189
+		// incoming args will replace the defaults listed here in the second array (union preserves first array)
190
+		$query_args = (array) $query_args + array($this->route_name => 'iframe');
191
+		$query_args = (array) apply_filters(
192
+			'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args',
193
+			$query_args
194
+		);
195
+		// add this route to our localized vars
196
+		$iframe_module_routes                      = EE_Registry::$i18n_js_strings['iframe_module_routes'] ?? [];
197
+		$iframe_module_routes[ $this->route_name ] = $this->route_name;
198
+		EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes;
199
+		$route_name = esc_attr($this->route_name);
200
+		$iframe_url = esc_url_raw(add_query_arg($query_args, site_url()));
201 201
 
202
-        return EEH_HTML::div(
203
-            EEH_HTML::link(
204
-                '#',
205
-                sprintf(esc_html__('Embed %1$s', 'event_espresso'), $this->iframe_name),
206
-                sprintf(
207
-                    esc_html__(
208
-                        'click here to generate code for embedding %1$s iframe into another site.',
209
-                        'event_espresso'
210
-                    ),
211
-                    EEH_Inflector::add_indefinite_article($this->iframe_name)
212
-                ),
213
-                $route_name . '-iframe-embed-trigger-js',
214
-                'iframe-embed-trigger-js button button--small button--secondary ' . esc_attr($button_class),
215
-                '',
216
-                ' data-iframe_embed_button="#' . $route_name . '-iframe-js" tabindex="-1"'
217
-            )
218
-            ,
219
-            '',
220
-            'ee-admin-button-row ee-admin-button-row--align-start'
221
-        )
222
-        . EEH_HTML::div(
223
-            EEH_HTML::div(
224
-                '<iframe src="' . $iframe_url . '" width="100%" height="100%"></iframe>',
225
-                '',
226
-                '',
227
-                'width:100%; height: 500px;'
228
-            ),
229
-            $route_name . '-iframe-js',
230
-            'iframe-embed-wrapper-js',
231
-            'display:none;'
232
-        );
202
+		return EEH_HTML::div(
203
+			EEH_HTML::link(
204
+				'#',
205
+				sprintf(esc_html__('Embed %1$s', 'event_espresso'), $this->iframe_name),
206
+				sprintf(
207
+					esc_html__(
208
+						'click here to generate code for embedding %1$s iframe into another site.',
209
+						'event_espresso'
210
+					),
211
+					EEH_Inflector::add_indefinite_article($this->iframe_name)
212
+				),
213
+				$route_name . '-iframe-embed-trigger-js',
214
+				'iframe-embed-trigger-js button button--small button--secondary ' . esc_attr($button_class),
215
+				'',
216
+				' data-iframe_embed_button="#' . $route_name . '-iframe-js" tabindex="-1"'
217
+			)
218
+			,
219
+			'',
220
+			'ee-admin-button-row ee-admin-button-row--align-start'
221
+		)
222
+		. EEH_HTML::div(
223
+			EEH_HTML::div(
224
+				'<iframe src="' . $iframe_url . '" width="100%" height="100%"></iframe>',
225
+				'',
226
+				'',
227
+				'width:100%; height: 500px;'
228
+			),
229
+			$route_name . '-iframe-js',
230
+			'iframe-embed-wrapper-js',
231
+			'display:none;'
232
+		);
233 233
 }
234 234
 
235 235
 
236
-    /**
237
-     * enqueue iframe button js
238
-     */
239
-    public function embedButtonAssets()
240
-    {
241
-        EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__(
242
-            'copy and paste the following into any other site\'s content to display this event:',
243
-            'event_espresso'
244
-        );
245
-        EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__(
246
-            'click anywhere outside of this window to close it.',
247
-            'event_espresso'
248
-        );
249
-        wp_register_script(
250
-            'iframe_embed_button',
251
-            plugin_dir_url(__FILE__) . 'iframe-embed-button.js',
252
-            array('ee-dialog'),
253
-            EVENT_ESPRESSO_VERSION,
254
-            true
255
-        );
256
-        wp_enqueue_script('iframe_embed_button');
257
-    }
236
+	/**
237
+	 * enqueue iframe button js
238
+	 */
239
+	public function embedButtonAssets()
240
+	{
241
+		EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__(
242
+			'copy and paste the following into any other site\'s content to display this event:',
243
+			'event_espresso'
244
+		);
245
+		EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__(
246
+			'click anywhere outside of this window to close it.',
247
+			'event_espresso'
248
+		);
249
+		wp_register_script(
250
+			'iframe_embed_button',
251
+			plugin_dir_url(__FILE__) . 'iframe-embed-button.js',
252
+			array('ee-dialog'),
253
+			EVENT_ESPRESSO_VERSION,
254
+			true
255
+		);
256
+		wp_enqueue_script('iframe_embed_button');
257
+	}
258 258
 
259 259
 
260
-    /**
261
-     * generates embed button sections for admin pages
262
-     *
263
-     * @param array $embed_buttons
264
-     * @return string
265
-     */
266
-    public function addIframeEmbedButtonsSection(array $embed_buttons)
267
-    {
268
-        $embed_buttons = (array) apply_filters(
269
-            'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons',
270
-            $embed_buttons
271
-        );
272
-        if (empty($embed_buttons)) {
273
-            return '';
274
-        }
275
-        // add button for iframe code to event editor.
276
-        $html = EEH_HTML::div('', '', 'ee-admin-section ee-iframe-embed-buttons');
277
-        $html .= EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso'));
278
-        $html .= EEH_HTML::p(
279
-            esc_html__(
280
-                'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.',
281
-                'event_espresso'
282
-            )
283
-        );
284
-        $html .= ' &nbsp; ' . implode(' &nbsp; ', $embed_buttons) . ' ';
285
-        $html .= EEH_HTML::divx();
286
-        return $html;
287
-    }
260
+	/**
261
+	 * generates embed button sections for admin pages
262
+	 *
263
+	 * @param array $embed_buttons
264
+	 * @return string
265
+	 */
266
+	public function addIframeEmbedButtonsSection(array $embed_buttons)
267
+	{
268
+		$embed_buttons = (array) apply_filters(
269
+			'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons',
270
+			$embed_buttons
271
+		);
272
+		if (empty($embed_buttons)) {
273
+			return '';
274
+		}
275
+		// add button for iframe code to event editor.
276
+		$html = EEH_HTML::div('', '', 'ee-admin-section ee-iframe-embed-buttons');
277
+		$html .= EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso'));
278
+		$html .= EEH_HTML::p(
279
+			esc_html__(
280
+				'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.',
281
+				'event_espresso'
282
+			)
283
+		);
284
+		$html .= ' &nbsp; ' . implode(' &nbsp; ', $embed_buttons) . ' ';
285
+		$html .= EEH_HTML::divx();
286
+		return $html;
287
+	}
288 288
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $id
101 101
     ) {
102 102
         // make sure this is ONLY when editing and the event id has been set.
103
-        if (! empty($id)) {
103
+        if ( ! empty($id)) {
104 104
             $post = get_post($id);
105 105
             // if NOT event then let's get out.
106 106
             if ($post->post_type !== 'espresso_events') {
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
                 : array($this->route_name => $embedButtonHtml) + $filterable_content;
171 171
         } else {
172 172
             $filterable_content = $this->append_filterable_content
173
-                ? $filterable_content . $embedButtonHtml
174
-                : $embedButtonHtml . $filterable_content;
173
+                ? $filterable_content.$embedButtonHtml
174
+                : $embedButtonHtml.$filterable_content;
175 175
         }
176 176
         return $filterable_content;
177 177
     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         );
195 195
         // add this route to our localized vars
196 196
         $iframe_module_routes                      = EE_Registry::$i18n_js_strings['iframe_module_routes'] ?? [];
197
-        $iframe_module_routes[ $this->route_name ] = $this->route_name;
197
+        $iframe_module_routes[$this->route_name] = $this->route_name;
198 198
         EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes;
199 199
         $route_name = esc_attr($this->route_name);
200 200
         $iframe_url = esc_url_raw(add_query_arg($query_args, site_url()));
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
                     ),
211 211
                     EEH_Inflector::add_indefinite_article($this->iframe_name)
212 212
                 ),
213
-                $route_name . '-iframe-embed-trigger-js',
214
-                'iframe-embed-trigger-js button button--small button--secondary ' . esc_attr($button_class),
213
+                $route_name.'-iframe-embed-trigger-js',
214
+                'iframe-embed-trigger-js button button--small button--secondary '.esc_attr($button_class),
215 215
                 '',
216
-                ' data-iframe_embed_button="#' . $route_name . '-iframe-js" tabindex="-1"'
216
+                ' data-iframe_embed_button="#'.$route_name.'-iframe-js" tabindex="-1"'
217 217
             )
218 218
             ,
219 219
             '',
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
         )
222 222
         . EEH_HTML::div(
223 223
             EEH_HTML::div(
224
-                '<iframe src="' . $iframe_url . '" width="100%" height="100%"></iframe>',
224
+                '<iframe src="'.$iframe_url.'" width="100%" height="100%"></iframe>',
225 225
                 '',
226 226
                 '',
227 227
                 'width:100%; height: 500px;'
228 228
             ),
229
-            $route_name . '-iframe-js',
229
+            $route_name.'-iframe-js',
230 230
             'iframe-embed-wrapper-js',
231 231
             'display:none;'
232 232
         );
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         );
249 249
         wp_register_script(
250 250
             'iframe_embed_button',
251
-            plugin_dir_url(__FILE__) . 'iframe-embed-button.js',
251
+            plugin_dir_url(__FILE__).'iframe-embed-button.js',
252 252
             array('ee-dialog'),
253 253
             EVENT_ESPRESSO_VERSION,
254 254
             true
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 'event_espresso'
282 282
             )
283 283
         );
284
-        $html .= ' &nbsp; ' . implode(' &nbsp; ', $embed_buttons) . ' ';
284
+        $html .= ' &nbsp; '.implode(' &nbsp; ', $embed_buttons).' ';
285 285
         $html .= EEH_HTML::divx();
286 286
         return $html;
287 287
     }
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 2 patches
Indentation   +4162 added lines, -4162 removed lines patch added patch discarded remove patch
@@ -19,4245 +19,4245 @@
 block discarded – undo
19 19
  */
20 20
 abstract class EE_Admin_Page extends EE_Base implements InterminableInterface
21 21
 {
22
-    /**
23
-     * @var EE_Admin_Config
24
-     */
25
-    protected $admin_config;
22
+	/**
23
+	 * @var EE_Admin_Config
24
+	 */
25
+	protected $admin_config;
26 26
 
27
-    /**
28
-     * @var LoaderInterface
29
-     */
30
-    protected $loader;
27
+	/**
28
+	 * @var LoaderInterface
29
+	 */
30
+	protected $loader;
31 31
 
32
-    /**
33
-     * @var RequestInterface
34
-     */
35
-    protected $request;
32
+	/**
33
+	 * @var RequestInterface
34
+	 */
35
+	protected $request;
36 36
 
37
-    // set in _init_page_props()
38
-    public $page_slug;
37
+	// set in _init_page_props()
38
+	public $page_slug;
39 39
 
40
-    public $page_label;
40
+	public $page_label;
41 41
 
42
-    public $page_folder;
42
+	public $page_folder;
43 43
 
44
-    // set in define_page_props()
45
-    protected $_admin_base_url;
44
+	// set in define_page_props()
45
+	protected $_admin_base_url;
46 46
 
47
-    protected $_admin_base_path;
47
+	protected $_admin_base_path;
48 48
 
49
-    protected $_admin_page_title;
49
+	protected $_admin_page_title;
50 50
 
51
-    protected $_labels;
51
+	protected $_labels;
52 52
 
53 53
 
54
-    // set early within EE_Admin_Init
55
-    protected $_wp_page_slug;
54
+	// set early within EE_Admin_Init
55
+	protected $_wp_page_slug;
56 56
 
57
-    // nav tabs
58
-    protected $_nav_tabs;
57
+	// nav tabs
58
+	protected $_nav_tabs;
59 59
 
60
-    protected $_default_nav_tab_name;
60
+	protected $_default_nav_tab_name;
61 61
 
62
-    /**
63
-     * @var array $_help_tour
64
-     */
65
-    protected $_help_tour = [];
62
+	/**
63
+	 * @var array $_help_tour
64
+	 */
65
+	protected $_help_tour = [];
66 66
 
67 67
 
68
-    // template variables (used by templates)
69
-    protected $_template_path;
68
+	// template variables (used by templates)
69
+	protected $_template_path;
70 70
 
71
-    protected $_column_template_path;
71
+	protected $_column_template_path;
72 72
 
73
-    /**
74
-     * @var array $_template_args
75
-     */
76
-    protected $_template_args = [];
73
+	/**
74
+	 * @var array $_template_args
75
+	 */
76
+	protected $_template_args = [];
77 77
 
78
-    /**
79
-     * this will hold the list table object for a given view.
80
-     *
81
-     * @var EE_Admin_List_Table $_list_table_object
82
-     */
83
-    protected $_list_table_object;
78
+	/**
79
+	 * this will hold the list table object for a given view.
80
+	 *
81
+	 * @var EE_Admin_List_Table $_list_table_object
82
+	 */
83
+	protected $_list_table_object;
84 84
 
85
-    // boolean
86
-    protected $_is_UI_request; // this starts at null so we can have no header routes progress through two states.
85
+	// boolean
86
+	protected $_is_UI_request; // this starts at null so we can have no header routes progress through two states.
87 87
 
88
-    protected $_routing;
88
+	protected $_routing;
89 89
 
90
-    // list table args
91
-    protected $_view;
90
+	// list table args
91
+	protected $_view;
92 92
 
93
-    protected $_views;
93
+	protected $_views;
94 94
 
95 95
 
96
-    // action => method pairs used for routing incoming requests
97
-    protected $_page_routes;
96
+	// action => method pairs used for routing incoming requests
97
+	protected $_page_routes;
98 98
 
99
-    /**
100
-     * @var array $_page_config
101
-     */
102
-    protected $_page_config;
99
+	/**
100
+	 * @var array $_page_config
101
+	 */
102
+	protected $_page_config;
103 103
 
104
-    /**
105
-     * the current page route and route config
106
-     *
107
-     * @var string $_route
108
-     */
109
-    protected $_route;
104
+	/**
105
+	 * the current page route and route config
106
+	 *
107
+	 * @var string $_route
108
+	 */
109
+	protected $_route;
110 110
 
111
-    /**
112
-     * @var string $_cpt_route
113
-     */
114
-    protected $_cpt_route;
111
+	/**
112
+	 * @var string $_cpt_route
113
+	 */
114
+	protected $_cpt_route;
115 115
 
116
-    /**
117
-     * @var array $_route_config
118
-     */
119
-    protected $_route_config;
116
+	/**
117
+	 * @var array $_route_config
118
+	 */
119
+	protected $_route_config;
120 120
 
121
-    /**
122
-     * Used to hold default query args for list table routes to help preserve stickiness of filters for carried out
123
-     * actions.
124
-     *
125
-     * @since 4.6.x
126
-     * @var array.
127
-     */
128
-    protected $_default_route_query_args;
121
+	/**
122
+	 * Used to hold default query args for list table routes to help preserve stickiness of filters for carried out
123
+	 * actions.
124
+	 *
125
+	 * @since 4.6.x
126
+	 * @var array.
127
+	 */
128
+	protected $_default_route_query_args;
129 129
 
130
-    // set via request page and action args.
131
-    protected $_current_page;
132
-
133
-    protected $_current_view;
130
+	// set via request page and action args.
131
+	protected $_current_page;
132
+
133
+	protected $_current_view;
134 134
 
135
-    protected $_current_page_view_url;
135
+	protected $_current_page_view_url;
136 136
 
137
-    /**
138
-     * unprocessed value for the 'action' request param (default '')
139
-     *
140
-     * @var string
141
-     */
142
-    protected $raw_req_action = '';
143
-
144
-    /**
145
-     * unprocessed value for the 'page' request param (default '')
146
-     *
147
-     * @var string
148
-     */
149
-    protected $raw_req_page = '';
150
-
151
-    /**
152
-     * sanitized request action (and nonce)
153
-     *
154
-     * @var string
155
-     */
156
-    protected $_req_action = '';
157
-
158
-    /**
159
-     * sanitized request action nonce
160
-     *
161
-     * @var string
162
-     */
163
-    protected $_req_nonce = '';
164
-
165
-    /**
166
-     * @var string
167
-     */
168
-    protected $_search_btn_label = '';
169
-
170
-    /**
171
-     * @var string
172
-     */
173
-    protected $_search_box_callback = '';
174
-
175
-    /**
176
-     * @var WP_Screen
177
-     */
178
-    protected $_current_screen;
179
-
180
-    // for holding EE_Admin_Hooks object when needed (set via set_hook_object())
181
-    protected $_hook_obj;
182
-
183
-    // for holding incoming request data
184
-    protected $_req_data = [];
185
-
186
-    // yes / no array for admin form fields
187
-    protected $_yes_no_values = [];
188
-
189
-    // some default things shared by all child classes
190
-    protected $_default_espresso_metaboxes;
191
-
192
-    /**
193
-     * @var EE_Registry
194
-     */
195
-    protected $EE;
196
-
197
-
198
-    /**
199
-     * This is just a property that flags whether the given route is a caffeinated route or not.
200
-     *
201
-     * @var boolean
202
-     */
203
-    protected $_is_caf = false;
204
-
205
-    /**
206
-     * whether or not initializePage() has run
207
-     *
208
-     * @var boolean
209
-     */
210
-    protected $initialized = false;
211
-
212
-    /**
213
-     * @var FeatureFlags
214
-     */
215
-    protected $feature;
216
-
217
-
218
-    /**
219
-     * @Constructor
220
-     * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
221
-     * @throws InvalidArgumentException
222
-     * @throws InvalidDataTypeException
223
-     * @throws InvalidInterfaceException
224
-     * @throws ReflectionException
225
-     */
226
-    public function __construct($routing = true)
227
-    {
228
-        $this->loader = LoaderFactory::getLoader();
229
-        $this->admin_config = $this->loader->getShared('EE_Admin_Config');
230
-        $this->feature = $this->loader->getShared(FeatureFlags::class);
231
-        $this->request = $this->loader->getShared(RequestInterface::class);
232
-        // routing enabled?
233
-        $this->_routing = $routing;
234
-
235
-        if (strpos($this->_get_dir(), 'caffeinated') !== false) {
236
-            $this->_is_caf = true;
237
-        }
238
-        $this->_yes_no_values = [
239
-            ['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
240
-            ['id' => false, 'text' => esc_html__('No', 'event_espresso')],
241
-        ];
242
-        // set the _req_data property.
243
-        $this->_req_data = $this->request->requestParams();
244
-    }
245
-
246
-
247
-    /**
248
-     * @return EE_Admin_Config
249
-     */
250
-    public function adminConfig(): EE_Admin_Config
251
-    {
252
-        return $this->admin_config;
253
-    }
254
-
255
-
256
-    /**
257
-     * @return FeatureFlags
258
-     */
259
-    public function feature(): FeatureFlags
260
-    {
261
-        return $this->feature;
262
-    }
263
-
264
-
265
-    /**
266
-     * This logic used to be in the constructor, but that caused a chicken <--> egg scenario
267
-     * for child classes that needed to set properties prior to these methods getting called,
268
-     * but also needed the parent class to have its construction completed as well.
269
-     * Bottom line is that constructors should ONLY be used for setting initial properties
270
-     * and any complex initialization logic should only run after instantiation is complete.
271
-     *
272
-     * This method gets called immediately after construction from within
273
-     *      EE_Admin_Page_Init::_initialize_admin_page()
274
-     *
275
-     * @throws EE_Error
276
-     * @throws InvalidArgumentException
277
-     * @throws InvalidDataTypeException
278
-     * @throws InvalidInterfaceException
279
-     * @throws ReflectionException
280
-     * @since $VID:$
281
-     */
282
-    public function initializePage()
283
-    {
284
-        if ($this->initialized) {
285
-            return;
286
-        }
287
-        // set initial page props (child method)
288
-        $this->_init_page_props();
289
-        // set global defaults
290
-        $this->_set_defaults();
291
-        // set early because incoming requests could be ajax related and we need to register those hooks.
292
-        $this->_global_ajax_hooks();
293
-        $this->_ajax_hooks();
294
-        // other_page_hooks have to be early too.
295
-        $this->_do_other_page_hooks();
296
-        // set up page dependencies
297
-        $this->_before_page_setup();
298
-        $this->_page_setup();
299
-        $this->initialized = true;
300
-    }
301
-
302
-
303
-    /**
304
-     * _init_page_props
305
-     * Child classes use to set at least the following properties:
306
-     * $page_slug.
307
-     * $page_label.
308
-     *
309
-     * @abstract
310
-     * @return void
311
-     */
312
-    abstract protected function _init_page_props();
313
-
314
-
315
-    /**
316
-     * _ajax_hooks
317
-     * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
318
-     * Note: within the ajax callback methods.
319
-     *
320
-     * @abstract
321
-     * @return void
322
-     */
323
-    abstract protected function _ajax_hooks();
324
-
325
-
326
-    /**
327
-     * _define_page_props
328
-     * child classes define page properties in here.  Must include at least:
329
-     * $_admin_base_url = base_url for all admin pages
330
-     * $_admin_page_title = default admin_page_title for admin pages
331
-     * $_labels = array of default labels for various automatically generated elements:
332
-     *    array(
333
-     *        'buttons' => array(
334
-     *            'add' => esc_html__('label for add new button'),
335
-     *            'edit' => esc_html__('label for edit button'),
336
-     *            'delete' => esc_html__('label for delete button')
337
-     *            )
338
-     *        )
339
-     *
340
-     * @abstract
341
-     * @return void
342
-     */
343
-    abstract protected function _define_page_props();
344
-
345
-
346
-    /**
347
-     * _set_page_routes
348
-     * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
349
-     * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
350
-     * have a 'default' route. Here's the format
351
-     * $this->_page_routes = array(
352
-     *        'default' => array(
353
-     *            'func' => '_default_method_handling_route',
354
-     *            'args' => array('array','of','args'),
355
-     *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
356
-     *            ajax request, backend processing)
357
-     *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
358
-     *            headers route after.  The string you enter here should match the defined route reference for a
359
-     *            headers sent route.
360
-     *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
361
-     *            this route.
362
-     *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
363
-     *            checks).
364
-     *        ),
365
-     *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
366
-     *        handling method.
367
-     *        )
368
-     * )
369
-     *
370
-     * @abstract
371
-     * @return void
372
-     */
373
-    abstract protected function _set_page_routes();
374
-
375
-
376
-    /**
377
-     * _set_page_config
378
-     * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
379
-     * array corresponds to the page_route for the loaded page. Format:
380
-     * $this->_page_config = array(
381
-     *        'default' => array(
382
-     *            'labels' => array(
383
-     *                'buttons' => array(
384
-     *                    'add' => esc_html__('label for adding item'),
385
-     *                    'edit' => esc_html__('label for editing item'),
386
-     *                    'delete' => esc_html__('label for deleting item')
387
-     *                ),
388
-     *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
389
-     *            ), //optional an array of custom labels for various automatically generated elements to use on the
390
-     *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
391
-     *            _define_page_props() method
392
-     *            'nav' => array(
393
-     *                'label' => esc_html__('Label for Tab', 'event_espresso').
394
-     *                'url' => 'http://someurl', //automatically generated UNLESS you define
395
-     *                'css_class' => 'css-class', //automatically generated UNLESS you define
396
-     *                'order' => 10, //required to indicate tab position.
397
-     *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
398
-     *                displayed then add this parameter.
399
-     *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
400
-     *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
401
-     *            metaboxes set for eventespresso admin pages.
402
-     *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
403
-     *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
404
-     *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
405
-     *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
406
-     *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
407
-     *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
408
-     *            array indicates the max number of columns (4) and the default number of columns on page load (2).
409
-     *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
410
-     *            want to display.
411
-     *            'help_tabs' => array( //this is used for adding help tabs to a page
412
-     *                'tab_id' => array(
413
-     *                    'title' => 'tab_title',
414
-     *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
415
-     *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
416
-     *                    should match a file in the admin folder's "help_tabs" dir (ie..
417
-     *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
418
-     *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
419
-     *                    attempt to use the callback which should match the name of a method in the class
420
-     *                    ),
421
-     *                'tab2_id' => array(
422
-     *                    'title' => 'tab2 title',
423
-     *                    'filename' => 'file_name_2'
424
-     *                    'callback' => 'callback_method_for_content',
425
-     *                 ),
426
-     *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
427
-     *            help tab area on an admin page. @return void
428
-     *
429
-     * @link
430
-     *                http://make.wordpress.org/core/2011/12/06/help-and-screen-api-changes-in-3-3/
431
-     *                'help_tour' => array(
432
-     *                'name_of_help_tour_class', //all help tours should be a child class of EE_Help_Tour and located
433
-     *                in a folder for this admin page named "help_tours", a file name matching the key given here
434
-     *                (name_of_help_tour_class.class.php), and class matching key given here (name_of_help_tour_class)
435
-     *                ),
436
-     *                'require_nonce' => TRUE //this is used if you want to set a route to NOT require a nonce (default
437
-     *                is true if it isn't present).  To remove the requirement for a nonce check when this route is
438
-     *                visited just set
439
-     *                'require_nonce' to FALSE
440
-     *                )
441
-     *                )
442
-     *
443
-     * @abstract
444
-     */
445
-    abstract protected function _set_page_config();
446
-
447
-
448
-
449
-
450
-
451
-    /** end sample help_tour methods **/
452
-    /**
453
-     * _add_screen_options
454
-     * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
455
-     * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
456
-     * to a particular view.
457
-     *
458
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
459
-     *         see also WP_Screen object documents...
460
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
461
-     * @abstract
462
-     * @return void
463
-     */
464
-    abstract protected function _add_screen_options();
465
-
466
-
467
-    /**
468
-     * _add_feature_pointers
469
-     * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
470
-     * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
471
-     * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
472
-     * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
473
-     * extended) also see:
474
-     *
475
-     * @link   http://eamann.com/tech/wordpress-portland/
476
-     * @abstract
477
-     * @return void
478
-     */
479
-    abstract protected function _add_feature_pointers();
480
-
481
-
482
-    /**
483
-     * load_scripts_styles
484
-     * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
485
-     * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
486
-     * scripts/styles per view by putting them in a dynamic function in this format
487
-     * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
488
-     *
489
-     * @abstract
490
-     * @return void
491
-     */
492
-    abstract public function load_scripts_styles();
493
-
494
-
495
-    /**
496
-     * admin_init
497
-     * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
498
-     * all pages/views loaded by child class.
499
-     *
500
-     * @abstract
501
-     * @return void
502
-     */
503
-    abstract public function admin_init();
504
-
505
-
506
-    /**
507
-     * admin_notices
508
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
509
-     * all pages/views loaded by child class.
510
-     *
511
-     * @abstract
512
-     * @return void
513
-     */
514
-    abstract public function admin_notices();
515
-
516
-
517
-    /**
518
-     * admin_footer_scripts
519
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
520
-     * will apply to all pages/views loaded by child class.
521
-     *
522
-     * @return void
523
-     */
524
-    abstract public function admin_footer_scripts();
525
-
526
-
527
-    /**
528
-     * admin_footer
529
-     * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
530
-     * apply to all pages/views loaded by child class.
531
-     *
532
-     * @return void
533
-     */
534
-    public function admin_footer()
535
-    {
536
-    }
537
-
538
-
539
-    /**
540
-     * _global_ajax_hooks
541
-     * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
542
-     * Note: within the ajax callback methods.
543
-     *
544
-     * @abstract
545
-     * @return void
546
-     */
547
-    protected function _global_ajax_hooks()
548
-    {
549
-        // for lazy loading of metabox content
550
-        add_action('wp_ajax_espresso-ajax-content', [$this, 'ajax_metabox_content'], 10);
551
-
552
-        add_action(
553
-            'wp_ajax_espresso_hide_status_change_notice',
554
-            [$this, 'hideStatusChangeNotice']
555
-        );
556
-        add_action(
557
-            'wp_ajax_nopriv_espresso_hide_status_change_notice',
558
-            [$this, 'hideStatusChangeNotice']
559
-        );
560
-    }
561
-
562
-
563
-    public function ajax_metabox_content()
564
-    {
565
-        $content_id  = $this->request->getRequestParam('contentid', '');
566
-        $content_url = $this->request->getRequestParam('contenturl', '', 'url');
567
-        EE_Admin_Page::cached_rss_display($content_id, $content_url);
568
-        wp_die();
569
-    }
570
-
571
-
572
-    public function hideStatusChangeNotice()
573
-    {
574
-        $response = [];
575
-        try {
576
-            /** @var EventEspresso\core\admin\StatusChangeNotice $status_change_notice */
577
-            $status_change_notice = $this->loader->getShared('EventEspresso\core\admin\StatusChangeNotice');
578
-            $response['success'] = $status_change_notice->dismiss() > -1;
579
-        } catch (Exception $exception) {
580
-            $response['errors'] = $exception->getMessage();
581
-        }
582
-        echo wp_json_encode($response);
583
-        exit();
584
-    }
585
-
586
-
587
-    /**
588
-     * allows extending classes do something specific before the parent constructor runs _page_setup().
589
-     *
590
-     * @return void
591
-     */
592
-    protected function _before_page_setup()
593
-    {
594
-        // default is to do nothing
595
-    }
596
-
597
-
598
-    /**
599
-     * Makes sure any things that need to be loaded early get handled.
600
-     * We also escape early here if the page requested doesn't match the object.
601
-     *
602
-     * @final
603
-     * @return void
604
-     * @throws EE_Error
605
-     * @throws InvalidArgumentException
606
-     * @throws ReflectionException
607
-     * @throws InvalidDataTypeException
608
-     * @throws InvalidInterfaceException
609
-     */
610
-    final protected function _page_setup()
611
-    {
612
-        // requires?
613
-        // admin_init stuff - global - we're setting this REALLY early
614
-        // so if EE_Admin pages have to hook into other WP pages they can.
615
-        // But keep in mind, not everything is available from the EE_Admin Page object at this point.
616
-        add_action('admin_init', [$this, 'admin_init_global'], 5);
617
-        // next verify if we need to load anything...
618
-        $this->_current_page = $this->request->getRequestParam('page', '', 'key');
619
-        $this->page_folder   = strtolower(
620
-            str_replace(['_Admin_Page', 'Extend_'], '', get_class($this))
621
-        );
622
-        global $ee_menu_slugs;
623
-        $ee_menu_slugs = (array) $ee_menu_slugs;
624
-        if (
625
-            ! $this->request->isAjax()
626
-            && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))
627
-        ) {
628
-            return;
629
-        }
630
-        // because WP List tables have two duplicate select inputs for choosing bulk actions,
631
-        // we need to copy the action from the second to the first
632
-        $action     = $this->request->getRequestParam('action', '-1', 'key');
633
-        $action2    = $this->request->getRequestParam('action2', '-1', 'key');
634
-        $action     = $action !== '-1' ? $action : $action2;
635
-        $req_action = $action !== '-1' ? $action : 'default';
636
-
637
-        // if a specific 'route' has been set, and the action is 'default' OR we are doing_ajax
638
-        // then let's use the route as the action.
639
-        // This covers cases where we're coming in from a list table that isn't on the default route.
640
-        $route = $this->request->getRequestParam('route');
641
-        $this->_req_action = $route && ($req_action === 'default' || $this->request->isAjax())
642
-            ? $route
643
-            : $req_action;
644
-
645
-        $this->_current_view = $this->_req_action;
646
-        $this->_req_nonce    = $this->_req_action . '_nonce';
647
-        $this->_define_page_props();
648
-        $this->_current_page_view_url = add_query_arg(
649
-            ['page' => $this->_current_page, 'action' => $this->_current_view],
650
-            $this->_admin_base_url
651
-        );
652
-        // default things
653
-        $this->_default_espresso_metaboxes = [
654
-            '_espresso_news_post_box',
655
-            '_espresso_links_post_box',
656
-            '_espresso_ratings_request',
657
-            '_espresso_sponsors_post_box',
658
-        ];
659
-        // set page configs
660
-        $this->_set_page_routes();
661
-        $this->_set_page_config();
662
-        // let's include any referrer data in our default_query_args for this route for "stickiness".
663
-        if ($this->request->requestParamIsSet('wp_referer')) {
664
-            $wp_referer = $this->request->getRequestParam('wp_referer');
665
-            if ($wp_referer) {
666
-                $this->_default_route_query_args['wp_referer'] = $wp_referer;
667
-            }
668
-        }
669
-        // for caffeinated and other extended functionality.
670
-        //  If there is a _extend_page_config method
671
-        // then let's run that to modify the all the various page configuration arrays
672
-        if (method_exists($this, '_extend_page_config')) {
673
-            $this->_extend_page_config();
674
-        }
675
-        // for CPT and other extended functionality.
676
-        // If there is an _extend_page_config_for_cpt
677
-        // then let's run that to modify all the various page configuration arrays.
678
-        if (method_exists($this, '_extend_page_config_for_cpt')) {
679
-            $this->_extend_page_config_for_cpt();
680
-        }
681
-        // filter routes and page_config so addons can add their stuff. Filtering done per class
682
-        $this->_page_routes = apply_filters(
683
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
684
-            $this->_page_routes,
685
-            $this
686
-        );
687
-        $this->_page_config = apply_filters(
688
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
689
-            $this->_page_config,
690
-            $this
691
-        );
692
-        // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
693
-        // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
694
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
695
-            add_action(
696
-                'AHEE__EE_Admin_Page__route_admin_request',
697
-                [$this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view],
698
-                10,
699
-                2
700
-            );
701
-        }
702
-        // next route only if routing enabled
703
-        if ($this->_routing && ! $this->request->isAjax()) {
704
-            $this->_verify_routes();
705
-            // next let's just check user_access and kill if no access
706
-            $this->check_user_access();
707
-            if ($this->_is_UI_request) {
708
-                // admin_init stuff - global, all views for this page class, specific view
709
-                add_action('admin_init', [$this, 'admin_init'], 10);
710
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
711
-                    add_action('admin_init', [$this, 'admin_init_' . $this->_current_view], 15);
712
-                }
713
-            } else {
714
-                // hijack regular WP loading and route admin request immediately
715
-                @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
716
-                $this->route_admin_request();
717
-            }
718
-        }
719
-    }
720
-
721
-
722
-    /**
723
-     * Provides a way for related child admin pages to load stuff on the loaded admin page.
724
-     *
725
-     * @return void
726
-     * @throws EE_Error
727
-     */
728
-    private function _do_other_page_hooks()
729
-    {
730
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, []);
731
-        foreach ($registered_pages as $page) {
732
-            // now let's setup the file name and class that should be present
733
-            $classname = str_replace('.class.php', '', $page);
734
-            // autoloaders should take care of loading file
735
-            if (! class_exists($classname)) {
736
-                $error_msg[] = sprintf(
737
-                    esc_html__(
738
-                        'Something went wrong with loading the %s admin hooks page.',
739
-                        'event_espresso'
740
-                    ),
741
-                    $page
742
-                );
743
-                $error_msg[] = $error_msg[0]
744
-                               . "\r\n"
745
-                               . sprintf(
746
-                                   esc_html__(
747
-                                       'There is no class in place for the %1$s admin hooks page.%2$sMake sure you have %3$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
748
-                                       'event_espresso'
749
-                                   ),
750
-                                   $page,
751
-                                   '<br />',
752
-                                   '<strong>' . $classname . '</strong>'
753
-                               );
754
-                throw new EE_Error(implode('||', $error_msg));
755
-            }
756
-            // notice we are passing the instance of this class to the hook object.
757
-            $this->loader->getShared($classname, [$this]);
758
-        }
759
-    }
760
-
761
-
762
-    /**
763
-     * @throws ReflectionException
764
-     * @throws EE_Error
765
-     */
766
-    public function load_page_dependencies()
767
-    {
768
-        try {
769
-            $this->_load_page_dependencies();
770
-        } catch (EE_Error $e) {
771
-            $e->get_error();
772
-        }
773
-    }
774
-
775
-
776
-    /**
777
-     * load_page_dependencies
778
-     * loads things specific to this page class when its loaded.  Really helps with efficiency.
779
-     *
780
-     * @return void
781
-     * @throws DomainException
782
-     * @throws EE_Error
783
-     * @throws InvalidArgumentException
784
-     * @throws InvalidDataTypeException
785
-     * @throws InvalidInterfaceException
786
-     */
787
-    protected function _load_page_dependencies()
788
-    {
789
-        // let's set the current_screen and screen options to override what WP set
790
-        $this->_current_screen = get_current_screen();
791
-        // load admin_notices - global, page class, and view specific
792
-        add_action('admin_notices', [$this, 'admin_notices_global'], 5);
793
-        add_action('admin_notices', [$this, 'admin_notices'], 10);
794
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
795
-            add_action('admin_notices', [$this, 'admin_notices_' . $this->_current_view], 15);
796
-        }
797
-        // load network admin_notices - global, page class, and view specific
798
-        add_action('network_admin_notices', [$this, 'network_admin_notices_global'], 5);
799
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
800
-            add_action('network_admin_notices', [$this, 'network_admin_notices_' . $this->_current_view]);
801
-        }
802
-        // this will save any per_page screen options if they are present
803
-        $this->_set_per_page_screen_options();
804
-        // setup list table properties
805
-        $this->_set_list_table();
806
-        // child classes can "register" a metabox to be automatically handled via the _page_config array property.
807
-        // However in some cases the metaboxes will need to be added within a route handling callback.
808
-        $this->_add_registered_meta_boxes();
809
-        $this->_add_screen_columns();
810
-        // add screen options - global, page child class, and view specific
811
-        $this->_add_global_screen_options();
812
-        $this->_add_screen_options();
813
-        $add_screen_options = "_add_screen_options_{$this->_current_view}";
814
-        if (method_exists($this, $add_screen_options)) {
815
-            $this->{$add_screen_options}();
816
-        }
817
-        // add help tab(s) and tours- set via page_config and qtips.
818
-        // $this->_add_help_tour();
819
-        $this->_add_help_tabs();
820
-        $this->_add_qtips();
821
-        // add feature_pointers - global, page child class, and view specific
822
-        $this->_add_feature_pointers();
823
-        $this->_add_global_feature_pointers();
824
-        $add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
825
-        if (method_exists($this, $add_feature_pointer)) {
826
-            $this->{$add_feature_pointer}();
827
-        }
828
-        // enqueue scripts/styles - global, page class, and view specific
829
-        add_action('admin_enqueue_scripts', [$this, 'load_global_scripts_styles'], 5);
830
-        add_action('admin_enqueue_scripts', [$this, 'load_scripts_styles'], 10);
831
-        if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
832
-            add_action('admin_enqueue_scripts', [$this, "load_scripts_styles_{$this->_current_view}"], 15);
833
-        }
834
-        add_action('admin_enqueue_scripts', [$this, 'admin_footer_scripts_eei18n_js_strings'], 100);
835
-        // admin_print_footer_scripts - global, page child class, and view specific.
836
-        // NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
837
-        // In most cases that's doing_it_wrong().  But adding hidden container elements etc.
838
-        // is a good use case. Notice the late priority we're giving these
839
-        add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts_global'], 99);
840
-        add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts'], 100);
841
-        if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
842
-            add_action('admin_print_footer_scripts', [$this, "admin_footer_scripts_{$this->_current_view}"], 101);
843
-        }
844
-        // admin footer scripts
845
-        add_action('admin_footer', [$this, 'admin_footer_global'], 99);
846
-        add_action('admin_footer', [$this, 'admin_footer'], 100);
847
-        if (method_exists($this, "admin_footer_{$this->_current_view}")) {
848
-            add_action('admin_footer', [$this, "admin_footer_{$this->_current_view}"], 101);
849
-        }
850
-        do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
851
-        // targeted hook
852
-        do_action(
853
-            "FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
854
-        );
855
-    }
856
-
857
-
858
-    /**
859
-     * _set_defaults
860
-     * This sets some global defaults for class properties.
861
-     */
862
-    private function _set_defaults()
863
-    {
864
-        $this->_current_screen       = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
865
-        $this->_event                = $this->_template_path = $this->_column_template_path = null;
866
-        $this->_nav_tabs             = $this->_views = $this->_page_routes = [];
867
-        $this->_page_config          = $this->_default_route_query_args = [];
868
-        $this->_default_nav_tab_name = 'overview';
869
-        // init template args
870
-        $this->_template_args = [
871
-            'admin_page_header'  => '',
872
-            'admin_page_content' => '',
873
-            'post_body_content'  => '',
874
-            'before_list_table'  => '',
875
-            'after_list_table'   => '',
876
-        ];
877
-    }
878
-
879
-
880
-    /**
881
-     * route_admin_request
882
-     *
883
-     * @return void
884
-     * @throws InvalidArgumentException
885
-     * @throws InvalidInterfaceException
886
-     * @throws InvalidDataTypeException
887
-     * @throws EE_Error
888
-     * @throws ReflectionException
889
-     * @see    _route_admin_request()
890
-     */
891
-    public function route_admin_request()
892
-    {
893
-        try {
894
-            $this->_route_admin_request();
895
-        } catch (EE_Error $e) {
896
-            $e->get_error();
897
-        }
898
-    }
899
-
900
-
901
-    public function set_wp_page_slug($wp_page_slug)
902
-    {
903
-        $this->_wp_page_slug = $wp_page_slug;
904
-        // if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
905
-        if (is_network_admin()) {
906
-            $this->_wp_page_slug .= '-network';
907
-        }
908
-    }
909
-
910
-
911
-    /**
912
-     * _verify_routes
913
-     * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
914
-     * we know if we need to drop out.
915
-     *
916
-     * @return bool
917
-     * @throws EE_Error
918
-     */
919
-    protected function _verify_routes()
920
-    {
921
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
922
-        if (! $this->_current_page && ! $this->request->isAjax()) {
923
-            return false;
924
-        }
925
-        $this->_route = false;
926
-        // check that the page_routes array is not empty
927
-        if (empty($this->_page_routes)) {
928
-            // user error msg
929
-            $error_msg = sprintf(
930
-                esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
931
-                $this->_admin_page_title
932
-            );
933
-            // developer error msg
934
-            $error_msg .= '||' . $error_msg
935
-                          . esc_html__(
936
-                              ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
937
-                              'event_espresso'
938
-                          );
939
-            throw new EE_Error($error_msg);
940
-        }
941
-        // and that the requested page route exists
942
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
943
-            $this->_route        = $this->_page_routes[ $this->_req_action ];
944
-            $this->_route_config = $this->_page_config[ $this->_req_action ] ?? [];
945
-        } else {
946
-            // user error msg
947
-            $error_msg = sprintf(
948
-                esc_html__(
949
-                    'The requested page route does not exist for the %s admin page.',
950
-                    'event_espresso'
951
-                ),
952
-                $this->_admin_page_title
953
-            );
954
-            // developer error msg
955
-            $error_msg .= '||' . $error_msg
956
-                          . sprintf(
957
-                              esc_html__(
958
-                                  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
959
-                                  'event_espresso'
960
-                              ),
961
-                              $this->_req_action
962
-                          );
963
-            throw new EE_Error($error_msg);
964
-        }
965
-        // and that a default route exists
966
-        if (! array_key_exists('default', $this->_page_routes)) {
967
-            // user error msg
968
-            $error_msg = sprintf(
969
-                esc_html__(
970
-                    'A default page route has not been set for the % admin page.',
971
-                    'event_espresso'
972
-                ),
973
-                $this->_admin_page_title
974
-            );
975
-            // developer error msg
976
-            $error_msg .= '||' . $error_msg
977
-                          . esc_html__(
978
-                              ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
979
-                              'event_espresso'
980
-                          );
981
-            throw new EE_Error($error_msg);
982
-        }
983
-
984
-        // first lets' catch if the UI request has EVER been set.
985
-        if ($this->_is_UI_request === null) {
986
-            // lets set if this is a UI request or not.
987
-            $this->_is_UI_request = ! $this->request->getRequestParam('noheader', false, 'bool');
988
-            // wait a minute... we might have a noheader in the route array
989
-            $this->_is_UI_request = ! (
990
-                is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader']
991
-            )
992
-                ? $this->_is_UI_request
993
-                : false;
994
-        }
995
-        $this->_set_current_labels();
996
-        return true;
997
-    }
998
-
999
-
1000
-    /**
1001
-     * this method simply verifies a given route and makes sure its an actual route available for the loaded page
1002
-     *
1003
-     * @param string $route the route name we're verifying
1004
-     * @return bool we'll throw an exception if this isn't a valid route.
1005
-     * @throws EE_Error
1006
-     */
1007
-    protected function _verify_route($route)
1008
-    {
1009
-        if (array_key_exists($this->_req_action, $this->_page_routes)) {
1010
-            return true;
1011
-        }
1012
-        // user error msg
1013
-        $error_msg = sprintf(
1014
-            esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
1015
-            $this->_admin_page_title
1016
-        );
1017
-        // developer error msg
1018
-        $error_msg .= '||' . $error_msg
1019
-                      . sprintf(
1020
-                          esc_html__(
1021
-                              ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
1022
-                              'event_espresso'
1023
-                          ),
1024
-                          $route
1025
-                      );
1026
-        throw new EE_Error($error_msg);
1027
-    }
1028
-
1029
-
1030
-    /**
1031
-     * perform nonce verification
1032
-     * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
1033
-     * using this method (and save retyping!)
1034
-     *
1035
-     * @param string $nonce     The nonce sent
1036
-     * @param string $nonce_ref The nonce reference string (name0)
1037
-     * @return void
1038
-     * @throws EE_Error
1039
-     * @throws InvalidArgumentException
1040
-     * @throws InvalidDataTypeException
1041
-     * @throws InvalidInterfaceException
1042
-     */
1043
-    protected function _verify_nonce($nonce, $nonce_ref)
1044
-    {
1045
-        // verify nonce against expected value
1046
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
1047
-            // these are not the droids you are looking for !!!
1048
-            $msg = sprintf(
1049
-                esc_html__('%sNonce Fail.%s', 'event_espresso'),
1050
-                '<a href="https://www.youtube.com/watch?v=56_S0WeTkzs">',
1051
-                '</a>'
1052
-            );
1053
-            if (WP_DEBUG) {
1054
-                $msg .= "\n  ";
1055
-                $msg .= sprintf(
1056
-                    esc_html__(
1057
-                        'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
1058
-                        'event_espresso'
1059
-                    ),
1060
-                    __CLASS__
1061
-                );
1062
-            }
1063
-            if (! $this->request->isAjax()) {
1064
-                wp_die($msg);
1065
-            }
1066
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1067
-            $this->_return_json();
1068
-        }
1069
-    }
1070
-
1071
-
1072
-    /**
1073
-     * _route_admin_request()
1074
-     * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if there are
1075
-     * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
1076
-     * in the page routes and then will try to load the corresponding method.
1077
-     *
1078
-     * @return void
1079
-     * @throws EE_Error
1080
-     * @throws InvalidArgumentException
1081
-     * @throws InvalidDataTypeException
1082
-     * @throws InvalidInterfaceException
1083
-     * @throws ReflectionException
1084
-     */
1085
-    protected function _route_admin_request()
1086
-    {
1087
-        if (! $this->_is_UI_request) {
1088
-            $this->_verify_routes();
1089
-        }
1090
-        $nonce_check = ! isset($this->_route_config['require_nonce']) || $this->_route_config['require_nonce'];
1091
-        if ($this->_req_action !== 'default' && $nonce_check) {
1092
-            // set nonce from post data
1093
-            $nonce = $this->request->getRequestParam($this->_req_nonce, '');
1094
-            $this->_verify_nonce($nonce, $this->_req_nonce);
1095
-        }
1096
-        // set the nav_tabs array but ONLY if this is  UI_request
1097
-        if ($this->_is_UI_request) {
1098
-            $this->_set_nav_tabs();
1099
-        }
1100
-        // grab callback function
1101
-        $func = is_array($this->_route) && isset($this->_route['func']) ? $this->_route['func'] : $this->_route;
1102
-        // check if callback has args
1103
-        $args      = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : [];
1104
-        $error_msg = '';
1105
-        // action right before calling route
1106
-        // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
1107
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1108
-            do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
1109
-        }
1110
-        // right before calling the route, let's clean the _wp_http_referer
1111
-        $this->request->setServerParam(
1112
-            'REQUEST_URI',
1113
-            remove_query_arg(
1114
-                '_wp_http_referer',
1115
-                wp_unslash($this->request->getServerParam('REQUEST_URI'))
1116
-            )
1117
-        );
1118
-        if (! empty($func)) {
1119
-            if (is_array($func)) {
1120
-                [$class, $method] = $func;
1121
-            } elseif (strpos($func, '::') !== false) {
1122
-                [$class, $method] = explode('::', $func);
1123
-            } else {
1124
-                $class  = $this;
1125
-                $method = $func;
1126
-            }
1127
-            if (! (is_object($class) && $class === $this)) {
1128
-                // send along this admin page object for access by addons.
1129
-                $args['admin_page_object'] = $this;
1130
-            }
1131
-            if (
1132
-                // is it a method on a class that doesn't work?
1133
-                (
1134
-                    (
1135
-                        method_exists($class, $method)
1136
-                        && call_user_func_array([$class, $method], $args) === false
1137
-                    )
1138
-                    && (
1139
-                        // is it a standalone function that doesn't work?
1140
-                        function_exists($method)
1141
-                        && call_user_func_array(
1142
-                            $func,
1143
-                            array_merge(['admin_page_object' => $this], $args)
1144
-                        ) === false
1145
-                    )
1146
-                )
1147
-                || (
1148
-                    // is it neither a class method NOR a standalone function?
1149
-                    ! method_exists($class, $method)
1150
-                    && ! function_exists($method)
1151
-                )
1152
-            ) {
1153
-                // user error msg
1154
-                $error_msg = esc_html__(
1155
-                    'An error occurred. The  requested page route could not be found.',
1156
-                    'event_espresso'
1157
-                );
1158
-                // developer error msg
1159
-                $error_msg .= '||';
1160
-                $error_msg .= sprintf(
1161
-                    esc_html__(
1162
-                        'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1163
-                        'event_espresso'
1164
-                    ),
1165
-                    $method
1166
-                );
1167
-            }
1168
-            if (! empty($error_msg)) {
1169
-                throw new EE_Error($error_msg);
1170
-            }
1171
-        }
1172
-        // if we've routed and this route has a no headers route AND a sent_headers_route,
1173
-        // then we need to reset the routing properties to the new route.
1174
-        // now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
1175
-        if (
1176
-            $this->_is_UI_request === false
1177
-            && is_array($this->_route)
1178
-            && ! empty($this->_route['headers_sent_route'])
1179
-        ) {
1180
-            $this->_reset_routing_properties($this->_route['headers_sent_route']);
1181
-        }
1182
-    }
1183
-
1184
-
1185
-    /**
1186
-     * This method just allows the resetting of page properties in the case where a no headers
1187
-     * route redirects to a headers route in its route config.
1188
-     *
1189
-     * @param string $new_route New (non header) route to redirect to.
1190
-     * @return   void
1191
-     * @throws ReflectionException
1192
-     * @throws InvalidArgumentException
1193
-     * @throws InvalidInterfaceException
1194
-     * @throws InvalidDataTypeException
1195
-     * @throws EE_Error
1196
-     * @since   4.3.0
1197
-     */
1198
-    protected function _reset_routing_properties($new_route)
1199
-    {
1200
-        $this->_is_UI_request = true;
1201
-        // now we set the current route to whatever the headers_sent_route is set at
1202
-        $this->request->setRequestParam('action', $new_route);
1203
-        // rerun page setup
1204
-        $this->_page_setup();
1205
-    }
1206
-
1207
-
1208
-    /**
1209
-     * _add_query_arg
1210
-     * adds nonce to array of arguments then calls WP add_query_arg function
1211
-     *(internally just uses EEH_URL's function with the same name)
1212
-     *
1213
-     * @param array  $args
1214
-     * @param string $url
1215
-     * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1216
-     *                                        generated url in an associative array indexed by the key 'wp_referer';
1217
-     *                                        Example usage: If the current page is:
1218
-     *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1219
-     *                                        &action=default&event_id=20&month_range=March%202015
1220
-     *                                        &_wpnonce=5467821
1221
-     *                                        and you call:
1222
-     *                                        EE_Admin_Page::add_query_args_and_nonce(
1223
-     *                                        array(
1224
-     *                                        'action' => 'resend_something',
1225
-     *                                        'page=>espresso_registrations'
1226
-     *                                        ),
1227
-     *                                        $some_url,
1228
-     *                                        true
1229
-     *                                        );
1230
-     *                                        It will produce a url in this structure:
1231
-     *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1232
-     *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1233
-     *                                        month_range]=March%202015
1234
-     * @param bool   $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1235
-     * @return string
1236
-     */
1237
-    public static function add_query_args_and_nonce(
1238
-        $args = [],
1239
-        $url = '',
1240
-        $sticky = false,
1241
-        $exclude_nonce = false
1242
-    ) {
1243
-        // if there is a _wp_http_referer include the values from the request but only if sticky = true
1244
-        if ($sticky) {
1245
-            /** @var RequestInterface $request */
1246
-            $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
1247
-            $request->unSetRequestParams(['_wp_http_referer', 'wp_referer']);
1248
-            foreach ($request->requestParams() as $key => $value) {
1249
-                // do not add nonces
1250
-                if (strpos($key, 'nonce') !== false) {
1251
-                    continue;
1252
-                }
1253
-                $args[ 'wp_referer[' . $key . ']' ] = is_string($value) ? htmlspecialchars($value) : $value;
1254
-            }
1255
-        }
1256
-        return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1257
-    }
1258
-
1259
-
1260
-    /**
1261
-     * This returns a generated link that will load the related help tab.
1262
-     *
1263
-     * @param string $help_tab_id the id for the connected help tab
1264
-     * @param string $icon_style  (optional) include css class for the style you want to use for the help icon.
1265
-     * @param string $help_text   (optional) send help text you want to use for the link if default not to be used
1266
-     * @return string              generated link
1267
-     * @uses EEH_Template::get_help_tab_link()
1268
-     */
1269
-    protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1270
-    {
1271
-        return EEH_Template::get_help_tab_link(
1272
-            $help_tab_id,
1273
-            $this->page_slug,
1274
-            $this->_req_action,
1275
-            $icon_style,
1276
-            $help_text
1277
-        );
1278
-    }
1279
-
1280
-
1281
-    /**
1282
-     * _add_help_tabs
1283
-     * Note child classes define their help tabs within the page_config array.
1284
-     *
1285
-     * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1286
-     * @return void
1287
-     * @throws DomainException
1288
-     * @throws EE_Error
1289
-     * @throws ReflectionException
1290
-     */
1291
-    protected function _add_help_tabs()
1292
-    {
1293
-        $tour_buttons = '';
1294
-        if (isset($this->_page_config[ $this->_req_action ])) {
1295
-            $config = $this->_page_config[ $this->_req_action ];
1296
-            // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
1297
-            // is there a help tour for the current route?  if there is let's setup the tour buttons
1298
-            // if (isset($this->_help_tour[ $this->_req_action ])) {
1299
-            //     $tb = array();
1300
-            //     $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1301
-            //     foreach ($this->_help_tour['tours'] as $tour) {
1302
-            //         // if this is the end tour then we don't need to setup a button
1303
-            //         if ($tour instanceof EE_Help_Tour_final_stop || ! $tour instanceof EE_Help_Tour) {
1304
-            //             continue;
1305
-            //         }
1306
-            //         $tb[] = '<button id="trigger-tour-'
1307
-            //                 . $tour->get_slug()
1308
-            //                 . '" class="button--primary trigger-ee-help-tour">'
1309
-            //                 . $tour->get_label()
1310
-            //                 . '</button>';
1311
-            //     }
1312
-            //     $tour_buttons .= implode('<br />', $tb);
1313
-            //     $tour_buttons .= '</div></div>';
1314
-            // }
1315
-            // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1316
-            if (is_array($config) && isset($config['help_sidebar'])) {
1317
-                // check that the callback given is valid
1318
-                if (! method_exists($this, $config['help_sidebar'])) {
1319
-                    throw new EE_Error(
1320
-                        sprintf(
1321
-                            esc_html__(
1322
-                                'The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s',
1323
-                                'event_espresso'
1324
-                            ),
1325
-                            $config['help_sidebar'],
1326
-                            get_class($this)
1327
-                        )
1328
-                    );
1329
-                }
1330
-                $content = apply_filters(
1331
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1332
-                    $this->{$config['help_sidebar']}()
1333
-                );
1334
-                $content .= $tour_buttons; // add help tour buttons.
1335
-                // do we have any help tours setup?  Cause if we do we want to add the buttons
1336
-                $this->_current_screen->set_help_sidebar($content);
1337
-            }
1338
-            // if there ARE tour buttons...
1339
-            if (! empty($tour_buttons)) {
1340
-                // if we DON'T have config help sidebar then we'll just add the tour buttons to the sidebar.
1341
-                if (! isset($config['help_sidebar'])) {
1342
-                    $this->_current_screen->set_help_sidebar($tour_buttons);
1343
-                }
1344
-                // handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1345
-                if (! isset($config['help_tabs'])) {
1346
-                    $_ht['id'] = $this->page_slug;
1347
-                    $_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1348
-                    $_ht['content'] = '<p>'
1349
-                                      . esc_html__(
1350
-                                          'The buttons to the right allow you to start/restart any help tours available for this page',
1351
-                                          'event_espresso'
1352
-                                      ) . '</p>';
1353
-                    $this->_current_screen->add_help_tab($_ht);
1354
-                }
1355
-            }
1356
-            if (! isset($config['help_tabs'])) {
1357
-                return;
1358
-            } //no help tabs for this route
1359
-            foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1360
-                // we're here so there ARE help tabs!
1361
-                // make sure we've got what we need
1362
-                if (! isset($cfg['title'])) {
1363
-                    throw new EE_Error(
1364
-                        esc_html__(
1365
-                            'The _page_config array is not set up properly for help tabs.  It is missing a title',
1366
-                            'event_espresso'
1367
-                        )
1368
-                    );
1369
-                }
1370
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1371
-                    throw new EE_Error(
1372
-                        esc_html__(
1373
-                            'The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab',
1374
-                            'event_espresso'
1375
-                        )
1376
-                    );
1377
-                }
1378
-                // first priority goes to content.
1379
-                if (! empty($cfg['content'])) {
1380
-                    $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1381
-                    // second priority goes to filename
1382
-                } elseif (! empty($cfg['filename'])) {
1383
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1384
-                    // it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1385
-                    $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1386
-                                                             . basename($this->_get_dir())
1387
-                                                             . '/help_tabs/'
1388
-                                                             . $cfg['filename']
1389
-                                                             . '.help_tab.php' : $file_path;
1390
-                    // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1391
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1392
-                        EE_Error::add_error(
1393
-                            sprintf(
1394
-                                esc_html__(
1395
-                                    'The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s',
1396
-                                    'event_espresso'
1397
-                                ),
1398
-                                $tab_id,
1399
-                                key($config),
1400
-                                $file_path
1401
-                            ),
1402
-                            __FILE__,
1403
-                            __FUNCTION__,
1404
-                            __LINE__
1405
-                        );
1406
-                        return;
1407
-                    }
1408
-                    $template_args['admin_page_obj'] = $this;
1409
-                    $content                         = EEH_Template::display_template(
1410
-                        $file_path,
1411
-                        $template_args,
1412
-                        true
1413
-                    );
1414
-                } else {
1415
-                    $content = '';
1416
-                }
1417
-                // check if callback is valid
1418
-                if (
1419
-                    empty($content)
1420
-                    && (
1421
-                        ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1422
-                    )
1423
-                ) {
1424
-                    EE_Error::add_error(
1425
-                        sprintf(
1426
-                            esc_html__(
1427
-                                'The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.',
1428
-                                'event_espresso'
1429
-                            ),
1430
-                            $cfg['title']
1431
-                        ),
1432
-                        __FILE__,
1433
-                        __FUNCTION__,
1434
-                        __LINE__
1435
-                    );
1436
-                    return;
1437
-                }
1438
-                // setup config array for help tab method
1439
-                $id  = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1440
-                $_ht = [
1441
-                    'id'       => $id,
1442
-                    'title'    => $cfg['title'],
1443
-                    'callback' => isset($cfg['callback']) && empty($content) ? [$this, $cfg['callback']] : null,
1444
-                    'content'  => $content,
1445
-                ];
1446
-                $this->_current_screen->add_help_tab($_ht);
1447
-            }
1448
-        }
1449
-    }
1450
-
1451
-
1452
-    /**
1453
-     * This basically checks loaded $_page_config property to see if there are any help_tours defined.  "help_tours" is
1454
-     * an array with properties for setting up usage of the joyride plugin
1455
-     *
1456
-     * @link   http://zurb.com/playground/jquery-joyride-feature-tour-plugin
1457
-     * @see    instructions regarding the format and construction of the "help_tour" array element is found in the
1458
-     *         _set_page_config() comments
1459
-     * @return void
1460
-     * @throws InvalidArgumentException
1461
-     * @throws InvalidDataTypeException
1462
-     * @throws InvalidInterfaceException
1463
-     * @throws ReflectionException
1464
-     */
1465
-    protected function _add_help_tour()
1466
-    {
1467
-        // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
1468
-        // $tours = array();
1469
-        // $this->_help_tour = array();
1470
-        // // exit early if help tours are turned off globally
1471
-        // if ((defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)
1472
-        //     || ! EE_Registry::instance()->CFG->admin->help_tour_activation
1473
-        // ) {
1474
-        //     return;
1475
-        // }
1476
-        // // loop through _page_config to find any help_tour defined
1477
-        // foreach ($this->_page_config as $route => $config) {
1478
-        //     // we're only going to set things up for this route
1479
-        //     if ($route !== $this->_req_action) {
1480
-        //         continue;
1481
-        //     }
1482
-        //     if (isset($config['help_tour'])) {
1483
-        //         foreach ($config['help_tour'] as $tour) {
1484
-        //             $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1485
-        //             // let's see if we can get that file...
1486
-        //             // if not its possible this is a decaf route not set in caffeinated
1487
-        //             // so lets try and get the caffeinated equivalent
1488
-        //             $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1489
-        //                                                      . basename($this->_get_dir())
1490
-        //                                                      . '/help_tours/'
1491
-        //                                                      . $tour
1492
-        //                                                      . '.class.php' : $file_path;
1493
-        //             // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1494
-        //             if (! is_readable($file_path)) {
1495
-        //                 EE_Error::add_error(
1496
-        //                     sprintf(
1497
-        //                         esc_html__(
1498
-        //                             'The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling',
1499
-        //                             'event_espresso'
1500
-        //                         ),
1501
-        //                         $file_path,
1502
-        //                         $tour
1503
-        //                     ),
1504
-        //                     __FILE__,
1505
-        //                     __FUNCTION__,
1506
-        //                     __LINE__
1507
-        //                 );
1508
-        //                 return;
1509
-        //             }
1510
-        //             require_once $file_path;
1511
-        //             if (! class_exists($tour)) {
1512
-        //                 $error_msg[] = sprintf(
1513
-        //                     esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1514
-        //                     $tour
1515
-        //                 );
1516
-        //                 $error_msg[] = $error_msg[0] . "\r\n"
1517
-        //                                . sprintf(
1518
-        //                                    esc_html__(
1519
-        //                                        'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.',
1520
-        //                                        'event_espresso'
1521
-        //                                    ),
1522
-        //                                    $tour,
1523
-        //                                    '<br />',
1524
-        //                                    $tour,
1525
-        //                                    $this->_req_action,
1526
-        //                                    get_class($this)
1527
-        //                                );
1528
-        //                 throw new EE_Error(implode('||', $error_msg));
1529
-        //             }
1530
-        //             $tour_obj = new $tour($this->_is_caf);
1531
-        //             $tours[] = $tour_obj;
1532
-        //             $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1533
-        //         }
1534
-        //         // let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1535
-        //         $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1536
-        //         $tours[] = $end_stop_tour;
1537
-        //         $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1538
-        //     }
1539
-        // }
1540
-        //
1541
-        // if (! empty($tours)) {
1542
-        //     $this->_help_tour['tours'] = $tours;
1543
-        // }
1544
-        // // that's it!  Now that the $_help_tours property is set (or not)
1545
-        // // the scripts and html should be taken care of automatically.
1546
-        //
1547
-        // /**
1548
-        //  * Allow extending the help tours variable.
1549
-        //  *
1550
-        //  * @param Array $_help_tour The array containing all help tour information to be displayed.
1551
-        //  */
1552
-        // $this->_help_tour = apply_filters('FHEE__EE_Admin_Page___add_help_tour___help_tour', $this->_help_tour);
1553
-    }
1554
-
1555
-
1556
-    /**
1557
-     * This simply sets up any qtips that have been defined in the page config
1558
-     *
1559
-     * @return void
1560
-     * @throws ReflectionException
1561
-     * @throws EE_Error
1562
-     */
1563
-    protected function _add_qtips()
1564
-    {
1565
-        if (isset($this->_route_config['qtips'])) {
1566
-            $qtips = (array) $this->_route_config['qtips'];
1567
-            // load qtip loader
1568
-            $path = [
1569
-                $this->_get_dir() . '/qtips/',
1570
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1571
-            ];
1572
-            EEH_Qtip_Loader::instance()->register($qtips, $path);
1573
-        }
1574
-    }
1575
-
1576
-
1577
-    /**
1578
-     * _set_nav_tabs
1579
-     * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1580
-     * wish to add additional tabs or modify accordingly.
1581
-     *
1582
-     * @return void
1583
-     * @throws InvalidArgumentException
1584
-     * @throws InvalidInterfaceException
1585
-     * @throws InvalidDataTypeException
1586
-     */
1587
-    protected function _set_nav_tabs()
1588
-    {
1589
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1590
-        $i = 0;
1591
-        foreach ($this->_page_config as $slug => $config) {
1592
-            if (! is_array($config) || empty($config['nav'])) {
1593
-                continue;
1594
-            }
1595
-            // no nav tab for this config
1596
-            // check for persistent flag
1597
-            if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1598
-                // nav tab is only to appear when route requested.
1599
-                continue;
1600
-            }
1601
-            if (! $this->check_user_access($slug, true)) {
1602
-                // no nav tab because current user does not have access.
1603
-                continue;
1604
-            }
1605
-            $css_class                = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1606
-            $this->_nav_tabs[ $slug ] = [
1607
-                'url'       => isset($config['nav']['url'])
1608
-                    ? $config['nav']['url']
1609
-                    : EE_Admin_Page::add_query_args_and_nonce(
1610
-                        ['action' => $slug],
1611
-                        $this->_admin_base_url
1612
-                    ),
1613
-                'link_text' => isset($config['nav']['label'])
1614
-                    ? $config['nav']['label']
1615
-                    : ucwords(
1616
-                        str_replace('_', ' ', $slug)
1617
-                    ),
1618
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1619
-                'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1620
-            ];
1621
-            $i++;
1622
-        }
1623
-        // if $this->_nav_tabs is empty then lets set the default
1624
-        if (empty($this->_nav_tabs)) {
1625
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = [
1626
-                'url'       => $this->_admin_base_url,
1627
-                'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1628
-                'css_class' => 'nav-tab-active',
1629
-                'order'     => 10,
1630
-            ];
1631
-        }
1632
-        // now let's sort the tabs according to order
1633
-        usort($this->_nav_tabs, [$this, '_sort_nav_tabs']);
1634
-    }
1635
-
1636
-
1637
-    /**
1638
-     * _set_current_labels
1639
-     * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1640
-     * property array
1641
-     *
1642
-     * @return void
1643
-     */
1644
-    private function _set_current_labels()
1645
-    {
1646
-        if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1647
-            foreach ($this->_route_config['labels'] as $label => $text) {
1648
-                if (is_array($text)) {
1649
-                    foreach ($text as $sublabel => $subtext) {
1650
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1651
-                    }
1652
-                } else {
1653
-                    $this->_labels[ $label ] = $text;
1654
-                }
1655
-            }
1656
-        }
1657
-    }
1658
-
1659
-
1660
-    /**
1661
-     *        verifies user access for this admin page
1662
-     *
1663
-     * @param string $route_to_check if present then the capability for the route matching this string is checked.
1664
-     * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1665
-     *                               return false if verify fail.
1666
-     * @return bool
1667
-     * @throws InvalidArgumentException
1668
-     * @throws InvalidDataTypeException
1669
-     * @throws InvalidInterfaceException
1670
-     */
1671
-    public function check_user_access($route_to_check = '', $verify_only = false)
1672
-    {
1673
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1674
-        $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1675
-        $capability     = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1676
-                          && is_array(
1677
-                              $this->_page_routes[ $route_to_check ]
1678
-                          )
1679
-                          && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1680
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1681
-        if (empty($capability) && empty($route_to_check)) {
1682
-            $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1683
-                : $this->_route['capability'];
1684
-        } else {
1685
-            $capability = empty($capability) ? 'manage_options' : $capability;
1686
-        }
1687
-        $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1688
-        if (
1689
-            ! $this->request->isAjax()
1690
-            && (
1691
-                ! function_exists('is_admin')
1692
-                || ! EE_Registry::instance()->CAP->current_user_can(
1693
-                    $capability,
1694
-                    $this->page_slug
1695
-                    . '_'
1696
-                    . $route_to_check,
1697
-                    $id
1698
-                )
1699
-            )
1700
-        ) {
1701
-            if ($verify_only) {
1702
-                return false;
1703
-            }
1704
-            if (is_user_logged_in()) {
1705
-                wp_die(esc_html__('You do not have access to this route.', 'event_espresso'));
1706
-            } else {
1707
-                return false;
1708
-            }
1709
-        }
1710
-        return true;
1711
-    }
1712
-
1713
-
1714
-    protected function addMetaBox(
1715
-        $box_id,
1716
-        $title,
1717
-        $callback,
1718
-        $screen,
1719
-        $context = 'normal',
1720
-        $priority = 'default',
1721
-        $callback_args = null
1722
-    ) {
1723
-        add_meta_box($box_id, $title, $callback, $screen, $context, $priority, $callback_args);
1724
-        add_filter(
1725
-            "postbox_classes_{$this->_wp_page_slug}_{$box_id}",
1726
-            function ($classes) {
1727
-                array_push($classes, 'ee-admin-container');
1728
-                return $classes;
1729
-            }
1730
-        );
1731
-    }
1732
-
1733
-
1734
-    /**
1735
-     * admin_init_global
1736
-     * This runs all the code that we want executed within the WP admin_init hook.
1737
-     * This method executes for ALL EE Admin pages.
1738
-     *
1739
-     * @return void
1740
-     */
1741
-    public function admin_init_global()
1742
-    {
1743
-    }
1744
-
1745
-
1746
-    /**
1747
-     * wp_loaded_global
1748
-     * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1749
-     * EE_Admin page and will execute on every EE Admin Page load
1750
-     *
1751
-     * @return void
1752
-     */
1753
-    public function wp_loaded()
1754
-    {
1755
-    }
1756
-
1757
-
1758
-    /**
1759
-     * admin_notices
1760
-     * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1761
-     * ALL EE_Admin pages.
1762
-     *
1763
-     * @return void
1764
-     */
1765
-    public function admin_notices_global()
1766
-    {
1767
-        $this->_display_no_javascript_warning();
1768
-        $this->_display_espresso_notices();
1769
-    }
1770
-
1771
-
1772
-    public function network_admin_notices_global()
1773
-    {
1774
-        $this->_display_no_javascript_warning();
1775
-        $this->_display_espresso_notices();
1776
-    }
1777
-
1778
-
1779
-    /**
1780
-     * admin_footer_scripts_global
1781
-     * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1782
-     * will apply on ALL EE_Admin pages.
1783
-     *
1784
-     * @return void
1785
-     */
1786
-    public function admin_footer_scripts_global()
1787
-    {
1788
-        $this->_add_admin_page_ajax_loading_img();
1789
-        $this->_add_admin_page_overlay();
1790
-        // if metaboxes are present we need to add the nonce field
1791
-        if (
1792
-            isset($this->_route_config['metaboxes'])
1793
-            || isset($this->_route_config['list_table'])
1794
-            || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1795
-        ) {
1796
-            wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1797
-            wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1798
-        }
1799
-    }
1800
-
1801
-
1802
-    /**
1803
-     * admin_footer_global
1804
-     * Anything triggered by the wp 'admin_footer' wp hook should be put in here.
1805
-     * This particular method will apply on ALL EE_Admin Pages.
1806
-     *
1807
-     * @return void
1808
-     */
1809
-    public function admin_footer_global()
1810
-    {
1811
-        // dialog container for dialog helper
1812
-        echo '
137
+	/**
138
+	 * unprocessed value for the 'action' request param (default '')
139
+	 *
140
+	 * @var string
141
+	 */
142
+	protected $raw_req_action = '';
143
+
144
+	/**
145
+	 * unprocessed value for the 'page' request param (default '')
146
+	 *
147
+	 * @var string
148
+	 */
149
+	protected $raw_req_page = '';
150
+
151
+	/**
152
+	 * sanitized request action (and nonce)
153
+	 *
154
+	 * @var string
155
+	 */
156
+	protected $_req_action = '';
157
+
158
+	/**
159
+	 * sanitized request action nonce
160
+	 *
161
+	 * @var string
162
+	 */
163
+	protected $_req_nonce = '';
164
+
165
+	/**
166
+	 * @var string
167
+	 */
168
+	protected $_search_btn_label = '';
169
+
170
+	/**
171
+	 * @var string
172
+	 */
173
+	protected $_search_box_callback = '';
174
+
175
+	/**
176
+	 * @var WP_Screen
177
+	 */
178
+	protected $_current_screen;
179
+
180
+	// for holding EE_Admin_Hooks object when needed (set via set_hook_object())
181
+	protected $_hook_obj;
182
+
183
+	// for holding incoming request data
184
+	protected $_req_data = [];
185
+
186
+	// yes / no array for admin form fields
187
+	protected $_yes_no_values = [];
188
+
189
+	// some default things shared by all child classes
190
+	protected $_default_espresso_metaboxes;
191
+
192
+	/**
193
+	 * @var EE_Registry
194
+	 */
195
+	protected $EE;
196
+
197
+
198
+	/**
199
+	 * This is just a property that flags whether the given route is a caffeinated route or not.
200
+	 *
201
+	 * @var boolean
202
+	 */
203
+	protected $_is_caf = false;
204
+
205
+	/**
206
+	 * whether or not initializePage() has run
207
+	 *
208
+	 * @var boolean
209
+	 */
210
+	protected $initialized = false;
211
+
212
+	/**
213
+	 * @var FeatureFlags
214
+	 */
215
+	protected $feature;
216
+
217
+
218
+	/**
219
+	 * @Constructor
220
+	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
221
+	 * @throws InvalidArgumentException
222
+	 * @throws InvalidDataTypeException
223
+	 * @throws InvalidInterfaceException
224
+	 * @throws ReflectionException
225
+	 */
226
+	public function __construct($routing = true)
227
+	{
228
+		$this->loader = LoaderFactory::getLoader();
229
+		$this->admin_config = $this->loader->getShared('EE_Admin_Config');
230
+		$this->feature = $this->loader->getShared(FeatureFlags::class);
231
+		$this->request = $this->loader->getShared(RequestInterface::class);
232
+		// routing enabled?
233
+		$this->_routing = $routing;
234
+
235
+		if (strpos($this->_get_dir(), 'caffeinated') !== false) {
236
+			$this->_is_caf = true;
237
+		}
238
+		$this->_yes_no_values = [
239
+			['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
240
+			['id' => false, 'text' => esc_html__('No', 'event_espresso')],
241
+		];
242
+		// set the _req_data property.
243
+		$this->_req_data = $this->request->requestParams();
244
+	}
245
+
246
+
247
+	/**
248
+	 * @return EE_Admin_Config
249
+	 */
250
+	public function adminConfig(): EE_Admin_Config
251
+	{
252
+		return $this->admin_config;
253
+	}
254
+
255
+
256
+	/**
257
+	 * @return FeatureFlags
258
+	 */
259
+	public function feature(): FeatureFlags
260
+	{
261
+		return $this->feature;
262
+	}
263
+
264
+
265
+	/**
266
+	 * This logic used to be in the constructor, but that caused a chicken <--> egg scenario
267
+	 * for child classes that needed to set properties prior to these methods getting called,
268
+	 * but also needed the parent class to have its construction completed as well.
269
+	 * Bottom line is that constructors should ONLY be used for setting initial properties
270
+	 * and any complex initialization logic should only run after instantiation is complete.
271
+	 *
272
+	 * This method gets called immediately after construction from within
273
+	 *      EE_Admin_Page_Init::_initialize_admin_page()
274
+	 *
275
+	 * @throws EE_Error
276
+	 * @throws InvalidArgumentException
277
+	 * @throws InvalidDataTypeException
278
+	 * @throws InvalidInterfaceException
279
+	 * @throws ReflectionException
280
+	 * @since $VID:$
281
+	 */
282
+	public function initializePage()
283
+	{
284
+		if ($this->initialized) {
285
+			return;
286
+		}
287
+		// set initial page props (child method)
288
+		$this->_init_page_props();
289
+		// set global defaults
290
+		$this->_set_defaults();
291
+		// set early because incoming requests could be ajax related and we need to register those hooks.
292
+		$this->_global_ajax_hooks();
293
+		$this->_ajax_hooks();
294
+		// other_page_hooks have to be early too.
295
+		$this->_do_other_page_hooks();
296
+		// set up page dependencies
297
+		$this->_before_page_setup();
298
+		$this->_page_setup();
299
+		$this->initialized = true;
300
+	}
301
+
302
+
303
+	/**
304
+	 * _init_page_props
305
+	 * Child classes use to set at least the following properties:
306
+	 * $page_slug.
307
+	 * $page_label.
308
+	 *
309
+	 * @abstract
310
+	 * @return void
311
+	 */
312
+	abstract protected function _init_page_props();
313
+
314
+
315
+	/**
316
+	 * _ajax_hooks
317
+	 * child classes put all their add_action('wp_ajax_{name_of_hook}') hooks in here.
318
+	 * Note: within the ajax callback methods.
319
+	 *
320
+	 * @abstract
321
+	 * @return void
322
+	 */
323
+	abstract protected function _ajax_hooks();
324
+
325
+
326
+	/**
327
+	 * _define_page_props
328
+	 * child classes define page properties in here.  Must include at least:
329
+	 * $_admin_base_url = base_url for all admin pages
330
+	 * $_admin_page_title = default admin_page_title for admin pages
331
+	 * $_labels = array of default labels for various automatically generated elements:
332
+	 *    array(
333
+	 *        'buttons' => array(
334
+	 *            'add' => esc_html__('label for add new button'),
335
+	 *            'edit' => esc_html__('label for edit button'),
336
+	 *            'delete' => esc_html__('label for delete button')
337
+	 *            )
338
+	 *        )
339
+	 *
340
+	 * @abstract
341
+	 * @return void
342
+	 */
343
+	abstract protected function _define_page_props();
344
+
345
+
346
+	/**
347
+	 * _set_page_routes
348
+	 * child classes use this to define the page routes for all subpages handled by the class.  Page routes are
349
+	 * assigned to a action => method pairs in an array and to the $_page_routes property.  Each page route must also
350
+	 * have a 'default' route. Here's the format
351
+	 * $this->_page_routes = array(
352
+	 *        'default' => array(
353
+	 *            'func' => '_default_method_handling_route',
354
+	 *            'args' => array('array','of','args'),
355
+	 *            'noheader' => true, //add this in if this page route is processed before any headers are loaded (i.e.
356
+	 *            ajax request, backend processing)
357
+	 *            'headers_sent_route'=>'headers_route_reference', //add this if noheader=>true, and you want to load a
358
+	 *            headers route after.  The string you enter here should match the defined route reference for a
359
+	 *            headers sent route.
360
+	 *            'capability' => 'route_capability', //indicate a string for minimum capability required to access
361
+	 *            this route.
362
+	 *            'obj_id' => 10 // if this route has an object id, then this can include it (used for capability
363
+	 *            checks).
364
+	 *        ),
365
+	 *        'insert_item' => '_method_for_handling_insert_item' //this can be used if all we need to have is a
366
+	 *        handling method.
367
+	 *        )
368
+	 * )
369
+	 *
370
+	 * @abstract
371
+	 * @return void
372
+	 */
373
+	abstract protected function _set_page_routes();
374
+
375
+
376
+	/**
377
+	 * _set_page_config
378
+	 * child classes use this to define the _page_config array for all subpages handled by the class. Each key in the
379
+	 * array corresponds to the page_route for the loaded page. Format:
380
+	 * $this->_page_config = array(
381
+	 *        'default' => array(
382
+	 *            'labels' => array(
383
+	 *                'buttons' => array(
384
+	 *                    'add' => esc_html__('label for adding item'),
385
+	 *                    'edit' => esc_html__('label for editing item'),
386
+	 *                    'delete' => esc_html__('label for deleting item')
387
+	 *                ),
388
+	 *                'publishbox' => esc_html__('Localized Title for Publish metabox', 'event_espresso')
389
+	 *            ), //optional an array of custom labels for various automatically generated elements to use on the
390
+	 *            page. If this isn't present then the defaults will be used as set for the $this->_labels in
391
+	 *            _define_page_props() method
392
+	 *            'nav' => array(
393
+	 *                'label' => esc_html__('Label for Tab', 'event_espresso').
394
+	 *                'url' => 'http://someurl', //automatically generated UNLESS you define
395
+	 *                'css_class' => 'css-class', //automatically generated UNLESS you define
396
+	 *                'order' => 10, //required to indicate tab position.
397
+	 *                'persistent' => false //if you want the nav tab to ONLY display when the specific route is
398
+	 *                displayed then add this parameter.
399
+	 *            'list_table' => 'name_of_list_table' //string for list table class to be loaded for this admin_page.
400
+	 *            'metaboxes' => array('metabox1', 'metabox2'), //if present this key indicates we want to load
401
+	 *            metaboxes set for eventespresso admin pages.
402
+	 *            'has_metaboxes' => true, //this boolean flag can simply be used to indicate if the route will have
403
+	 *            metaboxes.  Typically this is used if the 'metaboxes' index is not used because metaboxes are added
404
+	 *            later.  We just use this flag to make sure the necessary js gets enqueued on page load.
405
+	 *            'has_help_popups' => false //defaults(true) //this boolean flag can simply be used to indicate if the
406
+	 *            given route has help popups setup and if it does then we need to make sure thickbox is enqueued.
407
+	 *            'columns' => array(4, 2), //this key triggers the setup of a page that uses columns (metaboxes).  The
408
+	 *            array indicates the max number of columns (4) and the default number of columns on page load (2).
409
+	 *            There is an option in the "screen_options" dropdown that is setup so users can pick what columns they
410
+	 *            want to display.
411
+	 *            'help_tabs' => array( //this is used for adding help tabs to a page
412
+	 *                'tab_id' => array(
413
+	 *                    'title' => 'tab_title',
414
+	 *                    'filename' => 'name_of_file_containing_content', //this is the primary method for setting
415
+	 *                    help tab content.  The fallback if it isn't present is to try a the callback.  Filename
416
+	 *                    should match a file in the admin folder's "help_tabs" dir (ie..
417
+	 *                    events/help_tabs/name_of_file_containing_content.help_tab.php)
418
+	 *                    'callback' => 'callback_method_for_content', //if 'filename' isn't present then system will
419
+	 *                    attempt to use the callback which should match the name of a method in the class
420
+	 *                    ),
421
+	 *                'tab2_id' => array(
422
+	 *                    'title' => 'tab2 title',
423
+	 *                    'filename' => 'file_name_2'
424
+	 *                    'callback' => 'callback_method_for_content',
425
+	 *                 ),
426
+	 *            'help_sidebar' => 'callback_for_sidebar_content', //this is used for setting up the sidebar in the
427
+	 *            help tab area on an admin page. @return void
428
+	 *
429
+	 * @link
430
+	 *                http://make.wordpress.org/core/2011/12/06/help-and-screen-api-changes-in-3-3/
431
+	 *                'help_tour' => array(
432
+	 *                'name_of_help_tour_class', //all help tours should be a child class of EE_Help_Tour and located
433
+	 *                in a folder for this admin page named "help_tours", a file name matching the key given here
434
+	 *                (name_of_help_tour_class.class.php), and class matching key given here (name_of_help_tour_class)
435
+	 *                ),
436
+	 *                'require_nonce' => TRUE //this is used if you want to set a route to NOT require a nonce (default
437
+	 *                is true if it isn't present).  To remove the requirement for a nonce check when this route is
438
+	 *                visited just set
439
+	 *                'require_nonce' to FALSE
440
+	 *                )
441
+	 *                )
442
+	 *
443
+	 * @abstract
444
+	 */
445
+	abstract protected function _set_page_config();
446
+
447
+
448
+
449
+
450
+
451
+	/** end sample help_tour methods **/
452
+	/**
453
+	 * _add_screen_options
454
+	 * Child classes can add any extra wp_screen_options within this method using built-in WP functions/methods for
455
+	 * doing so. Note child classes can also define _add_screen_options_($this->_current_view) to limit screen options
456
+	 * to a particular view.
457
+	 *
458
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
459
+	 *         see also WP_Screen object documents...
460
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
461
+	 * @abstract
462
+	 * @return void
463
+	 */
464
+	abstract protected function _add_screen_options();
465
+
466
+
467
+	/**
468
+	 * _add_feature_pointers
469
+	 * Child classes should use this method for implementing any "feature pointers" (using built-in WP styling js).
470
+	 * Note child classes can also define _add_feature_pointers_($this->_current_view) to limit screen options to a
471
+	 * particular view. Note: this is just a placeholder for now.  Implementation will come down the road See:
472
+	 * WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
473
+	 * extended) also see:
474
+	 *
475
+	 * @link   http://eamann.com/tech/wordpress-portland/
476
+	 * @abstract
477
+	 * @return void
478
+	 */
479
+	abstract protected function _add_feature_pointers();
480
+
481
+
482
+	/**
483
+	 * load_scripts_styles
484
+	 * child classes put their wp_enqueue_script and wp_enqueue_style hooks in here for anything they need loaded for
485
+	 * their pages/subpages.  Note this is for all pages/subpages of the system.  You can also load only specific
486
+	 * scripts/styles per view by putting them in a dynamic function in this format
487
+	 * (load_scripts_styles_{$this->_current_view}) which matches your page route (action request arg)
488
+	 *
489
+	 * @abstract
490
+	 * @return void
491
+	 */
492
+	abstract public function load_scripts_styles();
493
+
494
+
495
+	/**
496
+	 * admin_init
497
+	 * Anything that should be set/executed at 'admin_init' WP hook runtime should be put in here.  This will apply to
498
+	 * all pages/views loaded by child class.
499
+	 *
500
+	 * @abstract
501
+	 * @return void
502
+	 */
503
+	abstract public function admin_init();
504
+
505
+
506
+	/**
507
+	 * admin_notices
508
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply to
509
+	 * all pages/views loaded by child class.
510
+	 *
511
+	 * @abstract
512
+	 * @return void
513
+	 */
514
+	abstract public function admin_notices();
515
+
516
+
517
+	/**
518
+	 * admin_footer_scripts
519
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
520
+	 * will apply to all pages/views loaded by child class.
521
+	 *
522
+	 * @return void
523
+	 */
524
+	abstract public function admin_footer_scripts();
525
+
526
+
527
+	/**
528
+	 * admin_footer
529
+	 * anything triggered by the 'admin_footer' WP action hook should be added to here. This particular method will
530
+	 * apply to all pages/views loaded by child class.
531
+	 *
532
+	 * @return void
533
+	 */
534
+	public function admin_footer()
535
+	{
536
+	}
537
+
538
+
539
+	/**
540
+	 * _global_ajax_hooks
541
+	 * all global add_action('wp_ajax_{name_of_hook}') hooks in here.
542
+	 * Note: within the ajax callback methods.
543
+	 *
544
+	 * @abstract
545
+	 * @return void
546
+	 */
547
+	protected function _global_ajax_hooks()
548
+	{
549
+		// for lazy loading of metabox content
550
+		add_action('wp_ajax_espresso-ajax-content', [$this, 'ajax_metabox_content'], 10);
551
+
552
+		add_action(
553
+			'wp_ajax_espresso_hide_status_change_notice',
554
+			[$this, 'hideStatusChangeNotice']
555
+		);
556
+		add_action(
557
+			'wp_ajax_nopriv_espresso_hide_status_change_notice',
558
+			[$this, 'hideStatusChangeNotice']
559
+		);
560
+	}
561
+
562
+
563
+	public function ajax_metabox_content()
564
+	{
565
+		$content_id  = $this->request->getRequestParam('contentid', '');
566
+		$content_url = $this->request->getRequestParam('contenturl', '', 'url');
567
+		EE_Admin_Page::cached_rss_display($content_id, $content_url);
568
+		wp_die();
569
+	}
570
+
571
+
572
+	public function hideStatusChangeNotice()
573
+	{
574
+		$response = [];
575
+		try {
576
+			/** @var EventEspresso\core\admin\StatusChangeNotice $status_change_notice */
577
+			$status_change_notice = $this->loader->getShared('EventEspresso\core\admin\StatusChangeNotice');
578
+			$response['success'] = $status_change_notice->dismiss() > -1;
579
+		} catch (Exception $exception) {
580
+			$response['errors'] = $exception->getMessage();
581
+		}
582
+		echo wp_json_encode($response);
583
+		exit();
584
+	}
585
+
586
+
587
+	/**
588
+	 * allows extending classes do something specific before the parent constructor runs _page_setup().
589
+	 *
590
+	 * @return void
591
+	 */
592
+	protected function _before_page_setup()
593
+	{
594
+		// default is to do nothing
595
+	}
596
+
597
+
598
+	/**
599
+	 * Makes sure any things that need to be loaded early get handled.
600
+	 * We also escape early here if the page requested doesn't match the object.
601
+	 *
602
+	 * @final
603
+	 * @return void
604
+	 * @throws EE_Error
605
+	 * @throws InvalidArgumentException
606
+	 * @throws ReflectionException
607
+	 * @throws InvalidDataTypeException
608
+	 * @throws InvalidInterfaceException
609
+	 */
610
+	final protected function _page_setup()
611
+	{
612
+		// requires?
613
+		// admin_init stuff - global - we're setting this REALLY early
614
+		// so if EE_Admin pages have to hook into other WP pages they can.
615
+		// But keep in mind, not everything is available from the EE_Admin Page object at this point.
616
+		add_action('admin_init', [$this, 'admin_init_global'], 5);
617
+		// next verify if we need to load anything...
618
+		$this->_current_page = $this->request->getRequestParam('page', '', 'key');
619
+		$this->page_folder   = strtolower(
620
+			str_replace(['_Admin_Page', 'Extend_'], '', get_class($this))
621
+		);
622
+		global $ee_menu_slugs;
623
+		$ee_menu_slugs = (array) $ee_menu_slugs;
624
+		if (
625
+			! $this->request->isAjax()
626
+			&& (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))
627
+		) {
628
+			return;
629
+		}
630
+		// because WP List tables have two duplicate select inputs for choosing bulk actions,
631
+		// we need to copy the action from the second to the first
632
+		$action     = $this->request->getRequestParam('action', '-1', 'key');
633
+		$action2    = $this->request->getRequestParam('action2', '-1', 'key');
634
+		$action     = $action !== '-1' ? $action : $action2;
635
+		$req_action = $action !== '-1' ? $action : 'default';
636
+
637
+		// if a specific 'route' has been set, and the action is 'default' OR we are doing_ajax
638
+		// then let's use the route as the action.
639
+		// This covers cases where we're coming in from a list table that isn't on the default route.
640
+		$route = $this->request->getRequestParam('route');
641
+		$this->_req_action = $route && ($req_action === 'default' || $this->request->isAjax())
642
+			? $route
643
+			: $req_action;
644
+
645
+		$this->_current_view = $this->_req_action;
646
+		$this->_req_nonce    = $this->_req_action . '_nonce';
647
+		$this->_define_page_props();
648
+		$this->_current_page_view_url = add_query_arg(
649
+			['page' => $this->_current_page, 'action' => $this->_current_view],
650
+			$this->_admin_base_url
651
+		);
652
+		// default things
653
+		$this->_default_espresso_metaboxes = [
654
+			'_espresso_news_post_box',
655
+			'_espresso_links_post_box',
656
+			'_espresso_ratings_request',
657
+			'_espresso_sponsors_post_box',
658
+		];
659
+		// set page configs
660
+		$this->_set_page_routes();
661
+		$this->_set_page_config();
662
+		// let's include any referrer data in our default_query_args for this route for "stickiness".
663
+		if ($this->request->requestParamIsSet('wp_referer')) {
664
+			$wp_referer = $this->request->getRequestParam('wp_referer');
665
+			if ($wp_referer) {
666
+				$this->_default_route_query_args['wp_referer'] = $wp_referer;
667
+			}
668
+		}
669
+		// for caffeinated and other extended functionality.
670
+		//  If there is a _extend_page_config method
671
+		// then let's run that to modify the all the various page configuration arrays
672
+		if (method_exists($this, '_extend_page_config')) {
673
+			$this->_extend_page_config();
674
+		}
675
+		// for CPT and other extended functionality.
676
+		// If there is an _extend_page_config_for_cpt
677
+		// then let's run that to modify all the various page configuration arrays.
678
+		if (method_exists($this, '_extend_page_config_for_cpt')) {
679
+			$this->_extend_page_config_for_cpt();
680
+		}
681
+		// filter routes and page_config so addons can add their stuff. Filtering done per class
682
+		$this->_page_routes = apply_filters(
683
+			'FHEE__' . get_class($this) . '__page_setup__page_routes',
684
+			$this->_page_routes,
685
+			$this
686
+		);
687
+		$this->_page_config = apply_filters(
688
+			'FHEE__' . get_class($this) . '__page_setup__page_config',
689
+			$this->_page_config,
690
+			$this
691
+		);
692
+		// if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
693
+		// then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
694
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
695
+			add_action(
696
+				'AHEE__EE_Admin_Page__route_admin_request',
697
+				[$this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view],
698
+				10,
699
+				2
700
+			);
701
+		}
702
+		// next route only if routing enabled
703
+		if ($this->_routing && ! $this->request->isAjax()) {
704
+			$this->_verify_routes();
705
+			// next let's just check user_access and kill if no access
706
+			$this->check_user_access();
707
+			if ($this->_is_UI_request) {
708
+				// admin_init stuff - global, all views for this page class, specific view
709
+				add_action('admin_init', [$this, 'admin_init'], 10);
710
+				if (method_exists($this, 'admin_init_' . $this->_current_view)) {
711
+					add_action('admin_init', [$this, 'admin_init_' . $this->_current_view], 15);
712
+				}
713
+			} else {
714
+				// hijack regular WP loading and route admin request immediately
715
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
716
+				$this->route_admin_request();
717
+			}
718
+		}
719
+	}
720
+
721
+
722
+	/**
723
+	 * Provides a way for related child admin pages to load stuff on the loaded admin page.
724
+	 *
725
+	 * @return void
726
+	 * @throws EE_Error
727
+	 */
728
+	private function _do_other_page_hooks()
729
+	{
730
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, []);
731
+		foreach ($registered_pages as $page) {
732
+			// now let's setup the file name and class that should be present
733
+			$classname = str_replace('.class.php', '', $page);
734
+			// autoloaders should take care of loading file
735
+			if (! class_exists($classname)) {
736
+				$error_msg[] = sprintf(
737
+					esc_html__(
738
+						'Something went wrong with loading the %s admin hooks page.',
739
+						'event_espresso'
740
+					),
741
+					$page
742
+				);
743
+				$error_msg[] = $error_msg[0]
744
+							   . "\r\n"
745
+							   . sprintf(
746
+								   esc_html__(
747
+									   'There is no class in place for the %1$s admin hooks page.%2$sMake sure you have %3$s defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class',
748
+									   'event_espresso'
749
+								   ),
750
+								   $page,
751
+								   '<br />',
752
+								   '<strong>' . $classname . '</strong>'
753
+							   );
754
+				throw new EE_Error(implode('||', $error_msg));
755
+			}
756
+			// notice we are passing the instance of this class to the hook object.
757
+			$this->loader->getShared($classname, [$this]);
758
+		}
759
+	}
760
+
761
+
762
+	/**
763
+	 * @throws ReflectionException
764
+	 * @throws EE_Error
765
+	 */
766
+	public function load_page_dependencies()
767
+	{
768
+		try {
769
+			$this->_load_page_dependencies();
770
+		} catch (EE_Error $e) {
771
+			$e->get_error();
772
+		}
773
+	}
774
+
775
+
776
+	/**
777
+	 * load_page_dependencies
778
+	 * loads things specific to this page class when its loaded.  Really helps with efficiency.
779
+	 *
780
+	 * @return void
781
+	 * @throws DomainException
782
+	 * @throws EE_Error
783
+	 * @throws InvalidArgumentException
784
+	 * @throws InvalidDataTypeException
785
+	 * @throws InvalidInterfaceException
786
+	 */
787
+	protected function _load_page_dependencies()
788
+	{
789
+		// let's set the current_screen and screen options to override what WP set
790
+		$this->_current_screen = get_current_screen();
791
+		// load admin_notices - global, page class, and view specific
792
+		add_action('admin_notices', [$this, 'admin_notices_global'], 5);
793
+		add_action('admin_notices', [$this, 'admin_notices'], 10);
794
+		if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
795
+			add_action('admin_notices', [$this, 'admin_notices_' . $this->_current_view], 15);
796
+		}
797
+		// load network admin_notices - global, page class, and view specific
798
+		add_action('network_admin_notices', [$this, 'network_admin_notices_global'], 5);
799
+		if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
800
+			add_action('network_admin_notices', [$this, 'network_admin_notices_' . $this->_current_view]);
801
+		}
802
+		// this will save any per_page screen options if they are present
803
+		$this->_set_per_page_screen_options();
804
+		// setup list table properties
805
+		$this->_set_list_table();
806
+		// child classes can "register" a metabox to be automatically handled via the _page_config array property.
807
+		// However in some cases the metaboxes will need to be added within a route handling callback.
808
+		$this->_add_registered_meta_boxes();
809
+		$this->_add_screen_columns();
810
+		// add screen options - global, page child class, and view specific
811
+		$this->_add_global_screen_options();
812
+		$this->_add_screen_options();
813
+		$add_screen_options = "_add_screen_options_{$this->_current_view}";
814
+		if (method_exists($this, $add_screen_options)) {
815
+			$this->{$add_screen_options}();
816
+		}
817
+		// add help tab(s) and tours- set via page_config and qtips.
818
+		// $this->_add_help_tour();
819
+		$this->_add_help_tabs();
820
+		$this->_add_qtips();
821
+		// add feature_pointers - global, page child class, and view specific
822
+		$this->_add_feature_pointers();
823
+		$this->_add_global_feature_pointers();
824
+		$add_feature_pointer = "_add_feature_pointer_{$this->_current_view}";
825
+		if (method_exists($this, $add_feature_pointer)) {
826
+			$this->{$add_feature_pointer}();
827
+		}
828
+		// enqueue scripts/styles - global, page class, and view specific
829
+		add_action('admin_enqueue_scripts', [$this, 'load_global_scripts_styles'], 5);
830
+		add_action('admin_enqueue_scripts', [$this, 'load_scripts_styles'], 10);
831
+		if (method_exists($this, "load_scripts_styles_{$this->_current_view}")) {
832
+			add_action('admin_enqueue_scripts', [$this, "load_scripts_styles_{$this->_current_view}"], 15);
833
+		}
834
+		add_action('admin_enqueue_scripts', [$this, 'admin_footer_scripts_eei18n_js_strings'], 100);
835
+		// admin_print_footer_scripts - global, page child class, and view specific.
836
+		// NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.
837
+		// In most cases that's doing_it_wrong().  But adding hidden container elements etc.
838
+		// is a good use case. Notice the late priority we're giving these
839
+		add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts_global'], 99);
840
+		add_action('admin_print_footer_scripts', [$this, 'admin_footer_scripts'], 100);
841
+		if (method_exists($this, "admin_footer_scripts_{$this->_current_view}")) {
842
+			add_action('admin_print_footer_scripts', [$this, "admin_footer_scripts_{$this->_current_view}"], 101);
843
+		}
844
+		// admin footer scripts
845
+		add_action('admin_footer', [$this, 'admin_footer_global'], 99);
846
+		add_action('admin_footer', [$this, 'admin_footer'], 100);
847
+		if (method_exists($this, "admin_footer_{$this->_current_view}")) {
848
+			add_action('admin_footer', [$this, "admin_footer_{$this->_current_view}"], 101);
849
+		}
850
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
851
+		// targeted hook
852
+		do_action(
853
+			"FHEE__EE_Admin_Page___load_page_dependencies__after_load__{$this->page_slug}__{$this->_req_action}"
854
+		);
855
+	}
856
+
857
+
858
+	/**
859
+	 * _set_defaults
860
+	 * This sets some global defaults for class properties.
861
+	 */
862
+	private function _set_defaults()
863
+	{
864
+		$this->_current_screen       = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = null;
865
+		$this->_event                = $this->_template_path = $this->_column_template_path = null;
866
+		$this->_nav_tabs             = $this->_views = $this->_page_routes = [];
867
+		$this->_page_config          = $this->_default_route_query_args = [];
868
+		$this->_default_nav_tab_name = 'overview';
869
+		// init template args
870
+		$this->_template_args = [
871
+			'admin_page_header'  => '',
872
+			'admin_page_content' => '',
873
+			'post_body_content'  => '',
874
+			'before_list_table'  => '',
875
+			'after_list_table'   => '',
876
+		];
877
+	}
878
+
879
+
880
+	/**
881
+	 * route_admin_request
882
+	 *
883
+	 * @return void
884
+	 * @throws InvalidArgumentException
885
+	 * @throws InvalidInterfaceException
886
+	 * @throws InvalidDataTypeException
887
+	 * @throws EE_Error
888
+	 * @throws ReflectionException
889
+	 * @see    _route_admin_request()
890
+	 */
891
+	public function route_admin_request()
892
+	{
893
+		try {
894
+			$this->_route_admin_request();
895
+		} catch (EE_Error $e) {
896
+			$e->get_error();
897
+		}
898
+	}
899
+
900
+
901
+	public function set_wp_page_slug($wp_page_slug)
902
+	{
903
+		$this->_wp_page_slug = $wp_page_slug;
904
+		// if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
905
+		if (is_network_admin()) {
906
+			$this->_wp_page_slug .= '-network';
907
+		}
908
+	}
909
+
910
+
911
+	/**
912
+	 * _verify_routes
913
+	 * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so
914
+	 * we know if we need to drop out.
915
+	 *
916
+	 * @return bool
917
+	 * @throws EE_Error
918
+	 */
919
+	protected function _verify_routes()
920
+	{
921
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
922
+		if (! $this->_current_page && ! $this->request->isAjax()) {
923
+			return false;
924
+		}
925
+		$this->_route = false;
926
+		// check that the page_routes array is not empty
927
+		if (empty($this->_page_routes)) {
928
+			// user error msg
929
+			$error_msg = sprintf(
930
+				esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
931
+				$this->_admin_page_title
932
+			);
933
+			// developer error msg
934
+			$error_msg .= '||' . $error_msg
935
+						  . esc_html__(
936
+							  ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
937
+							  'event_espresso'
938
+						  );
939
+			throw new EE_Error($error_msg);
940
+		}
941
+		// and that the requested page route exists
942
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
943
+			$this->_route        = $this->_page_routes[ $this->_req_action ];
944
+			$this->_route_config = $this->_page_config[ $this->_req_action ] ?? [];
945
+		} else {
946
+			// user error msg
947
+			$error_msg = sprintf(
948
+				esc_html__(
949
+					'The requested page route does not exist for the %s admin page.',
950
+					'event_espresso'
951
+				),
952
+				$this->_admin_page_title
953
+			);
954
+			// developer error msg
955
+			$error_msg .= '||' . $error_msg
956
+						  . sprintf(
957
+							  esc_html__(
958
+								  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
959
+								  'event_espresso'
960
+							  ),
961
+							  $this->_req_action
962
+						  );
963
+			throw new EE_Error($error_msg);
964
+		}
965
+		// and that a default route exists
966
+		if (! array_key_exists('default', $this->_page_routes)) {
967
+			// user error msg
968
+			$error_msg = sprintf(
969
+				esc_html__(
970
+					'A default page route has not been set for the % admin page.',
971
+					'event_espresso'
972
+				),
973
+				$this->_admin_page_title
974
+			);
975
+			// developer error msg
976
+			$error_msg .= '||' . $error_msg
977
+						  . esc_html__(
978
+							  ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
979
+							  'event_espresso'
980
+						  );
981
+			throw new EE_Error($error_msg);
982
+		}
983
+
984
+		// first lets' catch if the UI request has EVER been set.
985
+		if ($this->_is_UI_request === null) {
986
+			// lets set if this is a UI request or not.
987
+			$this->_is_UI_request = ! $this->request->getRequestParam('noheader', false, 'bool');
988
+			// wait a minute... we might have a noheader in the route array
989
+			$this->_is_UI_request = ! (
990
+				is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader']
991
+			)
992
+				? $this->_is_UI_request
993
+				: false;
994
+		}
995
+		$this->_set_current_labels();
996
+		return true;
997
+	}
998
+
999
+
1000
+	/**
1001
+	 * this method simply verifies a given route and makes sure its an actual route available for the loaded page
1002
+	 *
1003
+	 * @param string $route the route name we're verifying
1004
+	 * @return bool we'll throw an exception if this isn't a valid route.
1005
+	 * @throws EE_Error
1006
+	 */
1007
+	protected function _verify_route($route)
1008
+	{
1009
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
1010
+			return true;
1011
+		}
1012
+		// user error msg
1013
+		$error_msg = sprintf(
1014
+			esc_html__('The given page route does not exist for the %s admin page.', 'event_espresso'),
1015
+			$this->_admin_page_title
1016
+		);
1017
+		// developer error msg
1018
+		$error_msg .= '||' . $error_msg
1019
+					  . sprintf(
1020
+						  esc_html__(
1021
+							  ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
1022
+							  'event_espresso'
1023
+						  ),
1024
+						  $route
1025
+					  );
1026
+		throw new EE_Error($error_msg);
1027
+	}
1028
+
1029
+
1030
+	/**
1031
+	 * perform nonce verification
1032
+	 * This method has be encapsulated here so that any ajax requests that bypass normal routes can verify their nonces
1033
+	 * using this method (and save retyping!)
1034
+	 *
1035
+	 * @param string $nonce     The nonce sent
1036
+	 * @param string $nonce_ref The nonce reference string (name0)
1037
+	 * @return void
1038
+	 * @throws EE_Error
1039
+	 * @throws InvalidArgumentException
1040
+	 * @throws InvalidDataTypeException
1041
+	 * @throws InvalidInterfaceException
1042
+	 */
1043
+	protected function _verify_nonce($nonce, $nonce_ref)
1044
+	{
1045
+		// verify nonce against expected value
1046
+		if (! wp_verify_nonce($nonce, $nonce_ref)) {
1047
+			// these are not the droids you are looking for !!!
1048
+			$msg = sprintf(
1049
+				esc_html__('%sNonce Fail.%s', 'event_espresso'),
1050
+				'<a href="https://www.youtube.com/watch?v=56_S0WeTkzs">',
1051
+				'</a>'
1052
+			);
1053
+			if (WP_DEBUG) {
1054
+				$msg .= "\n  ";
1055
+				$msg .= sprintf(
1056
+					esc_html__(
1057
+						'In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!',
1058
+						'event_espresso'
1059
+					),
1060
+					__CLASS__
1061
+				);
1062
+			}
1063
+			if (! $this->request->isAjax()) {
1064
+				wp_die($msg);
1065
+			}
1066
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1067
+			$this->_return_json();
1068
+		}
1069
+	}
1070
+
1071
+
1072
+	/**
1073
+	 * _route_admin_request()
1074
+	 * Meat and potatoes of the class.  Basically, this dude checks out what's being requested and sees if there are
1075
+	 * some doodads to work the magic and handle the flingjangy. Translation:  Checks if the requested action is listed
1076
+	 * in the page routes and then will try to load the corresponding method.
1077
+	 *
1078
+	 * @return void
1079
+	 * @throws EE_Error
1080
+	 * @throws InvalidArgumentException
1081
+	 * @throws InvalidDataTypeException
1082
+	 * @throws InvalidInterfaceException
1083
+	 * @throws ReflectionException
1084
+	 */
1085
+	protected function _route_admin_request()
1086
+	{
1087
+		if (! $this->_is_UI_request) {
1088
+			$this->_verify_routes();
1089
+		}
1090
+		$nonce_check = ! isset($this->_route_config['require_nonce']) || $this->_route_config['require_nonce'];
1091
+		if ($this->_req_action !== 'default' && $nonce_check) {
1092
+			// set nonce from post data
1093
+			$nonce = $this->request->getRequestParam($this->_req_nonce, '');
1094
+			$this->_verify_nonce($nonce, $this->_req_nonce);
1095
+		}
1096
+		// set the nav_tabs array but ONLY if this is  UI_request
1097
+		if ($this->_is_UI_request) {
1098
+			$this->_set_nav_tabs();
1099
+		}
1100
+		// grab callback function
1101
+		$func = is_array($this->_route) && isset($this->_route['func']) ? $this->_route['func'] : $this->_route;
1102
+		// check if callback has args
1103
+		$args      = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : [];
1104
+		$error_msg = '';
1105
+		// action right before calling route
1106
+		// (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
1107
+		if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1108
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
1109
+		}
1110
+		// right before calling the route, let's clean the _wp_http_referer
1111
+		$this->request->setServerParam(
1112
+			'REQUEST_URI',
1113
+			remove_query_arg(
1114
+				'_wp_http_referer',
1115
+				wp_unslash($this->request->getServerParam('REQUEST_URI'))
1116
+			)
1117
+		);
1118
+		if (! empty($func)) {
1119
+			if (is_array($func)) {
1120
+				[$class, $method] = $func;
1121
+			} elseif (strpos($func, '::') !== false) {
1122
+				[$class, $method] = explode('::', $func);
1123
+			} else {
1124
+				$class  = $this;
1125
+				$method = $func;
1126
+			}
1127
+			if (! (is_object($class) && $class === $this)) {
1128
+				// send along this admin page object for access by addons.
1129
+				$args['admin_page_object'] = $this;
1130
+			}
1131
+			if (
1132
+				// is it a method on a class that doesn't work?
1133
+				(
1134
+					(
1135
+						method_exists($class, $method)
1136
+						&& call_user_func_array([$class, $method], $args) === false
1137
+					)
1138
+					&& (
1139
+						// is it a standalone function that doesn't work?
1140
+						function_exists($method)
1141
+						&& call_user_func_array(
1142
+							$func,
1143
+							array_merge(['admin_page_object' => $this], $args)
1144
+						) === false
1145
+					)
1146
+				)
1147
+				|| (
1148
+					// is it neither a class method NOR a standalone function?
1149
+					! method_exists($class, $method)
1150
+					&& ! function_exists($method)
1151
+				)
1152
+			) {
1153
+				// user error msg
1154
+				$error_msg = esc_html__(
1155
+					'An error occurred. The  requested page route could not be found.',
1156
+					'event_espresso'
1157
+				);
1158
+				// developer error msg
1159
+				$error_msg .= '||';
1160
+				$error_msg .= sprintf(
1161
+					esc_html__(
1162
+						'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.',
1163
+						'event_espresso'
1164
+					),
1165
+					$method
1166
+				);
1167
+			}
1168
+			if (! empty($error_msg)) {
1169
+				throw new EE_Error($error_msg);
1170
+			}
1171
+		}
1172
+		// if we've routed and this route has a no headers route AND a sent_headers_route,
1173
+		// then we need to reset the routing properties to the new route.
1174
+		// now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
1175
+		if (
1176
+			$this->_is_UI_request === false
1177
+			&& is_array($this->_route)
1178
+			&& ! empty($this->_route['headers_sent_route'])
1179
+		) {
1180
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
1181
+		}
1182
+	}
1183
+
1184
+
1185
+	/**
1186
+	 * This method just allows the resetting of page properties in the case where a no headers
1187
+	 * route redirects to a headers route in its route config.
1188
+	 *
1189
+	 * @param string $new_route New (non header) route to redirect to.
1190
+	 * @return   void
1191
+	 * @throws ReflectionException
1192
+	 * @throws InvalidArgumentException
1193
+	 * @throws InvalidInterfaceException
1194
+	 * @throws InvalidDataTypeException
1195
+	 * @throws EE_Error
1196
+	 * @since   4.3.0
1197
+	 */
1198
+	protected function _reset_routing_properties($new_route)
1199
+	{
1200
+		$this->_is_UI_request = true;
1201
+		// now we set the current route to whatever the headers_sent_route is set at
1202
+		$this->request->setRequestParam('action', $new_route);
1203
+		// rerun page setup
1204
+		$this->_page_setup();
1205
+	}
1206
+
1207
+
1208
+	/**
1209
+	 * _add_query_arg
1210
+	 * adds nonce to array of arguments then calls WP add_query_arg function
1211
+	 *(internally just uses EEH_URL's function with the same name)
1212
+	 *
1213
+	 * @param array  $args
1214
+	 * @param string $url
1215
+	 * @param bool   $sticky                  if true, then the existing Request params will be appended to the
1216
+	 *                                        generated url in an associative array indexed by the key 'wp_referer';
1217
+	 *                                        Example usage: If the current page is:
1218
+	 *                                        http://mydomain.com/wp-admin/admin.php?page=espresso_registrations
1219
+	 *                                        &action=default&event_id=20&month_range=March%202015
1220
+	 *                                        &_wpnonce=5467821
1221
+	 *                                        and you call:
1222
+	 *                                        EE_Admin_Page::add_query_args_and_nonce(
1223
+	 *                                        array(
1224
+	 *                                        'action' => 'resend_something',
1225
+	 *                                        'page=>espresso_registrations'
1226
+	 *                                        ),
1227
+	 *                                        $some_url,
1228
+	 *                                        true
1229
+	 *                                        );
1230
+	 *                                        It will produce a url in this structure:
1231
+	 *                                        http://{$some_url}/?page=espresso_registrations&action=resend_something
1232
+	 *                                        &wp_referer[action]=default&wp_referer[event_id]=20&wpreferer[
1233
+	 *                                        month_range]=March%202015
1234
+	 * @param bool   $exclude_nonce           If true, the the nonce will be excluded from the generated nonce.
1235
+	 * @return string
1236
+	 */
1237
+	public static function add_query_args_and_nonce(
1238
+		$args = [],
1239
+		$url = '',
1240
+		$sticky = false,
1241
+		$exclude_nonce = false
1242
+	) {
1243
+		// if there is a _wp_http_referer include the values from the request but only if sticky = true
1244
+		if ($sticky) {
1245
+			/** @var RequestInterface $request */
1246
+			$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
1247
+			$request->unSetRequestParams(['_wp_http_referer', 'wp_referer']);
1248
+			foreach ($request->requestParams() as $key => $value) {
1249
+				// do not add nonces
1250
+				if (strpos($key, 'nonce') !== false) {
1251
+					continue;
1252
+				}
1253
+				$args[ 'wp_referer[' . $key . ']' ] = is_string($value) ? htmlspecialchars($value) : $value;
1254
+			}
1255
+		}
1256
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1257
+	}
1258
+
1259
+
1260
+	/**
1261
+	 * This returns a generated link that will load the related help tab.
1262
+	 *
1263
+	 * @param string $help_tab_id the id for the connected help tab
1264
+	 * @param string $icon_style  (optional) include css class for the style you want to use for the help icon.
1265
+	 * @param string $help_text   (optional) send help text you want to use for the link if default not to be used
1266
+	 * @return string              generated link
1267
+	 * @uses EEH_Template::get_help_tab_link()
1268
+	 */
1269
+	protected function _get_help_tab_link($help_tab_id, $icon_style = '', $help_text = '')
1270
+	{
1271
+		return EEH_Template::get_help_tab_link(
1272
+			$help_tab_id,
1273
+			$this->page_slug,
1274
+			$this->_req_action,
1275
+			$icon_style,
1276
+			$help_text
1277
+		);
1278
+	}
1279
+
1280
+
1281
+	/**
1282
+	 * _add_help_tabs
1283
+	 * Note child classes define their help tabs within the page_config array.
1284
+	 *
1285
+	 * @link   http://codex.wordpress.org/Function_Reference/add_help_tab
1286
+	 * @return void
1287
+	 * @throws DomainException
1288
+	 * @throws EE_Error
1289
+	 * @throws ReflectionException
1290
+	 */
1291
+	protected function _add_help_tabs()
1292
+	{
1293
+		$tour_buttons = '';
1294
+		if (isset($this->_page_config[ $this->_req_action ])) {
1295
+			$config = $this->_page_config[ $this->_req_action ];
1296
+			// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
1297
+			// is there a help tour for the current route?  if there is let's setup the tour buttons
1298
+			// if (isset($this->_help_tour[ $this->_req_action ])) {
1299
+			//     $tb = array();
1300
+			//     $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1301
+			//     foreach ($this->_help_tour['tours'] as $tour) {
1302
+			//         // if this is the end tour then we don't need to setup a button
1303
+			//         if ($tour instanceof EE_Help_Tour_final_stop || ! $tour instanceof EE_Help_Tour) {
1304
+			//             continue;
1305
+			//         }
1306
+			//         $tb[] = '<button id="trigger-tour-'
1307
+			//                 . $tour->get_slug()
1308
+			//                 . '" class="button--primary trigger-ee-help-tour">'
1309
+			//                 . $tour->get_label()
1310
+			//                 . '</button>';
1311
+			//     }
1312
+			//     $tour_buttons .= implode('<br />', $tb);
1313
+			//     $tour_buttons .= '</div></div>';
1314
+			// }
1315
+			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1316
+			if (is_array($config) && isset($config['help_sidebar'])) {
1317
+				// check that the callback given is valid
1318
+				if (! method_exists($this, $config['help_sidebar'])) {
1319
+					throw new EE_Error(
1320
+						sprintf(
1321
+							esc_html__(
1322
+								'The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s',
1323
+								'event_espresso'
1324
+							),
1325
+							$config['help_sidebar'],
1326
+							get_class($this)
1327
+						)
1328
+					);
1329
+				}
1330
+				$content = apply_filters(
1331
+					'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1332
+					$this->{$config['help_sidebar']}()
1333
+				);
1334
+				$content .= $tour_buttons; // add help tour buttons.
1335
+				// do we have any help tours setup?  Cause if we do we want to add the buttons
1336
+				$this->_current_screen->set_help_sidebar($content);
1337
+			}
1338
+			// if there ARE tour buttons...
1339
+			if (! empty($tour_buttons)) {
1340
+				// if we DON'T have config help sidebar then we'll just add the tour buttons to the sidebar.
1341
+				if (! isset($config['help_sidebar'])) {
1342
+					$this->_current_screen->set_help_sidebar($tour_buttons);
1343
+				}
1344
+				// handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1345
+				if (! isset($config['help_tabs'])) {
1346
+					$_ht['id'] = $this->page_slug;
1347
+					$_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1348
+					$_ht['content'] = '<p>'
1349
+									  . esc_html__(
1350
+										  'The buttons to the right allow you to start/restart any help tours available for this page',
1351
+										  'event_espresso'
1352
+									  ) . '</p>';
1353
+					$this->_current_screen->add_help_tab($_ht);
1354
+				}
1355
+			}
1356
+			if (! isset($config['help_tabs'])) {
1357
+				return;
1358
+			} //no help tabs for this route
1359
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1360
+				// we're here so there ARE help tabs!
1361
+				// make sure we've got what we need
1362
+				if (! isset($cfg['title'])) {
1363
+					throw new EE_Error(
1364
+						esc_html__(
1365
+							'The _page_config array is not set up properly for help tabs.  It is missing a title',
1366
+							'event_espresso'
1367
+						)
1368
+					);
1369
+				}
1370
+				if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1371
+					throw new EE_Error(
1372
+						esc_html__(
1373
+							'The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab',
1374
+							'event_espresso'
1375
+						)
1376
+					);
1377
+				}
1378
+				// first priority goes to content.
1379
+				if (! empty($cfg['content'])) {
1380
+					$content = ! empty($cfg['content']) ? $cfg['content'] : null;
1381
+					// second priority goes to filename
1382
+				} elseif (! empty($cfg['filename'])) {
1383
+					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1384
+					// it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1385
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1386
+															 . basename($this->_get_dir())
1387
+															 . '/help_tabs/'
1388
+															 . $cfg['filename']
1389
+															 . '.help_tab.php' : $file_path;
1390
+					// if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1391
+					if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1392
+						EE_Error::add_error(
1393
+							sprintf(
1394
+								esc_html__(
1395
+									'The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s',
1396
+									'event_espresso'
1397
+								),
1398
+								$tab_id,
1399
+								key($config),
1400
+								$file_path
1401
+							),
1402
+							__FILE__,
1403
+							__FUNCTION__,
1404
+							__LINE__
1405
+						);
1406
+						return;
1407
+					}
1408
+					$template_args['admin_page_obj'] = $this;
1409
+					$content                         = EEH_Template::display_template(
1410
+						$file_path,
1411
+						$template_args,
1412
+						true
1413
+					);
1414
+				} else {
1415
+					$content = '';
1416
+				}
1417
+				// check if callback is valid
1418
+				if (
1419
+					empty($content)
1420
+					&& (
1421
+						! isset($cfg['callback']) || ! method_exists($this, $cfg['callback'])
1422
+					)
1423
+				) {
1424
+					EE_Error::add_error(
1425
+						sprintf(
1426
+							esc_html__(
1427
+								'The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.',
1428
+								'event_espresso'
1429
+							),
1430
+							$cfg['title']
1431
+						),
1432
+						__FILE__,
1433
+						__FUNCTION__,
1434
+						__LINE__
1435
+					);
1436
+					return;
1437
+				}
1438
+				// setup config array for help tab method
1439
+				$id  = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1440
+				$_ht = [
1441
+					'id'       => $id,
1442
+					'title'    => $cfg['title'],
1443
+					'callback' => isset($cfg['callback']) && empty($content) ? [$this, $cfg['callback']] : null,
1444
+					'content'  => $content,
1445
+				];
1446
+				$this->_current_screen->add_help_tab($_ht);
1447
+			}
1448
+		}
1449
+	}
1450
+
1451
+
1452
+	/**
1453
+	 * This basically checks loaded $_page_config property to see if there are any help_tours defined.  "help_tours" is
1454
+	 * an array with properties for setting up usage of the joyride plugin
1455
+	 *
1456
+	 * @link   http://zurb.com/playground/jquery-joyride-feature-tour-plugin
1457
+	 * @see    instructions regarding the format and construction of the "help_tour" array element is found in the
1458
+	 *         _set_page_config() comments
1459
+	 * @return void
1460
+	 * @throws InvalidArgumentException
1461
+	 * @throws InvalidDataTypeException
1462
+	 * @throws InvalidInterfaceException
1463
+	 * @throws ReflectionException
1464
+	 */
1465
+	protected function _add_help_tour()
1466
+	{
1467
+		// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
1468
+		// $tours = array();
1469
+		// $this->_help_tour = array();
1470
+		// // exit early if help tours are turned off globally
1471
+		// if ((defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)
1472
+		//     || ! EE_Registry::instance()->CFG->admin->help_tour_activation
1473
+		// ) {
1474
+		//     return;
1475
+		// }
1476
+		// // loop through _page_config to find any help_tour defined
1477
+		// foreach ($this->_page_config as $route => $config) {
1478
+		//     // we're only going to set things up for this route
1479
+		//     if ($route !== $this->_req_action) {
1480
+		//         continue;
1481
+		//     }
1482
+		//     if (isset($config['help_tour'])) {
1483
+		//         foreach ($config['help_tour'] as $tour) {
1484
+		//             $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1485
+		//             // let's see if we can get that file...
1486
+		//             // if not its possible this is a decaf route not set in caffeinated
1487
+		//             // so lets try and get the caffeinated equivalent
1488
+		//             $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1489
+		//                                                      . basename($this->_get_dir())
1490
+		//                                                      . '/help_tours/'
1491
+		//                                                      . $tour
1492
+		//                                                      . '.class.php' : $file_path;
1493
+		//             // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1494
+		//             if (! is_readable($file_path)) {
1495
+		//                 EE_Error::add_error(
1496
+		//                     sprintf(
1497
+		//                         esc_html__(
1498
+		//                             'The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling',
1499
+		//                             'event_espresso'
1500
+		//                         ),
1501
+		//                         $file_path,
1502
+		//                         $tour
1503
+		//                     ),
1504
+		//                     __FILE__,
1505
+		//                     __FUNCTION__,
1506
+		//                     __LINE__
1507
+		//                 );
1508
+		//                 return;
1509
+		//             }
1510
+		//             require_once $file_path;
1511
+		//             if (! class_exists($tour)) {
1512
+		//                 $error_msg[] = sprintf(
1513
+		//                     esc_html__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'),
1514
+		//                     $tour
1515
+		//                 );
1516
+		//                 $error_msg[] = $error_msg[0] . "\r\n"
1517
+		//                                . sprintf(
1518
+		//                                    esc_html__(
1519
+		//                                        'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.',
1520
+		//                                        'event_espresso'
1521
+		//                                    ),
1522
+		//                                    $tour,
1523
+		//                                    '<br />',
1524
+		//                                    $tour,
1525
+		//                                    $this->_req_action,
1526
+		//                                    get_class($this)
1527
+		//                                );
1528
+		//                 throw new EE_Error(implode('||', $error_msg));
1529
+		//             }
1530
+		//             $tour_obj = new $tour($this->_is_caf);
1531
+		//             $tours[] = $tour_obj;
1532
+		//             $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($tour_obj);
1533
+		//         }
1534
+		//         // let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1535
+		//         $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1536
+		//         $tours[] = $end_stop_tour;
1537
+		//         $this->_help_tour[ $route ][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1538
+		//     }
1539
+		// }
1540
+		//
1541
+		// if (! empty($tours)) {
1542
+		//     $this->_help_tour['tours'] = $tours;
1543
+		// }
1544
+		// // that's it!  Now that the $_help_tours property is set (or not)
1545
+		// // the scripts and html should be taken care of automatically.
1546
+		//
1547
+		// /**
1548
+		//  * Allow extending the help tours variable.
1549
+		//  *
1550
+		//  * @param Array $_help_tour The array containing all help tour information to be displayed.
1551
+		//  */
1552
+		// $this->_help_tour = apply_filters('FHEE__EE_Admin_Page___add_help_tour___help_tour', $this->_help_tour);
1553
+	}
1554
+
1555
+
1556
+	/**
1557
+	 * This simply sets up any qtips that have been defined in the page config
1558
+	 *
1559
+	 * @return void
1560
+	 * @throws ReflectionException
1561
+	 * @throws EE_Error
1562
+	 */
1563
+	protected function _add_qtips()
1564
+	{
1565
+		if (isset($this->_route_config['qtips'])) {
1566
+			$qtips = (array) $this->_route_config['qtips'];
1567
+			// load qtip loader
1568
+			$path = [
1569
+				$this->_get_dir() . '/qtips/',
1570
+				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1571
+			];
1572
+			EEH_Qtip_Loader::instance()->register($qtips, $path);
1573
+		}
1574
+	}
1575
+
1576
+
1577
+	/**
1578
+	 * _set_nav_tabs
1579
+	 * This sets up the nav tabs from the page_routes array.  This method can be overwritten by child classes if you
1580
+	 * wish to add additional tabs or modify accordingly.
1581
+	 *
1582
+	 * @return void
1583
+	 * @throws InvalidArgumentException
1584
+	 * @throws InvalidInterfaceException
1585
+	 * @throws InvalidDataTypeException
1586
+	 */
1587
+	protected function _set_nav_tabs()
1588
+	{
1589
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1590
+		$i = 0;
1591
+		foreach ($this->_page_config as $slug => $config) {
1592
+			if (! is_array($config) || empty($config['nav'])) {
1593
+				continue;
1594
+			}
1595
+			// no nav tab for this config
1596
+			// check for persistent flag
1597
+			if ($slug !== $this->_req_action && isset($config['nav']['persistent']) && ! $config['nav']['persistent']) {
1598
+				// nav tab is only to appear when route requested.
1599
+				continue;
1600
+			}
1601
+			if (! $this->check_user_access($slug, true)) {
1602
+				// no nav tab because current user does not have access.
1603
+				continue;
1604
+			}
1605
+			$css_class                = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1606
+			$this->_nav_tabs[ $slug ] = [
1607
+				'url'       => isset($config['nav']['url'])
1608
+					? $config['nav']['url']
1609
+					: EE_Admin_Page::add_query_args_and_nonce(
1610
+						['action' => $slug],
1611
+						$this->_admin_base_url
1612
+					),
1613
+				'link_text' => isset($config['nav']['label'])
1614
+					? $config['nav']['label']
1615
+					: ucwords(
1616
+						str_replace('_', ' ', $slug)
1617
+					),
1618
+				'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1619
+				'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1620
+			];
1621
+			$i++;
1622
+		}
1623
+		// if $this->_nav_tabs is empty then lets set the default
1624
+		if (empty($this->_nav_tabs)) {
1625
+			$this->_nav_tabs[ $this->_default_nav_tab_name ] = [
1626
+				'url'       => $this->_admin_base_url,
1627
+				'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1628
+				'css_class' => 'nav-tab-active',
1629
+				'order'     => 10,
1630
+			];
1631
+		}
1632
+		// now let's sort the tabs according to order
1633
+		usort($this->_nav_tabs, [$this, '_sort_nav_tabs']);
1634
+	}
1635
+
1636
+
1637
+	/**
1638
+	 * _set_current_labels
1639
+	 * This method modifies the _labels property with any optional specific labels indicated in the _page_routes
1640
+	 * property array
1641
+	 *
1642
+	 * @return void
1643
+	 */
1644
+	private function _set_current_labels()
1645
+	{
1646
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1647
+			foreach ($this->_route_config['labels'] as $label => $text) {
1648
+				if (is_array($text)) {
1649
+					foreach ($text as $sublabel => $subtext) {
1650
+						$this->_labels[ $label ][ $sublabel ] = $subtext;
1651
+					}
1652
+				} else {
1653
+					$this->_labels[ $label ] = $text;
1654
+				}
1655
+			}
1656
+		}
1657
+	}
1658
+
1659
+
1660
+	/**
1661
+	 *        verifies user access for this admin page
1662
+	 *
1663
+	 * @param string $route_to_check if present then the capability for the route matching this string is checked.
1664
+	 * @param bool   $verify_only    Default is FALSE which means if user check fails then wp_die().  Otherwise just
1665
+	 *                               return false if verify fail.
1666
+	 * @return bool
1667
+	 * @throws InvalidArgumentException
1668
+	 * @throws InvalidDataTypeException
1669
+	 * @throws InvalidInterfaceException
1670
+	 */
1671
+	public function check_user_access($route_to_check = '', $verify_only = false)
1672
+	{
1673
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1674
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1675
+		$capability     = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1676
+						  && is_array(
1677
+							  $this->_page_routes[ $route_to_check ]
1678
+						  )
1679
+						  && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1680
+			? $this->_page_routes[ $route_to_check ]['capability'] : null;
1681
+		if (empty($capability) && empty($route_to_check)) {
1682
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1683
+				: $this->_route['capability'];
1684
+		} else {
1685
+			$capability = empty($capability) ? 'manage_options' : $capability;
1686
+		}
1687
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1688
+		if (
1689
+			! $this->request->isAjax()
1690
+			&& (
1691
+				! function_exists('is_admin')
1692
+				|| ! EE_Registry::instance()->CAP->current_user_can(
1693
+					$capability,
1694
+					$this->page_slug
1695
+					. '_'
1696
+					. $route_to_check,
1697
+					$id
1698
+				)
1699
+			)
1700
+		) {
1701
+			if ($verify_only) {
1702
+				return false;
1703
+			}
1704
+			if (is_user_logged_in()) {
1705
+				wp_die(esc_html__('You do not have access to this route.', 'event_espresso'));
1706
+			} else {
1707
+				return false;
1708
+			}
1709
+		}
1710
+		return true;
1711
+	}
1712
+
1713
+
1714
+	protected function addMetaBox(
1715
+		$box_id,
1716
+		$title,
1717
+		$callback,
1718
+		$screen,
1719
+		$context = 'normal',
1720
+		$priority = 'default',
1721
+		$callback_args = null
1722
+	) {
1723
+		add_meta_box($box_id, $title, $callback, $screen, $context, $priority, $callback_args);
1724
+		add_filter(
1725
+			"postbox_classes_{$this->_wp_page_slug}_{$box_id}",
1726
+			function ($classes) {
1727
+				array_push($classes, 'ee-admin-container');
1728
+				return $classes;
1729
+			}
1730
+		);
1731
+	}
1732
+
1733
+
1734
+	/**
1735
+	 * admin_init_global
1736
+	 * This runs all the code that we want executed within the WP admin_init hook.
1737
+	 * This method executes for ALL EE Admin pages.
1738
+	 *
1739
+	 * @return void
1740
+	 */
1741
+	public function admin_init_global()
1742
+	{
1743
+	}
1744
+
1745
+
1746
+	/**
1747
+	 * wp_loaded_global
1748
+	 * This runs all the code that we want executed within the WP wp_loaded hook.  This method is optional for an
1749
+	 * EE_Admin page and will execute on every EE Admin Page load
1750
+	 *
1751
+	 * @return void
1752
+	 */
1753
+	public function wp_loaded()
1754
+	{
1755
+	}
1756
+
1757
+
1758
+	/**
1759
+	 * admin_notices
1760
+	 * Anything triggered by the 'admin_notices' WP hook should be put in here.  This particular method will apply on
1761
+	 * ALL EE_Admin pages.
1762
+	 *
1763
+	 * @return void
1764
+	 */
1765
+	public function admin_notices_global()
1766
+	{
1767
+		$this->_display_no_javascript_warning();
1768
+		$this->_display_espresso_notices();
1769
+	}
1770
+
1771
+
1772
+	public function network_admin_notices_global()
1773
+	{
1774
+		$this->_display_no_javascript_warning();
1775
+		$this->_display_espresso_notices();
1776
+	}
1777
+
1778
+
1779
+	/**
1780
+	 * admin_footer_scripts_global
1781
+	 * Anything triggered by the 'admin_print_footer_scripts' WP hook should be put in here. This particular method
1782
+	 * will apply on ALL EE_Admin pages.
1783
+	 *
1784
+	 * @return void
1785
+	 */
1786
+	public function admin_footer_scripts_global()
1787
+	{
1788
+		$this->_add_admin_page_ajax_loading_img();
1789
+		$this->_add_admin_page_overlay();
1790
+		// if metaboxes are present we need to add the nonce field
1791
+		if (
1792
+			isset($this->_route_config['metaboxes'])
1793
+			|| isset($this->_route_config['list_table'])
1794
+			|| (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'])
1795
+		) {
1796
+			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1797
+			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1798
+		}
1799
+	}
1800
+
1801
+
1802
+	/**
1803
+	 * admin_footer_global
1804
+	 * Anything triggered by the wp 'admin_footer' wp hook should be put in here.
1805
+	 * This particular method will apply on ALL EE_Admin Pages.
1806
+	 *
1807
+	 * @return void
1808
+	 */
1809
+	public function admin_footer_global()
1810
+	{
1811
+		// dialog container for dialog helper
1812
+		echo '
1813 1813
         <div class="ee-admin-dialog-container auto-hide hidden">
1814 1814
             <div class="ee-notices"></div>
1815 1815
             <div class="ee-admin-dialog-container-inner-content"></div>
1816 1816
         </div>
1817 1817
         ';
1818 1818
 
1819
-        // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
1820
-        // help tour stuff?
1821
-        // if (isset($this->_help_tour[ $this->_req_action ])) {
1822
-        //     echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1823
-        // }
1824
-        // current set timezone for timezone js
1825
-        echo '<span id="current_timezone" class="hidden">' . esc_html(EEH_DTT_Helper::get_timezone()) . '</span>';
1826
-    }
1827
-
1828
-
1829
-    /**
1830
-     * This function sees if there is a method for help popup content existing for the given route.  If there is then
1831
-     * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1832
-     * help popups then in your templates or your content you set "triggers" for the content using the
1833
-     * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1834
-     * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1835
-     * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1836
-     * for the
1837
-     * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1838
-     * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1839
-     *    'help_trigger_id' => array(
1840
-     *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1841
-     *        'content' => esc_html__('localized content for popup', 'event_espresso')
1842
-     *    )
1843
-     * );
1844
-     * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1845
-     *
1846
-     * @param array $help_array
1847
-     * @param bool  $display
1848
-     * @return string content
1849
-     * @throws DomainException
1850
-     * @throws EE_Error
1851
-     */
1852
-    protected function _set_help_popup_content($help_array = [], $display = false)
1853
-    {
1854
-        $content    = '';
1855
-        $help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1856
-        // loop through the array and setup content
1857
-        foreach ($help_array as $trigger => $help) {
1858
-            // make sure the array is setup properly
1859
-            if (! isset($help['title'], $help['content'])) {
1860
-                throw new EE_Error(
1861
-                    esc_html__(
1862
-                        'Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class',
1863
-                        'event_espresso'
1864
-                    )
1865
-                );
1866
-            }
1867
-            // we're good so let's setup the template vars and then assign parsed template content to our content.
1868
-            $template_args = [
1869
-                'help_popup_id'      => $trigger,
1870
-                'help_popup_title'   => $help['title'],
1871
-                'help_popup_content' => $help['content'],
1872
-            ];
1873
-            $content       .= EEH_Template::display_template(
1874
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1875
-                $template_args,
1876
-                true
1877
-            );
1878
-        }
1879
-        if ($display) {
1880
-            echo $content; // already escaped
1881
-            return '';
1882
-        }
1883
-        return $content;
1884
-    }
1885
-
1886
-
1887
-    /**
1888
-     * All this does is retrieve the help content array if set by the EE_Admin_Page child
1889
-     *
1890
-     * @return array properly formatted array for help popup content
1891
-     * @throws EE_Error
1892
-     */
1893
-    private function _get_help_content()
1894
-    {
1895
-        // what is the method we're looking for?
1896
-        $method_name = '_help_popup_content_' . $this->_req_action;
1897
-        // if method doesn't exist let's get out.
1898
-        if (! method_exists($this, $method_name)) {
1899
-            return [];
1900
-        }
1901
-        // k we're good to go let's retrieve the help array
1902
-        $help_array = $this->{$method_name}();
1903
-        // make sure we've got an array!
1904
-        if (! is_array($help_array)) {
1905
-            throw new EE_Error(
1906
-                esc_html__(
1907
-                    'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1908
-                    'event_espresso'
1909
-                )
1910
-            );
1911
-        }
1912
-        return $help_array;
1913
-    }
1914
-
1915
-
1916
-    /**
1917
-     * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1918
-     * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1919
-     * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1920
-     *
1921
-     * @param string  $trigger_id reference for retrieving the trigger content for the popup
1922
-     * @param boolean $display    if false then we return the trigger string
1923
-     * @param array   $dimensions an array of dimensions for the box (array(h,w))
1924
-     * @return string
1925
-     * @throws DomainException
1926
-     * @throws EE_Error
1927
-     */
1928
-    protected function _set_help_trigger($trigger_id, $display = true, $dimensions = ['400', '640'])
1929
-    {
1930
-        if ($this->request->isAjax()) {
1931
-            return '';
1932
-        }
1933
-        // let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1934
-        $help_array   = $this->_get_help_content();
1935
-        $help_content = '';
1936
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1937
-            $help_array[ $trigger_id ] = [
1938
-                'title'   => esc_html__('Missing Content', 'event_espresso'),
1939
-                'content' => esc_html__(
1940
-                    'A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)',
1941
-                    'event_espresso'
1942
-                ),
1943
-            ];
1944
-            $help_content = $this->_set_help_popup_content($help_array);
1945
-        }
1946
-        // let's setup the trigger
1947
-        $content = '<a class="ee-dialog" href="?height='
1948
-                   . esc_attr($dimensions[0])
1949
-                   . '&width='
1950
-                   . esc_attr($dimensions[1])
1951
-                   . '&inlineId='
1952
-                   . esc_attr($trigger_id)
1953
-                   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1954
-        $content .= $help_content;
1955
-        if ($display) {
1956
-            echo $content; // already escaped
1957
-            return '';
1958
-        }
1959
-        return $content;
1960
-    }
1961
-
1962
-
1963
-    /**
1964
-     * _add_global_screen_options
1965
-     * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1966
-     * This particular method will add_screen_options on ALL EE_Admin Pages
1967
-     *
1968
-     * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1969
-     *         see also WP_Screen object documents...
1970
-     * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1971
-     * @abstract
1972
-     * @return void
1973
-     */
1974
-    private function _add_global_screen_options()
1975
-    {
1976
-    }
1977
-
1978
-
1979
-    /**
1980
-     * _add_global_feature_pointers
1981
-     * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1982
-     * This particular method will implement feature pointers for ALL EE_Admin pages.
1983
-     * Note: this is just a placeholder for now.  Implementation will come down the road
1984
-     *
1985
-     * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1986
-     *         extended) also see:
1987
-     * @link   http://eamann.com/tech/wordpress-portland/
1988
-     * @abstract
1989
-     * @return void
1990
-     */
1991
-    private function _add_global_feature_pointers()
1992
-    {
1993
-    }
1994
-
1995
-
1996
-    /**
1997
-     * load_global_scripts_styles
1998
-     * The scripts and styles enqueued in here will be loaded on every EE Admin page
1999
-     *
2000
-     * @return void
2001
-     */
2002
-    public function load_global_scripts_styles()
2003
-    {
2004
-        // add debugging styles
2005
-        if (WP_DEBUG) {
2006
-            add_action('admin_head', [$this, 'add_xdebug_style']);
2007
-        }
2008
-        // taking care of metaboxes
2009
-        if (
2010
-            empty($this->_cpt_route)
2011
-            && (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
2012
-        ) {
2013
-            wp_enqueue_script('dashboard');
2014
-        }
2015
-
2016
-        wp_enqueue_script(EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN);
2017
-        // LOCALIZED DATA
2018
-        // localize script for ajax lazy loading
2019
-        wp_localize_script(
2020
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
2021
-            'eeLazyLoadingContainers',
2022
-            apply_filters(
2023
-                'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
2024
-                ['espresso_news_post_box_content']
2025
-            )
2026
-        );
2027
-        // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
2028
-        // /**
2029
-        //  * help tour stuff
2030
-        //  */
2031
-        // if (! empty($this->_help_tour)) {
2032
-        //     // register the js for kicking things off
2033
-        //     wp_enqueue_script(
2034
-        //         'ee-help-tour',
2035
-        //         EE_ADMIN_URL . 'assets/ee-help-tour.js',
2036
-        //         array('jquery-joyride'),
2037
-        //         EVENT_ESPRESSO_VERSION,
2038
-        //         true
2039
-        //     );
2040
-        //     $tours = array();
2041
-        //     // setup tours for the js tour object
2042
-        //     foreach ($this->_help_tour['tours'] as $tour) {
2043
-        //         if ($tour instanceof EE_Help_Tour) {
2044
-        //             $tours[] = array(
2045
-        //                 'id'      => $tour->get_slug(),
2046
-        //                 'options' => $tour->get_options(),
2047
-        //             );
2048
-        //         }
2049
-        //     }
2050
-        //     wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
2051
-        //     // admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
2052
-        // }
2053
-
2054
-        add_filter(
2055
-            'admin_body_class',
2056
-            function ($classes) {
2057
-                if (strpos($classes, 'espresso-admin') === false) {
2058
-                    $classes .= ' espresso-admin';
2059
-                }
2060
-                return $classes;
2061
-            }
2062
-        );
2063
-    }
2064
-
2065
-
2066
-    /**
2067
-     *        admin_footer_scripts_eei18n_js_strings
2068
-     *
2069
-     * @return        void
2070
-     */
2071
-    public function admin_footer_scripts_eei18n_js_strings()
2072
-    {
2073
-        EE_Registry::$i18n_js_strings['ajax_url']       = WP_AJAX_URL;
2074
-        EE_Registry::$i18n_js_strings['confirm_delete'] = wp_strip_all_tags(
2075
-            __(
2076
-                'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!',
2077
-                'event_espresso'
2078
-            )
2079
-        );
2080
-        EE_Registry::$i18n_js_strings['January']        = wp_strip_all_tags(__('January', 'event_espresso'));
2081
-        EE_Registry::$i18n_js_strings['February']       = wp_strip_all_tags(__('February', 'event_espresso'));
2082
-        EE_Registry::$i18n_js_strings['March']          = wp_strip_all_tags(__('March', 'event_espresso'));
2083
-        EE_Registry::$i18n_js_strings['April']          = wp_strip_all_tags(__('April', 'event_espresso'));
2084
-        EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
2085
-        EE_Registry::$i18n_js_strings['June']           = wp_strip_all_tags(__('June', 'event_espresso'));
2086
-        EE_Registry::$i18n_js_strings['July']           = wp_strip_all_tags(__('July', 'event_espresso'));
2087
-        EE_Registry::$i18n_js_strings['August']         = wp_strip_all_tags(__('August', 'event_espresso'));
2088
-        EE_Registry::$i18n_js_strings['September']      = wp_strip_all_tags(__('September', 'event_espresso'));
2089
-        EE_Registry::$i18n_js_strings['October']        = wp_strip_all_tags(__('October', 'event_espresso'));
2090
-        EE_Registry::$i18n_js_strings['November']       = wp_strip_all_tags(__('November', 'event_espresso'));
2091
-        EE_Registry::$i18n_js_strings['December']       = wp_strip_all_tags(__('December', 'event_espresso'));
2092
-        EE_Registry::$i18n_js_strings['Jan']            = wp_strip_all_tags(__('Jan', 'event_espresso'));
2093
-        EE_Registry::$i18n_js_strings['Feb']            = wp_strip_all_tags(__('Feb', 'event_espresso'));
2094
-        EE_Registry::$i18n_js_strings['Mar']            = wp_strip_all_tags(__('Mar', 'event_espresso'));
2095
-        EE_Registry::$i18n_js_strings['Apr']            = wp_strip_all_tags(__('Apr', 'event_espresso'));
2096
-        EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
2097
-        EE_Registry::$i18n_js_strings['Jun']            = wp_strip_all_tags(__('Jun', 'event_espresso'));
2098
-        EE_Registry::$i18n_js_strings['Jul']            = wp_strip_all_tags(__('Jul', 'event_espresso'));
2099
-        EE_Registry::$i18n_js_strings['Aug']            = wp_strip_all_tags(__('Aug', 'event_espresso'));
2100
-        EE_Registry::$i18n_js_strings['Sep']            = wp_strip_all_tags(__('Sep', 'event_espresso'));
2101
-        EE_Registry::$i18n_js_strings['Oct']            = wp_strip_all_tags(__('Oct', 'event_espresso'));
2102
-        EE_Registry::$i18n_js_strings['Nov']            = wp_strip_all_tags(__('Nov', 'event_espresso'));
2103
-        EE_Registry::$i18n_js_strings['Dec']            = wp_strip_all_tags(__('Dec', 'event_espresso'));
2104
-        EE_Registry::$i18n_js_strings['Sunday']         = wp_strip_all_tags(__('Sunday', 'event_espresso'));
2105
-        EE_Registry::$i18n_js_strings['Monday']         = wp_strip_all_tags(__('Monday', 'event_espresso'));
2106
-        EE_Registry::$i18n_js_strings['Tuesday']        = wp_strip_all_tags(__('Tuesday', 'event_espresso'));
2107
-        EE_Registry::$i18n_js_strings['Wednesday']      = wp_strip_all_tags(__('Wednesday', 'event_espresso'));
2108
-        EE_Registry::$i18n_js_strings['Thursday']       = wp_strip_all_tags(__('Thursday', 'event_espresso'));
2109
-        EE_Registry::$i18n_js_strings['Friday']         = wp_strip_all_tags(__('Friday', 'event_espresso'));
2110
-        EE_Registry::$i18n_js_strings['Saturday']       = wp_strip_all_tags(__('Saturday', 'event_espresso'));
2111
-        EE_Registry::$i18n_js_strings['Sun']            = wp_strip_all_tags(__('Sun', 'event_espresso'));
2112
-        EE_Registry::$i18n_js_strings['Mon']            = wp_strip_all_tags(__('Mon', 'event_espresso'));
2113
-        EE_Registry::$i18n_js_strings['Tue']            = wp_strip_all_tags(__('Tue', 'event_espresso'));
2114
-        EE_Registry::$i18n_js_strings['Wed']            = wp_strip_all_tags(__('Wed', 'event_espresso'));
2115
-        EE_Registry::$i18n_js_strings['Thu']            = wp_strip_all_tags(__('Thu', 'event_espresso'));
2116
-        EE_Registry::$i18n_js_strings['Fri']            = wp_strip_all_tags(__('Fri', 'event_espresso'));
2117
-        EE_Registry::$i18n_js_strings['Sat']            = wp_strip_all_tags(__('Sat', 'event_espresso'));
2118
-    }
2119
-
2120
-
2121
-    /**
2122
-     *        load enhanced xdebug styles for ppl with failing eyesight
2123
-     *
2124
-     * @return        void
2125
-     */
2126
-    public function add_xdebug_style()
2127
-    {
2128
-        echo '<style>.xdebug-error { font-size:1.5em; }</style>';
2129
-    }
2130
-
2131
-
2132
-    /************************/
2133
-    /** LIST TABLE METHODS **/
2134
-    /************************/
2135
-    /**
2136
-     * this sets up the list table if the current view requires it.
2137
-     *
2138
-     * @return void
2139
-     * @throws EE_Error
2140
-     * @throws InvalidArgumentException
2141
-     * @throws InvalidDataTypeException
2142
-     * @throws InvalidInterfaceException
2143
-     */
2144
-    protected function _set_list_table()
2145
-    {
2146
-        // first is this a list_table view?
2147
-        if (! isset($this->_route_config['list_table'])) {
2148
-            return;
2149
-        } //not a list_table view so get out.
2150
-        // list table functions are per view specific (because some admin pages might have more than one list table!)
2151
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
2152
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2153
-            // user error msg
2154
-            $error_msg = esc_html__(
2155
-                'An error occurred. The requested list table views could not be found.',
2156
-                'event_espresso'
2157
-            );
2158
-            // developer error msg
2159
-            $error_msg .= '||'
2160
-                          . sprintf(
2161
-                              esc_html__(
2162
-                                  'List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.',
2163
-                                  'event_espresso'
2164
-                              ),
2165
-                              $this->_req_action,
2166
-                              $list_table_view
2167
-                          );
2168
-            throw new EE_Error($error_msg);
2169
-        }
2170
-        // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2171
-        $this->_views = apply_filters(
2172
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2173
-            $this->_views
2174
-        );
2175
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2176
-        $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2177
-        $this->_set_list_table_view();
2178
-        $this->_set_list_table_object();
2179
-    }
2180
-
2181
-
2182
-    /**
2183
-     * set current view for List Table
2184
-     *
2185
-     * @return void
2186
-     */
2187
-    protected function _set_list_table_view()
2188
-    {
2189
-        $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2190
-        $status = $this->request->getRequestParam('status', null, 'key');
2191
-        $this->_view = $status && array_key_exists($status, $this->_views)
2192
-            ? $status
2193
-            : $this->_view;
2194
-    }
2195
-
2196
-
2197
-    /**
2198
-     * _set_list_table_object
2199
-     * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
2200
-     *
2201
-     * @throws InvalidInterfaceException
2202
-     * @throws InvalidArgumentException
2203
-     * @throws InvalidDataTypeException
2204
-     * @throws EE_Error
2205
-     * @throws InvalidInterfaceException
2206
-     */
2207
-    protected function _set_list_table_object()
2208
-    {
2209
-        if (isset($this->_route_config['list_table'])) {
2210
-            if (! class_exists($this->_route_config['list_table'])) {
2211
-                throw new EE_Error(
2212
-                    sprintf(
2213
-                        esc_html__(
2214
-                            'The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.',
2215
-                            'event_espresso'
2216
-                        ),
2217
-                        $this->_route_config['list_table'],
2218
-                        get_class($this)
2219
-                    )
2220
-                );
2221
-            }
2222
-            $this->_list_table_object = $this->loader->getShared(
2223
-                $this->_route_config['list_table'],
2224
-                [$this]
2225
-            );
2226
-        }
2227
-    }
2228
-
2229
-
2230
-    /**
2231
-     * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2232
-     *
2233
-     * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2234
-     *                                                    urls.  The array should be indexed by the view it is being
2235
-     *                                                    added to.
2236
-     * @return array
2237
-     */
2238
-    public function get_list_table_view_RLs($extra_query_args = [])
2239
-    {
2240
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2241
-        if (empty($this->_views)) {
2242
-            $this->_views = [];
2243
-        }
2244
-        // cycle thru views
2245
-        foreach ($this->_views as $key => $view) {
2246
-            $query_args = [];
2247
-            // check for current view
2248
-            $this->_views[ $key ]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2249
-            $query_args['action']                        = $this->_req_action;
2250
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2251
-            $query_args['status']                        = $view['slug'];
2252
-            // merge any other arguments sent in.
2253
-            if (isset($extra_query_args[ $view['slug'] ])) {
2254
-                foreach ($extra_query_args[ $view['slug'] ] as $extra_query_arg) {
2255
-                    $query_args[] = $extra_query_arg;
2256
-                }
2257
-            }
2258
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2259
-        }
2260
-        return $this->_views;
2261
-    }
2262
-
2263
-
2264
-    /**
2265
-     * _entries_per_page_dropdown
2266
-     * generates a dropdown box for selecting the number of visible rows in an admin page list table
2267
-     *
2268
-     * @param int $max_entries total number of rows in the table
2269
-     * @return string
2270
-     * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2271
-     *         WP does it.
2272
-     */
2273
-    protected function _entries_per_page_dropdown($max_entries = 0)
2274
-    {
2275
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2276
-        $values   = [10, 25, 50, 100];
2277
-        $per_page = $this->request->getRequestParam('per_page', 10, 'int');
2278
-        if ($max_entries) {
2279
-            $values[] = $max_entries;
2280
-            sort($values);
2281
-        }
2282
-        $entries_per_page_dropdown = '
1819
+		// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
1820
+		// help tour stuff?
1821
+		// if (isset($this->_help_tour[ $this->_req_action ])) {
1822
+		//     echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1823
+		// }
1824
+		// current set timezone for timezone js
1825
+		echo '<span id="current_timezone" class="hidden">' . esc_html(EEH_DTT_Helper::get_timezone()) . '</span>';
1826
+	}
1827
+
1828
+
1829
+	/**
1830
+	 * This function sees if there is a method for help popup content existing for the given route.  If there is then
1831
+	 * we'll use the retrieved array to output the content using the template. For child classes: If you want to have
1832
+	 * help popups then in your templates or your content you set "triggers" for the content using the
1833
+	 * "_set_help_trigger('help_trigger_id')" where "help_trigger_id" is what you will use later in your custom method
1834
+	 * for the help popup content on that page. Then in your Child_Admin_Page class you need to define a help popup
1835
+	 * method for the content in the format "_help_popup_content_{route_name}()"  So if you are setting help content
1836
+	 * for the
1837
+	 * 'edit_event' route you should have a method named "_help_popup_content_edit_route". In your defined
1838
+	 * "help_popup_content_..." method.  You must prepare and return an array in the following format array(
1839
+	 *    'help_trigger_id' => array(
1840
+	 *        'title' => esc_html__('localized title for popup', 'event_espresso'),
1841
+	 *        'content' => esc_html__('localized content for popup', 'event_espresso')
1842
+	 *    )
1843
+	 * );
1844
+	 * Then the EE_Admin_Parent will take care of making sure that is setup properly on the correct route.
1845
+	 *
1846
+	 * @param array $help_array
1847
+	 * @param bool  $display
1848
+	 * @return string content
1849
+	 * @throws DomainException
1850
+	 * @throws EE_Error
1851
+	 */
1852
+	protected function _set_help_popup_content($help_array = [], $display = false)
1853
+	{
1854
+		$content    = '';
1855
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1856
+		// loop through the array and setup content
1857
+		foreach ($help_array as $trigger => $help) {
1858
+			// make sure the array is setup properly
1859
+			if (! isset($help['title'], $help['content'])) {
1860
+				throw new EE_Error(
1861
+					esc_html__(
1862
+						'Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class',
1863
+						'event_espresso'
1864
+					)
1865
+				);
1866
+			}
1867
+			// we're good so let's setup the template vars and then assign parsed template content to our content.
1868
+			$template_args = [
1869
+				'help_popup_id'      => $trigger,
1870
+				'help_popup_title'   => $help['title'],
1871
+				'help_popup_content' => $help['content'],
1872
+			];
1873
+			$content       .= EEH_Template::display_template(
1874
+				EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1875
+				$template_args,
1876
+				true
1877
+			);
1878
+		}
1879
+		if ($display) {
1880
+			echo $content; // already escaped
1881
+			return '';
1882
+		}
1883
+		return $content;
1884
+	}
1885
+
1886
+
1887
+	/**
1888
+	 * All this does is retrieve the help content array if set by the EE_Admin_Page child
1889
+	 *
1890
+	 * @return array properly formatted array for help popup content
1891
+	 * @throws EE_Error
1892
+	 */
1893
+	private function _get_help_content()
1894
+	{
1895
+		// what is the method we're looking for?
1896
+		$method_name = '_help_popup_content_' . $this->_req_action;
1897
+		// if method doesn't exist let's get out.
1898
+		if (! method_exists($this, $method_name)) {
1899
+			return [];
1900
+		}
1901
+		// k we're good to go let's retrieve the help array
1902
+		$help_array = $this->{$method_name}();
1903
+		// make sure we've got an array!
1904
+		if (! is_array($help_array)) {
1905
+			throw new EE_Error(
1906
+				esc_html__(
1907
+					'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
1908
+					'event_espresso'
1909
+				)
1910
+			);
1911
+		}
1912
+		return $help_array;
1913
+	}
1914
+
1915
+
1916
+	/**
1917
+	 * EE Admin Pages can use this to set a properly formatted trigger for a help popup.
1918
+	 * By default the trigger html is printed.  Otherwise it can be returned if the $display flag is set "false"
1919
+	 * See comments made on the _set_help_content method for understanding other parts to the help popup tool.
1920
+	 *
1921
+	 * @param string  $trigger_id reference for retrieving the trigger content for the popup
1922
+	 * @param boolean $display    if false then we return the trigger string
1923
+	 * @param array   $dimensions an array of dimensions for the box (array(h,w))
1924
+	 * @return string
1925
+	 * @throws DomainException
1926
+	 * @throws EE_Error
1927
+	 */
1928
+	protected function _set_help_trigger($trigger_id, $display = true, $dimensions = ['400', '640'])
1929
+	{
1930
+		if ($this->request->isAjax()) {
1931
+			return '';
1932
+		}
1933
+		// let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1934
+		$help_array   = $this->_get_help_content();
1935
+		$help_content = '';
1936
+		if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1937
+			$help_array[ $trigger_id ] = [
1938
+				'title'   => esc_html__('Missing Content', 'event_espresso'),
1939
+				'content' => esc_html__(
1940
+					'A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)',
1941
+					'event_espresso'
1942
+				),
1943
+			];
1944
+			$help_content = $this->_set_help_popup_content($help_array);
1945
+		}
1946
+		// let's setup the trigger
1947
+		$content = '<a class="ee-dialog" href="?height='
1948
+				   . esc_attr($dimensions[0])
1949
+				   . '&width='
1950
+				   . esc_attr($dimensions[1])
1951
+				   . '&inlineId='
1952
+				   . esc_attr($trigger_id)
1953
+				   . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1954
+		$content .= $help_content;
1955
+		if ($display) {
1956
+			echo $content; // already escaped
1957
+			return '';
1958
+		}
1959
+		return $content;
1960
+	}
1961
+
1962
+
1963
+	/**
1964
+	 * _add_global_screen_options
1965
+	 * Add any extra wp_screen_options within this method using built-in WP functions/methods for doing so.
1966
+	 * This particular method will add_screen_options on ALL EE_Admin Pages
1967
+	 *
1968
+	 * @link   http://chrismarslender.com/wp-tutorials/wordpress-screen-options-tutorial/
1969
+	 *         see also WP_Screen object documents...
1970
+	 * @link   http://codex.wordpress.org/Class_Reference/WP_Screen
1971
+	 * @abstract
1972
+	 * @return void
1973
+	 */
1974
+	private function _add_global_screen_options()
1975
+	{
1976
+	}
1977
+
1978
+
1979
+	/**
1980
+	 * _add_global_feature_pointers
1981
+	 * This method is used for implementing any "feature pointers" (using built-in WP styling js).
1982
+	 * This particular method will implement feature pointers for ALL EE_Admin pages.
1983
+	 * Note: this is just a placeholder for now.  Implementation will come down the road
1984
+	 *
1985
+	 * @see    WP_Internal_Pointers class in wp-admin/includes/template.php for example (its a final class so can't be
1986
+	 *         extended) also see:
1987
+	 * @link   http://eamann.com/tech/wordpress-portland/
1988
+	 * @abstract
1989
+	 * @return void
1990
+	 */
1991
+	private function _add_global_feature_pointers()
1992
+	{
1993
+	}
1994
+
1995
+
1996
+	/**
1997
+	 * load_global_scripts_styles
1998
+	 * The scripts and styles enqueued in here will be loaded on every EE Admin page
1999
+	 *
2000
+	 * @return void
2001
+	 */
2002
+	public function load_global_scripts_styles()
2003
+	{
2004
+		// add debugging styles
2005
+		if (WP_DEBUG) {
2006
+			add_action('admin_head', [$this, 'add_xdebug_style']);
2007
+		}
2008
+		// taking care of metaboxes
2009
+		if (
2010
+			empty($this->_cpt_route)
2011
+			&& (isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes']))
2012
+		) {
2013
+			wp_enqueue_script('dashboard');
2014
+		}
2015
+
2016
+		wp_enqueue_script(EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN);
2017
+		// LOCALIZED DATA
2018
+		// localize script for ajax lazy loading
2019
+		wp_localize_script(
2020
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
2021
+			'eeLazyLoadingContainers',
2022
+			apply_filters(
2023
+				'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers',
2024
+				['espresso_news_post_box_content']
2025
+			)
2026
+		);
2027
+		// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
2028
+		// /**
2029
+		//  * help tour stuff
2030
+		//  */
2031
+		// if (! empty($this->_help_tour)) {
2032
+		//     // register the js for kicking things off
2033
+		//     wp_enqueue_script(
2034
+		//         'ee-help-tour',
2035
+		//         EE_ADMIN_URL . 'assets/ee-help-tour.js',
2036
+		//         array('jquery-joyride'),
2037
+		//         EVENT_ESPRESSO_VERSION,
2038
+		//         true
2039
+		//     );
2040
+		//     $tours = array();
2041
+		//     // setup tours for the js tour object
2042
+		//     foreach ($this->_help_tour['tours'] as $tour) {
2043
+		//         if ($tour instanceof EE_Help_Tour) {
2044
+		//             $tours[] = array(
2045
+		//                 'id'      => $tour->get_slug(),
2046
+		//                 'options' => $tour->get_options(),
2047
+		//             );
2048
+		//         }
2049
+		//     }
2050
+		//     wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
2051
+		//     // admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
2052
+		// }
2053
+
2054
+		add_filter(
2055
+			'admin_body_class',
2056
+			function ($classes) {
2057
+				if (strpos($classes, 'espresso-admin') === false) {
2058
+					$classes .= ' espresso-admin';
2059
+				}
2060
+				return $classes;
2061
+			}
2062
+		);
2063
+	}
2064
+
2065
+
2066
+	/**
2067
+	 *        admin_footer_scripts_eei18n_js_strings
2068
+	 *
2069
+	 * @return        void
2070
+	 */
2071
+	public function admin_footer_scripts_eei18n_js_strings()
2072
+	{
2073
+		EE_Registry::$i18n_js_strings['ajax_url']       = WP_AJAX_URL;
2074
+		EE_Registry::$i18n_js_strings['confirm_delete'] = wp_strip_all_tags(
2075
+			__(
2076
+				'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!',
2077
+				'event_espresso'
2078
+			)
2079
+		);
2080
+		EE_Registry::$i18n_js_strings['January']        = wp_strip_all_tags(__('January', 'event_espresso'));
2081
+		EE_Registry::$i18n_js_strings['February']       = wp_strip_all_tags(__('February', 'event_espresso'));
2082
+		EE_Registry::$i18n_js_strings['March']          = wp_strip_all_tags(__('March', 'event_espresso'));
2083
+		EE_Registry::$i18n_js_strings['April']          = wp_strip_all_tags(__('April', 'event_espresso'));
2084
+		EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
2085
+		EE_Registry::$i18n_js_strings['June']           = wp_strip_all_tags(__('June', 'event_espresso'));
2086
+		EE_Registry::$i18n_js_strings['July']           = wp_strip_all_tags(__('July', 'event_espresso'));
2087
+		EE_Registry::$i18n_js_strings['August']         = wp_strip_all_tags(__('August', 'event_espresso'));
2088
+		EE_Registry::$i18n_js_strings['September']      = wp_strip_all_tags(__('September', 'event_espresso'));
2089
+		EE_Registry::$i18n_js_strings['October']        = wp_strip_all_tags(__('October', 'event_espresso'));
2090
+		EE_Registry::$i18n_js_strings['November']       = wp_strip_all_tags(__('November', 'event_espresso'));
2091
+		EE_Registry::$i18n_js_strings['December']       = wp_strip_all_tags(__('December', 'event_espresso'));
2092
+		EE_Registry::$i18n_js_strings['Jan']            = wp_strip_all_tags(__('Jan', 'event_espresso'));
2093
+		EE_Registry::$i18n_js_strings['Feb']            = wp_strip_all_tags(__('Feb', 'event_espresso'));
2094
+		EE_Registry::$i18n_js_strings['Mar']            = wp_strip_all_tags(__('Mar', 'event_espresso'));
2095
+		EE_Registry::$i18n_js_strings['Apr']            = wp_strip_all_tags(__('Apr', 'event_espresso'));
2096
+		EE_Registry::$i18n_js_strings['May']            = wp_strip_all_tags(__('May', 'event_espresso'));
2097
+		EE_Registry::$i18n_js_strings['Jun']            = wp_strip_all_tags(__('Jun', 'event_espresso'));
2098
+		EE_Registry::$i18n_js_strings['Jul']            = wp_strip_all_tags(__('Jul', 'event_espresso'));
2099
+		EE_Registry::$i18n_js_strings['Aug']            = wp_strip_all_tags(__('Aug', 'event_espresso'));
2100
+		EE_Registry::$i18n_js_strings['Sep']            = wp_strip_all_tags(__('Sep', 'event_espresso'));
2101
+		EE_Registry::$i18n_js_strings['Oct']            = wp_strip_all_tags(__('Oct', 'event_espresso'));
2102
+		EE_Registry::$i18n_js_strings['Nov']            = wp_strip_all_tags(__('Nov', 'event_espresso'));
2103
+		EE_Registry::$i18n_js_strings['Dec']            = wp_strip_all_tags(__('Dec', 'event_espresso'));
2104
+		EE_Registry::$i18n_js_strings['Sunday']         = wp_strip_all_tags(__('Sunday', 'event_espresso'));
2105
+		EE_Registry::$i18n_js_strings['Monday']         = wp_strip_all_tags(__('Monday', 'event_espresso'));
2106
+		EE_Registry::$i18n_js_strings['Tuesday']        = wp_strip_all_tags(__('Tuesday', 'event_espresso'));
2107
+		EE_Registry::$i18n_js_strings['Wednesday']      = wp_strip_all_tags(__('Wednesday', 'event_espresso'));
2108
+		EE_Registry::$i18n_js_strings['Thursday']       = wp_strip_all_tags(__('Thursday', 'event_espresso'));
2109
+		EE_Registry::$i18n_js_strings['Friday']         = wp_strip_all_tags(__('Friday', 'event_espresso'));
2110
+		EE_Registry::$i18n_js_strings['Saturday']       = wp_strip_all_tags(__('Saturday', 'event_espresso'));
2111
+		EE_Registry::$i18n_js_strings['Sun']            = wp_strip_all_tags(__('Sun', 'event_espresso'));
2112
+		EE_Registry::$i18n_js_strings['Mon']            = wp_strip_all_tags(__('Mon', 'event_espresso'));
2113
+		EE_Registry::$i18n_js_strings['Tue']            = wp_strip_all_tags(__('Tue', 'event_espresso'));
2114
+		EE_Registry::$i18n_js_strings['Wed']            = wp_strip_all_tags(__('Wed', 'event_espresso'));
2115
+		EE_Registry::$i18n_js_strings['Thu']            = wp_strip_all_tags(__('Thu', 'event_espresso'));
2116
+		EE_Registry::$i18n_js_strings['Fri']            = wp_strip_all_tags(__('Fri', 'event_espresso'));
2117
+		EE_Registry::$i18n_js_strings['Sat']            = wp_strip_all_tags(__('Sat', 'event_espresso'));
2118
+	}
2119
+
2120
+
2121
+	/**
2122
+	 *        load enhanced xdebug styles for ppl with failing eyesight
2123
+	 *
2124
+	 * @return        void
2125
+	 */
2126
+	public function add_xdebug_style()
2127
+	{
2128
+		echo '<style>.xdebug-error { font-size:1.5em; }</style>';
2129
+	}
2130
+
2131
+
2132
+	/************************/
2133
+	/** LIST TABLE METHODS **/
2134
+	/************************/
2135
+	/**
2136
+	 * this sets up the list table if the current view requires it.
2137
+	 *
2138
+	 * @return void
2139
+	 * @throws EE_Error
2140
+	 * @throws InvalidArgumentException
2141
+	 * @throws InvalidDataTypeException
2142
+	 * @throws InvalidInterfaceException
2143
+	 */
2144
+	protected function _set_list_table()
2145
+	{
2146
+		// first is this a list_table view?
2147
+		if (! isset($this->_route_config['list_table'])) {
2148
+			return;
2149
+		} //not a list_table view so get out.
2150
+		// list table functions are per view specific (because some admin pages might have more than one list table!)
2151
+		$list_table_view = '_set_list_table_views_' . $this->_req_action;
2152
+		if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2153
+			// user error msg
2154
+			$error_msg = esc_html__(
2155
+				'An error occurred. The requested list table views could not be found.',
2156
+				'event_espresso'
2157
+			);
2158
+			// developer error msg
2159
+			$error_msg .= '||'
2160
+						  . sprintf(
2161
+							  esc_html__(
2162
+								  'List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.',
2163
+								  'event_espresso'
2164
+							  ),
2165
+							  $this->_req_action,
2166
+							  $list_table_view
2167
+						  );
2168
+			throw new EE_Error($error_msg);
2169
+		}
2170
+		// let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2171
+		$this->_views = apply_filters(
2172
+			'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2173
+			$this->_views
2174
+		);
2175
+		$this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2176
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2177
+		$this->_set_list_table_view();
2178
+		$this->_set_list_table_object();
2179
+	}
2180
+
2181
+
2182
+	/**
2183
+	 * set current view for List Table
2184
+	 *
2185
+	 * @return void
2186
+	 */
2187
+	protected function _set_list_table_view()
2188
+	{
2189
+		$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
2190
+		$status = $this->request->getRequestParam('status', null, 'key');
2191
+		$this->_view = $status && array_key_exists($status, $this->_views)
2192
+			? $status
2193
+			: $this->_view;
2194
+	}
2195
+
2196
+
2197
+	/**
2198
+	 * _set_list_table_object
2199
+	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
2200
+	 *
2201
+	 * @throws InvalidInterfaceException
2202
+	 * @throws InvalidArgumentException
2203
+	 * @throws InvalidDataTypeException
2204
+	 * @throws EE_Error
2205
+	 * @throws InvalidInterfaceException
2206
+	 */
2207
+	protected function _set_list_table_object()
2208
+	{
2209
+		if (isset($this->_route_config['list_table'])) {
2210
+			if (! class_exists($this->_route_config['list_table'])) {
2211
+				throw new EE_Error(
2212
+					sprintf(
2213
+						esc_html__(
2214
+							'The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.',
2215
+							'event_espresso'
2216
+						),
2217
+						$this->_route_config['list_table'],
2218
+						get_class($this)
2219
+					)
2220
+				);
2221
+			}
2222
+			$this->_list_table_object = $this->loader->getShared(
2223
+				$this->_route_config['list_table'],
2224
+				[$this]
2225
+			);
2226
+		}
2227
+	}
2228
+
2229
+
2230
+	/**
2231
+	 * get_list_table_view_RLs - get it? View RL ?? VU-RL???  URL ??
2232
+	 *
2233
+	 * @param array $extra_query_args                     Optional. An array of extra query args to add to the generated
2234
+	 *                                                    urls.  The array should be indexed by the view it is being
2235
+	 *                                                    added to.
2236
+	 * @return array
2237
+	 */
2238
+	public function get_list_table_view_RLs($extra_query_args = [])
2239
+	{
2240
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2241
+		if (empty($this->_views)) {
2242
+			$this->_views = [];
2243
+		}
2244
+		// cycle thru views
2245
+		foreach ($this->_views as $key => $view) {
2246
+			$query_args = [];
2247
+			// check for current view
2248
+			$this->_views[ $key ]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2249
+			$query_args['action']                        = $this->_req_action;
2250
+			$query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2251
+			$query_args['status']                        = $view['slug'];
2252
+			// merge any other arguments sent in.
2253
+			if (isset($extra_query_args[ $view['slug'] ])) {
2254
+				foreach ($extra_query_args[ $view['slug'] ] as $extra_query_arg) {
2255
+					$query_args[] = $extra_query_arg;
2256
+				}
2257
+			}
2258
+			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2259
+		}
2260
+		return $this->_views;
2261
+	}
2262
+
2263
+
2264
+	/**
2265
+	 * _entries_per_page_dropdown
2266
+	 * generates a dropdown box for selecting the number of visible rows in an admin page list table
2267
+	 *
2268
+	 * @param int $max_entries total number of rows in the table
2269
+	 * @return string
2270
+	 * @todo   : Note: ideally this should be added to the screen options dropdown as that would be consistent with how
2271
+	 *         WP does it.
2272
+	 */
2273
+	protected function _entries_per_page_dropdown($max_entries = 0)
2274
+	{
2275
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2276
+		$values   = [10, 25, 50, 100];
2277
+		$per_page = $this->request->getRequestParam('per_page', 10, 'int');
2278
+		if ($max_entries) {
2279
+			$values[] = $max_entries;
2280
+			sort($values);
2281
+		}
2282
+		$entries_per_page_dropdown = '
2283 2283
 			<div id="entries-per-page-dv" class="alignleft actions">
2284 2284
 				<label class="hide-if-no-js">
2285 2285
 					Show
2286 2286
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2287
-        foreach ($values as $value) {
2288
-            if ($value < $max_entries) {
2289
-                $selected                  = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2290
-                $entries_per_page_dropdown .= '
2287
+		foreach ($values as $value) {
2288
+			if ($value < $max_entries) {
2289
+				$selected                  = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2290
+				$entries_per_page_dropdown .= '
2291 2291
 						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2292
-            }
2293
-        }
2294
-        $selected                  = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2295
-        $entries_per_page_dropdown .= '
2292
+			}
2293
+		}
2294
+		$selected                  = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2295
+		$entries_per_page_dropdown .= '
2296 2296
 						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2297
-        $entries_per_page_dropdown .= '
2297
+		$entries_per_page_dropdown .= '
2298 2298
 					</select>
2299 2299
 					entries
2300 2300
 				</label>
2301 2301
 				<input id="entries-per-page-btn" class="button button--secondary" type="submit" value="Go" >
2302 2302
 			</div>
2303 2303
 		';
2304
-        return $entries_per_page_dropdown;
2305
-    }
2306
-
2307
-
2308
-    /**
2309
-     *        _set_search_attributes
2310
-     *
2311
-     * @return        void
2312
-     */
2313
-    public function _set_search_attributes()
2314
-    {
2315
-        $this->_template_args['search']['btn_label'] = sprintf(
2316
-            esc_html__('Search %s', 'event_espresso'),
2317
-            empty($this->_search_btn_label) ? $this->page_label
2318
-                : $this->_search_btn_label
2319
-        );
2320
-        $this->_template_args['search']['callback']  = 'search_' . $this->page_slug;
2321
-    }
2322
-
2323
-
2324
-
2325
-    /*** END LIST TABLE METHODS **/
2326
-
2327
-
2328
-    /**
2329
-     * _add_registered_metaboxes
2330
-     *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2331
-     *
2332
-     * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2333
-     * @return void
2334
-     * @throws EE_Error
2335
-     */
2336
-    private function _add_registered_meta_boxes()
2337
-    {
2338
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2339
-        // we only add meta boxes if the page_route calls for it
2340
-        if (
2341
-            is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2342
-            && is_array(
2343
-                $this->_route_config['metaboxes']
2344
-            )
2345
-        ) {
2346
-            // this simply loops through the callbacks provided
2347
-            // and checks if there is a corresponding callback registered by the child
2348
-            // if there is then we go ahead and process the metabox loader.
2349
-            foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2350
-                // first check for Closures
2351
-                if ($metabox_callback instanceof Closure) {
2352
-                    $result = $metabox_callback();
2353
-                } elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2354
-                    $result = call_user_func([$metabox_callback[0], $metabox_callback[1]]);
2355
-                } else {
2356
-                    $result = $this->{$metabox_callback}();
2357
-                }
2358
-                if ($result === false) {
2359
-                    // user error msg
2360
-                    $error_msg = esc_html__(
2361
-                        'An error occurred. The  requested metabox could not be found.',
2362
-                        'event_espresso'
2363
-                    );
2364
-                    // developer error msg
2365
-                    $error_msg .= '||'
2366
-                                  . sprintf(
2367
-                                      esc_html__(
2368
-                                          'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.',
2369
-                                          'event_espresso'
2370
-                                      ),
2371
-                                      $metabox_callback
2372
-                                  );
2373
-                    throw new EE_Error($error_msg);
2374
-                }
2375
-            }
2376
-        }
2377
-    }
2378
-
2379
-
2380
-    /**
2381
-     * _add_screen_columns
2382
-     * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2383
-     * the dynamic column template and we'll setup the column options for the page.
2384
-     *
2385
-     * @return void
2386
-     */
2387
-    private function _add_screen_columns()
2388
-    {
2389
-        if (
2390
-            is_array($this->_route_config)
2391
-            && isset($this->_route_config['columns'])
2392
-            && is_array($this->_route_config['columns'])
2393
-            && count($this->_route_config['columns']) === 2
2394
-        ) {
2395
-            add_screen_option(
2396
-                'layout_columns',
2397
-                [
2398
-                    'max'     => (int) $this->_route_config['columns'][0],
2399
-                    'default' => (int) $this->_route_config['columns'][1],
2400
-                ]
2401
-            );
2402
-            $this->_template_args['num_columns']                 = $this->_route_config['columns'][0];
2403
-            $screen_id                                           = $this->_current_screen->id;
2404
-            $screen_columns                                      = (int) get_user_option("screen_layout_{$screen_id}");
2405
-            $total_columns                                       = ! empty($screen_columns)
2406
-                ? $screen_columns
2407
-                : $this->_route_config['columns'][1];
2408
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2409
-            $this->_template_args['current_page']                = $this->_wp_page_slug;
2410
-            $this->_template_args['screen']                      = $this->_current_screen;
2411
-            $this->_column_template_path                         = EE_ADMIN_TEMPLATE
2412
-                                                                   . 'admin_details_metabox_column_wrapper.template.php';
2413
-            // finally if we don't have has_metaboxes set in the route config
2414
-            // let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2415
-            $this->_route_config['has_metaboxes'] = true;
2416
-        }
2417
-    }
2418
-
2419
-
2420
-
2421
-    /** GLOBALLY AVAILABLE METABOXES **/
2422
-
2423
-
2424
-    /**
2425
-     * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2426
-     * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2427
-     * these get loaded on.
2428
-     */
2429
-    private function _espresso_news_post_box()
2430
-    {
2431
-        $news_box_title = apply_filters(
2432
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2433
-            esc_html__('New @ Event Espresso', 'event_espresso')
2434
-        );
2435
-        $this->addMetaBox(
2436
-            'espresso_news_post_box',
2437
-            $news_box_title,
2438
-            [
2439
-                $this,
2440
-                'espresso_news_post_box',
2441
-            ],
2442
-            $this->_wp_page_slug,
2443
-            'side'
2444
-        );
2445
-    }
2446
-
2447
-
2448
-    /**
2449
-     * Code for setting up espresso ratings request metabox.
2450
-     */
2451
-    protected function _espresso_ratings_request()
2452
-    {
2453
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2454
-            return;
2455
-        }
2456
-        $ratings_box_title = apply_filters(
2457
-            'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2458
-            esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2459
-        );
2460
-        $this->addMetaBox(
2461
-            'espresso_ratings_request',
2462
-            $ratings_box_title,
2463
-            [
2464
-                $this,
2465
-                'espresso_ratings_request',
2466
-            ],
2467
-            $this->_wp_page_slug,
2468
-            'side'
2469
-        );
2470
-    }
2471
-
2472
-
2473
-    /**
2474
-     * Code for setting up espresso ratings request metabox content.
2475
-     *
2476
-     * @throws DomainException
2477
-     */
2478
-    public function espresso_ratings_request()
2479
-    {
2480
-        EEH_Template::display_template(EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php');
2481
-    }
2482
-
2483
-
2484
-    public static function cached_rss_display($rss_id, $url)
2485
-    {
2486
-        $loading   = '<p class="widget-loading hide-if-no-js">'
2487
-                     . esc_html__('Loading&#8230;', 'event_espresso')
2488
-                     . '</p><p class="hide-if-js">'
2489
-                     . esc_html__('This widget requires JavaScript.', 'event_espresso')
2490
-                     . '</p>';
2491
-        $pre       = '<div class="espresso-rss-display">' . "\n\t";
2492
-        $pre       .= '<span id="' . esc_attr($rss_id) . '_url" class="hidden">' . esc_url_raw($url) . '</span>';
2493
-        $post      = '</div>' . "\n";
2494
-        $cache_key = 'ee_rss_' . md5($rss_id);
2495
-        $output    = get_transient($cache_key);
2496
-        if ($output !== false) {
2497
-            echo $pre . $output . $post; // already escaped
2498
-            return true;
2499
-        }
2500
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2501
-            echo $pre . $loading . $post; // already escaped
2502
-            return false;
2503
-        }
2504
-        ob_start();
2505
-        wp_widget_rss_output($url, ['show_date' => 0, 'items' => 5]);
2506
-        set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2507
-        return true;
2508
-    }
2509
-
2510
-
2511
-    public function espresso_news_post_box()
2512
-    {
2513
-        ?>
2304
+		return $entries_per_page_dropdown;
2305
+	}
2306
+
2307
+
2308
+	/**
2309
+	 *        _set_search_attributes
2310
+	 *
2311
+	 * @return        void
2312
+	 */
2313
+	public function _set_search_attributes()
2314
+	{
2315
+		$this->_template_args['search']['btn_label'] = sprintf(
2316
+			esc_html__('Search %s', 'event_espresso'),
2317
+			empty($this->_search_btn_label) ? $this->page_label
2318
+				: $this->_search_btn_label
2319
+		);
2320
+		$this->_template_args['search']['callback']  = 'search_' . $this->page_slug;
2321
+	}
2322
+
2323
+
2324
+
2325
+	/*** END LIST TABLE METHODS **/
2326
+
2327
+
2328
+	/**
2329
+	 * _add_registered_metaboxes
2330
+	 *  this loads any registered metaboxes via the 'metaboxes' index in the _page_config property array.
2331
+	 *
2332
+	 * @link   http://codex.wordpress.org/Function_Reference/add_meta_box
2333
+	 * @return void
2334
+	 * @throws EE_Error
2335
+	 */
2336
+	private function _add_registered_meta_boxes()
2337
+	{
2338
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2339
+		// we only add meta boxes if the page_route calls for it
2340
+		if (
2341
+			is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
2342
+			&& is_array(
2343
+				$this->_route_config['metaboxes']
2344
+			)
2345
+		) {
2346
+			// this simply loops through the callbacks provided
2347
+			// and checks if there is a corresponding callback registered by the child
2348
+			// if there is then we go ahead and process the metabox loader.
2349
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
2350
+				// first check for Closures
2351
+				if ($metabox_callback instanceof Closure) {
2352
+					$result = $metabox_callback();
2353
+				} elseif (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2354
+					$result = call_user_func([$metabox_callback[0], $metabox_callback[1]]);
2355
+				} else {
2356
+					$result = $this->{$metabox_callback}();
2357
+				}
2358
+				if ($result === false) {
2359
+					// user error msg
2360
+					$error_msg = esc_html__(
2361
+						'An error occurred. The  requested metabox could not be found.',
2362
+						'event_espresso'
2363
+					);
2364
+					// developer error msg
2365
+					$error_msg .= '||'
2366
+								  . sprintf(
2367
+									  esc_html__(
2368
+										  'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.',
2369
+										  'event_espresso'
2370
+									  ),
2371
+									  $metabox_callback
2372
+								  );
2373
+					throw new EE_Error($error_msg);
2374
+				}
2375
+			}
2376
+		}
2377
+	}
2378
+
2379
+
2380
+	/**
2381
+	 * _add_screen_columns
2382
+	 * This will check the _page_config array and if there is "columns" key index indicated, we'll set the template as
2383
+	 * the dynamic column template and we'll setup the column options for the page.
2384
+	 *
2385
+	 * @return void
2386
+	 */
2387
+	private function _add_screen_columns()
2388
+	{
2389
+		if (
2390
+			is_array($this->_route_config)
2391
+			&& isset($this->_route_config['columns'])
2392
+			&& is_array($this->_route_config['columns'])
2393
+			&& count($this->_route_config['columns']) === 2
2394
+		) {
2395
+			add_screen_option(
2396
+				'layout_columns',
2397
+				[
2398
+					'max'     => (int) $this->_route_config['columns'][0],
2399
+					'default' => (int) $this->_route_config['columns'][1],
2400
+				]
2401
+			);
2402
+			$this->_template_args['num_columns']                 = $this->_route_config['columns'][0];
2403
+			$screen_id                                           = $this->_current_screen->id;
2404
+			$screen_columns                                      = (int) get_user_option("screen_layout_{$screen_id}");
2405
+			$total_columns                                       = ! empty($screen_columns)
2406
+				? $screen_columns
2407
+				: $this->_route_config['columns'][1];
2408
+			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2409
+			$this->_template_args['current_page']                = $this->_wp_page_slug;
2410
+			$this->_template_args['screen']                      = $this->_current_screen;
2411
+			$this->_column_template_path                         = EE_ADMIN_TEMPLATE
2412
+																   . 'admin_details_metabox_column_wrapper.template.php';
2413
+			// finally if we don't have has_metaboxes set in the route config
2414
+			// let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2415
+			$this->_route_config['has_metaboxes'] = true;
2416
+		}
2417
+	}
2418
+
2419
+
2420
+
2421
+	/** GLOBALLY AVAILABLE METABOXES **/
2422
+
2423
+
2424
+	/**
2425
+	 * In this section we put any globally available EE metaboxes for all EE Admin pages.  They are called by simply
2426
+	 * referencing the callback in the _page_config array property.  This way you can be very specific about what pages
2427
+	 * these get loaded on.
2428
+	 */
2429
+	private function _espresso_news_post_box()
2430
+	{
2431
+		$news_box_title = apply_filters(
2432
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2433
+			esc_html__('New @ Event Espresso', 'event_espresso')
2434
+		);
2435
+		$this->addMetaBox(
2436
+			'espresso_news_post_box',
2437
+			$news_box_title,
2438
+			[
2439
+				$this,
2440
+				'espresso_news_post_box',
2441
+			],
2442
+			$this->_wp_page_slug,
2443
+			'side'
2444
+		);
2445
+	}
2446
+
2447
+
2448
+	/**
2449
+	 * Code for setting up espresso ratings request metabox.
2450
+	 */
2451
+	protected function _espresso_ratings_request()
2452
+	{
2453
+		if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2454
+			return;
2455
+		}
2456
+		$ratings_box_title = apply_filters(
2457
+			'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title',
2458
+			esc_html__('Keep Event Espresso Decaf Free', 'event_espresso')
2459
+		);
2460
+		$this->addMetaBox(
2461
+			'espresso_ratings_request',
2462
+			$ratings_box_title,
2463
+			[
2464
+				$this,
2465
+				'espresso_ratings_request',
2466
+			],
2467
+			$this->_wp_page_slug,
2468
+			'side'
2469
+		);
2470
+	}
2471
+
2472
+
2473
+	/**
2474
+	 * Code for setting up espresso ratings request metabox content.
2475
+	 *
2476
+	 * @throws DomainException
2477
+	 */
2478
+	public function espresso_ratings_request()
2479
+	{
2480
+		EEH_Template::display_template(EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php');
2481
+	}
2482
+
2483
+
2484
+	public static function cached_rss_display($rss_id, $url)
2485
+	{
2486
+		$loading   = '<p class="widget-loading hide-if-no-js">'
2487
+					 . esc_html__('Loading&#8230;', 'event_espresso')
2488
+					 . '</p><p class="hide-if-js">'
2489
+					 . esc_html__('This widget requires JavaScript.', 'event_espresso')
2490
+					 . '</p>';
2491
+		$pre       = '<div class="espresso-rss-display">' . "\n\t";
2492
+		$pre       .= '<span id="' . esc_attr($rss_id) . '_url" class="hidden">' . esc_url_raw($url) . '</span>';
2493
+		$post      = '</div>' . "\n";
2494
+		$cache_key = 'ee_rss_' . md5($rss_id);
2495
+		$output    = get_transient($cache_key);
2496
+		if ($output !== false) {
2497
+			echo $pre . $output . $post; // already escaped
2498
+			return true;
2499
+		}
2500
+		if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2501
+			echo $pre . $loading . $post; // already escaped
2502
+			return false;
2503
+		}
2504
+		ob_start();
2505
+		wp_widget_rss_output($url, ['show_date' => 0, 'items' => 5]);
2506
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2507
+		return true;
2508
+	}
2509
+
2510
+
2511
+	public function espresso_news_post_box()
2512
+	{
2513
+		?>
2514 2514
         <div class="padding">
2515 2515
             <div id="espresso_news_post_box_content" class="infolinks">
2516 2516
                 <?php
2517
-                // Get RSS Feed(s)
2518
-                EE_Admin_Page::cached_rss_display(
2519
-                    'espresso_news_post_box_content',
2520
-                    esc_url_raw(
2521
-                        apply_filters(
2522
-                            'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2523
-                            'https://eventespresso.com/feed/'
2524
-                        )
2525
-                    )
2526
-                );
2527
-                ?>
2517
+				// Get RSS Feed(s)
2518
+				EE_Admin_Page::cached_rss_display(
2519
+					'espresso_news_post_box_content',
2520
+					esc_url_raw(
2521
+						apply_filters(
2522
+							'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url',
2523
+							'https://eventespresso.com/feed/'
2524
+						)
2525
+					)
2526
+				);
2527
+				?>
2528 2528
             </div>
2529 2529
             <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2530 2530
         </div>
2531 2531
         <?php
2532
-    }
2533
-
2534
-
2535
-    private function _espresso_links_post_box()
2536
-    {
2537
-        // Hiding until we actually have content to put in here...
2538
-        // $this->addMetaBox('espresso_links_post_box', esc_html__('Helpful Plugin Links', 'event_espresso'), array( $this, 'espresso_links_post_box'), $this->_wp_page_slug, 'side');
2539
-    }
2540
-
2541
-
2542
-    public function espresso_links_post_box()
2543
-    {
2544
-        // Hiding until we actually have content to put in here...
2545
-        // EEH_Template::display_template(
2546
-        //     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2547
-        // );
2548
-    }
2549
-
2550
-
2551
-    protected function _espresso_sponsors_post_box()
2552
-    {
2553
-        if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2554
-            $this->addMetaBox(
2555
-                'espresso_sponsors_post_box',
2556
-                esc_html__('Event Espresso Highlights', 'event_espresso'),
2557
-                [$this, 'espresso_sponsors_post_box'],
2558
-                $this->_wp_page_slug,
2559
-                'side'
2560
-            );
2561
-        }
2562
-    }
2563
-
2564
-
2565
-    public function espresso_sponsors_post_box()
2566
-    {
2567
-        EEH_Template::display_template(
2568
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2569
-        );
2570
-    }
2571
-
2572
-
2573
-    private function _publish_post_box()
2574
-    {
2575
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2576
-        // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2577
-        // then we'll use that for the metabox label.
2578
-        // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2579
-        if (! empty($this->_labels['publishbox'])) {
2580
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2581
-                : $this->_labels['publishbox'];
2582
-        } else {
2583
-            $box_label = esc_html__('Publish', 'event_espresso');
2584
-        }
2585
-        $box_label = apply_filters(
2586
-            'FHEE__EE_Admin_Page___publish_post_box__box_label',
2587
-            $box_label,
2588
-            $this->_req_action,
2589
-            $this
2590
-        );
2591
-        $this->addMetaBox(
2592
-            $meta_box_ref,
2593
-            $box_label,
2594
-            [$this, 'editor_overview'],
2595
-            $this->_current_screen->id,
2596
-            'side',
2597
-            'high'
2598
-        );
2599
-    }
2600
-
2601
-
2602
-    public function editor_overview()
2603
-    {
2604
-        // if we have extra content set let's add it in if not make sure its empty
2605
-        $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2606
-            ? $this->_template_args['publish_box_extra_content']
2607
-            : '';
2608
-        echo EEH_Template::display_template(
2609
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2610
-            $this->_template_args,
2611
-            true
2612
-        );
2613
-    }
2614
-
2615
-
2616
-    /** end of globally available metaboxes section **/
2617
-
2618
-
2619
-    /**
2620
-     * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2621
-     * protected method.
2622
-     *
2623
-     * @param string $name
2624
-     * @param int    $id
2625
-     * @param bool   $delete
2626
-     * @param string $save_close_redirect_URL
2627
-     * @param bool   $both_btns
2628
-     * @throws EE_Error
2629
-     * @throws InvalidArgumentException
2630
-     * @throws InvalidDataTypeException
2631
-     * @throws InvalidInterfaceException
2632
-     * @see   $this->_set_publish_post_box_vars for param details
2633
-     * @since 4.6.0
2634
-     */
2635
-    public function set_publish_post_box_vars(
2636
-        $name = '',
2637
-        $id = 0,
2638
-        $delete = false,
2639
-        $save_close_redirect_URL = '',
2640
-        $both_btns = true
2641
-    ) {
2642
-        $this->_set_publish_post_box_vars(
2643
-            $name,
2644
-            $id,
2645
-            $delete,
2646
-            $save_close_redirect_URL,
2647
-            $both_btns
2648
-        );
2649
-    }
2650
-
2651
-
2652
-    /**
2653
-     * Sets the _template_args arguments used by the _publish_post_box shortcut
2654
-     * Note: currently there is no validation for this.  However if you want the delete button, the
2655
-     * save, and save and close buttons to work properly, then you will want to include a
2656
-     * values for the name and id arguments.
2657
-     *
2658
-     * @param string  $name                       key used for the action ID (i.e. event_id)
2659
-     * @param int     $id                         id attached to the item published
2660
-     * @param string  $delete                     page route callback for the delete action
2661
-     * @param string  $save_close_redirect_URL    custom URL to redirect to after Save & Close has been completed
2662
-     * @param boolean $both_btns                  whether to display BOTH the "Save & Close" and "Save" buttons or just
2663
-     *                                            the Save button
2664
-     * @throws EE_Error
2665
-     * @throws InvalidArgumentException
2666
-     * @throws InvalidDataTypeException
2667
-     * @throws InvalidInterfaceException
2668
-     * @todo  Add in validation for name/id arguments.
2669
-     */
2670
-    protected function _set_publish_post_box_vars(
2671
-        $name = '',
2672
-        $id = 0,
2673
-        $delete = '',
2674
-        $save_close_redirect_URL = '',
2675
-        $both_btns = true
2676
-    ) {
2677
-        // if Save & Close, use a custom redirect URL or default to the main page?
2678
-        $save_close_redirect_URL = ! empty($save_close_redirect_URL)
2679
-            ? $save_close_redirect_URL
2680
-            : $this->_admin_base_url;
2681
-        // create the Save & Close and Save buttons
2682
-        $this->_set_save_buttons($both_btns, [], [], $save_close_redirect_URL);
2683
-        // if we have extra content set let's add it in if not make sure its empty
2684
-        $this->_template_args['publish_box_extra_content'] = $this->_template_args['publish_box_extra_content'] ?? '';
2685
-        $delete_link = '';
2686
-        if ($delete && ! empty($id)) {
2687
-            // make sure we have a default if just true is sent.
2688
-            $delete           = ! empty($delete) ? $delete : 'delete';
2689
-            $delete_link      = $this->get_action_link_or_button(
2690
-                $delete,
2691
-                $delete,
2692
-                [$name => $id],
2693
-                'submitdelete deletion button button--small  button--outline button--caution'
2694
-            );
2695
-        }
2696
-        $this->_template_args['publish_delete_link'] = $delete_link;
2697
-        if (! empty($name) && ! empty($id)) {
2698
-            $hidden_field_arr[ $name ] = [
2699
-                'type'  => 'hidden',
2700
-                'value' => $id,
2701
-            ];
2702
-            $hf                        = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2703
-        } else {
2704
-            $hf = '';
2705
-        }
2706
-        // add hidden field
2707
-        $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2708
-            ? $hf[ $name ]['field']
2709
-            : $hf;
2710
-    }
2711
-
2712
-
2713
-    /**
2714
-     * displays an error message to ppl who have javascript disabled
2715
-     *
2716
-     * @return void
2717
-     */
2718
-    private function _display_no_javascript_warning()
2719
-    {
2720
-        ?>
2532
+	}
2533
+
2534
+
2535
+	private function _espresso_links_post_box()
2536
+	{
2537
+		// Hiding until we actually have content to put in here...
2538
+		// $this->addMetaBox('espresso_links_post_box', esc_html__('Helpful Plugin Links', 'event_espresso'), array( $this, 'espresso_links_post_box'), $this->_wp_page_slug, 'side');
2539
+	}
2540
+
2541
+
2542
+	public function espresso_links_post_box()
2543
+	{
2544
+		// Hiding until we actually have content to put in here...
2545
+		// EEH_Template::display_template(
2546
+		//     EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_links.template.php'
2547
+		// );
2548
+	}
2549
+
2550
+
2551
+	protected function _espresso_sponsors_post_box()
2552
+	{
2553
+		if (apply_filters('FHEE_show_sponsors_meta_box', true)) {
2554
+			$this->addMetaBox(
2555
+				'espresso_sponsors_post_box',
2556
+				esc_html__('Event Espresso Highlights', 'event_espresso'),
2557
+				[$this, 'espresso_sponsors_post_box'],
2558
+				$this->_wp_page_slug,
2559
+				'side'
2560
+			);
2561
+		}
2562
+	}
2563
+
2564
+
2565
+	public function espresso_sponsors_post_box()
2566
+	{
2567
+		EEH_Template::display_template(
2568
+			EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2569
+		);
2570
+	}
2571
+
2572
+
2573
+	private function _publish_post_box()
2574
+	{
2575
+		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2576
+		// if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2577
+		// then we'll use that for the metabox label.
2578
+		// Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2579
+		if (! empty($this->_labels['publishbox'])) {
2580
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2581
+				: $this->_labels['publishbox'];
2582
+		} else {
2583
+			$box_label = esc_html__('Publish', 'event_espresso');
2584
+		}
2585
+		$box_label = apply_filters(
2586
+			'FHEE__EE_Admin_Page___publish_post_box__box_label',
2587
+			$box_label,
2588
+			$this->_req_action,
2589
+			$this
2590
+		);
2591
+		$this->addMetaBox(
2592
+			$meta_box_ref,
2593
+			$box_label,
2594
+			[$this, 'editor_overview'],
2595
+			$this->_current_screen->id,
2596
+			'side',
2597
+			'high'
2598
+		);
2599
+	}
2600
+
2601
+
2602
+	public function editor_overview()
2603
+	{
2604
+		// if we have extra content set let's add it in if not make sure its empty
2605
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content'])
2606
+			? $this->_template_args['publish_box_extra_content']
2607
+			: '';
2608
+		echo EEH_Template::display_template(
2609
+			EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2610
+			$this->_template_args,
2611
+			true
2612
+		);
2613
+	}
2614
+
2615
+
2616
+	/** end of globally available metaboxes section **/
2617
+
2618
+
2619
+	/**
2620
+	 * Public wrapper for the protected method.  Allows plugins/addons to externally call the
2621
+	 * protected method.
2622
+	 *
2623
+	 * @param string $name
2624
+	 * @param int    $id
2625
+	 * @param bool   $delete
2626
+	 * @param string $save_close_redirect_URL
2627
+	 * @param bool   $both_btns
2628
+	 * @throws EE_Error
2629
+	 * @throws InvalidArgumentException
2630
+	 * @throws InvalidDataTypeException
2631
+	 * @throws InvalidInterfaceException
2632
+	 * @see   $this->_set_publish_post_box_vars for param details
2633
+	 * @since 4.6.0
2634
+	 */
2635
+	public function set_publish_post_box_vars(
2636
+		$name = '',
2637
+		$id = 0,
2638
+		$delete = false,
2639
+		$save_close_redirect_URL = '',
2640
+		$both_btns = true
2641
+	) {
2642
+		$this->_set_publish_post_box_vars(
2643
+			$name,
2644
+			$id,
2645
+			$delete,
2646
+			$save_close_redirect_URL,
2647
+			$both_btns
2648
+		);
2649
+	}
2650
+
2651
+
2652
+	/**
2653
+	 * Sets the _template_args arguments used by the _publish_post_box shortcut
2654
+	 * Note: currently there is no validation for this.  However if you want the delete button, the
2655
+	 * save, and save and close buttons to work properly, then you will want to include a
2656
+	 * values for the name and id arguments.
2657
+	 *
2658
+	 * @param string  $name                       key used for the action ID (i.e. event_id)
2659
+	 * @param int     $id                         id attached to the item published
2660
+	 * @param string  $delete                     page route callback for the delete action
2661
+	 * @param string  $save_close_redirect_URL    custom URL to redirect to after Save & Close has been completed
2662
+	 * @param boolean $both_btns                  whether to display BOTH the "Save & Close" and "Save" buttons or just
2663
+	 *                                            the Save button
2664
+	 * @throws EE_Error
2665
+	 * @throws InvalidArgumentException
2666
+	 * @throws InvalidDataTypeException
2667
+	 * @throws InvalidInterfaceException
2668
+	 * @todo  Add in validation for name/id arguments.
2669
+	 */
2670
+	protected function _set_publish_post_box_vars(
2671
+		$name = '',
2672
+		$id = 0,
2673
+		$delete = '',
2674
+		$save_close_redirect_URL = '',
2675
+		$both_btns = true
2676
+	) {
2677
+		// if Save & Close, use a custom redirect URL or default to the main page?
2678
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL)
2679
+			? $save_close_redirect_URL
2680
+			: $this->_admin_base_url;
2681
+		// create the Save & Close and Save buttons
2682
+		$this->_set_save_buttons($both_btns, [], [], $save_close_redirect_URL);
2683
+		// if we have extra content set let's add it in if not make sure its empty
2684
+		$this->_template_args['publish_box_extra_content'] = $this->_template_args['publish_box_extra_content'] ?? '';
2685
+		$delete_link = '';
2686
+		if ($delete && ! empty($id)) {
2687
+			// make sure we have a default if just true is sent.
2688
+			$delete           = ! empty($delete) ? $delete : 'delete';
2689
+			$delete_link      = $this->get_action_link_or_button(
2690
+				$delete,
2691
+				$delete,
2692
+				[$name => $id],
2693
+				'submitdelete deletion button button--small  button--outline button--caution'
2694
+			);
2695
+		}
2696
+		$this->_template_args['publish_delete_link'] = $delete_link;
2697
+		if (! empty($name) && ! empty($id)) {
2698
+			$hidden_field_arr[ $name ] = [
2699
+				'type'  => 'hidden',
2700
+				'value' => $id,
2701
+			];
2702
+			$hf                        = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2703
+		} else {
2704
+			$hf = '';
2705
+		}
2706
+		// add hidden field
2707
+		$this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2708
+			? $hf[ $name ]['field']
2709
+			: $hf;
2710
+	}
2711
+
2712
+
2713
+	/**
2714
+	 * displays an error message to ppl who have javascript disabled
2715
+	 *
2716
+	 * @return void
2717
+	 */
2718
+	private function _display_no_javascript_warning()
2719
+	{
2720
+		?>
2721 2721
         <noscript>
2722 2722
             <div id="no-js-message" class="error">
2723 2723
                 <p style="font-size:1.3em;">
2724 2724
                     <span style="color:red;"><?php esc_html_e('Warning!', 'event_espresso'); ?></span>
2725 2725
                     <?php esc_html_e(
2726
-                        'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.',
2727
-                        'event_espresso'
2728
-                    ); ?>
2726
+						'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.',
2727
+						'event_espresso'
2728
+					); ?>
2729 2729
                 </p>
2730 2730
             </div>
2731 2731
         </noscript>
2732 2732
         <?php
2733
-    }
2734
-
2735
-
2736
-    /**
2737
-     * displays espresso success and/or error notices
2738
-     *
2739
-     * @return void
2740
-     */
2741
-    protected function _display_espresso_notices()
2742
-    {
2743
-        $notices = $this->_get_transient(true);
2744
-        echo stripslashes($notices);
2745
-    }
2746
-
2747
-
2748
-    /**
2749
-     * spinny things pacify the masses
2750
-     *
2751
-     * @return void
2752
-     */
2753
-    protected function _add_admin_page_ajax_loading_img()
2754
-    {
2755
-        ?>
2733
+	}
2734
+
2735
+
2736
+	/**
2737
+	 * displays espresso success and/or error notices
2738
+	 *
2739
+	 * @return void
2740
+	 */
2741
+	protected function _display_espresso_notices()
2742
+	{
2743
+		$notices = $this->_get_transient(true);
2744
+		echo stripslashes($notices);
2745
+	}
2746
+
2747
+
2748
+	/**
2749
+	 * spinny things pacify the masses
2750
+	 *
2751
+	 * @return void
2752
+	 */
2753
+	protected function _add_admin_page_ajax_loading_img()
2754
+	{
2755
+		?>
2756 2756
         <div id="espresso-ajax-loading" class="ajax-loading-grey">
2757 2757
             <span class="ee-spinner ee-spin"></span><span class="hidden"><?php
2758
-                esc_html_e('loading...', 'event_espresso'); ?></span>
2758
+				esc_html_e('loading...', 'event_espresso'); ?></span>
2759 2759
         </div>
2760 2760
         <?php
2761
-    }
2761
+	}
2762 2762
 
2763 2763
 
2764
-    /**
2765
-     * add admin page overlay for modal boxes
2766
-     *
2767
-     * @return void
2768
-     */
2769
-    protected function _add_admin_page_overlay()
2770
-    {
2771
-        ?>
2764
+	/**
2765
+	 * add admin page overlay for modal boxes
2766
+	 *
2767
+	 * @return void
2768
+	 */
2769
+	protected function _add_admin_page_overlay()
2770
+	{
2771
+		?>
2772 2772
         <div id="espresso-admin-page-overlay-dv" class=""></div>
2773 2773
         <?php
2774
-    }
2775
-
2776
-
2777
-    /**
2778
-     * facade for $this->addMetaBox()
2779
-     *
2780
-     * @param string  $action        where the metabox gets displayed
2781
-     * @param string  $title         Title of Metabox (output in metabox header)
2782
-     * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2783
-     *                               instead of the one created in here.
2784
-     * @param array   $callback_args an array of args supplied for the metabox
2785
-     * @param string  $column        what metabox column
2786
-     * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2787
-     * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2788
-     *                               created but just set our own callback for wp's add_meta_box.
2789
-     * @throws DomainException
2790
-     */
2791
-    public function _add_admin_page_meta_box(
2792
-        $action,
2793
-        $title,
2794
-        $callback,
2795
-        $callback_args,
2796
-        $column = 'normal',
2797
-        $priority = 'high',
2798
-        $create_func = true
2799
-    ) {
2800
-        do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2801
-        // if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2802
-        if (empty($callback_args) && $create_func) {
2803
-            $callback_args = [
2804
-                'template_path' => $this->_template_path,
2805
-                'template_args' => $this->_template_args,
2806
-            ];
2807
-        }
2808
-        // if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2809
-        $call_back_func = $create_func
2810
-            ? static function ($post, $metabox) {
2811
-                do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2812
-                echo EEH_Template::display_template(
2813
-                    $metabox['args']['template_path'],
2814
-                    $metabox['args']['template_args'],
2815
-                    true
2816
-                );
2817
-            }
2818
-            : $callback;
2819
-        $this->addMetaBox(
2820
-            str_replace('_', '-', $action) . '-mbox',
2821
-            $title,
2822
-            $call_back_func,
2823
-            $this->_wp_page_slug,
2824
-            $column,
2825
-            $priority,
2826
-            $callback_args
2827
-        );
2828
-    }
2829
-
2830
-
2831
-    /**
2832
-     * generates HTML wrapper for and admin details page that contains metaboxes in columns
2833
-     *
2834
-     * @throws DomainException
2835
-     * @throws EE_Error
2836
-     * @throws InvalidArgumentException
2837
-     * @throws InvalidDataTypeException
2838
-     * @throws InvalidInterfaceException
2839
-     */
2840
-    public function display_admin_page_with_metabox_columns()
2841
-    {
2842
-        $this->_template_args['post_body_content']  = $this->_template_args['admin_page_content'];
2843
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2844
-            $this->_column_template_path,
2845
-            $this->_template_args,
2846
-            true
2847
-        );
2848
-        // the final wrapper
2849
-        $this->admin_page_wrapper();
2850
-    }
2851
-
2852
-
2853
-    /**
2854
-     * generates  HTML wrapper for an admin details page
2855
-     *
2856
-     * @return void
2857
-     * @throws DomainException
2858
-     * @throws EE_Error
2859
-     * @throws InvalidArgumentException
2860
-     * @throws InvalidDataTypeException
2861
-     * @throws InvalidInterfaceException
2862
-     */
2863
-    public function display_admin_page_with_sidebar()
2864
-    {
2865
-        $this->_display_admin_page(true);
2866
-    }
2867
-
2868
-
2869
-    /**
2870
-     * generates  HTML wrapper for an admin details page (except no sidebar)
2871
-     *
2872
-     * @return void
2873
-     * @throws DomainException
2874
-     * @throws EE_Error
2875
-     * @throws InvalidArgumentException
2876
-     * @throws InvalidDataTypeException
2877
-     * @throws InvalidInterfaceException
2878
-     */
2879
-    public function display_admin_page_with_no_sidebar()
2880
-    {
2881
-        $this->_display_admin_page();
2882
-    }
2883
-
2884
-
2885
-    /**
2886
-     * generates HTML wrapper for an EE about admin page (no sidebar)
2887
-     *
2888
-     * @return void
2889
-     * @throws DomainException
2890
-     * @throws EE_Error
2891
-     * @throws InvalidArgumentException
2892
-     * @throws InvalidDataTypeException
2893
-     * @throws InvalidInterfaceException
2894
-     */
2895
-    public function display_about_admin_page()
2896
-    {
2897
-        $this->_display_admin_page(false, true);
2898
-    }
2899
-
2900
-
2901
-    /**
2902
-     * display_admin_page
2903
-     * contains the code for actually displaying an admin page
2904
-     *
2905
-     * @param boolean $sidebar true with sidebar, false without
2906
-     * @param boolean $about   use the about admin wrapper instead of the default.
2907
-     * @return void
2908
-     * @throws DomainException
2909
-     * @throws EE_Error
2910
-     * @throws InvalidArgumentException
2911
-     * @throws InvalidDataTypeException
2912
-     * @throws InvalidInterfaceException
2913
-     */
2914
-    private function _display_admin_page($sidebar = false, $about = false)
2915
-    {
2916
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2917
-        // custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2918
-        do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2919
-        // set current wp page slug - looks like: event-espresso_page_event_categories
2920
-        // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2921
-
2922
-        $post_body_content = $this->_template_args['before_admin_page_content'] ?? '';
2923
-
2924
-        $this->_template_args['add_page_frame'] = $this->_req_action !== 'system_status'
2925
-                                                 && $this->_req_action !== 'data_reset'
2926
-                                                 && $this->_wp_page_slug !== 'event-espresso_page_espresso_packages'
2927
-                                                 && strpos($post_body_content, 'wp-list-table') === false;
2928
-
2929
-        $this->_template_args['current_page']              = $this->_wp_page_slug;
2930
-        $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2931
-            ? 'poststuff'
2932
-            : 'espresso-default-admin';
2933
-        $this->_template_args['admin_page_wrapper_div_class'] = str_replace(
2934
-            'event-espresso_page_espresso_',
2935
-            '',
2936
-            $this->_wp_page_slug
2937
-        ) . ' ' . $this->_req_action . '-route';
2938
-
2939
-        $template_path = $sidebar
2940
-            ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2941
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2942
-        if ($this->request->isAjax()) {
2943
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2944
-        }
2945
-        $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2946
-
2947
-        $this->_template_args['post_body_content']         = $this->_template_args['admin_page_content'] ?? '';
2948
-        $this->_template_args['before_admin_page_content'] = $post_body_content;
2949
-        $this->_template_args['after_admin_page_content']  = $this->_template_args['after_admin_page_content'] ?? '';
2950
-        $this->_template_args['admin_page_content']        = EEH_Template::display_template(
2951
-            $template_path,
2952
-            $this->_template_args,
2953
-            true
2954
-        );
2955
-        // the final template wrapper
2956
-        $this->admin_page_wrapper($about);
2957
-    }
2958
-
2959
-
2960
-    /**
2961
-     * This is used to display caf preview pages.
2962
-     *
2963
-     * @param string $utm_campaign_source what is the key used for google analytics link
2964
-     * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2965
-     *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2966
-     * @return void
2967
-     * @throws DomainException
2968
-     * @throws EE_Error
2969
-     * @throws InvalidArgumentException
2970
-     * @throws InvalidDataTypeException
2971
-     * @throws InvalidInterfaceException
2972
-     * @since 4.3.2
2973
-     */
2974
-    public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2975
-    {
2976
-        // let's generate a default preview action button if there isn't one already present.
2977
-        $this->_labels['buttons']['buy_now']           = esc_html__(
2978
-            'Upgrade to Event Espresso 4 Right Now',
2979
-            'event_espresso'
2980
-        );
2981
-        $buy_now_url                                   = add_query_arg(
2982
-            [
2983
-                'ee_ver'       => 'ee4',
2984
-                'utm_source'   => 'ee4_plugin_admin',
2985
-                'utm_medium'   => 'link',
2986
-                'utm_campaign' => $utm_campaign_source,
2987
-                'utm_content'  => 'buy_now_button',
2988
-            ],
2989
-            'https://eventespresso.com/pricing/'
2990
-        );
2991
-        $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2992
-            ? $this->get_action_link_or_button(
2993
-                '',
2994
-                'buy_now',
2995
-                [],
2996
-                'button button--primary button--big',
2997
-                esc_url_raw($buy_now_url),
2998
-                true
2999
-            )
3000
-            : $this->_template_args['preview_action_button'];
3001
-        $this->_template_args['admin_page_content']    = EEH_Template::display_template(
3002
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
3003
-            $this->_template_args,
3004
-            true
3005
-        );
3006
-        $this->_display_admin_page($display_sidebar);
3007
-    }
3008
-
3009
-
3010
-    /**
3011
-     * display_admin_list_table_page_with_sidebar
3012
-     * generates HTML wrapper for an admin_page with list_table
3013
-     *
3014
-     * @return void
3015
-     * @throws DomainException
3016
-     * @throws EE_Error
3017
-     * @throws InvalidArgumentException
3018
-     * @throws InvalidDataTypeException
3019
-     * @throws InvalidInterfaceException
3020
-     */
3021
-    public function display_admin_list_table_page_with_sidebar()
3022
-    {
3023
-        $this->_display_admin_list_table_page(true);
3024
-    }
3025
-
3026
-
3027
-    /**
3028
-     * display_admin_list_table_page_with_no_sidebar
3029
-     * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
3030
-     *
3031
-     * @return void
3032
-     * @throws DomainException
3033
-     * @throws EE_Error
3034
-     * @throws InvalidArgumentException
3035
-     * @throws InvalidDataTypeException
3036
-     * @throws InvalidInterfaceException
3037
-     */
3038
-    public function display_admin_list_table_page_with_no_sidebar()
3039
-    {
3040
-        $this->_display_admin_list_table_page();
3041
-    }
3042
-
3043
-
3044
-    /**
3045
-     * generates html wrapper for an admin_list_table page
3046
-     *
3047
-     * @param boolean $sidebar whether to display with sidebar or not.
3048
-     * @return void
3049
-     * @throws DomainException
3050
-     * @throws EE_Error
3051
-     * @throws InvalidArgumentException
3052
-     * @throws InvalidDataTypeException
3053
-     * @throws InvalidInterfaceException
3054
-     */
3055
-    private function _display_admin_list_table_page($sidebar = false)
3056
-    {
3057
-        // setup search attributes
3058
-        $this->_set_search_attributes();
3059
-        $this->_template_args['current_page']     = $this->_wp_page_slug;
3060
-        $template_path                            = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
3061
-        $this->_template_args['table_url']        = $this->request->isAjax()
3062
-            ? add_query_arg(['noheader' => 'true', 'route' => $this->_req_action], $this->_admin_base_url)
3063
-            : add_query_arg(['route' => $this->_req_action], $this->_admin_base_url);
3064
-        $this->_template_args['list_table']       = $this->_list_table_object;
3065
-        $this->_template_args['current_route']    = $this->_req_action;
3066
-        $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
3067
-        $ajax_sorting_callback                    = $this->_list_table_object->get_ajax_sorting_callback();
3068
-        if (! empty($ajax_sorting_callback)) {
3069
-            $sortable_list_table_form_fields = wp_nonce_field(
3070
-                $ajax_sorting_callback . '_nonce',
3071
-                $ajax_sorting_callback . '_nonce',
3072
-                false,
3073
-                false
3074
-            );
3075
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
3076
-                                                . $this->page_slug
3077
-                                                . '" />';
3078
-            $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
3079
-                                                . $ajax_sorting_callback
3080
-                                                . '" />';
3081
-        } else {
3082
-            $sortable_list_table_form_fields = '';
3083
-        }
3084
-        $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
3085
-
3086
-        $hidden_form_fields = $this->_template_args['list_table_hidden_fields'] ?? '';
3087
-
3088
-        $nonce_ref          = $this->_req_action . '_nonce';
3089
-        $hidden_form_fields .= '
2774
+	}
2775
+
2776
+
2777
+	/**
2778
+	 * facade for $this->addMetaBox()
2779
+	 *
2780
+	 * @param string  $action        where the metabox gets displayed
2781
+	 * @param string  $title         Title of Metabox (output in metabox header)
2782
+	 * @param string  $callback      If not empty and $create_fun is set to false then we'll use a custom callback
2783
+	 *                               instead of the one created in here.
2784
+	 * @param array   $callback_args an array of args supplied for the metabox
2785
+	 * @param string  $column        what metabox column
2786
+	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2787
+	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function
2788
+	 *                               created but just set our own callback for wp's add_meta_box.
2789
+	 * @throws DomainException
2790
+	 */
2791
+	public function _add_admin_page_meta_box(
2792
+		$action,
2793
+		$title,
2794
+		$callback,
2795
+		$callback_args,
2796
+		$column = 'normal',
2797
+		$priority = 'high',
2798
+		$create_func = true
2799
+	) {
2800
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2801
+		// if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2802
+		if (empty($callback_args) && $create_func) {
2803
+			$callback_args = [
2804
+				'template_path' => $this->_template_path,
2805
+				'template_args' => $this->_template_args,
2806
+			];
2807
+		}
2808
+		// if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2809
+		$call_back_func = $create_func
2810
+			? static function ($post, $metabox) {
2811
+				do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2812
+				echo EEH_Template::display_template(
2813
+					$metabox['args']['template_path'],
2814
+					$metabox['args']['template_args'],
2815
+					true
2816
+				);
2817
+			}
2818
+			: $callback;
2819
+		$this->addMetaBox(
2820
+			str_replace('_', '-', $action) . '-mbox',
2821
+			$title,
2822
+			$call_back_func,
2823
+			$this->_wp_page_slug,
2824
+			$column,
2825
+			$priority,
2826
+			$callback_args
2827
+		);
2828
+	}
2829
+
2830
+
2831
+	/**
2832
+	 * generates HTML wrapper for and admin details page that contains metaboxes in columns
2833
+	 *
2834
+	 * @throws DomainException
2835
+	 * @throws EE_Error
2836
+	 * @throws InvalidArgumentException
2837
+	 * @throws InvalidDataTypeException
2838
+	 * @throws InvalidInterfaceException
2839
+	 */
2840
+	public function display_admin_page_with_metabox_columns()
2841
+	{
2842
+		$this->_template_args['post_body_content']  = $this->_template_args['admin_page_content'];
2843
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2844
+			$this->_column_template_path,
2845
+			$this->_template_args,
2846
+			true
2847
+		);
2848
+		// the final wrapper
2849
+		$this->admin_page_wrapper();
2850
+	}
2851
+
2852
+
2853
+	/**
2854
+	 * generates  HTML wrapper for an admin details page
2855
+	 *
2856
+	 * @return void
2857
+	 * @throws DomainException
2858
+	 * @throws EE_Error
2859
+	 * @throws InvalidArgumentException
2860
+	 * @throws InvalidDataTypeException
2861
+	 * @throws InvalidInterfaceException
2862
+	 */
2863
+	public function display_admin_page_with_sidebar()
2864
+	{
2865
+		$this->_display_admin_page(true);
2866
+	}
2867
+
2868
+
2869
+	/**
2870
+	 * generates  HTML wrapper for an admin details page (except no sidebar)
2871
+	 *
2872
+	 * @return void
2873
+	 * @throws DomainException
2874
+	 * @throws EE_Error
2875
+	 * @throws InvalidArgumentException
2876
+	 * @throws InvalidDataTypeException
2877
+	 * @throws InvalidInterfaceException
2878
+	 */
2879
+	public function display_admin_page_with_no_sidebar()
2880
+	{
2881
+		$this->_display_admin_page();
2882
+	}
2883
+
2884
+
2885
+	/**
2886
+	 * generates HTML wrapper for an EE about admin page (no sidebar)
2887
+	 *
2888
+	 * @return void
2889
+	 * @throws DomainException
2890
+	 * @throws EE_Error
2891
+	 * @throws InvalidArgumentException
2892
+	 * @throws InvalidDataTypeException
2893
+	 * @throws InvalidInterfaceException
2894
+	 */
2895
+	public function display_about_admin_page()
2896
+	{
2897
+		$this->_display_admin_page(false, true);
2898
+	}
2899
+
2900
+
2901
+	/**
2902
+	 * display_admin_page
2903
+	 * contains the code for actually displaying an admin page
2904
+	 *
2905
+	 * @param boolean $sidebar true with sidebar, false without
2906
+	 * @param boolean $about   use the about admin wrapper instead of the default.
2907
+	 * @return void
2908
+	 * @throws DomainException
2909
+	 * @throws EE_Error
2910
+	 * @throws InvalidArgumentException
2911
+	 * @throws InvalidDataTypeException
2912
+	 * @throws InvalidInterfaceException
2913
+	 */
2914
+	private function _display_admin_page($sidebar = false, $about = false)
2915
+	{
2916
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2917
+		// custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2918
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2919
+		// set current wp page slug - looks like: event-espresso_page_event_categories
2920
+		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2921
+
2922
+		$post_body_content = $this->_template_args['before_admin_page_content'] ?? '';
2923
+
2924
+		$this->_template_args['add_page_frame'] = $this->_req_action !== 'system_status'
2925
+												 && $this->_req_action !== 'data_reset'
2926
+												 && $this->_wp_page_slug !== 'event-espresso_page_espresso_packages'
2927
+												 && strpos($post_body_content, 'wp-list-table') === false;
2928
+
2929
+		$this->_template_args['current_page']              = $this->_wp_page_slug;
2930
+		$this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2931
+			? 'poststuff'
2932
+			: 'espresso-default-admin';
2933
+		$this->_template_args['admin_page_wrapper_div_class'] = str_replace(
2934
+			'event-espresso_page_espresso_',
2935
+			'',
2936
+			$this->_wp_page_slug
2937
+		) . ' ' . $this->_req_action . '-route';
2938
+
2939
+		$template_path = $sidebar
2940
+			? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2941
+			: EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2942
+		if ($this->request->isAjax()) {
2943
+			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2944
+		}
2945
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2946
+
2947
+		$this->_template_args['post_body_content']         = $this->_template_args['admin_page_content'] ?? '';
2948
+		$this->_template_args['before_admin_page_content'] = $post_body_content;
2949
+		$this->_template_args['after_admin_page_content']  = $this->_template_args['after_admin_page_content'] ?? '';
2950
+		$this->_template_args['admin_page_content']        = EEH_Template::display_template(
2951
+			$template_path,
2952
+			$this->_template_args,
2953
+			true
2954
+		);
2955
+		// the final template wrapper
2956
+		$this->admin_page_wrapper($about);
2957
+	}
2958
+
2959
+
2960
+	/**
2961
+	 * This is used to display caf preview pages.
2962
+	 *
2963
+	 * @param string $utm_campaign_source what is the key used for google analytics link
2964
+	 * @param bool   $display_sidebar     whether to use the sidebar template or the full template for the page.  TRUE
2965
+	 *                                    = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2966
+	 * @return void
2967
+	 * @throws DomainException
2968
+	 * @throws EE_Error
2969
+	 * @throws InvalidArgumentException
2970
+	 * @throws InvalidDataTypeException
2971
+	 * @throws InvalidInterfaceException
2972
+	 * @since 4.3.2
2973
+	 */
2974
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2975
+	{
2976
+		// let's generate a default preview action button if there isn't one already present.
2977
+		$this->_labels['buttons']['buy_now']           = esc_html__(
2978
+			'Upgrade to Event Espresso 4 Right Now',
2979
+			'event_espresso'
2980
+		);
2981
+		$buy_now_url                                   = add_query_arg(
2982
+			[
2983
+				'ee_ver'       => 'ee4',
2984
+				'utm_source'   => 'ee4_plugin_admin',
2985
+				'utm_medium'   => 'link',
2986
+				'utm_campaign' => $utm_campaign_source,
2987
+				'utm_content'  => 'buy_now_button',
2988
+			],
2989
+			'https://eventespresso.com/pricing/'
2990
+		);
2991
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2992
+			? $this->get_action_link_or_button(
2993
+				'',
2994
+				'buy_now',
2995
+				[],
2996
+				'button button--primary button--big',
2997
+				esc_url_raw($buy_now_url),
2998
+				true
2999
+			)
3000
+			: $this->_template_args['preview_action_button'];
3001
+		$this->_template_args['admin_page_content']    = EEH_Template::display_template(
3002
+			EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
3003
+			$this->_template_args,
3004
+			true
3005
+		);
3006
+		$this->_display_admin_page($display_sidebar);
3007
+	}
3008
+
3009
+
3010
+	/**
3011
+	 * display_admin_list_table_page_with_sidebar
3012
+	 * generates HTML wrapper for an admin_page with list_table
3013
+	 *
3014
+	 * @return void
3015
+	 * @throws DomainException
3016
+	 * @throws EE_Error
3017
+	 * @throws InvalidArgumentException
3018
+	 * @throws InvalidDataTypeException
3019
+	 * @throws InvalidInterfaceException
3020
+	 */
3021
+	public function display_admin_list_table_page_with_sidebar()
3022
+	{
3023
+		$this->_display_admin_list_table_page(true);
3024
+	}
3025
+
3026
+
3027
+	/**
3028
+	 * display_admin_list_table_page_with_no_sidebar
3029
+	 * generates HTML wrapper for an admin_page with list_table (but with no sidebar)
3030
+	 *
3031
+	 * @return void
3032
+	 * @throws DomainException
3033
+	 * @throws EE_Error
3034
+	 * @throws InvalidArgumentException
3035
+	 * @throws InvalidDataTypeException
3036
+	 * @throws InvalidInterfaceException
3037
+	 */
3038
+	public function display_admin_list_table_page_with_no_sidebar()
3039
+	{
3040
+		$this->_display_admin_list_table_page();
3041
+	}
3042
+
3043
+
3044
+	/**
3045
+	 * generates html wrapper for an admin_list_table page
3046
+	 *
3047
+	 * @param boolean $sidebar whether to display with sidebar or not.
3048
+	 * @return void
3049
+	 * @throws DomainException
3050
+	 * @throws EE_Error
3051
+	 * @throws InvalidArgumentException
3052
+	 * @throws InvalidDataTypeException
3053
+	 * @throws InvalidInterfaceException
3054
+	 */
3055
+	private function _display_admin_list_table_page($sidebar = false)
3056
+	{
3057
+		// setup search attributes
3058
+		$this->_set_search_attributes();
3059
+		$this->_template_args['current_page']     = $this->_wp_page_slug;
3060
+		$template_path                            = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
3061
+		$this->_template_args['table_url']        = $this->request->isAjax()
3062
+			? add_query_arg(['noheader' => 'true', 'route' => $this->_req_action], $this->_admin_base_url)
3063
+			: add_query_arg(['route' => $this->_req_action], $this->_admin_base_url);
3064
+		$this->_template_args['list_table']       = $this->_list_table_object;
3065
+		$this->_template_args['current_route']    = $this->_req_action;
3066
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
3067
+		$ajax_sorting_callback                    = $this->_list_table_object->get_ajax_sorting_callback();
3068
+		if (! empty($ajax_sorting_callback)) {
3069
+			$sortable_list_table_form_fields = wp_nonce_field(
3070
+				$ajax_sorting_callback . '_nonce',
3071
+				$ajax_sorting_callback . '_nonce',
3072
+				false,
3073
+				false
3074
+			);
3075
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'
3076
+												. $this->page_slug
3077
+												. '" />';
3078
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'
3079
+												. $ajax_sorting_callback
3080
+												. '" />';
3081
+		} else {
3082
+			$sortable_list_table_form_fields = '';
3083
+		}
3084
+		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
3085
+
3086
+		$hidden_form_fields = $this->_template_args['list_table_hidden_fields'] ?? '';
3087
+
3088
+		$nonce_ref          = $this->_req_action . '_nonce';
3089
+		$hidden_form_fields .= '
3090 3090
             <input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce($nonce_ref) . '">';
3091 3091
 
3092
-        $this->_template_args['list_table_hidden_fields']        = $hidden_form_fields;
3093
-        // display message about search results?
3094
-        $search = $this->request->getRequestParam('s');
3095
-        $this->_template_args['before_list_table'] .= ! empty($search)
3096
-            ? '<p class="ee-search-results">' . sprintf(
3097
-                esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
3098
-                trim($search, '%')
3099
-            ) . '</p>'
3100
-            : '';
3101
-        // filter before_list_table template arg
3102
-        $this->_template_args['before_list_table'] = apply_filters(
3103
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
3104
-            $this->_template_args['before_list_table'],
3105
-            $this->page_slug,
3106
-            $this->request->requestParams(),
3107
-            $this->_req_action
3108
-        );
3109
-        // convert to array and filter again
3110
-        // arrays are easier to inject new items in a specific location,
3111
-        // but would not be backwards compatible, so we have to add a new filter
3112
-        $this->_template_args['before_list_table'] = implode(
3113
-            " \n",
3114
-            (array) apply_filters(
3115
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
3116
-                (array) $this->_template_args['before_list_table'],
3117
-                $this->page_slug,
3118
-                $this->request->requestParams(),
3119
-                $this->_req_action
3120
-            )
3121
-        );
3122
-        // filter after_list_table template arg
3123
-        $this->_template_args['after_list_table'] = apply_filters(
3124
-            'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
3125
-            $this->_template_args['after_list_table'],
3126
-            $this->page_slug,
3127
-            $this->request->requestParams(),
3128
-            $this->_req_action
3129
-        );
3130
-        // convert to array and filter again
3131
-        // arrays are easier to inject new items in a specific location,
3132
-        // but would not be backwards compatible, so we have to add a new filter
3133
-        $this->_template_args['after_list_table']   = implode(
3134
-            " \n",
3135
-            (array) apply_filters(
3136
-                'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
3137
-                (array) $this->_template_args['after_list_table'],
3138
-                $this->page_slug,
3139
-                $this->request->requestParams(),
3140
-                $this->_req_action
3141
-            )
3142
-        );
3143
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3144
-            $template_path,
3145
-            $this->_template_args,
3146
-            true
3147
-        );
3148
-        // the final template wrapper
3149
-        if ($sidebar) {
3150
-            $this->display_admin_page_with_sidebar();
3151
-        } else {
3152
-            $this->display_admin_page_with_no_sidebar();
3153
-        }
3154
-    }
3155
-
3156
-
3157
-    /**
3158
-     * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
3159
-     * html string for the legend.
3160
-     * $items are expected in an array in the following format:
3161
-     * $legend_items = array(
3162
-     *        'item_id' => array(
3163
-     *            'icon' => 'http://url_to_icon_being_described.png',
3164
-     *            'desc' => esc_html__('localized description of item');
3165
-     *        )
3166
-     * );
3167
-     *
3168
-     * @param array $items see above for format of array
3169
-     * @return string html string of legend
3170
-     * @throws DomainException
3171
-     */
3172
-    protected function _display_legend($items)
3173
-    {
3174
-        $this->_template_args['items'] = apply_filters(
3175
-            'FHEE__EE_Admin_Page___display_legend__items',
3176
-            (array) $items,
3177
-            $this
3178
-        );
3179
-        /** @var EventEspresso\core\admin\StatusChangeNotice $status_change_notice */
3180
-        $status_change_notice = $this->loader->getShared('EventEspresso\core\admin\StatusChangeNotice');
3181
-        if (! $status_change_notice->isDismissed()) {
3182
-            $this->_template_args['status_change_notice'] = EEH_Template::display_template(
3183
-                EE_ADMIN_TEMPLATE . 'status_change_notice.template.php',
3184
-                [ 'context' => '__admin-legend', 'page_slug' => $this->page_slug ],
3185
-                true
3186
-            );
3187
-        }
3188
-        return EEH_Template::display_template(
3189
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3190
-            $this->_template_args,
3191
-            true
3192
-        );
3193
-    }
3194
-
3195
-
3196
-    /**
3197
-     * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
3198
-     * The returned json object is created from an array in the following format:
3199
-     * array(
3200
-     *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
3201
-     *  'success' => FALSE, //(default FALSE) - contains any special success message.
3202
-     *  'notices' => '', // - contains any EE_Error formatted notices
3203
-     *  'content' => 'string can be html', //this is a string of formatted content (can be html)
3204
-     *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
3205
-     *  We're also going to include the template args with every package (so js can pick out any specific template args
3206
-     *  that might be included in here)
3207
-     * )
3208
-     * The json object is populated by whatever is set in the $_template_args property.
3209
-     *
3210
-     * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
3211
-     *                                 instead of displayed.
3212
-     * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
3213
-     * @return void
3214
-     * @throws EE_Error
3215
-     * @throws InvalidArgumentException
3216
-     * @throws InvalidDataTypeException
3217
-     * @throws InvalidInterfaceException
3218
-     */
3219
-    protected function _return_json($sticky_notices = false, $notices_arguments = [])
3220
-    {
3221
-        // make sure any EE_Error notices have been handled.
3222
-        $this->_process_notices($notices_arguments, true, $sticky_notices);
3223
-        $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : [];
3224
-        unset($this->_template_args['data']);
3225
-        $json = [
3226
-            'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
3227
-            'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
3228
-            'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
3229
-            'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
3230
-            'notices'   => EE_Error::get_notices(),
3231
-            'content'   => isset($this->_template_args['admin_page_content'])
3232
-                ? $this->_template_args['admin_page_content'] : '',
3233
-            'data'      => array_merge($data, ['template_args' => $this->_template_args]),
3234
-            'isEEajax'  => true
3235
-            // special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
3236
-        ];
3237
-        // make sure there are no php errors or headers_sent.  Then we can set correct json header.
3238
-        if (null === error_get_last() || ! headers_sent()) {
3239
-            header('Content-Type: application/json; charset=UTF-8');
3240
-        }
3241
-        echo wp_json_encode($json);
3242
-        exit();
3243
-    }
3244
-
3245
-
3246
-    /**
3247
-     * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
3248
-     *
3249
-     * @return void
3250
-     * @throws EE_Error
3251
-     * @throws InvalidArgumentException
3252
-     * @throws InvalidDataTypeException
3253
-     * @throws InvalidInterfaceException
3254
-     */
3255
-    public function return_json()
3256
-    {
3257
-        if ($this->request->isAjax()) {
3258
-            $this->_return_json();
3259
-        } else {
3260
-            throw new EE_Error(
3261
-                sprintf(
3262
-                    esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3263
-                    __FUNCTION__
3264
-                )
3265
-            );
3266
-        }
3267
-    }
3268
-
3269
-
3270
-    /**
3271
-     * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3272
-     * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3273
-     *
3274
-     * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3275
-     */
3276
-    public function set_hook_object(EE_Admin_Hooks $hook_obj)
3277
-    {
3278
-        $this->_hook_obj = $hook_obj;
3279
-    }
3280
-
3281
-
3282
-    /**
3283
-     *        generates  HTML wrapper with Tabbed nav for an admin page
3284
-     *
3285
-     * @param boolean $about whether to use the special about page wrapper or default.
3286
-     * @return void
3287
-     * @throws DomainException
3288
-     * @throws EE_Error
3289
-     * @throws InvalidArgumentException
3290
-     * @throws InvalidDataTypeException
3291
-     * @throws InvalidInterfaceException
3292
-     */
3293
-    public function admin_page_wrapper($about = false)
3294
-    {
3295
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3296
-        $this->_nav_tabs                                   = $this->_get_main_nav_tabs();
3297
-        $this->_template_args['nav_tabs']                  = $this->_nav_tabs;
3298
-        $this->_template_args['admin_page_title']          = $this->_admin_page_title;
3299
-
3300
-        $this->_template_args['before_admin_page_content'] = apply_filters(
3301
-            "FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3302
-            isset($this->_template_args['before_admin_page_content'])
3303
-                ? $this->_template_args['before_admin_page_content']
3304
-                : ''
3305
-        );
3306
-
3307
-        $this->_template_args['after_admin_page_content']  = apply_filters(
3308
-            "FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3309
-            isset($this->_template_args['after_admin_page_content'])
3310
-                ? $this->_template_args['after_admin_page_content']
3311
-                : ''
3312
-        );
3313
-        $this->_template_args['after_admin_page_content']  .= $this->_set_help_popup_content();
3314
-
3315
-        if ($this->request->isAjax()) {
3316
-            $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3317
-                // $template_path,
3318
-                EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php',
3319
-                $this->_template_args,
3320
-                true
3321
-            );
3322
-            $this->_return_json();
3323
-        }
3324
-        // load settings page wrapper template
3325
-        $template_path = $about
3326
-            ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3327
-            : EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php';
3328
-
3329
-        EEH_Template::display_template($template_path, $this->_template_args);
3330
-    }
3331
-
3332
-
3333
-    /**
3334
-     * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3335
-     *
3336
-     * @return string html
3337
-     * @throws EE_Error
3338
-     */
3339
-    protected function _get_main_nav_tabs()
3340
-    {
3341
-        // let's generate the html using the EEH_Tabbed_Content helper.
3342
-        // We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3343
-        // (rather than setting in the page_routes array)
3344
-        return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3345
-    }
3346
-
3347
-
3348
-    /**
3349
-     *        sort nav tabs
3350
-     *
3351
-     * @param $a
3352
-     * @param $b
3353
-     * @return int
3354
-     */
3355
-    private function _sort_nav_tabs($a, $b)
3356
-    {
3357
-        if ($a['order'] === $b['order']) {
3358
-            return 0;
3359
-        }
3360
-        return ($a['order'] < $b['order']) ? -1 : 1;
3361
-    }
3362
-
3363
-
3364
-    /**
3365
-     * generates HTML for the forms used on admin pages
3366
-     *
3367
-     * @param array  $input_vars - array of input field details
3368
-     * @param string $generator  indicates which generator to use: options are 'string' or 'array'
3369
-     * @param bool   $id
3370
-     * @return array|string
3371
-     * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3372
-     * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3373
-     */
3374
-    protected function _generate_admin_form_fields($input_vars = [], $generator = 'string', $id = false)
3375
-    {
3376
-        return $generator === 'string'
3377
-            ? EEH_Form_Fields::get_form_fields($input_vars, $id)
3378
-            : EEH_Form_Fields::get_form_fields_array($input_vars);
3379
-    }
3380
-
3381
-
3382
-    /**
3383
-     * generates the "Save" and "Save & Close" buttons for edit forms
3384
-     *
3385
-     * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3386
-     *                                   Close" button.
3387
-     * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3388
-     *                                   'Save', [1] => 'save & close')
3389
-     * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3390
-     *                                   via the "name" value in the button).  We can also use this to just dump
3391
-     *                                   default actions by submitting some other value.
3392
-     * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3393
-     *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3394
-     *                                   close (normal form handling).
3395
-     */
3396
-    protected function _set_save_buttons($both = true, $text = [], $actions = [], $referrer = null)
3397
-    {
3398
-        // make sure $text and $actions are in an array
3399
-        $text          = (array) $text;
3400
-        $actions       = (array) $actions;
3401
-        $referrer_url  = ! empty($referrer) ? $referrer : $this->request->getServerParam('REQUEST_URI');
3402
-        $button_text   = ! empty($text)
3403
-            ? $text
3404
-            : [
3405
-                esc_html__('Save', 'event_espresso'),
3406
-                esc_html__('Save and Close', 'event_espresso'),
3407
-            ];
3408
-        $default_names = ['save', 'save_and_close'];
3409
-        $buttons = '';
3410
-        foreach ($button_text as $key => $button) {
3411
-            $ref     = $default_names[ $key ];
3412
-            $name    = ! empty($actions) ? $actions[ $key ] : $ref;
3413
-            $buttons .= '<input type="submit" class="button button--primary ' . $ref . '" '
3414
-                        . 'value="' . $button . '" name="' . $name . '" '
3415
-                        . 'id="' . $this->_current_view . '_' . $ref . '" />';
3416
-            if (! $both) {
3417
-                break;
3418
-            }
3419
-        }
3420
-        // add in a hidden index for the current page (so save and close redirects properly)
3421
-        $buttons .= '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3422
-                   . $referrer_url
3423
-                   . '" />';
3424
-        $this->_template_args['save_buttons'] = $buttons;
3425
-    }
3426
-
3427
-
3428
-    /**
3429
-     * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3430
-     *
3431
-     * @param string $route
3432
-     * @param array  $additional_hidden_fields
3433
-     * @see   $this->_set_add_edit_form_tags() for details on params
3434
-     * @since 4.6.0
3435
-     */
3436
-    public function set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3437
-    {
3438
-        $this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3439
-    }
3440
-
3441
-
3442
-    /**
3443
-     * set form open and close tags on add/edit pages.
3444
-     *
3445
-     * @param string $route                    the route you want the form to direct to
3446
-     * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3447
-     * @return void
3448
-     */
3449
-    protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3450
-    {
3451
-        if (empty($route)) {
3452
-            $user_msg = esc_html__(
3453
-                'An error occurred. No action was set for this page\'s form.',
3454
-                'event_espresso'
3455
-            );
3456
-            $dev_msg  = $user_msg . "\n"
3457
-                        . sprintf(
3458
-                            esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3459
-                            __FUNCTION__,
3460
-                            __CLASS__
3461
-                        );
3462
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3463
-        }
3464
-        // open form
3465
-        $action = $this->_admin_base_url;
3466
-        $this->_template_args['before_admin_page_content'] = "
3092
+		$this->_template_args['list_table_hidden_fields']        = $hidden_form_fields;
3093
+		// display message about search results?
3094
+		$search = $this->request->getRequestParam('s');
3095
+		$this->_template_args['before_list_table'] .= ! empty($search)
3096
+			? '<p class="ee-search-results">' . sprintf(
3097
+				esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
3098
+				trim($search, '%')
3099
+			) . '</p>'
3100
+			: '';
3101
+		// filter before_list_table template arg
3102
+		$this->_template_args['before_list_table'] = apply_filters(
3103
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
3104
+			$this->_template_args['before_list_table'],
3105
+			$this->page_slug,
3106
+			$this->request->requestParams(),
3107
+			$this->_req_action
3108
+		);
3109
+		// convert to array and filter again
3110
+		// arrays are easier to inject new items in a specific location,
3111
+		// but would not be backwards compatible, so we have to add a new filter
3112
+		$this->_template_args['before_list_table'] = implode(
3113
+			" \n",
3114
+			(array) apply_filters(
3115
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_args_array',
3116
+				(array) $this->_template_args['before_list_table'],
3117
+				$this->page_slug,
3118
+				$this->request->requestParams(),
3119
+				$this->_req_action
3120
+			)
3121
+		);
3122
+		// filter after_list_table template arg
3123
+		$this->_template_args['after_list_table'] = apply_filters(
3124
+			'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_arg',
3125
+			$this->_template_args['after_list_table'],
3126
+			$this->page_slug,
3127
+			$this->request->requestParams(),
3128
+			$this->_req_action
3129
+		);
3130
+		// convert to array and filter again
3131
+		// arrays are easier to inject new items in a specific location,
3132
+		// but would not be backwards compatible, so we have to add a new filter
3133
+		$this->_template_args['after_list_table']   = implode(
3134
+			" \n",
3135
+			(array) apply_filters(
3136
+				'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
3137
+				(array) $this->_template_args['after_list_table'],
3138
+				$this->page_slug,
3139
+				$this->request->requestParams(),
3140
+				$this->_req_action
3141
+			)
3142
+		);
3143
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
3144
+			$template_path,
3145
+			$this->_template_args,
3146
+			true
3147
+		);
3148
+		// the final template wrapper
3149
+		if ($sidebar) {
3150
+			$this->display_admin_page_with_sidebar();
3151
+		} else {
3152
+			$this->display_admin_page_with_no_sidebar();
3153
+		}
3154
+	}
3155
+
3156
+
3157
+	/**
3158
+	 * This just prepares a legend using the given items and the admin_details_legend.template.php file and returns the
3159
+	 * html string for the legend.
3160
+	 * $items are expected in an array in the following format:
3161
+	 * $legend_items = array(
3162
+	 *        'item_id' => array(
3163
+	 *            'icon' => 'http://url_to_icon_being_described.png',
3164
+	 *            'desc' => esc_html__('localized description of item');
3165
+	 *        )
3166
+	 * );
3167
+	 *
3168
+	 * @param array $items see above for format of array
3169
+	 * @return string html string of legend
3170
+	 * @throws DomainException
3171
+	 */
3172
+	protected function _display_legend($items)
3173
+	{
3174
+		$this->_template_args['items'] = apply_filters(
3175
+			'FHEE__EE_Admin_Page___display_legend__items',
3176
+			(array) $items,
3177
+			$this
3178
+		);
3179
+		/** @var EventEspresso\core\admin\StatusChangeNotice $status_change_notice */
3180
+		$status_change_notice = $this->loader->getShared('EventEspresso\core\admin\StatusChangeNotice');
3181
+		if (! $status_change_notice->isDismissed()) {
3182
+			$this->_template_args['status_change_notice'] = EEH_Template::display_template(
3183
+				EE_ADMIN_TEMPLATE . 'status_change_notice.template.php',
3184
+				[ 'context' => '__admin-legend', 'page_slug' => $this->page_slug ],
3185
+				true
3186
+			);
3187
+		}
3188
+		return EEH_Template::display_template(
3189
+			EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3190
+			$this->_template_args,
3191
+			true
3192
+		);
3193
+	}
3194
+
3195
+
3196
+	/**
3197
+	 * This is used whenever we're DOING_AJAX to return a formatted json array that our calling javascript can expect
3198
+	 * The returned json object is created from an array in the following format:
3199
+	 * array(
3200
+	 *  'error' => FALSE, //(default FALSE), contains any errors and/or exceptions (exceptions return json early),
3201
+	 *  'success' => FALSE, //(default FALSE) - contains any special success message.
3202
+	 *  'notices' => '', // - contains any EE_Error formatted notices
3203
+	 *  'content' => 'string can be html', //this is a string of formatted content (can be html)
3204
+	 *  'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
3205
+	 *  We're also going to include the template args with every package (so js can pick out any specific template args
3206
+	 *  that might be included in here)
3207
+	 * )
3208
+	 * The json object is populated by whatever is set in the $_template_args property.
3209
+	 *
3210
+	 * @param bool  $sticky_notices    Used to indicate whether you want to ensure notices are added to a transient
3211
+	 *                                 instead of displayed.
3212
+	 * @param array $notices_arguments Use this to pass any additional args on to the _process_notices.
3213
+	 * @return void
3214
+	 * @throws EE_Error
3215
+	 * @throws InvalidArgumentException
3216
+	 * @throws InvalidDataTypeException
3217
+	 * @throws InvalidInterfaceException
3218
+	 */
3219
+	protected function _return_json($sticky_notices = false, $notices_arguments = [])
3220
+	{
3221
+		// make sure any EE_Error notices have been handled.
3222
+		$this->_process_notices($notices_arguments, true, $sticky_notices);
3223
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : [];
3224
+		unset($this->_template_args['data']);
3225
+		$json = [
3226
+			'error'     => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
3227
+			'success'   => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
3228
+			'errors'    => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
3229
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
3230
+			'notices'   => EE_Error::get_notices(),
3231
+			'content'   => isset($this->_template_args['admin_page_content'])
3232
+				? $this->_template_args['admin_page_content'] : '',
3233
+			'data'      => array_merge($data, ['template_args' => $this->_template_args]),
3234
+			'isEEajax'  => true
3235
+			// special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
3236
+		];
3237
+		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
3238
+		if (null === error_get_last() || ! headers_sent()) {
3239
+			header('Content-Type: application/json; charset=UTF-8');
3240
+		}
3241
+		echo wp_json_encode($json);
3242
+		exit();
3243
+	}
3244
+
3245
+
3246
+	/**
3247
+	 * Simply a wrapper for the protected method so we can call this outside the class (ONLY when doing ajax)
3248
+	 *
3249
+	 * @return void
3250
+	 * @throws EE_Error
3251
+	 * @throws InvalidArgumentException
3252
+	 * @throws InvalidDataTypeException
3253
+	 * @throws InvalidInterfaceException
3254
+	 */
3255
+	public function return_json()
3256
+	{
3257
+		if ($this->request->isAjax()) {
3258
+			$this->_return_json();
3259
+		} else {
3260
+			throw new EE_Error(
3261
+				sprintf(
3262
+					esc_html__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'),
3263
+					__FUNCTION__
3264
+				)
3265
+			);
3266
+		}
3267
+	}
3268
+
3269
+
3270
+	/**
3271
+	 * This provides a way for child hook classes to send along themselves by reference so methods/properties within
3272
+	 * them can be accessed by EE_Admin_child pages. This is assigned to the $_hook_obj property.
3273
+	 *
3274
+	 * @param EE_Admin_Hooks $hook_obj This will be the object for the EE_Admin_Hooks child
3275
+	 */
3276
+	public function set_hook_object(EE_Admin_Hooks $hook_obj)
3277
+	{
3278
+		$this->_hook_obj = $hook_obj;
3279
+	}
3280
+
3281
+
3282
+	/**
3283
+	 *        generates  HTML wrapper with Tabbed nav for an admin page
3284
+	 *
3285
+	 * @param boolean $about whether to use the special about page wrapper or default.
3286
+	 * @return void
3287
+	 * @throws DomainException
3288
+	 * @throws EE_Error
3289
+	 * @throws InvalidArgumentException
3290
+	 * @throws InvalidDataTypeException
3291
+	 * @throws InvalidInterfaceException
3292
+	 */
3293
+	public function admin_page_wrapper($about = false)
3294
+	{
3295
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3296
+		$this->_nav_tabs                                   = $this->_get_main_nav_tabs();
3297
+		$this->_template_args['nav_tabs']                  = $this->_nav_tabs;
3298
+		$this->_template_args['admin_page_title']          = $this->_admin_page_title;
3299
+
3300
+		$this->_template_args['before_admin_page_content'] = apply_filters(
3301
+			"FHEE_before_admin_page_content{$this->_current_page}{$this->_current_view}",
3302
+			isset($this->_template_args['before_admin_page_content'])
3303
+				? $this->_template_args['before_admin_page_content']
3304
+				: ''
3305
+		);
3306
+
3307
+		$this->_template_args['after_admin_page_content']  = apply_filters(
3308
+			"FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3309
+			isset($this->_template_args['after_admin_page_content'])
3310
+				? $this->_template_args['after_admin_page_content']
3311
+				: ''
3312
+		);
3313
+		$this->_template_args['after_admin_page_content']  .= $this->_set_help_popup_content();
3314
+
3315
+		if ($this->request->isAjax()) {
3316
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template(
3317
+				// $template_path,
3318
+				EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php',
3319
+				$this->_template_args,
3320
+				true
3321
+			);
3322
+			$this->_return_json();
3323
+		}
3324
+		// load settings page wrapper template
3325
+		$template_path = $about
3326
+			? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3327
+			: EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php';
3328
+
3329
+		EEH_Template::display_template($template_path, $this->_template_args);
3330
+	}
3331
+
3332
+
3333
+	/**
3334
+	 * This returns the admin_nav tabs html using the configuration in the _nav_tabs property
3335
+	 *
3336
+	 * @return string html
3337
+	 * @throws EE_Error
3338
+	 */
3339
+	protected function _get_main_nav_tabs()
3340
+	{
3341
+		// let's generate the html using the EEH_Tabbed_Content helper.
3342
+		// We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute
3343
+		// (rather than setting in the page_routes array)
3344
+		return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
3345
+	}
3346
+
3347
+
3348
+	/**
3349
+	 *        sort nav tabs
3350
+	 *
3351
+	 * @param $a
3352
+	 * @param $b
3353
+	 * @return int
3354
+	 */
3355
+	private function _sort_nav_tabs($a, $b)
3356
+	{
3357
+		if ($a['order'] === $b['order']) {
3358
+			return 0;
3359
+		}
3360
+		return ($a['order'] < $b['order']) ? -1 : 1;
3361
+	}
3362
+
3363
+
3364
+	/**
3365
+	 * generates HTML for the forms used on admin pages
3366
+	 *
3367
+	 * @param array  $input_vars - array of input field details
3368
+	 * @param string $generator  indicates which generator to use: options are 'string' or 'array'
3369
+	 * @param bool   $id
3370
+	 * @return array|string
3371
+	 * @uses   EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
3372
+	 * @uses   EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
3373
+	 */
3374
+	protected function _generate_admin_form_fields($input_vars = [], $generator = 'string', $id = false)
3375
+	{
3376
+		return $generator === 'string'
3377
+			? EEH_Form_Fields::get_form_fields($input_vars, $id)
3378
+			: EEH_Form_Fields::get_form_fields_array($input_vars);
3379
+	}
3380
+
3381
+
3382
+	/**
3383
+	 * generates the "Save" and "Save & Close" buttons for edit forms
3384
+	 *
3385
+	 * @param bool             $both     if true then both buttons will be generated.  If false then just the "Save &
3386
+	 *                                   Close" button.
3387
+	 * @param array            $text     if included, generator will use the given text for the buttons ( array([0] =>
3388
+	 *                                   'Save', [1] => 'save & close')
3389
+	 * @param array            $actions  if included allows us to set the actions that each button will carry out (i.e.
3390
+	 *                                   via the "name" value in the button).  We can also use this to just dump
3391
+	 *                                   default actions by submitting some other value.
3392
+	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it
3393
+	 *                                   will use the $referrer string. IF null, then we don't do ANYTHING on save and
3394
+	 *                                   close (normal form handling).
3395
+	 */
3396
+	protected function _set_save_buttons($both = true, $text = [], $actions = [], $referrer = null)
3397
+	{
3398
+		// make sure $text and $actions are in an array
3399
+		$text          = (array) $text;
3400
+		$actions       = (array) $actions;
3401
+		$referrer_url  = ! empty($referrer) ? $referrer : $this->request->getServerParam('REQUEST_URI');
3402
+		$button_text   = ! empty($text)
3403
+			? $text
3404
+			: [
3405
+				esc_html__('Save', 'event_espresso'),
3406
+				esc_html__('Save and Close', 'event_espresso'),
3407
+			];
3408
+		$default_names = ['save', 'save_and_close'];
3409
+		$buttons = '';
3410
+		foreach ($button_text as $key => $button) {
3411
+			$ref     = $default_names[ $key ];
3412
+			$name    = ! empty($actions) ? $actions[ $key ] : $ref;
3413
+			$buttons .= '<input type="submit" class="button button--primary ' . $ref . '" '
3414
+						. 'value="' . $button . '" name="' . $name . '" '
3415
+						. 'id="' . $this->_current_view . '_' . $ref . '" />';
3416
+			if (! $both) {
3417
+				break;
3418
+			}
3419
+		}
3420
+		// add in a hidden index for the current page (so save and close redirects properly)
3421
+		$buttons .= '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'
3422
+				   . $referrer_url
3423
+				   . '" />';
3424
+		$this->_template_args['save_buttons'] = $buttons;
3425
+	}
3426
+
3427
+
3428
+	/**
3429
+	 * Wrapper for the protected function.  Allows plugins/addons to call this to set the form tags.
3430
+	 *
3431
+	 * @param string $route
3432
+	 * @param array  $additional_hidden_fields
3433
+	 * @see   $this->_set_add_edit_form_tags() for details on params
3434
+	 * @since 4.6.0
3435
+	 */
3436
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3437
+	{
3438
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
3439
+	}
3440
+
3441
+
3442
+	/**
3443
+	 * set form open and close tags on add/edit pages.
3444
+	 *
3445
+	 * @param string $route                    the route you want the form to direct to
3446
+	 * @param array  $additional_hidden_fields any additional hidden fields required in the form header
3447
+	 * @return void
3448
+	 */
3449
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = [])
3450
+	{
3451
+		if (empty($route)) {
3452
+			$user_msg = esc_html__(
3453
+				'An error occurred. No action was set for this page\'s form.',
3454
+				'event_espresso'
3455
+			);
3456
+			$dev_msg  = $user_msg . "\n"
3457
+						. sprintf(
3458
+							esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3459
+							__FUNCTION__,
3460
+							__CLASS__
3461
+						);
3462
+			EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3463
+		}
3464
+		// open form
3465
+		$action = $this->_admin_base_url;
3466
+		$this->_template_args['before_admin_page_content'] = "
3467 3467
             <form name='form' method='post' action='{$action}' id='{$route}_event_form' class='ee-admin-page-form' >
3468 3468
             ";
3469
-        // add nonce
3470
-        $nonce                                             =
3471
-            wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3472
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3473
-        // add REQUIRED form action
3474
-        $hidden_fields = [
3475
-            'action' => ['type' => 'hidden', 'value' => $route],
3476
-        ];
3477
-        // merge arrays
3478
-        $hidden_fields = is_array($additional_hidden_fields)
3479
-            ? array_merge($hidden_fields, $additional_hidden_fields)
3480
-            : $hidden_fields;
3481
-        // generate form fields
3482
-        $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3483
-        // add fields to form
3484
-        foreach ((array) $form_fields as $form_field) {
3485
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3486
-        }
3487
-        // close form
3488
-        $this->_template_args['after_admin_page_content'] = '</form>';
3489
-    }
3490
-
3491
-
3492
-    /**
3493
-     * Public Wrapper for _redirect_after_action() method since its
3494
-     * discovered it would be useful for external code to have access.
3495
-     *
3496
-     * @param bool   $success
3497
-     * @param string $what
3498
-     * @param string $action_desc
3499
-     * @param array  $query_args
3500
-     * @param bool   $override_overwrite
3501
-     * @throws EE_Error
3502
-     * @see   EE_Admin_Page::_redirect_after_action() for params.
3503
-     * @since 4.5.0
3504
-     */
3505
-    public function redirect_after_action(
3506
-        $success = false,
3507
-        $what = 'item',
3508
-        $action_desc = 'processed',
3509
-        $query_args = [],
3510
-        $override_overwrite = false
3511
-    ) {
3512
-        $this->_redirect_after_action(
3513
-            $success,
3514
-            $what,
3515
-            $action_desc,
3516
-            $query_args,
3517
-            $override_overwrite
3518
-        );
3519
-    }
3520
-
3521
-
3522
-    /**
3523
-     * Helper method for merging existing request data with the returned redirect url.
3524
-     *
3525
-     * This is typically used for redirects after an action so that if the original view was a filtered view those
3526
-     * filters are still applied.
3527
-     *
3528
-     * @param array $new_route_data
3529
-     * @return array
3530
-     */
3531
-    protected function mergeExistingRequestParamsWithRedirectArgs(array $new_route_data)
3532
-    {
3533
-        foreach ($this->request->requestParams() as $ref => $value) {
3534
-            // unset nonces
3535
-            if (strpos($ref, 'nonce') !== false) {
3536
-                $this->request->unSetRequestParam($ref);
3537
-                continue;
3538
-            }
3539
-            // urlencode values.
3540
-            $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
3541
-            $this->request->setRequestParam($ref, $value);
3542
-        }
3543
-        return array_merge($this->request->requestParams(), $new_route_data);
3544
-    }
3545
-
3546
-
3547
-    /**
3548
-     *    _redirect_after_action
3549
-     *
3550
-     * @param int    $success            - whether success was for two or more records, or just one, or none
3551
-     * @param string $what               - what the action was performed on
3552
-     * @param string $action_desc        - what was done ie: updated, deleted, etc
3553
-     * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3554
-     *                                   action is completed
3555
-     * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3556
-     *                                   override this so that they show.
3557
-     * @return void
3558
-     * @throws EE_Error
3559
-     * @throws InvalidArgumentException
3560
-     * @throws InvalidDataTypeException
3561
-     * @throws InvalidInterfaceException
3562
-     */
3563
-    protected function _redirect_after_action(
3564
-        $success = 0,
3565
-        $what = 'item',
3566
-        $action_desc = 'processed',
3567
-        $query_args = [],
3568
-        $override_overwrite = false
3569
-    ) {
3570
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3571
-        // class name for actions/filters.
3572
-        $classname = get_class($this);
3573
-        // set redirect url.
3574
-        // Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3575
-        // otherwise we go with whatever is set as the _admin_base_url
3576
-        $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3577
-        $notices      = EE_Error::get_notices(false);
3578
-        // overwrite default success messages //BUT ONLY if overwrite not overridden
3579
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3580
-            EE_Error::overwrite_success();
3581
-        }
3582
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3583
-            // how many records affected ? more than one record ? or just one ?
3584
-            if ($success > 1) {
3585
-                // set plural msg
3586
-                EE_Error::add_success(
3587
-                    sprintf(
3588
-                        esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3589
-                        $what,
3590
-                        $action_desc
3591
-                    ),
3592
-                    __FILE__,
3593
-                    __FUNCTION__,
3594
-                    __LINE__
3595
-                );
3596
-            } elseif ($success === 1) {
3597
-                // set singular msg
3598
-                EE_Error::add_success(
3599
-                    sprintf(
3600
-                        esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3601
-                        $what,
3602
-                        $action_desc
3603
-                    ),
3604
-                    __FILE__,
3605
-                    __FUNCTION__,
3606
-                    __LINE__
3607
-                );
3608
-            }
3609
-        }
3610
-        // check that $query_args isn't something crazy
3611
-        if (! is_array($query_args)) {
3612
-            $query_args = [];
3613
-        }
3614
-        /**
3615
-         * Allow injecting actions before the query_args are modified for possible different
3616
-         * redirections on save and close actions
3617
-         *
3618
-         * @param array $query_args       The original query_args array coming into the
3619
-         *                                method.
3620
-         * @since 4.2.0
3621
-         */
3622
-        do_action(
3623
-            "AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3624
-            $query_args
3625
-        );
3626
-        // calculate where we're going (if we have a "save and close" button pushed)
3627
-
3628
-        if (
3629
-            $this->request->requestParamIsSet('save_and_close')
3630
-            && $this->request->requestParamIsSet('save_and_close_referrer')
3631
-        ) {
3632
-            // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3633
-            $parsed_url = parse_url($this->request->getRequestParam('save_and_close_referrer', '', 'url'));
3634
-            // regenerate query args array from referrer URL
3635
-            parse_str($parsed_url['query'], $query_args);
3636
-            // correct page and action will be in the query args now
3637
-            $redirect_url = admin_url('admin.php');
3638
-        }
3639
-        // merge any default query_args set in _default_route_query_args property
3640
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3641
-            $args_to_merge = [];
3642
-            foreach ($this->_default_route_query_args as $query_param => $query_value) {
3643
-                // is there a wp_referer array in our _default_route_query_args property?
3644
-                if ($query_param === 'wp_referer') {
3645
-                    $query_value = (array) $query_value;
3646
-                    foreach ($query_value as $reference => $value) {
3647
-                        if (strpos($reference, 'nonce') !== false) {
3648
-                            continue;
3649
-                        }
3650
-                        // finally we will override any arguments in the referer with
3651
-                        // what might be set on the _default_route_query_args array.
3652
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3653
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3654
-                        } else {
3655
-                            $args_to_merge[ $reference ] = urlencode($value);
3656
-                        }
3657
-                    }
3658
-                    continue;
3659
-                }
3660
-                $args_to_merge[ $query_param ] = $query_value;
3661
-            }
3662
-            // now let's merge these arguments but override with what was specifically sent in to the
3663
-            // redirect.
3664
-            $query_args = array_merge($args_to_merge, $query_args);
3665
-        }
3666
-        $this->_process_notices($query_args);
3667
-        // generate redirect url
3668
-        // if redirecting to anything other than the main page, add a nonce
3669
-        if (isset($query_args['action'])) {
3670
-            // manually generate wp_nonce and merge that with the query vars
3671
-            // becuz the wp_nonce_url function wrecks havoc on some vars
3672
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3673
-        }
3674
-        // we're adding some hooks and filters in here for processing any things just before redirects
3675
-        // (example: an admin page has done an insert or update and we want to run something after that).
3676
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3677
-        $redirect_url = apply_filters(
3678
-            'FHEE_redirect_' . $classname . $this->_req_action,
3679
-            EE_Admin_Page::add_query_args_and_nonce($query_args, $redirect_url),
3680
-            $query_args
3681
-        );
3682
-        // check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3683
-        if ($this->request->isAjax()) {
3684
-            $default_data                    = [
3685
-                'close'        => true,
3686
-                'redirect_url' => $redirect_url,
3687
-                'where'        => 'main',
3688
-                'what'         => 'append',
3689
-            ];
3690
-            $this->_template_args['success'] = $success;
3691
-            $this->_template_args['data']    = ! empty($this->_template_args['data']) ? array_merge(
3692
-                $default_data,
3693
-                $this->_template_args['data']
3694
-            ) : $default_data;
3695
-            $this->_return_json();
3696
-        }
3697
-        wp_safe_redirect($redirect_url);
3698
-        exit();
3699
-    }
3700
-
3701
-
3702
-    /**
3703
-     * process any notices before redirecting (or returning ajax request)
3704
-     * This method sets the $this->_template_args['notices'] attribute;
3705
-     *
3706
-     * @param array $query_args         any query args that need to be used for notice transient ('action')
3707
-     * @param bool  $skip_route_verify  This is typically used when we are processing notices REALLY early and
3708
-     *                                  page_routes haven't been defined yet.
3709
-     * @param bool  $sticky_notices     This is used to flag that regardless of whether this is doing_ajax or not, we
3710
-     *                                  still save a transient for the notice.
3711
-     * @return void
3712
-     * @throws EE_Error
3713
-     * @throws InvalidArgumentException
3714
-     * @throws InvalidDataTypeException
3715
-     * @throws InvalidInterfaceException
3716
-     */
3717
-    protected function _process_notices($query_args = [], $skip_route_verify = false, $sticky_notices = true)
3718
-    {
3719
-        // first let's set individual error properties if doing_ajax and the properties aren't already set.
3720
-        if ($this->request->isAjax()) {
3721
-            $notices = EE_Error::get_notices(false);
3722
-            if (empty($this->_template_args['success'])) {
3723
-                $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3724
-            }
3725
-            if (empty($this->_template_args['errors'])) {
3726
-                $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3727
-            }
3728
-            if (empty($this->_template_args['attention'])) {
3729
-                $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3730
-            }
3731
-        }
3732
-        $this->_template_args['notices'] = EE_Error::get_notices();
3733
-        // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3734
-        if (! $this->request->isAjax() || $sticky_notices) {
3735
-            $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3736
-            $this->_add_transient(
3737
-                $route,
3738
-                $this->_template_args['notices'],
3739
-                true,
3740
-                $skip_route_verify
3741
-            );
3742
-        }
3743
-    }
3744
-
3745
-
3746
-    /**
3747
-     * get_action_link_or_button
3748
-     * returns the button html for adding, editing, or deleting an item (depending on given type)
3749
-     *
3750
-     * @param string $action        use this to indicate which action the url is generated with.
3751
-     * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3752
-     *                              property.
3753
-     * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3754
-     * @param string $class         Use this to give the class for the button. Defaults to 'button--primary'
3755
-     * @param string $base_url      If this is not provided
3756
-     *                              the _admin_base_url will be used as the default for the button base_url.
3757
-     *                              Otherwise this value will be used.
3758
-     * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3759
-     * @return string
3760
-     * @throws InvalidArgumentException
3761
-     * @throws InvalidInterfaceException
3762
-     * @throws InvalidDataTypeException
3763
-     * @throws EE_Error
3764
-     */
3765
-    public function get_action_link_or_button(
3766
-        $action,
3767
-        $type = 'add',
3768
-        $extra_request = [],
3769
-        $class = 'button--primary',
3770
-        $base_url = '',
3771
-        $exclude_nonce = false
3772
-    ) {
3773
-        // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3774
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3775
-            throw new EE_Error(
3776
-                sprintf(
3777
-                    esc_html__(
3778
-                        'There is no page route for given action for the button.  This action was given: %s',
3779
-                        'event_espresso'
3780
-                    ),
3781
-                    $action
3782
-                )
3783
-            );
3784
-        }
3785
-        if (! isset($this->_labels['buttons'][ $type ])) {
3786
-            throw new EE_Error(
3787
-                sprintf(
3788
-                    esc_html__(
3789
-                        'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3790
-                        'event_espresso'
3791
-                    ),
3792
-                    $type
3793
-                )
3794
-            );
3795
-        }
3796
-        // finally check user access for this button.
3797
-        $has_access = $this->check_user_access($action, true);
3798
-        if (! $has_access) {
3799
-            return '';
3800
-        }
3801
-        $_base_url  = ! $base_url ? $this->_admin_base_url : $base_url;
3802
-        $query_args = [
3803
-            'action' => $action,
3804
-        ];
3805
-        // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3806
-        if (! empty($extra_request)) {
3807
-            $query_args = array_merge($extra_request, $query_args);
3808
-        }
3809
-        $url = EE_Admin_Page::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3810
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3811
-    }
3812
-
3813
-
3814
-    /**
3815
-     * _per_page_screen_option
3816
-     * Utility function for adding in a per_page_option in the screen_options_dropdown.
3817
-     *
3818
-     * @return void
3819
-     * @throws InvalidArgumentException
3820
-     * @throws InvalidInterfaceException
3821
-     * @throws InvalidDataTypeException
3822
-     */
3823
-    protected function _per_page_screen_option()
3824
-    {
3825
-        $option = 'per_page';
3826
-        $args   = [
3827
-            'label'   => apply_filters(
3828
-                'FHEE__EE_Admin_Page___per_page_screen_options___label',
3829
-                $this->_admin_page_title,
3830
-                $this
3831
-            ),
3832
-            'default' => (int) apply_filters(
3833
-                'FHEE__EE_Admin_Page___per_page_screen_options__default',
3834
-                20
3835
-            ),
3836
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3837
-        ];
3838
-        // ONLY add the screen option if the user has access to it.
3839
-        if ($this->check_user_access($this->_current_view, true)) {
3840
-            add_screen_option($option, $args);
3841
-        }
3842
-    }
3843
-
3844
-
3845
-    /**
3846
-     * set_per_page_screen_option
3847
-     * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3848
-     * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3849
-     * admin_menu.
3850
-     *
3851
-     * @return void
3852
-     */
3853
-    private function _set_per_page_screen_options()
3854
-    {
3855
-        if ($this->request->requestParamIsSet('wp_screen_options')) {
3856
-            check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3857
-            if (! $user = wp_get_current_user()) {
3858
-                return;
3859
-            }
3860
-            $option = $this->request->getRequestParam('wp_screen_options[option]', '', 'key');
3861
-            if (! $option) {
3862
-                return;
3863
-            }
3864
-            $value  = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3865
-            $map_option = $option;
3866
-            $option     = str_replace('-', '_', $option);
3867
-            switch ($map_option) {
3868
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3869
-                    $max_value = apply_filters(
3870
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3871
-                        999,
3872
-                        $this->_current_page,
3873
-                        $this->_current_view
3874
-                    );
3875
-                    if ($value < 1) {
3876
-                        return;
3877
-                    }
3878
-                    $value = min($value, $max_value);
3879
-                    break;
3880
-                default:
3881
-                    $value = apply_filters(
3882
-                        'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3883
-                        false,
3884
-                        $option,
3885
-                        $value
3886
-                    );
3887
-                    if (false === $value) {
3888
-                        return;
3889
-                    }
3890
-                    break;
3891
-            }
3892
-            update_user_meta($user->ID, $option, $value);
3893
-            wp_safe_redirect(remove_query_arg(['pagenum', 'apage', 'paged'], wp_get_referer()));
3894
-            exit;
3895
-        }
3896
-    }
3897
-
3898
-
3899
-    /**
3900
-     * This just allows for setting the $_template_args property if it needs to be set outside the object
3901
-     *
3902
-     * @param array $data array that will be assigned to template args.
3903
-     */
3904
-    public function set_template_args($data)
3905
-    {
3906
-        $this->_template_args = array_merge($this->_template_args, (array) $data);
3907
-    }
3908
-
3909
-
3910
-    /**
3911
-     * This makes available the WP transient system for temporarily moving data between routes
3912
-     *
3913
-     * @param string $route             the route that should receive the transient
3914
-     * @param array  $data              the data that gets sent
3915
-     * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3916
-     *                                  normal route transient.
3917
-     * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3918
-     *                                  when we are adding a transient before page_routes have been defined.
3919
-     * @return void
3920
-     * @throws EE_Error
3921
-     */
3922
-    protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3923
-    {
3924
-        $user_id = get_current_user_id();
3925
-        if (! $skip_route_verify) {
3926
-            $this->_verify_route($route);
3927
-        }
3928
-        // now let's set the string for what kind of transient we're setting
3929
-        $transient = $notices
3930
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3931
-            : 'rte_tx_' . $route . '_' . $user_id;
3932
-        $data      = $notices ? ['notices' => $data] : $data;
3933
-        // is there already a transient for this route?  If there is then let's ADD to that transient
3934
-        $existing = is_multisite() && is_network_admin()
3935
-            ? get_site_transient($transient)
3936
-            : get_transient($transient);
3937
-        if ($existing) {
3938
-            $data = array_merge((array) $data, (array) $existing);
3939
-        }
3940
-        if (is_multisite() && is_network_admin()) {
3941
-            set_site_transient($transient, $data, 8);
3942
-        } else {
3943
-            set_transient($transient, $data, 8);
3944
-        }
3945
-    }
3946
-
3947
-
3948
-    /**
3949
-     * this retrieves the temporary transient that has been set for moving data between routes.
3950
-     *
3951
-     * @param bool   $notices true we get notices transient. False we just return normal route transient
3952
-     * @param string $route
3953
-     * @return mixed data
3954
-     */
3955
-    protected function _get_transient($notices = false, $route = '')
3956
-    {
3957
-        $user_id   = get_current_user_id();
3958
-        $route     = ! $route ? $this->_req_action : $route;
3959
-        $transient = $notices
3960
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3961
-            : 'rte_tx_' . $route . '_' . $user_id;
3962
-        $data      = is_multisite() && is_network_admin()
3963
-            ? get_site_transient($transient)
3964
-            : get_transient($transient);
3965
-        // delete transient after retrieval (just in case it hasn't expired);
3966
-        if (is_multisite() && is_network_admin()) {
3967
-            delete_site_transient($transient);
3968
-        } else {
3969
-            delete_transient($transient);
3970
-        }
3971
-        return $notices && isset($data['notices']) ? $data['notices'] : $data;
3972
-    }
3973
-
3974
-
3975
-    /**
3976
-     * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3977
-     * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3978
-     * default route callback on the EE_Admin page you want it run.)
3979
-     *
3980
-     * @return void
3981
-     */
3982
-    protected function _transient_garbage_collection()
3983
-    {
3984
-        global $wpdb;
3985
-        // retrieve all existing transients
3986
-        $query =
3987
-            "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3988
-        if ($results = $wpdb->get_results($query)) {
3989
-            foreach ($results as $result) {
3990
-                $transient = str_replace('_transient_', '', $result->option_name);
3991
-                get_transient($transient);
3992
-                if (is_multisite() && is_network_admin()) {
3993
-                    get_site_transient($transient);
3994
-                }
3995
-            }
3996
-        }
3997
-    }
3998
-
3999
-
4000
-    /**
4001
-     * get_view
4002
-     *
4003
-     * @return string content of _view property
4004
-     */
4005
-    public function get_view()
4006
-    {
4007
-        return $this->_view;
4008
-    }
4009
-
4010
-
4011
-    /**
4012
-     * getter for the protected $_views property
4013
-     *
4014
-     * @return array
4015
-     */
4016
-    public function get_views()
4017
-    {
4018
-        return $this->_views;
4019
-    }
4020
-
4021
-
4022
-    /**
4023
-     * get_current_page
4024
-     *
4025
-     * @return string _current_page property value
4026
-     */
4027
-    public function get_current_page()
4028
-    {
4029
-        return $this->_current_page;
4030
-    }
4031
-
4032
-
4033
-    /**
4034
-     * get_current_view
4035
-     *
4036
-     * @return string _current_view property value
4037
-     */
4038
-    public function get_current_view()
4039
-    {
4040
-        return $this->_current_view;
4041
-    }
4042
-
4043
-
4044
-    /**
4045
-     * get_current_screen
4046
-     *
4047
-     * @return object The current WP_Screen object
4048
-     */
4049
-    public function get_current_screen()
4050
-    {
4051
-        return $this->_current_screen;
4052
-    }
4053
-
4054
-
4055
-    /**
4056
-     * get_current_page_view_url
4057
-     *
4058
-     * @return string This returns the url for the current_page_view.
4059
-     */
4060
-    public function get_current_page_view_url()
4061
-    {
4062
-        return $this->_current_page_view_url;
4063
-    }
4064
-
4065
-
4066
-    /**
4067
-     * just returns the Request
4068
-     *
4069
-     * @return RequestInterface
4070
-     */
4071
-    public function get_request()
4072
-    {
4073
-        return $this->request;
4074
-    }
4075
-
4076
-
4077
-    /**
4078
-     * just returns the _req_data property
4079
-     *
4080
-     * @return array
4081
-     */
4082
-    public function get_request_data()
4083
-    {
4084
-        return $this->request->requestParams();
4085
-    }
4086
-
4087
-
4088
-    /**
4089
-     * returns the _req_data protected property
4090
-     *
4091
-     * @return string
4092
-     */
4093
-    public function get_req_action()
4094
-    {
4095
-        return $this->_req_action;
4096
-    }
4097
-
4098
-
4099
-    /**
4100
-     * @return bool  value of $_is_caf property
4101
-     */
4102
-    public function is_caf()
4103
-    {
4104
-        return $this->_is_caf;
4105
-    }
4106
-
4107
-
4108
-    /**
4109
-     * @return mixed
4110
-     */
4111
-    public function default_espresso_metaboxes()
4112
-    {
4113
-        return $this->_default_espresso_metaboxes;
4114
-    }
4115
-
4116
-
4117
-    /**
4118
-     * @return mixed
4119
-     */
4120
-    public function admin_base_url()
4121
-    {
4122
-        return $this->_admin_base_url;
4123
-    }
4124
-
4125
-
4126
-    /**
4127
-     * @return mixed
4128
-     */
4129
-    public function wp_page_slug()
4130
-    {
4131
-        return $this->_wp_page_slug;
4132
-    }
4133
-
4134
-
4135
-    /**
4136
-     * updates  espresso configuration settings
4137
-     *
4138
-     * @param string                   $tab
4139
-     * @param EE_Config_Base|EE_Config $config
4140
-     * @param string                   $file file where error occurred
4141
-     * @param string                   $func function  where error occurred
4142
-     * @param string                   $line line no where error occurred
4143
-     * @return boolean
4144
-     */
4145
-    protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
4146
-    {
4147
-        // remove any options that are NOT going to be saved with the config settings.
4148
-        if (isset($config->core->ee_ueip_optin)) {
4149
-            // TODO: remove the following two lines and make sure values are migrated from 3.1
4150
-            update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
4151
-            update_option('ee_ueip_has_notified', true);
4152
-        }
4153
-        // and save it (note we're also doing the network save here)
4154
-        $net_saved    = ! is_main_site() || EE_Network_Config::instance()->update_config(false, false);
4155
-        $config_saved = EE_Config::instance()->update_espresso_config(false, false);
4156
-        if ($config_saved && $net_saved) {
4157
-            EE_Error::add_success(sprintf(esc_html__('"%s" have been successfully updated.', 'event_espresso'), $tab));
4158
-            return true;
4159
-        }
4160
-        EE_Error::add_error(sprintf(esc_html__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
4161
-        return false;
4162
-    }
4163
-
4164
-
4165
-    /**
4166
-     * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
4167
-     *
4168
-     * @return array
4169
-     */
4170
-    public function get_yes_no_values()
4171
-    {
4172
-        return $this->_yes_no_values;
4173
-    }
4174
-
4175
-
4176
-    /**
4177
-     * @return string
4178
-     * @throws ReflectionException
4179
-     * @since $VID:$
4180
-     */
4181
-    protected function _get_dir()
4182
-    {
4183
-        $reflector = new ReflectionClass(get_class($this));
4184
-        return dirname($reflector->getFileName());
4185
-    }
4186
-
4187
-
4188
-    /**
4189
-     * A helper for getting a "next link".
4190
-     *
4191
-     * @param string $url   The url to link to
4192
-     * @param string $class The class to use.
4193
-     * @return string
4194
-     */
4195
-    protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4196
-    {
4197
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4198
-    }
4199
-
4200
-
4201
-    /**
4202
-     * A helper for getting a "previous link".
4203
-     *
4204
-     * @param string $url   The url to link to
4205
-     * @param string $class The class to use.
4206
-     * @return string
4207
-     */
4208
-    protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4209
-    {
4210
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4211
-    }
4212
-
4213
-
4214
-
4215
-
4216
-
4217
-
4218
-
4219
-    // below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
4220
-
4221
-
4222
-    /**
4223
-     * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
4224
-     * knows that the _REG_ID isn't in the req_data array but CAN obtain it, the caller should ADD the _REG_ID to the
4225
-     * _req_data array.
4226
-     *
4227
-     * @return bool success/fail
4228
-     * @throws EE_Error
4229
-     * @throws InvalidArgumentException
4230
-     * @throws ReflectionException
4231
-     * @throws InvalidDataTypeException
4232
-     * @throws InvalidInterfaceException
4233
-     */
4234
-    protected function _process_resend_registration()
4235
-    {
4236
-        $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
4237
-        do_action(
4238
-            'AHEE__EE_Admin_Page___process_resend_registration',
4239
-            $this->_template_args['success'],
4240
-            $this->request->requestParams()
4241
-        );
4242
-        return $this->_template_args['success'];
4243
-    }
4244
-
4245
-
4246
-    /**
4247
-     * This automatically processes any payment message notifications when manual payment has been applied.
4248
-     *
4249
-     * @param EE_Payment $payment
4250
-     * @return bool success/fail
4251
-     */
4252
-    protected function _process_payment_notification(EE_Payment $payment)
4253
-    {
4254
-        add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
4255
-        do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
4256
-        $this->_template_args['success'] = apply_filters(
4257
-            'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
4258
-            false,
4259
-            $payment
4260
-        );
4261
-        return $this->_template_args['success'];
4262
-    }
3469
+		// add nonce
3470
+		$nonce                                             =
3471
+			wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3472
+		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3473
+		// add REQUIRED form action
3474
+		$hidden_fields = [
3475
+			'action' => ['type' => 'hidden', 'value' => $route],
3476
+		];
3477
+		// merge arrays
3478
+		$hidden_fields = is_array($additional_hidden_fields)
3479
+			? array_merge($hidden_fields, $additional_hidden_fields)
3480
+			: $hidden_fields;
3481
+		// generate form fields
3482
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3483
+		// add fields to form
3484
+		foreach ((array) $form_fields as $form_field) {
3485
+			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3486
+		}
3487
+		// close form
3488
+		$this->_template_args['after_admin_page_content'] = '</form>';
3489
+	}
3490
+
3491
+
3492
+	/**
3493
+	 * Public Wrapper for _redirect_after_action() method since its
3494
+	 * discovered it would be useful for external code to have access.
3495
+	 *
3496
+	 * @param bool   $success
3497
+	 * @param string $what
3498
+	 * @param string $action_desc
3499
+	 * @param array  $query_args
3500
+	 * @param bool   $override_overwrite
3501
+	 * @throws EE_Error
3502
+	 * @see   EE_Admin_Page::_redirect_after_action() for params.
3503
+	 * @since 4.5.0
3504
+	 */
3505
+	public function redirect_after_action(
3506
+		$success = false,
3507
+		$what = 'item',
3508
+		$action_desc = 'processed',
3509
+		$query_args = [],
3510
+		$override_overwrite = false
3511
+	) {
3512
+		$this->_redirect_after_action(
3513
+			$success,
3514
+			$what,
3515
+			$action_desc,
3516
+			$query_args,
3517
+			$override_overwrite
3518
+		);
3519
+	}
3520
+
3521
+
3522
+	/**
3523
+	 * Helper method for merging existing request data with the returned redirect url.
3524
+	 *
3525
+	 * This is typically used for redirects after an action so that if the original view was a filtered view those
3526
+	 * filters are still applied.
3527
+	 *
3528
+	 * @param array $new_route_data
3529
+	 * @return array
3530
+	 */
3531
+	protected function mergeExistingRequestParamsWithRedirectArgs(array $new_route_data)
3532
+	{
3533
+		foreach ($this->request->requestParams() as $ref => $value) {
3534
+			// unset nonces
3535
+			if (strpos($ref, 'nonce') !== false) {
3536
+				$this->request->unSetRequestParam($ref);
3537
+				continue;
3538
+			}
3539
+			// urlencode values.
3540
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
3541
+			$this->request->setRequestParam($ref, $value);
3542
+		}
3543
+		return array_merge($this->request->requestParams(), $new_route_data);
3544
+	}
3545
+
3546
+
3547
+	/**
3548
+	 *    _redirect_after_action
3549
+	 *
3550
+	 * @param int    $success            - whether success was for two or more records, or just one, or none
3551
+	 * @param string $what               - what the action was performed on
3552
+	 * @param string $action_desc        - what was done ie: updated, deleted, etc
3553
+	 * @param array  $query_args         - an array of query_args to be added to the URL to redirect to after the admin
3554
+	 *                                   action is completed
3555
+	 * @param BOOL   $override_overwrite by default all EE_Error::success messages are overwritten, this allows you to
3556
+	 *                                   override this so that they show.
3557
+	 * @return void
3558
+	 * @throws EE_Error
3559
+	 * @throws InvalidArgumentException
3560
+	 * @throws InvalidDataTypeException
3561
+	 * @throws InvalidInterfaceException
3562
+	 */
3563
+	protected function _redirect_after_action(
3564
+		$success = 0,
3565
+		$what = 'item',
3566
+		$action_desc = 'processed',
3567
+		$query_args = [],
3568
+		$override_overwrite = false
3569
+	) {
3570
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3571
+		// class name for actions/filters.
3572
+		$classname = get_class($this);
3573
+		// set redirect url.
3574
+		// Note if there is a "page" index in the $query_args then we go with vanilla admin.php route,
3575
+		// otherwise we go with whatever is set as the _admin_base_url
3576
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3577
+		$notices      = EE_Error::get_notices(false);
3578
+		// overwrite default success messages //BUT ONLY if overwrite not overridden
3579
+		if (! $override_overwrite || ! empty($notices['errors'])) {
3580
+			EE_Error::overwrite_success();
3581
+		}
3582
+		if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3583
+			// how many records affected ? more than one record ? or just one ?
3584
+			if ($success > 1) {
3585
+				// set plural msg
3586
+				EE_Error::add_success(
3587
+					sprintf(
3588
+						esc_html__('The "%s" have been successfully %s.', 'event_espresso'),
3589
+						$what,
3590
+						$action_desc
3591
+					),
3592
+					__FILE__,
3593
+					__FUNCTION__,
3594
+					__LINE__
3595
+				);
3596
+			} elseif ($success === 1) {
3597
+				// set singular msg
3598
+				EE_Error::add_success(
3599
+					sprintf(
3600
+						esc_html__('The "%s" has been successfully %s.', 'event_espresso'),
3601
+						$what,
3602
+						$action_desc
3603
+					),
3604
+					__FILE__,
3605
+					__FUNCTION__,
3606
+					__LINE__
3607
+				);
3608
+			}
3609
+		}
3610
+		// check that $query_args isn't something crazy
3611
+		if (! is_array($query_args)) {
3612
+			$query_args = [];
3613
+		}
3614
+		/**
3615
+		 * Allow injecting actions before the query_args are modified for possible different
3616
+		 * redirections on save and close actions
3617
+		 *
3618
+		 * @param array $query_args       The original query_args array coming into the
3619
+		 *                                method.
3620
+		 * @since 4.2.0
3621
+		 */
3622
+		do_action(
3623
+			"AHEE__{$classname}___redirect_after_action__before_redirect_modification_{$this->_req_action}",
3624
+			$query_args
3625
+		);
3626
+		// calculate where we're going (if we have a "save and close" button pushed)
3627
+
3628
+		if (
3629
+			$this->request->requestParamIsSet('save_and_close')
3630
+			&& $this->request->requestParamIsSet('save_and_close_referrer')
3631
+		) {
3632
+			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
3633
+			$parsed_url = parse_url($this->request->getRequestParam('save_and_close_referrer', '', 'url'));
3634
+			// regenerate query args array from referrer URL
3635
+			parse_str($parsed_url['query'], $query_args);
3636
+			// correct page and action will be in the query args now
3637
+			$redirect_url = admin_url('admin.php');
3638
+		}
3639
+		// merge any default query_args set in _default_route_query_args property
3640
+		if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3641
+			$args_to_merge = [];
3642
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
3643
+				// is there a wp_referer array in our _default_route_query_args property?
3644
+				if ($query_param === 'wp_referer') {
3645
+					$query_value = (array) $query_value;
3646
+					foreach ($query_value as $reference => $value) {
3647
+						if (strpos($reference, 'nonce') !== false) {
3648
+							continue;
3649
+						}
3650
+						// finally we will override any arguments in the referer with
3651
+						// what might be set on the _default_route_query_args array.
3652
+						if (isset($this->_default_route_query_args[ $reference ])) {
3653
+							$args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3654
+						} else {
3655
+							$args_to_merge[ $reference ] = urlencode($value);
3656
+						}
3657
+					}
3658
+					continue;
3659
+				}
3660
+				$args_to_merge[ $query_param ] = $query_value;
3661
+			}
3662
+			// now let's merge these arguments but override with what was specifically sent in to the
3663
+			// redirect.
3664
+			$query_args = array_merge($args_to_merge, $query_args);
3665
+		}
3666
+		$this->_process_notices($query_args);
3667
+		// generate redirect url
3668
+		// if redirecting to anything other than the main page, add a nonce
3669
+		if (isset($query_args['action'])) {
3670
+			// manually generate wp_nonce and merge that with the query vars
3671
+			// becuz the wp_nonce_url function wrecks havoc on some vars
3672
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3673
+		}
3674
+		// we're adding some hooks and filters in here for processing any things just before redirects
3675
+		// (example: an admin page has done an insert or update and we want to run something after that).
3676
+		do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3677
+		$redirect_url = apply_filters(
3678
+			'FHEE_redirect_' . $classname . $this->_req_action,
3679
+			EE_Admin_Page::add_query_args_and_nonce($query_args, $redirect_url),
3680
+			$query_args
3681
+		);
3682
+		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3683
+		if ($this->request->isAjax()) {
3684
+			$default_data                    = [
3685
+				'close'        => true,
3686
+				'redirect_url' => $redirect_url,
3687
+				'where'        => 'main',
3688
+				'what'         => 'append',
3689
+			];
3690
+			$this->_template_args['success'] = $success;
3691
+			$this->_template_args['data']    = ! empty($this->_template_args['data']) ? array_merge(
3692
+				$default_data,
3693
+				$this->_template_args['data']
3694
+			) : $default_data;
3695
+			$this->_return_json();
3696
+		}
3697
+		wp_safe_redirect($redirect_url);
3698
+		exit();
3699
+	}
3700
+
3701
+
3702
+	/**
3703
+	 * process any notices before redirecting (or returning ajax request)
3704
+	 * This method sets the $this->_template_args['notices'] attribute;
3705
+	 *
3706
+	 * @param array $query_args         any query args that need to be used for notice transient ('action')
3707
+	 * @param bool  $skip_route_verify  This is typically used when we are processing notices REALLY early and
3708
+	 *                                  page_routes haven't been defined yet.
3709
+	 * @param bool  $sticky_notices     This is used to flag that regardless of whether this is doing_ajax or not, we
3710
+	 *                                  still save a transient for the notice.
3711
+	 * @return void
3712
+	 * @throws EE_Error
3713
+	 * @throws InvalidArgumentException
3714
+	 * @throws InvalidDataTypeException
3715
+	 * @throws InvalidInterfaceException
3716
+	 */
3717
+	protected function _process_notices($query_args = [], $skip_route_verify = false, $sticky_notices = true)
3718
+	{
3719
+		// first let's set individual error properties if doing_ajax and the properties aren't already set.
3720
+		if ($this->request->isAjax()) {
3721
+			$notices = EE_Error::get_notices(false);
3722
+			if (empty($this->_template_args['success'])) {
3723
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3724
+			}
3725
+			if (empty($this->_template_args['errors'])) {
3726
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3727
+			}
3728
+			if (empty($this->_template_args['attention'])) {
3729
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3730
+			}
3731
+		}
3732
+		$this->_template_args['notices'] = EE_Error::get_notices();
3733
+		// IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3734
+		if (! $this->request->isAjax() || $sticky_notices) {
3735
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3736
+			$this->_add_transient(
3737
+				$route,
3738
+				$this->_template_args['notices'],
3739
+				true,
3740
+				$skip_route_verify
3741
+			);
3742
+		}
3743
+	}
3744
+
3745
+
3746
+	/**
3747
+	 * get_action_link_or_button
3748
+	 * returns the button html for adding, editing, or deleting an item (depending on given type)
3749
+	 *
3750
+	 * @param string $action        use this to indicate which action the url is generated with.
3751
+	 * @param string $type          accepted strings must be defined in the $_labels['button'] array(as the key)
3752
+	 *                              property.
3753
+	 * @param array  $extra_request if the button requires extra params you can include them in $key=>$value pairs.
3754
+	 * @param string $class         Use this to give the class for the button. Defaults to 'button--primary'
3755
+	 * @param string $base_url      If this is not provided
3756
+	 *                              the _admin_base_url will be used as the default for the button base_url.
3757
+	 *                              Otherwise this value will be used.
3758
+	 * @param bool   $exclude_nonce If true then no nonce will be in the generated button link.
3759
+	 * @return string
3760
+	 * @throws InvalidArgumentException
3761
+	 * @throws InvalidInterfaceException
3762
+	 * @throws InvalidDataTypeException
3763
+	 * @throws EE_Error
3764
+	 */
3765
+	public function get_action_link_or_button(
3766
+		$action,
3767
+		$type = 'add',
3768
+		$extra_request = [],
3769
+		$class = 'button--primary',
3770
+		$base_url = '',
3771
+		$exclude_nonce = false
3772
+	) {
3773
+		// first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3774
+		if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3775
+			throw new EE_Error(
3776
+				sprintf(
3777
+					esc_html__(
3778
+						'There is no page route for given action for the button.  This action was given: %s',
3779
+						'event_espresso'
3780
+					),
3781
+					$action
3782
+				)
3783
+			);
3784
+		}
3785
+		if (! isset($this->_labels['buttons'][ $type ])) {
3786
+			throw new EE_Error(
3787
+				sprintf(
3788
+					esc_html__(
3789
+						'There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.',
3790
+						'event_espresso'
3791
+					),
3792
+					$type
3793
+				)
3794
+			);
3795
+		}
3796
+		// finally check user access for this button.
3797
+		$has_access = $this->check_user_access($action, true);
3798
+		if (! $has_access) {
3799
+			return '';
3800
+		}
3801
+		$_base_url  = ! $base_url ? $this->_admin_base_url : $base_url;
3802
+		$query_args = [
3803
+			'action' => $action,
3804
+		];
3805
+		// merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3806
+		if (! empty($extra_request)) {
3807
+			$query_args = array_merge($extra_request, $query_args);
3808
+		}
3809
+		$url = EE_Admin_Page::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3810
+		return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3811
+	}
3812
+
3813
+
3814
+	/**
3815
+	 * _per_page_screen_option
3816
+	 * Utility function for adding in a per_page_option in the screen_options_dropdown.
3817
+	 *
3818
+	 * @return void
3819
+	 * @throws InvalidArgumentException
3820
+	 * @throws InvalidInterfaceException
3821
+	 * @throws InvalidDataTypeException
3822
+	 */
3823
+	protected function _per_page_screen_option()
3824
+	{
3825
+		$option = 'per_page';
3826
+		$args   = [
3827
+			'label'   => apply_filters(
3828
+				'FHEE__EE_Admin_Page___per_page_screen_options___label',
3829
+				$this->_admin_page_title,
3830
+				$this
3831
+			),
3832
+			'default' => (int) apply_filters(
3833
+				'FHEE__EE_Admin_Page___per_page_screen_options__default',
3834
+				20
3835
+			),
3836
+			'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3837
+		];
3838
+		// ONLY add the screen option if the user has access to it.
3839
+		if ($this->check_user_access($this->_current_view, true)) {
3840
+			add_screen_option($option, $args);
3841
+		}
3842
+	}
3843
+
3844
+
3845
+	/**
3846
+	 * set_per_page_screen_option
3847
+	 * All this does is make sure that WordPress saves any per_page screen options (if set) for the current page.
3848
+	 * we have to do this rather than running inside the 'set-screen-options' hook because it runs earlier than
3849
+	 * admin_menu.
3850
+	 *
3851
+	 * @return void
3852
+	 */
3853
+	private function _set_per_page_screen_options()
3854
+	{
3855
+		if ($this->request->requestParamIsSet('wp_screen_options')) {
3856
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3857
+			if (! $user = wp_get_current_user()) {
3858
+				return;
3859
+			}
3860
+			$option = $this->request->getRequestParam('wp_screen_options[option]', '', 'key');
3861
+			if (! $option) {
3862
+				return;
3863
+			}
3864
+			$value  = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3865
+			$map_option = $option;
3866
+			$option     = str_replace('-', '_', $option);
3867
+			switch ($map_option) {
3868
+				case $this->_current_page . '_' . $this->_current_view . '_per_page':
3869
+					$max_value = apply_filters(
3870
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3871
+						999,
3872
+						$this->_current_page,
3873
+						$this->_current_view
3874
+					);
3875
+					if ($value < 1) {
3876
+						return;
3877
+					}
3878
+					$value = min($value, $max_value);
3879
+					break;
3880
+				default:
3881
+					$value = apply_filters(
3882
+						'FHEE__EE_Admin_Page___set_per_page_screen_options__value',
3883
+						false,
3884
+						$option,
3885
+						$value
3886
+					);
3887
+					if (false === $value) {
3888
+						return;
3889
+					}
3890
+					break;
3891
+			}
3892
+			update_user_meta($user->ID, $option, $value);
3893
+			wp_safe_redirect(remove_query_arg(['pagenum', 'apage', 'paged'], wp_get_referer()));
3894
+			exit;
3895
+		}
3896
+	}
3897
+
3898
+
3899
+	/**
3900
+	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3901
+	 *
3902
+	 * @param array $data array that will be assigned to template args.
3903
+	 */
3904
+	public function set_template_args($data)
3905
+	{
3906
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3907
+	}
3908
+
3909
+
3910
+	/**
3911
+	 * This makes available the WP transient system for temporarily moving data between routes
3912
+	 *
3913
+	 * @param string $route             the route that should receive the transient
3914
+	 * @param array  $data              the data that gets sent
3915
+	 * @param bool   $notices           If this is for notices then we use this to indicate so, otherwise its just a
3916
+	 *                                  normal route transient.
3917
+	 * @param bool   $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used
3918
+	 *                                  when we are adding a transient before page_routes have been defined.
3919
+	 * @return void
3920
+	 * @throws EE_Error
3921
+	 */
3922
+	protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3923
+	{
3924
+		$user_id = get_current_user_id();
3925
+		if (! $skip_route_verify) {
3926
+			$this->_verify_route($route);
3927
+		}
3928
+		// now let's set the string for what kind of transient we're setting
3929
+		$transient = $notices
3930
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3931
+			: 'rte_tx_' . $route . '_' . $user_id;
3932
+		$data      = $notices ? ['notices' => $data] : $data;
3933
+		// is there already a transient for this route?  If there is then let's ADD to that transient
3934
+		$existing = is_multisite() && is_network_admin()
3935
+			? get_site_transient($transient)
3936
+			: get_transient($transient);
3937
+		if ($existing) {
3938
+			$data = array_merge((array) $data, (array) $existing);
3939
+		}
3940
+		if (is_multisite() && is_network_admin()) {
3941
+			set_site_transient($transient, $data, 8);
3942
+		} else {
3943
+			set_transient($transient, $data, 8);
3944
+		}
3945
+	}
3946
+
3947
+
3948
+	/**
3949
+	 * this retrieves the temporary transient that has been set for moving data between routes.
3950
+	 *
3951
+	 * @param bool   $notices true we get notices transient. False we just return normal route transient
3952
+	 * @param string $route
3953
+	 * @return mixed data
3954
+	 */
3955
+	protected function _get_transient($notices = false, $route = '')
3956
+	{
3957
+		$user_id   = get_current_user_id();
3958
+		$route     = ! $route ? $this->_req_action : $route;
3959
+		$transient = $notices
3960
+			? 'ee_rte_n_tx_' . $route . '_' . $user_id
3961
+			: 'rte_tx_' . $route . '_' . $user_id;
3962
+		$data      = is_multisite() && is_network_admin()
3963
+			? get_site_transient($transient)
3964
+			: get_transient($transient);
3965
+		// delete transient after retrieval (just in case it hasn't expired);
3966
+		if (is_multisite() && is_network_admin()) {
3967
+			delete_site_transient($transient);
3968
+		} else {
3969
+			delete_transient($transient);
3970
+		}
3971
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3972
+	}
3973
+
3974
+
3975
+	/**
3976
+	 * The purpose of this method is just to run garbage collection on any EE transients that might have expired but
3977
+	 * would not be called later. This will be assigned to run on a specific EE Admin page. (place the method in the
3978
+	 * default route callback on the EE_Admin page you want it run.)
3979
+	 *
3980
+	 * @return void
3981
+	 */
3982
+	protected function _transient_garbage_collection()
3983
+	{
3984
+		global $wpdb;
3985
+		// retrieve all existing transients
3986
+		$query =
3987
+			"SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3988
+		if ($results = $wpdb->get_results($query)) {
3989
+			foreach ($results as $result) {
3990
+				$transient = str_replace('_transient_', '', $result->option_name);
3991
+				get_transient($transient);
3992
+				if (is_multisite() && is_network_admin()) {
3993
+					get_site_transient($transient);
3994
+				}
3995
+			}
3996
+		}
3997
+	}
3998
+
3999
+
4000
+	/**
4001
+	 * get_view
4002
+	 *
4003
+	 * @return string content of _view property
4004
+	 */
4005
+	public function get_view()
4006
+	{
4007
+		return $this->_view;
4008
+	}
4009
+
4010
+
4011
+	/**
4012
+	 * getter for the protected $_views property
4013
+	 *
4014
+	 * @return array
4015
+	 */
4016
+	public function get_views()
4017
+	{
4018
+		return $this->_views;
4019
+	}
4020
+
4021
+
4022
+	/**
4023
+	 * get_current_page
4024
+	 *
4025
+	 * @return string _current_page property value
4026
+	 */
4027
+	public function get_current_page()
4028
+	{
4029
+		return $this->_current_page;
4030
+	}
4031
+
4032
+
4033
+	/**
4034
+	 * get_current_view
4035
+	 *
4036
+	 * @return string _current_view property value
4037
+	 */
4038
+	public function get_current_view()
4039
+	{
4040
+		return $this->_current_view;
4041
+	}
4042
+
4043
+
4044
+	/**
4045
+	 * get_current_screen
4046
+	 *
4047
+	 * @return object The current WP_Screen object
4048
+	 */
4049
+	public function get_current_screen()
4050
+	{
4051
+		return $this->_current_screen;
4052
+	}
4053
+
4054
+
4055
+	/**
4056
+	 * get_current_page_view_url
4057
+	 *
4058
+	 * @return string This returns the url for the current_page_view.
4059
+	 */
4060
+	public function get_current_page_view_url()
4061
+	{
4062
+		return $this->_current_page_view_url;
4063
+	}
4064
+
4065
+
4066
+	/**
4067
+	 * just returns the Request
4068
+	 *
4069
+	 * @return RequestInterface
4070
+	 */
4071
+	public function get_request()
4072
+	{
4073
+		return $this->request;
4074
+	}
4075
+
4076
+
4077
+	/**
4078
+	 * just returns the _req_data property
4079
+	 *
4080
+	 * @return array
4081
+	 */
4082
+	public function get_request_data()
4083
+	{
4084
+		return $this->request->requestParams();
4085
+	}
4086
+
4087
+
4088
+	/**
4089
+	 * returns the _req_data protected property
4090
+	 *
4091
+	 * @return string
4092
+	 */
4093
+	public function get_req_action()
4094
+	{
4095
+		return $this->_req_action;
4096
+	}
4097
+
4098
+
4099
+	/**
4100
+	 * @return bool  value of $_is_caf property
4101
+	 */
4102
+	public function is_caf()
4103
+	{
4104
+		return $this->_is_caf;
4105
+	}
4106
+
4107
+
4108
+	/**
4109
+	 * @return mixed
4110
+	 */
4111
+	public function default_espresso_metaboxes()
4112
+	{
4113
+		return $this->_default_espresso_metaboxes;
4114
+	}
4115
+
4116
+
4117
+	/**
4118
+	 * @return mixed
4119
+	 */
4120
+	public function admin_base_url()
4121
+	{
4122
+		return $this->_admin_base_url;
4123
+	}
4124
+
4125
+
4126
+	/**
4127
+	 * @return mixed
4128
+	 */
4129
+	public function wp_page_slug()
4130
+	{
4131
+		return $this->_wp_page_slug;
4132
+	}
4133
+
4134
+
4135
+	/**
4136
+	 * updates  espresso configuration settings
4137
+	 *
4138
+	 * @param string                   $tab
4139
+	 * @param EE_Config_Base|EE_Config $config
4140
+	 * @param string                   $file file where error occurred
4141
+	 * @param string                   $func function  where error occurred
4142
+	 * @param string                   $line line no where error occurred
4143
+	 * @return boolean
4144
+	 */
4145
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '')
4146
+	{
4147
+		// remove any options that are NOT going to be saved with the config settings.
4148
+		if (isset($config->core->ee_ueip_optin)) {
4149
+			// TODO: remove the following two lines and make sure values are migrated from 3.1
4150
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
4151
+			update_option('ee_ueip_has_notified', true);
4152
+		}
4153
+		// and save it (note we're also doing the network save here)
4154
+		$net_saved    = ! is_main_site() || EE_Network_Config::instance()->update_config(false, false);
4155
+		$config_saved = EE_Config::instance()->update_espresso_config(false, false);
4156
+		if ($config_saved && $net_saved) {
4157
+			EE_Error::add_success(sprintf(esc_html__('"%s" have been successfully updated.', 'event_espresso'), $tab));
4158
+			return true;
4159
+		}
4160
+		EE_Error::add_error(sprintf(esc_html__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
4161
+		return false;
4162
+	}
4163
+
4164
+
4165
+	/**
4166
+	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
4167
+	 *
4168
+	 * @return array
4169
+	 */
4170
+	public function get_yes_no_values()
4171
+	{
4172
+		return $this->_yes_no_values;
4173
+	}
4174
+
4175
+
4176
+	/**
4177
+	 * @return string
4178
+	 * @throws ReflectionException
4179
+	 * @since $VID:$
4180
+	 */
4181
+	protected function _get_dir()
4182
+	{
4183
+		$reflector = new ReflectionClass(get_class($this));
4184
+		return dirname($reflector->getFileName());
4185
+	}
4186
+
4187
+
4188
+	/**
4189
+	 * A helper for getting a "next link".
4190
+	 *
4191
+	 * @param string $url   The url to link to
4192
+	 * @param string $class The class to use.
4193
+	 * @return string
4194
+	 */
4195
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4196
+	{
4197
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
4198
+	}
4199
+
4200
+
4201
+	/**
4202
+	 * A helper for getting a "previous link".
4203
+	 *
4204
+	 * @param string $url   The url to link to
4205
+	 * @param string $class The class to use.
4206
+	 * @return string
4207
+	 */
4208
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4209
+	{
4210
+		return '<a class="' . $class . '" href="' . $url . '"></a>';
4211
+	}
4212
+
4213
+
4214
+
4215
+
4216
+
4217
+
4218
+
4219
+	// below are some messages related methods that should be available across the EE_Admin system.  Note, these methods are NOT page specific
4220
+
4221
+
4222
+	/**
4223
+	 * This processes an request to resend a registration and assumes we have a _REG_ID for doing so. So if the caller
4224
+	 * knows that the _REG_ID isn't in the req_data array but CAN obtain it, the caller should ADD the _REG_ID to the
4225
+	 * _req_data array.
4226
+	 *
4227
+	 * @return bool success/fail
4228
+	 * @throws EE_Error
4229
+	 * @throws InvalidArgumentException
4230
+	 * @throws ReflectionException
4231
+	 * @throws InvalidDataTypeException
4232
+	 * @throws InvalidInterfaceException
4233
+	 */
4234
+	protected function _process_resend_registration()
4235
+	{
4236
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
4237
+		do_action(
4238
+			'AHEE__EE_Admin_Page___process_resend_registration',
4239
+			$this->_template_args['success'],
4240
+			$this->request->requestParams()
4241
+		);
4242
+		return $this->_template_args['success'];
4243
+	}
4244
+
4245
+
4246
+	/**
4247
+	 * This automatically processes any payment message notifications when manual payment has been applied.
4248
+	 *
4249
+	 * @param EE_Payment $payment
4250
+	 * @return bool success/fail
4251
+	 */
4252
+	protected function _process_payment_notification(EE_Payment $payment)
4253
+	{
4254
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
4255
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
4256
+		$this->_template_args['success'] = apply_filters(
4257
+			'FHEE__EE_Admin_Page___process_admin_payment_notification__success',
4258
+			false,
4259
+			$payment
4260
+		);
4261
+		return $this->_template_args['success'];
4262
+	}
4263 4263
 }
Please login to merge, or discard this patch.
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
         $ee_menu_slugs = (array) $ee_menu_slugs;
624 624
         if (
625 625
             ! $this->request->isAjax()
626
-            && (! $this->_current_page || ! isset($ee_menu_slugs[ $this->_current_page ]))
626
+            && ( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page]))
627 627
         ) {
628 628
             return;
629 629
         }
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
             : $req_action;
644 644
 
645 645
         $this->_current_view = $this->_req_action;
646
-        $this->_req_nonce    = $this->_req_action . '_nonce';
646
+        $this->_req_nonce    = $this->_req_action.'_nonce';
647 647
         $this->_define_page_props();
648 648
         $this->_current_page_view_url = add_query_arg(
649 649
             ['page' => $this->_current_page, 'action' => $this->_current_view],
@@ -680,21 +680,21 @@  discard block
 block discarded – undo
680 680
         }
681 681
         // filter routes and page_config so addons can add their stuff. Filtering done per class
682 682
         $this->_page_routes = apply_filters(
683
-            'FHEE__' . get_class($this) . '__page_setup__page_routes',
683
+            'FHEE__'.get_class($this).'__page_setup__page_routes',
684 684
             $this->_page_routes,
685 685
             $this
686 686
         );
687 687
         $this->_page_config = apply_filters(
688
-            'FHEE__' . get_class($this) . '__page_setup__page_config',
688
+            'FHEE__'.get_class($this).'__page_setup__page_config',
689 689
             $this->_page_config,
690 690
             $this
691 691
         );
692 692
         // if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present
693 693
         // then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
694
-        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view)) {
694
+        if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
695 695
             add_action(
696 696
                 'AHEE__EE_Admin_Page__route_admin_request',
697
-                [$this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view],
697
+                [$this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view],
698 698
                 10,
699 699
                 2
700 700
             );
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
             if ($this->_is_UI_request) {
708 708
                 // admin_init stuff - global, all views for this page class, specific view
709 709
                 add_action('admin_init', [$this, 'admin_init'], 10);
710
-                if (method_exists($this, 'admin_init_' . $this->_current_view)) {
711
-                    add_action('admin_init', [$this, 'admin_init_' . $this->_current_view], 15);
710
+                if (method_exists($this, 'admin_init_'.$this->_current_view)) {
711
+                    add_action('admin_init', [$this, 'admin_init_'.$this->_current_view], 15);
712 712
                 }
713 713
             } else {
714 714
                 // hijack regular WP loading and route admin request immediately
@@ -727,12 +727,12 @@  discard block
 block discarded – undo
727 727
      */
728 728
     private function _do_other_page_hooks()
729 729
     {
730
-        $registered_pages = apply_filters('FHEE_do_other_page_hooks_' . $this->page_slug, []);
730
+        $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, []);
731 731
         foreach ($registered_pages as $page) {
732 732
             // now let's setup the file name and class that should be present
733 733
             $classname = str_replace('.class.php', '', $page);
734 734
             // autoloaders should take care of loading file
735
-            if (! class_exists($classname)) {
735
+            if ( ! class_exists($classname)) {
736 736
                 $error_msg[] = sprintf(
737 737
                     esc_html__(
738 738
                         'Something went wrong with loading the %s admin hooks page.',
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
                                    ),
750 750
                                    $page,
751 751
                                    '<br />',
752
-                                   '<strong>' . $classname . '</strong>'
752
+                                   '<strong>'.$classname.'</strong>'
753 753
                                );
754 754
                 throw new EE_Error(implode('||', $error_msg));
755 755
             }
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
         // load admin_notices - global, page class, and view specific
792 792
         add_action('admin_notices', [$this, 'admin_notices_global'], 5);
793 793
         add_action('admin_notices', [$this, 'admin_notices'], 10);
794
-        if (method_exists($this, 'admin_notices_' . $this->_current_view)) {
795
-            add_action('admin_notices', [$this, 'admin_notices_' . $this->_current_view], 15);
794
+        if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
795
+            add_action('admin_notices', [$this, 'admin_notices_'.$this->_current_view], 15);
796 796
         }
797 797
         // load network admin_notices - global, page class, and view specific
798 798
         add_action('network_admin_notices', [$this, 'network_admin_notices_global'], 5);
799
-        if (method_exists($this, 'network_admin_notices_' . $this->_current_view)) {
800
-            add_action('network_admin_notices', [$this, 'network_admin_notices_' . $this->_current_view]);
799
+        if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
800
+            add_action('network_admin_notices', [$this, 'network_admin_notices_'.$this->_current_view]);
801 801
         }
802 802
         // this will save any per_page screen options if they are present
803 803
         $this->_set_per_page_screen_options();
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
     protected function _verify_routes()
920 920
     {
921 921
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
922
-        if (! $this->_current_page && ! $this->request->isAjax()) {
922
+        if ( ! $this->_current_page && ! $this->request->isAjax()) {
923 923
             return false;
924 924
         }
925 925
         $this->_route = false;
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
                 $this->_admin_page_title
932 932
             );
933 933
             // developer error msg
934
-            $error_msg .= '||' . $error_msg
934
+            $error_msg .= '||'.$error_msg
935 935
                           . esc_html__(
936 936
                               ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
937 937
                               'event_espresso'
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
         }
941 941
         // and that the requested page route exists
942 942
         if (array_key_exists($this->_req_action, $this->_page_routes)) {
943
-            $this->_route        = $this->_page_routes[ $this->_req_action ];
944
-            $this->_route_config = $this->_page_config[ $this->_req_action ] ?? [];
943
+            $this->_route        = $this->_page_routes[$this->_req_action];
944
+            $this->_route_config = $this->_page_config[$this->_req_action] ?? [];
945 945
         } else {
946 946
             // user error msg
947 947
             $error_msg = sprintf(
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
                 $this->_admin_page_title
953 953
             );
954 954
             // developer error msg
955
-            $error_msg .= '||' . $error_msg
955
+            $error_msg .= '||'.$error_msg
956 956
                           . sprintf(
957 957
                               esc_html__(
958 958
                                   ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
             throw new EE_Error($error_msg);
964 964
         }
965 965
         // and that a default route exists
966
-        if (! array_key_exists('default', $this->_page_routes)) {
966
+        if ( ! array_key_exists('default', $this->_page_routes)) {
967 967
             // user error msg
968 968
             $error_msg = sprintf(
969 969
                 esc_html__(
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
                 $this->_admin_page_title
974 974
             );
975 975
             // developer error msg
976
-            $error_msg .= '||' . $error_msg
976
+            $error_msg .= '||'.$error_msg
977 977
                           . esc_html__(
978 978
                               ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
979 979
                               'event_espresso'
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
             $this->_admin_page_title
1016 1016
         );
1017 1017
         // developer error msg
1018
-        $error_msg .= '||' . $error_msg
1018
+        $error_msg .= '||'.$error_msg
1019 1019
                       . sprintf(
1020 1020
                           esc_html__(
1021 1021
                               ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property',
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
     protected function _verify_nonce($nonce, $nonce_ref)
1044 1044
     {
1045 1045
         // verify nonce against expected value
1046
-        if (! wp_verify_nonce($nonce, $nonce_ref)) {
1046
+        if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
1047 1047
             // these are not the droids you are looking for !!!
1048 1048
             $msg = sprintf(
1049 1049
                 esc_html__('%sNonce Fail.%s', 'event_espresso'),
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
                     __CLASS__
1061 1061
                 );
1062 1062
             }
1063
-            if (! $this->request->isAjax()) {
1063
+            if ( ! $this->request->isAjax()) {
1064 1064
                 wp_die($msg);
1065 1065
             }
1066 1066
             EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
      */
1085 1085
     protected function _route_admin_request()
1086 1086
     {
1087
-        if (! $this->_is_UI_request) {
1087
+        if ( ! $this->_is_UI_request) {
1088 1088
             $this->_verify_routes();
1089 1089
         }
1090 1090
         $nonce_check = ! isset($this->_route_config['require_nonce']) || $this->_route_config['require_nonce'];
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
         $error_msg = '';
1105 1105
         // action right before calling route
1106 1106
         // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
1107
-        if (! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1107
+        if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
1108 1108
             do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
1109 1109
         }
1110 1110
         // right before calling the route, let's clean the _wp_http_referer
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
                 wp_unslash($this->request->getServerParam('REQUEST_URI'))
1116 1116
             )
1117 1117
         );
1118
-        if (! empty($func)) {
1118
+        if ( ! empty($func)) {
1119 1119
             if (is_array($func)) {
1120 1120
                 [$class, $method] = $func;
1121 1121
             } elseif (strpos($func, '::') !== false) {
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
                 $class  = $this;
1125 1125
                 $method = $func;
1126 1126
             }
1127
-            if (! (is_object($class) && $class === $this)) {
1127
+            if ( ! (is_object($class) && $class === $this)) {
1128 1128
                 // send along this admin page object for access by addons.
1129 1129
                 $args['admin_page_object'] = $this;
1130 1130
             }
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
                     $method
1166 1166
                 );
1167 1167
             }
1168
-            if (! empty($error_msg)) {
1168
+            if ( ! empty($error_msg)) {
1169 1169
                 throw new EE_Error($error_msg);
1170 1170
             }
1171 1171
         }
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
                 if (strpos($key, 'nonce') !== false) {
1251 1251
                     continue;
1252 1252
                 }
1253
-                $args[ 'wp_referer[' . $key . ']' ] = is_string($value) ? htmlspecialchars($value) : $value;
1253
+                $args['wp_referer['.$key.']'] = is_string($value) ? htmlspecialchars($value) : $value;
1254 1254
             }
1255 1255
         }
1256 1256
         return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
@@ -1291,8 +1291,8 @@  discard block
 block discarded – undo
1291 1291
     protected function _add_help_tabs()
1292 1292
     {
1293 1293
         $tour_buttons = '';
1294
-        if (isset($this->_page_config[ $this->_req_action ])) {
1295
-            $config = $this->_page_config[ $this->_req_action ];
1294
+        if (isset($this->_page_config[$this->_req_action])) {
1295
+            $config = $this->_page_config[$this->_req_action];
1296 1296
             // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
1297 1297
             // is there a help tour for the current route?  if there is let's setup the tour buttons
1298 1298
             // if (isset($this->_help_tour[ $this->_req_action ])) {
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
             // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1316 1316
             if (is_array($config) && isset($config['help_sidebar'])) {
1317 1317
                 // check that the callback given is valid
1318
-                if (! method_exists($this, $config['help_sidebar'])) {
1318
+                if ( ! method_exists($this, $config['help_sidebar'])) {
1319 1319
                     throw new EE_Error(
1320 1320
                         sprintf(
1321 1321
                             esc_html__(
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
                     );
1329 1329
                 }
1330 1330
                 $content = apply_filters(
1331
-                    'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar',
1331
+                    'FHEE__'.get_class($this).'__add_help_tabs__help_sidebar',
1332 1332
                     $this->{$config['help_sidebar']}()
1333 1333
                 );
1334 1334
                 $content .= $tour_buttons; // add help tour buttons.
@@ -1336,30 +1336,30 @@  discard block
 block discarded – undo
1336 1336
                 $this->_current_screen->set_help_sidebar($content);
1337 1337
             }
1338 1338
             // if there ARE tour buttons...
1339
-            if (! empty($tour_buttons)) {
1339
+            if ( ! empty($tour_buttons)) {
1340 1340
                 // if we DON'T have config help sidebar then we'll just add the tour buttons to the sidebar.
1341
-                if (! isset($config['help_sidebar'])) {
1341
+                if ( ! isset($config['help_sidebar'])) {
1342 1342
                     $this->_current_screen->set_help_sidebar($tour_buttons);
1343 1343
                 }
1344 1344
                 // handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1345
-                if (! isset($config['help_tabs'])) {
1345
+                if ( ! isset($config['help_tabs'])) {
1346 1346
                     $_ht['id'] = $this->page_slug;
1347 1347
                     $_ht['title'] = esc_html__('Help Tours', 'event_espresso');
1348 1348
                     $_ht['content'] = '<p>'
1349 1349
                                       . esc_html__(
1350 1350
                                           'The buttons to the right allow you to start/restart any help tours available for this page',
1351 1351
                                           'event_espresso'
1352
-                                      ) . '</p>';
1352
+                                      ).'</p>';
1353 1353
                     $this->_current_screen->add_help_tab($_ht);
1354 1354
                 }
1355 1355
             }
1356
-            if (! isset($config['help_tabs'])) {
1356
+            if ( ! isset($config['help_tabs'])) {
1357 1357
                 return;
1358 1358
             } //no help tabs for this route
1359 1359
             foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1360 1360
                 // we're here so there ARE help tabs!
1361 1361
                 // make sure we've got what we need
1362
-                if (! isset($cfg['title'])) {
1362
+                if ( ! isset($cfg['title'])) {
1363 1363
                     throw new EE_Error(
1364 1364
                         esc_html__(
1365 1365
                             'The _page_config array is not set up properly for help tabs.  It is missing a title',
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
                         )
1368 1368
                     );
1369 1369
                 }
1370
-                if (! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1370
+                if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) {
1371 1371
                     throw new EE_Error(
1372 1372
                         esc_html__(
1373 1373
                             'The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab',
@@ -1376,11 +1376,11 @@  discard block
 block discarded – undo
1376 1376
                     );
1377 1377
                 }
1378 1378
                 // first priority goes to content.
1379
-                if (! empty($cfg['content'])) {
1379
+                if ( ! empty($cfg['content'])) {
1380 1380
                     $content = ! empty($cfg['content']) ? $cfg['content'] : null;
1381 1381
                     // second priority goes to filename
1382
-                } elseif (! empty($cfg['filename'])) {
1383
-                    $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1382
+                } elseif ( ! empty($cfg['filename'])) {
1383
+                    $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1384 1384
                     // it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1385 1385
                     $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES
1386 1386
                                                              . basename($this->_get_dir())
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
                                                              . $cfg['filename']
1389 1389
                                                              . '.help_tab.php' : $file_path;
1390 1390
                     // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1391
-                    if (! isset($cfg['callback']) && ! is_readable($file_path)) {
1391
+                    if ( ! isset($cfg['callback']) && ! is_readable($file_path)) {
1392 1392
                         EE_Error::add_error(
1393 1393
                             sprintf(
1394 1394
                                 esc_html__(
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                     return;
1437 1437
                 }
1438 1438
                 // setup config array for help tab method
1439
-                $id  = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1439
+                $id  = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1440 1440
                 $_ht = [
1441 1441
                     'id'       => $id,
1442 1442
                     'title'    => $cfg['title'],
@@ -1566,8 +1566,8 @@  discard block
 block discarded – undo
1566 1566
             $qtips = (array) $this->_route_config['qtips'];
1567 1567
             // load qtip loader
1568 1568
             $path = [
1569
-                $this->_get_dir() . '/qtips/',
1570
-                EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/',
1569
+                $this->_get_dir().'/qtips/',
1570
+                EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/',
1571 1571
             ];
1572 1572
             EEH_Qtip_Loader::instance()->register($qtips, $path);
1573 1573
         }
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1590 1590
         $i = 0;
1591 1591
         foreach ($this->_page_config as $slug => $config) {
1592
-            if (! is_array($config) || empty($config['nav'])) {
1592
+            if ( ! is_array($config) || empty($config['nav'])) {
1593 1593
                 continue;
1594 1594
             }
1595 1595
             // no nav tab for this config
@@ -1598,12 +1598,12 @@  discard block
 block discarded – undo
1598 1598
                 // nav tab is only to appear when route requested.
1599 1599
                 continue;
1600 1600
             }
1601
-            if (! $this->check_user_access($slug, true)) {
1601
+            if ( ! $this->check_user_access($slug, true)) {
1602 1602
                 // no nav tab because current user does not have access.
1603 1603
                 continue;
1604 1604
             }
1605
-            $css_class                = isset($config['css_class']) ? $config['css_class'] . ' ' : '';
1606
-            $this->_nav_tabs[ $slug ] = [
1605
+            $css_class                = isset($config['css_class']) ? $config['css_class'].' ' : '';
1606
+            $this->_nav_tabs[$slug] = [
1607 1607
                 'url'       => isset($config['nav']['url'])
1608 1608
                     ? $config['nav']['url']
1609 1609
                     : EE_Admin_Page::add_query_args_and_nonce(
@@ -1615,14 +1615,14 @@  discard block
 block discarded – undo
1615 1615
                     : ucwords(
1616 1616
                         str_replace('_', ' ', $slug)
1617 1617
                     ),
1618
-                'css_class' => $this->_req_action === $slug ? $css_class . 'nav-tab-active' : $css_class,
1618
+                'css_class' => $this->_req_action === $slug ? $css_class.'nav-tab-active' : $css_class,
1619 1619
                 'order'     => isset($config['nav']['order']) ? $config['nav']['order'] : $i,
1620 1620
             ];
1621 1621
             $i++;
1622 1622
         }
1623 1623
         // if $this->_nav_tabs is empty then lets set the default
1624 1624
         if (empty($this->_nav_tabs)) {
1625
-            $this->_nav_tabs[ $this->_default_nav_tab_name ] = [
1625
+            $this->_nav_tabs[$this->_default_nav_tab_name] = [
1626 1626
                 'url'       => $this->_admin_base_url,
1627 1627
                 'link_text' => ucwords(str_replace('_', ' ', $this->_default_nav_tab_name)),
1628 1628
                 'css_class' => 'nav-tab-active',
@@ -1647,10 +1647,10 @@  discard block
 block discarded – undo
1647 1647
             foreach ($this->_route_config['labels'] as $label => $text) {
1648 1648
                 if (is_array($text)) {
1649 1649
                     foreach ($text as $sublabel => $subtext) {
1650
-                        $this->_labels[ $label ][ $sublabel ] = $subtext;
1650
+                        $this->_labels[$label][$sublabel] = $subtext;
1651 1651
                     }
1652 1652
                 } else {
1653
-                    $this->_labels[ $label ] = $text;
1653
+                    $this->_labels[$label] = $text;
1654 1654
                 }
1655 1655
             }
1656 1656
         }
@@ -1672,12 +1672,12 @@  discard block
 block discarded – undo
1672 1672
     {
1673 1673
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1674 1674
         $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1675
-        $capability     = ! empty($route_to_check) && isset($this->_page_routes[ $route_to_check ])
1675
+        $capability     = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check])
1676 1676
                           && is_array(
1677
-                              $this->_page_routes[ $route_to_check ]
1677
+                              $this->_page_routes[$route_to_check]
1678 1678
                           )
1679
-                          && ! empty($this->_page_routes[ $route_to_check ]['capability'])
1680
-            ? $this->_page_routes[ $route_to_check ]['capability'] : null;
1679
+                          && ! empty($this->_page_routes[$route_to_check]['capability'])
1680
+            ? $this->_page_routes[$route_to_check]['capability'] : null;
1681 1681
         if (empty($capability) && empty($route_to_check)) {
1682 1682
             $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options'
1683 1683
                 : $this->_route['capability'];
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
         add_meta_box($box_id, $title, $callback, $screen, $context, $priority, $callback_args);
1724 1724
         add_filter(
1725 1725
             "postbox_classes_{$this->_wp_page_slug}_{$box_id}",
1726
-            function ($classes) {
1726
+            function($classes) {
1727 1727
                 array_push($classes, 'ee-admin-container');
1728 1728
                 return $classes;
1729 1729
             }
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
         //     echo implode('<br />', $this->_help_tour[ $this->_req_action ]);
1823 1823
         // }
1824 1824
         // current set timezone for timezone js
1825
-        echo '<span id="current_timezone" class="hidden">' . esc_html(EEH_DTT_Helper::get_timezone()) . '</span>';
1825
+        echo '<span id="current_timezone" class="hidden">'.esc_html(EEH_DTT_Helper::get_timezone()).'</span>';
1826 1826
     }
1827 1827
 
1828 1828
 
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
         // loop through the array and setup content
1857 1857
         foreach ($help_array as $trigger => $help) {
1858 1858
             // make sure the array is setup properly
1859
-            if (! isset($help['title'], $help['content'])) {
1859
+            if ( ! isset($help['title'], $help['content'])) {
1860 1860
                 throw new EE_Error(
1861 1861
                     esc_html__(
1862 1862
                         'Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class',
@@ -1870,8 +1870,8 @@  discard block
 block discarded – undo
1870 1870
                 'help_popup_title'   => $help['title'],
1871 1871
                 'help_popup_content' => $help['content'],
1872 1872
             ];
1873
-            $content       .= EEH_Template::display_template(
1874
-                EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php',
1873
+            $content .= EEH_Template::display_template(
1874
+                EE_ADMIN_TEMPLATE.'admin_help_popup.template.php',
1875 1875
                 $template_args,
1876 1876
                 true
1877 1877
             );
@@ -1893,15 +1893,15 @@  discard block
 block discarded – undo
1893 1893
     private function _get_help_content()
1894 1894
     {
1895 1895
         // what is the method we're looking for?
1896
-        $method_name = '_help_popup_content_' . $this->_req_action;
1896
+        $method_name = '_help_popup_content_'.$this->_req_action;
1897 1897
         // if method doesn't exist let's get out.
1898
-        if (! method_exists($this, $method_name)) {
1898
+        if ( ! method_exists($this, $method_name)) {
1899 1899
             return [];
1900 1900
         }
1901 1901
         // k we're good to go let's retrieve the help array
1902 1902
         $help_array = $this->{$method_name}();
1903 1903
         // make sure we've got an array!
1904
-        if (! is_array($help_array)) {
1904
+        if ( ! is_array($help_array)) {
1905 1905
             throw new EE_Error(
1906 1906
                 esc_html__(
1907 1907
                     'Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.',
@@ -1933,8 +1933,8 @@  discard block
 block discarded – undo
1933 1933
         // let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1934 1934
         $help_array   = $this->_get_help_content();
1935 1935
         $help_content = '';
1936
-        if (empty($help_array) || ! isset($help_array[ $trigger_id ])) {
1937
-            $help_array[ $trigger_id ] = [
1936
+        if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1937
+            $help_array[$trigger_id] = [
1938 1938
                 'title'   => esc_html__('Missing Content', 'event_espresso'),
1939 1939
                 'content' => esc_html__(
1940 1940
                     'A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)',
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 
2054 2054
         add_filter(
2055 2055
             'admin_body_class',
2056
-            function ($classes) {
2056
+            function($classes) {
2057 2057
                 if (strpos($classes, 'espresso-admin') === false) {
2058 2058
                     $classes .= ' espresso-admin';
2059 2059
                 }
@@ -2144,12 +2144,12 @@  discard block
 block discarded – undo
2144 2144
     protected function _set_list_table()
2145 2145
     {
2146 2146
         // first is this a list_table view?
2147
-        if (! isset($this->_route_config['list_table'])) {
2147
+        if ( ! isset($this->_route_config['list_table'])) {
2148 2148
             return;
2149 2149
         } //not a list_table view so get out.
2150 2150
         // list table functions are per view specific (because some admin pages might have more than one list table!)
2151
-        $list_table_view = '_set_list_table_views_' . $this->_req_action;
2152
-        if (! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2151
+        $list_table_view = '_set_list_table_views_'.$this->_req_action;
2152
+        if ( ! method_exists($this, $list_table_view) || $this->{$list_table_view}() === false) {
2153 2153
             // user error msg
2154 2154
             $error_msg = esc_html__(
2155 2155
                 'An error occurred. The requested list table views could not be found.',
@@ -2169,10 +2169,10 @@  discard block
 block discarded – undo
2169 2169
         }
2170 2170
         // let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
2171 2171
         $this->_views = apply_filters(
2172
-            'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action,
2172
+            'FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action,
2173 2173
             $this->_views
2174 2174
         );
2175
-        $this->_views = apply_filters('FHEE_list_table_views_' . $this->page_slug, $this->_views);
2175
+        $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
2176 2176
         $this->_views = apply_filters('FHEE_list_table_views', $this->_views);
2177 2177
         $this->_set_list_table_view();
2178 2178
         $this->_set_list_table_object();
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
     protected function _set_list_table_object()
2208 2208
     {
2209 2209
         if (isset($this->_route_config['list_table'])) {
2210
-            if (! class_exists($this->_route_config['list_table'])) {
2210
+            if ( ! class_exists($this->_route_config['list_table'])) {
2211 2211
                 throw new EE_Error(
2212 2212
                     sprintf(
2213 2213
                         esc_html__(
@@ -2245,17 +2245,17 @@  discard block
 block discarded – undo
2245 2245
         foreach ($this->_views as $key => $view) {
2246 2246
             $query_args = [];
2247 2247
             // check for current view
2248
-            $this->_views[ $key ]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2248
+            $this->_views[$key]['class']               = $this->_view === $view['slug'] ? 'current' : '';
2249 2249
             $query_args['action']                        = $this->_req_action;
2250
-            $query_args[ $this->_req_action . '_nonce' ] = wp_create_nonce($query_args['action'] . '_nonce');
2250
+            $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
2251 2251
             $query_args['status']                        = $view['slug'];
2252 2252
             // merge any other arguments sent in.
2253
-            if (isset($extra_query_args[ $view['slug'] ])) {
2254
-                foreach ($extra_query_args[ $view['slug'] ] as $extra_query_arg) {
2253
+            if (isset($extra_query_args[$view['slug']])) {
2254
+                foreach ($extra_query_args[$view['slug']] as $extra_query_arg) {
2255 2255
                     $query_args[] = $extra_query_arg;
2256 2256
                 }
2257 2257
             }
2258
-            $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2258
+            $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
2259 2259
         }
2260 2260
         return $this->_views;
2261 2261
     }
@@ -2286,14 +2286,14 @@  discard block
 block discarded – undo
2286 2286
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
2287 2287
         foreach ($values as $value) {
2288 2288
             if ($value < $max_entries) {
2289
-                $selected                  = $value === $per_page ? ' selected="' . $per_page . '"' : '';
2289
+                $selected = $value === $per_page ? ' selected="'.$per_page.'"' : '';
2290 2290
                 $entries_per_page_dropdown .= '
2291
-						<option value="' . $value . '"' . $selected . '>' . $value . '&nbsp;&nbsp;</option>';
2291
+						<option value="' . $value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
2292 2292
             }
2293 2293
         }
2294
-        $selected                  = $max_entries === $per_page ? ' selected="' . $per_page . '"' : '';
2294
+        $selected = $max_entries === $per_page ? ' selected="'.$per_page.'"' : '';
2295 2295
         $entries_per_page_dropdown .= '
2296
-						<option value="' . $max_entries . '"' . $selected . '>All&nbsp;&nbsp;</option>';
2296
+						<option value="' . $max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
2297 2297
         $entries_per_page_dropdown .= '
2298 2298
 					</select>
2299 2299
 					entries
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
             empty($this->_search_btn_label) ? $this->page_label
2318 2318
                 : $this->_search_btn_label
2319 2319
         );
2320
-        $this->_template_args['search']['callback']  = 'search_' . $this->page_slug;
2320
+        $this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
2321 2321
     }
2322 2322
 
2323 2323
 
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
             $total_columns                                       = ! empty($screen_columns)
2406 2406
                 ? $screen_columns
2407 2407
                 : $this->_route_config['columns'][1];
2408
-            $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2408
+            $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2409 2409
             $this->_template_args['current_page']                = $this->_wp_page_slug;
2410 2410
             $this->_template_args['screen']                      = $this->_current_screen;
2411 2411
             $this->_column_template_path                         = EE_ADMIN_TEMPLATE
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
      */
2451 2451
     protected function _espresso_ratings_request()
2452 2452
     {
2453
-        if (! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2453
+        if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2454 2454
             return;
2455 2455
         }
2456 2456
         $ratings_box_title = apply_filters(
@@ -2477,28 +2477,28 @@  discard block
 block discarded – undo
2477 2477
      */
2478 2478
     public function espresso_ratings_request()
2479 2479
     {
2480
-        EEH_Template::display_template(EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php');
2480
+        EEH_Template::display_template(EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php');
2481 2481
     }
2482 2482
 
2483 2483
 
2484 2484
     public static function cached_rss_display($rss_id, $url)
2485 2485
     {
2486
-        $loading   = '<p class="widget-loading hide-if-no-js">'
2486
+        $loading = '<p class="widget-loading hide-if-no-js">'
2487 2487
                      . esc_html__('Loading&#8230;', 'event_espresso')
2488 2488
                      . '</p><p class="hide-if-js">'
2489 2489
                      . esc_html__('This widget requires JavaScript.', 'event_espresso')
2490 2490
                      . '</p>';
2491
-        $pre       = '<div class="espresso-rss-display">' . "\n\t";
2492
-        $pre       .= '<span id="' . esc_attr($rss_id) . '_url" class="hidden">' . esc_url_raw($url) . '</span>';
2493
-        $post      = '</div>' . "\n";
2494
-        $cache_key = 'ee_rss_' . md5($rss_id);
2491
+        $pre       = '<div class="espresso-rss-display">'."\n\t";
2492
+        $pre .= '<span id="'.esc_attr($rss_id).'_url" class="hidden">'.esc_url_raw($url).'</span>';
2493
+        $post      = '</div>'."\n";
2494
+        $cache_key = 'ee_rss_'.md5($rss_id);
2495 2495
         $output    = get_transient($cache_key);
2496 2496
         if ($output !== false) {
2497
-            echo $pre . $output . $post; // already escaped
2497
+            echo $pre.$output.$post; // already escaped
2498 2498
             return true;
2499 2499
         }
2500
-        if (! (defined('DOING_AJAX') && DOING_AJAX)) {
2501
-            echo $pre . $loading . $post; // already escaped
2500
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
2501
+            echo $pre.$loading.$post; // already escaped
2502 2502
             return false;
2503 2503
         }
2504 2504
         ob_start();
@@ -2565,19 +2565,19 @@  discard block
 block discarded – undo
2565 2565
     public function espresso_sponsors_post_box()
2566 2566
     {
2567 2567
         EEH_Template::display_template(
2568
-            EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'
2568
+            EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'
2569 2569
         );
2570 2570
     }
2571 2571
 
2572 2572
 
2573 2573
     private function _publish_post_box()
2574 2574
     {
2575
-        $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2575
+        $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2576 2576
         // if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array
2577 2577
         // then we'll use that for the metabox label.
2578 2578
         // Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2579
-        if (! empty($this->_labels['publishbox'])) {
2580
-            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][ $this->_req_action ]
2579
+        if ( ! empty($this->_labels['publishbox'])) {
2580
+            $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action]
2581 2581
                 : $this->_labels['publishbox'];
2582 2582
         } else {
2583 2583
             $box_label = esc_html__('Publish', 'event_espresso');
@@ -2606,7 +2606,7 @@  discard block
 block discarded – undo
2606 2606
             ? $this->_template_args['publish_box_extra_content']
2607 2607
             : '';
2608 2608
         echo EEH_Template::display_template(
2609
-            EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php',
2609
+            EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php',
2610 2610
             $this->_template_args,
2611 2611
             true
2612 2612
         );
@@ -2694,18 +2694,18 @@  discard block
 block discarded – undo
2694 2694
             );
2695 2695
         }
2696 2696
         $this->_template_args['publish_delete_link'] = $delete_link;
2697
-        if (! empty($name) && ! empty($id)) {
2698
-            $hidden_field_arr[ $name ] = [
2697
+        if ( ! empty($name) && ! empty($id)) {
2698
+            $hidden_field_arr[$name] = [
2699 2699
                 'type'  => 'hidden',
2700 2700
                 'value' => $id,
2701 2701
             ];
2702
-            $hf                        = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2702
+            $hf = $this->_generate_admin_form_fields($hidden_field_arr, 'array');
2703 2703
         } else {
2704 2704
             $hf = '';
2705 2705
         }
2706 2706
         // add hidden field
2707 2707
         $this->_template_args['publish_hidden_fields'] = is_array($hf) && ! empty($name)
2708
-            ? $hf[ $name ]['field']
2708
+            ? $hf[$name]['field']
2709 2709
             : $hf;
2710 2710
     }
2711 2711
 
@@ -2807,7 +2807,7 @@  discard block
 block discarded – undo
2807 2807
         }
2808 2808
         // if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2809 2809
         $call_back_func = $create_func
2810
-            ? static function ($post, $metabox) {
2810
+            ? static function($post, $metabox) {
2811 2811
                 do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2812 2812
                 echo EEH_Template::display_template(
2813 2813
                     $metabox['args']['template_path'],
@@ -2817,7 +2817,7 @@  discard block
 block discarded – undo
2817 2817
             }
2818 2818
             : $callback;
2819 2819
         $this->addMetaBox(
2820
-            str_replace('_', '-', $action) . '-mbox',
2820
+            str_replace('_', '-', $action).'-mbox',
2821 2821
             $title,
2822 2822
             $call_back_func,
2823 2823
             $this->_wp_page_slug,
@@ -2934,13 +2934,13 @@  discard block
 block discarded – undo
2934 2934
             'event-espresso_page_espresso_',
2935 2935
             '',
2936 2936
             $this->_wp_page_slug
2937
-        ) . ' ' . $this->_req_action . '-route';
2937
+        ).' '.$this->_req_action.'-route';
2938 2938
 
2939 2939
         $template_path = $sidebar
2940 2940
             ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2941
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2941
+            : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2942 2942
         if ($this->request->isAjax()) {
2943
-            $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2943
+            $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2944 2944
         }
2945 2945
         $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2946 2946
 
@@ -2974,11 +2974,11 @@  discard block
 block discarded – undo
2974 2974
     public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = true)
2975 2975
     {
2976 2976
         // let's generate a default preview action button if there isn't one already present.
2977
-        $this->_labels['buttons']['buy_now']           = esc_html__(
2977
+        $this->_labels['buttons']['buy_now'] = esc_html__(
2978 2978
             'Upgrade to Event Espresso 4 Right Now',
2979 2979
             'event_espresso'
2980 2980
         );
2981
-        $buy_now_url                                   = add_query_arg(
2981
+        $buy_now_url = add_query_arg(
2982 2982
             [
2983 2983
                 'ee_ver'       => 'ee4',
2984 2984
                 'utm_source'   => 'ee4_plugin_admin',
@@ -2998,8 +2998,8 @@  discard block
 block discarded – undo
2998 2998
                 true
2999 2999
             )
3000 3000
             : $this->_template_args['preview_action_button'];
3001
-        $this->_template_args['admin_page_content']    = EEH_Template::display_template(
3002
-            EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php',
3001
+        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3002
+            EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php',
3003 3003
             $this->_template_args,
3004 3004
             true
3005 3005
         );
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
         // setup search attributes
3058 3058
         $this->_set_search_attributes();
3059 3059
         $this->_template_args['current_page']     = $this->_wp_page_slug;
3060
-        $template_path                            = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
3060
+        $template_path                            = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
3061 3061
         $this->_template_args['table_url']        = $this->request->isAjax()
3062 3062
             ? add_query_arg(['noheader' => 'true', 'route' => $this->_req_action], $this->_admin_base_url)
3063 3063
             : add_query_arg(['route' => $this->_req_action], $this->_admin_base_url);
@@ -3065,10 +3065,10 @@  discard block
 block discarded – undo
3065 3065
         $this->_template_args['current_route']    = $this->_req_action;
3066 3066
         $this->_template_args['list_table_class'] = get_class($this->_list_table_object);
3067 3067
         $ajax_sorting_callback                    = $this->_list_table_object->get_ajax_sorting_callback();
3068
-        if (! empty($ajax_sorting_callback)) {
3068
+        if ( ! empty($ajax_sorting_callback)) {
3069 3069
             $sortable_list_table_form_fields = wp_nonce_field(
3070
-                $ajax_sorting_callback . '_nonce',
3071
-                $ajax_sorting_callback . '_nonce',
3070
+                $ajax_sorting_callback.'_nonce',
3071
+                $ajax_sorting_callback.'_nonce',
3072 3072
                 false,
3073 3073
                 false
3074 3074
             );
@@ -3085,18 +3085,18 @@  discard block
 block discarded – undo
3085 3085
 
3086 3086
         $hidden_form_fields = $this->_template_args['list_table_hidden_fields'] ?? '';
3087 3087
 
3088
-        $nonce_ref          = $this->_req_action . '_nonce';
3088
+        $nonce_ref          = $this->_req_action.'_nonce';
3089 3089
         $hidden_form_fields .= '
3090
-            <input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce($nonce_ref) . '">';
3090
+            <input type="hidden" name="' . $nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
3091 3091
 
3092
-        $this->_template_args['list_table_hidden_fields']        = $hidden_form_fields;
3092
+        $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
3093 3093
         // display message about search results?
3094 3094
         $search = $this->request->getRequestParam('s');
3095 3095
         $this->_template_args['before_list_table'] .= ! empty($search)
3096
-            ? '<p class="ee-search-results">' . sprintf(
3096
+            ? '<p class="ee-search-results">'.sprintf(
3097 3097
                 esc_html__('Displaying search results for the search string: %1$s', 'event_espresso'),
3098 3098
                 trim($search, '%')
3099
-            ) . '</p>'
3099
+            ).'</p>'
3100 3100
             : '';
3101 3101
         // filter before_list_table template arg
3102 3102
         $this->_template_args['before_list_table'] = apply_filters(
@@ -3130,7 +3130,7 @@  discard block
 block discarded – undo
3130 3130
         // convert to array and filter again
3131 3131
         // arrays are easier to inject new items in a specific location,
3132 3132
         // but would not be backwards compatible, so we have to add a new filter
3133
-        $this->_template_args['after_list_table']   = implode(
3133
+        $this->_template_args['after_list_table'] = implode(
3134 3134
             " \n",
3135 3135
             (array) apply_filters(
3136 3136
                 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
@@ -3178,15 +3178,15 @@  discard block
 block discarded – undo
3178 3178
         );
3179 3179
         /** @var EventEspresso\core\admin\StatusChangeNotice $status_change_notice */
3180 3180
         $status_change_notice = $this->loader->getShared('EventEspresso\core\admin\StatusChangeNotice');
3181
-        if (! $status_change_notice->isDismissed()) {
3181
+        if ( ! $status_change_notice->isDismissed()) {
3182 3182
             $this->_template_args['status_change_notice'] = EEH_Template::display_template(
3183
-                EE_ADMIN_TEMPLATE . 'status_change_notice.template.php',
3184
-                [ 'context' => '__admin-legend', 'page_slug' => $this->page_slug ],
3183
+                EE_ADMIN_TEMPLATE.'status_change_notice.template.php',
3184
+                ['context' => '__admin-legend', 'page_slug' => $this->page_slug],
3185 3185
                 true
3186 3186
             );
3187 3187
         }
3188 3188
         return EEH_Template::display_template(
3189
-            EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php',
3189
+            EE_ADMIN_TEMPLATE.'admin_details_legend.template.php',
3190 3190
             $this->_template_args,
3191 3191
             true
3192 3192
         );
@@ -3304,18 +3304,18 @@  discard block
 block discarded – undo
3304 3304
                 : ''
3305 3305
         );
3306 3306
 
3307
-        $this->_template_args['after_admin_page_content']  = apply_filters(
3307
+        $this->_template_args['after_admin_page_content'] = apply_filters(
3308 3308
             "FHEE_after_admin_page_content{$this->_current_page}{$this->_current_view}",
3309 3309
             isset($this->_template_args['after_admin_page_content'])
3310 3310
                 ? $this->_template_args['after_admin_page_content']
3311 3311
                 : ''
3312 3312
         );
3313
-        $this->_template_args['after_admin_page_content']  .= $this->_set_help_popup_content();
3313
+        $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
3314 3314
 
3315 3315
         if ($this->request->isAjax()) {
3316 3316
             $this->_template_args['admin_page_content'] = EEH_Template::display_template(
3317 3317
                 // $template_path,
3318
-                EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php',
3318
+                EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php',
3319 3319
                 $this->_template_args,
3320 3320
                 true
3321 3321
             );
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
         // load settings page wrapper template
3325 3325
         $template_path = $about
3326 3326
             ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php'
3327
-            : EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php';
3327
+            : EE_ADMIN_TEMPLATE.'admin_wrapper.template.php';
3328 3328
 
3329 3329
         EEH_Template::display_template($template_path, $this->_template_args);
3330 3330
     }
@@ -3408,12 +3408,12 @@  discard block
 block discarded – undo
3408 3408
         $default_names = ['save', 'save_and_close'];
3409 3409
         $buttons = '';
3410 3410
         foreach ($button_text as $key => $button) {
3411
-            $ref     = $default_names[ $key ];
3412
-            $name    = ! empty($actions) ? $actions[ $key ] : $ref;
3413
-            $buttons .= '<input type="submit" class="button button--primary ' . $ref . '" '
3414
-                        . 'value="' . $button . '" name="' . $name . '" '
3415
-                        . 'id="' . $this->_current_view . '_' . $ref . '" />';
3416
-            if (! $both) {
3411
+            $ref     = $default_names[$key];
3412
+            $name    = ! empty($actions) ? $actions[$key] : $ref;
3413
+            $buttons .= '<input type="submit" class="button button--primary '.$ref.'" '
3414
+                        . 'value="'.$button.'" name="'.$name.'" '
3415
+                        . 'id="'.$this->_current_view.'_'.$ref.'" />';
3416
+            if ( ! $both) {
3417 3417
                 break;
3418 3418
             }
3419 3419
         }
@@ -3453,13 +3453,13 @@  discard block
 block discarded – undo
3453 3453
                 'An error occurred. No action was set for this page\'s form.',
3454 3454
                 'event_espresso'
3455 3455
             );
3456
-            $dev_msg  = $user_msg . "\n"
3456
+            $dev_msg = $user_msg."\n"
3457 3457
                         . sprintf(
3458 3458
                             esc_html__('The $route argument is required for the %s->%s method.', 'event_espresso'),
3459 3459
                             __FUNCTION__,
3460 3460
                             __CLASS__
3461 3461
                         );
3462
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
3462
+            EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
3463 3463
         }
3464 3464
         // open form
3465 3465
         $action = $this->_admin_base_url;
@@ -3467,9 +3467,9 @@  discard block
 block discarded – undo
3467 3467
             <form name='form' method='post' action='{$action}' id='{$route}_event_form' class='ee-admin-page-form' >
3468 3468
             ";
3469 3469
         // add nonce
3470
-        $nonce                                             =
3471
-            wp_nonce_field($route . '_nonce', $route . '_nonce', false, false);
3472
-        $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
3470
+        $nonce =
3471
+            wp_nonce_field($route.'_nonce', $route.'_nonce', false, false);
3472
+        $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
3473 3473
         // add REQUIRED form action
3474 3474
         $hidden_fields = [
3475 3475
             'action' => ['type' => 'hidden', 'value' => $route],
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
         $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
3483 3483
         // add fields to form
3484 3484
         foreach ((array) $form_fields as $form_field) {
3485
-            $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
3485
+            $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
3486 3486
         }
3487 3487
         // close form
3488 3488
         $this->_template_args['after_admin_page_content'] = '</form>';
@@ -3576,10 +3576,10 @@  discard block
 block discarded – undo
3576 3576
         $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
3577 3577
         $notices      = EE_Error::get_notices(false);
3578 3578
         // overwrite default success messages //BUT ONLY if overwrite not overridden
3579
-        if (! $override_overwrite || ! empty($notices['errors'])) {
3579
+        if ( ! $override_overwrite || ! empty($notices['errors'])) {
3580 3580
             EE_Error::overwrite_success();
3581 3581
         }
3582
-        if (! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3582
+        if ( ! empty($what) && ! empty($action_desc) && empty($notices['errors'])) {
3583 3583
             // how many records affected ? more than one record ? or just one ?
3584 3584
             if ($success > 1) {
3585 3585
                 // set plural msg
@@ -3608,7 +3608,7 @@  discard block
 block discarded – undo
3608 3608
             }
3609 3609
         }
3610 3610
         // check that $query_args isn't something crazy
3611
-        if (! is_array($query_args)) {
3611
+        if ( ! is_array($query_args)) {
3612 3612
             $query_args = [];
3613 3613
         }
3614 3614
         /**
@@ -3637,7 +3637,7 @@  discard block
 block discarded – undo
3637 3637
             $redirect_url = admin_url('admin.php');
3638 3638
         }
3639 3639
         // merge any default query_args set in _default_route_query_args property
3640
-        if (! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3640
+        if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
3641 3641
             $args_to_merge = [];
3642 3642
             foreach ($this->_default_route_query_args as $query_param => $query_value) {
3643 3643
                 // is there a wp_referer array in our _default_route_query_args property?
@@ -3649,15 +3649,15 @@  discard block
 block discarded – undo
3649 3649
                         }
3650 3650
                         // finally we will override any arguments in the referer with
3651 3651
                         // what might be set on the _default_route_query_args array.
3652
-                        if (isset($this->_default_route_query_args[ $reference ])) {
3653
-                            $args_to_merge[ $reference ] = urlencode($this->_default_route_query_args[ $reference ]);
3652
+                        if (isset($this->_default_route_query_args[$reference])) {
3653
+                            $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
3654 3654
                         } else {
3655
-                            $args_to_merge[ $reference ] = urlencode($value);
3655
+                            $args_to_merge[$reference] = urlencode($value);
3656 3656
                         }
3657 3657
                     }
3658 3658
                     continue;
3659 3659
                 }
3660
-                $args_to_merge[ $query_param ] = $query_value;
3660
+                $args_to_merge[$query_param] = $query_value;
3661 3661
             }
3662 3662
             // now let's merge these arguments but override with what was specifically sent in to the
3663 3663
             // redirect.
@@ -3669,19 +3669,19 @@  discard block
 block discarded – undo
3669 3669
         if (isset($query_args['action'])) {
3670 3670
             // manually generate wp_nonce and merge that with the query vars
3671 3671
             // becuz the wp_nonce_url function wrecks havoc on some vars
3672
-            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'] . '_nonce');
3672
+            $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
3673 3673
         }
3674 3674
         // we're adding some hooks and filters in here for processing any things just before redirects
3675 3675
         // (example: an admin page has done an insert or update and we want to run something after that).
3676
-        do_action('AHEE_redirect_' . $classname . $this->_req_action, $query_args);
3676
+        do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
3677 3677
         $redirect_url = apply_filters(
3678
-            'FHEE_redirect_' . $classname . $this->_req_action,
3678
+            'FHEE_redirect_'.$classname.$this->_req_action,
3679 3679
             EE_Admin_Page::add_query_args_and_nonce($query_args, $redirect_url),
3680 3680
             $query_args
3681 3681
         );
3682 3682
         // check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3683 3683
         if ($this->request->isAjax()) {
3684
-            $default_data                    = [
3684
+            $default_data = [
3685 3685
                 'close'        => true,
3686 3686
                 'redirect_url' => $redirect_url,
3687 3687
                 'where'        => 'main',
@@ -3731,7 +3731,7 @@  discard block
 block discarded – undo
3731 3731
         }
3732 3732
         $this->_template_args['notices'] = EE_Error::get_notices();
3733 3733
         // IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3734
-        if (! $this->request->isAjax() || $sticky_notices) {
3734
+        if ( ! $this->request->isAjax() || $sticky_notices) {
3735 3735
             $route = isset($query_args['action']) ? $query_args['action'] : 'default';
3736 3736
             $this->_add_transient(
3737 3737
                 $route,
@@ -3771,7 +3771,7 @@  discard block
 block discarded – undo
3771 3771
         $exclude_nonce = false
3772 3772
     ) {
3773 3773
         // first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3774
-        if (empty($base_url) && ! isset($this->_page_routes[ $action ])) {
3774
+        if (empty($base_url) && ! isset($this->_page_routes[$action])) {
3775 3775
             throw new EE_Error(
3776 3776
                 sprintf(
3777 3777
                     esc_html__(
@@ -3782,7 +3782,7 @@  discard block
 block discarded – undo
3782 3782
                 )
3783 3783
             );
3784 3784
         }
3785
-        if (! isset($this->_labels['buttons'][ $type ])) {
3785
+        if ( ! isset($this->_labels['buttons'][$type])) {
3786 3786
             throw new EE_Error(
3787 3787
                 sprintf(
3788 3788
                     esc_html__(
@@ -3795,7 +3795,7 @@  discard block
 block discarded – undo
3795 3795
         }
3796 3796
         // finally check user access for this button.
3797 3797
         $has_access = $this->check_user_access($action, true);
3798
-        if (! $has_access) {
3798
+        if ( ! $has_access) {
3799 3799
             return '';
3800 3800
         }
3801 3801
         $_base_url  = ! $base_url ? $this->_admin_base_url : $base_url;
@@ -3803,11 +3803,11 @@  discard block
 block discarded – undo
3803 3803
             'action' => $action,
3804 3804
         ];
3805 3805
         // merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3806
-        if (! empty($extra_request)) {
3806
+        if ( ! empty($extra_request)) {
3807 3807
             $query_args = array_merge($extra_request, $query_args);
3808 3808
         }
3809 3809
         $url = EE_Admin_Page::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3810
-        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][ $type ], $class);
3810
+        return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3811 3811
     }
3812 3812
 
3813 3813
 
@@ -3833,7 +3833,7 @@  discard block
 block discarded – undo
3833 3833
                 'FHEE__EE_Admin_Page___per_page_screen_options__default',
3834 3834
                 20
3835 3835
             ),
3836
-            'option'  => $this->_current_page . '_' . $this->_current_view . '_per_page',
3836
+            'option'  => $this->_current_page.'_'.$this->_current_view.'_per_page',
3837 3837
         ];
3838 3838
         // ONLY add the screen option if the user has access to it.
3839 3839
         if ($this->check_user_access($this->_current_view, true)) {
@@ -3854,18 +3854,18 @@  discard block
 block discarded – undo
3854 3854
     {
3855 3855
         if ($this->request->requestParamIsSet('wp_screen_options')) {
3856 3856
             check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3857
-            if (! $user = wp_get_current_user()) {
3857
+            if ( ! $user = wp_get_current_user()) {
3858 3858
                 return;
3859 3859
             }
3860 3860
             $option = $this->request->getRequestParam('wp_screen_options[option]', '', 'key');
3861
-            if (! $option) {
3861
+            if ( ! $option) {
3862 3862
                 return;
3863 3863
             }
3864
-            $value  = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3864
+            $value = $this->request->getRequestParam('wp_screen_options[value]', 0, 'int');
3865 3865
             $map_option = $option;
3866 3866
             $option     = str_replace('-', '_', $option);
3867 3867
             switch ($map_option) {
3868
-                case $this->_current_page . '_' . $this->_current_view . '_per_page':
3868
+                case $this->_current_page.'_'.$this->_current_view.'_per_page':
3869 3869
                     $max_value = apply_filters(
3870 3870
                         'FHEE__EE_Admin_Page___set_per_page_screen_options__max_value',
3871 3871
                         999,
@@ -3922,13 +3922,13 @@  discard block
 block discarded – undo
3922 3922
     protected function _add_transient($route, $data, $notices = false, $skip_route_verify = false)
3923 3923
     {
3924 3924
         $user_id = get_current_user_id();
3925
-        if (! $skip_route_verify) {
3925
+        if ( ! $skip_route_verify) {
3926 3926
             $this->_verify_route($route);
3927 3927
         }
3928 3928
         // now let's set the string for what kind of transient we're setting
3929 3929
         $transient = $notices
3930
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3931
-            : 'rte_tx_' . $route . '_' . $user_id;
3930
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3931
+            : 'rte_tx_'.$route.'_'.$user_id;
3932 3932
         $data      = $notices ? ['notices' => $data] : $data;
3933 3933
         // is there already a transient for this route?  If there is then let's ADD to that transient
3934 3934
         $existing = is_multisite() && is_network_admin()
@@ -3957,8 +3957,8 @@  discard block
 block discarded – undo
3957 3957
         $user_id   = get_current_user_id();
3958 3958
         $route     = ! $route ? $this->_req_action : $route;
3959 3959
         $transient = $notices
3960
-            ? 'ee_rte_n_tx_' . $route . '_' . $user_id
3961
-            : 'rte_tx_' . $route . '_' . $user_id;
3960
+            ? 'ee_rte_n_tx_'.$route.'_'.$user_id
3961
+            : 'rte_tx_'.$route.'_'.$user_id;
3962 3962
         $data      = is_multisite() && is_network_admin()
3963 3963
             ? get_site_transient($transient)
3964 3964
             : get_transient($transient);
@@ -4194,7 +4194,7 @@  discard block
 block discarded – undo
4194 4194
      */
4195 4195
     protected function _next_link($url, $class = 'dashicons dashicons-arrow-right')
4196 4196
     {
4197
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4197
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
4198 4198
     }
4199 4199
 
4200 4200
 
@@ -4207,7 +4207,7 @@  discard block
 block discarded – undo
4207 4207
      */
4208 4208
     protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left')
4209 4209
     {
4210
-        return '<a class="' . $class . '" href="' . $url . '"></a>';
4210
+        return '<a class="'.$class.'" href="'.$url.'"></a>';
4211 4211
     }
4212 4212
 
4213 4213
 
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 2 patches
Indentation   +595 added lines, -595 removed lines patch added patch discarded remove patch
@@ -12,350 +12,350 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class EE_Event_Registrations_List_Table extends EE_Admin_List_Table
14 14
 {
15
-    /**
16
-     * @var Extend_Registrations_Admin_Page
17
-     */
18
-    protected $_admin_page;
19
-
20
-    /**
21
-     * This property will hold the related Datetimes on an event IF the event id is included in the request.
22
-     *
23
-     * @var EE_Datetime[]
24
-     */
25
-    protected $_dtts_for_event = [];
26
-
27
-    /**
28
-     * The event if one is specified in the request
29
-     *
30
-     * @var EE_Event
31
-     */
32
-    protected $_evt = null;
33
-
34
-    /**
35
-     * The DTT_ID if the current view has a specified datetime.
36
-     *
37
-     * @var int $_cur_dtt_id
38
-     */
39
-    protected $_cur_dtt_id = 0;
40
-
41
-
42
-    /**
43
-     * EE_Event_Registrations_List_Table constructor.
44
-     *
45
-     * @param Registrations_Admin_Page $admin_page
46
-     */
47
-    public function __construct($admin_page)
48
-    {
49
-        parent::__construct($admin_page);
50
-    }
51
-
52
-
53
-    /**
54
-     * @throws EE_Error
55
-     */
56
-    protected function _setup_data()
57
-    {
58
-        $this->_data = $this->_view !== 'trash'
59
-            ? $this->_admin_page->get_event_attendees($this->_per_page)
60
-            : $this->_admin_page->get_event_attendees($this->_per_page, false, true);
61
-
62
-        $this->_all_data_count = $this->_view !== 'trash'
63
-            ? $this->_admin_page->get_event_attendees($this->_per_page, true)
64
-            : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
65
-    }
66
-
67
-
68
-    /**
69
-     * @throws ReflectionException
70
-     * @throws EE_Error
71
-     */
72
-    protected function _set_properties()
73
-    {
74
-        $return_url = $this->getReturnUrl();
75
-        $evt_id     = $this->_req_data['event_id'] ?? null;
76
-
77
-        $this->_wp_list_args = [
78
-            'singular' => esc_html__('registrant', 'event_espresso'),
79
-            'plural'   => esc_html__('registrants', 'event_espresso'),
80
-            'ajax'     => true,
81
-            'screen'   => $this->_admin_page->get_current_screen()->id,
82
-        ];
83
-        $columns             = [];
84
-        $this->_columns      = [
85
-            '_REG_att_checked_in' => esc_html__('Check In', 'event_espresso'),
86
-            'ATT_name'            => esc_html__('Registrant', 'event_espresso'),
87
-            'ATT_email'           => esc_html__('Email Address', 'event_espresso'),
88
-            'Event'               => esc_html__('Event', 'event_espresso'),
89
-            'PRC_name'            => esc_html__('TKT Option', 'event_espresso'),
90
-            '_REG_final_price'    => esc_html__('Price', 'event_espresso'),
91
-            'TXN_paid'            => esc_html__('Paid', 'event_espresso'),
92
-            'TXN_total'           => esc_html__('Total', 'event_espresso'),
93
-        ];
94
-        // Add/remove columns when an event has been selected
95
-        if (! empty($evt_id)) {
96
-            // Render a checkbox column
97
-            $columns['cb']              = '<input type="checkbox" />';
98
-            $this->_has_checkbox_column = true;
99
-            // Remove the 'Event' column
100
-            unset($this->_columns['Event']);
101
-        }
102
-        $this->_columns        = array_merge($columns, $this->_columns);
103
-        $this->_primary_column = '_REG_att_checked_in';
104
-        if (
105
-            ! empty($evt_id)
106
-            && EE_Registry::instance()->CAP->current_user_can(
107
-                'ee_read_registrations',
108
-                'espresso_registrations_registrations_reports',
109
-                $evt_id
110
-            )
111
-        ) {
112
-            $this->_bottom_buttons = [
113
-                'report' => [
114
-                    'route'         => 'registrations_report',
115
-                    'extra_request' =>
116
-                        [
117
-                            'EVT_ID'     => $evt_id,
118
-                            'return_url' => $return_url,
119
-                        ],
120
-                ],
121
-            ];
122
-        }
123
-        $this->_bottom_buttons['report_filtered'] = [
124
-            'route'         => 'registrations_checkin_report',
125
-            'extra_request' => [
126
-                'use_filters' => true,
127
-                'filters'     => array_merge(
128
-                    [
129
-                        'EVT_ID' => $evt_id,
130
-                    ],
131
-                    array_diff_key(
132
-                        $this->_req_data,
133
-                        array_flip(
134
-                            [
135
-                                'page',
136
-                                'action',
137
-                                'default_nonce',
138
-                            ]
139
-                        )
140
-                    )
141
-                ),
142
-                'return_url'  => $return_url,
143
-            ],
144
-        ];
145
-        $this->_sortable_columns                  = [
146
-            /**
147
-             * Allows users to change the default sort if they wish.
148
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
149
-             *
150
-             * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
151
-             * change the sorts on any list table involving registration contacts.  If you want to only change the filter
152
-             * for a specific list table you can use the provided reference to this object instance.
153
-             */
154
-            'ATT_name' => [
155
-                'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
156
-                true,
157
-                $this,
158
-            ]
159
-                ? ['ATT_lname' => true]
160
-                : ['ATT_fname' => true],
161
-            'Event'    => ['Event.EVT_name' => false],
162
-        ];
163
-        $this->_hidden_columns                    = [];
164
-        $this->_evt                               = EEM_Event::instance()->get_one_by_ID($evt_id);
165
-        $this->_dtts_for_event                    =
166
-            $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : [];
167
-    }
168
-
169
-
170
-    /**
171
-     * @param EE_Registration $item
172
-     * @return string
173
-     */
174
-    protected function _get_row_class($item): string
175
-    {
176
-        $class = parent::_get_row_class($item);
177
-        if ($this->_has_checkbox_column) {
178
-            $class .= ' has-checkbox-column';
179
-        }
180
-        return $class;
181
-    }
182
-
183
-
184
-    /**
185
-     * @return array
186
-     * @throws EE_Error
187
-     * @throws ReflectionException
188
-     */
189
-    protected function _get_table_filters(): array
190
-    {
191
-        $filters        = $where = [];
192
-        $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
193
-        if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
194
-            // this means we don't have an event so let's setup a filter dropdown for all the events to select
195
-            // note possible capability restrictions
196
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
197
-                $where['status**'] = ['!=', 'private'];
198
-            }
199
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
200
-                $where['EVT_wp_user'] = get_current_user_id();
201
-            }
202
-            $events   = EEM_Event::instance()->get_all(
203
-                [
204
-                    $where,
205
-                    'order_by' => ['Datetime.DTT_EVT_start' => 'DESC'],
206
-                ]
207
-            );
208
-            $events[] = [
209
-                'id'   => 0,
210
-                'text' => esc_html__(' - select an event - ', 'event_espresso'),
211
-            ];
212
-            $checked  = 'checked';
213
-            /** @var EE_Event $event */
214
-            foreach ($events as $event) {
215
-                // any registrations for this event?
216
-                if (! $event instanceof EE_Event || ! $event->get_count_of_all_registrations()) {
217
-                    continue;
218
-                }
219
-                $events[] = [
220
-                    'id'    => $event->ID(),
221
-                    'text'  => apply_filters(
222
-                        'FHEE__EE_Event_Registrations___get_table_filters__event_name',
223
-                        $event->get('EVT_name'),
224
-                        $event
225
-                    ),
226
-                    'class' => $event->is_expired() ? 'ee-expired-event' : '',
227
-                ];
228
-                if ($event->ID() === $current_EVT_ID && $event->is_expired()) {
229
-                    $checked = '';
230
-                }
231
-            }
232
-            $event_filter = '<div class="ee-event-filter">';
233
-            $event_filter .= '<label for="event_id">';
234
-            $event_filter .= esc_html__('Check-in Status for', 'event_espresso');
235
-            $event_filter .= '</label>&nbsp;&nbsp;';
236
-            $event_filter .= EEH_Form_Fields::select_input('event_id', $events, $current_EVT_ID);
237
-            $event_filter .= '<span class="ee-event-filter-toggle">';
238
-            $event_filter .= '<label for="js-ee-hide-expired-events">';
239
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '>&nbsp;&nbsp;';
240
-            $event_filter .= esc_html__('Hide Expired Events', 'event_espresso');
241
-            $event_filter .= '</label>';
242
-            $event_filter .= '</span>';
243
-            $event_filter .= '</div>';
244
-            $filters[]    = $event_filter;
245
-        }
246
-        if (! empty($this->_dtts_for_event)) {
247
-            // DTT datetimes filter
248
-            $this->_cur_dtt_id = $this->_req_data['DTT_ID'] ?? 0;
249
-            if (count($this->_dtts_for_event) > 1) {
250
-                $datetimes[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso');
251
-                foreach ($this->_dtts_for_event as $datetime) {
252
-                    $datetime_string              = $datetime->name();
253
-                    $datetime_string              = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
254
-                    $datetime_string              =
255
-                        $datetime->start_date_and_time() . ' - ' . $datetime->end_date_and_time() . $datetime_string;
256
-                    $datetimes[ $datetime->ID() ] = $datetime_string;
257
-                }
258
-                $input     = new EE_Select_Input(
259
-                    $datetimes,
260
-                    [
261
-                        'html_name' => 'DTT_ID',
262
-                        'html_id'   => 'DTT_ID',
263
-                        'default'   => $this->_cur_dtt_id,
264
-                    ]
265
-                );
266
-                $filters[] = $input->get_html_for_input();
267
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
268
-            }
269
-        }
270
-        return $filters;
271
-    }
272
-
273
-
274
-    /**
275
-     * @throws EE_Error
276
-     * @throws ReflectionException
277
-     */
278
-    protected function _add_view_counts()
279
-    {
280
-        $this->_views['all']['count'] = $this->_get_total_event_attendees();
281
-    }
282
-
283
-
284
-    /**
285
-     * @return int
286
-     * @throws EE_Error
287
-     * @throws ReflectionException
288
-     */
289
-    protected function _get_total_event_attendees(): int
290
-    {
291
-        $EVT_ID       = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
292
-        $DTT_ID       = $this->_cur_dtt_id;
293
-        $query_params = [];
294
-        if ($EVT_ID) {
295
-            $query_params[0]['EVT_ID'] = $EVT_ID;
296
-        }
297
-        // if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
298
-        if ($DTT_ID) {
299
-            $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
300
-        }
301
-        $status_ids_array          = apply_filters(
302
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
303
-            [EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved]
304
-        );
305
-        $query_params[0]['STS_ID'] = ['IN', $status_ids_array];
306
-        return EEM_Registration::instance()->count($query_params);
307
-    }
308
-
309
-
310
-    /**
311
-     * @param EE_Registration $item
312
-     * @return string
313
-     * @throws EE_Error
314
-     * @throws ReflectionException
315
-     */
316
-    public function column_cb($item): string
317
-    {
318
-        return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
319
-    }
320
-
321
-
322
-    /**
323
-     * column_REG_att_checked_in
324
-     *
325
-     * @param EE_Registration $registration
326
-     * @return string
327
-     * @throws EE_Error
328
-     * @throws InvalidArgumentException
329
-     * @throws InvalidDataTypeException
330
-     * @throws InvalidInterfaceException
331
-     * @throws ReflectionException
332
-     */
333
-    public function column__REG_att_checked_in(EE_Registration $registration): string
334
-    {
335
-        $attendee      = $registration->attendee();
336
-        $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
337
-
338
-        if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
339
-            $latest_related_datetime = $registration->get_latest_related_datetime();
340
-            if ($latest_related_datetime instanceof EE_Datetime) {
341
-                $this->_cur_dtt_id = $latest_related_datetime->ID();
342
-            }
343
-        }
344
-        $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
345
-            $registration,
346
-            $this->_cur_dtt_id
347
-        );
348
-        $nonce                   = wp_create_nonce('checkin_nonce');
349
-        $toggle_active           = ! empty($this->_cur_dtt_id)
350
-                                   && EE_Registry::instance()->CAP->current_user_can(
351
-                                       'ee_edit_checkin',
352
-                                       'espresso_registrations_toggle_checkin_status',
353
-                                       $registration->ID()
354
-                                   )
355
-            ? ' clickable trigger-checkin'
356
-            : '';
357
-        $mobile_view_content     = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
358
-        return '
15
+	/**
16
+	 * @var Extend_Registrations_Admin_Page
17
+	 */
18
+	protected $_admin_page;
19
+
20
+	/**
21
+	 * This property will hold the related Datetimes on an event IF the event id is included in the request.
22
+	 *
23
+	 * @var EE_Datetime[]
24
+	 */
25
+	protected $_dtts_for_event = [];
26
+
27
+	/**
28
+	 * The event if one is specified in the request
29
+	 *
30
+	 * @var EE_Event
31
+	 */
32
+	protected $_evt = null;
33
+
34
+	/**
35
+	 * The DTT_ID if the current view has a specified datetime.
36
+	 *
37
+	 * @var int $_cur_dtt_id
38
+	 */
39
+	protected $_cur_dtt_id = 0;
40
+
41
+
42
+	/**
43
+	 * EE_Event_Registrations_List_Table constructor.
44
+	 *
45
+	 * @param Registrations_Admin_Page $admin_page
46
+	 */
47
+	public function __construct($admin_page)
48
+	{
49
+		parent::__construct($admin_page);
50
+	}
51
+
52
+
53
+	/**
54
+	 * @throws EE_Error
55
+	 */
56
+	protected function _setup_data()
57
+	{
58
+		$this->_data = $this->_view !== 'trash'
59
+			? $this->_admin_page->get_event_attendees($this->_per_page)
60
+			: $this->_admin_page->get_event_attendees($this->_per_page, false, true);
61
+
62
+		$this->_all_data_count = $this->_view !== 'trash'
63
+			? $this->_admin_page->get_event_attendees($this->_per_page, true)
64
+			: $this->_admin_page->get_event_attendees($this->_per_page, true, true);
65
+	}
66
+
67
+
68
+	/**
69
+	 * @throws ReflectionException
70
+	 * @throws EE_Error
71
+	 */
72
+	protected function _set_properties()
73
+	{
74
+		$return_url = $this->getReturnUrl();
75
+		$evt_id     = $this->_req_data['event_id'] ?? null;
76
+
77
+		$this->_wp_list_args = [
78
+			'singular' => esc_html__('registrant', 'event_espresso'),
79
+			'plural'   => esc_html__('registrants', 'event_espresso'),
80
+			'ajax'     => true,
81
+			'screen'   => $this->_admin_page->get_current_screen()->id,
82
+		];
83
+		$columns             = [];
84
+		$this->_columns      = [
85
+			'_REG_att_checked_in' => esc_html__('Check In', 'event_espresso'),
86
+			'ATT_name'            => esc_html__('Registrant', 'event_espresso'),
87
+			'ATT_email'           => esc_html__('Email Address', 'event_espresso'),
88
+			'Event'               => esc_html__('Event', 'event_espresso'),
89
+			'PRC_name'            => esc_html__('TKT Option', 'event_espresso'),
90
+			'_REG_final_price'    => esc_html__('Price', 'event_espresso'),
91
+			'TXN_paid'            => esc_html__('Paid', 'event_espresso'),
92
+			'TXN_total'           => esc_html__('Total', 'event_espresso'),
93
+		];
94
+		// Add/remove columns when an event has been selected
95
+		if (! empty($evt_id)) {
96
+			// Render a checkbox column
97
+			$columns['cb']              = '<input type="checkbox" />';
98
+			$this->_has_checkbox_column = true;
99
+			// Remove the 'Event' column
100
+			unset($this->_columns['Event']);
101
+		}
102
+		$this->_columns        = array_merge($columns, $this->_columns);
103
+		$this->_primary_column = '_REG_att_checked_in';
104
+		if (
105
+			! empty($evt_id)
106
+			&& EE_Registry::instance()->CAP->current_user_can(
107
+				'ee_read_registrations',
108
+				'espresso_registrations_registrations_reports',
109
+				$evt_id
110
+			)
111
+		) {
112
+			$this->_bottom_buttons = [
113
+				'report' => [
114
+					'route'         => 'registrations_report',
115
+					'extra_request' =>
116
+						[
117
+							'EVT_ID'     => $evt_id,
118
+							'return_url' => $return_url,
119
+						],
120
+				],
121
+			];
122
+		}
123
+		$this->_bottom_buttons['report_filtered'] = [
124
+			'route'         => 'registrations_checkin_report',
125
+			'extra_request' => [
126
+				'use_filters' => true,
127
+				'filters'     => array_merge(
128
+					[
129
+						'EVT_ID' => $evt_id,
130
+					],
131
+					array_diff_key(
132
+						$this->_req_data,
133
+						array_flip(
134
+							[
135
+								'page',
136
+								'action',
137
+								'default_nonce',
138
+							]
139
+						)
140
+					)
141
+				),
142
+				'return_url'  => $return_url,
143
+			],
144
+		];
145
+		$this->_sortable_columns                  = [
146
+			/**
147
+			 * Allows users to change the default sort if they wish.
148
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
149
+			 *
150
+			 * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
151
+			 * change the sorts on any list table involving registration contacts.  If you want to only change the filter
152
+			 * for a specific list table you can use the provided reference to this object instance.
153
+			 */
154
+			'ATT_name' => [
155
+				'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
156
+				true,
157
+				$this,
158
+			]
159
+				? ['ATT_lname' => true]
160
+				: ['ATT_fname' => true],
161
+			'Event'    => ['Event.EVT_name' => false],
162
+		];
163
+		$this->_hidden_columns                    = [];
164
+		$this->_evt                               = EEM_Event::instance()->get_one_by_ID($evt_id);
165
+		$this->_dtts_for_event                    =
166
+			$this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : [];
167
+	}
168
+
169
+
170
+	/**
171
+	 * @param EE_Registration $item
172
+	 * @return string
173
+	 */
174
+	protected function _get_row_class($item): string
175
+	{
176
+		$class = parent::_get_row_class($item);
177
+		if ($this->_has_checkbox_column) {
178
+			$class .= ' has-checkbox-column';
179
+		}
180
+		return $class;
181
+	}
182
+
183
+
184
+	/**
185
+	 * @return array
186
+	 * @throws EE_Error
187
+	 * @throws ReflectionException
188
+	 */
189
+	protected function _get_table_filters(): array
190
+	{
191
+		$filters        = $where = [];
192
+		$current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
193
+		if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
194
+			// this means we don't have an event so let's setup a filter dropdown for all the events to select
195
+			// note possible capability restrictions
196
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
197
+				$where['status**'] = ['!=', 'private'];
198
+			}
199
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
200
+				$where['EVT_wp_user'] = get_current_user_id();
201
+			}
202
+			$events   = EEM_Event::instance()->get_all(
203
+				[
204
+					$where,
205
+					'order_by' => ['Datetime.DTT_EVT_start' => 'DESC'],
206
+				]
207
+			);
208
+			$events[] = [
209
+				'id'   => 0,
210
+				'text' => esc_html__(' - select an event - ', 'event_espresso'),
211
+			];
212
+			$checked  = 'checked';
213
+			/** @var EE_Event $event */
214
+			foreach ($events as $event) {
215
+				// any registrations for this event?
216
+				if (! $event instanceof EE_Event || ! $event->get_count_of_all_registrations()) {
217
+					continue;
218
+				}
219
+				$events[] = [
220
+					'id'    => $event->ID(),
221
+					'text'  => apply_filters(
222
+						'FHEE__EE_Event_Registrations___get_table_filters__event_name',
223
+						$event->get('EVT_name'),
224
+						$event
225
+					),
226
+					'class' => $event->is_expired() ? 'ee-expired-event' : '',
227
+				];
228
+				if ($event->ID() === $current_EVT_ID && $event->is_expired()) {
229
+					$checked = '';
230
+				}
231
+			}
232
+			$event_filter = '<div class="ee-event-filter">';
233
+			$event_filter .= '<label for="event_id">';
234
+			$event_filter .= esc_html__('Check-in Status for', 'event_espresso');
235
+			$event_filter .= '</label>&nbsp;&nbsp;';
236
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $events, $current_EVT_ID);
237
+			$event_filter .= '<span class="ee-event-filter-toggle">';
238
+			$event_filter .= '<label for="js-ee-hide-expired-events">';
239
+			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '>&nbsp;&nbsp;';
240
+			$event_filter .= esc_html__('Hide Expired Events', 'event_espresso');
241
+			$event_filter .= '</label>';
242
+			$event_filter .= '</span>';
243
+			$event_filter .= '</div>';
244
+			$filters[]    = $event_filter;
245
+		}
246
+		if (! empty($this->_dtts_for_event)) {
247
+			// DTT datetimes filter
248
+			$this->_cur_dtt_id = $this->_req_data['DTT_ID'] ?? 0;
249
+			if (count($this->_dtts_for_event) > 1) {
250
+				$datetimes[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso');
251
+				foreach ($this->_dtts_for_event as $datetime) {
252
+					$datetime_string              = $datetime->name();
253
+					$datetime_string              = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
254
+					$datetime_string              =
255
+						$datetime->start_date_and_time() . ' - ' . $datetime->end_date_and_time() . $datetime_string;
256
+					$datetimes[ $datetime->ID() ] = $datetime_string;
257
+				}
258
+				$input     = new EE_Select_Input(
259
+					$datetimes,
260
+					[
261
+						'html_name' => 'DTT_ID',
262
+						'html_id'   => 'DTT_ID',
263
+						'default'   => $this->_cur_dtt_id,
264
+					]
265
+				);
266
+				$filters[] = $input->get_html_for_input();
267
+				$filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
268
+			}
269
+		}
270
+		return $filters;
271
+	}
272
+
273
+
274
+	/**
275
+	 * @throws EE_Error
276
+	 * @throws ReflectionException
277
+	 */
278
+	protected function _add_view_counts()
279
+	{
280
+		$this->_views['all']['count'] = $this->_get_total_event_attendees();
281
+	}
282
+
283
+
284
+	/**
285
+	 * @return int
286
+	 * @throws EE_Error
287
+	 * @throws ReflectionException
288
+	 */
289
+	protected function _get_total_event_attendees(): int
290
+	{
291
+		$EVT_ID       = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
292
+		$DTT_ID       = $this->_cur_dtt_id;
293
+		$query_params = [];
294
+		if ($EVT_ID) {
295
+			$query_params[0]['EVT_ID'] = $EVT_ID;
296
+		}
297
+		// if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
298
+		if ($DTT_ID) {
299
+			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
300
+		}
301
+		$status_ids_array          = apply_filters(
302
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
303
+			[EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved]
304
+		);
305
+		$query_params[0]['STS_ID'] = ['IN', $status_ids_array];
306
+		return EEM_Registration::instance()->count($query_params);
307
+	}
308
+
309
+
310
+	/**
311
+	 * @param EE_Registration $item
312
+	 * @return string
313
+	 * @throws EE_Error
314
+	 * @throws ReflectionException
315
+	 */
316
+	public function column_cb($item): string
317
+	{
318
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
319
+	}
320
+
321
+
322
+	/**
323
+	 * column_REG_att_checked_in
324
+	 *
325
+	 * @param EE_Registration $registration
326
+	 * @return string
327
+	 * @throws EE_Error
328
+	 * @throws InvalidArgumentException
329
+	 * @throws InvalidDataTypeException
330
+	 * @throws InvalidInterfaceException
331
+	 * @throws ReflectionException
332
+	 */
333
+	public function column__REG_att_checked_in(EE_Registration $registration): string
334
+	{
335
+		$attendee      = $registration->attendee();
336
+		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
337
+
338
+		if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
339
+			$latest_related_datetime = $registration->get_latest_related_datetime();
340
+			if ($latest_related_datetime instanceof EE_Datetime) {
341
+				$this->_cur_dtt_id = $latest_related_datetime->ID();
342
+			}
343
+		}
344
+		$checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
345
+			$registration,
346
+			$this->_cur_dtt_id
347
+		);
348
+		$nonce                   = wp_create_nonce('checkin_nonce');
349
+		$toggle_active           = ! empty($this->_cur_dtt_id)
350
+								   && EE_Registry::instance()->CAP->current_user_can(
351
+									   'ee_edit_checkin',
352
+									   'espresso_registrations_toggle_checkin_status',
353
+									   $registration->ID()
354
+								   )
355
+			? ' clickable trigger-checkin'
356
+			: '';
357
+		$mobile_view_content     = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
358
+		return '
359 359
         <button class="button button--secondary button--icon-only ' . $toggle_active . '"
360 360
                 data-_regid="' . $registration->ID() . '"
361 361
                 data-dttid="' . $this->_cur_dtt_id . '"
@@ -364,263 +364,263 @@  discard block
 block discarded – undo
364 364
             <span class="' . $checkin_status_dashicon->cssClasses() . '"></span>
365 365
         </button>
366 366
             '
367
-               . $mobile_view_content;
368
-    }
369
-
370
-
371
-    /**
372
-     * @param EE_Registration $registration
373
-     * @return string
374
-     * @throws EE_Error
375
-     * @throws ReflectionException
376
-     */
377
-    public function column_ATT_name(EE_Registration $registration): string
378
-    {
379
-        $attendee = $registration->attendee();
380
-        if (! $attendee instanceof EE_Attendee) {
381
-            return esc_html__('No contact record for this registration.', 'event_espresso');
382
-        }
383
-        // edit attendee link
384
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
385
-            ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
386
-            REG_ADMIN_URL
387
-        );
388
-        $name_link    = '
367
+			   . $mobile_view_content;
368
+	}
369
+
370
+
371
+	/**
372
+	 * @param EE_Registration $registration
373
+	 * @return string
374
+	 * @throws EE_Error
375
+	 * @throws ReflectionException
376
+	 */
377
+	public function column_ATT_name(EE_Registration $registration): string
378
+	{
379
+		$attendee = $registration->attendee();
380
+		if (! $attendee instanceof EE_Attendee) {
381
+			return esc_html__('No contact record for this registration.', 'event_espresso');
382
+		}
383
+		// edit attendee link
384
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
385
+			['action' => 'view_registration', '_REG_ID' => $registration->ID()],
386
+			REG_ADMIN_URL
387
+		);
388
+		$name_link    = '
389 389
             <span class="ee-status-dot ee-status-bg--' . esc_attr($registration->status_ID()) . ' ee-aria-tooltip"
390 390
             aria-label="' . EEH_Template::pretty_status($registration->status_ID(), false, 'sentence') . '">
391 391
             </span>';
392
-        $name_link    .= EE_Registry::instance()->CAP->current_user_can(
393
-            'ee_edit_contacts',
394
-            'espresso_registrations_edit_attendee'
395
-        )
396
-            ? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__(
397
-                'View Registration Details',
398
-                'event_espresso'
399
-            ) . '">'
400
-              . $registration->attendee()->full_name()
401
-              . '</a>'
402
-            : $registration->attendee()->full_name();
403
-        $name_link    .= $registration->count() === 1
404
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup>	'
405
-            : '';
406
-        // add group details
407
-        $name_link .= '&nbsp;' . sprintf(
408
-            esc_html__('(%s of %s)', 'event_espresso'),
409
-            $registration->count(),
410
-            $registration->group_size()
411
-        );
412
-        // add regcode
413
-        $link      = EE_Admin_Page::add_query_args_and_nonce(
414
-            ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
415
-            REG_ADMIN_URL
416
-        );
417
-        $name_link .= '<br>';
418
-        $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
419
-            'ee_read_registration',
420
-            'view_registration',
421
-            $registration->ID()
422
-        )
423
-            ? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__(
424
-                'View Registration Details',
425
-                'event_espresso'
426
-            ) . '">'
427
-              . $registration->reg_code()
428
-              . '</a>'
429
-            : $registration->reg_code();
430
-        // status
431
-        // $name_link               .= '<br><span class="ee-status-text-small">';
432
-        // $name_link               .= EEH_Template::pretty_status($registration->status_ID(), false, 'sentence');
433
-        // $name_link               .= '</span>';
434
-        $actions                 = [];
435
-        $DTT_ID                  = $this->_cur_dtt_id;
436
-        $latest_related_datetime =
437
-            empty($DTT_ID) && ! empty($this->_req_data['event_id'])
438
-                ? $registration->get_latest_related_datetime()
439
-                : null;
440
-        $DTT_ID                  = $latest_related_datetime instanceof EE_Datetime
441
-            ? $latest_related_datetime->ID()
442
-            : $DTT_ID;
443
-        if (
444
-            ! empty($DTT_ID)
445
-            && EE_Registry::instance()->CAP->current_user_can(
446
-                'ee_read_checkins',
447
-                'espresso_registrations_registration_checkins'
448
-            )
449
-        ) {
450
-            $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
451
-                ['action' => 'registration_checkins', '_REG_ID' => $registration->ID(), 'DTT_ID' => $DTT_ID],
452
-                REG_ADMIN_URL
453
-            );
454
-            // get the timestamps for this registration's checkins, related to the selected datetime
455
-            $timestamps = $registration->get_many_related('Checkin', [['DTT_ID' => $DTT_ID]]);
456
-            if (! empty($timestamps)) {
457
-                // get the last timestamp
458
-                $last_timestamp = end($timestamps);
459
-                // checked in or checked out?
460
-                $checkin_status = $last_timestamp->get('CHK_in')
461
-                    ? esc_html__('Checked In', 'event_espresso')
462
-                    : esc_html__('Checked Out', 'event_espresso');
463
-                // get timestamp string
464
-                $timestamp_string   = $last_timestamp->get_datetime('CHK_timestamp');
465
-                $actions['checkin'] = '<a class="ee-aria-tooltip" href="' . $checkin_list_url . '" aria-label="'
466
-                                      . esc_attr__(
467
-                                          'View this registrant\'s check-ins/checkouts for the datetime',
468
-                                          'event_espresso'
469
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
470
-            }
471
-        }
472
-        return (! empty($DTT_ID) && ! empty($timestamps))
473
-            ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
474
-            : $name_link;
475
-    }
476
-
477
-
478
-    /**
479
-     * @param EE_Registration $registration
480
-     * @return string
481
-     * @throws EE_Error
482
-     * @throws EE_Error
483
-     */
484
-    public function column_ATT_email(EE_Registration $registration): string
485
-    {
486
-        $attendee = $registration->attendee();
487
-        return $attendee instanceof EE_Attendee ? $attendee->email() : '';
488
-    }
489
-
490
-
491
-    /**
492
-     * @param EE_Registration $registration
493
-     * @return bool|string
494
-     * @throws EE_Error
495
-     * @throws ReflectionException
496
-     */
497
-    public function column_Event(EE_Registration $registration)
498
-    {
499
-        try {
500
-            $event            = $this->_evt instanceof EE_Event ? $this->_evt : $registration->event();
501
-            $checkin_link_url = EE_Admin_Page::add_query_args_and_nonce(
502
-                ['action' => 'event_registrations', 'event_id' => $event->ID()],
503
-                REG_ADMIN_URL
504
-            );
505
-            $event_label      = EE_Registry::instance()->CAP->current_user_can(
506
-                'ee_read_checkins',
507
-                'espresso_registrations_registration_checkins'
508
-            ) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="'
509
-                . esc_attr__(
510
-                    'View Checkins for this Event',
511
-                    'event_espresso'
512
-                ) . '">' . $event->name() . '</a>' : $event->name();
513
-        } catch (EntityNotFoundException $e) {
514
-            $event_label = esc_html__('Unknown', 'event_espresso');
515
-        }
516
-        return $event_label;
517
-    }
518
-
519
-
520
-    /**
521
-     * @param EE_Registration $registration
522
-     * @return string
523
-     * @throws EE_Error
524
-     * @throws ReflectionException
525
-     */
526
-    public function column_PRC_name(EE_Registration $registration): string
527
-    {
528
-        return $registration->ticket() instanceof EE_Ticket
529
-            ? $registration->ticket()->name()
530
-            : esc_html__(
531
-                "Unknown",
532
-                "event_espresso"
533
-            );
534
-    }
535
-
536
-
537
-    /**
538
-     * column_REG_final_price
539
-     *
540
-     * @param EE_Registration $registration
541
-     * @return string
542
-     * @throws EE_Error
543
-     */
544
-    public function column__REG_final_price(EE_Registration $registration): string
545
-    {
546
-        return '<span class="reg-pad-rght">' . ' ' . $registration->pretty_final_price() . '</span>';
547
-    }
548
-
549
-
550
-    /**
551
-     * column_TXN_paid
552
-     *
553
-     * @param EE_Registration $registration
554
-     * @return string
555
-     * @throws EE_Error
556
-     * @throws ReflectionException
557
-     */
558
-    public function column_TXN_paid(EE_Registration $registration): string
559
-    {
560
-        if ($registration->count() === 1) {
561
-            if ($registration->transaction()->paid() >= $registration->transaction()->total()) {
562
-                return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
563
-            } else {
564
-                $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
565
-                    ['action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()],
566
-                    TXN_ADMIN_URL
567
-                );
568
-                return EE_Registry::instance()->CAP->current_user_can(
569
-                    'ee_read_transaction',
570
-                    'espresso_transactions_view_transaction'
571
-                ) ? '
392
+		$name_link    .= EE_Registry::instance()->CAP->current_user_can(
393
+			'ee_edit_contacts',
394
+			'espresso_registrations_edit_attendee'
395
+		)
396
+			? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__(
397
+				'View Registration Details',
398
+				'event_espresso'
399
+			) . '">'
400
+			  . $registration->attendee()->full_name()
401
+			  . '</a>'
402
+			: $registration->attendee()->full_name();
403
+		$name_link    .= $registration->count() === 1
404
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup>	'
405
+			: '';
406
+		// add group details
407
+		$name_link .= '&nbsp;' . sprintf(
408
+			esc_html__('(%s of %s)', 'event_espresso'),
409
+			$registration->count(),
410
+			$registration->group_size()
411
+		);
412
+		// add regcode
413
+		$link      = EE_Admin_Page::add_query_args_and_nonce(
414
+			['action' => 'view_registration', '_REG_ID' => $registration->ID()],
415
+			REG_ADMIN_URL
416
+		);
417
+		$name_link .= '<br>';
418
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
419
+			'ee_read_registration',
420
+			'view_registration',
421
+			$registration->ID()
422
+		)
423
+			? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__(
424
+				'View Registration Details',
425
+				'event_espresso'
426
+			) . '">'
427
+			  . $registration->reg_code()
428
+			  . '</a>'
429
+			: $registration->reg_code();
430
+		// status
431
+		// $name_link               .= '<br><span class="ee-status-text-small">';
432
+		// $name_link               .= EEH_Template::pretty_status($registration->status_ID(), false, 'sentence');
433
+		// $name_link               .= '</span>';
434
+		$actions                 = [];
435
+		$DTT_ID                  = $this->_cur_dtt_id;
436
+		$latest_related_datetime =
437
+			empty($DTT_ID) && ! empty($this->_req_data['event_id'])
438
+				? $registration->get_latest_related_datetime()
439
+				: null;
440
+		$DTT_ID                  = $latest_related_datetime instanceof EE_Datetime
441
+			? $latest_related_datetime->ID()
442
+			: $DTT_ID;
443
+		if (
444
+			! empty($DTT_ID)
445
+			&& EE_Registry::instance()->CAP->current_user_can(
446
+				'ee_read_checkins',
447
+				'espresso_registrations_registration_checkins'
448
+			)
449
+		) {
450
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
451
+				['action' => 'registration_checkins', '_REG_ID' => $registration->ID(), 'DTT_ID' => $DTT_ID],
452
+				REG_ADMIN_URL
453
+			);
454
+			// get the timestamps for this registration's checkins, related to the selected datetime
455
+			$timestamps = $registration->get_many_related('Checkin', [['DTT_ID' => $DTT_ID]]);
456
+			if (! empty($timestamps)) {
457
+				// get the last timestamp
458
+				$last_timestamp = end($timestamps);
459
+				// checked in or checked out?
460
+				$checkin_status = $last_timestamp->get('CHK_in')
461
+					? esc_html__('Checked In', 'event_espresso')
462
+					: esc_html__('Checked Out', 'event_espresso');
463
+				// get timestamp string
464
+				$timestamp_string   = $last_timestamp->get_datetime('CHK_timestamp');
465
+				$actions['checkin'] = '<a class="ee-aria-tooltip" href="' . $checkin_list_url . '" aria-label="'
466
+									  . esc_attr__(
467
+										  'View this registrant\'s check-ins/checkouts for the datetime',
468
+										  'event_espresso'
469
+									  ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
470
+			}
471
+		}
472
+		return (! empty($DTT_ID) && ! empty($timestamps))
473
+			? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
474
+			: $name_link;
475
+	}
476
+
477
+
478
+	/**
479
+	 * @param EE_Registration $registration
480
+	 * @return string
481
+	 * @throws EE_Error
482
+	 * @throws EE_Error
483
+	 */
484
+	public function column_ATT_email(EE_Registration $registration): string
485
+	{
486
+		$attendee = $registration->attendee();
487
+		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
488
+	}
489
+
490
+
491
+	/**
492
+	 * @param EE_Registration $registration
493
+	 * @return bool|string
494
+	 * @throws EE_Error
495
+	 * @throws ReflectionException
496
+	 */
497
+	public function column_Event(EE_Registration $registration)
498
+	{
499
+		try {
500
+			$event            = $this->_evt instanceof EE_Event ? $this->_evt : $registration->event();
501
+			$checkin_link_url = EE_Admin_Page::add_query_args_and_nonce(
502
+				['action' => 'event_registrations', 'event_id' => $event->ID()],
503
+				REG_ADMIN_URL
504
+			);
505
+			$event_label      = EE_Registry::instance()->CAP->current_user_can(
506
+				'ee_read_checkins',
507
+				'espresso_registrations_registration_checkins'
508
+			) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="'
509
+				. esc_attr__(
510
+					'View Checkins for this Event',
511
+					'event_espresso'
512
+				) . '">' . $event->name() . '</a>' : $event->name();
513
+		} catch (EntityNotFoundException $e) {
514
+			$event_label = esc_html__('Unknown', 'event_espresso');
515
+		}
516
+		return $event_label;
517
+	}
518
+
519
+
520
+	/**
521
+	 * @param EE_Registration $registration
522
+	 * @return string
523
+	 * @throws EE_Error
524
+	 * @throws ReflectionException
525
+	 */
526
+	public function column_PRC_name(EE_Registration $registration): string
527
+	{
528
+		return $registration->ticket() instanceof EE_Ticket
529
+			? $registration->ticket()->name()
530
+			: esc_html__(
531
+				"Unknown",
532
+				"event_espresso"
533
+			);
534
+	}
535
+
536
+
537
+	/**
538
+	 * column_REG_final_price
539
+	 *
540
+	 * @param EE_Registration $registration
541
+	 * @return string
542
+	 * @throws EE_Error
543
+	 */
544
+	public function column__REG_final_price(EE_Registration $registration): string
545
+	{
546
+		return '<span class="reg-pad-rght">' . ' ' . $registration->pretty_final_price() . '</span>';
547
+	}
548
+
549
+
550
+	/**
551
+	 * column_TXN_paid
552
+	 *
553
+	 * @param EE_Registration $registration
554
+	 * @return string
555
+	 * @throws EE_Error
556
+	 * @throws ReflectionException
557
+	 */
558
+	public function column_TXN_paid(EE_Registration $registration): string
559
+	{
560
+		if ($registration->count() === 1) {
561
+			if ($registration->transaction()->paid() >= $registration->transaction()->total()) {
562
+				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
563
+			} else {
564
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
565
+					['action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()],
566
+					TXN_ADMIN_URL
567
+				);
568
+				return EE_Registry::instance()->CAP->current_user_can(
569
+					'ee_read_transaction',
570
+					'espresso_transactions_view_transaction'
571
+				) ? '
572 572
 				<span class="reg-pad-rght">
573 573
 					<a class="ee-aria-tooltip ee-status-color--'
574
-                    . $registration->transaction()->status_ID()
575
-                    . '" href="'
576
-                    . $view_txn_lnk_url
577
-                    . '"  aria-label="'
578
-                    . esc_attr__('View Transaction', 'event_espresso')
579
-                    . '">
574
+					. $registration->transaction()->status_ID()
575
+					. '" href="'
576
+					. $view_txn_lnk_url
577
+					. '"  aria-label="'
578
+					. esc_attr__('View Transaction', 'event_espresso')
579
+					. '">
580 580
 						'
581
-                    . $registration->transaction()->pretty_paid()
582
-                    . '
581
+					. $registration->transaction()->pretty_paid()
582
+					. '
583 583
 					</a>
584 584
 				<span>' : '<span class="reg-pad-rght">' . $registration->transaction()->pretty_paid() . '</span>';
585
-            }
586
-        } else {
587
-            return '<span class="reg-pad-rght"></span>';
588
-        }
589
-    }
590
-
591
-
592
-    /**
593
-     *        column_TXN_total
594
-     *
595
-     * @param EE_Registration $registration
596
-     * @return string
597
-     * @throws EE_Error
598
-     * @throws ReflectionException
599
-     */
600
-    public function column_TXN_total(EE_Registration $registration): string
601
-    {
602
-        $txn          = $registration->transaction();
603
-        $view_txn_url = add_query_arg(['action' => 'view_transaction', 'TXN_ID' => $txn->ID()], TXN_ADMIN_URL);
604
-        if ($registration->get('REG_count') === 1) {
605
-            $line_total_obj = $txn->total_line_item();
606
-            $txn_total      = $line_total_obj instanceof EE_Line_Item
607
-                ? $line_total_obj->get_pretty('LIN_total')
608
-                : esc_html__(
609
-                    'View Transaction',
610
-                    'event_espresso'
611
-                );
612
-            return EE_Registry::instance()->CAP->current_user_can(
613
-                'ee_read_transaction',
614
-                'espresso_transactions_view_transaction'
615
-            ) ? '<a class="ee-aria-tooltip" href="'
616
-                . $view_txn_url
617
-                . '" aria-label="'
618
-                . esc_attr__('View Transaction', 'event_espresso')
619
-                . '"><span class="reg-pad-rght">'
620
-                . $txn_total
621
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
622
-        } else {
623
-            return '<span class="reg-pad-rght"></span>';
624
-        }
625
-    }
585
+			}
586
+		} else {
587
+			return '<span class="reg-pad-rght"></span>';
588
+		}
589
+	}
590
+
591
+
592
+	/**
593
+	 *        column_TXN_total
594
+	 *
595
+	 * @param EE_Registration $registration
596
+	 * @return string
597
+	 * @throws EE_Error
598
+	 * @throws ReflectionException
599
+	 */
600
+	public function column_TXN_total(EE_Registration $registration): string
601
+	{
602
+		$txn          = $registration->transaction();
603
+		$view_txn_url = add_query_arg(['action' => 'view_transaction', 'TXN_ID' => $txn->ID()], TXN_ADMIN_URL);
604
+		if ($registration->get('REG_count') === 1) {
605
+			$line_total_obj = $txn->total_line_item();
606
+			$txn_total      = $line_total_obj instanceof EE_Line_Item
607
+				? $line_total_obj->get_pretty('LIN_total')
608
+				: esc_html__(
609
+					'View Transaction',
610
+					'event_espresso'
611
+				);
612
+			return EE_Registry::instance()->CAP->current_user_can(
613
+				'ee_read_transaction',
614
+				'espresso_transactions_view_transaction'
615
+			) ? '<a class="ee-aria-tooltip" href="'
616
+				. $view_txn_url
617
+				. '" aria-label="'
618
+				. esc_attr__('View Transaction', 'event_espresso')
619
+				. '"><span class="reg-pad-rght">'
620
+				. $txn_total
621
+				. '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
622
+		} else {
623
+			return '<span class="reg-pad-rght"></span>';
624
+		}
625
+	}
626 626
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             'TXN_total'           => esc_html__('Total', 'event_espresso'),
93 93
         ];
94 94
         // Add/remove columns when an event has been selected
95
-        if (! empty($evt_id)) {
95
+        if ( ! empty($evt_id)) {
96 96
             // Render a checkbox column
97 97
             $columns['cb']              = '<input type="checkbox" />';
98 98
             $this->_has_checkbox_column = true;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 'return_url'  => $return_url,
143 143
             ],
144 144
         ];
145
-        $this->_sortable_columns                  = [
145
+        $this->_sortable_columns = [
146 146
             /**
147 147
              * Allows users to change the default sort if they wish.
148 148
              * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
         if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
194 194
             // this means we don't have an event so let's setup a filter dropdown for all the events to select
195 195
             // note possible capability restrictions
196
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
196
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
197 197
                 $where['status**'] = ['!=', 'private'];
198 198
             }
199
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
199
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
200 200
                 $where['EVT_wp_user'] = get_current_user_id();
201 201
             }
202
-            $events   = EEM_Event::instance()->get_all(
202
+            $events = EEM_Event::instance()->get_all(
203 203
                 [
204 204
                     $where,
205 205
                     'order_by' => ['Datetime.DTT_EVT_start' => 'DESC'],
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
                 'id'   => 0,
210 210
                 'text' => esc_html__(' - select an event - ', 'event_espresso'),
211 211
             ];
212
-            $checked  = 'checked';
212
+            $checked = 'checked';
213 213
             /** @var EE_Event $event */
214 214
             foreach ($events as $event) {
215 215
                 // any registrations for this event?
216
-                if (! $event instanceof EE_Event || ! $event->get_count_of_all_registrations()) {
216
+                if ( ! $event instanceof EE_Event || ! $event->get_count_of_all_registrations()) {
217 217
                     continue;
218 218
                 }
219 219
                 $events[] = [
@@ -236,26 +236,26 @@  discard block
 block discarded – undo
236 236
             $event_filter .= EEH_Form_Fields::select_input('event_id', $events, $current_EVT_ID);
237 237
             $event_filter .= '<span class="ee-event-filter-toggle">';
238 238
             $event_filter .= '<label for="js-ee-hide-expired-events">';
239
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '>&nbsp;&nbsp;';
239
+            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'>&nbsp;&nbsp;';
240 240
             $event_filter .= esc_html__('Hide Expired Events', 'event_espresso');
241 241
             $event_filter .= '</label>';
242 242
             $event_filter .= '</span>';
243 243
             $event_filter .= '</div>';
244
-            $filters[]    = $event_filter;
244
+            $filters[] = $event_filter;
245 245
         }
246
-        if (! empty($this->_dtts_for_event)) {
246
+        if ( ! empty($this->_dtts_for_event)) {
247 247
             // DTT datetimes filter
248 248
             $this->_cur_dtt_id = $this->_req_data['DTT_ID'] ?? 0;
249 249
             if (count($this->_dtts_for_event) > 1) {
250 250
                 $datetimes[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso');
251 251
                 foreach ($this->_dtts_for_event as $datetime) {
252 252
                     $datetime_string              = $datetime->name();
253
-                    $datetime_string              = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
253
+                    $datetime_string              = ! empty($datetime_string) ? ' ('.$datetime_string.')' : '';
254 254
                     $datetime_string              =
255
-                        $datetime->start_date_and_time() . ' - ' . $datetime->end_date_and_time() . $datetime_string;
256
-                    $datetimes[ $datetime->ID() ] = $datetime_string;
255
+                        $datetime->start_date_and_time().' - '.$datetime->end_date_and_time().$datetime_string;
256
+                    $datetimes[$datetime->ID()] = $datetime_string;
257 257
                 }
258
-                $input     = new EE_Select_Input(
258
+                $input = new EE_Select_Input(
259 259
                     $datetimes,
260 260
                     [
261 261
                         'html_name' => 'DTT_ID',
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                     ]
265 265
                 );
266 266
                 $filters[] = $input->get_html_for_input();
267
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
267
+                $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">';
268 268
             }
269 269
         }
270 270
         return $filters;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         if ($DTT_ID) {
299 299
             $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
300 300
         }
301
-        $status_ids_array          = apply_filters(
301
+        $status_ids_array = apply_filters(
302 302
             'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
303 303
             [EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved]
304 304
         );
@@ -354,14 +354,14 @@  discard block
 block discarded – undo
354 354
                                    )
355 355
             ? ' clickable trigger-checkin'
356 356
             : '';
357
-        $mobile_view_content     = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
357
+        $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
358 358
         return '
359
-        <button class="button button--secondary button--icon-only ' . $toggle_active . '"
360
-                data-_regid="' . $registration->ID() . '"
361
-                data-dttid="' . $this->_cur_dtt_id . '"
362
-                data-nonce="' . $nonce . '"
359
+        <button class="button button--secondary button--icon-only ' . $toggle_active.'"
360
+                data-_regid="' . $registration->ID().'"
361
+                data-dttid="' . $this->_cur_dtt_id.'"
362
+                data-nonce="' . $nonce.'"
363 363
         >   
364
-            <span class="' . $checkin_status_dashicon->cssClasses() . '"></span>
364
+            <span class="' . $checkin_status_dashicon->cssClasses().'"></span>
365 365
         </button>
366 366
             '
367 367
                . $mobile_view_content;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     public function column_ATT_name(EE_Registration $registration): string
378 378
     {
379 379
         $attendee = $registration->attendee();
380
-        if (! $attendee instanceof EE_Attendee) {
380
+        if ( ! $attendee instanceof EE_Attendee) {
381 381
             return esc_html__('No contact record for this registration.', 'event_espresso');
382 382
         }
383 383
         // edit attendee link
@@ -385,32 +385,32 @@  discard block
 block discarded – undo
385 385
             ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
386 386
             REG_ADMIN_URL
387 387
         );
388
-        $name_link    = '
389
-            <span class="ee-status-dot ee-status-bg--' . esc_attr($registration->status_ID()) . ' ee-aria-tooltip"
390
-            aria-label="' . EEH_Template::pretty_status($registration->status_ID(), false, 'sentence') . '">
388
+        $name_link = '
389
+            <span class="ee-status-dot ee-status-bg--' . esc_attr($registration->status_ID()).' ee-aria-tooltip"
390
+            aria-label="' . EEH_Template::pretty_status($registration->status_ID(), false, 'sentence').'">
391 391
             </span>';
392
-        $name_link    .= EE_Registry::instance()->CAP->current_user_can(
392
+        $name_link .= EE_Registry::instance()->CAP->current_user_can(
393 393
             'ee_edit_contacts',
394 394
             'espresso_registrations_edit_attendee'
395 395
         )
396
-            ? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__(
396
+            ? '<a class="ee-aria-tooltip" href="'.$edit_lnk_url.'" aria-label="'.esc_attr__(
397 397
                 'View Registration Details',
398 398
                 'event_espresso'
399
-            ) . '">'
399
+            ).'">'
400 400
               . $registration->attendee()->full_name()
401 401
               . '</a>'
402 402
             : $registration->attendee()->full_name();
403
-        $name_link    .= $registration->count() === 1
403
+        $name_link .= $registration->count() === 1
404 404
             ? '&nbsp;<sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup>	'
405 405
             : '';
406 406
         // add group details
407
-        $name_link .= '&nbsp;' . sprintf(
407
+        $name_link .= '&nbsp;'.sprintf(
408 408
             esc_html__('(%s of %s)', 'event_espresso'),
409 409
             $registration->count(),
410 410
             $registration->group_size()
411 411
         );
412 412
         // add regcode
413
-        $link      = EE_Admin_Page::add_query_args_and_nonce(
413
+        $link = EE_Admin_Page::add_query_args_and_nonce(
414 414
             ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
415 415
             REG_ADMIN_URL
416 416
         );
@@ -420,10 +420,10 @@  discard block
 block discarded – undo
420 420
             'view_registration',
421 421
             $registration->ID()
422 422
         )
423
-            ? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__(
423
+            ? '<a class="ee-aria-tooltip" href="'.$link.'" aria-label="'.esc_attr__(
424 424
                 'View Registration Details',
425 425
                 'event_espresso'
426
-            ) . '">'
426
+            ).'">'
427 427
               . $registration->reg_code()
428 428
               . '</a>'
429 429
             : $registration->reg_code();
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
             empty($DTT_ID) && ! empty($this->_req_data['event_id'])
438 438
                 ? $registration->get_latest_related_datetime()
439 439
                 : null;
440
-        $DTT_ID                  = $latest_related_datetime instanceof EE_Datetime
440
+        $DTT_ID = $latest_related_datetime instanceof EE_Datetime
441 441
             ? $latest_related_datetime->ID()
442 442
             : $DTT_ID;
443 443
         if (
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
             );
454 454
             // get the timestamps for this registration's checkins, related to the selected datetime
455 455
             $timestamps = $registration->get_many_related('Checkin', [['DTT_ID' => $DTT_ID]]);
456
-            if (! empty($timestamps)) {
456
+            if ( ! empty($timestamps)) {
457 457
                 // get the last timestamp
458 458
                 $last_timestamp = end($timestamps);
459 459
                 // checked in or checked out?
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
                     : esc_html__('Checked Out', 'event_espresso');
463 463
                 // get timestamp string
464 464
                 $timestamp_string   = $last_timestamp->get_datetime('CHK_timestamp');
465
-                $actions['checkin'] = '<a class="ee-aria-tooltip" href="' . $checkin_list_url . '" aria-label="'
465
+                $actions['checkin'] = '<a class="ee-aria-tooltip" href="'.$checkin_list_url.'" aria-label="'
466 466
                                       . esc_attr__(
467 467
                                           'View this registrant\'s check-ins/checkouts for the datetime',
468 468
                                           'event_espresso'
469
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
469
+                                      ).'">'.$checkin_status.': '.$timestamp_string.'</a>';
470 470
             }
471 471
         }
472
-        return (! empty($DTT_ID) && ! empty($timestamps))
472
+        return ( ! empty($DTT_ID) && ! empty($timestamps))
473 473
             ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
474 474
             : $name_link;
475 475
     }
@@ -502,14 +502,14 @@  discard block
 block discarded – undo
502 502
                 ['action' => 'event_registrations', 'event_id' => $event->ID()],
503 503
                 REG_ADMIN_URL
504 504
             );
505
-            $event_label      = EE_Registry::instance()->CAP->current_user_can(
505
+            $event_label = EE_Registry::instance()->CAP->current_user_can(
506 506
                 'ee_read_checkins',
507 507
                 'espresso_registrations_registration_checkins'
508
-            ) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="'
508
+            ) ? '<a class="ee-aria-tooltip" href="'.$checkin_link_url.'" aria-label="'
509 509
                 . esc_attr__(
510 510
                     'View Checkins for this Event',
511 511
                     'event_espresso'
512
-                ) . '">' . $event->name() . '</a>' : $event->name();
512
+                ).'">'.$event->name().'</a>' : $event->name();
513 513
         } catch (EntityNotFoundException $e) {
514 514
             $event_label = esc_html__('Unknown', 'event_espresso');
515 515
         }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
      */
544 544
     public function column__REG_final_price(EE_Registration $registration): string
545 545
     {
546
-        return '<span class="reg-pad-rght">' . ' ' . $registration->pretty_final_price() . '</span>';
546
+        return '<span class="reg-pad-rght">'.' '.$registration->pretty_final_price().'</span>';
547 547
     }
548 548
 
549 549
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                     . $registration->transaction()->pretty_paid()
582 582
                     . '
583 583
 					</a>
584
-				<span>' : '<span class="reg-pad-rght">' . $registration->transaction()->pretty_paid() . '</span>';
584
+				<span>' : '<span class="reg-pad-rght">'.$registration->transaction()->pretty_paid().'</span>';
585 585
             }
586 586
         } else {
587 587
             return '<span class="reg-pad-rght"></span>';
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
                 . esc_attr__('View Transaction', 'event_espresso')
619 619
                 . '"><span class="reg-pad-rght">'
620 620
                 . $txn_total
621
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
621
+                . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
622 622
         } else {
623 623
             return '<span class="reg-pad-rght"></span>';
624 624
         }
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_List_Table.class.php 2 patches
Indentation   +571 added lines, -571 removed lines patch added patch discarded remove patch
@@ -14,177 +14,177 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class Events_Admin_List_Table extends EE_Admin_List_Table
16 16
 {
17
-    /**
18
-     * @var Events_Admin_Page
19
-     */
20
-    protected $_admin_page;
21
-
22
-    /**
23
-     * @var EE_Datetime
24
-     */
25
-    private $_dtt;
26
-
27
-
28
-    /**
29
-     * Initial setup of data properties for the list table.
30
-     *
31
-     * @throws Exception
32
-     */
33
-    protected function _setup_data()
34
-    {
35
-        $this->_data           = $this->_admin_page->get_events($this->_per_page, $this->_current_page);
36
-        $this->_all_data_count = $this->_admin_page->get_events(0, 0, true);
37
-    }
38
-
39
-
40
-    /**
41
-     * Set up of additional properties for the list table.
42
-     *
43
-     * @throws EE_Error
44
-     * @throws ReflectionException
45
-     */
46
-    protected function _set_properties()
47
-    {
48
-        $this->_wp_list_args    = [
49
-            'singular' => esc_html__('event', 'event_espresso'),
50
-            'plural'   => esc_html__('events', 'event_espresso'),
51
-            'ajax'     => true, // for now
52
-            'screen'   => $this->_admin_page->get_current_screen()->id,
53
-        ];
54
-        $approved_registrations = esc_html__('Approved Registrations', 'event_espresso');
55
-        $this->_columns         = [
56
-            'cb'              => '<input type="checkbox" />',
57
-            'id'              => esc_html__('ID', 'event_espresso'),
58
-            'name'            => esc_html__('Name', 'event_espresso'),
59
-            'author'          => esc_html__('Author', 'event_espresso'),
60
-            'venue'           => esc_html__('Venue', 'event_espresso'),
61
-            'start_date_time' => esc_html__('Event Start', 'event_espresso'),
62
-            'reg_begins'      => esc_html__('On Sale', 'event_espresso'),
63
-            'attendees'       => '
17
+	/**
18
+	 * @var Events_Admin_Page
19
+	 */
20
+	protected $_admin_page;
21
+
22
+	/**
23
+	 * @var EE_Datetime
24
+	 */
25
+	private $_dtt;
26
+
27
+
28
+	/**
29
+	 * Initial setup of data properties for the list table.
30
+	 *
31
+	 * @throws Exception
32
+	 */
33
+	protected function _setup_data()
34
+	{
35
+		$this->_data           = $this->_admin_page->get_events($this->_per_page, $this->_current_page);
36
+		$this->_all_data_count = $this->_admin_page->get_events(0, 0, true);
37
+	}
38
+
39
+
40
+	/**
41
+	 * Set up of additional properties for the list table.
42
+	 *
43
+	 * @throws EE_Error
44
+	 * @throws ReflectionException
45
+	 */
46
+	protected function _set_properties()
47
+	{
48
+		$this->_wp_list_args    = [
49
+			'singular' => esc_html__('event', 'event_espresso'),
50
+			'plural'   => esc_html__('events', 'event_espresso'),
51
+			'ajax'     => true, // for now
52
+			'screen'   => $this->_admin_page->get_current_screen()->id,
53
+		];
54
+		$approved_registrations = esc_html__('Approved Registrations', 'event_espresso');
55
+		$this->_columns         = [
56
+			'cb'              => '<input type="checkbox" />',
57
+			'id'              => esc_html__('ID', 'event_espresso'),
58
+			'name'            => esc_html__('Name', 'event_espresso'),
59
+			'author'          => esc_html__('Author', 'event_espresso'),
60
+			'venue'           => esc_html__('Venue', 'event_espresso'),
61
+			'start_date_time' => esc_html__('Event Start', 'event_espresso'),
62
+			'reg_begins'      => esc_html__('On Sale', 'event_espresso'),
63
+			'attendees'       => '
64 64
                 <span class="show-on-mobile-view-only" aria-label="' . $approved_registrations . '">
65 65
                     ' . $approved_registrations . '
66 66
                 </span>
67 67
                 <span class="dashicons dashicons-groups ee-icon-color-ee-green"></span>',
68
-            'actions'         => $this->actionsColumnHeader(),
69
-        ];
70
-        $this->addConditionalColumns();
71
-        $this->_sortable_columns = [
72
-            'id'              => ['EVT_ID' => true],
73
-            'name'            => ['EVT_name' => false],
74
-            'author'          => ['EVT_wp_user' => false],
75
-            'venue'           => ['Venue.VNU_name' => false],
76
-            'start_date_time' => ['Datetime.DTT_EVT_start' => false],
77
-            'reg_begins'      => ['Datetime.Ticket.TKT_start_date' => false],
78
-        ];
79
-
80
-        $this->_primary_column = 'id';
81
-        $this->_hidden_columns = ['author', 'event_category'];
82
-    }
83
-
84
-
85
-    /**
86
-     * @return array
87
-     */
88
-    protected function _get_table_filters(): array
89
-    {
90
-        return []; // no filters with decaf
91
-    }
92
-
93
-
94
-    /**
95
-     * Setup of views properties.
96
-     *
97
-     * @throws InvalidDataTypeException
98
-     * @throws InvalidInterfaceException
99
-     * @throws InvalidArgumentException
100
-     * @throws EE_Error
101
-     * @throws EE_Error
102
-     * @throws EE_Error
103
-     */
104
-    protected function _add_view_counts()
105
-    {
106
-        $this->_views['all']['count']   = $this->_admin_page->total_events();
107
-        $this->_views['draft']['count'] = $this->_admin_page->total_events_draft();
108
-        if (
109
-            EE_Registry::instance()->CAP->current_user_can(
110
-                'ee_delete_events',
111
-                'espresso_events_trash_events'
112
-            )
113
-        ) {
114
-            $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events();
115
-        }
116
-    }
117
-
118
-
119
-    /**
120
-     * @param EE_Event $item
121
-     * @return string
122
-     */
123
-    protected function _get_row_class($item): string
124
-    {
125
-        $class = parent::_get_row_class($item);
126
-        if ($this->_has_checkbox_column) {
127
-            $class .= ' has-checkbox-column';
128
-        }
129
-        return $class;
130
-    }
131
-
132
-
133
-    /**
134
-     * @param EE_Event $item
135
-     * @return string
136
-     * @throws EE_Error
137
-     * @throws ReflectionException
138
-     */
139
-    public function column_cb($item): string
140
-    {
141
-        if (! $item instanceof EE_Event) {
142
-            return '';
143
-        }
144
-        $this->_dtt = $item->primary_datetime(); // set this for use in other columns
145
-        $content    = sprintf(
146
-            '<input type="checkbox" name="EVT_IDs[]" value="%s" />',
147
-            $item->ID()
148
-        );
149
-        return $this->columnContent('cb', $content, 'center');
150
-    }
151
-
152
-
153
-    /**
154
-     * @param EE_Event $event
155
-     * @return string
156
-     * @throws EE_Error
157
-     * @throws ReflectionException
158
-     */
159
-    public function column_id(EE_Event $event): string
160
-    {
161
-        $content = $event->ID();
162
-        $content .= '<span class="show-on-mobile-view-only">';
163
-        $content .= $this->column_name($event, false);
164
-        $content .= '</span>';
165
-        return $this->columnContent('id', $content, 'end');
166
-    }
167
-
168
-
169
-    /**
170
-     * @param EE_Event $event
171
-     * @param bool     $prep_content
172
-     * @return string
173
-     * @throws EE_Error
174
-     * @throws ReflectionException
175
-     */
176
-    public function column_name(EE_Event $event, bool $prep_content = true): string
177
-    {
178
-        $edit_query_args = [
179
-            'action' => 'edit',
180
-            'post'   => $event->ID(),
181
-        ];
182
-        $edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
183
-        $actions         = $this->_column_name_action_setup($event);
184
-        $status          = esc_attr($event->get_active_status());
185
-        $pretty_status   = EEH_Template::pretty_status($status, false, 'sentence');
186
-        $status_dot      = '<span class="ee-status-dot ee-status-bg--' . $status . '"></span>';
187
-        $content         = '
68
+			'actions'         => $this->actionsColumnHeader(),
69
+		];
70
+		$this->addConditionalColumns();
71
+		$this->_sortable_columns = [
72
+			'id'              => ['EVT_ID' => true],
73
+			'name'            => ['EVT_name' => false],
74
+			'author'          => ['EVT_wp_user' => false],
75
+			'venue'           => ['Venue.VNU_name' => false],
76
+			'start_date_time' => ['Datetime.DTT_EVT_start' => false],
77
+			'reg_begins'      => ['Datetime.Ticket.TKT_start_date' => false],
78
+		];
79
+
80
+		$this->_primary_column = 'id';
81
+		$this->_hidden_columns = ['author', 'event_category'];
82
+	}
83
+
84
+
85
+	/**
86
+	 * @return array
87
+	 */
88
+	protected function _get_table_filters(): array
89
+	{
90
+		return []; // no filters with decaf
91
+	}
92
+
93
+
94
+	/**
95
+	 * Setup of views properties.
96
+	 *
97
+	 * @throws InvalidDataTypeException
98
+	 * @throws InvalidInterfaceException
99
+	 * @throws InvalidArgumentException
100
+	 * @throws EE_Error
101
+	 * @throws EE_Error
102
+	 * @throws EE_Error
103
+	 */
104
+	protected function _add_view_counts()
105
+	{
106
+		$this->_views['all']['count']   = $this->_admin_page->total_events();
107
+		$this->_views['draft']['count'] = $this->_admin_page->total_events_draft();
108
+		if (
109
+			EE_Registry::instance()->CAP->current_user_can(
110
+				'ee_delete_events',
111
+				'espresso_events_trash_events'
112
+			)
113
+		) {
114
+			$this->_views['trash']['count'] = $this->_admin_page->total_trashed_events();
115
+		}
116
+	}
117
+
118
+
119
+	/**
120
+	 * @param EE_Event $item
121
+	 * @return string
122
+	 */
123
+	protected function _get_row_class($item): string
124
+	{
125
+		$class = parent::_get_row_class($item);
126
+		if ($this->_has_checkbox_column) {
127
+			$class .= ' has-checkbox-column';
128
+		}
129
+		return $class;
130
+	}
131
+
132
+
133
+	/**
134
+	 * @param EE_Event $item
135
+	 * @return string
136
+	 * @throws EE_Error
137
+	 * @throws ReflectionException
138
+	 */
139
+	public function column_cb($item): string
140
+	{
141
+		if (! $item instanceof EE_Event) {
142
+			return '';
143
+		}
144
+		$this->_dtt = $item->primary_datetime(); // set this for use in other columns
145
+		$content    = sprintf(
146
+			'<input type="checkbox" name="EVT_IDs[]" value="%s" />',
147
+			$item->ID()
148
+		);
149
+		return $this->columnContent('cb', $content, 'center');
150
+	}
151
+
152
+
153
+	/**
154
+	 * @param EE_Event $event
155
+	 * @return string
156
+	 * @throws EE_Error
157
+	 * @throws ReflectionException
158
+	 */
159
+	public function column_id(EE_Event $event): string
160
+	{
161
+		$content = $event->ID();
162
+		$content .= '<span class="show-on-mobile-view-only">';
163
+		$content .= $this->column_name($event, false);
164
+		$content .= '</span>';
165
+		return $this->columnContent('id', $content, 'end');
166
+	}
167
+
168
+
169
+	/**
170
+	 * @param EE_Event $event
171
+	 * @param bool     $prep_content
172
+	 * @return string
173
+	 * @throws EE_Error
174
+	 * @throws ReflectionException
175
+	 */
176
+	public function column_name(EE_Event $event, bool $prep_content = true): string
177
+	{
178
+		$edit_query_args = [
179
+			'action' => 'edit',
180
+			'post'   => $event->ID(),
181
+		];
182
+		$edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
183
+		$actions         = $this->_column_name_action_setup($event);
184
+		$status          = esc_attr($event->get_active_status());
185
+		$pretty_status   = EEH_Template::pretty_status($status, false, 'sentence');
186
+		$status_dot      = '<span class="ee-status-dot ee-status-bg--' . $status . '"></span>';
187
+		$content         = '
188 188
             <div class="ee-layout-row ee-layout-row--fixed">
189 189
                 <a  class="row-title ee-status-color--' . $status . ' ee-aria-tooltip" 
190 190
                     aria-label="' . $pretty_status . '" 
@@ -194,409 +194,409 @@  discard block
 block discarded – undo
194 194
                 </a>
195 195
             </div>';
196 196
 
197
-        $content .= $this->row_actions($actions);
198
-
199
-        return $prep_content ? $this->columnContent('name', $content) : $content;
200
-    }
201
-
202
-
203
-    /**
204
-     * Just a method for setting up the actions for the name column
205
-     *
206
-     * @param EE_Event $event
207
-     * @return array array of actions
208
-     * @throws EE_Error
209
-     * @throws InvalidArgumentException
210
-     * @throws InvalidDataTypeException
211
-     * @throws InvalidInterfaceException
212
-     * @throws ReflectionException
213
-     */
214
-    protected function _column_name_action_setup(EE_Event $event): array
215
-    {
216
-        // todo: remove when attendees is active
217
-        if (! defined('REG_ADMIN_URL')) {
218
-            define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
219
-        }
220
-        $actions            = [];
221
-        $restore_event_link = '';
222
-        $delete_event_link  = '';
223
-        $trash_event_link   = '';
224
-        if (
225
-            EE_Registry::instance()->CAP->current_user_can(
226
-                'ee_edit_event',
227
-                'espresso_events_edit',
228
-                $event->ID()
229
-            )
230
-        ) {
231
-            $edit_query_args = [
232
-                'action' => 'edit',
233
-                'post'   => $event->ID(),
234
-            ];
235
-            $edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
236
-            $actions['edit'] = '<a href="' . $edit_link . '" class="ee-aria-tooltip" '
237
-                               . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">'
238
-                               . esc_html__('Edit', 'event_espresso')
239
-                               . '</a>';
240
-        }
241
-        if (
242
-            EE_Registry::instance()->CAP->current_user_can(
243
-                'ee_read_registrations',
244
-                'espresso_registrations_view_registration'
245
-            )
246
-            && EE_Registry::instance()->CAP->current_user_can(
247
-                'ee_read_event',
248
-                'espresso_registrations_view_registration',
249
-                $event->ID()
250
-            )
251
-        ) {
252
-            $attendees_query_args = [
253
-                'action'   => 'default',
254
-                'event_id' => $event->ID(),
255
-            ];
256
-            $attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
257
-            $actions['attendees'] = '<a href="' . $attendees_link . '" class="ee-aria-tooltip"'
258
-                                    . ' aria-label="' . esc_attr__('View Registrations', 'event_espresso') . '">'
259
-                                    . esc_html__('Registrations', 'event_espresso')
260
-                                    . '</a>';
261
-        }
262
-        if (
263
-            EE_Registry::instance()->CAP->current_user_can(
264
-                'ee_delete_event',
265
-                'espresso_events_trash_event',
266
-                $event->ID()
267
-            )
268
-        ) {
269
-            $trash_event_query_args = [
270
-                'action' => 'trash_event',
271
-                'EVT_ID' => $event->ID(),
272
-            ];
273
-            $trash_event_link       = EE_Admin_Page::add_query_args_and_nonce(
274
-                $trash_event_query_args,
275
-                EVENTS_ADMIN_URL
276
-            );
277
-        }
278
-        if (
279
-            EE_Registry::instance()->CAP->current_user_can(
280
-                'ee_delete_event',
281
-                'espresso_events_restore_event',
282
-                $event->ID()
283
-            )
284
-        ) {
285
-            $restore_event_query_args = [
286
-                'action' => 'restore_event',
287
-                'EVT_ID' => $event->ID(),
288
-            ];
289
-            $restore_event_link       = EE_Admin_Page::add_query_args_and_nonce(
290
-                $restore_event_query_args,
291
-                EVENTS_ADMIN_URL
292
-            );
293
-        }
294
-        if (
295
-            EE_Registry::instance()->CAP->current_user_can(
296
-                'ee_delete_event',
297
-                'espresso_events_delete_event',
298
-                $event->ID()
299
-            )
300
-        ) {
301
-            $delete_event_query_args = [
302
-                'action' => 'delete_event',
303
-                'EVT_ID' => $event->ID(),
304
-            ];
305
-            $delete_event_link       = EE_Admin_Page::add_query_args_and_nonce(
306
-                $delete_event_query_args,
307
-                EVENTS_ADMIN_URL
308
-            );
309
-        }
310
-        $view_link       = get_permalink($event->ID());
311
-        $actions['view'] = '<a href="' . $view_link . '" class="ee-aria-tooltip"'
312
-                           . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '">'
313
-                           . esc_html__('View', 'event_espresso')
314
-                           . '</a>';
315
-        if ($event->get('status') === 'trash') {
316
-            if (
317
-                EE_Registry::instance()->CAP->current_user_can(
318
-                    'ee_delete_event',
319
-                    'espresso_events_restore_event',
320
-                    $event->ID()
321
-                )
322
-            ) {
323
-                $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" class="ee-aria-tooltip"'
324
-                                                 . ' aria-label="' . esc_attr__('Restore from Trash', 'event_espresso')
325
-                                                 . '">'
326
-                                                 . esc_html__('Restore from Trash', 'event_espresso')
327
-                                                 . '</a>';
328
-            }
329
-            if (
330
-                EE_Registry::instance()->CAP->current_user_can(
331
-                    'ee_delete_event',
332
-                    'espresso_events_delete_event',
333
-                    $event->ID()
334
-                )
335
-            ) {
336
-                $actions['delete'] = '<a href="' . $delete_event_link . '" class="ee-aria-tooltip"'
337
-                                     . ' aria-label="' . esc_attr__('Delete Permanently', 'event_espresso') . '">'
338
-                                     . esc_html__('Delete Permanently', 'event_espresso')
339
-                                     . '</a>';
340
-            }
341
-        } else {
342
-            if (
343
-                EE_Registry::instance()->CAP->current_user_can(
344
-                    'ee_delete_event',
345
-                    'espresso_events_trash_event',
346
-                    $event->ID()
347
-                )
348
-            ) {
349
-                $actions['move to trash'] = '<a href="' . $trash_event_link . '" class="ee-aria-tooltip"'
350
-                                            . ' aria-label="' . esc_attr__('Trash Event', 'event_espresso') . '">'
351
-                                            . esc_html__('Trash', 'event_espresso')
352
-                                            . '</a>';
353
-            }
354
-        }
355
-        return $actions;
356
-    }
357
-
358
-
359
-    /**
360
-     * @param EE_Event $event
361
-     * @return string
362
-     * @throws EE_Error
363
-     * @throws ReflectionException
364
-     */
365
-    public function column_author(EE_Event $event): string
366
-    {
367
-        // user author info
368
-        $event_author = get_userdata($event->wp_user());
369
-        $gravatar     = get_avatar($event->wp_user(), '24');
370
-        // filter link
371
-        $query_args = [
372
-            'action'      => 'default',
373
-            'EVT_wp_user' => $event->wp_user(),
374
-        ];
375
-        $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL);
376
-        $content    = '<div class="ee-layout-row ee-layout-row--fixed">';
377
-        $content    .= $gravatar . '  <a href="' . $filter_url . '" class="ee-aria-tooltip"'
378
-                       . ' aria-label="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">'
379
-                       . $event_author->display_name
380
-                       . '</a>';
381
-        $content    .= '</div>';
382
-        return $this->columnContent('author', $content);
383
-    }
384
-
385
-
386
-    /**
387
-     * @param EE_Event $event
388
-     * @return string
389
-     * @throws EE_Error
390
-     * @throws ReflectionException
391
-     */
392
-    public function column_event_category(EE_Event $event): string
393
-    {
394
-        $event_categories = $event->get_all_event_categories();
395
-        $content          = implode(
396
-            ', ',
397
-            array_map(
398
-                function (EE_Term $category) {
399
-                    return $category->name();
400
-                },
401
-                $event_categories
402
-            )
403
-        );
404
-        return $this->columnContent('event_category', $content);
405
-    }
406
-
407
-
408
-    /**
409
-     * @param EE_Event $event
410
-     * @return string
411
-     * @throws EE_Error
412
-     * @throws ReflectionException
413
-     */
414
-    public function column_venue(EE_Event $event): string
415
-    {
416
-        $venue   = $event->get_first_related('Venue');
417
-        $content = ! empty($venue)
418
-            ? $venue->name()
419
-            : '';
420
-        return $this->columnContent('venue', $content);
421
-    }
422
-
423
-
424
-    /**
425
-     * @param EE_Event $event
426
-     * @return string
427
-     * @throws EE_Error
428
-     * @throws ReflectionException
429
-     */
430
-    public function column_start_date_time(EE_Event $event): string
431
-    {
432
-        $content = $this->_dtt instanceof EE_Datetime
433
-            ? $this->_dtt->get_i18n_datetime('DTT_EVT_start')
434
-            : esc_html__('No Date was saved for this Event', 'event_espresso');
435
-        return $this->columnContent('start_date_time', $content);
436
-    }
437
-
438
-
439
-    /**
440
-     * @param EE_Event $event
441
-     * @return string
442
-     * @throws EE_Error
443
-     * @throws ReflectionException
444
-     */
445
-    public function column_reg_begins(EE_Event $event): string
446
-    {
447
-        $reg_start = $event->get_ticket_with_earliest_start_time();
448
-        $content   = $reg_start instanceof EE_Ticket
449
-            ? $reg_start->get_i18n_datetime('TKT_start_date')
450
-            : esc_html__('No Tickets have been setup for this Event', 'event_espresso');
451
-        return $this->columnContent('reg_begins', $content);
452
-    }
453
-
454
-
455
-    /**
456
-     * @param EE_Event $event
457
-     * @return string
458
-     * @throws EE_Error
459
-     * @throws InvalidArgumentException
460
-     * @throws InvalidDataTypeException
461
-     * @throws InvalidInterfaceException
462
-     * @throws ReflectionException
463
-     */
464
-    public function column_attendees(EE_Event $event): string
465
-    {
466
-        $attendees_query_args = [
467
-            'action'   => 'default',
468
-            'event_id' => $event->ID(),
469
-        ];
470
-        $attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
471
-        $registered_attendees = EEM_Registration::instance()->get_event_registration_count($event->ID());
472
-
473
-        $content              = EE_Registry::instance()->CAP->current_user_can(
474
-            'ee_read_event',
475
-            'espresso_registrations_view_registration',
476
-            $event->ID()
477
-        ) && EE_Registry::instance()->CAP->current_user_can(
478
-            'ee_read_registrations',
479
-            'espresso_registrations_view_registration'
480
-        )
481
-            ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>'
482
-            : $registered_attendees;
483
-        return $this->columnContent('attendees', $content, 'center');
484
-    }
485
-
486
-
487
-    /**
488
-     * @param EE_Event $event
489
-     * @return float
490
-     * @throws EE_Error
491
-     * @throws InvalidArgumentException
492
-     * @throws InvalidDataTypeException
493
-     * @throws InvalidInterfaceException
494
-     * @throws ReflectionException
495
-     */
496
-    public function column_tkts_sold(EE_Event $event): float
497
-    {
498
-        $content = EEM_Ticket::instance()->sum([['Datetime.EVT_ID' => $event->ID()]], 'TKT_sold');
499
-        return $this->columnContent('tkts_sold', $content);
500
-    }
501
-
502
-
503
-    /**
504
-     * @param EE_Event $event
505
-     * @return string
506
-     * @throws EE_Error
507
-     * @throws InvalidArgumentException
508
-     * @throws InvalidDataTypeException
509
-     * @throws InvalidInterfaceException
510
-     * @throws ReflectionException
511
-     */
512
-    public function column_actions(EE_Event $event): string
513
-    {
514
-        // todo: remove when attendees is active
515
-        if (! defined('REG_ADMIN_URL')) {
516
-            define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
517
-        }
518
-        $action_links   = [];
519
-        $view_link      = get_permalink($event->ID());
520
-        $action_links[] = '<a href="' . $view_link . '" class="ee-aria-tooltip button button--icon-only"'
521
-                          . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">
197
+		$content .= $this->row_actions($actions);
198
+
199
+		return $prep_content ? $this->columnContent('name', $content) : $content;
200
+	}
201
+
202
+
203
+	/**
204
+	 * Just a method for setting up the actions for the name column
205
+	 *
206
+	 * @param EE_Event $event
207
+	 * @return array array of actions
208
+	 * @throws EE_Error
209
+	 * @throws InvalidArgumentException
210
+	 * @throws InvalidDataTypeException
211
+	 * @throws InvalidInterfaceException
212
+	 * @throws ReflectionException
213
+	 */
214
+	protected function _column_name_action_setup(EE_Event $event): array
215
+	{
216
+		// todo: remove when attendees is active
217
+		if (! defined('REG_ADMIN_URL')) {
218
+			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
219
+		}
220
+		$actions            = [];
221
+		$restore_event_link = '';
222
+		$delete_event_link  = '';
223
+		$trash_event_link   = '';
224
+		if (
225
+			EE_Registry::instance()->CAP->current_user_can(
226
+				'ee_edit_event',
227
+				'espresso_events_edit',
228
+				$event->ID()
229
+			)
230
+		) {
231
+			$edit_query_args = [
232
+				'action' => 'edit',
233
+				'post'   => $event->ID(),
234
+			];
235
+			$edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
236
+			$actions['edit'] = '<a href="' . $edit_link . '" class="ee-aria-tooltip" '
237
+							   . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">'
238
+							   . esc_html__('Edit', 'event_espresso')
239
+							   . '</a>';
240
+		}
241
+		if (
242
+			EE_Registry::instance()->CAP->current_user_can(
243
+				'ee_read_registrations',
244
+				'espresso_registrations_view_registration'
245
+			)
246
+			&& EE_Registry::instance()->CAP->current_user_can(
247
+				'ee_read_event',
248
+				'espresso_registrations_view_registration',
249
+				$event->ID()
250
+			)
251
+		) {
252
+			$attendees_query_args = [
253
+				'action'   => 'default',
254
+				'event_id' => $event->ID(),
255
+			];
256
+			$attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
257
+			$actions['attendees'] = '<a href="' . $attendees_link . '" class="ee-aria-tooltip"'
258
+									. ' aria-label="' . esc_attr__('View Registrations', 'event_espresso') . '">'
259
+									. esc_html__('Registrations', 'event_espresso')
260
+									. '</a>';
261
+		}
262
+		if (
263
+			EE_Registry::instance()->CAP->current_user_can(
264
+				'ee_delete_event',
265
+				'espresso_events_trash_event',
266
+				$event->ID()
267
+			)
268
+		) {
269
+			$trash_event_query_args = [
270
+				'action' => 'trash_event',
271
+				'EVT_ID' => $event->ID(),
272
+			];
273
+			$trash_event_link       = EE_Admin_Page::add_query_args_and_nonce(
274
+				$trash_event_query_args,
275
+				EVENTS_ADMIN_URL
276
+			);
277
+		}
278
+		if (
279
+			EE_Registry::instance()->CAP->current_user_can(
280
+				'ee_delete_event',
281
+				'espresso_events_restore_event',
282
+				$event->ID()
283
+			)
284
+		) {
285
+			$restore_event_query_args = [
286
+				'action' => 'restore_event',
287
+				'EVT_ID' => $event->ID(),
288
+			];
289
+			$restore_event_link       = EE_Admin_Page::add_query_args_and_nonce(
290
+				$restore_event_query_args,
291
+				EVENTS_ADMIN_URL
292
+			);
293
+		}
294
+		if (
295
+			EE_Registry::instance()->CAP->current_user_can(
296
+				'ee_delete_event',
297
+				'espresso_events_delete_event',
298
+				$event->ID()
299
+			)
300
+		) {
301
+			$delete_event_query_args = [
302
+				'action' => 'delete_event',
303
+				'EVT_ID' => $event->ID(),
304
+			];
305
+			$delete_event_link       = EE_Admin_Page::add_query_args_and_nonce(
306
+				$delete_event_query_args,
307
+				EVENTS_ADMIN_URL
308
+			);
309
+		}
310
+		$view_link       = get_permalink($event->ID());
311
+		$actions['view'] = '<a href="' . $view_link . '" class="ee-aria-tooltip"'
312
+						   . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '">'
313
+						   . esc_html__('View', 'event_espresso')
314
+						   . '</a>';
315
+		if ($event->get('status') === 'trash') {
316
+			if (
317
+				EE_Registry::instance()->CAP->current_user_can(
318
+					'ee_delete_event',
319
+					'espresso_events_restore_event',
320
+					$event->ID()
321
+				)
322
+			) {
323
+				$actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" class="ee-aria-tooltip"'
324
+												 . ' aria-label="' . esc_attr__('Restore from Trash', 'event_espresso')
325
+												 . '">'
326
+												 . esc_html__('Restore from Trash', 'event_espresso')
327
+												 . '</a>';
328
+			}
329
+			if (
330
+				EE_Registry::instance()->CAP->current_user_can(
331
+					'ee_delete_event',
332
+					'espresso_events_delete_event',
333
+					$event->ID()
334
+				)
335
+			) {
336
+				$actions['delete'] = '<a href="' . $delete_event_link . '" class="ee-aria-tooltip"'
337
+									 . ' aria-label="' . esc_attr__('Delete Permanently', 'event_espresso') . '">'
338
+									 . esc_html__('Delete Permanently', 'event_espresso')
339
+									 . '</a>';
340
+			}
341
+		} else {
342
+			if (
343
+				EE_Registry::instance()->CAP->current_user_can(
344
+					'ee_delete_event',
345
+					'espresso_events_trash_event',
346
+					$event->ID()
347
+				)
348
+			) {
349
+				$actions['move to trash'] = '<a href="' . $trash_event_link . '" class="ee-aria-tooltip"'
350
+											. ' aria-label="' . esc_attr__('Trash Event', 'event_espresso') . '">'
351
+											. esc_html__('Trash', 'event_espresso')
352
+											. '</a>';
353
+			}
354
+		}
355
+		return $actions;
356
+	}
357
+
358
+
359
+	/**
360
+	 * @param EE_Event $event
361
+	 * @return string
362
+	 * @throws EE_Error
363
+	 * @throws ReflectionException
364
+	 */
365
+	public function column_author(EE_Event $event): string
366
+	{
367
+		// user author info
368
+		$event_author = get_userdata($event->wp_user());
369
+		$gravatar     = get_avatar($event->wp_user(), '24');
370
+		// filter link
371
+		$query_args = [
372
+			'action'      => 'default',
373
+			'EVT_wp_user' => $event->wp_user(),
374
+		];
375
+		$filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL);
376
+		$content    = '<div class="ee-layout-row ee-layout-row--fixed">';
377
+		$content    .= $gravatar . '  <a href="' . $filter_url . '" class="ee-aria-tooltip"'
378
+					   . ' aria-label="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">'
379
+					   . $event_author->display_name
380
+					   . '</a>';
381
+		$content    .= '</div>';
382
+		return $this->columnContent('author', $content);
383
+	}
384
+
385
+
386
+	/**
387
+	 * @param EE_Event $event
388
+	 * @return string
389
+	 * @throws EE_Error
390
+	 * @throws ReflectionException
391
+	 */
392
+	public function column_event_category(EE_Event $event): string
393
+	{
394
+		$event_categories = $event->get_all_event_categories();
395
+		$content          = implode(
396
+			', ',
397
+			array_map(
398
+				function (EE_Term $category) {
399
+					return $category->name();
400
+				},
401
+				$event_categories
402
+			)
403
+		);
404
+		return $this->columnContent('event_category', $content);
405
+	}
406
+
407
+
408
+	/**
409
+	 * @param EE_Event $event
410
+	 * @return string
411
+	 * @throws EE_Error
412
+	 * @throws ReflectionException
413
+	 */
414
+	public function column_venue(EE_Event $event): string
415
+	{
416
+		$venue   = $event->get_first_related('Venue');
417
+		$content = ! empty($venue)
418
+			? $venue->name()
419
+			: '';
420
+		return $this->columnContent('venue', $content);
421
+	}
422
+
423
+
424
+	/**
425
+	 * @param EE_Event $event
426
+	 * @return string
427
+	 * @throws EE_Error
428
+	 * @throws ReflectionException
429
+	 */
430
+	public function column_start_date_time(EE_Event $event): string
431
+	{
432
+		$content = $this->_dtt instanceof EE_Datetime
433
+			? $this->_dtt->get_i18n_datetime('DTT_EVT_start')
434
+			: esc_html__('No Date was saved for this Event', 'event_espresso');
435
+		return $this->columnContent('start_date_time', $content);
436
+	}
437
+
438
+
439
+	/**
440
+	 * @param EE_Event $event
441
+	 * @return string
442
+	 * @throws EE_Error
443
+	 * @throws ReflectionException
444
+	 */
445
+	public function column_reg_begins(EE_Event $event): string
446
+	{
447
+		$reg_start = $event->get_ticket_with_earliest_start_time();
448
+		$content   = $reg_start instanceof EE_Ticket
449
+			? $reg_start->get_i18n_datetime('TKT_start_date')
450
+			: esc_html__('No Tickets have been setup for this Event', 'event_espresso');
451
+		return $this->columnContent('reg_begins', $content);
452
+	}
453
+
454
+
455
+	/**
456
+	 * @param EE_Event $event
457
+	 * @return string
458
+	 * @throws EE_Error
459
+	 * @throws InvalidArgumentException
460
+	 * @throws InvalidDataTypeException
461
+	 * @throws InvalidInterfaceException
462
+	 * @throws ReflectionException
463
+	 */
464
+	public function column_attendees(EE_Event $event): string
465
+	{
466
+		$attendees_query_args = [
467
+			'action'   => 'default',
468
+			'event_id' => $event->ID(),
469
+		];
470
+		$attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
471
+		$registered_attendees = EEM_Registration::instance()->get_event_registration_count($event->ID());
472
+
473
+		$content              = EE_Registry::instance()->CAP->current_user_can(
474
+			'ee_read_event',
475
+			'espresso_registrations_view_registration',
476
+			$event->ID()
477
+		) && EE_Registry::instance()->CAP->current_user_can(
478
+			'ee_read_registrations',
479
+			'espresso_registrations_view_registration'
480
+		)
481
+			? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>'
482
+			: $registered_attendees;
483
+		return $this->columnContent('attendees', $content, 'center');
484
+	}
485
+
486
+
487
+	/**
488
+	 * @param EE_Event $event
489
+	 * @return float
490
+	 * @throws EE_Error
491
+	 * @throws InvalidArgumentException
492
+	 * @throws InvalidDataTypeException
493
+	 * @throws InvalidInterfaceException
494
+	 * @throws ReflectionException
495
+	 */
496
+	public function column_tkts_sold(EE_Event $event): float
497
+	{
498
+		$content = EEM_Ticket::instance()->sum([['Datetime.EVT_ID' => $event->ID()]], 'TKT_sold');
499
+		return $this->columnContent('tkts_sold', $content);
500
+	}
501
+
502
+
503
+	/**
504
+	 * @param EE_Event $event
505
+	 * @return string
506
+	 * @throws EE_Error
507
+	 * @throws InvalidArgumentException
508
+	 * @throws InvalidDataTypeException
509
+	 * @throws InvalidInterfaceException
510
+	 * @throws ReflectionException
511
+	 */
512
+	public function column_actions(EE_Event $event): string
513
+	{
514
+		// todo: remove when attendees is active
515
+		if (! defined('REG_ADMIN_URL')) {
516
+			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
517
+		}
518
+		$action_links   = [];
519
+		$view_link      = get_permalink($event->ID());
520
+		$action_links[] = '<a href="' . $view_link . '" class="ee-aria-tooltip button button--icon-only"'
521
+						  . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">
522 522
                           <span class="dashicons dashicons-visibility"></span></a>';
523
-        if (
524
-            EE_Registry::instance()->CAP->current_user_can(
525
-                'ee_edit_event',
526
-                'espresso_events_edit',
527
-                $event->ID()
528
-            )
529
-        ) {
530
-            $edit_query_args = [
531
-                'action' => 'edit',
532
-                'post'   => $event->ID(),
533
-            ];
534
-            $edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
535
-            $action_links[]  = '<a href="' . $edit_link . '" class="ee-aria-tooltip button button--icon-only"'
536
-                               . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">'
537
-                               . '<span class="dashicons dashicons-calendar-alt"></span>'
538
-                               . '</a>';
539
-        }
540
-        if (
541
-            EE_Registry::instance()->CAP->current_user_can(
542
-                'ee_read_registrations',
543
-                'espresso_registrations_view_registration'
544
-            )
545
-            && EE_Registry::instance()->CAP->current_user_can(
546
-                'ee_read_event',
547
-                'espresso_registrations_view_registration',
548
-                $event->ID()
549
-            )
550
-        ) {
551
-            $attendees_query_args = [
552
-                'action'   => 'default',
553
-                'event_id' => $event->ID(),
554
-            ];
555
-            $attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
556
-            $action_links[]       = '<a href="' . $attendees_link . '" class="ee-aria-tooltip button button--icon-only"'
557
-                                    . ' aria-label="' . esc_attr__('View Registrants', 'event_espresso') . '">'
558
-                                    . '<span class="dashicons dashicons-groups"></span>'
559
-                                    . '</a>';
560
-        }
561
-        $action_links = apply_filters(
562
-            'FHEE__Events_Admin_List_Table__column_actions__action_links',
563
-            $action_links,
564
-            $event
565
-        );
566
-        $content      = $this->_action_string(
567
-            implode("\n\t", $action_links),
568
-            $event,
569
-            'div',
570
-            'event-overview-actions ee-list-table-actions'
571
-        );
572
-        return $this->columnContent('actions', $this->actionsModalMenu($content));
573
-    }
574
-
575
-
576
-    /**
577
-     * Helper for adding columns conditionally
578
-     *
579
-     * @throws EE_Error
580
-     * @throws InvalidArgumentException
581
-     * @throws InvalidDataTypeException
582
-     * @throws InvalidInterfaceException
583
-     * @throws ReflectionException
584
-     */
585
-    private function addConditionalColumns()
586
-    {
587
-        $event_category_count = EEM_Term::instance()->count(
588
-            [['Term_Taxonomy.taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY]]
589
-        );
590
-        if ($event_category_count === 0) {
591
-            return;
592
-        }
593
-        $column_array = [];
594
-        foreach ($this->_columns as $column => $column_label) {
595
-            $column_array[ $column ] = $column_label;
596
-            if ($column === 'venue') {
597
-                $column_array['event_category'] = esc_html__('Event Category', 'event_espresso');
598
-            }
599
-        }
600
-        $this->_columns = $column_array;
601
-    }
523
+		if (
524
+			EE_Registry::instance()->CAP->current_user_can(
525
+				'ee_edit_event',
526
+				'espresso_events_edit',
527
+				$event->ID()
528
+			)
529
+		) {
530
+			$edit_query_args = [
531
+				'action' => 'edit',
532
+				'post'   => $event->ID(),
533
+			];
534
+			$edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
535
+			$action_links[]  = '<a href="' . $edit_link . '" class="ee-aria-tooltip button button--icon-only"'
536
+							   . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">'
537
+							   . '<span class="dashicons dashicons-calendar-alt"></span>'
538
+							   . '</a>';
539
+		}
540
+		if (
541
+			EE_Registry::instance()->CAP->current_user_can(
542
+				'ee_read_registrations',
543
+				'espresso_registrations_view_registration'
544
+			)
545
+			&& EE_Registry::instance()->CAP->current_user_can(
546
+				'ee_read_event',
547
+				'espresso_registrations_view_registration',
548
+				$event->ID()
549
+			)
550
+		) {
551
+			$attendees_query_args = [
552
+				'action'   => 'default',
553
+				'event_id' => $event->ID(),
554
+			];
555
+			$attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
556
+			$action_links[]       = '<a href="' . $attendees_link . '" class="ee-aria-tooltip button button--icon-only"'
557
+									. ' aria-label="' . esc_attr__('View Registrants', 'event_espresso') . '">'
558
+									. '<span class="dashicons dashicons-groups"></span>'
559
+									. '</a>';
560
+		}
561
+		$action_links = apply_filters(
562
+			'FHEE__Events_Admin_List_Table__column_actions__action_links',
563
+			$action_links,
564
+			$event
565
+		);
566
+		$content      = $this->_action_string(
567
+			implode("\n\t", $action_links),
568
+			$event,
569
+			'div',
570
+			'event-overview-actions ee-list-table-actions'
571
+		);
572
+		return $this->columnContent('actions', $this->actionsModalMenu($content));
573
+	}
574
+
575
+
576
+	/**
577
+	 * Helper for adding columns conditionally
578
+	 *
579
+	 * @throws EE_Error
580
+	 * @throws InvalidArgumentException
581
+	 * @throws InvalidDataTypeException
582
+	 * @throws InvalidInterfaceException
583
+	 * @throws ReflectionException
584
+	 */
585
+	private function addConditionalColumns()
586
+	{
587
+		$event_category_count = EEM_Term::instance()->count(
588
+			[['Term_Taxonomy.taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY]]
589
+		);
590
+		if ($event_category_count === 0) {
591
+			return;
592
+		}
593
+		$column_array = [];
594
+		foreach ($this->_columns as $column => $column_label) {
595
+			$column_array[ $column ] = $column_label;
596
+			if ($column === 'venue') {
597
+				$column_array['event_category'] = esc_html__('Event Category', 'event_espresso');
598
+			}
599
+		}
600
+		$this->_columns = $column_array;
601
+	}
602 602
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     protected function _set_properties()
47 47
     {
48
-        $this->_wp_list_args    = [
48
+        $this->_wp_list_args = [
49 49
             'singular' => esc_html__('event', 'event_espresso'),
50 50
             'plural'   => esc_html__('events', 'event_espresso'),
51 51
             'ajax'     => true, // for now
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
             'start_date_time' => esc_html__('Event Start', 'event_espresso'),
62 62
             'reg_begins'      => esc_html__('On Sale', 'event_espresso'),
63 63
             'attendees'       => '
64
-                <span class="show-on-mobile-view-only" aria-label="' . $approved_registrations . '">
65
-                    ' . $approved_registrations . '
64
+                <span class="show-on-mobile-view-only" aria-label="' . $approved_registrations.'">
65
+                    ' . $approved_registrations.'
66 66
                 </span>
67 67
                 <span class="dashicons dashicons-groups ee-icon-color-ee-green"></span>',
68 68
             'actions'         => $this->actionsColumnHeader(),
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function column_cb($item): string
140 140
     {
141
-        if (! $item instanceof EE_Event) {
141
+        if ( ! $item instanceof EE_Event) {
142 142
             return '';
143 143
         }
144 144
         $this->_dtt = $item->primary_datetime(); // set this for use in other columns
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
         $actions         = $this->_column_name_action_setup($event);
184 184
         $status          = esc_attr($event->get_active_status());
185 185
         $pretty_status   = EEH_Template::pretty_status($status, false, 'sentence');
186
-        $status_dot      = '<span class="ee-status-dot ee-status-bg--' . $status . '"></span>';
186
+        $status_dot      = '<span class="ee-status-dot ee-status-bg--'.$status.'"></span>';
187 187
         $content         = '
188 188
             <div class="ee-layout-row ee-layout-row--fixed">
189
-                <a  class="row-title ee-status-color--' . $status . ' ee-aria-tooltip" 
190
-                    aria-label="' . $pretty_status . '" 
191
-                    href="' . $edit_link . '"
189
+                <a  class="row-title ee-status-color--' . $status.' ee-aria-tooltip" 
190
+                    aria-label="' . $pretty_status.'" 
191
+                    href="' . $edit_link.'"
192 192
                 >
193
-                    ' . $status_dot . $event->name() . '
193
+                    ' . $status_dot.$event->name().'
194 194
                 </a>
195 195
             </div>';
196 196
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     protected function _column_name_action_setup(EE_Event $event): array
215 215
     {
216 216
         // todo: remove when attendees is active
217
-        if (! defined('REG_ADMIN_URL')) {
217
+        if ( ! defined('REG_ADMIN_URL')) {
218 218
             define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
219 219
         }
220 220
         $actions            = [];
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
                 'post'   => $event->ID(),
234 234
             ];
235 235
             $edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
236
-            $actions['edit'] = '<a href="' . $edit_link . '" class="ee-aria-tooltip" '
237
-                               . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">'
236
+            $actions['edit'] = '<a href="'.$edit_link.'" class="ee-aria-tooltip" '
237
+                               . ' aria-label="'.esc_attr__('Edit Event', 'event_espresso').'">'
238 238
                                . esc_html__('Edit', 'event_espresso')
239 239
                                . '</a>';
240 240
         }
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
                 'event_id' => $event->ID(),
255 255
             ];
256 256
             $attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
257
-            $actions['attendees'] = '<a href="' . $attendees_link . '" class="ee-aria-tooltip"'
258
-                                    . ' aria-label="' . esc_attr__('View Registrations', 'event_espresso') . '">'
257
+            $actions['attendees'] = '<a href="'.$attendees_link.'" class="ee-aria-tooltip"'
258
+                                    . ' aria-label="'.esc_attr__('View Registrations', 'event_espresso').'">'
259 259
                                     . esc_html__('Registrations', 'event_espresso')
260 260
                                     . '</a>';
261 261
         }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                 'action' => 'trash_event',
271 271
                 'EVT_ID' => $event->ID(),
272 272
             ];
273
-            $trash_event_link       = EE_Admin_Page::add_query_args_and_nonce(
273
+            $trash_event_link = EE_Admin_Page::add_query_args_and_nonce(
274 274
                 $trash_event_query_args,
275 275
                 EVENTS_ADMIN_URL
276 276
             );
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 'action' => 'restore_event',
287 287
                 'EVT_ID' => $event->ID(),
288 288
             ];
289
-            $restore_event_link       = EE_Admin_Page::add_query_args_and_nonce(
289
+            $restore_event_link = EE_Admin_Page::add_query_args_and_nonce(
290 290
                 $restore_event_query_args,
291 291
                 EVENTS_ADMIN_URL
292 292
             );
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
                 'action' => 'delete_event',
303 303
                 'EVT_ID' => $event->ID(),
304 304
             ];
305
-            $delete_event_link       = EE_Admin_Page::add_query_args_and_nonce(
305
+            $delete_event_link = EE_Admin_Page::add_query_args_and_nonce(
306 306
                 $delete_event_query_args,
307 307
                 EVENTS_ADMIN_URL
308 308
             );
309 309
         }
310 310
         $view_link       = get_permalink($event->ID());
311
-        $actions['view'] = '<a href="' . $view_link . '" class="ee-aria-tooltip"'
312
-                           . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '">'
311
+        $actions['view'] = '<a href="'.$view_link.'" class="ee-aria-tooltip"'
312
+                           . ' aria-label="'.esc_attr__('View Event', 'event_espresso').'">'
313 313
                            . esc_html__('View', 'event_espresso')
314 314
                            . '</a>';
315 315
         if ($event->get('status') === 'trash') {
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
                     $event->ID()
321 321
                 )
322 322
             ) {
323
-                $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" class="ee-aria-tooltip"'
324
-                                                 . ' aria-label="' . esc_attr__('Restore from Trash', 'event_espresso')
323
+                $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" class="ee-aria-tooltip"'
324
+                                                 . ' aria-label="'.esc_attr__('Restore from Trash', 'event_espresso')
325 325
                                                  . '">'
326 326
                                                  . esc_html__('Restore from Trash', 'event_espresso')
327 327
                                                  . '</a>';
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
                     $event->ID()
334 334
                 )
335 335
             ) {
336
-                $actions['delete'] = '<a href="' . $delete_event_link . '" class="ee-aria-tooltip"'
337
-                                     . ' aria-label="' . esc_attr__('Delete Permanently', 'event_espresso') . '">'
336
+                $actions['delete'] = '<a href="'.$delete_event_link.'" class="ee-aria-tooltip"'
337
+                                     . ' aria-label="'.esc_attr__('Delete Permanently', 'event_espresso').'">'
338 338
                                      . esc_html__('Delete Permanently', 'event_espresso')
339 339
                                      . '</a>';
340 340
             }
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
                     $event->ID()
347 347
                 )
348 348
             ) {
349
-                $actions['move to trash'] = '<a href="' . $trash_event_link . '" class="ee-aria-tooltip"'
350
-                                            . ' aria-label="' . esc_attr__('Trash Event', 'event_espresso') . '">'
349
+                $actions['move to trash'] = '<a href="'.$trash_event_link.'" class="ee-aria-tooltip"'
350
+                                            . ' aria-label="'.esc_attr__('Trash Event', 'event_espresso').'">'
351 351
                                             . esc_html__('Trash', 'event_espresso')
352 352
                                             . '</a>';
353 353
             }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
         ];
375 375
         $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL);
376 376
         $content    = '<div class="ee-layout-row ee-layout-row--fixed">';
377
-        $content    .= $gravatar . '  <a href="' . $filter_url . '" class="ee-aria-tooltip"'
378
-                       . ' aria-label="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">'
377
+        $content .= $gravatar.'  <a href="'.$filter_url.'" class="ee-aria-tooltip"'
378
+                       . ' aria-label="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'
379 379
                        . $event_author->display_name
380 380
                        . '</a>';
381
-        $content    .= '</div>';
381
+        $content .= '</div>';
382 382
         return $this->columnContent('author', $content);
383 383
     }
384 384
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         $content          = implode(
396 396
             ', ',
397 397
             array_map(
398
-                function (EE_Term $category) {
398
+                function(EE_Term $category) {
399 399
                     return $category->name();
400 400
                 },
401 401
                 $event_categories
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             'ee_read_registrations',
479 479
             'espresso_registrations_view_registration'
480 480
         )
481
-            ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>'
481
+            ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>'
482 482
             : $registered_attendees;
483 483
         return $this->columnContent('attendees', $content, 'center');
484 484
     }
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
     public function column_actions(EE_Event $event): string
513 513
     {
514 514
         // todo: remove when attendees is active
515
-        if (! defined('REG_ADMIN_URL')) {
515
+        if ( ! defined('REG_ADMIN_URL')) {
516 516
             define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
517 517
         }
518 518
         $action_links   = [];
519 519
         $view_link      = get_permalink($event->ID());
520
-        $action_links[] = '<a href="' . $view_link . '" class="ee-aria-tooltip button button--icon-only"'
521
-                          . ' aria-label="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">
520
+        $action_links[] = '<a href="'.$view_link.'" class="ee-aria-tooltip button button--icon-only"'
521
+                          . ' aria-label="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">
522 522
                           <span class="dashicons dashicons-visibility"></span></a>';
523 523
         if (
524 524
             EE_Registry::instance()->CAP->current_user_can(
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                 'post'   => $event->ID(),
533 533
             ];
534 534
             $edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL);
535
-            $action_links[]  = '<a href="' . $edit_link . '" class="ee-aria-tooltip button button--icon-only"'
536
-                               . ' aria-label="' . esc_attr__('Edit Event', 'event_espresso') . '">'
535
+            $action_links[]  = '<a href="'.$edit_link.'" class="ee-aria-tooltip button button--icon-only"'
536
+                               . ' aria-label="'.esc_attr__('Edit Event', 'event_espresso').'">'
537 537
                                . '<span class="dashicons dashicons-calendar-alt"></span>'
538 538
                                . '</a>';
539 539
         }
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
                 'event_id' => $event->ID(),
554 554
             ];
555 555
             $attendees_link       = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL);
556
-            $action_links[]       = '<a href="' . $attendees_link . '" class="ee-aria-tooltip button button--icon-only"'
557
-                                    . ' aria-label="' . esc_attr__('View Registrants', 'event_espresso') . '">'
556
+            $action_links[]       = '<a href="'.$attendees_link.'" class="ee-aria-tooltip button button--icon-only"'
557
+                                    . ' aria-label="'.esc_attr__('View Registrants', 'event_espresso').'">'
558 558
                                     . '<span class="dashicons dashicons-groups"></span>'
559 559
                                     . '</a>';
560 560
         }
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             $action_links,
564 564
             $event
565 565
         );
566
-        $content      = $this->_action_string(
566
+        $content = $this->_action_string(
567 567
             implode("\n\t", $action_links),
568 568
             $event,
569 569
             'div',
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
         }
593 593
         $column_array = [];
594 594
         foreach ($this->_columns as $column => $column_label) {
595
-            $column_array[ $column ] = $column_label;
595
+            $column_array[$column] = $column_label;
596 596
             if ($column === 'venue') {
597 597
                 $column_array['event_category'] = esc_html__('Event Category', 'event_espresso');
598 598
             }
Please login to merge, or discard this patch.
templates/txn_admin_details_main_meta_box_txn_details.template.php 2 patches
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -80,21 +80,21 @@  discard block
 block discarded – undo
80 80
     </div>
81 81
     <br class="clear" />
82 82
     <?php
83
-    $no_payments = $grand_raw_total > 0
84
-                   || $TXN_status !== EEM_Transaction::complete_status_code
85
-                   || ! empty($payments);
86
-    ?>
83
+	$no_payments = $grand_raw_total > 0
84
+				   || $TXN_status !== EEM_Transaction::complete_status_code
85
+				   || ! empty($payments);
86
+	?>
87 87
     <?php if ($attendee instanceof EE_Attendee && $no_payments) : ?>
88 88
         <?php $no_payment_text = $can_edit_payments
89
-            ? esc_html__(
90
-                'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.',
91
-                'event_espresso'
92
-            )
93
-            : esc_html__(
94
-                'No payments have been applied to this transaction yet.',
95
-                'event_espresso'
96
-            );
97
-        ?>
89
+			? esc_html__(
90
+				'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.',
91
+				'event_espresso'
92
+			)
93
+			: esc_html__(
94
+				'No payments have been applied to this transaction yet.',
95
+				'event_espresso'
96
+			);
97
+		?>
98 98
 
99 99
         <h3 class="admin-primary-mbox-h4 hdr-has-icon">
100 100
             <?php esc_html_e('Payment Details', 'event_espresso'); ?>
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
                     <?php if ($payments) : ?>
141 141
                         <?php $payment_total = 0; ?>
142 142
                         <?php foreach ($payments as $PAY_ID => $payment) :
143
-                            if (! $payment instanceof EE_Payment) {
144
-                                continue;
145
-                            }
146
-                            $PAY_ID = absint($PAY_ID);
147
-                            $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ])
148
-                                ? wp_json_encode($existing_reg_payments[ $PAY_ID ])
149
-                                : '{}';
150
-                            $escaped_pay_id = esc_attr($PAY_ID);
151
-                            ?>
143
+							if (! $payment instanceof EE_Payment) {
144
+								continue;
145
+							}
146
+							$PAY_ID = absint($PAY_ID);
147
+							$existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ])
148
+								? wp_json_encode($existing_reg_payments[ $PAY_ID ])
149
+								: '{}';
150
+							$escaped_pay_id = esc_attr($PAY_ID);
151
+							?>
152 152
                             <tr id="txn-admin-payment-tr-<?php echo $escaped_pay_id; ?>" class=' jst-cntr'>
153 153
                                 <td class="jst-cntr no-pad">
154 154
                                     <span id="payment-status-<?php echo $escaped_pay_id; ?>"
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                                 <td class=" jst-rght">
165 165
                                     <div id="payment-id-<?php echo $escaped_pay_id; ?>">
166 166
                                         <?php echo $PAY_ID; // sanitized
167
-                                        ?>
167
+										?>
168 168
                                     </div>
169 169
                                 </td>
170 170
                                 <td class=" jst-left">
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
                                 </td>
175 175
                                 <td class=' jst-rght'>
176 176
                                     <?php
177
-                                    $payment_class = $payment->amount() > 0
178
-                                        ? 'txn-admin-payment-status-' . $payment->STS_ID()
179
-                                        : 'txn-admin-payment-status-PDC';
180
-                                    ?>
177
+									$payment_class = $payment->amount() > 0
178
+										? 'txn-admin-payment-status-' . $payment->STS_ID()
179
+										: 'txn-admin-payment-status-PDC';
180
+									?>
181 181
                                     <span class="<?php echo esc_attr($payment_class); ?>">
182 182
                                         <span id="payment-amount-<?php echo $escaped_pay_id; ?>"
183 183
                                               style="display:inline;"
184 184
                                         >
185 185
                                         <?php echo EEH_Template::format_currency(
186
-                                            $payment->amount(),
187
-                                            false,
188
-                                            false
189
-                                        ); // already escaped
190
-                                        ?>
186
+											$payment->amount(),
187
+											false,
188
+											false
189
+										); // already escaped
190
+										?>
191 191
                                         </span>
192 192
                                     </span>
193 193
                                 </td>
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
                                     <span class="ee-status--ignore">&raquo;</span>
199 199
                                     <span id="payment-gateway-<?php echo $escaped_pay_id; ?>">
200 200
                                         <?php echo $payment->payment_method() instanceof EE_Payment_Method
201
-                                            ? esc_html($payment->payment_method()->admin_name())
202
-                                            : esc_html__("Unknown", 'event_espresso'); ?>
201
+											? esc_html($payment->payment_method()->admin_name())
202
+											: esc_html__("Unknown", 'event_espresso'); ?>
203 203
                                     </span>
204 204
                                     <span id="payment-gateway-id-<?php echo $escaped_pay_id; ?>" class="hidden">
205 205
                                         <?php echo $payment->payment_method() instanceof EE_Payment_Method
206
-                                            ? esc_html($payment->payment_method()->ID())
207
-                                            : 0; ?>
206
+											? esc_html($payment->payment_method()->ID())
207
+											: 0; ?>
208 208
                                     </span>
209 209
                                 </td>
210 210
                                 <td class=" jst-left">
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
                             <?php $payment_total += $payment->STS_ID() == 'PAP' ? $payment->amount() : 0; ?>
256 256
                         <?php endforeach; ?>
257 257
                         <?php $pay_totals_class = $payment_total > $grand_raw_total
258
-                            ? ' important-notice'
259
-                            : '';
260
-                        ?>
258
+							? ' important-notice'
259
+							: '';
260
+						?>
261 261
                         <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden">
262 262
                             <td class=" jst-rght" colspan="10">
263 263
                                 <span class="important-notice"><?php echo $no_payment_text; // already escaped ?></span>
@@ -269,27 +269,27 @@  discard block
 block discarded – undo
269 269
                             <th class=" jst-rght" colspan="9">
270 270
                         <span id="payments-total-spn">
271 271
                         <?php
272
-                        $overpaid = $payment_total > $grand_raw_total
273
-                            ? '<span id="overpaid">'
274
-                              . __('This transaction has been overpaid ! ', 'event_espresso')
275
-                              . '</span>'
276
-                            : '';
277
-                        echo $overpaid . esc_html(
278
-                            sprintf(
279
-                                __('Payments Total %s', 'event_espresso'),
280
-                                '(' . EE_Registry::instance()->CFG->currency->code . ')'
281
-                            )
282
-                        ); ?>
272
+						$overpaid = $payment_total > $grand_raw_total
273
+							? '<span id="overpaid">'
274
+							  . __('This transaction has been overpaid ! ', 'event_espresso')
275
+							  . '</span>'
276
+							: '';
277
+						echo $overpaid . esc_html(
278
+							sprintf(
279
+								__('Payments Total %s', 'event_espresso'),
280
+								'(' . EE_Registry::instance()->CFG->currency->code . ')'
281
+							)
282
+						); ?>
283 283
                         </span>
284 284
                             </th>
285 285
                             <th class=" jst-rght">
286 286
                         <span id="txn-admin-payment-total">
287 287
                         <?php
288
-                        echo EEH_Template::format_currency(
289
-                            $payment_total,
290
-                            false,
291
-                            false
292
-                        ); // already escaped ?>
288
+						echo EEH_Template::format_currency(
289
+							$payment_total,
290
+							false,
291
+							false
292
+						); // already escaped ?>
293 293
                         </span>
294 294
                             </th>
295 295
                         </tr>
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 
371 371
         <ul id="txn-admin-payment-options-ul">
372 372
             <?php if ($can_edit_payments) :
373
-                ?>
373
+				?>
374 374
                 <li>
375 375
                     <a id="display-txn-admin-apply-payment"
376 376
                        class="button button--primary no-icon no-hide"
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
                 </li>
398 398
             <?php endif; ?>
399 399
             <?php
400
-            // Allows extend the fields at actions area.
401
-            do_action(
402
-                'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons',
403
-                $can_edit_payments
404
-            );
405
-            ?>
400
+			// Allows extend the fields at actions area.
401
+			do_action(
402
+				'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons',
403
+				$can_edit_payments
404
+			);
405
+			?>
406 406
         </ul>
407 407
         <br class="clear" />
408 408
 
@@ -419,23 +419,23 @@  discard block
 block discarded – undo
419 419
                 style="display:none;"
420 420
             >
421 421
                 <?php
422
-                printf(
423
-                    esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'),
424
-                    '<span class="ee-admin-payment-id"></span>',
425
-                    $txn_nmbr['value']
426
-                );
427
-                ?>
422
+				printf(
423
+					esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'),
424
+					'<span class="ee-admin-payment-id"></span>',
425
+					$txn_nmbr['value']
426
+				);
427
+				?>
428 428
                 <span class='dashicons dashicons-money-alt'></span>
429 429
             </h2>
430 430
 
431 431
             <h2 id="admin-modal-dialog-edit-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;">
432 432
                 <?php
433
-                printf(
434
-                    esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'),
435
-                    '<span class="ee-admin-payment-id"></span>',
436
-                    $txn_nmbr['value']
437
-                );
438
-                ?>
433
+				printf(
434
+					esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'),
435
+					'<span class="ee-admin-payment-id"></span>',
436
+					$txn_nmbr['value']
437
+				);
438
+				?>
439 439
                 <span class='dashicons dashicons-money-alt'></span>
440 440
             </h2>
441 441
 
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
                 style="display:none;"
444 444
             >
445 445
                 <?php
446
-                echo esc_html__('Apply a Refund to Transaction #', 'event_espresso');
447
-                echo esc_html($txn_nmbr['value']);
448
-                ?>
446
+				echo esc_html__('Apply a Refund to Transaction #', 'event_espresso');
447
+				echo esc_html($txn_nmbr['value']);
448
+				?>
449 449
                 <span class='dashicons dashicons-money-alt'></span>
450 450
             </h2>
451 451
 
@@ -552,29 +552,29 @@  discard block
 block discarded – undo
552 552
                                 >
553 553
                                     <?php foreach ($payment_methods as $method) : ?>
554 554
                                         <?php
555
-                                        $selected = $method->slug() == 'cash'
556
-                                            ? ' selected="selected"'
557
-                                            : '';
558
-                                        ?>
555
+										$selected = $method->slug() == 'cash'
556
+											? ' selected="selected"'
557
+											: '';
558
+										?>
559 559
                                         <option id="payment-method-opt-<?php echo esc_attr($method->slug()); ?>"
560 560
                                                 value="<?php echo esc_attr($method->ID()); ?>"
561 561
                                             <?php echo esc_attr($selected); ?>
562 562
                                         >
563 563
                                             <?php
564
-                                            echo esc_html(
565
-                                                sanitize_key($method->admin_desc())
566
-                                                    ? substr($method->admin_desc(), 0, 128)
567
-                                                    : $method->admin_name()
568
-                                            );
569
-                                            ?>&nbsp;&nbsp;
564
+											echo esc_html(
565
+												sanitize_key($method->admin_desc())
566
+													? substr($method->admin_desc(), 0, 128)
567
+													: $method->admin_name()
568
+											);
569
+											?>&nbsp;&nbsp;
570 570
                                         </option>
571 571
                                     <?php endforeach; ?>
572 572
                                 </select>
573 573
                                 <p class="description">
574 574
                                     <?php esc_html_e(
575
-                                        'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash',
576
-                                        'event_espresso'
577
-                                    ); ?>
575
+										'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash',
576
+										'event_espresso'
577
+									); ?>
578 578
                                 </p>
579 579
                             </div>
580 580
                         </div>
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
                         admin-modal-dialog-row ee-layout-row">
584 584
                             <label for="txn-admin-payment-txn-id-chq-nmbr-inp" class="">
585 585
                                 <?php esc_html_e(
586
-                                    'TXN ID / CHQ #',
587
-                                    'event_espresso'
588
-                                ); ?>
586
+									'TXN ID / CHQ #',
587
+									'event_espresso'
588
+								); ?>
589 589
                             </label>
590 590
                             <div class='ee-layout-stack'>
591 591
                                 <input name="txn_admin_payment[txn_id_chq_nmbr]"
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
                                 />
596 596
                                 <p class="description">
597 597
                                     <?php esc_html_e(
598
-                                        'The Transaction ID sent back from the payment gateway, or the Cheque #',
599
-                                        'event_espresso'
600
-                                    ); ?>
598
+										'The Transaction ID sent back from the payment gateway, or the Cheque #',
599
+										'event_espresso'
600
+									); ?>
601 601
                                 </p>
602 602
                             </div>
603 603
                         </div>
@@ -615,9 +615,9 @@  discard block
 block discarded – undo
615 615
                                 />
616 616
                                 <p class="description">
617 617
                                     <?php esc_html_e(
618
-                                        'The gateway response string (optional)',
619
-                                        'event_espresso'
620
-                                    ); ?>
618
+										'The gateway response string (optional)',
619
+										'event_espresso'
620
+									); ?>
621 621
                                 </p>
622 622
                             </div>
623 623
                         </div>
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
                             ee-layout-row">
627 627
                             <label for="txn-admin-payment-status-slct" class="">
628 628
                                 <?php esc_html_e(
629
-                                    'Payment Status',
630
-                                    'event_espresso'
631
-                                ); ?>
629
+									'Payment Status',
630
+									'event_espresso'
631
+								); ?>
632 632
                             </label>
633 633
                             <div class='ee-layout-stack'>
634 634
                                 <select name="txn_admin_payment[status]"
@@ -638,10 +638,10 @@  discard block
 block discarded – undo
638 638
                                 >
639 639
                                     <?php foreach ($payment_status as $STS_ID => $STS_code) : ?>
640 640
                                         <?php
641
-                                        $selected = $STS_ID == 'PAP'
642
-                                            ? ' selected="selected"'
643
-                                            : '';
644
-                                        ?>
641
+										$selected = $STS_ID == 'PAP'
642
+											? ' selected="selected"'
643
+											: '';
644
+										?>
645 645
                                         <option id="payment-status-opt-<?php echo esc_attr($STS_ID); ?>"
646 646
                                                 value="<?php echo esc_attr($STS_ID); ?>"
647 647
                                             <?php echo esc_attr($selected); ?>
@@ -652,10 +652,10 @@  discard block
 block discarded – undo
652 652
                                 </select>
653 653
                                 <p class="description">
654 654
                                     <?php
655
-                                    esc_html_e(
656
-                                        'Whether the payment was approved, cancelled, declined or failed after submission to the gateway',
657
-                                        'event_espresso'
658
-                                    ); ?>
655
+									esc_html_e(
656
+										'Whether the payment was approved, cancelled, declined or failed after submission to the gateway',
657
+										'event_espresso'
658
+									); ?>
659 659
                                 </p>
660 660
                             </div>
661 661
                         </div>
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
                                 />
674 674
                                 <p class="description">
675 675
                                     <?php esc_html_e(
676
-                                        'The Purchase or Sales Order Number if any (optional)',
677
-                                        'event_espresso'
678
-                                    ); ?>
676
+										'The Purchase or Sales Order Number if any (optional)',
677
+										'event_espresso'
678
+									); ?>
679 679
                                 </p>
680 680
                             </div>
681 681
                         </div>
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
                                 />
699 699
                                 <p class="description">
700 700
                                     <?php esc_html_e(
701
-                                        'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.',
702
-                                        'event_espresso'
703
-                                    ); ?>
701
+										'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.',
702
+										'event_espresso'
703
+									); ?>
704 704
                                 </p>
705 705
                             </div>
706 706
                         </div>
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
                                 <?php echo $status_change_select; // already escaped ?>
740 740
                                 <p class="description">
741 741
                                     <?php esc_html_e(
742
-                                        'If you wish to change the status for the registrations selected above, then select which status from this dropdown.',
743
-                                        'event_espresso'
744
-                                    ); ?>
742
+										'If you wish to change the status for the registrations selected above, then select which status from this dropdown.',
743
+										'event_espresso'
744
+									); ?>
745 745
                                 </p>
746 746
                             </div>
747 747
                         </div>
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
                                 <br class="clear-float" />
773 773
                                 <p class="description">
774 774
                                     <?php printf(
775
-                                        esc_html__(
776
-                                            'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.',
777
-                                            'event_espresso'
778
-                                        ),
779
-                                        '<strong>',
780
-                                        '</strong>',
781
-                                        '<br />'
782
-                                    ); ?>
775
+										esc_html__(
776
+											'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.',
777
+											'event_espresso'
778
+										),
779
+										'<strong>',
780
+										'</strong>',
781
+										'<br />'
782
+									); ?>
783 783
                                 </p>
784 784
                             </div>
785 785
                         </div>
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
                 style="display:none;"
835 835
             >
836 836
                 <?php printf(
837
-                    esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'),
838
-                    $txn_nmbr['value']
839
-                );
840
-                ?>
837
+					esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'),
838
+					$txn_nmbr['value']
839
+				);
840
+				?>
841 841
                 <span class='dashicons dashicons-money-alt'></span>
842 842
             </h2>
843 843
 
@@ -875,13 +875,13 @@  discard block
 block discarded – undo
875 875
                                 <?php echo $delete_status_change_select; // already escaped ?>
876 876
                                 <p class="description">
877 877
                                     <?php printf(
878
-                                        esc_html__(
879
-                                            'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s',
880
-                                            'event_espresso'
881
-                                        ),
882
-                                        '<strong>',
883
-                                        '</strong>'
884
-                                    ); ?>
878
+										esc_html__(
879
+											'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s',
880
+											'event_espresso'
881
+										),
882
+										'<strong>',
883
+										'</strong>'
884
+									); ?>
885 885
                                 </p>
886 886
                             </div>
887 887
                         </div>
@@ -898,10 +898,10 @@  discard block
 block discarded – undo
898 898
                                 />
899 899
                                 <p class="description">
900 900
                                     <?php
901
-                                    esc_html_e(
902
-                                        'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.',
903
-                                        'event_espresso'
904
-                                    ); ?>
901
+									esc_html_e(
902
+										'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.',
903
+										'event_espresso'
904
+									); ?>
905 905
                                 </p>
906 906
                             </div>
907 907
                         </div>
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
     <?php endif; // $grand_raw_total > 0?>
930 930
 
931 931
     <?php if (WP_DEBUG) {
932
-        $delivered_messages = get_option('EED_Messages__payment', []);
933
-        if (isset($delivered_messages[ $TXN_ID ])) { ?>
932
+		$delivered_messages = get_option('EED_Messages__payment', []);
933
+		if (isset($delivered_messages[ $TXN_ID ])) { ?>
934 934
             <h4 class="admin-primary-mbox-h4 hdr-has-icon">
935 935
                 <?php esc_html_e('Messages Sent to Primary Registrant', 'event_espresso'); ?>
936 936
                 <span class="dashicons dashicons-email-alt"></span>
@@ -942,39 +942,39 @@  discard block
 block discarded – undo
942 942
                             <th class="jst-left"><?php esc_html_e('Date & Time', 'event_espresso'); ?></th>
943 943
                             <th class="jst-left"><?php esc_html_e('Message Type', 'event_espresso'); ?></th>
944 944
                             <th class="jst-left"><?php esc_html_e(
945
-                                'Payment Status Upon Sending',
946
-                                'event_espresso'
947
-                            ); ?></th>
945
+								'Payment Status Upon Sending',
946
+								'event_espresso'
947
+							); ?></th>
948 948
                             <th class="jst-left"><?php esc_html_e('TXN Status Upon Sending', 'event_espresso'); ?></th>
949 949
                         </tr>
950 950
                     </thead>
951 951
                     <tbody>
952 952
                         <?php
953
-                        foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
954
-                            ?>
953
+						foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
954
+							?>
955 955
                             <tr>
956 956
                                 <td class="jst-left">
957 957
                                     <?php echo esc_html(
958
-                                        date(
959
-                                            get_option('date_format') . ' ' . get_option('time_format'),
960
-                                            ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
961
-                                        )
962
-                                    ); ?>
958
+										date(
959
+											get_option('date_format') . ' ' . get_option('time_format'),
960
+											($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
961
+										)
962
+									); ?>
963 963
                                 </td>
964 964
                                 <td class="jst-left"><?php
965
-                                    echo isset($delivered_message['message_type'])
966
-                                        ? esc_html($delivered_message['message_type'])
967
-                                        : ''; ?>
965
+									echo isset($delivered_message['message_type'])
966
+										? esc_html($delivered_message['message_type'])
967
+										: ''; ?>
968 968
                                 </td>
969 969
                                 <td class="jst-left"><?php
970
-                                    echo isset($delivered_message['pay_status'])
971
-                                        ? esc_html($delivered_message['pay_status'])
972
-                                        : ''; ?>
970
+									echo isset($delivered_message['pay_status'])
971
+										? esc_html($delivered_message['pay_status'])
972
+										: ''; ?>
973 973
                                 </td>
974 974
                                 <td class="jst-left"><?php
975
-                                    echo isset($delivered_message['txn_status'])
976
-                                        ? esc_html($delivered_message['txn_status'])
977
-                                        : ''; ?>
975
+									echo isset($delivered_message['txn_status'])
976
+										? esc_html($delivered_message['txn_status'])
977
+										: ''; ?>
978 978
                                 </td>
979 979
                             </tr>
980 980
                         <?php endforeach; // $delivered_messages?>
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
                 </table>
983 983
             </div>
984 984
             <?php
985
-        }
986
-    }
987
-    ?>
985
+		}
986
+	}
987
+	?>
988 988
 </div>
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                             <?php esc_html_e('ID', 'event_espresso'); ?>
111 111
                         </th>
112 112
                         <th class="txn-admin-payment-date-col jst-left">
113
-                            <?php esc_html_e('Date', 'event_espresso');?>
113
+                            <?php esc_html_e('Date', 'event_espresso'); ?>
114 114
                         </th>
115 115
                         <th class='jst-cntr'>
116 116
                             <?php esc_html_e('Amount', 'event_espresso'); ?>
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
                     <?php if ($payments) : ?>
141 141
                         <?php $payment_total = 0; ?>
142 142
                         <?php foreach ($payments as $PAY_ID => $payment) :
143
-                            if (! $payment instanceof EE_Payment) {
143
+                            if ( ! $payment instanceof EE_Payment) {
144 144
                                 continue;
145 145
                             }
146 146
                             $PAY_ID = absint($PAY_ID);
147
-                            $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ])
148
-                                ? wp_json_encode($existing_reg_payments[ $PAY_ID ])
147
+                            $existing_reg_payment_json = isset($existing_reg_payments[$PAY_ID])
148
+                                ? wp_json_encode($existing_reg_payments[$PAY_ID])
149 149
                                 : '{}';
150 150
                             $escaped_pay_id = esc_attr($PAY_ID);
151 151
                             ?>
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                                 <td class=' jst-rght'>
176 176
                                     <?php
177 177
                                     $payment_class = $payment->amount() > 0
178
-                                        ? 'txn-admin-payment-status-' . $payment->STS_ID()
178
+                                        ? 'txn-admin-payment-status-'.$payment->STS_ID()
179 179
                                         : 'txn-admin-payment-status-PDC';
180 180
                                     ?>
181 181
                                     <span class="<?php echo esc_attr($payment_class); ?>">
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
                               . __('This transaction has been overpaid ! ', 'event_espresso')
275 275
                               . '</span>'
276 276
                             : '';
277
-                        echo $overpaid . esc_html(
277
+                        echo $overpaid.esc_html(
278 278
                             sprintf(
279 279
                                 __('Payments Total %s', 'event_espresso'),
280
-                                '(' . EE_Registry::instance()->CFG->currency->code . ')'
280
+                                '('.EE_Registry::instance()->CFG->currency->code.')'
281 281
                             )
282 282
                         ); ?>
283 283
                         </span>
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
             <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon"
412 412
                 style="display:none;"
413 413
             >
414
-                <?php echo esc_html__('Apply a Payment to Transaction #', 'event_espresso') . esc_html($txn_nmbr['value']); ?>
414
+                <?php echo esc_html__('Apply a Payment to Transaction #', 'event_espresso').esc_html($txn_nmbr['value']); ?>
415 415
                 <span class='dashicons dashicons-money-alt'></span>
416 416
             </h2>
417 417
 
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 
931 931
     <?php if (WP_DEBUG) {
932 932
         $delivered_messages = get_option('EED_Messages__payment', []);
933
-        if (isset($delivered_messages[ $TXN_ID ])) { ?>
933
+        if (isset($delivered_messages[$TXN_ID])) { ?>
934 934
             <h4 class="admin-primary-mbox-h4 hdr-has-icon">
935 935
                 <?php esc_html_e('Messages Sent to Primary Registrant', 'event_espresso'); ?>
936 936
                 <span class="dashicons dashicons-email-alt"></span>
@@ -950,13 +950,13 @@  discard block
 block discarded – undo
950 950
                     </thead>
951 951
                     <tbody>
952 952
                         <?php
953
-                        foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
953
+                        foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) :
954 954
                             ?>
955 955
                             <tr>
956 956
                                 <td class="jst-left">
957 957
                                     <?php echo esc_html(
958 958
                                         date(
959
-                                            get_option('date_format') . ' ' . get_option('time_format'),
959
+                                            get_option('date_format').' '.get_option('time_format'),
960 960
                                             ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
961 961
                                         )
962 962
                                     ); ?>
Please login to merge, or discard this patch.