@@ -71,12 +71,12 @@ |
||
71 | 71 | |
72 | 72 | <?php |
73 | 73 | /** |
74 | - * template args used |
|
75 | - * |
|
76 | - * $dtt_row |
|
77 | - * $DTT_description |
|
78 | - * $show_tickets_row |
|
79 | - * $datetime_tickets_list |
|
80 | - * $add_new_datetime_ticket_help_link |
|
81 | - * $DTT_ID |
|
82 | - */ |
|
83 | 74 | \ No newline at end of file |
75 | + * template args used |
|
76 | + * |
|
77 | + * $dtt_row |
|
78 | + * $DTT_description |
|
79 | + * $show_tickets_row |
|
80 | + * $datetime_tickets_list |
|
81 | + * $add_new_datetime_ticket_help_link |
|
82 | + * $DTT_ID |
|
83 | + */ |
|
84 | 84 | \ No newline at end of file |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file contains a helper class for money type actions. |
|
4 | - * |
|
5 | - * @since %VER% |
|
6 | - * @package Event Espresso |
|
7 | - * @subpackage helper |
|
8 | - */ |
|
3 | + * This file contains a helper class for money type actions. |
|
4 | + * |
|
5 | + * @since %VER% |
|
6 | + * @package Event Espresso |
|
7 | + * @subpackage helper |
|
8 | + */ |
|
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
10 | 10 | /** |
11 | - * |
|
12 | - * Money helper class. |
|
13 | - * This class has helper methods that help with money related conversions and calculations. |
|
14 | - * |
|
15 | - * @since %VER% |
|
16 | - * |
|
17 | - * @package Event Espresso |
|
18 | - * @subpackage helpers |
|
19 | - * @author Darren Ethier |
|
20 | - * |
|
21 | - * ------------------------------------------------------------------------ |
|
22 | - */ |
|
11 | + * |
|
12 | + * Money helper class. |
|
13 | + * This class has helper methods that help with money related conversions and calculations. |
|
14 | + * |
|
15 | + * @since %VER% |
|
16 | + * |
|
17 | + * @package Event Espresso |
|
18 | + * @subpackage helpers |
|
19 | + * @author Darren Ethier |
|
20 | + * |
|
21 | + * ------------------------------------------------------------------------ |
|
22 | + */ |
|
23 | 23 | class EEH_Money extends EEH_Base { |
24 | 24 | |
25 | 25 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * ------------------------------------------------------------------------ |
22 | 22 | */ |
23 | -class EEH_Money extends EEH_Base { |
|
23 | +class EEH_Money extends EEH_Base { |
|
24 | 24 | |
25 | 25 | |
26 | 26 | /** |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | * @param int|string $incoming_value |
30 | 30 | * @return float |
31 | 31 | */ |
32 | - public static function convert_to_float_from_localized_money( $incoming_value ) { |
|
32 | + public static function convert_to_float_from_localized_money($incoming_value) { |
|
33 | 33 | //remove thousands separator |
34 | - $money_value = str_replace( EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value ); |
|
34 | + $money_value = str_replace(EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value); |
|
35 | 35 | |
36 | 36 | //replace decimal place with standard decimal. |
37 | - $money_value = str_replace( EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value ); |
|
37 | + $money_value = str_replace(EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value); |
|
38 | 38 | |
39 | 39 | //float it! and round to three decimal places |
40 | - $money_value = round ( (float) $money_value, 3 ); |
|
40 | + $money_value = round((float) $money_value, 3); |
|
41 | 41 | return $money_value; |
42 | 42 | } |
43 | 43 | |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | * @throws \EE_Error |
58 | 58 | */ |
59 | 59 | |
60 | - public static function compare_floats( $float1, $float2, $operator='=' ) { |
|
60 | + public static function compare_floats($float1, $float2, $operator = '=') { |
|
61 | 61 | // Check numbers to 5 digits of precision |
62 | 62 | $epsilon = 0.00001; |
63 | 63 | |
64 | - $float1 = (float)$float1; |
|
65 | - $float2 = (float)$float2; |
|
64 | + $float1 = (float) $float1; |
|
65 | + $float2 = (float) $float2; |
|
66 | 66 | |
67 | 67 | switch ($operator) { |
68 | 68 | // equal |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | break; |
118 | 118 | default: |
119 | - throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) ); |
|
119 | + throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso')); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return false; |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @return string |
133 | 133 | */ |
134 | - public static function get_format_for_jqplot( $CNT_ISO = '') { |
|
134 | + public static function get_format_for_jqplot($CNT_ISO = '') { |
|
135 | 135 | //default format |
136 | 136 | $format = 'f'; |
137 | 137 | //if CNT_ISO passed lets try to get currency settings for it. |
138 | - $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null; |
|
138 | + $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null; |
|
139 | 139 | //default currency settings for site if not set |
140 | - if ( ! $currency_config instanceof EE_Currency_Config ) { |
|
140 | + if ( ! $currency_config instanceof EE_Currency_Config) { |
|
141 | 141 | $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
142 | 142 | } |
143 | 143 | |
144 | 144 | //first get the decimal place and number of places |
145 | - $format = "%'." . $currency_config->dec_plc . $format; |
|
145 | + $format = "%'.".$currency_config->dec_plc.$format; |
|
146 | 146 | |
147 | 147 | //currency symbol on right side. |
148 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
148 | + $format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
149 | 149 | return $format; |
150 | 150 | } |
151 | 151 | |
@@ -160,27 +160,27 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return string |
162 | 162 | */ |
163 | - public static function get_format_for_google_charts( $CNT_ISO = '' ) { |
|
163 | + public static function get_format_for_google_charts($CNT_ISO = '') { |
|
164 | 164 | //if CNT_ISO passed lets try to get currency settings for it. |
165 | - $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null; |
|
165 | + $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null; |
|
166 | 166 | //default currency settings for site if not set |
167 | - if ( ! $currency_config instanceof EE_Currency_Config ) { |
|
167 | + if ( ! $currency_config instanceof EE_Currency_Config) { |
|
168 | 168 | $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
169 | 169 | } |
170 | 170 | |
171 | - $decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' ); |
|
171 | + $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
|
172 | 172 | |
173 | 173 | //first get the decimal place and number of places |
174 | - $format = '#,##0.' . $decimal_places_placeholder; |
|
174 | + $format = '#,##0.'.$decimal_places_placeholder; |
|
175 | 175 | |
176 | 176 | //currency symbol on right side. |
177 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
177 | + $format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
178 | 178 | $formatterObject = array( |
179 | 179 | 'decimalSymbol' => $currency_config->dec_mrk, |
180 | 180 | 'groupingSymbol' => $currency_config->thsnds, |
181 | 181 | 'fractionDigits' => $currency_config->dec_plc, |
182 | 182 | ); |
183 | - if ( $currency_config->sign_b4 ) { |
|
183 | + if ($currency_config->sign_b4) { |
|
184 | 184 | $formatterObject['prefix'] = $currency_config->sign; |
185 | 185 | } else { |
186 | 186 | $formatterObject['suffix'] = $currency_config->sign; |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | 3 | * EE_Registry Class |
4 | - * |
|
5 | - * Centralized Application Data Storage and Management |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage core |
|
9 | - * @author Brent Christensen |
|
10 | - */ |
|
4 | + * |
|
5 | + * Centralized Application Data Storage and Management |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage core |
|
9 | + * @author Brent Christensen |
|
10 | + */ |
|
11 | 11 | final class EE_Registry { |
12 | 12 | |
13 | 13 | /** |
14 | - * EE_Registry Object |
|
15 | - * @var EE_Registry $_instance |
|
16 | - * @access private |
|
17 | - */ |
|
14 | + * EE_Registry Object |
|
15 | + * @var EE_Registry $_instance |
|
16 | + * @access private |
|
17 | + */ |
|
18 | 18 | private static $_instance = NULL; |
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
22 | - * EE_Cart Object |
|
23 | - * @access public |
|
24 | - * @var EE_Cart $CART |
|
25 | - */ |
|
22 | + * EE_Cart Object |
|
23 | + * @access public |
|
24 | + * @var EE_Cart $CART |
|
25 | + */ |
|
26 | 26 | public $CART = NULL; |
27 | 27 | |
28 | 28 | /** |
29 | - * EE_Config Object |
|
30 | - * @access public |
|
31 | - * @var EE_Config $CFG |
|
32 | - */ |
|
29 | + * EE_Config Object |
|
30 | + * @access public |
|
31 | + * @var EE_Config $CFG |
|
32 | + */ |
|
33 | 33 | public $CFG = NULL; |
34 | 34 | |
35 | 35 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | /** |
47 | - * StdClass object for storing library classes in |
|
48 | - * @public LIB |
|
49 | - */ |
|
47 | + * StdClass object for storing library classes in |
|
48 | + * @public LIB |
|
49 | + */ |
|
50 | 50 | public $LIB = NULL; |
51 | 51 | |
52 | 52 | /** |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public $REQ = NULL; |
58 | 58 | |
59 | 59 | /** |
60 | - * EE_Session Object |
|
61 | - * @access public |
|
62 | - * @var EE_Session $SSN |
|
63 | - */ |
|
60 | + * EE_Session Object |
|
61 | + * @access public |
|
62 | + * @var EE_Session $SSN |
|
63 | + */ |
|
64 | 64 | public $SSN = NULL; |
65 | 65 | |
66 | 66 | |
@@ -127,21 +127,21 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | /** |
130 | - * $i18n_js_strings - internationalization for JS strings |
|
131 | - * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | - * in js file: var translatedString = eei18n.string_key; |
|
133 | - * |
|
134 | - * @access public |
|
135 | - * @var array |
|
136 | - */ |
|
130 | + * $i18n_js_strings - internationalization for JS strings |
|
131 | + * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | + * in js file: var translatedString = eei18n.string_key; |
|
133 | + * |
|
134 | + * @access public |
|
135 | + * @var array |
|
136 | + */ |
|
137 | 137 | public static $i18n_js_strings = array(); |
138 | 138 | |
139 | 139 | /** |
140 | - * $main_file - path to espresso.php |
|
141 | - * |
|
142 | - * @access public |
|
143 | - * @var array |
|
144 | - */ |
|
140 | + * $main_file - path to espresso.php |
|
141 | + * |
|
142 | + * @access public |
|
143 | + * @var array |
|
144 | + */ |
|
145 | 145 | public $main_file; |
146 | 146 | |
147 | 147 |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function instance() { |
158 | 158 | // check if class object is instantiated |
159 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) { |
|
159 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) { |
|
160 | 160 | self::$_instance = new self(); |
161 | 161 | } |
162 | 162 | return self::$_instance; |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | * @return EE_Registry |
172 | 172 | */ |
173 | 173 | private function __construct() { |
174 | - $this->load_core( 'Base' ); |
|
174 | + $this->load_core('Base'); |
|
175 | 175 | // class library |
176 | 176 | $this->LIB = new StdClass(); |
177 | 177 | $this->addons = new StdClass(); |
178 | 178 | $this->modules = new StdClass(); |
179 | 179 | $this->shortcodes = new StdClass(); |
180 | 180 | $this->widgets = new StdClass(); |
181 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' )); |
|
181 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function init() { |
193 | 193 | // Get current page protocol |
194 | - $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
|
194 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
195 | 195 | // Output admin-ajax.php URL with same protocol as current page |
196 | - self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol ); |
|
197 | - self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE; |
|
196 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
197 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @return string |
206 | 206 | */ |
207 | 207 | public static function localize_i18n_js_strings() { |
208 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
209 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
210 | - if ( is_scalar( $value ) ) { |
|
211 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
208 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
209 | + foreach ($i18n_js_strings as $key => $value) { |
|
210 | + if (is_scalar($value)) { |
|
211 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
215 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param mixed string | EED_Module $module |
222 | 222 | */ |
223 | - public function add_module( $module ) { |
|
224 | - if ( $module instanceof EED_Module ) { |
|
225 | - $module_class = get_class( $module ); |
|
223 | + public function add_module($module) { |
|
224 | + if ($module instanceof EED_Module) { |
|
225 | + $module_class = get_class($module); |
|
226 | 226 | $this->modules->{$module_class} = $module; |
227 | 227 | } else { |
228 | - if ( ! class_exists( 'EE_Module_Request_Router' )) { |
|
229 | - $this->load_core( 'Module_Request_Router' ); |
|
228 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
229 | + $this->load_core('Module_Request_Router'); |
|
230 | 230 | } |
231 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
231 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @param string $module_name |
239 | 239 | * @return mixed EED_Module | NULL |
240 | 240 | */ |
241 | - public function get_module( $module_name = '' ) { |
|
242 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
241 | + public function get_module($module_name = '') { |
|
242 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -252,18 +252,18 @@ discard block |
||
252 | 252 | * @param bool $load_only |
253 | 253 | * @return mixed |
254 | 254 | */ |
255 | - public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
255 | + public function load_core($class_name, $arguments = array(), $load_only = FALSE) { |
|
256 | 256 | $core_paths = apply_filters( |
257 | 257 | 'FHEE__EE_Registry__load_core__core_paths', |
258 | 258 | array( |
259 | 259 | EE_CORE, |
260 | 260 | EE_ADMIN, |
261 | 261 | EE_CPTS, |
262 | - EE_CORE . 'data_migration_scripts' . DS |
|
262 | + EE_CORE.'data_migration_scripts'.DS |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | // retrieve instantiated class |
266 | - return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only ); |
|
266 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param mixed $arguments |
277 | 277 | * @return EE_Data_Migration_Script_Base |
278 | 278 | */ |
279 | - public function load_dms ( $class_name, $arguments = array() ) { |
|
279 | + public function load_dms($class_name, $arguments = array()) { |
|
280 | 280 | // retrieve instantiated class |
281 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE ); |
|
281 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
294 | 294 | * @return EE_Base_Class |
295 | 295 | */ |
296 | - public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
297 | - $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
|
296 | + public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
297 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
298 | 298 | EE_CORE, |
299 | 299 | EE_CLASSES, |
300 | 300 | EE_BUSINESS |
301 | 301 | )); |
302 | 302 | // retrieve instantiated class |
303 | - return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
303 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | * @param bool $load_only |
315 | 315 | * @return EEH_Base |
316 | 316 | */ |
317 | - public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
318 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) ); |
|
317 | + public function load_helper($class_name, $arguments = array(), $load_only = TRUE) { |
|
318 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
319 | 319 | // retrieve instantiated class |
320 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only ); |
|
320 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | * @param bool $load_only |
332 | 332 | * @return mixed |
333 | 333 | */ |
334 | - public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
334 | + public function load_lib($class_name, $arguments = array(), $load_only = FALSE) { |
|
335 | 335 | $paths = array( |
336 | 336 | EE_LIBRARIES, |
337 | - EE_LIBRARIES . 'messages' . DS, |
|
338 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
339 | - EE_LIBRARIES . 'qtips' . DS, |
|
340 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
337 | + EE_LIBRARIES.'messages'.DS, |
|
338 | + EE_LIBRARIES.'shortcodes'.DS, |
|
339 | + EE_LIBRARIES.'qtips'.DS, |
|
340 | + EE_LIBRARIES.'payment_methods'.DS, |
|
341 | 341 | ); |
342 | 342 | // retrieve instantiated class |
343 | - return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only ); |
|
343 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * @param bool $load_only |
354 | 354 | * @return EEM_Base |
355 | 355 | */ |
356 | - public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
357 | - $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
|
356 | + public function load_model($class_name, $arguments = array(), $load_only = FALSE) { |
|
357 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
358 | 358 | EE_MODELS, |
359 | 359 | EE_CORE |
360 | 360 | )); |
361 | 361 | // retrieve instantiated class |
362 | - return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only ); |
|
362 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -372,15 +372,15 @@ discard block |
||
372 | 372 | * @param bool $load_only |
373 | 373 | * @return mixed |
374 | 374 | */ |
375 | - public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
375 | + public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) { |
|
376 | 376 | $paths = array( |
377 | - EE_MODELS . 'fields' . DS, |
|
378 | - EE_MODELS . 'helpers' . DS, |
|
379 | - EE_MODELS . 'relations' . DS, |
|
380 | - EE_MODELS . 'strategies' . DS |
|
377 | + EE_MODELS.'fields'.DS, |
|
378 | + EE_MODELS.'helpers'.DS, |
|
379 | + EE_MODELS.'relations'.DS, |
|
380 | + EE_MODELS.'strategies'.DS |
|
381 | 381 | ); |
382 | 382 | // retrieve instantiated class |
383 | - return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only ); |
|
383 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
393 | 393 | * @return boolean |
394 | 394 | */ |
395 | - public function is_model_name( $model_name ){ |
|
396 | - return isset( $this->models[ $model_name ] ) ? TRUE : FALSE; |
|
395 | + public function is_model_name($model_name) { |
|
396 | + return isset($this->models[$model_name]) ? TRUE : FALSE; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | * @param bool $load_only |
409 | 409 | * @return mixed |
410 | 410 | */ |
411 | - public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
|
411 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) { |
|
412 | 412 | // retrieve instantiated class |
413 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
413 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | * @param bool $load_only |
426 | 426 | * @return EE_Addon |
427 | 427 | */ |
428 | - public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
|
428 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) { |
|
429 | 429 | // retrieve instantiated class |
430 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
430 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | * @internal param string $file_path - file path including file name |
446 | 446 | * @return bool | object |
447 | 447 | */ |
448 | - private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
448 | + private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
449 | 449 | // strip php file extension |
450 | - $class_name = str_replace( '.php', '', trim( $class_name )); |
|
450 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
451 | 451 | // does the class have a prefix ? |
452 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
452 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
453 | 453 | // make sure $class_prefix is uppercase |
454 | - $class_prefix = strtoupper( trim( $class_prefix )); |
|
454 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
455 | 455 | // add class prefix ONCE!!! |
456 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
456 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | $class_abbreviations = array( |
@@ -465,61 +465,61 @@ discard block |
||
465 | 465 | 'EE_Capabilities' => 'CAP' |
466 | 466 | ); |
467 | 467 | |
468 | - $class_abbreviation = isset( $class_abbreviations[ $class_name ] ) |
|
469 | - ? $class_abbreviations[ $class_name ] |
|
468 | + $class_abbreviation = isset($class_abbreviations[$class_name]) |
|
469 | + ? $class_abbreviations[$class_name] |
|
470 | 470 | : ''; |
471 | 471 | // check if class has already been loaded, and return it if it has been |
472 | - if ( $class_abbreviation !== '' && ! is_null( $this->{$class_abbreviation} ) |
|
472 | + if ($class_abbreviation !== '' && ! is_null($this->{$class_abbreviation} ) |
|
473 | 473 | ) { |
474 | 474 | return $this->{$class_abbreviation}; |
475 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
475 | + } else if (isset ($this->{$class_name} )) { |
|
476 | 476 | return $this->{$class_name}; |
477 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
477 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
478 | 478 | return $this->LIB->{$class_name}; |
479 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
479 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
480 | 480 | return $this->addons->{$class_name}; |
481 | 481 | } |
482 | 482 | |
483 | 483 | // assume all paths lead nowhere |
484 | 484 | $path = FALSE; |
485 | 485 | // make sure $file_paths is an array |
486 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
486 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
487 | 487 | // cycle thru paths |
488 | - foreach ( $file_paths as $key => $file_path ) { |
|
488 | + foreach ($file_paths as $key => $file_path) { |
|
489 | 489 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
490 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
490 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
491 | 491 | // prep file type |
492 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
492 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
493 | 493 | // build full file path |
494 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
494 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
495 | 495 | //does the file exist and can be read ? |
496 | - if ( is_readable( $file_paths[ $key ] )) { |
|
497 | - $path = $file_paths[ $key ]; |
|
496 | + if (is_readable($file_paths[$key])) { |
|
497 | + $path = $file_paths[$key]; |
|
498 | 498 | break; |
499 | 499 | } |
500 | 500 | } |
501 | 501 | // don't give up! you gotta... |
502 | 502 | try { |
503 | 503 | //does the file exist and can it be read ? |
504 | - if ( ! $path ) { |
|
504 | + if ( ! $path) { |
|
505 | 505 | // so sorry, can't find the file |
506 | - throw new EE_Error ( |
|
507 | - sprintf ( |
|
508 | - __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s','event_espresso'), |
|
509 | - trim( $type, '.' ), |
|
506 | + throw new EE_Error( |
|
507 | + sprintf( |
|
508 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
509 | + trim($type, '.'), |
|
510 | 510 | $class_name, |
511 | - '<br />' . implode( ',<br />', $file_paths ) |
|
511 | + '<br />'.implode(',<br />', $file_paths) |
|
512 | 512 | ) |
513 | 513 | ); |
514 | 514 | } |
515 | 515 | // get the file |
516 | - require_once( $path ); |
|
516 | + require_once($path); |
|
517 | 517 | // if the class isn't already declared somewhere |
518 | - if ( class_exists( $class_name, FALSE ) === FALSE ) { |
|
518 | + if (class_exists($class_name, FALSE) === FALSE) { |
|
519 | 519 | // so sorry, not a class |
520 | 520 | throw new EE_Error( |
521 | 521 | sprintf( |
522 | - __('The %s file %s does not appear to contain the %s Class.','event_espresso'), |
|
522 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
523 | 523 | $type, |
524 | 524 | $path, |
525 | 525 | $class_name |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | ); |
528 | 528 | } |
529 | 529 | |
530 | - } catch ( EE_Error $e ) { |
|
530 | + } catch (EE_Error $e) { |
|
531 | 531 | $e->get_error(); |
532 | 532 | } |
533 | 533 | |
@@ -535,38 +535,38 @@ discard block |
||
535 | 535 | // don't give up! you gotta... |
536 | 536 | try { |
537 | 537 | // create reflection |
538 | - $reflector = new ReflectionClass( $class_name ); |
|
538 | + $reflector = new ReflectionClass($class_name); |
|
539 | 539 | // instantiate the class and add to the LIB array for tracking |
540 | 540 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
541 | - if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) { |
|
541 | + if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) { |
|
542 | 542 | // $instantiation_mode = 0; |
543 | 543 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
544 | 544 | return TRUE; |
545 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
545 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
546 | 546 | // $instantiation_mode = 1; |
547 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
548 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
547 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
548 | + } else if (method_exists($class_name, 'new_instance')) { |
|
549 | 549 | // $instantiation_mode = 2; |
550 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
551 | - } else if ( method_exists( $class_name, 'instance' )) { |
|
550 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
551 | + } else if (method_exists($class_name, 'instance')) { |
|
552 | 552 | // $instantiation_mode = 3; |
553 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
554 | - } else if ( $reflector->isInstantiable() ) { |
|
553 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
554 | + } else if ($reflector->isInstantiable()) { |
|
555 | 555 | // $instantiation_mode = 4; |
556 | - $class_obj = $reflector->newInstance( $arguments ); |
|
557 | - } else if ( ! $load_only ) { |
|
556 | + $class_obj = $reflector->newInstance($arguments); |
|
557 | + } else if ( ! $load_only) { |
|
558 | 558 | // heh ? something's not right ! |
559 | 559 | // $instantiation_mode = 5; |
560 | 560 | throw new EE_Error( |
561 | 561 | sprintf( |
562 | - __('The %s file %s could not be instantiated.','event_espresso'), |
|
562 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
563 | 563 | $type, |
564 | 564 | $class_name |
565 | 565 | ) |
566 | 566 | ); |
567 | 567 | } |
568 | 568 | |
569 | - } catch ( EE_Error $e ) { |
|
569 | + } catch (EE_Error $e) { |
|
570 | 570 | $e->get_error(); |
571 | 571 | } |
572 | 572 | |
@@ -578,15 +578,15 @@ discard block |
||
578 | 578 | // EEH_Debug_Tools::printr( $class_obj, '$class_obj <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
579 | 579 | |
580 | 580 | |
581 | - if ( isset( $class_obj )) { |
|
581 | + if (isset($class_obj)) { |
|
582 | 582 | // return newly instantiated class |
583 | - if ( $class_abbreviation !== '' ) { |
|
583 | + if ($class_abbreviation !== '') { |
|
584 | 584 | $this->{$class_abbreviation} = $class_obj; |
585 | - } else if ( EEH_Class_Tools::has_property( $this, $class_name )) { |
|
585 | + } else if (EEH_Class_Tools::has_property($this, $class_name)) { |
|
586 | 586 | $this->{$class_name} = $class_obj; |
587 | - } else if ( $class_prefix == 'addon' && $cache ) { |
|
587 | + } else if ($class_prefix == 'addon' && $cache) { |
|
588 | 588 | $this->addons->{$class_name} = $class_obj; |
589 | - } else if ( !$from_db && $cache ) { |
|
589 | + } else if ( ! $from_db && $cache) { |
|
590 | 590 | $this->LIB->{$class_name} = $class_obj; |
591 | 591 | } |
592 | 592 | return $class_obj; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param $a |
612 | 612 | * @param $b |
613 | 613 | */ |
614 | - final function __call($a,$b) {} |
|
614 | + final function __call($a, $b) {} |
|
615 | 615 | |
616 | 616 | |
617 | 617 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @param $a |
627 | 627 | * @param $b |
628 | 628 | */ |
629 | - final function __set($a,$b) {} |
|
629 | + final function __set($a, $b) {} |
|
630 | 630 | |
631 | 631 | |
632 | 632 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | * @param $a |
667 | 667 | * @param $b |
668 | 668 | */ |
669 | - final static function __callStatic($a,$b) {} |
|
669 | + final static function __callStatic($a, $b) {} |
|
670 | 670 | |
671 | 671 | /** |
672 | 672 | * Gets the addon by its name/slug (not classname. For that, just |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | * @param string $name |
675 | 675 | * @return EE_Addon |
676 | 676 | */ |
677 | - public function get_addon_by_name( $name ){ |
|
678 | - foreach($this->addons as $addon){ |
|
679 | - if( $addon->name() == $name){ |
|
677 | + public function get_addon_by_name($name) { |
|
678 | + foreach ($this->addons as $addon) { |
|
679 | + if ($addon->name() == $name) { |
|
680 | 680 | return $addon; |
681 | 681 | } |
682 | 682 | } |
@@ -687,10 +687,10 @@ discard block |
||
687 | 687 | * |
688 | 688 | * @return EE_Addon[] where the KEYS are the addon's name() |
689 | 689 | */ |
690 | - public function get_addons_by_name(){ |
|
690 | + public function get_addons_by_name() { |
|
691 | 691 | $addons = array(); |
692 | - foreach($this->addons as $addon){ |
|
693 | - $addons[ $addon->name() ] = $addon; |
|
692 | + foreach ($this->addons as $addon) { |
|
693 | + $addons[$addon->name()] = $addon; |
|
694 | 694 | } |
695 | 695 | return $addons; |
696 | 696 | } |
@@ -705,14 +705,14 @@ discard block |
||
705 | 705 | * @return EEM_Base |
706 | 706 | * @throws EE_Error |
707 | 707 | */ |
708 | - public function reset_model( $model_name ){ |
|
709 | - $model = $this->load_model( $model_name ); |
|
710 | - $model_class_name = get_class( $model ); |
|
708 | + public function reset_model($model_name) { |
|
709 | + $model = $this->load_model($model_name); |
|
710 | + $model_class_name = get_class($model); |
|
711 | 711 | //get that model reset it and make sure we nuke the old reference to it |
712 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
712 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
713 | 713 | $this->LIB->{$model_class_name} = $model::reset(); |
714 | - }else{ |
|
715 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
714 | + } else { |
|
715 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
716 | 716 | } |
717 | 717 | return $this->LIB->{$model_class_name}; |
718 | 718 | } |
@@ -728,15 +728,15 @@ discard block |
||
728 | 728 | * currently reinstantiate the singletons at the moment) |
729 | 729 | * @return EE_Registry |
730 | 730 | */ |
731 | - public static function reset( $hard = FALSE, $reinstantiate = TRUE ){ |
|
731 | + public static function reset($hard = FALSE, $reinstantiate = TRUE) { |
|
732 | 732 | $instance = self::instance(); |
733 | 733 | $instance->load_helper('Activation'); |
734 | 734 | EEH_Activation::reset(); |
735 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
735 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
736 | 736 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
737 | 737 | $instance->LIB = new stdClass(); |
738 | - foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){ |
|
739 | - $instance->reset_model( $model_name ); |
|
738 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
739 | + $instance->reset_model($model_name); |
|
740 | 740 | } |
741 | 741 | return $instance; |
742 | 742 | } |
@@ -747,9 +747,9 @@ discard block |
||
747 | 747 | */ |
748 | 748 | public function cpt_models() { |
749 | 749 | $cpt_models = array(); |
750 | - foreach( $this->non_abstract_db_models as $shortname => $classname ) { |
|
751 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
752 | - $cpt_models[ $shortname ] = $classname; |
|
750 | + foreach ($this->non_abstract_db_models as $shortname => $classname) { |
|
751 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
752 | + $cpt_models[$shortname] = $classname; |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | return $cpt_models; |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Event Espresso |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EEH_Class_Tools Helper |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /helpers/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Event Espresso |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EEH_Class_Tools Helper |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /helpers/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EEH_Class_Tools { |
25 | 25 | |
26 | 26 | static $i = 0; |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function get_called_class() { |
37 | 37 | $backtrace = debug_backtrace(); |
38 | - if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['class'] ) && ! isset( $backtrace[2]['file'] )) { |
|
38 | + if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['class']) && ! isset($backtrace[2]['file'])) { |
|
39 | 39 | return $backtrace[2]['class']; |
40 | - } else if ( isset( $backtrace[3] ) && is_array( $backtrace[3] ) && isset( $backtrace[3]['class'] ) && ! isset( $backtrace[3]['file'] )) { |
|
40 | + } else if (isset($backtrace[3]) && is_array($backtrace[3]) && isset($backtrace[3]['class']) && ! isset($backtrace[3]['file'])) { |
|
41 | 41 | return $backtrace[3]['class']; |
42 | - } else if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['file'] ) && isset( $backtrace[2]['line'] )) { |
|
43 | - if ( self::$file_line == $backtrace[2]['file'] . $backtrace[2]['line'] ) { |
|
42 | + } else if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) { |
|
43 | + if (self::$file_line == $backtrace[2]['file'].$backtrace[2]['line']) { |
|
44 | 44 | self::$i++; |
45 | 45 | } else { |
46 | 46 | self::$i = 0; |
47 | - self::$file_line = $backtrace[2]['file'] . $backtrace[2]['line']; |
|
47 | + self::$file_line = $backtrace[2]['file'].$backtrace[2]['line']; |
|
48 | 48 | } |
49 | 49 | // was class method called via call_user_func ? |
50 | - if ( $backtrace[2]['function'] == 'call_user_func' && isset( $backtrace[2]['args'] ) && is_array( $backtrace[2]['args'] )){ |
|
51 | - if ( isset( $backtrace[2]['args'][0] ) && isset( $backtrace[2]['args'][0][0] )) { |
|
50 | + if ($backtrace[2]['function'] == 'call_user_func' && isset($backtrace[2]['args']) && is_array($backtrace[2]['args'])) { |
|
51 | + if (isset($backtrace[2]['args'][0]) && isset($backtrace[2]['args'][0][0])) { |
|
52 | 52 | $called_class = $backtrace[2]['args'][0][0]; |
53 | 53 | // is it an EE function ? |
54 | - if ( strpos( $called_class, 'EE' ) === 0 ) { |
|
55 | - $prefix_chars = strpos( $called_class, '_' ) + 1; |
|
56 | - $prefix = substr( $called_class, 0, $prefix_chars ); |
|
57 | - $classname = substr( $called_class, $prefix_chars, strlen( $called_class )); |
|
58 | - $classname = $prefix . str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $classname )))); |
|
54 | + if (strpos($called_class, 'EE') === 0) { |
|
55 | + $prefix_chars = strpos($called_class, '_') + 1; |
|
56 | + $prefix = substr($called_class, 0, $prefix_chars); |
|
57 | + $classname = substr($called_class, $prefix_chars, strlen($called_class)); |
|
58 | + $classname = $prefix.str_replace(' ', '_', ucwords(strtolower(str_replace('_', ' ', $classname)))); |
|
59 | 59 | return $classname; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | } else { |
63 | - $lines = file( $backtrace[2]['file'] ); |
|
64 | - preg_match_all( '/([a-zA-Z0-9\_]+)::' . $backtrace[2]['function'] . '/', $lines[$backtrace[2]['line']-1], $matches ); |
|
65 | - if ( isset( $matches[1] ) && isset( $matches[1][ self::$i ] )) { |
|
66 | - return $matches[1][ self::$i ]; |
|
63 | + $lines = file($backtrace[2]['file']); |
|
64 | + preg_match_all('/([a-zA-Z0-9\_]+)::'.$backtrace[2]['function'].'/', $lines[$backtrace[2]['line'] - 1], $matches); |
|
65 | + if (isset($matches[1]) && isset($matches[1][self::$i])) { |
|
66 | + return $matches[1][self::$i]; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
@@ -80,22 +80,22 @@ discard block |
||
80 | 80 | * @param string $hook |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public static function get_class_names_for_all_callbacks_on_hook( $hook = NULL ) { |
|
83 | + public static function get_class_names_for_all_callbacks_on_hook($hook = NULL) { |
|
84 | 84 | global $wp_filter; |
85 | 85 | $class_names = array(); |
86 | 86 | // are any callbacks registered for this hook ? |
87 | - if ( isset( $wp_filter[ $hook ] )) { |
|
87 | + if (isset($wp_filter[$hook])) { |
|
88 | 88 | // loop thru all of the callbacks attached to the deprecated hookpoint |
89 | - foreach( $wp_filter[ $hook ] as $priority ) { |
|
90 | - foreach( $priority as $callback ) { |
|
89 | + foreach ($wp_filter[$hook] as $priority) { |
|
90 | + foreach ($priority as $callback) { |
|
91 | 91 | // is the callback a non-static class method ? |
92 | - if ( isset( $callback['function'] ) && is_array( $callback['function'] )) { |
|
93 | - if ( isset( $callback['function'][0] ) && is_object( $callback['function'][0] )) { |
|
94 | - $class_names[] = get_class( $callback['function'][0] ); |
|
92 | + if (isset($callback['function']) && is_array($callback['function'])) { |
|
93 | + if (isset($callback['function'][0]) && is_object($callback['function'][0])) { |
|
94 | + $class_names[] = get_class($callback['function'][0]); |
|
95 | 95 | } |
96 | 96 | // test for static method |
97 | - } else if ( strpos( $callback['function'], '::' ) !== FALSE ) { |
|
98 | - $class = explode( '::', $callback['function'] ); |
|
97 | + } else if (strpos($callback['function'], '::') !== FALSE) { |
|
98 | + $class = explode('::', $callback['function']); |
|
99 | 99 | $class_names[] = $class[0]; |
100 | 100 | } else { |
101 | 101 | // just a function |
@@ -116,24 +116,24 @@ discard block |
||
116 | 116 | * @param string $property |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - public static function has_property( $class = NULL, $property = NULL ) { |
|
119 | + public static function has_property($class = NULL, $property = NULL) { |
|
120 | 120 | // if $class or $property don't exist, then get out, cuz that would be like... fatal dude |
121 | - if ( empty( $class ) || empty( $property )) { |
|
121 | + if (empty($class) || empty($property)) { |
|
122 | 122 | return FALSE; |
123 | 123 | } |
124 | 124 | // if your hosting company doesn't cut the mustard |
125 | - if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { |
|
125 | + if (version_compare(PHP_VERSION, '5.3.0') < 0) { |
|
126 | 126 | // just in case $class is an actual instantiated object |
127 | - if ( is_object( $class )) { |
|
128 | - return isset( $class->{$property} ) ? TRUE : FALSE; |
|
127 | + if (is_object($class)) { |
|
128 | + return isset($class->{$property} ) ? TRUE : FALSE; |
|
129 | 129 | } else { |
130 | 130 | // use reflection for < PHP 5.3 to get details using just the class name |
131 | - $reflector = new ReflectionClass( $class ); |
|
132 | - return $reflector->hasProperty( $property ); |
|
131 | + $reflector = new ReflectionClass($class); |
|
132 | + return $reflector->hasProperty($property); |
|
133 | 133 | } |
134 | 134 | } else { |
135 | 135 | // or try regular property exists method which works as expected in PHP 5.3+ |
136 | - return property_exists( $class, $property ); |
|
136 | + return property_exists($class, $property); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | |
145 | 145 | // if PHP version < 5.3 |
146 | -if ( ! function_exists( 'get_called_class' )) { |
|
146 | +if ( ! function_exists('get_called_class')) { |
|
147 | 147 | /** |
148 | 148 | * @return bool|string |
149 | 149 | */ |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * |
|
4 | - * Class JobHandlerFile |
|
5 | - * |
|
6 | - * Base class for common implementations of JobHandlerInterface, but ones |
|
7 | - * which write to a temporary file |
|
8 | - * |
|
9 | - * @package Event Espresso |
|
10 | - * @subpackage batch |
|
11 | - * @author Mike Nelson |
|
12 | - * @since 4.8.26 |
|
13 | - * |
|
14 | - */ |
|
3 | + * |
|
4 | + * Class JobHandlerFile |
|
5 | + * |
|
6 | + * Base class for common implementations of JobHandlerInterface, but ones |
|
7 | + * which write to a temporary file |
|
8 | + * |
|
9 | + * @package Event Espresso |
|
10 | + * @subpackage batch |
|
11 | + * @author Mike Nelson |
|
12 | + * @since 4.8.26 |
|
13 | + * |
|
14 | + */ |
|
15 | 15 | namespace EventEspressoBatchRequest\JobHandlerBaseClasses; |
16 | 16 | |
17 | 17 | use EventEspressoBatchRequest\Helpers\BatchRequestException; |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | |
17 | 17 | use EventEspressoBatchRequest\Helpers\BatchRequestException; |
18 | 18 | |
19 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
20 | - exit( 'No direct script access allowed' ); |
|
19 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param \EEHI_File|null $file_helper |
41 | 41 | */ |
42 | - public function __construct( \EEHI_File $file_helper = null ) { |
|
43 | - if( ! $file_helper ) { |
|
42 | + public function __construct(\EEHI_File $file_helper = null) { |
|
43 | + if ( ! $file_helper) { |
|
44 | 44 | $this->_file_helper = new \EEH_File(); |
45 | 45 | } |
46 | 46 | } |
@@ -56,39 +56,39 @@ discard block |
||
56 | 56 | * @return string |
57 | 57 | * @throws \EventEspressoBatchRequest\Helpers\BatchRequestException |
58 | 58 | */ |
59 | - public function create_file_from_job_with_name( $job_id, $filename, $filetype = 'application/ms-excel' ) { |
|
59 | + public function create_file_from_job_with_name($job_id, $filename, $filetype = 'application/ms-excel') { |
|
60 | 60 | $filepath = ''; |
61 | - try{ |
|
61 | + try { |
|
62 | 62 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
63 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name |
|
63 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name |
|
64 | 64 | ); |
65 | - if ( $success ) { |
|
65 | + if ($success) { |
|
66 | 66 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
67 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id |
|
67 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id |
|
68 | 68 | ); |
69 | 69 | } |
70 | - if( $success ) { |
|
71 | - $filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename; |
|
72 | - $success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath ); |
|
70 | + if ($success) { |
|
71 | + $filepath = EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename; |
|
72 | + $success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath); |
|
73 | 73 | } |
74 | 74 | //let's add the .htaccess file so safari will open the file properly |
75 | - if( $success ) { |
|
76 | - $extension = \EEH_File::get_file_extension( $filepath ); |
|
75 | + if ($success) { |
|
76 | + $extension = \EEH_File::get_file_extension($filepath); |
|
77 | 77 | \EEH_File::write_to_file( |
78 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS . '.htaccess', |
|
79 | - 'AddType ' . $filetype . ' ' . $extension, |
|
78 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.'.htaccess', |
|
79 | + 'AddType '.$filetype.' '.$extension, |
|
80 | 80 | '.htaccess' |
81 | 81 | ); |
82 | 82 | } |
83 | 83 | //those methods normally fail with an exception, but if not, let's do it |
84 | - if( ! $success ) { |
|
85 | - throw new \EE_Error( 'could_not_create_temp_file', |
|
86 | - __( 'An unknown error occurred', 'event_espresso' )); |
|
84 | + if ( ! $success) { |
|
85 | + throw new \EE_Error('could_not_create_temp_file', |
|
86 | + __('An unknown error occurred', 'event_espresso')); |
|
87 | 87 | } |
88 | - } catch( \EE_Error $e ) { |
|
88 | + } catch (\EE_Error $e) { |
|
89 | 89 | throw new BatchRequestException( |
90 | 90 | sprintf( |
91 | - __( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ), |
|
91 | + __('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'), |
|
92 | 92 | $job_id, |
93 | 93 | $e->getMessage() |
94 | 94 | ), |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $filepath |
105 | 105 | * @return string url to file |
106 | 106 | */ |
107 | - public function get_url_to_file( $filepath ) { |
|
108 | - return str_replace( EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath ); |
|
107 | + public function get_url_to_file($filepath) { |
|
108 | + return str_replace(EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * |
|
4 | - * Class JobParameters |
|
5 | - * |
|
6 | - * Class for storing information about a job. Takes care of serializing the |
|
7 | - * data for storing in a wordpress option |
|
8 | - * |
|
9 | - * @package Event Espresso |
|
10 | - * @subpackage batch |
|
11 | - * @author Mike Nelson |
|
12 | - * @since 4.8.26 |
|
13 | - * |
|
14 | - */ |
|
3 | + * |
|
4 | + * Class JobParameters |
|
5 | + * |
|
6 | + * Class for storing information about a job. Takes care of serializing the |
|
7 | + * data for storing in a wordpress option |
|
8 | + * |
|
9 | + * @package Event Espresso |
|
10 | + * @subpackage batch |
|
11 | + * @author Mike Nelson |
|
12 | + * @since 4.8.26 |
|
13 | + * |
|
14 | + */ |
|
15 | 15 | namespace EventEspressoBatchRequest\Helpers; |
16 | 16 | |
17 | 17 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | * @param array $request_data |
97 | 97 | * @param array $extra_data |
98 | 98 | */ |
99 | - function __construct( $job_id, $classname, $request_data, $extra_data = array() ) { |
|
100 | - $this->set_job_id( $job_id ); |
|
101 | - $this->set_classname( $classname ); |
|
102 | - $this->set_request_data( $request_data ); |
|
103 | - $this->set_extra_data( $extra_data ); |
|
104 | - $this->set_status( JobParameters::status_continue ); |
|
99 | + function __construct($job_id, $classname, $request_data, $extra_data = array()) { |
|
100 | + $this->set_job_id($job_id); |
|
101 | + $this->set_classname($classname); |
|
102 | + $this->set_request_data($request_data); |
|
103 | + $this->set_extra_data($extra_data); |
|
104 | + $this->set_status(JobParameters::status_continue); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | * @param boolean $first |
127 | 127 | * @return boolean success |
128 | 128 | */ |
129 | - function save( $first = false ) { |
|
130 | - $object_vars = wp_json_encode( get_object_vars( $this ) ); |
|
131 | - if( $first ) { |
|
132 | - return add_option( $this->option_name(), $object_vars, null, 'no' ); |
|
133 | - } else{ |
|
134 | - return update_option( $this->option_name(), $object_vars ); |
|
129 | + function save($first = false) { |
|
130 | + $object_vars = wp_json_encode(get_object_vars($this)); |
|
131 | + if ($first) { |
|
132 | + return add_option($this->option_name(), $object_vars, null, 'no'); |
|
133 | + } else { |
|
134 | + return update_option($this->option_name(), $object_vars); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return boolean |
144 | 144 | */ |
145 | 145 | function delete() { |
146 | - return delete_option( $this->option_name() ); |
|
146 | + return delete_option($this->option_name()); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,26 +154,26 @@ discard block |
||
154 | 154 | * @return JobParameters |
155 | 155 | * @throws BatchRequestException |
156 | 156 | */ |
157 | - static function load( $job_id ) { |
|
158 | - $job_parameter_vars = json_decode( get_option( JobParameters::wp_option_prefix . $job_id ), true ); |
|
159 | - if( |
|
160 | - ! is_array( $job_parameter_vars ) || |
|
161 | - ! isset( $job_parameter_vars[ '_classname' ] ) || |
|
162 | - ! isset( $job_parameter_vars[ '_request_data' ] ) |
|
157 | + static function load($job_id) { |
|
158 | + $job_parameter_vars = json_decode(get_option(JobParameters::wp_option_prefix.$job_id), true); |
|
159 | + if ( |
|
160 | + ! is_array($job_parameter_vars) || |
|
161 | + ! isset($job_parameter_vars['_classname']) || |
|
162 | + ! isset($job_parameter_vars['_request_data']) |
|
163 | 163 | ) { |
164 | 164 | throw new BatchRequestException( |
165 | 165 | sprintf( |
166 | 166 | __('Could not retrieve job %1$s from the Wordpress options table, and so the job could not continue. The wordpress option was %2$s', 'event_espresso'), |
167 | 167 | $job_id, |
168 | - get_option( JobParameters::wp_option_prefix . $job_id ) |
|
168 | + get_option(JobParameters::wp_option_prefix.$job_id) |
|
169 | 169 | ) |
170 | 170 | ); |
171 | 171 | } |
172 | 172 | $job_parameters = new JobParameters( |
173 | 173 | $job_id, |
174 | - $job_parameter_vars[ '_classname' ], |
|
175 | - $job_parameter_vars[ '_request_data'] ); |
|
176 | - foreach( $job_parameter_vars as $key => $value ) { |
|
174 | + $job_parameter_vars['_classname'], |
|
175 | + $job_parameter_vars['_request_data'] ); |
|
176 | + foreach ($job_parameter_vars as $key => $value) { |
|
177 | 177 | $job_parameters->{$key} = $value; |
178 | 178 | } |
179 | 179 | return $job_parameters; |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @param string|array $default |
218 | 218 | * @return string|array |
219 | 219 | */ |
220 | - function request_datum( $key, $default = '' ) { |
|
221 | - if( isset( $this->_request_data[ $key ] ) ) { |
|
222 | - return $this->_request_data[ $key ]; |
|
220 | + function request_datum($key, $default = '') { |
|
221 | + if (isset($this->_request_data[$key])) { |
|
222 | + return $this->_request_data[$key]; |
|
223 | 223 | } else { |
224 | 224 | return $default; |
225 | 225 | } |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * @param string|array $default |
234 | 234 | * @return string|array |
235 | 235 | */ |
236 | - function extra_datum( $key, $default = '' ) { |
|
237 | - if( isset( $this->_extra_data[ $key ] ) ) { |
|
238 | - return $this->_extra_data[ $key ]; |
|
236 | + function extra_datum($key, $default = '') { |
|
237 | + if (isset($this->_extra_data[$key])) { |
|
238 | + return $this->_extra_data[$key]; |
|
239 | 239 | } else { |
240 | 240 | return $default; |
241 | 241 | } |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | * @param string $key |
249 | 249 | * @param string|int|array|null $value almost any extra data you want to store |
250 | 250 | */ |
251 | - function add_extra_data( $key, $value ) { |
|
252 | - $this->_extra_data[ $key ] = $value; |
|
251 | + function add_extra_data($key, $value) { |
|
252 | + $this->_extra_data[$key] = $value; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * Sets the job size. You decide what units to use |
279 | 279 | * @param int $size |
280 | 280 | */ |
281 | - function set_job_size( $size ) { |
|
281 | + function set_job_size($size) { |
|
282 | 282 | $this->_job_size = $size; |
283 | 283 | } |
284 | 284 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param int $newly_processed |
300 | 300 | * @return int updated units processed |
301 | 301 | */ |
302 | - function mark_processed( $newly_processed ) { |
|
302 | + function mark_processed($newly_processed) { |
|
303 | 303 | $this->_units_processed += $newly_processed; |
304 | 304 | return $this->_units_processed; |
305 | 305 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * Sets the total count of units processed. You might prefer to use mark_processed |
311 | 311 | * @param int $total_units_processed |
312 | 312 | */ |
313 | - function set_units_processed( $total_units_processed ) { |
|
313 | + function set_units_processed($total_units_processed) { |
|
314 | 314 | $this->_units_processed = $total_units_processed; |
315 | 315 | } |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * Sets the job's ID |
321 | 321 | * @param string $job_id |
322 | 322 | */ |
323 | - function set_job_id( $job_id ) { |
|
323 | + function set_job_id($job_id) { |
|
324 | 324 | $this->_job_id = $job_id; |
325 | 325 | } |
326 | 326 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * sets the classname |
331 | 331 | * @param string $classname |
332 | 332 | */ |
333 | - function set_classname( $classname ) { |
|
333 | + function set_classname($classname) { |
|
334 | 334 | $this->_classname = $classname; |
335 | 335 | } |
336 | 336 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * Sets the request data |
341 | 341 | * @param array $request_data |
342 | 342 | */ |
343 | - function set_request_data( $request_data ) { |
|
343 | + function set_request_data($request_data) { |
|
344 | 344 | $this->_request_data = $request_data; |
345 | 345 | } |
346 | 346 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * Sets the array of extra data we want to store on this request |
351 | 351 | * @param array $extra_data |
352 | 352 | */ |
353 | - function set_extra_data( $extra_data ) { |
|
353 | + function set_extra_data($extra_data) { |
|
354 | 354 | $this->_extra_data = $extra_data; |
355 | 355 | } |
356 | 356 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @return string |
362 | 362 | */ |
363 | 363 | function option_name() { |
364 | - return JobParameters::wp_option_prefix . $this->job_id(); |
|
364 | + return JobParameters::wp_option_prefix.$this->job_id(); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @param string $status on eof JobParameters::valid_stati() |
382 | 382 | */ |
383 | - public function set_status( $status ) { |
|
383 | + public function set_status($status) { |
|
384 | 384 | $this->_status = $status; |
385 | 385 | } |
386 | 386 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $_price_types = array(); |
38 | 38 | |
39 | - public function __construct( $admin_page ) { |
|
39 | + public function __construct($admin_page) { |
|
40 | 40 | parent::__construct($admin_page); |
41 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
41 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
42 | 42 | $this->_PRT = EEM_Price_Type::instance(); |
43 | 43 | $this->_price_types = $this->_PRT->get_all_deleted_and_undeleted(); |
44 | 44 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function _setup_data() { |
50 | 50 | $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
51 | - $this->_data = $this->_admin_page->get_prices_overview_data( $this->_per_page, false, $trashed ); |
|
52 | - $this->_all_data_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, false ); |
|
53 | - $this->_trashed_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, true ); |
|
51 | + $this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed); |
|
52 | + $this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false); |
|
53 | + $this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->_sortable_columns = array( |
76 | 76 | // true means its already sorted |
77 | - 'name' => array( 'name' => false ), |
|
78 | - 'type' => array( 'type' => false ), |
|
79 | - 'amount' => array( 'amount' => false ) |
|
77 | + 'name' => array('name' => false), |
|
78 | + 'type' => array('type' => false), |
|
79 | + 'amount' => array('amount' => false) |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $this->_hidden_columns = array( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | protected function _add_view_counts() { |
100 | 100 | $this->_views['all']['count'] = $this->_all_data_count; |
101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price') ) { |
|
101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
102 | 102 | $this->_views['trashed']['count'] = $this->_trashed_count; |
103 | 103 | } |
104 | 104 | } |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | * @param object $item the current item |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - protected function _get_row_class( $item ) { |
|
115 | + protected function _get_row_class($item) { |
|
116 | 116 | static $row_class = ''; |
117 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
117 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
118 | 118 | |
119 | 119 | $new_row = $row_class; |
120 | 120 | |
121 | - if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 ) |
|
121 | + if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4) |
|
122 | 122 | $new_row .= ' rowsortable'; |
123 | 123 | |
124 | - return ' class="' . $new_row . '"'; |
|
124 | + return ' class="'.$new_row.'"'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | |
133 | 133 | function column_cb($item) { |
134 | - if ( $item->type_obj()->base_type() !== 1 ) |
|
135 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() ); |
|
134 | + if ($item->type_obj()->base_type() !== 1) |
|
135 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID()); |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | //Build row actions |
146 | 146 | $actions = array(); |
147 | 147 | // edit price link |
148 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'pricing_edit_price', $item->ID() ) ) { |
|
149 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price', 'id'=>$item->ID() ), PRICING_ADMIN_URL ); |
|
150 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
148 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) { |
|
149 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price', 'id'=>$item->ID()), PRICING_ADMIN_URL); |
|
150 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
151 | 151 | } |
152 | 152 | |
153 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'edit_price', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name(); |
|
153 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name(); |
|
154 | 154 | |
155 | - if ( $item->type_obj()->base_type() !== 1 ) { |
|
155 | + if ($item->type_obj()->base_type() !== 1) { |
|
156 | 156 | if ($this->_view == 'all') { |
157 | 157 | // trash price link |
158 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_trash_price', $item->ID() ) ) { |
|
159 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
160 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
158 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) { |
|
159 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
160 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
161 | 161 | } |
162 | 162 | } else { |
163 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_restore_price', $item->ID() ) ) { |
|
163 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) { |
|
164 | 164 | // restore price link |
165 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
166 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
165 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
166 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // delete price link |
170 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_delete_price', $item->ID() ) ) { |
|
171 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
172 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
170 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) { |
|
171 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
172 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
179 | 179 | /* $1%s */ $name_link, |
180 | 180 | /* $2%s */ $item->ID(), |
181 | - /* $3%s */ $this->row_actions( $actions ) |
|
181 | + /* $3%s */ $this->row_actions($actions) |
|
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | |
197 | 197 | function column_description($item) { |
198 | - return stripslashes( $item->desc() ); |
|
198 | + return stripslashes($item->desc()); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | function column_amount($item) { |
206 | 206 | if ($this->_price_types[$item->type()]->is_percent()) { |
207 | - return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>'; |
|
207 | + return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>'; |
|
208 | 208 | } else { |
209 | - return '<div class="pad-amnt-rght">' . EEH_Template::format_currency( $item->amount() ) . '</div>'; |
|
209 | + return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>'; |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
217 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
218 | 218 | 'require_nonce' => FALSE |
219 | 219 | ), |
220 | 220 | 'add_new_price' => array( |
@@ -230,24 +230,24 @@ discard block |
||
230 | 230 | ) |
231 | 231 | ), |
232 | 232 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
233 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
233 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
236 | 236 | 'edit_price' => array( |
237 | 237 | 'nav' => array( |
238 | 238 | 'label' => __('Edit Default Price', 'event_espresso'), |
239 | 239 | 'order' => 20, |
240 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
240 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
243 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
244 | 244 | 'help_tabs' => array( |
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
248 | 248 | ) |
249 | 249 | ), |
250 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
250 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
251 | 251 | 'require_nonce' => FALSE |
252 | 252 | ), |
253 | 253 | 'price_types' => array( |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
271 | 271 | ), |
272 | 272 | ), |
273 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
273 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
274 | 274 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
275 | 275 | 'require_nonce' => FALSE |
276 | 276 | ), |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
289 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
290 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
293 | 293 | 'edit_price_type' => array( |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
305 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
306 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
309 | 309 | ) |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | public function load_scripts_styles() { |
341 | 341 | //styles |
342 | 342 | wp_enqueue_style('espresso-ui-theme'); |
343 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
343 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
344 | 344 | wp_enqueue_style('espresso_PRICING'); |
345 | 345 | |
346 | 346 | //scripts |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | //wp_enqueue_script('jquery-ui-dialog'); |
351 | 351 | //wp_enqueue_script('jquery-ui-draggable'); |
352 | 352 | //wp_enqueue_script('jquery-ui-datepicker'); |
353 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
354 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
353 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
354 | + wp_enqueue_script('espresso_PRICING'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | |
361 | 361 | public function load_scripts_styles_default() { |
362 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
362 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
391 | 391 | $this->_views['trashed'] = array( |
392 | 392 | 'slug' => 'trashed', |
393 | 393 | 'label' => __('Trash', 'event_espresso'), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
421 | 421 | $this->_views['trashed'] = array( |
422 | 422 | 'slug' => 'trashed', |
423 | 423 | 'label' => __('Trash', 'event_espresso'), |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
457 | 457 | * @return mixed (int|array) int = count || array of price objects |
458 | 458 | */ |
459 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
459 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
460 | 460 | |
461 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
461 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
462 | 462 | // start with an empty array |
463 | 463 | $event_pricing = array(); |
464 | 464 | |
465 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
466 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
465 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
466 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
467 | 467 | //$PRC = EEM_Price::instance(); |
468 | 468 | |
469 | 469 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
470 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
470 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
471 | 471 | |
472 | 472 | switch ($this->_req_data['orderby']) { |
473 | 473 | case 'name': |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | $orderby = array('PRC_amount'=>$order); |
481 | 481 | break; |
482 | 482 | default: |
483 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
483 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
484 | 484 | } |
485 | 485 | |
486 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
487 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
486 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
487 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
488 | 488 | |
489 | 489 | $_where = array( |
490 | 490 | 'PRC_is_default' => 1, |
491 | 491 | 'PRC_deleted' => $trashed |
492 | 492 | ); |
493 | 493 | |
494 | - $offset = ($current_page-1)*$per_page; |
|
495 | - $limit = array( $offset, $per_page ); |
|
494 | + $offset = ($current_page - 1) * $per_page; |
|
495 | + $limit = array($offset, $per_page); |
|
496 | 496 | |
497 | - if ( isset( $this->_req_data['s'] ) ) { |
|
498 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
497 | + if (isset($this->_req_data['s'])) { |
|
498 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
499 | 499 | $_where['OR'] = array( |
500 | - 'PRC_name' => array('LIKE',$sstr ), |
|
501 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
502 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
503 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
500 | + 'PRC_name' => array('LIKE', $sstr), |
|
501 | + 'PRC_desc' => array('LIKE', $sstr), |
|
502 | + 'PRC_amount' => array('LIKE', $sstr), |
|
503 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
504 | 504 | ); |
505 | 505 | } |
506 | 506 | |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | 'group_by'=>'PRC_ID' |
512 | 512 | ); |
513 | 513 | |
514 | - if($count){ |
|
515 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | - }else{ |
|
514 | + if ($count) { |
|
515 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | + } else { |
|
517 | 517 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
518 | 518 | } |
519 | 519 | } |
@@ -529,40 +529,40 @@ discard block |
||
529 | 529 | * @return void |
530 | 530 | */ |
531 | 531 | protected function _edit_price_details() { |
532 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
532 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
533 | 533 | // grab price ID |
534 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
534 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
535 | 535 | // change page title based on request action |
536 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
536 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
537 | 537 | // add PRC_ID to title if editing |
538 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
538 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
539 | 539 | |
540 | 540 | // get prices |
541 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
541 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
542 | 542 | $PRC = EEM_Price::instance(); |
543 | 543 | |
544 | - if ( $PRC_ID ) { |
|
545 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
544 | + if ($PRC_ID) { |
|
545 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
546 | 546 | $additional_hidden_fields = array( |
547 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
547 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
548 | 548 | ); |
549 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
549 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
550 | 550 | } else { |
551 | 551 | $price = $PRC->get_new_price(); |
552 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
552 | + $this->_set_add_edit_form_tags('insert_price'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $this->_template_args['PRC_ID'] = $PRC_ID; |
556 | 556 | $this->_template_args['price'] = $price; |
557 | 557 | |
558 | 558 | // get price types |
559 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
559 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
560 | 560 | $PRT = EEM_Price_Type::instance(); |
561 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
561 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
562 | 562 | $price_type_names = array(); |
563 | 563 | if (empty($price_types)) { |
564 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
565 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
564 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
565 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
566 | 566 | exit(); |
567 | 567 | } else { |
568 | 568 | foreach ($price_types as $type) { |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $this->_template_args['price_types'] = $price_type_names; |
576 | 576 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
577 | 577 | |
578 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
578 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
579 | 579 | // the details template wrapper |
580 | 580 | $this->display_admin_page_with_sidebar(); |
581 | 581 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * @return void |
592 | 592 | */ |
593 | 593 | protected function _price_details_meta_boxes() { |
594 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
594 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function _edit_price_details_meta_box() { |
608 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
608 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | */ |
620 | 620 | protected function set_price_column_values() { |
621 | 621 | |
622 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
622 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
623 | 623 | |
624 | 624 | $set_column_values = array( |
625 | 625 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | * @access protected |
648 | 648 | * @return void |
649 | 649 | */ |
650 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
650 | + protected function _insert_or_update_price($insert = FALSE) { |
|
651 | 651 | |
652 | 652 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
653 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
653 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
654 | 654 | |
655 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
655 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
656 | 656 | $PRC = EEM_Price::instance(); |
657 | 657 | |
658 | 658 | // why be so pessimistic ??? : ( |
@@ -660,14 +660,14 @@ discard block |
||
660 | 660 | |
661 | 661 | $set_column_values = $this->set_price_column_values(); |
662 | 662 | // is this a new Price ? |
663 | - if ( $insert ) { |
|
663 | + if ($insert) { |
|
664 | 664 | // run the insert |
665 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
665 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
666 | 666 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
667 | 667 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
668 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
668 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
669 | 669 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
670 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
670 | + $ticket->_add_relation_to($PR, 'Price'); |
|
671 | 671 | $ticket->save(); |
672 | 672 | } |
673 | 673 | $success = 1; |
@@ -677,29 +677,29 @@ discard block |
||
677 | 677 | } |
678 | 678 | $action_desc = 'created'; |
679 | 679 | } else { |
680 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
680 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
681 | 681 | // run the update |
682 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
683 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
682 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
683 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
684 | 684 | $success = 1; |
685 | 685 | } |
686 | 686 | |
687 | 687 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
688 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
688 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
689 | 689 | |
690 | 690 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
691 | - if ( $PRC_ID === 1 ) { |
|
691 | + if ($PRC_ID === 1) { |
|
692 | 692 | $ticket = $PR->get_first_related('Ticket'); |
693 | - if ( $ticket ) { |
|
694 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
695 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
693 | + if ($ticket) { |
|
694 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
695 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
696 | 696 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
697 | 697 | $ticket->save(); |
698 | 698 | } |
699 | 699 | } else { |
700 | 700 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
701 | 701 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
702 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
702 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
703 | 703 | $ticket->save(); |
704 | 704 | } |
705 | 705 | } |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | $action_desc = 'updated'; |
708 | 708 | } |
709 | 709 | |
710 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
710 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
711 | 711 | |
712 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
712 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
713 | 713 | |
714 | 714 | } |
715 | 715 | |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * @access protected |
724 | 724 | * @return void |
725 | 725 | */ |
726 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
726 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
727 | 727 | |
728 | 728 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
729 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
729 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
730 | 730 | |
731 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
731 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
732 | 732 | $PRC = EEM_Price::instance(); |
733 | 733 | |
734 | 734 | $success = 1; |
@@ -737,18 +737,18 @@ discard block |
||
737 | 737 | //get base ticket for updating |
738 | 738 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
739 | 739 | //Checkboxes |
740 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
740 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
741 | 741 | // if array has more than one element than success message should be plural |
742 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
742 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
743 | 743 | // cycle thru checkboxes |
744 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
745 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
744 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
745 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
746 | 746 | $success = 0; |
747 | 747 | } else { |
748 | 748 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
749 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
749 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
750 | 750 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
751 | - if ( $PRC_deleted ) { |
|
751 | + if ($PRC_deleted) { |
|
752 | 752 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
753 | 753 | } else { |
754 | 754 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -760,14 +760,14 @@ discard block |
||
760 | 760 | |
761 | 761 | } else { |
762 | 762 | // grab single id and delete |
763 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
764 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
763 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
764 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
765 | 765 | $success = 0; |
766 | 766 | } else { |
767 | 767 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
768 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
768 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
769 | 769 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
770 | - if ( $PRC_deleted ) { |
|
770 | + if ($PRC_deleted) { |
|
771 | 771 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
772 | 772 | } else { |
773 | 773 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -781,17 +781,17 @@ discard block |
||
781 | 781 | 'action' => 'default' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( $success ) { |
|
785 | - if ( $trash ) { |
|
784 | + if ($success) { |
|
785 | + if ($trash) { |
|
786 | 786 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
787 | 787 | } else { |
788 | 788 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
789 | 789 | } |
790 | 790 | |
791 | - EE_Error::add_success( $msg ); |
|
791 | + EE_Error::add_success($msg); |
|
792 | 792 | } |
793 | 793 | |
794 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
794 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
795 | 795 | |
796 | 796 | } |
797 | 797 | |
@@ -808,19 +808,19 @@ discard block |
||
808 | 808 | protected function _delete_price() { |
809 | 809 | |
810 | 810 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
811 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
811 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
812 | 812 | |
813 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
813 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
814 | 814 | $PRC = EEM_Price::instance(); |
815 | 815 | |
816 | 816 | $success = 1; |
817 | 817 | //Checkboxes |
818 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
818 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
819 | 819 | // if array has more than one element than success message should be plural |
820 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
820 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
821 | 821 | // cycle thru bulk action checkboxes |
822 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
823 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
822 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
823 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
824 | 824 | $success = 0; |
825 | 825 | } |
826 | 826 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | |
835 | 835 | } |
836 | 836 | |
837 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
837 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
838 | 838 | |
839 | 839 | } |
840 | 840 | |
@@ -842,16 +842,16 @@ discard block |
||
842 | 842 | |
843 | 843 | |
844 | 844 | public function update_price_order() { |
845 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
845 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
846 | 846 | |
847 | 847 | // grab our row IDs |
848 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
848 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
849 | 849 | |
850 | - if ( is_array( $row_ids )) { |
|
851 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
850 | + if (is_array($row_ids)) { |
|
851 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
852 | 852 | //Update the prices when re-ordering |
853 | 853 | $id = absint($row_ids[$i]); |
854 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
854 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
855 | 855 | $success = FALSE; |
856 | 856 | } |
857 | 857 | } |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | $success = FALSE; |
860 | 860 | } |
861 | 861 | |
862 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
862 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
863 | 863 | |
864 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
864 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
865 | 865 | die(); |
866 | 866 | } |
867 | 867 | |
@@ -904,46 +904,46 @@ discard block |
||
904 | 904 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
905 | 905 | * @return mixed (int|array) int = count || array of price objects |
906 | 906 | */ |
907 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
907 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
908 | 908 | |
909 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
909 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
910 | 910 | // start with an empty array |
911 | 911 | |
912 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
913 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
912 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
913 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
914 | 914 | |
915 | 915 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
916 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
916 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
917 | 917 | switch ($this->_req_data['orderby']) { |
918 | 918 | case 'name': |
919 | - $orderby = array( 'PRT_name' => $order); |
|
919 | + $orderby = array('PRT_name' => $order); |
|
920 | 920 | break; |
921 | 921 | default: |
922 | - $orderby = array( 'PRT_order' => $order); |
|
922 | + $orderby = array('PRT_order' => $order); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
926 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
927 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
926 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
927 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
928 | 928 | |
929 | - $offset = ($current_page-1)*$per_page; |
|
930 | - $limit = array( $offset, $per_page ); |
|
929 | + $offset = ($current_page - 1) * $per_page; |
|
930 | + $limit = array($offset, $per_page); |
|
931 | 931 | |
932 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
932 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
933 | 933 | |
934 | - if ( isset( $this->_req_data['s'] ) ) { |
|
935 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
934 | + if (isset($this->_req_data['s'])) { |
|
935 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
936 | 936 | $_where['OR'] = array( |
937 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
937 | + 'PRT_name' => array('LIKE', $sstr) |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | $query_params = array( |
941 | 941 | $_where, |
942 | 942 | 'order_by'=>$orderby, |
943 | 943 | 'limit'=>$limit); |
944 | - if($count){ |
|
944 | + if ($count) { |
|
945 | 945 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
946 | - }else{ |
|
946 | + } else { |
|
947 | 947 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
948 | 948 | } |
949 | 949 | |
@@ -963,25 +963,25 @@ discard block |
||
963 | 963 | */ |
964 | 964 | protected function _edit_price_type_details() { |
965 | 965 | |
966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
967 | 967 | |
968 | 968 | |
969 | 969 | // grab price type ID |
970 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
970 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
971 | 971 | // change page title based on request action |
972 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
972 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
973 | 973 | // add PRT_ID to title if editing |
974 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
974 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
975 | 975 | |
976 | 976 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
977 | 977 | |
978 | - if ( $PRT_ID ) { |
|
979 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
980 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
981 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
978 | + if ($PRT_ID) { |
|
979 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
980 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
981 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
982 | 982 | } else { |
983 | 983 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
984 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
984 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -990,19 +990,19 @@ discard block |
||
990 | 990 | |
991 | 991 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
992 | 992 | $select_values = array(); |
993 | - foreach ( $base_types as $ref => $text ) { |
|
994 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
993 | + foreach ($base_types as $ref => $text) { |
|
994 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
995 | 995 | //do not allow creation of base_type_base_prices because that's a system only base type. |
996 | 996 | continue; |
997 | 997 | } |
998 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
998 | + $values[] = array('id' => $ref, 'text' => $text); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
1002 | 1002 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1003 | 1003 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1004 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1005 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1004 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1005 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1006 | 1006 | // the details template wrapper |
1007 | 1007 | $this->display_admin_page_with_sidebar(); |
1008 | 1008 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @return void |
1020 | 1020 | */ |
1021 | 1021 | protected function _price_type_details_meta_boxes() { |
1022 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1022 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | * @return void |
1033 | 1033 | */ |
1034 | 1034 | public function _edit_price_type_details_meta_box() { |
1035 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1035 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | |
@@ -1045,9 +1045,9 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | protected function set_price_type_column_values() { |
1047 | 1047 | |
1048 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1048 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1049 | 1049 | |
1050 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1050 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1051 | 1051 | |
1052 | 1052 | switch ($base_type) { |
1053 | 1053 | |
@@ -1094,12 +1094,12 @@ discard block |
||
1094 | 1094 | * @access protected |
1095 | 1095 | * @return void |
1096 | 1096 | */ |
1097 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1097 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1098 | 1098 | |
1099 | 1099 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1100 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1100 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1101 | 1101 | |
1102 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1102 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1103 | 1103 | $PRT = EEM_Price_Type::instance(); |
1104 | 1104 | |
1105 | 1105 | // why be so pessimistic ??? : ( |
@@ -1107,24 +1107,24 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | $set_column_values = $this->set_price_type_column_values(); |
1109 | 1109 | // is this a new Price ? |
1110 | - if ( $new_price_type ) { |
|
1110 | + if ($new_price_type) { |
|
1111 | 1111 | // run the insert |
1112 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1112 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1113 | 1113 | $success = 1; |
1114 | 1114 | } |
1115 | 1115 | $action_desc = 'created'; |
1116 | 1116 | } else { |
1117 | 1117 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1118 | 1118 | // run the update |
1119 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1120 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1119 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1120 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1121 | 1121 | $success = 1; |
1122 | 1122 | } |
1123 | 1123 | $action_desc = 'updated'; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1127 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1126 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1127 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1128 | 1128 | |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1138,49 +1138,49 @@ discard block |
||
1138 | 1138 | * @access protected |
1139 | 1139 | * @return void |
1140 | 1140 | */ |
1141 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1141 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1142 | 1142 | |
1143 | 1143 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1144 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1144 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1145 | 1145 | |
1146 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1146 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1147 | 1147 | $PRT = EEM_Price_Type::instance(); |
1148 | 1148 | |
1149 | 1149 | $success = 1; |
1150 | 1150 | $PRT_deleted = $trash ? TRUE : FALSE; |
1151 | 1151 | //Checkboxes |
1152 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1152 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1153 | 1153 | // if array has more than one element than success message should be plural |
1154 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1155 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1154 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1155 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1156 | 1156 | // cycle thru checkboxes |
1157 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1158 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1157 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1158 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | } else { |
1164 | 1164 | // grab single id and delete |
1165 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1166 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1165 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1166 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1167 | 1167 | $success = 0; |
1168 | 1168 | } |
1169 | 1169 | $what = 'Price Type'; |
1170 | 1170 | |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $query_args = array( 'action' => 'price_types' ); |
|
1174 | - if ( $success ) { |
|
1175 | - if ( $trash ) { |
|
1173 | + $query_args = array('action' => 'price_types'); |
|
1174 | + if ($success) { |
|
1175 | + if ($trash) { |
|
1176 | 1176 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1177 | 1177 | } else { |
1178 | 1178 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1179 | 1179 | } |
1180 | - EE_Error::add_success( $msg ); |
|
1180 | + EE_Error::add_success($msg); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1183 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1184 | 1184 | |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1197,19 +1197,19 @@ discard block |
||
1197 | 1197 | protected function _delete_price_type() { |
1198 | 1198 | |
1199 | 1199 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1200 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1200 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1201 | 1201 | |
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | //Checkboxes |
1206 | - if (!empty($this->_req_data['checkbox'])) { |
|
1206 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1207 | 1207 | // if array has more than one element than success message should be plural |
1208 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1208 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1209 | 1209 | $what = $PRT->item_name($success); |
1210 | 1210 | // cycle thru bulk action checkboxes |
1211 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1212 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1211 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1212 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1213 | 1213 | $success = 0; |
1214 | 1214 | } |
1215 | 1215 | } |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | - $query_args = array( 'action'=> 'price_types' ); |
|
1221 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1220 | + $query_args = array('action'=> 'price_types'); |
|
1221 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1222 | 1222 | |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | * @return string |
1235 | 1235 | */ |
1236 | 1236 | protected function _learn_more_about_pricing_link() { |
1237 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1237 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS ); |
|
35 | - define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS ); |
|
36 | - define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' ); |
|
37 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS ); |
|
38 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' ); |
|
39 | - parent::__construct( $routing ); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS); |
|
35 | + define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS); |
|
36 | + define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/'); |
|
37 | + define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS); |
|
38 | + define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/'); |
|
39 | + parent::__construct($routing); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | protected function _extend_page_config() { |
48 | 48 | $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN; |
49 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
50 | - $qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0; |
|
49 | + $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
50 | + $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0; |
|
51 | 51 | |
52 | 52 | $new_page_routes = array( |
53 | 53 | 'question_groups' => array( |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'func' => '_trash_or_restore_questions', |
81 | 81 | 'capability' => 'ee_delete_question', |
82 | 82 | 'obj_id' => $qst_id, |
83 | - 'args' => array( 'trash' => FALSE ), |
|
83 | + 'args' => array('trash' => FALSE), |
|
84 | 84 | 'noheader' => TRUE |
85 | 85 | ), |
86 | 86 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | 'trash_question_group' => array( |
141 | 141 | 'func' => '_trash_or_restore_question_groups', |
142 | - 'args' => array( 'trash' => TRUE ), |
|
142 | + 'args' => array('trash' => TRUE), |
|
143 | 143 | 'capability' => 'ee_delete_question_group', |
144 | 144 | 'obj_id' => $qsg_id, |
145 | 145 | 'noheader' => TRUE |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | 'restore_question_group' => array( |
149 | 149 | 'func' => '_trash_or_restore_question_groups', |
150 | - 'args' => array( 'trash' => FALSE ), |
|
150 | + 'args' => array('trash' => FALSE), |
|
151 | 151 | 'capability' => 'ee_delete_question_group', |
152 | 152 | 'obj_id' => $qsg_id, |
153 | 153 | 'noheader' => TRUE |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | 'update_question_group' => array( |
164 | 164 | 'func' => '_insert_or_update_question_group', |
165 | - 'args' => array('new_question_group' => FALSE ), |
|
165 | + 'args' => array('new_question_group' => FALSE), |
|
166 | 166 | 'capability' => 'ee_edit_question_group', |
167 | 167 | 'obj_id' => $qsg_id, |
168 | 168 | 'noheader' => TRUE, |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'noheader' => TRUE |
201 | 201 | ), |
202 | 202 | ); |
203 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
203 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
204 | 204 | |
205 | 205 | $new_page_config = array( |
206 | 206 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | 'filename' => 'registration_form_question_groups_views_bulk_actions_search' |
225 | 225 | ), |
226 | 226 | ), |
227 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
227 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
228 | 228 | 'metaboxes' => $this->_default_espresso_metaboxes, |
229 | 229 | 'require_nonce' => FALSE, |
230 | 230 | 'qtips' => array( |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | 'order' => 5, |
239 | 239 | 'persistent' => FALSE |
240 | 240 | ), |
241 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
241 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
242 | 242 | 'help_tabs' => array( |
243 | 243 | 'registration_form_add_question_help_tab' => array( |
244 | 244 | 'title' => __('Add Question', 'event_espresso'), |
245 | 245 | 'filename' => 'registration_form_add_question' |
246 | 246 | ), |
247 | 247 | ), |
248 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
248 | + 'help_tour' => array('Registration_Form_Add_Question_Help_Tour'), |
|
249 | 249 | 'require_nonce' => FALSE |
250 | 250 | ), |
251 | 251 | |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | 'order' => 5, |
256 | 256 | 'persistent' => FALSE |
257 | 257 | ), |
258 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
258 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
259 | 259 | 'help_tabs' => array( |
260 | 260 | 'registration_form_add_question_group_help_tab' => array( |
261 | 261 | 'title' => __('Add Question Group', 'event_espresso'), |
262 | 262 | 'filename' => 'registration_form_add_question_group' |
263 | 263 | ), |
264 | 264 | ), |
265 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
265 | + 'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'), |
|
266 | 266 | 'require_nonce' => FALSE |
267 | 267 | ), |
268 | 268 | |
@@ -271,16 +271,16 @@ discard block |
||
271 | 271 | 'label' => __('Edit Question Group', 'event_espresso'), |
272 | 272 | 'order' => 5, |
273 | 273 | 'persistent' => FALSE, |
274 | - 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
274 | + 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
275 | 275 | ), |
276 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
276 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
277 | 277 | 'help_tabs' => array( |
278 | 278 | 'registration_form_edit_question_group_help_tab' => array( |
279 | 279 | 'title' => __('Edit Question Group', 'event_espresso'), |
280 | 280 | 'filename' => 'registration_form_edit_question_group' |
281 | 281 | ), |
282 | 282 | ), |
283 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
283 | + 'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'), |
|
284 | 284 | 'require_nonce' => FALSE |
285 | 285 | ), |
286 | 286 | |
@@ -292,19 +292,19 @@ discard block |
||
292 | 292 | 'labels' => array( |
293 | 293 | 'publishbox' => __('Update Settings', 'event_espresso') |
294 | 294 | ), |
295 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
295 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
296 | 296 | 'help_tabs' => array( |
297 | 297 | 'registration_form_reg_form_settings_help_tab' => array( |
298 | 298 | 'title' => __('Registration Form Settings', 'event_espresso'), |
299 | 299 | 'filename' => 'registration_form_reg_form_settings' |
300 | 300 | ), |
301 | 301 | ), |
302 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
302 | + 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
303 | 303 | 'require_nonce' => FALSE |
304 | 304 | ) |
305 | 305 | |
306 | 306 | ); |
307 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
307 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
308 | 308 | |
309 | 309 | //change the list table we're going to use so it's the NEW list table! |
310 | 310 | $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table'; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | 'edit_question_group' => __('Edit Question Group', 'event_espresso'), |
319 | 319 | 'delete_question_group' => __('Delete Question Group', 'event_espresso'), |
320 | 320 | ); |
321 | - $this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels ); |
|
321 | + $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | |
328 | 328 | |
329 | 329 | protected function _ajax_hooks() { |
330 | - add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' )); |
|
330 | + add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order')); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | 335 | |
336 | 336 | public function load_scripts_styles_question_groups() { |
337 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
337 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return void |
356 | 356 | */ |
357 | 357 | public function load_sortable_question_script() { |
358 | - wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
358 | + wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
359 | 359 | wp_enqueue_script('ee-question-sortable'); |
360 | 360 | } |
361 | 361 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | ) |
375 | 375 | ); |
376 | 376 | |
377 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
377 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
378 | 378 | $this->_views['trash'] = array( |
379 | 379 | 'slug' => 'trash', |
380 | 380 | 'label' => __('Trash', 'event_espresso'), |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | ) |
405 | 405 | ); |
406 | 406 | |
407 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) { |
|
407 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) { |
|
408 | 408 | $this->_views['trash'] = array( |
409 | 409 | 'slug' => 'trash', |
410 | 410 | 'label' => __('Trash', 'event_espresso'), |
@@ -440,24 +440,24 @@ discard block |
||
440 | 440 | |
441 | 441 | |
442 | 442 | |
443 | - protected function _delete_question(){ |
|
444 | - $success = $this->_delete_items( $this->_question_model ); |
|
443 | + protected function _delete_question() { |
|
444 | + $success = $this->_delete_items($this->_question_model); |
|
445 | 445 | $this->_redirect_after_action( |
446 | 446 | $success, |
447 | - $this->_question_model->item_name( $success ), |
|
447 | + $this->_question_model->item_name($success), |
|
448 | 448 | 'deleted', |
449 | - array( 'action' => 'default', 'status' => 'all' ) |
|
449 | + array('action' => 'default', 'status' => 'all') |
|
450 | 450 | ); |
451 | 451 | } |
452 | 452 | |
453 | 453 | |
454 | 454 | protected function _delete_questions() { |
455 | - $success = $this->_delete_items( $this->_question_model ); |
|
455 | + $success = $this->_delete_items($this->_question_model); |
|
456 | 456 | $this->_redirect_after_action( |
457 | 457 | $success, |
458 | - $this->_question_model->item_name( $success ), |
|
458 | + $this->_question_model->item_name($success), |
|
459 | 459 | 'deleted permanently', |
460 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
460 | + array('action' => 'default', 'status' => 'trash') |
|
461 | 461 | ); |
462 | 462 | } |
463 | 463 | |
@@ -468,26 +468,26 @@ discard block |
||
468 | 468 | * @param EEM_Soft_Delete_Base $model |
469 | 469 | * @return int number of items deleted permanently |
470 | 470 | */ |
471 | - private function _delete_items(EEM_Soft_Delete_Base $model){ |
|
471 | + private function _delete_items(EEM_Soft_Delete_Base $model) { |
|
472 | 472 | $success = 0; |
473 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
474 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
473 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
474 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
475 | 475 | // if array has more than one element than success message should be plural |
476 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
476 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
477 | 477 | // cycle thru bulk action checkboxes |
478 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
479 | - if ( ! $this->_delete_item( $ID, $model ) ) { |
|
478 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
479 | + if ( ! $this->_delete_item($ID, $model)) { |
|
480 | 480 | $success = 0; |
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | - }elseif( !empty($this->_req_data['QSG_ID'])){ |
|
485 | - $success = $this->_delete_item( $this->_req_data['QSG_ID'], $model ); |
|
484 | + }elseif ( ! empty($this->_req_data['QSG_ID'])) { |
|
485 | + $success = $this->_delete_item($this->_req_data['QSG_ID'], $model); |
|
486 | 486 | |
487 | - }elseif( !empty($this->_req_data['QST_ID'])){ |
|
488 | - $success = $this->_delete_item( $this->_req_data['QST_ID'], $model ); |
|
489 | - }else{ |
|
490 | - EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ ); |
|
487 | + }elseif ( ! empty($this->_req_data['QST_ID'])) { |
|
488 | + $success = $this->_delete_item($this->_req_data['QST_ID'], $model); |
|
489 | + } else { |
|
490 | + EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__); |
|
491 | 491 | } |
492 | 492 | return $success; |
493 | 493 | } |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | * @param EEM_Soft_Delete_Base $model |
499 | 499 | * @return boolean |
500 | 500 | */ |
501 | - protected function _delete_item( $id, $model ) { |
|
502 | - if( $model instanceof EEM_Question ) { |
|
503 | - EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) ); |
|
501 | + protected function _delete_item($id, $model) { |
|
502 | + if ($model instanceof EEM_Question) { |
|
503 | + EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); |
|
504 | 504 | } |
505 | - return $model->delete_permanently_by_ID( absint( $id ) ); |
|
505 | + return $model->delete_permanently_by_ID(absint($id)); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | |
@@ -514,29 +514,29 @@ discard block |
||
514 | 514 | |
515 | 515 | |
516 | 516 | |
517 | - protected function _edit_question_group( $type = 'add' ) { |
|
518 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
519 | - $ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE; |
|
520 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
517 | + protected function _edit_question_group($type = 'add') { |
|
518 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
519 | + $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE; |
|
520 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
521 | 521 | // add ID to title if editing |
522 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
523 | - if($ID){ |
|
524 | - $questionGroup=$this->_question_group_model->get_one_by_ID($ID); |
|
525 | - $additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
522 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
523 | + if ($ID) { |
|
524 | + $questionGroup = $this->_question_group_model->get_one_by_ID($ID); |
|
525 | + $additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
526 | 526 | $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); |
527 | - }else{ |
|
527 | + } else { |
|
528 | 528 | $questionGroup = EEM_Question_Group::instance()->create_default_object(); |
529 | 529 | $questionGroup->set_order_to_latest(); |
530 | 530 | $this->_set_add_edit_form_tags('insert_question_group'); |
531 | 531 | } |
532 | 532 | $this->_template_args['values'] = $this->_yes_no_values; |
533 | - $this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group(); |
|
534 | - $this->_template_args['QSG_ID']=$ID ? $ID : TRUE; |
|
535 | - $this->_template_args['question_group']=$questionGroup; |
|
533 | + $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group(); |
|
534 | + $this->_template_args['QSG_ID'] = $ID ? $ID : TRUE; |
|
535 | + $this->_template_args['question_group'] = $questionGroup; |
|
536 | 536 | |
537 | - $redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url ); |
|
538 | - $this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL ); |
|
539 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
537 | + $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url); |
|
538 | + $this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL); |
|
539 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE); |
|
540 | 540 | |
541 | 541 | // the details template wrapper |
542 | 542 | $this->display_admin_page_with_sidebar(); |
@@ -547,76 +547,76 @@ discard block |
||
547 | 547 | |
548 | 548 | protected function _delete_question_groups() { |
549 | 549 | $success = $this->_delete_items($this->_question_group_model); |
550 | - $this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' )); |
|
550 | + $this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash')); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | |
554 | 554 | |
555 | - protected function _insert_or_update_question_group( $new_question_group = TRUE) { |
|
556 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
557 | - $set_column_values=$this->_set_column_values_for($this->_question_group_model); |
|
558 | - if ( $new_question_group ){ |
|
555 | + protected function _insert_or_update_question_group($new_question_group = TRUE) { |
|
556 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
557 | + $set_column_values = $this->_set_column_values_for($this->_question_group_model); |
|
558 | + if ($new_question_group) { |
|
559 | 559 | $QSG_ID = $this->_question_group_model->insert($set_column_values); |
560 | 560 | $success = $QSG_ID ? 1 : 0; |
561 | 561 | } else { |
562 | 562 | $QSG_ID = absint($this->_req_data['QSG_ID']); |
563 | - unset( $set_column_values[ 'QSG_ID' ] ); |
|
564 | - $success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID ))); |
|
563 | + unset($set_column_values['QSG_ID']); |
|
564 | + $success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID))); |
|
565 | 565 | } |
566 | - $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone ); |
|
566 | + $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone); |
|
567 | 567 | // update the existing related questions |
568 | 568 | // BUT FIRST... delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group) |
569 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) { |
|
569 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) { |
|
570 | 570 | // delete where QST ID = system phone question ID and Question Group ID is NOT this group |
571 | - EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID )))); |
|
571 | + EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID)))); |
|
572 | 572 | } |
573 | 573 | /** @type EE_Question_Group $question_group */ |
574 | - $question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID ); |
|
574 | + $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID); |
|
575 | 575 | $questions = $question_group->questions(); |
576 | 576 | // make sure system phone question is added to list of questions for this group |
577 | - if ( ! isset( $questions[$phone_question_id ] )) { |
|
578 | - $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id ); |
|
577 | + if ( ! isset($questions[$phone_question_id])) { |
|
578 | + $questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id); |
|
579 | 579 | } |
580 | 580 | |
581 | - foreach( $questions as $question_ID => $question ){ |
|
581 | + foreach ($questions as $question_ID => $question) { |
|
582 | 582 | // first we always check for order. |
583 | - if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){ |
|
583 | + if ( ! empty($this->_req_data['question_orders'][$question_ID])) { |
|
584 | 584 | //update question order |
585 | - $question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] ); |
|
585 | + $question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | // then we always check if adding or removing. |
589 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) { |
|
590 | - $question_group->add_question( $question_ID ); |
|
589 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) { |
|
590 | + $question_group->add_question($question_ID); |
|
591 | 591 | } else { |
592 | 592 | // not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it) |
593 | 593 | if ( |
594 | 594 | in_array( |
595 | 595 | $question->system_ID(), |
596 | - EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() ) |
|
596 | + EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group()) |
|
597 | 597 | ) |
598 | 598 | ) { |
599 | 599 | continue; |
600 | 600 | } else { |
601 | - $question_group->remove_question( $question_ID ); |
|
601 | + $question_group->remove_question($question_ID); |
|
602 | 602 | } |
603 | 603 | } |
604 | 604 | } |
605 | 605 | // save new related questions |
606 | - if ( isset( $this->_req_data['questions'] )) { |
|
607 | - foreach( $this->_req_data['questions'] as $QST_ID ){ |
|
608 | - $question_group->add_question( $QST_ID ); |
|
609 | - if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) { |
|
610 | - $question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] ); |
|
606 | + if (isset($this->_req_data['questions'])) { |
|
607 | + foreach ($this->_req_data['questions'] as $QST_ID) { |
|
608 | + $question_group->add_question($QST_ID); |
|
609 | + if (isset($this->_req_data['question_orders'][$QST_ID])) { |
|
610 | + $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | - if ( $success !== FALSE ) { |
|
616 | - $msg = $new_question_group ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() ); |
|
617 | - EE_Error::add_success( $msg ); |
|
615 | + if ($success !== FALSE) { |
|
616 | + $msg = $new_question_group ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name()); |
|
617 | + EE_Error::add_success($msg); |
|
618 | 618 | } |
619 | - $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE); |
|
619 | + $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE); |
|
620 | 620 | |
621 | 621 | } |
622 | 622 | |
@@ -624,39 +624,39 @@ discard block |
||
624 | 624 | * duplicates a question and all its question options and redirects to the new question. |
625 | 625 | */ |
626 | 626 | public function _duplicate_question() { |
627 | - $question_ID = intval( $this->_req_data[ 'QST_ID' ] ); |
|
628 | - $question = EEM_Question::instance()->get_one_by_ID( $question_ID ); |
|
629 | - if( $question instanceof EE_Question ) { |
|
627 | + $question_ID = intval($this->_req_data['QST_ID']); |
|
628 | + $question = EEM_Question::instance()->get_one_by_ID($question_ID); |
|
629 | + if ($question instanceof EE_Question) { |
|
630 | 630 | $new_question = $question->duplicate(); |
631 | - if( $new_question instanceof EE_Question ) { |
|
632 | - $this->_redirect_after_action( true, __( 'Question', 'event_espresso' ), __( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE); |
|
631 | + if ($new_question instanceof EE_Question) { |
|
632 | + $this->_redirect_after_action(true, __('Question', 'event_espresso'), __('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE); |
|
633 | 633 | } else { |
634 | 634 | global $wpdb; |
635 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ ); |
|
636 | - $this->_redirect_after_action(false, '', '', array('action'=>'default'), false ); |
|
635 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__); |
|
636 | + $this->_redirect_after_action(false, '', '', array('action'=>'default'), false); |
|
637 | 637 | } |
638 | 638 | } else { |
639 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ ); |
|
640 | - $this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false ); |
|
639 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__); |
|
640 | + $this->_redirect_after_action(false, '', '', array('action' => 'default'), false); |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
644 | 644 | |
645 | 645 | |
646 | 646 | protected function _trash_or_restore_question_groups($trash = TRUE) { |
647 | - return $this->_trash_or_restore_items( $this->_question_group_model, $trash ); |
|
647 | + return $this->_trash_or_restore_items($this->_question_group_model, $trash); |
|
648 | 648 | } |
649 | 649 | |
650 | - protected function _trash_question(){ |
|
651 | - $success=$this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID'])); |
|
652 | - $query_args=array('action'=>'default','status'=>'all'); |
|
650 | + protected function _trash_question() { |
|
651 | + $success = $this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID'])); |
|
652 | + $query_args = array('action'=>'default', 'status'=>'all'); |
|
653 | 653 | $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args); |
654 | 654 | } |
655 | 655 | |
656 | 656 | |
657 | 657 | |
658 | - protected function _trash_or_restore_questions($trash=TRUE){ |
|
659 | - $this->_trash_or_restore_items( $this->_question_model, $trash ); |
|
658 | + protected function _trash_or_restore_questions($trash = TRUE) { |
|
659 | + $this->_trash_or_restore_items($this->_question_model, $trash); |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | |
@@ -667,21 +667,21 @@ discard block |
||
667 | 667 | * @param EEM_Base $model |
668 | 668 | * @param boolean $trash wehter to trash or restore |
669 | 669 | */ |
670 | - private function _trash_or_restore_items( EEM_Base $model, $trash = TRUE ) { |
|
670 | + private function _trash_or_restore_items(EEM_Base $model, $trash = TRUE) { |
|
671 | 671 | |
672 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
672 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
673 | 673 | |
674 | 674 | $success = 1; |
675 | 675 | //Checkboxes |
676 | 676 | //echo "trash $trash"; |
677 | 677 | //var_dump($this->_req_data['checkbox']);die; |
678 | - if ( isset( $this->_req_data['checkbox'] )) { |
|
679 | - if ( isset( $this->_req_data['checkbox'] ) && ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
678 | + if (isset($this->_req_data['checkbox'])) { |
|
679 | + if (isset($this->_req_data['checkbox']) && ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
680 | 680 | // if array has more than one element than success message should be plural |
681 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
681 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
682 | 682 | // cycle thru bulk action checkboxes |
683 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
684 | - if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) { |
|
683 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
684 | + if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) { |
|
685 | 685 | $success = 0; |
686 | 686 | } |
687 | 687 | } |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | } else { |
690 | 690 | // grab single id and delete |
691 | 691 | $ID = absint($this->_req_data['checkbox']); |
692 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
692 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
693 | 693 | $success = 0; |
694 | 694 | } |
695 | 695 | } |
@@ -697,53 +697,53 @@ discard block |
||
697 | 697 | } else { |
698 | 698 | // delete via trash link |
699 | 699 | // grab single id and delete |
700 | - $ID = absint($this->_req_data[ $model->primary_key_name() ]); |
|
701 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
700 | + $ID = absint($this->_req_data[$model->primary_key_name()]); |
|
701 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
702 | 702 | $success = 0; |
703 | 703 | } |
704 | 704 | |
705 | 705 | } |
706 | 706 | |
707 | 707 | |
708 | - $action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) ); |
|
708 | + $action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) ); |
|
709 | 709 | //echo "action :$action"; |
710 | 710 | //$action = 'questions' ? 'default' : $action; |
711 | - if($trash){ |
|
711 | + if ($trash) { |
|
712 | 712 | $action_desc = 'trashed'; |
713 | 713 | $status = 'trash'; |
714 | - }else{ |
|
714 | + } else { |
|
715 | 715 | $action_desc = 'restored'; |
716 | 716 | $status = 'all'; |
717 | 717 | } |
718 | - $this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) ); |
|
718 | + $this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status)); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
722 | 722 | |
723 | 723 | |
724 | - public function get_trashed_questions( $per_page,$current_page = 1, $count = FALSE ) { |
|
724 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
725 | 725 | $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
726 | 726 | |
727 | - if( $count ){ |
|
727 | + if ($count) { |
|
728 | 728 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
729 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
730 | - $results=$this->_question_model->count_deleted($where); |
|
731 | - }else{ |
|
729 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
730 | + $results = $this->_question_model->count_deleted($where); |
|
731 | + } else { |
|
732 | 732 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
733 | - $results=$this->_question_model->get_all_deleted($query_params); |
|
733 | + $results = $this->_question_model->get_all_deleted($query_params); |
|
734 | 734 | } |
735 | 735 | return $results; |
736 | 736 | } |
737 | 737 | |
738 | 738 | |
739 | 739 | |
740 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
741 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
742 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
743 | - if ($count){ |
|
744 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
740 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
741 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
742 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
743 | + if ($count) { |
|
744 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
745 | 745 | $results = $questionGroupModel->count($where); |
746 | - }else{ |
|
746 | + } else { |
|
747 | 747 | $results = $questionGroupModel->get_all($query_params); |
748 | 748 | } |
749 | 749 | return $results; |
@@ -751,14 +751,14 @@ discard block |
||
751 | 751 | |
752 | 752 | |
753 | 753 | |
754 | - public function get_trashed_question_groups( $per_page,$current_page = 1, $count = FALSE ) { |
|
755 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
756 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
757 | - if($count){ |
|
758 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
754 | + public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
755 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
756 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
757 | + if ($count) { |
|
758 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
759 | 759 | $query_params['limit'] = NULL; |
760 | 760 | $results = $questionGroupModel->count_deleted($where); |
761 | - }else{ |
|
761 | + } else { |
|
762 | 762 | $results = $questionGroupModel->get_all_deleted($query_params); |
763 | 763 | } |
764 | 764 | return $results; |
@@ -771,22 +771,22 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function update_question_group_order() { |
773 | 773 | |
774 | - $success = __( 'Question group order was updated successfully.', 'event_espresso' ); |
|
774 | + $success = __('Question group order was updated successfully.', 'event_espresso'); |
|
775 | 775 | |
776 | 776 | // grab our row IDs |
777 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
777 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
778 | 778 | |
779 | - $perpage = !empty( $this->_req_data['perpage'] ) ? (int) $this->_req_data['perpage'] : NULL; |
|
780 | - $curpage = !empty( $this->_req_data['curpage'] ) ? (int) $this->_req_data['curpage'] : NULL; |
|
779 | + $perpage = ! empty($this->_req_data['perpage']) ? (int) $this->_req_data['perpage'] : NULL; |
|
780 | + $curpage = ! empty($this->_req_data['curpage']) ? (int) $this->_req_data['curpage'] : NULL; |
|
781 | 781 | |
782 | - if ( is_array( $row_ids )) { |
|
782 | + if (is_array($row_ids)) { |
|
783 | 783 | //figure out where we start the row_id count at for the current page. |
784 | - $qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage; |
|
784 | + $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage; |
|
785 | 785 | |
786 | 786 | global $wpdb; |
787 | - for ( $i = 0; $i < count($row_ids); $i++ ) { |
|
787 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
788 | 788 | //Update the questions when re-ordering |
789 | - if ( EEM_Question_Group::instance()->update ( array( 'QSG_order' => $qsgcount ), array(array( 'QSG_ID' => $row_ids[$i] ))) === FALSE ) { |
|
789 | + if (EEM_Question_Group::instance()->update(array('QSG_order' => $qsgcount), array(array('QSG_ID' => $row_ids[$i]))) === FALSE) { |
|
790 | 790 | $success = FALSE; |
791 | 791 | } |
792 | 792 | $qsgcount++; |
@@ -795,9 +795,9 @@ discard block |
||
795 | 795 | $success = FALSE; |
796 | 796 | } |
797 | 797 | |
798 | - $errors = ! $success ? __( 'An error occurred. The question group order was not updated.', 'event_espresso' ) : FALSE; |
|
798 | + $errors = ! $success ? __('An error occurred. The question group order was not updated.', 'event_espresso') : FALSE; |
|
799 | 799 | |
800 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
800 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
801 | 801 | die(); |
802 | 802 | |
803 | 803 | } |
@@ -814,10 +814,10 @@ discard block |
||
814 | 814 | |
815 | 815 | protected function _reg_form_settings() { |
816 | 816 | $this->_template_args['values'] = $this->_yes_no_values; |
817 | - $this->_template_args = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args ); |
|
818 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
819 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
820 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
817 | + $this->_template_args = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args); |
|
818 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
819 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
820 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
821 | 821 | $this->display_admin_page_with_sidebar(); |
822 | 822 | } |
823 | 823 | |
@@ -825,9 +825,9 @@ discard block |
||
825 | 825 | |
826 | 826 | |
827 | 827 | protected function _update_reg_form_settings() { |
828 | - EE_Registry::instance()->CFG->registration = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration ); |
|
829 | - $success = $this->_update_espresso_configuration( __('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
830 | - $this->_redirect_after_action( $success, __('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) ); |
|
828 | + EE_Registry::instance()->CFG->registration = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration); |
|
829 | + $success = $this->_update_espresso_configuration(__('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
830 | + $this->_redirect_after_action($success, __('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings')); |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | } |