@@ -11,42 +11,42 @@ |
||
11 | 11 | class EEH_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @var array $uri_segment_array URL segments |
|
16 | - * @access private |
|
17 | - */ |
|
14 | + /** |
|
15 | + * @var array $uri_segment_array URL segments |
|
16 | + * @access private |
|
17 | + */ |
|
18 | 18 | // final private function __construct() {} |
19 | 19 | |
20 | - /** |
|
21 | - * @ override magic methods |
|
22 | - * @ return void |
|
23 | - */ |
|
24 | - public function __set($a, $b) |
|
25 | - { |
|
26 | - return false; |
|
27 | - } |
|
28 | - public function __get($a) |
|
29 | - { |
|
30 | - return false; |
|
31 | - } |
|
32 | - public function __isset($a) |
|
33 | - { |
|
34 | - return false; |
|
35 | - } |
|
36 | - public function __unset($a) |
|
37 | - { |
|
38 | - return false; |
|
39 | - } |
|
40 | - public function __clone() |
|
41 | - { |
|
42 | - return false; |
|
43 | - } |
|
44 | - public function __wakeup() |
|
45 | - { |
|
46 | - return false; |
|
47 | - } |
|
48 | - public function __destruct() |
|
49 | - { |
|
50 | - return false; |
|
51 | - } |
|
20 | + /** |
|
21 | + * @ override magic methods |
|
22 | + * @ return void |
|
23 | + */ |
|
24 | + public function __set($a, $b) |
|
25 | + { |
|
26 | + return false; |
|
27 | + } |
|
28 | + public function __get($a) |
|
29 | + { |
|
30 | + return false; |
|
31 | + } |
|
32 | + public function __isset($a) |
|
33 | + { |
|
34 | + return false; |
|
35 | + } |
|
36 | + public function __unset($a) |
|
37 | + { |
|
38 | + return false; |
|
39 | + } |
|
40 | + public function __clone() |
|
41 | + { |
|
42 | + return false; |
|
43 | + } |
|
44 | + public function __wakeup() |
|
45 | + { |
|
46 | + return false; |
|
47 | + } |
|
48 | + public function __destruct() |
|
49 | + { |
|
50 | + return false; |
|
51 | + } |
|
52 | 52 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ), |
38 | 38 | $money_value |
39 | 39 | ); |
40 | - $money_value = filter_var( |
|
40 | + $money_value = filter_var( |
|
41 | 41 | $money_value, |
42 | 42 | FILTER_SANITIZE_NUMBER_FLOAT, |
43 | 43 | FILTER_FLAG_ALLOW_FRACTION |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $format = 'f'; |
166 | 166 | $currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
167 | 167 | // first get the decimal place and number of places |
168 | - $format = "%'." . $currency_config->dec_plc . $format; |
|
168 | + $format = "%'.".$currency_config->dec_plc.$format; |
|
169 | 169 | // currency symbol on right side. |
170 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
170 | + $format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
171 | 171 | return $format; |
172 | 172 | } |
173 | 173 | |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
188 | 188 | $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
189 | 189 | // first get the decimal place and number of places |
190 | - $format = '#,##0.' . $decimal_places_placeholder; |
|
190 | + $format = '#,##0.'.$decimal_places_placeholder; |
|
191 | 191 | // currency symbol on right side. |
192 | - $format = $currency_config->sign_b4 |
|
193 | - ? $currency_config->sign . $format |
|
192 | + $format = $currency_config->sign_b4 |
|
193 | + ? $currency_config->sign.$format |
|
194 | 194 | : $format |
195 | 195 | . $currency_config->sign; |
196 | 196 | $formatterObject = array( |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | ? new EE_Currency_Config($CNT_ISO) |
223 | 223 | : null; |
224 | 224 | // default currency settings for site if not set |
225 | - if (! $currency_config instanceof EE_Currency_Config) { |
|
225 | + if ( ! $currency_config instanceof EE_Currency_Config) { |
|
226 | 226 | $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config |
227 | 227 | ? EE_Registry::instance()->CFG->currency |
228 | 228 | : new EE_Currency_Config(); |
@@ -12,221 +12,221 @@ |
||
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 | - } else { |
|
102 | - if ($float1 < $float2) { |
|
103 | - return true; |
|
104 | - } |
|
105 | - } |
|
106 | - break; |
|
107 | - // less than or equal |
|
108 | - case "<=": |
|
109 | - case "lte": |
|
110 | - if (self::compare_floats($float1, $float2, '<') || self::compare_floats($float1, $float2, '=')) { |
|
111 | - return true; |
|
112 | - } |
|
113 | - break; |
|
114 | - // greater than |
|
115 | - case ">": |
|
116 | - case "gt": |
|
117 | - if (abs($float1 - $float2) < $epsilon) { |
|
118 | - return false; |
|
119 | - } else { |
|
120 | - if ($float1 > $float2) { |
|
121 | - return true; |
|
122 | - } |
|
123 | - } |
|
124 | - break; |
|
125 | - // greater than or equal |
|
126 | - case ">=": |
|
127 | - case "gte": |
|
128 | - if (self::compare_floats($float1, $float2, '>') || self::compare_floats($float1, $float2, '=')) { |
|
129 | - return true; |
|
130 | - } |
|
131 | - break; |
|
132 | - case "<>": |
|
133 | - case "!=": |
|
134 | - case "ne": |
|
135 | - if (abs($float1 - $float2) > $epsilon) { |
|
136 | - return true; |
|
137 | - } |
|
138 | - break; |
|
139 | - default: |
|
140 | - throw new EE_Error( |
|
141 | - sprintf( |
|
142 | - esc_html__( |
|
143 | - "Unknown operator %s in EEH_Money::compare_floats()", |
|
144 | - 'event_espresso' |
|
145 | - ), |
|
146 | - $operator |
|
147 | - ) |
|
148 | - ); |
|
149 | - } |
|
150 | - return false; |
|
151 | - } |
|
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 | + } else { |
|
102 | + if ($float1 < $float2) { |
|
103 | + return true; |
|
104 | + } |
|
105 | + } |
|
106 | + break; |
|
107 | + // less than or equal |
|
108 | + case "<=": |
|
109 | + case "lte": |
|
110 | + if (self::compare_floats($float1, $float2, '<') || self::compare_floats($float1, $float2, '=')) { |
|
111 | + return true; |
|
112 | + } |
|
113 | + break; |
|
114 | + // greater than |
|
115 | + case ">": |
|
116 | + case "gt": |
|
117 | + if (abs($float1 - $float2) < $epsilon) { |
|
118 | + return false; |
|
119 | + } else { |
|
120 | + if ($float1 > $float2) { |
|
121 | + return true; |
|
122 | + } |
|
123 | + } |
|
124 | + break; |
|
125 | + // greater than or equal |
|
126 | + case ">=": |
|
127 | + case "gte": |
|
128 | + if (self::compare_floats($float1, $float2, '>') || self::compare_floats($float1, $float2, '=')) { |
|
129 | + return true; |
|
130 | + } |
|
131 | + break; |
|
132 | + case "<>": |
|
133 | + case "!=": |
|
134 | + case "ne": |
|
135 | + if (abs($float1 - $float2) > $epsilon) { |
|
136 | + return true; |
|
137 | + } |
|
138 | + break; |
|
139 | + default: |
|
140 | + throw new EE_Error( |
|
141 | + sprintf( |
|
142 | + esc_html__( |
|
143 | + "Unknown operator %s in EEH_Money::compare_floats()", |
|
144 | + 'event_espresso' |
|
145 | + ), |
|
146 | + $operator |
|
147 | + ) |
|
148 | + ); |
|
149 | + } |
|
150 | + return false; |
|
151 | + } |
|
152 | 152 | |
153 | 153 | |
154 | - /** |
|
155 | - * This returns a localized format string suitable for jQplot. |
|
156 | - * |
|
157 | - * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
158 | - * Otherwise will use currency settings for current active country on site. |
|
159 | - * @return string |
|
160 | - * @throws EE_Error |
|
161 | - */ |
|
162 | - public static function get_format_for_jqplot($CNT_ISO = '') |
|
163 | - { |
|
164 | - // default format |
|
165 | - $format = 'f'; |
|
166 | - $currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
|
167 | - // first get the decimal place and number of places |
|
168 | - $format = "%'." . $currency_config->dec_plc . $format; |
|
169 | - // currency symbol on right side. |
|
170 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
171 | - return $format; |
|
172 | - } |
|
154 | + /** |
|
155 | + * This returns a localized format string suitable for jQplot. |
|
156 | + * |
|
157 | + * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
158 | + * Otherwise will use currency settings for current active country on site. |
|
159 | + * @return string |
|
160 | + * @throws EE_Error |
|
161 | + */ |
|
162 | + public static function get_format_for_jqplot($CNT_ISO = '') |
|
163 | + { |
|
164 | + // default format |
|
165 | + $format = 'f'; |
|
166 | + $currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
|
167 | + // first get the decimal place and number of places |
|
168 | + $format = "%'." . $currency_config->dec_plc . $format; |
|
169 | + // currency symbol on right side. |
|
170 | + $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
171 | + return $format; |
|
172 | + } |
|
173 | 173 | |
174 | 174 | |
175 | - /** |
|
176 | - * This returns a localized format string suitable for usage with the Google Charts API format param. |
|
177 | - * |
|
178 | - * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
179 | - * Otherwise will use currency settings for current active country on site. |
|
180 | - * Note: GoogleCharts uses ICU pattern set |
|
181 | - * (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) |
|
182 | - * @return string |
|
183 | - * @throws EE_Error |
|
184 | - */ |
|
185 | - public static function get_format_for_google_charts($CNT_ISO = '') |
|
186 | - { |
|
187 | - $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
|
188 | - $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
|
189 | - // first get the decimal place and number of places |
|
190 | - $format = '#,##0.' . $decimal_places_placeholder; |
|
191 | - // currency symbol on right side. |
|
192 | - $format = $currency_config->sign_b4 |
|
193 | - ? $currency_config->sign . $format |
|
194 | - : $format |
|
195 | - . $currency_config->sign; |
|
196 | - $formatterObject = array( |
|
197 | - 'decimalSymbol' => $currency_config->dec_mrk, |
|
198 | - 'groupingSymbol' => $currency_config->thsnds, |
|
199 | - 'fractionDigits' => $currency_config->dec_plc, |
|
200 | - ); |
|
201 | - if ($currency_config->sign_b4) { |
|
202 | - $formatterObject['prefix'] = $currency_config->sign; |
|
203 | - } else { |
|
204 | - $formatterObject['suffix'] = $currency_config->sign; |
|
205 | - } |
|
206 | - return array( |
|
207 | - 'format' => $format, |
|
208 | - 'formatterObject' => $formatterObject, |
|
209 | - ); |
|
210 | - } |
|
175 | + /** |
|
176 | + * This returns a localized format string suitable for usage with the Google Charts API format param. |
|
177 | + * |
|
178 | + * @param string $CNT_ISO If this is provided, then will attempt to get the currency settings for the country. |
|
179 | + * Otherwise will use currency settings for current active country on site. |
|
180 | + * Note: GoogleCharts uses ICU pattern set |
|
181 | + * (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) |
|
182 | + * @return string |
|
183 | + * @throws EE_Error |
|
184 | + */ |
|
185 | + public static function get_format_for_google_charts($CNT_ISO = '') |
|
186 | + { |
|
187 | + $currency_config = EEH_Money::get_currency_config($CNT_ISO); |
|
188 | + $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
|
189 | + // first get the decimal place and number of places |
|
190 | + $format = '#,##0.' . $decimal_places_placeholder; |
|
191 | + // currency symbol on right side. |
|
192 | + $format = $currency_config->sign_b4 |
|
193 | + ? $currency_config->sign . $format |
|
194 | + : $format |
|
195 | + . $currency_config->sign; |
|
196 | + $formatterObject = array( |
|
197 | + 'decimalSymbol' => $currency_config->dec_mrk, |
|
198 | + 'groupingSymbol' => $currency_config->thsnds, |
|
199 | + 'fractionDigits' => $currency_config->dec_plc, |
|
200 | + ); |
|
201 | + if ($currency_config->sign_b4) { |
|
202 | + $formatterObject['prefix'] = $currency_config->sign; |
|
203 | + } else { |
|
204 | + $formatterObject['suffix'] = $currency_config->sign; |
|
205 | + } |
|
206 | + return array( |
|
207 | + 'format' => $format, |
|
208 | + 'formatterObject' => $formatterObject, |
|
209 | + ); |
|
210 | + } |
|
211 | 211 | |
212 | 212 | |
213 | - /** |
|
214 | - * @param string $CNT_ISO |
|
215 | - * @return EE_Currency_Config|null |
|
216 | - * @throws EE_Error |
|
217 | - */ |
|
218 | - public static function get_currency_config($CNT_ISO = '') |
|
219 | - { |
|
220 | - // if CNT_ISO passed lets try to get currency settings for it. |
|
221 | - $currency_config = $CNT_ISO !== '' |
|
222 | - ? new EE_Currency_Config($CNT_ISO) |
|
223 | - : null; |
|
224 | - // default currency settings for site if not set |
|
225 | - if (! $currency_config instanceof EE_Currency_Config) { |
|
226 | - $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config |
|
227 | - ? EE_Registry::instance()->CFG->currency |
|
228 | - : new EE_Currency_Config(); |
|
229 | - } |
|
230 | - return $currency_config; |
|
231 | - } |
|
213 | + /** |
|
214 | + * @param string $CNT_ISO |
|
215 | + * @return EE_Currency_Config|null |
|
216 | + * @throws EE_Error |
|
217 | + */ |
|
218 | + public static function get_currency_config($CNT_ISO = '') |
|
219 | + { |
|
220 | + // if CNT_ISO passed lets try to get currency settings for it. |
|
221 | + $currency_config = $CNT_ISO !== '' |
|
222 | + ? new EE_Currency_Config($CNT_ISO) |
|
223 | + : null; |
|
224 | + // default currency settings for site if not set |
|
225 | + if (! $currency_config instanceof EE_Currency_Config) { |
|
226 | + $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config |
|
227 | + ? EE_Registry::instance()->CFG->currency |
|
228 | + : new EE_Currency_Config(); |
|
229 | + } |
|
230 | + return $currency_config; |
|
231 | + } |
|
232 | 232 | } |
@@ -13,70 +13,70 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * $CPT - the current page, if it utilizes CPTs |
|
18 | - * |
|
19 | - * @var object |
|
20 | - * @access protected |
|
21 | - */ |
|
22 | - protected $CPT = null; |
|
16 | + /** |
|
17 | + * $CPT - the current page, if it utilizes CPTs |
|
18 | + * |
|
19 | + * @var object |
|
20 | + * @access protected |
|
21 | + */ |
|
22 | + protected $CPT = null; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * class constructor |
|
27 | - * |
|
28 | - * @access private |
|
29 | - * @param array $arguments |
|
30 | - * @return \EE_CPT_Default_Strategy |
|
31 | - */ |
|
32 | - public function __construct($arguments = array()) |
|
33 | - { |
|
34 | - $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
35 | - } |
|
25 | + /** |
|
26 | + * class constructor |
|
27 | + * |
|
28 | + * @access private |
|
29 | + * @param array $arguments |
|
30 | + * @return \EE_CPT_Default_Strategy |
|
31 | + */ |
|
32 | + public function __construct($arguments = array()) |
|
33 | + { |
|
34 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * pre_get_posts |
|
40 | - * |
|
41 | - * @access public |
|
42 | - * @param \WP_Query $WP_Query |
|
43 | - * @return \WP_Query |
|
44 | - */ |
|
45 | - public function pre_get_posts(WP_Query $WP_Query) |
|
46 | - { |
|
47 | - if (! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
48 | - return $WP_Query; |
|
49 | - } |
|
50 | - return $WP_Query; |
|
51 | - } |
|
38 | + /** |
|
39 | + * pre_get_posts |
|
40 | + * |
|
41 | + * @access public |
|
42 | + * @param \WP_Query $WP_Query |
|
43 | + * @return \WP_Query |
|
44 | + */ |
|
45 | + public function pre_get_posts(WP_Query $WP_Query) |
|
46 | + { |
|
47 | + if (! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
48 | + return $WP_Query; |
|
49 | + } |
|
50 | + return $WP_Query; |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * wp |
|
56 | - * |
|
57 | - * @access public |
|
58 | - * @param \WP_Post[] $posts |
|
59 | - * @param \WP_Query $WP_Query |
|
60 | - * @return \WP_Post[] |
|
61 | - */ |
|
62 | - public function the_posts($posts, WP_Query $WP_Query) |
|
63 | - { |
|
64 | - return $posts; |
|
65 | - } |
|
54 | + /** |
|
55 | + * wp |
|
56 | + * |
|
57 | + * @access public |
|
58 | + * @param \WP_Post[] $posts |
|
59 | + * @param \WP_Query $WP_Query |
|
60 | + * @return \WP_Post[] |
|
61 | + */ |
|
62 | + public function the_posts($posts, WP_Query $WP_Query) |
|
63 | + { |
|
64 | + return $posts; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * get_EE_post_type_metadata |
|
70 | - * |
|
71 | - * @access public |
|
72 | - * @param mixed $meta_value |
|
73 | - * @param int $post_id |
|
74 | - * @param string $meta_key |
|
75 | - * @param string $single |
|
76 | - * @return mixed |
|
77 | - */ |
|
78 | - public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) |
|
79 | - { |
|
80 | - return $meta_value; |
|
81 | - } |
|
68 | + /** |
|
69 | + * get_EE_post_type_metadata |
|
70 | + * |
|
71 | + * @access public |
|
72 | + * @param mixed $meta_value |
|
73 | + * @param int $post_id |
|
74 | + * @param string $meta_key |
|
75 | + * @param string $single |
|
76 | + * @return mixed |
|
77 | + */ |
|
78 | + public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) |
|
79 | + { |
|
80 | + return $meta_value; |
|
81 | + } |
|
82 | 82 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function pre_get_posts(WP_Query $WP_Query) |
46 | 46 | { |
47 | - if (! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
47 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
48 | 48 | return $WP_Query; |
49 | 49 | } |
50 | 50 | return $WP_Query; |
@@ -24,39 +24,39 @@ |
||
24 | 24 | class EE_CPT_Attendee_Strategy |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * $CPT - the current page, if it utilizes CPTs |
|
29 | - * |
|
30 | - * @var array |
|
31 | - * @access protected |
|
32 | - */ |
|
33 | - protected $CPT = null; |
|
27 | + /** |
|
28 | + * $CPT - the current page, if it utilizes CPTs |
|
29 | + * |
|
30 | + * @var array |
|
31 | + * @access protected |
|
32 | + */ |
|
33 | + protected $CPT = null; |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * class constructor |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * @param array $arguments |
|
41 | - * @return \EE_CPT_Attendee_Strategy |
|
42 | - */ |
|
43 | - public function __construct($arguments = array()) |
|
44 | - { |
|
45 | - $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
46 | - $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : null; |
|
47 | - } |
|
36 | + /** |
|
37 | + * class constructor |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * @param array $arguments |
|
41 | + * @return \EE_CPT_Attendee_Strategy |
|
42 | + */ |
|
43 | + public function __construct($arguments = array()) |
|
44 | + { |
|
45 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
46 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : null; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * the_posts |
|
52 | - * |
|
53 | - * @access public |
|
54 | - * @param $posts |
|
55 | - * @param WP_Query $wp_query |
|
56 | - * @return void |
|
57 | - */ |
|
58 | - public function the_posts($posts, WP_Query $wp_query) |
|
59 | - { |
|
60 | - return $posts; |
|
61 | - } |
|
50 | + /** |
|
51 | + * the_posts |
|
52 | + * |
|
53 | + * @access public |
|
54 | + * @param $posts |
|
55 | + * @param WP_Query $wp_query |
|
56 | + * @return void |
|
57 | + */ |
|
58 | + public function the_posts($posts, WP_Query $wp_query) |
|
59 | + { |
|
60 | + return $posts; |
|
61 | + } |
|
62 | 62 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | public static function getInvalidCheckoutAccess() |
62 | 62 | { |
63 | - if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
63 | + if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
64 | 64 | self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
65 | 65 | } |
66 | 66 | return self::$invalid_checkout_access_form; |
@@ -14,84 +14,84 @@ |
||
14 | 14 | class EED_Invalid_Checkout_Access extends EED_Module |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @var InvalidCheckoutAccess $invalid_checkout_access_form |
|
19 | - */ |
|
20 | - private static $invalid_checkout_access_form; |
|
17 | + /** |
|
18 | + * @var InvalidCheckoutAccess $invalid_checkout_access_form |
|
19 | + */ |
|
20 | + private static $invalid_checkout_access_form; |
|
21 | 21 | |
22 | - /** |
|
23 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
24 | - */ |
|
25 | - public static function set_hooks() |
|
26 | - { |
|
27 | - } |
|
22 | + /** |
|
23 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
24 | + */ |
|
25 | + public static function set_hooks() |
|
26 | + { |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
32 | - */ |
|
33 | - public static function set_hooks_admin() |
|
34 | - { |
|
35 | - add_action( |
|
36 | - 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
37 | - array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'), |
|
38 | - 15 |
|
39 | - ); |
|
40 | - add_filter( |
|
41 | - 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
42 | - array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form') |
|
43 | - ); |
|
44 | - } |
|
30 | + /** |
|
31 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
32 | + */ |
|
33 | + public static function set_hooks_admin() |
|
34 | + { |
|
35 | + add_action( |
|
36 | + 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
37 | + array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'), |
|
38 | + 15 |
|
39 | + ); |
|
40 | + add_filter( |
|
41 | + 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
42 | + array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form') |
|
43 | + ); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * run - initial module setup |
|
49 | - * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
50 | - * |
|
51 | - * @var WP $WP |
|
52 | - */ |
|
53 | - public function run($WP) |
|
54 | - { |
|
55 | - // TODO: Implement run() method. |
|
56 | - } |
|
47 | + /** |
|
48 | + * run - initial module setup |
|
49 | + * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
50 | + * |
|
51 | + * @var WP $WP |
|
52 | + */ |
|
53 | + public function run($WP) |
|
54 | + { |
|
55 | + // TODO: Implement run() method. |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @return InvalidCheckoutAccess |
|
61 | - */ |
|
62 | - public static function getInvalidCheckoutAccess() |
|
63 | - { |
|
64 | - if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
65 | - self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
|
66 | - } |
|
67 | - return self::$invalid_checkout_access_form; |
|
68 | - } |
|
59 | + /** |
|
60 | + * @return InvalidCheckoutAccess |
|
61 | + */ |
|
62 | + public static function getInvalidCheckoutAccess() |
|
63 | + { |
|
64 | + if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
65 | + self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
|
66 | + } |
|
67 | + return self::$invalid_checkout_access_form; |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * email_validation_settings_form |
|
73 | - * |
|
74 | - * @return void |
|
75 | - * @throws EE_Error |
|
76 | - */ |
|
77 | - public static function display_invalid_checkout_access_form() |
|
78 | - { |
|
79 | - $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
80 | - echo wp_kses($invalid_checkout_access_form->getForm()->get_html(), AllowedTags::getWithFormTags()); |
|
81 | - } |
|
71 | + /** |
|
72 | + * email_validation_settings_form |
|
73 | + * |
|
74 | + * @return void |
|
75 | + * @throws EE_Error |
|
76 | + */ |
|
77 | + public static function display_invalid_checkout_access_form() |
|
78 | + { |
|
79 | + $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
80 | + echo wp_kses($invalid_checkout_access_form->getForm()->get_html(), AllowedTags::getWithFormTags()); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | - /** |
|
85 | - * email_validation_settings_form |
|
86 | - * |
|
87 | - * @param EE_Registration_Config $EE_Registration_Config |
|
88 | - * @return EE_Registration_Config |
|
89 | - * @throws EE_Error |
|
90 | - * @throws ReflectionException |
|
91 | - */ |
|
92 | - public static function process_invalid_checkout_access_form(EE_Registration_Config $EE_Registration_Config) |
|
93 | - { |
|
94 | - $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
95 | - return $invalid_checkout_access_form->processForm($EE_Registration_Config); |
|
96 | - } |
|
84 | + /** |
|
85 | + * email_validation_settings_form |
|
86 | + * |
|
87 | + * @param EE_Registration_Config $EE_Registration_Config |
|
88 | + * @return EE_Registration_Config |
|
89 | + * @throws EE_Error |
|
90 | + * @throws ReflectionException |
|
91 | + */ |
|
92 | + public static function process_invalid_checkout_access_form(EE_Registration_Config $EE_Registration_Config) |
|
93 | + { |
|
94 | + $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
95 | + return $invalid_checkout_access_form->processForm($EE_Registration_Config); |
|
96 | + } |
|
97 | 97 | } |
@@ -12,69 +12,69 @@ |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * @return EED_Csv |
|
17 | - */ |
|
18 | - public static function instance() |
|
19 | - { |
|
20 | - return parent::get_instance(__CLASS__); |
|
21 | - } |
|
15 | + /** |
|
16 | + * @return EED_Csv |
|
17 | + */ |
|
18 | + public static function instance() |
|
19 | + { |
|
20 | + return parent::get_instance(__CLASS__); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
26 | - * |
|
27 | - * @access public |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public static function set_hooks() |
|
31 | - { |
|
32 | - } |
|
24 | + /** |
|
25 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
26 | + * |
|
27 | + * @access public |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public static function set_hooks() |
|
31 | + { |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
36 | - * |
|
37 | - * @access public |
|
38 | - * @return void |
|
39 | - */ |
|
40 | - public static function set_hooks_admin() |
|
41 | - { |
|
42 | - } |
|
34 | + /** |
|
35 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
36 | + * |
|
37 | + * @access public |
|
38 | + * @return void |
|
39 | + */ |
|
40 | + public static function set_hooks_admin() |
|
41 | + { |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * run - initial module setup |
|
47 | - * |
|
48 | - * @access public |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function run($WP) |
|
52 | - { |
|
53 | - } |
|
45 | + /** |
|
46 | + * run - initial module setup |
|
47 | + * |
|
48 | + * @access public |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function run($WP) |
|
52 | + { |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * export |
|
58 | - * |
|
59 | - * @access public |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - public function export() |
|
63 | - { |
|
64 | - $Export = EE_Registry::instance()->load_class('Export'); |
|
65 | - $Export->export(); |
|
66 | - } |
|
56 | + /** |
|
57 | + * export |
|
58 | + * |
|
59 | + * @access public |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + public function export() |
|
63 | + { |
|
64 | + $Export = EE_Registry::instance()->load_class('Export'); |
|
65 | + $Export->export(); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | - /** |
|
70 | - * import |
|
71 | - * |
|
72 | - * @access public |
|
73 | - * @return void |
|
74 | - */ |
|
75 | - public function import() |
|
76 | - { |
|
77 | - $Import = EE_Registry::instance()->load_class('Import'); |
|
78 | - $Import->import(); |
|
79 | - } |
|
69 | + /** |
|
70 | + * import |
|
71 | + * |
|
72 | + * @access public |
|
73 | + * @return void |
|
74 | + */ |
|
75 | + public function import() |
|
76 | + { |
|
77 | + $Import = EE_Registry::instance()->load_class('Import'); |
|
78 | + $Import->import(); |
|
79 | + } |
|
80 | 80 | } |
@@ -3,13 +3,13 @@ |
||
3 | 3 | // if this is decaf, which is put on WordPress.org, we need to inform users that |
4 | 4 | // we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12 |
5 | 5 | if (apply_filters('FHEE__ee_show_affiliate_links', true)) { |
6 | - $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso'); |
|
6 | + $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso'); |
|
7 | 7 | } |
8 | 8 | printf( |
9 | - esc_html__( |
|
10 | - 'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
11 | - 'event_espresso' |
|
12 | - ), |
|
13 | - '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', |
|
14 | - $closing_tag |
|
9 | + esc_html__( |
|
10 | + 'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
11 | + 'event_espresso' |
|
12 | + ), |
|
13 | + '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', |
|
14 | + $closing_tag |
|
15 | 15 | ); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $limit = array($offset, $per_page); |
217 | 217 | |
218 | 218 | if (isset($this->_req_data['s'])) { |
219 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
219 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
220 | 220 | $_where['OR'] = array( |
221 | 221 | 'TKT_name' => array('LIKE', $sstr), |
222 | 222 | 'TKT_description' => array('LIKE', $sstr), |
@@ -245,18 +245,18 @@ discard block |
||
245 | 245 | $TKT = EEM_Ticket::instance(); |
246 | 246 | |
247 | 247 | // checkboxes? |
248 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
248 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
249 | 249 | // if array has more than one element then success message should be plural |
250 | 250 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
251 | 251 | |
252 | 252 | // cycle thru the boxes |
253 | 253 | while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
254 | 254 | if ($trash) { |
255 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
255 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
256 | 256 | $success = 0; |
257 | 257 | } |
258 | 258 | } else { |
259 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
259 | + if ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
260 | 260 | $success = 0; |
261 | 261 | } |
262 | 262 | } |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
267 | 267 | |
268 | 268 | if ($trash) { |
269 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
269 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
270 | 270 | $success = 0; |
271 | 271 | } |
272 | 272 | } else { |
273 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
273 | + if ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
274 | 274 | $success = 0; |
275 | 275 | } |
276 | 276 | } |
@@ -288,21 +288,21 @@ discard block |
||
288 | 288 | $TKT = EEM_Ticket::instance(); |
289 | 289 | |
290 | 290 | // checkboxes? |
291 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
291 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
292 | 292 | // if array has more than one element then success message should be plural |
293 | 293 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
294 | 294 | |
295 | 295 | // cycle thru the boxes |
296 | 296 | while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
297 | 297 | // delete |
298 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
298 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
299 | 299 | $success = 0; |
300 | 300 | } |
301 | 301 | } |
302 | 302 | } else { |
303 | 303 | // grab single id and trash |
304 | 304 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
305 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
305 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
306 | 306 | $success = 0; |
307 | 307 | } |
308 | 308 | } |
@@ -13,312 +13,312 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - protected function _init_page_props() |
|
17 | - { |
|
18 | - $this->page_slug = TICKETS_PG_SLUG; |
|
19 | - $this->page_label = TICKETS_LABEL; |
|
20 | - $this->_admin_base_url = TICKETS_ADMIN_URL; |
|
21 | - $this->_admin_base_path = TICKETS_ADMIN; |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - protected function _ajax_hooks() |
|
26 | - { |
|
27 | - } |
|
28 | - |
|
29 | - |
|
30 | - protected function _define_page_props() |
|
31 | - { |
|
32 | - $this->_admin_page_title = TICKETS_LABEL; |
|
33 | - $this->_labels = array( |
|
34 | - 'buttons' => array( |
|
35 | - 'add' => esc_html__('Add New Default Ticket', 'event_espresso'), |
|
36 | - 'edit' => esc_html__('Edit Default Ticket', 'event_espresso'), |
|
37 | - 'delete' => esc_html__('Delete Default Ticket', 'event_espresso'), |
|
38 | - ), |
|
39 | - ); |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - protected function _set_page_routes() |
|
44 | - { |
|
45 | - |
|
46 | - $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
47 | - ? $this->_req_data['TKT_ID'] : 0; |
|
48 | - |
|
49 | - $this->_page_routes = array( |
|
50 | - 'default' => array( |
|
51 | - 'func' => '_tickets_overview_list_table', |
|
52 | - 'capability' => 'ee_read_default_tickets', |
|
53 | - ), |
|
54 | - 'trash_ticket' => array( |
|
55 | - 'func' => '_trash_or_restore_ticket', |
|
56 | - 'noheader' => true, |
|
57 | - 'args' => array('trash' => true), |
|
58 | - 'capability' => 'ee_delete_default_ticket', |
|
59 | - 'obj_id' => $tkt_id, |
|
60 | - ), |
|
61 | - 'trash_tickets' => array( |
|
62 | - 'func' => '_trash_or_restore_ticket', |
|
63 | - 'noheader' => true, |
|
64 | - 'args' => array('trash' => true), |
|
65 | - 'capability' => 'ee_delete_default_tickets', |
|
66 | - ), |
|
67 | - 'restore_ticket' => array( |
|
68 | - 'func' => '_trash_or_restore_ticket', |
|
69 | - 'noheader' => true, |
|
70 | - 'capability' => 'ee_delete_default_ticket', |
|
71 | - 'obj_id' => $tkt_id, |
|
72 | - ), |
|
73 | - 'restore_tickets' => array( |
|
74 | - 'func' => '_trash_or_restore_ticket', |
|
75 | - 'noheader' => true, |
|
76 | - 'capability' => 'ee_delete_default_tickets', |
|
77 | - ), |
|
78 | - 'delete_ticket' => array( |
|
79 | - 'func' => '_delete_ticket', |
|
80 | - 'noheader' => true, |
|
81 | - 'capability' => 'ee_delete_default_ticket', |
|
82 | - 'obj_id' => $tkt_id, |
|
83 | - ), |
|
84 | - 'delete_tickets' => array( |
|
85 | - 'func' => '_delete_ticket', |
|
86 | - 'noheader' => true, |
|
87 | - 'capability' => 'ee_delete_default_tickets', |
|
88 | - ), |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - protected function _set_page_config() |
|
94 | - { |
|
95 | - $this->_page_config = array( |
|
96 | - 'default' => array( |
|
97 | - 'nav' => array( |
|
98 | - 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
99 | - 'order' => 10, |
|
100 | - ), |
|
101 | - 'list_table' => 'Tickets_List_Table', |
|
102 | - 'require_nonce' => false, |
|
103 | - ), |
|
104 | - ); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - protected function _add_screen_options() |
|
109 | - { |
|
110 | - } |
|
111 | - |
|
112 | - protected function _add_screen_options_default() |
|
113 | - { |
|
114 | - $this->_per_page_screen_option(); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - protected function _add_feature_pointers() |
|
119 | - { |
|
120 | - } |
|
121 | - |
|
122 | - public function load_scripts_styles() |
|
123 | - { |
|
124 | - } |
|
125 | - |
|
126 | - public function load_scripts_styles_default() |
|
127 | - { |
|
128 | - } |
|
129 | - |
|
130 | - public function admin_footer_scripts() |
|
131 | - { |
|
132 | - } |
|
133 | - |
|
134 | - public function admin_init() |
|
135 | - { |
|
136 | - } |
|
137 | - |
|
138 | - public function admin_notices() |
|
139 | - { |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - public function _set_list_table_views_default() |
|
144 | - { |
|
145 | - $this->_views = array( |
|
146 | - 'all' => array( |
|
147 | - 'slug' => 'all', |
|
148 | - 'label' => esc_html__('All', 'event_espresso'), |
|
149 | - 'count' => 0, |
|
150 | - 'bulk_action' => array( |
|
151 | - 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
152 | - ), |
|
153 | - ), |
|
154 | - 'trashed' => array( |
|
155 | - 'slug' => 'trashed', |
|
156 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
157 | - 'count' => 0, |
|
158 | - 'bulk_action' => array( |
|
159 | - 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
160 | - 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
161 | - ), |
|
162 | - ), |
|
163 | - ); |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - public function _tickets_overview_list_table() |
|
168 | - { |
|
169 | - $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
170 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
175 | - { |
|
176 | - |
|
177 | - $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
178 | - $order = empty($this->_req_data['order']) ? 'ASC' : $order; |
|
179 | - |
|
180 | - switch ($orderby) { |
|
181 | - case 'TKT_name': |
|
182 | - $orderby = array('TKT_name' => $order); |
|
183 | - break; |
|
184 | - |
|
185 | - case 'TKT_price': |
|
186 | - $orderby = array('TKT_price' => $order); |
|
187 | - break; |
|
188 | - |
|
189 | - case 'TKT_uses': |
|
190 | - $orderby = array('TKT_uses' => $order); |
|
191 | - break; |
|
192 | - |
|
193 | - case 'TKT_min': |
|
194 | - $orderby = array('TKT_min' => $order); |
|
195 | - break; |
|
196 | - |
|
197 | - case 'TKT_max': |
|
198 | - $orderby = array('TKT_max' => $order); |
|
199 | - break; |
|
200 | - |
|
201 | - case 'TKT_qty': |
|
202 | - $orderby = array('TKT_qty' => $order); |
|
203 | - break; |
|
204 | - } |
|
205 | - |
|
206 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
207 | - ? $this->_req_data['paged'] : 1; |
|
208 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
209 | - ? $this->_req_data['perpage'] : $per_page; |
|
210 | - |
|
211 | - $_where = array( |
|
212 | - 'TKT_is_default' => 1, |
|
213 | - 'TKT_deleted' => $trashed, |
|
214 | - ); |
|
215 | - |
|
216 | - $offset = ($current_page - 1) * $per_page; |
|
217 | - $limit = array($offset, $per_page); |
|
218 | - |
|
219 | - if (isset($this->_req_data['s'])) { |
|
220 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
221 | - $_where['OR'] = array( |
|
222 | - 'TKT_name' => array('LIKE', $sstr), |
|
223 | - 'TKT_description' => array('LIKE', $sstr), |
|
224 | - ); |
|
225 | - } |
|
226 | - |
|
227 | - $query_params = array( |
|
228 | - $_where, |
|
229 | - 'order_by' => $orderby, |
|
230 | - 'limit' => $limit, |
|
231 | - 'group_by' => 'TKT_ID', |
|
232 | - ); |
|
233 | - |
|
234 | - if ($count) { |
|
235 | - return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
|
236 | - } else { |
|
237 | - return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
238 | - } |
|
239 | - } |
|
240 | - |
|
241 | - |
|
242 | - protected function _trash_or_restore_ticket($trash = false) |
|
243 | - { |
|
244 | - $success = 1; |
|
245 | - |
|
246 | - $TKT = EEM_Ticket::instance(); |
|
247 | - |
|
248 | - // checkboxes? |
|
249 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
250 | - // if array has more than one element then success message should be plural |
|
251 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
252 | - |
|
253 | - // cycle thru the boxes |
|
254 | - while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
255 | - if ($trash) { |
|
256 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
257 | - $success = 0; |
|
258 | - } |
|
259 | - } else { |
|
260 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
261 | - $success = 0; |
|
262 | - } |
|
263 | - } |
|
264 | - } |
|
265 | - } else { |
|
266 | - // grab single id and trash |
|
267 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
268 | - |
|
269 | - if ($trash) { |
|
270 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
271 | - $success = 0; |
|
272 | - } |
|
273 | - } else { |
|
274 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
275 | - $success = 0; |
|
276 | - } |
|
277 | - } |
|
278 | - } |
|
279 | - |
|
280 | - $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
281 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
282 | - } |
|
283 | - |
|
284 | - |
|
285 | - protected function _delete_ticket() |
|
286 | - { |
|
287 | - $success = 1; |
|
288 | - |
|
289 | - $TKT = EEM_Ticket::instance(); |
|
290 | - |
|
291 | - // checkboxes? |
|
292 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
293 | - // if array has more than one element then success message should be plural |
|
294 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
295 | - |
|
296 | - // cycle thru the boxes |
|
297 | - while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
298 | - // delete |
|
299 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
300 | - $success = 0; |
|
301 | - } |
|
302 | - } |
|
303 | - } else { |
|
304 | - // grab single id and trash |
|
305 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
306 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
307 | - $success = 0; |
|
308 | - } |
|
309 | - } |
|
310 | - |
|
311 | - $action_desc = 'deleted'; |
|
312 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
313 | - } |
|
314 | - |
|
315 | - |
|
316 | - protected function _delete_the_ticket($TKT_ID) |
|
317 | - { |
|
318 | - $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
319 | - |
|
320 | - // delete all related prices first |
|
321 | - $tkt->delete_related_permanently('Price'); |
|
322 | - return $tkt->delete_permanently(); |
|
323 | - } |
|
16 | + protected function _init_page_props() |
|
17 | + { |
|
18 | + $this->page_slug = TICKETS_PG_SLUG; |
|
19 | + $this->page_label = TICKETS_LABEL; |
|
20 | + $this->_admin_base_url = TICKETS_ADMIN_URL; |
|
21 | + $this->_admin_base_path = TICKETS_ADMIN; |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + protected function _ajax_hooks() |
|
26 | + { |
|
27 | + } |
|
28 | + |
|
29 | + |
|
30 | + protected function _define_page_props() |
|
31 | + { |
|
32 | + $this->_admin_page_title = TICKETS_LABEL; |
|
33 | + $this->_labels = array( |
|
34 | + 'buttons' => array( |
|
35 | + 'add' => esc_html__('Add New Default Ticket', 'event_espresso'), |
|
36 | + 'edit' => esc_html__('Edit Default Ticket', 'event_espresso'), |
|
37 | + 'delete' => esc_html__('Delete Default Ticket', 'event_espresso'), |
|
38 | + ), |
|
39 | + ); |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + protected function _set_page_routes() |
|
44 | + { |
|
45 | + |
|
46 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
47 | + ? $this->_req_data['TKT_ID'] : 0; |
|
48 | + |
|
49 | + $this->_page_routes = array( |
|
50 | + 'default' => array( |
|
51 | + 'func' => '_tickets_overview_list_table', |
|
52 | + 'capability' => 'ee_read_default_tickets', |
|
53 | + ), |
|
54 | + 'trash_ticket' => array( |
|
55 | + 'func' => '_trash_or_restore_ticket', |
|
56 | + 'noheader' => true, |
|
57 | + 'args' => array('trash' => true), |
|
58 | + 'capability' => 'ee_delete_default_ticket', |
|
59 | + 'obj_id' => $tkt_id, |
|
60 | + ), |
|
61 | + 'trash_tickets' => array( |
|
62 | + 'func' => '_trash_or_restore_ticket', |
|
63 | + 'noheader' => true, |
|
64 | + 'args' => array('trash' => true), |
|
65 | + 'capability' => 'ee_delete_default_tickets', |
|
66 | + ), |
|
67 | + 'restore_ticket' => array( |
|
68 | + 'func' => '_trash_or_restore_ticket', |
|
69 | + 'noheader' => true, |
|
70 | + 'capability' => 'ee_delete_default_ticket', |
|
71 | + 'obj_id' => $tkt_id, |
|
72 | + ), |
|
73 | + 'restore_tickets' => array( |
|
74 | + 'func' => '_trash_or_restore_ticket', |
|
75 | + 'noheader' => true, |
|
76 | + 'capability' => 'ee_delete_default_tickets', |
|
77 | + ), |
|
78 | + 'delete_ticket' => array( |
|
79 | + 'func' => '_delete_ticket', |
|
80 | + 'noheader' => true, |
|
81 | + 'capability' => 'ee_delete_default_ticket', |
|
82 | + 'obj_id' => $tkt_id, |
|
83 | + ), |
|
84 | + 'delete_tickets' => array( |
|
85 | + 'func' => '_delete_ticket', |
|
86 | + 'noheader' => true, |
|
87 | + 'capability' => 'ee_delete_default_tickets', |
|
88 | + ), |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + protected function _set_page_config() |
|
94 | + { |
|
95 | + $this->_page_config = array( |
|
96 | + 'default' => array( |
|
97 | + 'nav' => array( |
|
98 | + 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
99 | + 'order' => 10, |
|
100 | + ), |
|
101 | + 'list_table' => 'Tickets_List_Table', |
|
102 | + 'require_nonce' => false, |
|
103 | + ), |
|
104 | + ); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + protected function _add_screen_options() |
|
109 | + { |
|
110 | + } |
|
111 | + |
|
112 | + protected function _add_screen_options_default() |
|
113 | + { |
|
114 | + $this->_per_page_screen_option(); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + protected function _add_feature_pointers() |
|
119 | + { |
|
120 | + } |
|
121 | + |
|
122 | + public function load_scripts_styles() |
|
123 | + { |
|
124 | + } |
|
125 | + |
|
126 | + public function load_scripts_styles_default() |
|
127 | + { |
|
128 | + } |
|
129 | + |
|
130 | + public function admin_footer_scripts() |
|
131 | + { |
|
132 | + } |
|
133 | + |
|
134 | + public function admin_init() |
|
135 | + { |
|
136 | + } |
|
137 | + |
|
138 | + public function admin_notices() |
|
139 | + { |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + public function _set_list_table_views_default() |
|
144 | + { |
|
145 | + $this->_views = array( |
|
146 | + 'all' => array( |
|
147 | + 'slug' => 'all', |
|
148 | + 'label' => esc_html__('All', 'event_espresso'), |
|
149 | + 'count' => 0, |
|
150 | + 'bulk_action' => array( |
|
151 | + 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
152 | + ), |
|
153 | + ), |
|
154 | + 'trashed' => array( |
|
155 | + 'slug' => 'trashed', |
|
156 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
157 | + 'count' => 0, |
|
158 | + 'bulk_action' => array( |
|
159 | + 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
160 | + 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
161 | + ), |
|
162 | + ), |
|
163 | + ); |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + public function _tickets_overview_list_table() |
|
168 | + { |
|
169 | + $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
170 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
175 | + { |
|
176 | + |
|
177 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
178 | + $order = empty($this->_req_data['order']) ? 'ASC' : $order; |
|
179 | + |
|
180 | + switch ($orderby) { |
|
181 | + case 'TKT_name': |
|
182 | + $orderby = array('TKT_name' => $order); |
|
183 | + break; |
|
184 | + |
|
185 | + case 'TKT_price': |
|
186 | + $orderby = array('TKT_price' => $order); |
|
187 | + break; |
|
188 | + |
|
189 | + case 'TKT_uses': |
|
190 | + $orderby = array('TKT_uses' => $order); |
|
191 | + break; |
|
192 | + |
|
193 | + case 'TKT_min': |
|
194 | + $orderby = array('TKT_min' => $order); |
|
195 | + break; |
|
196 | + |
|
197 | + case 'TKT_max': |
|
198 | + $orderby = array('TKT_max' => $order); |
|
199 | + break; |
|
200 | + |
|
201 | + case 'TKT_qty': |
|
202 | + $orderby = array('TKT_qty' => $order); |
|
203 | + break; |
|
204 | + } |
|
205 | + |
|
206 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
207 | + ? $this->_req_data['paged'] : 1; |
|
208 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
209 | + ? $this->_req_data['perpage'] : $per_page; |
|
210 | + |
|
211 | + $_where = array( |
|
212 | + 'TKT_is_default' => 1, |
|
213 | + 'TKT_deleted' => $trashed, |
|
214 | + ); |
|
215 | + |
|
216 | + $offset = ($current_page - 1) * $per_page; |
|
217 | + $limit = array($offset, $per_page); |
|
218 | + |
|
219 | + if (isset($this->_req_data['s'])) { |
|
220 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
221 | + $_where['OR'] = array( |
|
222 | + 'TKT_name' => array('LIKE', $sstr), |
|
223 | + 'TKT_description' => array('LIKE', $sstr), |
|
224 | + ); |
|
225 | + } |
|
226 | + |
|
227 | + $query_params = array( |
|
228 | + $_where, |
|
229 | + 'order_by' => $orderby, |
|
230 | + 'limit' => $limit, |
|
231 | + 'group_by' => 'TKT_ID', |
|
232 | + ); |
|
233 | + |
|
234 | + if ($count) { |
|
235 | + return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
|
236 | + } else { |
|
237 | + return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
238 | + } |
|
239 | + } |
|
240 | + |
|
241 | + |
|
242 | + protected function _trash_or_restore_ticket($trash = false) |
|
243 | + { |
|
244 | + $success = 1; |
|
245 | + |
|
246 | + $TKT = EEM_Ticket::instance(); |
|
247 | + |
|
248 | + // checkboxes? |
|
249 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
250 | + // if array has more than one element then success message should be plural |
|
251 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
252 | + |
|
253 | + // cycle thru the boxes |
|
254 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
255 | + if ($trash) { |
|
256 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
257 | + $success = 0; |
|
258 | + } |
|
259 | + } else { |
|
260 | + if (! $TKT->restore_by_ID($TKT_ID)) { |
|
261 | + $success = 0; |
|
262 | + } |
|
263 | + } |
|
264 | + } |
|
265 | + } else { |
|
266 | + // grab single id and trash |
|
267 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
268 | + |
|
269 | + if ($trash) { |
|
270 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
271 | + $success = 0; |
|
272 | + } |
|
273 | + } else { |
|
274 | + if (! $TKT->restore_by_ID($TKT_ID)) { |
|
275 | + $success = 0; |
|
276 | + } |
|
277 | + } |
|
278 | + } |
|
279 | + |
|
280 | + $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
281 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
282 | + } |
|
283 | + |
|
284 | + |
|
285 | + protected function _delete_ticket() |
|
286 | + { |
|
287 | + $success = 1; |
|
288 | + |
|
289 | + $TKT = EEM_Ticket::instance(); |
|
290 | + |
|
291 | + // checkboxes? |
|
292 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
293 | + // if array has more than one element then success message should be plural |
|
294 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
295 | + |
|
296 | + // cycle thru the boxes |
|
297 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
298 | + // delete |
|
299 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
300 | + $success = 0; |
|
301 | + } |
|
302 | + } |
|
303 | + } else { |
|
304 | + // grab single id and trash |
|
305 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
306 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
307 | + $success = 0; |
|
308 | + } |
|
309 | + } |
|
310 | + |
|
311 | + $action_desc = 'deleted'; |
|
312 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
313 | + } |
|
314 | + |
|
315 | + |
|
316 | + protected function _delete_the_ticket($TKT_ID) |
|
317 | + { |
|
318 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
319 | + |
|
320 | + // delete all related prices first |
|
321 | + $tkt->delete_related_permanently('Price'); |
|
322 | + return $tkt->delete_permanently(); |
|
323 | + } |
|
324 | 324 | } |
@@ -12,71 +12,71 @@ |
||
12 | 12 | class Extend_Support_Admin_Page extends Support_Admin_Page |
13 | 13 | { |
14 | 14 | |
15 | - public function __construct($routing = true) |
|
16 | - { |
|
17 | - parent::__construct($routing); |
|
18 | - define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/'); |
|
19 | - } |
|
15 | + public function __construct($routing = true) |
|
16 | + { |
|
17 | + parent::__construct($routing); |
|
18 | + define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/'); |
|
19 | + } |
|
20 | 20 | |
21 | 21 | |
22 | - protected function _extend_page_config() |
|
23 | - { |
|
24 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support'; |
|
25 | - // new routes and new configs (or overrides ) |
|
26 | - $new_page_routes = array( |
|
27 | - 'faq' => array( |
|
28 | - 'func' => '_faq', |
|
29 | - 'capability' => 'ee_read_ee', |
|
30 | - ), |
|
31 | - ); |
|
32 | - $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
33 | - $new_page_config = array( |
|
34 | - 'faq' => array( |
|
35 | - 'nav' => array( |
|
36 | - 'label' => esc_html__('FAQ', 'event_espresso'), |
|
37 | - 'order' => 40, |
|
38 | - ), |
|
39 | - 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
40 | - 'require_nonce' => false, |
|
41 | - ), |
|
42 | - ); |
|
43 | - $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
44 | - $this->_page_config['default']['metaboxes'][] = '_installation_boxes'; |
|
45 | - } |
|
22 | + protected function _extend_page_config() |
|
23 | + { |
|
24 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support'; |
|
25 | + // new routes and new configs (or overrides ) |
|
26 | + $new_page_routes = array( |
|
27 | + 'faq' => array( |
|
28 | + 'func' => '_faq', |
|
29 | + 'capability' => 'ee_read_ee', |
|
30 | + ), |
|
31 | + ); |
|
32 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
33 | + $new_page_config = array( |
|
34 | + 'faq' => array( |
|
35 | + 'nav' => array( |
|
36 | + 'label' => esc_html__('FAQ', 'event_espresso'), |
|
37 | + 'order' => 40, |
|
38 | + ), |
|
39 | + 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
40 | + 'require_nonce' => false, |
|
41 | + ), |
|
42 | + ); |
|
43 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
44 | + $this->_page_config['default']['metaboxes'][] = '_installation_boxes'; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - protected function _faq() |
|
49 | - { |
|
50 | - $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php'; |
|
51 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
52 | - $template_path, |
|
53 | - '', |
|
54 | - true |
|
55 | - ); |
|
56 | - $this->display_admin_page_with_sidebar(); |
|
57 | - } |
|
48 | + protected function _faq() |
|
49 | + { |
|
50 | + $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php'; |
|
51 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
52 | + $template_path, |
|
53 | + '', |
|
54 | + true |
|
55 | + ); |
|
56 | + $this->display_admin_page_with_sidebar(); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | - protected function _installation_boxes() |
|
61 | - { |
|
62 | - $callback_args = array( |
|
63 | - 'template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH |
|
64 | - . 'support_admin_details_additional_information.template.php', |
|
65 | - ); |
|
66 | - add_meta_box( |
|
67 | - 'espresso_additional_information_support', |
|
68 | - esc_html__('Additional Information', 'event_espresso'), |
|
69 | - function ($post, $metabox) { |
|
70 | - echo EEH_Template::display_template( |
|
71 | - $metabox['args']['template_path'], |
|
72 | - '', |
|
73 | - true |
|
74 | - ); |
|
75 | - }, |
|
76 | - $this->_current_screen->id, |
|
77 | - 'normal', |
|
78 | - 'high', |
|
79 | - $callback_args |
|
80 | - ); |
|
81 | - } |
|
60 | + protected function _installation_boxes() |
|
61 | + { |
|
62 | + $callback_args = array( |
|
63 | + 'template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH |
|
64 | + . 'support_admin_details_additional_information.template.php', |
|
65 | + ); |
|
66 | + add_meta_box( |
|
67 | + 'espresso_additional_information_support', |
|
68 | + esc_html__('Additional Information', 'event_espresso'), |
|
69 | + function ($post, $metabox) { |
|
70 | + echo EEH_Template::display_template( |
|
71 | + $metabox['args']['template_path'], |
|
72 | + '', |
|
73 | + true |
|
74 | + ); |
|
75 | + }, |
|
76 | + $this->_current_screen->id, |
|
77 | + 'normal', |
|
78 | + 'high', |
|
79 | + $callback_args |
|
80 | + ); |
|
81 | + } |
|
82 | 82 | } |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | public function __construct($routing = true) |
16 | 16 | { |
17 | 17 | parent::__construct($routing); |
18 | - define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/'); |
|
18 | + define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'support/templates/'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | 22 | protected function _extend_page_config() |
23 | 23 | { |
24 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support'; |
|
24 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'support'; |
|
25 | 25 | // new routes and new configs (or overrides ) |
26 | 26 | $new_page_routes = array( |
27 | 27 | 'faq' => array( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | protected function _faq() |
49 | 49 | { |
50 | - $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php'; |
|
50 | + $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_faq.template.php'; |
|
51 | 51 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
52 | 52 | $template_path, |
53 | 53 | '', |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | add_meta_box( |
67 | 67 | 'espresso_additional_information_support', |
68 | 68 | esc_html__('Additional Information', 'event_espresso'), |
69 | - function ($post, $metabox) { |
|
69 | + function($post, $metabox) { |
|
70 | 70 | echo EEH_Template::display_template( |
71 | 71 | $metabox['args']['template_path'], |
72 | 72 | '', |