@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param WP $WP |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - public abstract function run( WP $WP ); |
|
45 | + public abstract function run(WP $WP); |
|
46 | 46 | |
47 | 47 | |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param array $attributes |
55 | 55 | * @return mixed |
56 | 56 | */ |
57 | - public abstract function process_shortcode( $attributes = array() ); |
|
57 | + public abstract function process_shortcode($attributes = array()); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @param string $shortcode_class |
66 | 66 | * @return \EES_Shortcode |
67 | 67 | */ |
68 | - final public static function instance( $shortcode_class = NULL ) { |
|
69 | - $shortcode_class = ! empty( $shortcode_class ) ? $shortcode_class : get_called_class(); |
|
70 | - if ( $shortcode_class == 'EES_Shortcode' || empty( $shortcode_class )) { |
|
68 | + final public static function instance($shortcode_class = NULL) { |
|
69 | + $shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class(); |
|
70 | + if ($shortcode_class == 'EES_Shortcode' || empty($shortcode_class)) { |
|
71 | 71 | return NULL; |
72 | 72 | } |
73 | - $shortcode = str_replace( 'EES_', '', strtoupper( $shortcode_class )); |
|
74 | - $shortcode_obj = isset( EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
73 | + $shortcode = str_replace('EES_', '', strtoupper($shortcode_class)); |
|
74 | + $shortcode_obj = isset(EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
75 | 75 | return $shortcode_obj instanceof $shortcode_class || $shortcode_class == 'self' ? $shortcode_obj : new $shortcode_class(); |
76 | 76 | } |
77 | 77 | |
@@ -86,20 +86,20 @@ discard block |
||
86 | 86 | * @param $attributes |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - final public static function fallback_shortcode_processor( $attributes ) { |
|
89 | + final public static function fallback_shortcode_processor($attributes) { |
|
90 | 90 | // what shortcode was actually parsed ? |
91 | 91 | $shortcode_class = get_called_class(); |
92 | 92 | // notify rest of system that fallback processor was triggered |
93 | - add_filter( 'FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true' ); |
|
93 | + add_filter('FHEE__fallback_shortcode_processor__'.$shortcode_class, '__return_true'); |
|
94 | 94 | // get instance of actual shortcode |
95 | - $shortcode_obj = self::instance( $shortcode_class ); |
|
95 | + $shortcode_obj = self::instance($shortcode_class); |
|
96 | 96 | // verify class |
97 | - if ( $shortcode_obj instanceof EES_Shortcode ) { |
|
97 | + if ($shortcode_obj instanceof EES_Shortcode) { |
|
98 | 98 | global $wp; |
99 | - $shortcode_obj->run( $wp ); |
|
99 | + $shortcode_obj->run($wp); |
|
100 | 100 | // set attributes and run the shortcode |
101 | - $shortcode_obj->_attributes = (array)$attributes; |
|
102 | - return $shortcode_obj->process_shortcode( $shortcode_obj->_attributes ); |
|
101 | + $shortcode_obj->_attributes = (array) $attributes; |
|
102 | + return $shortcode_obj->process_shortcode($shortcode_obj->_attributes); |
|
103 | 103 | } else { |
104 | 104 | return NULL; |
105 | 105 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param $attributes |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - final public static function invalid_shortcode_processor( $attributes ) { |
|
118 | + final public static function invalid_shortcode_processor($attributes) { |
|
119 | 119 | return ''; |
120 | 120 | } |
121 | 121 | |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | */ |
130 | 130 | final public function __construct() { |
131 | 131 | // get classname, remove EES_prefix, and convert to UPPERCASE |
132 | - $shortcode = strtoupper( str_replace( 'EES_', '', get_class( $this ))); |
|
132 | + $shortcode = strtoupper(str_replace('EES_', '', get_class($this))); |
|
133 | 133 | // assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier |
134 | - add_shortcode( $shortcode, array( $this, 'process_shortcode' )); |
|
134 | + add_shortcode($shortcode, array($this, 'process_shortcode')); |
|
135 | 135 | // make sure system knows this is an EE page |
136 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
136 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | 60 | // check if class object is instantiated, and instantiated properly |
61 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Network_Config )) { |
|
61 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Network_Config)) { |
|
62 | 62 | self::$_instance = new self(); |
63 | 63 | } |
64 | 64 | return self::$_instance; |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * @return void |
75 | 75 | */ |
76 | 76 | private function __construct() { |
77 | - do_action( 'AHEE__EE_Network_Config__construct__begin',$this ); |
|
77 | + do_action('AHEE__EE_Network_Config__construct__begin', $this); |
|
78 | 78 | //set defaults |
79 | - $this->core = apply_filters( 'FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config() ); |
|
79 | + $this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config()); |
|
80 | 80 | $this->addons = array(); |
81 | 81 | |
82 | 82 | $this->_load_config(); |
83 | 83 | |
84 | 84 | // construct__end hook |
85 | - do_action( 'AHEE__EE_Network_Config__construct__end',$this ); |
|
85 | + do_action('AHEE__EE_Network_Config__construct__end', $this); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | */ |
96 | 96 | private function _load_config() { |
97 | 97 | $config = $this->get_config(); |
98 | - foreach ( $config as $prop => $settings ) { |
|
99 | - $prop_class = is_object( $settings ) ? get_class( $this->{$prop} ) : FALSE; |
|
100 | - if ( ! empty( $settings ) && ( ! $prop_class || ( $settings instanceof $prop_class ))) { |
|
98 | + foreach ($config as $prop => $settings) { |
|
99 | + $prop_class = is_object($settings) ? get_class($this->{$prop} ) : FALSE; |
|
100 | + if ( ! empty($settings) && ( ! $prop_class || ($settings instanceof $prop_class))) { |
|
101 | 101 | $this->{$prop} = $settings; |
102 | 102 | } |
103 | 103 | } |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function get_config() { |
116 | 116 | // grab network configuration |
117 | - $CFG = get_site_option( 'ee_network_config', array() ); |
|
118 | - $CFG = apply_filters( 'FHEE__EE_Network_Config__get_config__CFG', $CFG ); |
|
117 | + $CFG = get_site_option('ee_network_config', array()); |
|
118 | + $CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG); |
|
119 | 119 | return $CFG; |
120 | 120 | } |
121 | 121 | |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | * @access public |
128 | 128 | * @return boolean success |
129 | 129 | */ |
130 | - public function update_config( $add_success = FALSE, $add_error = TRUE ) { |
|
131 | - do_action( 'AHEE__EE_Network_Config__update_config__begin',$this ); |
|
130 | + public function update_config($add_success = FALSE, $add_error = TRUE) { |
|
131 | + do_action('AHEE__EE_Network_Config__update_config__begin', $this); |
|
132 | 132 | // compare existing settings with what's already saved' |
133 | 133 | $saved_config = $this->get_config(); |
134 | 134 | // update |
135 | - $saved = $saved_config == $this ? TRUE : update_site_option( 'ee_network_config', $this ); |
|
136 | - do_action( 'AHEE__EE_Network_Config__update_config__end', $this, $saved ); |
|
135 | + $saved = $saved_config == $this ? TRUE : update_site_option('ee_network_config', $this); |
|
136 | + do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved); |
|
137 | 137 | // if config remains the same or was updated successfully |
138 | - if ( $saved ) { |
|
139 | - if ( $add_success ) { |
|
140 | - $msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso' ) : __( 'Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso' ); |
|
141 | - EE_Error::add_success( $msg ); |
|
138 | + if ($saved) { |
|
139 | + if ($add_success) { |
|
140 | + $msg = is_multisite() ? __('The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso') : __('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso'); |
|
141 | + EE_Error::add_success($msg); |
|
142 | 142 | } |
143 | 143 | return TRUE; |
144 | 144 | } else { |
145 | - if ( $add_error ) { |
|
146 | - $msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings were not updated.', 'event_espresso' ) : __( 'Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso' ); |
|
147 | - EE_Error::add_error( $msg , __FILE__, __FUNCTION__, __LINE__ ); |
|
145 | + if ($add_error) { |
|
146 | + $msg = is_multisite() ? __('The Event Espresso Network Configuration Settings were not updated.', 'event_espresso') : __('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso'); |
|
147 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
148 | 148 | } |
149 | 149 | return FALSE; |
150 | 150 | } |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @return array |
159 | 159 | */ |
160 | 160 | public function __sleep() { |
161 | - return apply_filters( 'FHEE__EE_Network_Config__sleep',array( |
|
161 | + return apply_filters('FHEE__EE_Network_Config__sleep', array( |
|
162 | 162 | 'core', |
163 | - ) ); |
|
163 | + )); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | } //end EE_Network_Config. |
@@ -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; |
@@ -711,7 +711,7 @@ |
||
711 | 711 | //get that model reset it and make sure we nuke the old reference to it |
712 | 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{ |
|
714 | + } else{ |
|
715 | 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}; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin == $main_file ) { |
|
122 | + if ($plugin == $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -175,36 +175,36 @@ discard block |
||
175 | 175 | public function init() { |
176 | 176 | |
177 | 177 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
178 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
178 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
179 | 179 | //ok so we want to enable the entire admin |
180 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
181 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
182 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
183 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
184 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
185 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
180 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
181 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
182 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
183 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
184 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
185 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | 186 | //at a glance dashboard widget |
187 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
187 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
188 | 188 | //filter for get_edit_post_link used on comments for custom post types |
189 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
189 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
193 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
193 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
194 | 194 | try { |
195 | 195 | //this loads the controller for the admin pages which will setup routing etc |
196 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
197 | - } catch ( EE_Error $e ) { |
|
196 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
197 | + } catch (EE_Error $e) { |
|
198 | 198 | $e->get_error(); |
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
203 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
204 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
203 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
204 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
205 | 205 | |
206 | 206 | //exclude EE critical pages from all nav menus and wp_list_pages |
207 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
207 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @param object $post_type WP post type object |
218 | 218 | * @return object WP post type object |
219 | 219 | */ |
220 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
220 | + public function remove_pages_from_nav_menu($post_type) { |
|
221 | 221 | //if this isn't the "pages" post type let's get out |
222 | - if ( $post_type->name !== 'page' ) |
|
222 | + if ($post_type->name !== 'page') |
|
223 | 223 | return $post_type; |
224 | 224 | |
225 | 225 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -239,28 +239,28 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function enable_hidden_ee_nav_menu_metaboxes() { |
241 | 241 | global $wp_meta_boxes, $pagenow; |
242 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
242 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | $user = wp_get_current_user(); |
246 | 246 | //has this been done yet? |
247 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
247 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
252 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
251 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
252 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
253 | 253 | |
254 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
255 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
256 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
257 | - unset( $hidden_meta_boxes[ $key ] ); |
|
254 | + if (is_array($hidden_meta_boxes)) { |
|
255 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
256 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
257 | + unset($hidden_meta_boxes[$key]); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
263 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
262 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
263 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @return void |
280 | 280 | */ |
281 | 281 | public function register_custom_nav_menu_boxes() { |
282 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
282 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return string the (maybe) modified link |
298 | 298 | */ |
299 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
300 | - if ( ! $post = get_post( $id ) ) |
|
299 | + public function modify_edit_post_link($link, $id, $context) { |
|
300 | + if ( ! $post = get_post($id)) |
|
301 | 301 | return $link; |
302 | 302 | |
303 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
303 | + if ($post->post_type == 'espresso_attendees') { |
|
304 | 304 | $query_args = array( |
305 | 305 | 'action' => 'edit_attendee', |
306 | 306 | 'post' => $id |
307 | 307 | ); |
308 | 308 | EE_Registry::instance()->load_helper('URL'); |
309 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
309 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
310 | 310 | } |
311 | 311 | return $link; |
312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | global $nav_menu_selected_id; |
319 | 319 | |
320 | 320 | $db_fields = false; |
321 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
321 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
322 | 322 | $current_tab = 'event-archives'; |
323 | 323 | |
324 | 324 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | ?> |
338 | 338 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
339 | 339 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
340 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
341 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
342 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
340 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
341 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
342 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
343 | 343 | </a> |
344 | 344 | </li> |
345 | 345 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -357,13 +357,13 @@ discard block |
||
357 | 357 | <?php */ ?> |
358 | 358 | |
359 | 359 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
360 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
360 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
361 | 361 | ?>"> |
362 | 362 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
363 | 363 | <?php |
364 | 364 | $pages = $this->_get_extra_nav_menu_pages_items(); |
365 | 365 | $args['walker'] = $walker; |
366 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
366 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
367 | 367 | ?> |
368 | 368 | </ul> |
369 | 369 | </div><!-- /.tabs-panel --> |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | <p class="button-controls"> |
372 | 372 | <span class="list-controls"> |
373 | 373 | <a href="<?php |
374 | - echo esc_url( add_query_arg( |
|
374 | + echo esc_url(add_query_arg( |
|
375 | 375 | array( |
376 | 376 | 'extra-nav-menu-pages-tab' => 'event-archives', |
377 | 377 | 'selectall' => 1, |
378 | 378 | ), |
379 | - remove_query_arg( $removed_args ) |
|
379 | + remove_query_arg($removed_args) |
|
380 | 380 | )); |
381 | 381 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
382 | 382 | </span> |
383 | 383 | |
384 | 384 | <span class="add-to-menu"> |
385 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
385 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
386 | 386 | <span class="spinner"></span> |
387 | 387 | </span> |
388 | 388 | </p> |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | private function _get_extra_nav_menu_pages_items() { |
404 | 404 | $menuitems[] = array( |
405 | 405 | 'title' => __('Event List', 'event_espresso'), |
406 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
406 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
407 | 407 | 'description' => __('Archive page for all events.', 'event_espresso') |
408 | 408 | ); |
409 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
409 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param $menu_item_values |
419 | 419 | * @return stdClass |
420 | 420 | */ |
421 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
421 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
422 | 422 | $menu_item = new stdClass(); |
423 | 423 | $keys = array( |
424 | 424 | 'ID' => 0, |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | 'xfn' => '' |
439 | 439 | ); |
440 | 440 | |
441 | - foreach ( $keys as $key => $value) { |
|
442 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
441 | + foreach ($keys as $key => $value) { |
|
442 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
443 | 443 | } |
444 | 444 | return $menu_item; |
445 | 445 | } |
@@ -478,10 +478,10 @@ discard block |
||
478 | 478 | * - check if doing post processing of one of EE CPTs |
479 | 479 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
480 | 480 | */ |
481 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
482 | - if ( isset( $_POST['post_type'] ) ) { |
|
483 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
484 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
481 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
482 | + if (isset($_POST['post_type'])) { |
|
483 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
484 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
492 | 492 | */ |
493 | 493 | global $pagenow; |
494 | - if ( $pagenow == 'options-reading.php' ) { |
|
495 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
494 | + if ($pagenow == 'options-reading.php') { |
|
495 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | } |
@@ -504,25 +504,25 @@ discard block |
||
504 | 504 | * @param string $output Current output. |
505 | 505 | * @return string |
506 | 506 | */ |
507 | - public function modify_dropdown_pages( $output ) { |
|
507 | + public function modify_dropdown_pages($output) { |
|
508 | 508 | //get critical pages |
509 | 509 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
510 | 510 | |
511 | 511 | //split current output by line break for easier parsing. |
512 | - $split_output = explode( "\n", $output ); |
|
512 | + $split_output = explode("\n", $output); |
|
513 | 513 | |
514 | 514 | //loop through to remove any critical pages from the array. |
515 | - foreach ( $critical_pages as $page_id ) { |
|
516 | - $needle = 'value="' . $page_id . '"'; |
|
517 | - foreach( $split_output as $key => $haystack ) { |
|
518 | - if( strpos( $haystack, $needle ) !== false ) { |
|
519 | - unset( $split_output[$key] ); |
|
515 | + foreach ($critical_pages as $page_id) { |
|
516 | + $needle = 'value="'.$page_id.'"'; |
|
517 | + foreach ($split_output as $key => $haystack) { |
|
518 | + if (strpos($haystack, $needle) !== false) { |
|
519 | + unset($split_output[$key]); |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | 524 | //replace output with the new contents |
525 | - $output = implode( "\n", $split_output ); |
|
525 | + $output = implode("\n", $split_output); |
|
526 | 526 | |
527 | 527 | return $output; |
528 | 528 | } |
@@ -538,37 +538,37 @@ discard block |
||
538 | 538 | public function enqueue_admin_scripts() { |
539 | 539 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
540 | 540 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
541 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
541 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
542 | 542 | // register cookie script for future dependencies |
543 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
543 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
544 | 544 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
545 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
545 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
546 | 546 | // register jQuery Validate |
547 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
547 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
548 | 548 | } |
549 | 549 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
551 | 551 | //joyride style |
552 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
553 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
554 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
552 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
553 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
554 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
555 | 555 | //joyride JS |
556 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
556 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
557 | 557 | // wanna go for a joyride? |
558 | 558 | wp_enqueue_style('ee-joyride-css'); |
559 | 559 | wp_enqueue_script('jquery-joyride'); |
560 | 560 | } |
561 | 561 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
562 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
562 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
563 | 563 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
564 | 564 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
565 | 565 | } |
566 | 566 | //accounting.js library |
567 | 567 | // @link http://josscrowcroft.github.io/accounting.js/ |
568 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
569 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
570 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
571 | - wp_enqueue_script( 'ee-accounting' ); |
|
568 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
569 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
570 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
571 | + wp_enqueue_script('ee-accounting'); |
|
572 | 572 | // array of settings to get converted to JSON array via wp_localize_script |
573 | 573 | $currency_config = array( |
574 | 574 | 'currency' => array( |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | public function get_persistent_admin_notices() { |
616 | 616 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
617 | 617 | $args = array( |
618 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
619 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
618 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
619 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
620 | 620 | ); |
621 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
622 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
621 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
622 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -640,26 +640,26 @@ discard block |
||
640 | 640 | * @param $elements |
641 | 641 | * @return array |
642 | 642 | */ |
643 | - public function dashboard_glance_items( $elements ) { |
|
643 | + public function dashboard_glance_items($elements) { |
|
644 | 644 | $events = EEM_Event::instance()->count(); |
645 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
646 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
645 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
646 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
647 | 647 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
648 | 648 | $registrations = EEM_Registration::instance()->count( |
649 | 649 | array( |
650 | 650 | array( |
651 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
651 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
652 | 652 | ) |
653 | 653 | ) |
654 | 654 | ); |
655 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
656 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
655 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
656 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
657 | 657 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
658 | 658 | |
659 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
659 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
660 | 660 | |
661 | - foreach ( $items as $type => $item_properties ) { |
|
662 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
661 | + foreach ($items as $type => $item_properties) { |
|
662 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
663 | 663 | } |
664 | 664 | return $elements; |
665 | 665 | } |
@@ -678,63 +678,63 @@ discard block |
||
678 | 678 | * @param $post |
679 | 679 | * @return void |
680 | 680 | */ |
681 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
681 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
682 | 682 | // default post types |
683 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
683 | + $post_types = array('post' => 0, 'page' => 1); |
|
684 | 684 | // add CPTs |
685 | 685 | $CPTs = EE_Register_CPTs::get_CPTs(); |
686 | - $post_types = array_merge( $post_types, $CPTs ); |
|
686 | + $post_types = array_merge($post_types, $CPTs); |
|
687 | 687 | // for default or CPT posts... |
688 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
688 | + if (isset($post_types[$post->post_type])) { |
|
689 | 689 | // post on frontpage ? |
690 | 690 | $page_for_posts = EE_Config::get_page_for_posts(); |
691 | 691 | $maybe_remove_from_posts = array(); |
692 | 692 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
693 | 693 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
694 | 694 | // array of shortcodes indexed by post name |
695 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
695 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
696 | 696 | // whether to proceed with update, if an entry already exists for this post, then we want to update |
697 | - $update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false; |
|
697 | + $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false; |
|
698 | 698 | // empty both arrays |
699 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
699 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
700 | 700 | // check that posts page is already being tracked |
701 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
701 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
702 | 702 | // if not, then ensure that it is properly added |
703 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
703 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
704 | 704 | } |
705 | 705 | // loop thru shortcodes |
706 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
706 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
707 | 707 | // convert to UPPERCASE to get actual shortcode |
708 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
708 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
709 | 709 | // is the shortcode in the post_content ? |
710 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
710 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
711 | 711 | // map shortcode to post names and post IDs |
712 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
712 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
713 | 713 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
714 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
714 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
715 | 715 | // add shortcode to "Posts page" tracking |
716 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
716 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
717 | 717 | } |
718 | 718 | $update_post_shortcodes = TRUE; |
719 | - unset( $maybe_remove_from_posts[ $EES_Shortcode ] ); |
|
719 | + unset($maybe_remove_from_posts[$EES_Shortcode]); |
|
720 | 720 | } else { |
721 | - $maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID; |
|
721 | + $maybe_remove_from_posts[$EES_Shortcode] = $post_ID; |
|
722 | 722 | } |
723 | 723 | } |
724 | - if ( $update_post_shortcodes ) { |
|
724 | + if ($update_post_shortcodes) { |
|
725 | 725 | // remove shortcodes from $maybe_remove_from_posts that are still being used |
726 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) { |
|
727 | - if ( $post_name == $page_for_posts ) { |
|
726 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) { |
|
727 | + if ($post_name == $page_for_posts) { |
|
728 | 728 | continue; |
729 | 729 | } |
730 | 730 | // compute difference between active post_shortcodes array and $maybe_remove_from_posts array |
731 | - $maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes ); |
|
731 | + $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes); |
|
732 | 732 | } |
733 | 733 | // now unset unused shortcodes from the $page_for_posts post_shortcodes |
734 | - foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) { |
|
735 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] ); |
|
734 | + foreach ($maybe_remove_from_posts as $shortcode => $post_ID) { |
|
735 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]); |
|
736 | 736 | } |
737 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
737 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 | } |
@@ -752,32 +752,32 @@ discard block |
||
752 | 752 | * @throws EE_Error |
753 | 753 | * @return string |
754 | 754 | */ |
755 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
756 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
755 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
756 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
757 | 757 | // check for date_format or time_format |
758 | - switch ( $option ) { |
|
758 | + switch ($option) { |
|
759 | 759 | case 'date_format' : |
760 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
760 | + $date_time_format = $value.' '.get_option('time_format'); |
|
761 | 761 | break; |
762 | 762 | case 'time_format' : |
763 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
763 | + $date_time_format = get_option('date_format').' '.$value; |
|
764 | 764 | break; |
765 | 765 | default : |
766 | 766 | $date_time_format = FALSE; |
767 | 767 | } |
768 | 768 | // do we have a date_time format to check ? |
769 | - if ( $date_time_format ) { |
|
770 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
769 | + if ($date_time_format) { |
|
770 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
771 | 771 | |
772 | - if ( is_array( $error_msg ) ) { |
|
773 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
772 | + if (is_array($error_msg)) { |
|
773 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
774 | 774 | |
775 | 775 | |
776 | - foreach ( $error_msg as $error ) { |
|
777 | - $msg .= '<li>' . $error . '</li>'; |
|
776 | + foreach ($error_msg as $error) { |
|
777 | + $msg .= '<li>'.$error.'</li>'; |
|
778 | 778 | } |
779 | 779 | |
780 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
780 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
781 | 781 | |
782 | 782 | // trigger WP settings error |
783 | 783 | add_settings_error( |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | ); |
788 | 788 | |
789 | 789 | // set format to something valid |
790 | - switch ( $option ) { |
|
790 | + switch ($option) { |
|
791 | 791 | case 'date_format' : |
792 | 792 | $value = 'F j, Y'; |
793 | 793 | break; |
@@ -813,14 +813,14 @@ discard block |
||
813 | 813 | * @param $value |
814 | 814 | * @return void |
815 | 815 | */ |
816 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
817 | - if ( $option == 'page_for_posts' ) { |
|
816 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
817 | + if ($option == 'page_for_posts') { |
|
818 | 818 | global $wpdb; |
819 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
820 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
821 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
822 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
823 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
819 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
820 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
821 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
822 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
823 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
@@ -833,8 +833,8 @@ discard block |
||
833 | 833 | * @param $content |
834 | 834 | * @return string |
835 | 835 | */ |
836 | - public function its_eSpresso( $content ) { |
|
837 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
836 | + public function its_eSpresso($content) { |
|
837 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -847,9 +847,9 @@ discard block |
||
847 | 847 | */ |
848 | 848 | public function espresso_admin_footer() { |
849 | 849 | return sprintf( |
850 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
850 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
851 | 851 | '<a href="https://eventespresso.com/" title="', |
852 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
852 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
853 | 853 | ); |
854 | 854 | } |
855 | 855 | |
@@ -869,11 +869,11 @@ discard block |
||
869 | 869 | * @param array $config |
870 | 870 | * @return void |
871 | 871 | */ |
872 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
873 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
874 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
872 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
873 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
874 | + if (class_exists('EE_Register_Admin_Page')) |
|
875 | 875 | $config['page_path'] = $page_path; |
876 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
876 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
877 | 877 | } |
878 | 878 | |
879 | 879 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Processor |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param array $registration_query_params |
51 | 51 | *@return EE_Transaction_Processor instance |
52 | 52 | */ |
53 | - public static function instance( $registration_query_params = array() ) { |
|
53 | + public static function instance($registration_query_params = array()) { |
|
54 | 54 | // check if class object is instantiated |
55 | - if ( ! self::$_instance instanceof EE_Transaction_Processor ) { |
|
56 | - self::$_instance = new self( $registration_query_params ); |
|
55 | + if ( ! self::$_instance instanceof EE_Transaction_Processor) { |
|
56 | + self::$_instance = new self($registration_query_params); |
|
57 | 57 | } |
58 | 58 | return self::$_instance; |
59 | 59 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * @param array $registration_query_params |
65 | 65 | * @return EE_Transaction_Processor |
66 | 66 | */ |
67 | - private function __construct( $registration_query_params = array() ) { |
|
67 | + private function __construct($registration_query_params = array()) { |
|
68 | 68 | // make sure some query params are set for retrieving registrations |
69 | - $this->_set_registration_query_params( $registration_query_params ); |
|
69 | + $this->_set_registration_query_params($registration_query_params); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @access private |
76 | 76 | * @param array $registration_query_params |
77 | 77 | */ |
78 | - private function _set_registration_query_params( $registration_query_params ) { |
|
79 | - $this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
78 | + private function _set_registration_query_params($registration_query_params) { |
|
79 | + $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC')); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $old_txn_status |
95 | 95 | */ |
96 | - public function set_old_txn_status( $old_txn_status ) { |
|
96 | + public function set_old_txn_status($old_txn_status) { |
|
97 | 97 | // only set the first time |
98 | - if ( $this->_old_txn_status === null ) { |
|
98 | + if ($this->_old_txn_status === null) { |
|
99 | 99 | $this->_old_txn_status = $old_txn_status; |
100 | 100 | } |
101 | 101 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param string $new_txn_status |
116 | 116 | */ |
117 | - public function set_new_txn_status( $new_txn_status ) { |
|
117 | + public function set_new_txn_status($new_txn_status) { |
|
118 | 118 | $this->_new_txn_status = $new_txn_status; |
119 | 119 | } |
120 | 120 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * @param bool $check_all |
146 | 146 | * @return boolean | int |
147 | 147 | */ |
148 | - private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) { |
|
148 | + private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) { |
|
149 | 149 | $reg_steps = $transaction->reg_steps(); |
150 | - if ( ! is_array( $reg_steps ) || empty( $reg_steps )) { |
|
150 | + if ( ! is_array($reg_steps) || empty($reg_steps)) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | // loop thru reg steps array) |
154 | - foreach ( $reg_steps as $slug => $reg_step_completed ) { |
|
154 | + foreach ($reg_steps as $slug => $reg_step_completed) { |
|
155 | 155 | // if NOT checking ALL steps (only checking one step) |
156 | - if ( ! $check_all ) { |
|
156 | + if ( ! $check_all) { |
|
157 | 157 | // and this is the one |
158 | - if ( $slug == $reg_step_slug ) { |
|
158 | + if ($slug == $reg_step_slug) { |
|
159 | 159 | return $reg_step_completed; |
160 | 160 | } else { |
161 | 161 | // skip to next reg step in loop |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | // if any reg step is NOT completed (ignoring any specific steps), then just leave |
166 | - if ( $reg_step_completed !== true && $slug != $reg_step_slug ) { |
|
166 | + if ($reg_step_completed !== true && $slug != $reg_step_slug) { |
|
167 | 167 | return false; |
168 | - } else if ( $slug == $reg_step_slug ) { |
|
168 | + } else if ($slug == $reg_step_slug) { |
|
169 | 169 | // if we reach this point, then we are testing either: |
170 | 170 | // all_reg_steps_completed_except() or |
171 | 171 | // all_reg_steps_completed_except_final_step(), |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * @param EE_Transaction $transaction |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function all_reg_steps_completed( EE_Transaction $transaction ) { |
|
194 | - return $this->_reg_steps_completed( $transaction ); |
|
193 | + public function all_reg_steps_completed(EE_Transaction $transaction) { |
|
194 | + return $this->_reg_steps_completed($transaction); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @param string $exception |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) { |
|
212 | - return $this->_reg_steps_completed( $transaction, $exception ); |
|
211 | + public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') { |
|
212 | + return $this->_reg_steps_completed($transaction, $exception); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * @param EE_Transaction $transaction |
226 | 226 | * @return boolean |
227 | 227 | */ |
228 | - public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) { |
|
229 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration' ); |
|
228 | + public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) { |
|
229 | + return $this->_reg_steps_completed($transaction, 'finalize_registration'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @param string $reg_step_slug |
244 | 244 | * @return boolean | int |
245 | 245 | */ |
246 | - public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
247 | - return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE ); |
|
246 | + public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
247 | + return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | * @param EE_Transaction $transaction |
261 | 261 | * @return boolean | int |
262 | 262 | */ |
263 | - public function final_reg_step_completed( EE_Transaction $transaction ) { |
|
264 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE ); |
|
263 | + public function final_reg_step_completed(EE_Transaction $transaction) { |
|
264 | + return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @param string $reg_step_slug |
276 | 276 | * @return boolean |
277 | 277 | */ |
278 | - public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) { |
|
278 | + public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) { |
|
279 | 279 | $current_time = time(); |
280 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, $current_time ); |
|
280 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, $current_time); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * @param string $reg_step_slug |
292 | 292 | * @return boolean |
293 | 293 | */ |
294 | - public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
295 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, TRUE ); |
|
294 | + public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
295 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, TRUE); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @param string $reg_step_slug |
307 | 307 | * @return boolean |
308 | 308 | */ |
309 | - public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
310 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, FALSE ); |
|
309 | + public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
310 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, FALSE); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -323,36 +323,36 @@ discard block |
||
323 | 323 | * @param boolean | int $status |
324 | 324 | * @return boolean |
325 | 325 | */ |
326 | - private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) { |
|
326 | + private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) { |
|
327 | 327 | // validate status |
328 | - $status = is_bool( $status ) || is_numeric( $status ) ? $status : false; |
|
328 | + $status = is_bool($status) || is_numeric($status) ? $status : false; |
|
329 | 329 | // get reg steps array |
330 | 330 | $txn_reg_steps = $transaction->reg_steps(); |
331 | 331 | // if reg step does NOT exist |
332 | - if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) { |
|
332 | + if ( ! isset($txn_reg_steps[$reg_step_slug])) { |
|
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | // if we're trying to complete a step that is already completed |
336 | - if ( $txn_reg_steps[ $reg_step_slug ] === true ) { |
|
336 | + if ($txn_reg_steps[$reg_step_slug] === true) { |
|
337 | 337 | return true; |
338 | 338 | } |
339 | 339 | // if we're trying to complete a step that hasn't even started |
340 | - if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) { |
|
340 | + if ($status === true && $txn_reg_steps[$reg_step_slug] === false) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | // if current status value matches the incoming value (no change) |
344 | - if ( $txn_reg_steps[ $reg_step_slug ] === $status ) { |
|
344 | + if ($txn_reg_steps[$reg_step_slug] === $status) { |
|
345 | 345 | // this will happen in cases where multiple AJAX requests occur during the same step |
346 | 346 | return true; |
347 | 347 | } |
348 | 348 | // if we're trying to set a start time |
349 | - if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) { |
|
349 | + if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) { |
|
350 | 350 | // skip the update below, but don't return FALSE so that errors won't be displayed |
351 | 351 | return true; |
352 | 352 | } |
353 | 353 | // update completed status |
354 | - $txn_reg_steps[ $reg_step_slug ] = $status; |
|
355 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
354 | + $txn_reg_steps[$reg_step_slug] = $status; |
|
355 | + $transaction->set_reg_steps($txn_reg_steps); |
|
356 | 356 | $transaction->save(); |
357 | 357 | // DEBUG LOG |
358 | 358 | //$this->log( |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | * @param string $reg_step_slug |
379 | 379 | * @return void |
380 | 380 | */ |
381 | - public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) { |
|
381 | + public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) { |
|
382 | 382 | // get reg steps array |
383 | 383 | $txn_reg_steps = $transaction->reg_steps(); |
384 | - unset( $txn_reg_steps[ $reg_step_slug ] ); |
|
385 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
384 | + unset($txn_reg_steps[$reg_step_slug]); |
|
385 | + $transaction->set_reg_steps($txn_reg_steps); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | * @param EE_Transaction $transaction |
397 | 397 | * @return boolean |
398 | 398 | */ |
399 | - public function toggle_failed_transaction_status( EE_Transaction $transaction ) { |
|
399 | + public function toggle_failed_transaction_status(EE_Transaction $transaction) { |
|
400 | 400 | // set incoming TXN_Status |
401 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
401 | + $this->set_old_txn_status($transaction->status_ID()); |
|
402 | 402 | // if TXN status is still set as "failed"... |
403 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code ) { |
|
403 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code) { |
|
404 | 404 | // set incoming TXN_Status |
405 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
406 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
405 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
406 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
407 | 407 | return TRUE; |
408 | 408 | } |
409 | 409 | return FALSE; |
@@ -419,20 +419,20 @@ discard block |
||
419 | 419 | * @param EE_Transaction $transaction |
420 | 420 | * @return boolean |
421 | 421 | */ |
422 | - public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) { |
|
422 | + public function toggle_abandoned_transaction_status(EE_Transaction $transaction) { |
|
423 | 423 | // set incoming TXN_Status |
424 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
424 | + $this->set_old_txn_status($transaction->status_ID()); |
|
425 | 425 | // if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"... |
426 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code ) { |
|
427 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
426 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code) { |
|
427 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
428 | 428 | // if a contact record for the primary registrant has been created |
429 | - if ( $transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee ) { |
|
430 | - $transaction->set_status( EEM_Transaction::incomplete_status_code ); |
|
431 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
429 | + if ($transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee) { |
|
430 | + $transaction->set_status(EEM_Transaction::incomplete_status_code); |
|
431 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
432 | 432 | } else { |
433 | 433 | // no contact record? yer abandoned! |
434 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
435 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
434 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
435 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
436 | 436 | } |
437 | 437 | return TRUE; |
438 | 438 | } |
@@ -450,16 +450,16 @@ discard block |
||
450 | 450 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
451 | 451 | * @return boolean |
452 | 452 | */ |
453 | - public function manually_update_registration_statuses( EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array() ) { |
|
454 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status ); |
|
453 | + public function manually_update_registration_statuses(EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array()) { |
|
454 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status); |
|
455 | 455 | // send messages |
456 | 456 | /** @type EE_Registration_Processor $registration_processor */ |
457 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
457 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
458 | 458 | $registration_processor->trigger_registration_update_notifications( |
459 | 459 | $transaction->primary_registration(), |
460 | - array( 'manually_updated' => true ) |
|
460 | + array('manually_updated' => true) |
|
461 | 461 | ); |
462 | - do_action( 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates ); |
|
462 | + do_action('AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates); |
|
463 | 463 | return $status_updates; |
464 | 464 | } |
465 | 465 | |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
474 | 474 | * @return boolean |
475 | 475 | */ |
476 | - public function toggle_registration_statuses_for_default_approved_events( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
477 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params ); |
|
478 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates ); |
|
476 | + public function toggle_registration_statuses_for_default_approved_events(EE_Transaction $transaction, $registration_query_params = array()) { |
|
477 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params); |
|
478 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates); |
|
479 | 479 | return $status_updates; |
480 | 480 | } |
481 | 481 | |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
490 | 490 | * @return boolean |
491 | 491 | */ |
492 | - public function toggle_registration_statuses_if_no_monies_owing( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
493 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params ); |
|
494 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates ); |
|
492 | + public function toggle_registration_statuses_if_no_monies_owing(EE_Transaction $transaction, $registration_query_params = array()) { |
|
493 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params); |
|
494 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates); |
|
495 | 495 | return $status_updates; |
496 | 496 | } |
497 | 497 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @throws \EE_Error |
508 | 508 | * @return array |
509 | 509 | */ |
510 | - public function update_transaction_and_registrations_after_checkout_or_payment( EE_Transaction $transaction, $payment = NULL, $registration_query_params = array() ) { |
|
510 | + public function update_transaction_and_registrations_after_checkout_or_payment(EE_Transaction $transaction, $payment = NULL, $registration_query_params = array()) { |
|
511 | 511 | // set incoming TXN_Status, and consider it new since old status should have been set |
512 | - $this->set_new_txn_status( $transaction->status_ID() ); |
|
513 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' ); |
|
512 | + $this->set_new_txn_status($transaction->status_ID()); |
|
513 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()'); |
|
514 | 514 | // make sure some query params are set for retrieving registrations |
515 | - $this->_set_registration_query_params( $registration_query_params ); |
|
515 | + $this->_set_registration_query_params($registration_query_params); |
|
516 | 516 | // get final reg step status |
517 | - $finalized = $this->final_reg_step_completed( $transaction ); |
|
517 | + $finalized = $this->final_reg_step_completed($transaction); |
|
518 | 518 | // if the 'finalize_registration' step has been initiated (has a timestamp) but has not yet been fully completed (TRUE) |
519 | - if ( is_numeric( $finalized ) && $finalized !== true ) { |
|
520 | - $this->set_reg_step_completed( $transaction, 'finalize_registration' ); |
|
519 | + if (is_numeric($finalized) && $finalized !== true) { |
|
520 | + $this->set_reg_step_completed($transaction, 'finalize_registration'); |
|
521 | 521 | $finalized = true; |
522 | 522 | } |
523 | 523 | $transaction->save(); |
@@ -540,13 +540,13 @@ discard block |
||
540 | 540 | |
541 | 541 | // send messages |
542 | 542 | /** @type EE_Registration_Processor $registration_processor */ |
543 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
543 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
544 | 544 | $registration_processor->trigger_registration_update_notifications( |
545 | 545 | $transaction->primary_registration(), |
546 | 546 | $update_params |
547 | 547 | ); |
548 | 548 | |
549 | - do_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params ); |
|
549 | + do_action('AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params); |
|
550 | 550 | return $update_params; |
551 | 551 | } |
552 | 552 | |
@@ -564,23 +564,23 @@ discard block |
||
564 | 564 | * @throws \EE_Error |
565 | 565 | * @return boolean |
566 | 566 | */ |
567 | - private function _call_method_on_registrations_via_Registration_Processor( $method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL ) { |
|
567 | + private function _call_method_on_registrations_via_Registration_Processor($method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL) { |
|
568 | 568 | $response = FALSE; |
569 | 569 | /** @type EE_Registration_Processor $registration_processor */ |
570 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
570 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
571 | 571 | // check that method exists |
572 | - if ( ! method_exists( $registration_processor, $method_name )) { |
|
573 | - throw new EE_Error( __( 'Method does not exist.', 'event_espresso' )); |
|
572 | + if ( ! method_exists($registration_processor, $method_name)) { |
|
573 | + throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
574 | 574 | } |
575 | 575 | // make sure some query params are set for retrieving registrations |
576 | - $this->_set_registration_query_params( $registration_query_params ); |
|
576 | + $this->_set_registration_query_params($registration_query_params); |
|
577 | 577 | // loop through cached registrations |
578 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
579 | - if ( $registration instanceof EE_Registration ) { |
|
580 | - if ( $additional_param ) { |
|
581 | - $response = $registration_processor->{$method_name}( $registration, $additional_param ) ? TRUE : $response; |
|
578 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
579 | + if ($registration instanceof EE_Registration) { |
|
580 | + if ($additional_param) { |
|
581 | + $response = $registration_processor->{$method_name}($registration, $additional_param) ? TRUE : $response; |
|
582 | 582 | } else { |
583 | - $response = $registration_processor->{$method_name}( $registration ) ? TRUE : $response; |
|
583 | + $response = $registration_processor->{$method_name}($registration) ? TRUE : $response; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
@@ -605,46 +605,46 @@ discard block |
||
605 | 605 | public function set_transaction_payment_method_based_on_registration_statuses( |
606 | 606 | EE_Registration $edited_registration |
607 | 607 | ) { |
608 | - if ( $edited_registration instanceof EE_Registration ) { |
|
608 | + if ($edited_registration instanceof EE_Registration) { |
|
609 | 609 | $transaction = $edited_registration->transaction(); |
610 | - if ( $transaction instanceof EE_Transaction ) { |
|
610 | + if ($transaction instanceof EE_Transaction) { |
|
611 | 611 | $all_not_approved = true; |
612 | - foreach ( $transaction->registrations() as $registration ) { |
|
613 | - if ( $registration instanceof EE_Registration ) { |
|
612 | + foreach ($transaction->registrations() as $registration) { |
|
613 | + if ($registration instanceof EE_Registration) { |
|
614 | 614 | // if any REG != "Not Approved" then toggle to false |
615 | 615 | $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
616 | 616 | } |
617 | 617 | } |
618 | 618 | // if ALL Registrations are "Not Approved" |
619 | - if ( $all_not_approved ) { |
|
620 | - $transaction->set_payment_method_ID( null ); |
|
619 | + if ($all_not_approved) { |
|
620 | + $transaction->set_payment_method_ID(null); |
|
621 | 621 | $transaction->save(); |
622 | 622 | } else { |
623 | - $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ); |
|
624 | - if ( ! empty( $available_payment_methods ) ) { |
|
623 | + $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart); |
|
624 | + if ( ! empty($available_payment_methods)) { |
|
625 | 625 | $PMD_ID = 0; |
626 | - foreach ( $available_payment_methods as $available_payment_method ) { |
|
627 | - if ( $available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default() ) { |
|
626 | + foreach ($available_payment_methods as $available_payment_method) { |
|
627 | + if ($available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default()) { |
|
628 | 628 | $PMD_ID = $available_payment_method->ID(); |
629 | 629 | break; |
630 | 630 | } |
631 | 631 | } |
632 | - if ( ! $PMD_ID ) { |
|
633 | - $first_payment_method = reset( $available_payment_methods ); |
|
634 | - if ( $first_payment_method instanceof EE_Payment_Method ) { |
|
632 | + if ( ! $PMD_ID) { |
|
633 | + $first_payment_method = reset($available_payment_methods); |
|
634 | + if ($first_payment_method instanceof EE_Payment_Method) { |
|
635 | 635 | $PMD_ID = $first_payment_method->ID(); |
636 | 636 | } else { |
637 | 637 | EE_Error::add_error( |
638 | - __( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ), |
|
638 | + __('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'), |
|
639 | 639 | __FILE__, __LINE__, __FUNCTION__ |
640 | 640 | ); |
641 | 641 | } |
642 | 642 | } |
643 | - $transaction->set_payment_method_ID( $PMD_ID ); |
|
643 | + $transaction->set_payment_method_ID($PMD_ID); |
|
644 | 644 | $transaction->save(); |
645 | 645 | } else { |
646 | 646 | EE_Error::add_error( |
647 | - __( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ), |
|
647 | + __('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'), |
|
648 | 648 | __FILE__, __LINE__, __FUNCTION__ |
649 | 649 | ); |
650 | 650 | } |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences! |
118 | 118 | */ |
119 | 119 | public function __construct() { |
120 | - $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages); |
|
121 | - foreach($this->_migration_stages as $migration_stage){ |
|
122 | - if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) { |
|
120 | + $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages); |
|
121 | + foreach ($this->_migration_stages as $migration_stage) { |
|
122 | + if ($migration_stage instanceof EE_Data_Migration_Script_Stage) { |
|
123 | 123 | $migration_stage->_construct_finalize($this); |
124 | 124 | } |
125 | 125 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Place to add hooks and filters for tweaking the migrations page, in order |
133 | 133 | * to customize it |
134 | 134 | */ |
135 | - public function migration_page_hooks(){ |
|
135 | + public function migration_page_hooks() { |
|
136 | 136 | //by default none are added because we normally like the default look of the migration page |
137 | 137 | } |
138 | 138 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @param int|string $new_pk eg posts.ID |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function set_mapping($old_table,$old_pk,$new_table,$new_pk){ |
|
150 | + public function set_mapping($old_table, $old_pk, $new_table, $new_pk) { |
|
151 | 151 | //make sure it has the needed keys |
152 | - if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){ |
|
152 | + if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) { |
|
153 | 153 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
154 | 154 | } |
155 | 155 | $this->_mappings[$old_table][$new_table][$old_pk] = $new_pk; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts |
166 | 166 | * @return mixed the primary key on the new table |
167 | 167 | */ |
168 | - public function get_mapping_new_pk($old_table,$old_pk,$new_table){ |
|
169 | - if( ! isset($this->_mappings[$old_table]) || |
|
170 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
168 | + public function get_mapping_new_pk($old_table, $old_pk, $new_table) { |
|
169 | + if ( ! isset($this->_mappings[$old_table]) || |
|
170 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
171 | 171 | //try fetching the option |
172 | 172 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
173 | 173 | } |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | * @param mixed $new_pk |
185 | 185 | * @return mixed |
186 | 186 | */ |
187 | - public function get_mapping_old_pk($old_table,$new_table,$new_pk){ |
|
188 | - if( ! isset($this->_mappings[$old_table]) || |
|
189 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
187 | + public function get_mapping_old_pk($old_table, $new_table, $new_pk) { |
|
188 | + if ( ! isset($this->_mappings[$old_table]) || |
|
189 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
190 | 190 | //try fetching the option |
191 | 191 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
192 | 192 | } |
193 | - if(isset($this->_mappings[$old_table][$new_table])){ |
|
193 | + if (isset($this->_mappings[$old_table][$new_table])) { |
|
194 | 194 | $new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]); |
195 | - if(isset($new_pk_to_old_pk[$new_pk])){ |
|
195 | + if (isset($new_pk_to_old_pk[$new_pk])) { |
|
196 | 196 | return $new_pk_to_old_pk[$new_pk]; |
197 | 197 | } |
198 | 198 | } |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * @param string $new_table_name |
208 | 208 | * @return array |
209 | 209 | */ |
210 | - protected function _get_mapping_option($old_table_name,$new_table_name){ |
|
211 | - $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array()); |
|
210 | + protected function _get_mapping_option($old_table_name, $new_table_name) { |
|
211 | + $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array()); |
|
212 | 212 | return $option; |
213 | 213 | } |
214 | 214 | |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | * @param array $mapping_array |
222 | 222 | * @return boolean success of updating option |
223 | 223 | */ |
224 | - protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){ |
|
224 | + protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) { |
|
225 | 225 | // echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>"; |
226 | - $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array); |
|
226 | + $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array); |
|
227 | 227 | return $success; |
228 | 228 | } |
229 | 229 | |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * @param string $new_table_name |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - protected function _get_mapping_option_name($old_table_name,$new_table_name){ |
|
238 | + protected function _get_mapping_option_name($old_table_name, $new_table_name) { |
|
239 | 239 | global $wpdb; |
240 | - $old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name); |
|
241 | - $new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name); |
|
240 | + $old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name); |
|
241 | + $new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name); |
|
242 | 242 | $migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
243 | - return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 ); |
|
243 | + return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete. |
258 | 258 | * @return int |
259 | 259 | */ |
260 | - protected function _count_records_to_migrate(){ |
|
260 | + protected function _count_records_to_migrate() { |
|
261 | 261 | $count = 0; |
262 | - foreach($this->stages() as $stage){ |
|
263 | - $count+= $stage->count_records_to_migrate(); |
|
262 | + foreach ($this->stages() as $stage) { |
|
263 | + $count += $stage->count_records_to_migrate(); |
|
264 | 264 | } |
265 | 265 | return $count; |
266 | 266 | } |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | * by just setting a transient and updating it after each migration_step |
273 | 273 | * @return int |
274 | 274 | */ |
275 | - public function count_records_migrated(){ |
|
275 | + public function count_records_migrated() { |
|
276 | 276 | $count = 0; |
277 | - foreach($this->stages() as $stage){ |
|
278 | - $count+= $stage->count_records_migrated(); |
|
277 | + foreach ($this->stages() as $stage) { |
|
278 | + $count += $stage->count_records_migrated(); |
|
279 | 279 | } |
280 | 280 | $this->_records_migrated = $count; |
281 | 281 | return $count; |
@@ -289,24 +289,24 @@ discard block |
||
289 | 289 | * @throws EE_Error |
290 | 290 | * @throws Exception |
291 | 291 | */ |
292 | - public function migration_step($num_records_to_migrate_limit){ |
|
292 | + public function migration_step($num_records_to_migrate_limit) { |
|
293 | 293 | //reset the feedback message |
294 | 294 | $this->_feedback_message = ''; |
295 | 295 | //if we haven't yet done the 1st schema changes, do them now. buffer any output |
296 | 296 | $this->_maybe_do_schema_changes(true); |
297 | 297 | |
298 | - $num_records_actually_migrated =0; |
|
298 | + $num_records_actually_migrated = 0; |
|
299 | 299 | $records_migrated_per_stage = array(); |
300 | 300 | //setup the 'stage' variable, which should hold the last run stage of the migration (or none at all if nothing runs) |
301 | 301 | $stage = null; |
302 | 302 | //get the next stage that isn't complete |
303 | - foreach($this->stages() as $stage){ |
|
304 | - if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){ |
|
305 | - try{ |
|
303 | + foreach ($this->stages() as $stage) { |
|
304 | + if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) { |
|
305 | + try { |
|
306 | 306 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
307 | 307 | $num_records_actually_migrated += $records_migrated_during_stage; |
308 | 308 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
309 | - }catch(Exception $e){ |
|
309 | + } catch (Exception $e) { |
|
310 | 310 | //yes if we catch an exception here, we consider that migration stage borked. |
311 | 311 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
312 | 312 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | throw $e; |
315 | 315 | } |
316 | 316 | //check that the migration stage didn't mark itself as having a fatal error |
317 | - if($stage->is_broken()){ |
|
317 | + if ($stage->is_broken()) { |
|
318 | 318 | $this->set_broken(); |
319 | 319 | throw new EE_Error($stage->get_last_error()); |
320 | 320 | } |
@@ -322,24 +322,24 @@ discard block |
||
322 | 322 | //once we've migrated all the number we intended to (possibly from different stages), stop migrating |
323 | 323 | //or if we had a fatal error |
324 | 324 | //or if the current script stopped early- its not done, but it's done all it thinks we should do on this step |
325 | - if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){ |
|
325 | + if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) { |
|
326 | 326 | break; |
327 | 327 | } |
328 | 328 | } |
329 | 329 | //check if we're all done this data migration... |
330 | 330 | //which is indicated by being done early AND the last stage claims to be done |
331 | - if($stage == NULL){ |
|
331 | + if ($stage == NULL) { |
|
332 | 332 | //this migration script apparently has NO stages... which is super weird, but whatever |
333 | 333 | $this->set_completed(); |
334 | 334 | $this->_maybe_do_schema_changes(false); |
335 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
335 | + } else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) { |
|
336 | 336 | //apparently we're done, because we couldn't migrate the number we intended to |
337 | 337 | $this->set_completed(); |
338 | 338 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
339 | 339 | //do schema changes for after the migration now |
340 | 340 | //first double-check we haven't already done this |
341 | 341 | $this->_maybe_do_schema_changes(false); |
342 | - }else{ |
|
342 | + } else { |
|
343 | 343 | //update feedback message, keeping in mind that we show them with the most recent at the top |
344 | 344 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
345 | 345 | } |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage |
354 | 354 | * @return void |
355 | 355 | */ |
356 | - private function _update_feedback_message($records_migrated_per_stage){ |
|
356 | + private function _update_feedback_message($records_migrated_per_stage) { |
|
357 | 357 | $feedback_message_array = array(); |
358 | - foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){ |
|
359 | - $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ; |
|
358 | + foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) { |
|
359 | + $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name); |
|
360 | 360 | } |
361 | - $this->_feedback_message .= implode("<br>",$feedback_message_array); |
|
361 | + $this->_feedback_message .= implode("<br>", $feedback_message_array); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -370,27 +370,27 @@ discard block |
||
370 | 370 | * @throws Exception |
371 | 371 | * @return void |
372 | 372 | */ |
373 | - private function _maybe_do_schema_changes($before = true){ |
|
373 | + private function _maybe_do_schema_changes($before = true) { |
|
374 | 374 | //so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran |
375 | - $property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran'; |
|
376 | - if ( ! $this->{$property_name} ){ |
|
377 | - try{ |
|
375 | + $property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran'; |
|
376 | + if ( ! $this->{$property_name} ) { |
|
377 | + try { |
|
378 | 378 | ob_start(); |
379 | - if($before){ |
|
379 | + if ($before) { |
|
380 | 380 | $this->schema_changes_before_migration(); |
381 | - }else{ |
|
381 | + } else { |
|
382 | 382 | $this->schema_changes_after_migration(); |
383 | 383 | } |
384 | 384 | $output = ob_get_contents(); |
385 | 385 | ob_end_clean(); |
386 | - }catch(Exception $e){ |
|
386 | + } catch (Exception $e) { |
|
387 | 387 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
388 | 388 | throw $e; |
389 | 389 | } |
390 | 390 | //record that we've done these schema changes |
391 | 391 | $this->{$property_name} = true; |
392 | 392 | //if there were any warnings etc, record them as non-fatal errors |
393 | - if( $output ){ |
|
393 | + if ($output) { |
|
394 | 394 | //there were some warnings |
395 | 395 | $this->_errors[] = $output; |
396 | 396 | } |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | * @param string $table_definition_sql |
418 | 418 | * @param string $engine_string |
419 | 419 | */ |
420 | - protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){ |
|
420 | + protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') { |
|
421 | 421 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name ); |
422 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( true ) ); |
|
422 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true)); |
|
423 | 423 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name ); |
424 | 424 | } |
425 | 425 | |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | * @param string $table_definition_sql |
434 | 434 | * @param string $engine_string |
435 | 435 | */ |
436 | - protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
436 | + protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
437 | 437 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name ); |
438 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
438 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
439 | 439 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name ); |
440 | 440 | } |
441 | 441 | |
@@ -446,9 +446,9 @@ discard block |
||
446 | 446 | * @param string $table_name |
447 | 447 | * @return boolean |
448 | 448 | */ |
449 | - protected function _old_table_exists( $table_name ) { |
|
450 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
451 | - return EEH_Activation::table_exists( $table_name ); |
|
449 | + protected function _old_table_exists($table_name) { |
|
450 | + EE_Registry::instance()->load_helper('Activation'); |
|
451 | + return EEH_Activation::table_exists($table_name); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | * @param string $table_name |
459 | 459 | * @return boolean |
460 | 460 | */ |
461 | - protected function _delete_table_if_empty( $table_name ) { |
|
462 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
463 | - return EEH_Activation::delete_db_table_if_empty( $table_name ); |
|
461 | + protected function _delete_table_if_empty($table_name) { |
|
462 | + EE_Registry::instance()->load_helper('Activation'); |
|
463 | + return EEH_Activation::delete_db_table_if_empty($table_name); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -479,9 +479,9 @@ discard block |
||
479 | 479 | * @param string $table_definition_sql |
480 | 480 | * @param string $engine_string |
481 | 481 | */ |
482 | - protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
482 | + protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
483 | 483 | // EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name ); |
484 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
484 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
485 | 485 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
486 | 486 | } |
487 | 487 | |
@@ -496,13 +496,13 @@ discard block |
||
496 | 496 | * @param string $table_definition_sql |
497 | 497 | * @param string $engine_string |
498 | 498 | */ |
499 | - protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
500 | - if( $this->_currently_migrating() ) { |
|
499 | + protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
500 | + if ($this->_currently_migrating()) { |
|
501 | 501 | //if we're doing a migration, and this table apparently already exists, then we don't need do anything right? |
502 | 502 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
503 | 503 | return; |
504 | 504 | } |
505 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
505 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | protected function _currently_migrating() { |
513 | 513 | //we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM) |
514 | 514 | return $this->_migrating && |
515 | - $this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) && |
|
515 | + $this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) && |
|
516 | 516 | EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance; |
517 | 517 | } |
518 | 518 | |
@@ -523,17 +523,17 @@ discard block |
||
523 | 523 | * @param boolean $table_is_new |
524 | 524 | * @return boolean |
525 | 525 | */ |
526 | - protected function _pre_existing_table_should_be_dropped( $table_is_new ) { |
|
527 | - if( $table_is_new ) { |
|
528 | - if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating() ){ |
|
526 | + protected function _pre_existing_table_should_be_dropped($table_is_new) { |
|
527 | + if ($table_is_new) { |
|
528 | + if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) { |
|
529 | 529 | return true; |
530 | - }else{ |
|
530 | + } else { |
|
531 | 531 | return false; |
532 | 532 | } |
533 | - }else{ |
|
534 | - if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
|
533 | + } else { |
|
534 | + if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) { |
|
535 | 535 | return true; |
536 | - }else{ |
|
536 | + } else { |
|
537 | 537 | return false; |
538 | 538 | } |
539 | 539 | } |
@@ -546,13 +546,13 @@ discard block |
||
546 | 546 | * @param string $engine_string |
547 | 547 | * @param boolean $drop_pre_existing_tables |
548 | 548 | */ |
549 | - private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){ |
|
549 | + private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) { |
|
550 | 550 | EE_Registry::instance()->load_helper('Activation'); |
551 | - try{ |
|
552 | - EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
553 | - }catch( EE_Error $e ) { |
|
554 | - $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
|
555 | - $this->add_error( $message ); |
|
551 | + try { |
|
552 | + EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
553 | + } catch (EE_Error $e) { |
|
554 | + $message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString(); |
|
555 | + $this->add_error($message); |
|
556 | 556 | $this->_feedback_message .= $message; |
557 | 557 | } |
558 | 558 | } |
@@ -564,15 +564,15 @@ discard block |
||
564 | 564 | * @return int one of EE_System::_req_type_* constants |
565 | 565 | * @throws EE_Error |
566 | 566 | */ |
567 | - private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
|
568 | - if($this->slug() == 'Core'){ |
|
567 | + private function _get_req_type_for_plugin_corresponding_to_this_dms() { |
|
568 | + if ($this->slug() == 'Core') { |
|
569 | 569 | return EE_System::instance()->detect_req_type(); |
570 | - }else{//it must be for an addon |
|
570 | + } else {//it must be for an addon |
|
571 | 571 | $addon_name = $this->slug(); |
572 | - if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
|
572 | + if (EE_Registry::instance()->get_addon_by_name($addon_name)) { |
|
573 | 573 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
574 | - }else{ |
|
575 | - throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
|
574 | + } else { |
|
575 | + throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name())))); |
|
576 | 576 | } |
577 | 577 | } |
578 | 578 | } |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | * returns an array of strings describing errors by all the script's stages |
584 | 584 | * @return array |
585 | 585 | */ |
586 | - public function get_errors(){ |
|
586 | + public function get_errors() { |
|
587 | 587 | $all_errors = $this->_errors; |
588 | - if( ! is_array($all_errors)){ |
|
588 | + if ( ! is_array($all_errors)) { |
|
589 | 589 | $all_errors = array(); |
590 | 590 | } |
591 | - foreach($this->stages() as $stage){ |
|
592 | - $all_errors = array_merge($stage->get_errors(),$all_errors); |
|
591 | + foreach ($this->stages() as $stage) { |
|
592 | + $all_errors = array_merge($stage->get_errors(), $all_errors); |
|
593 | 593 | } |
594 | 594 | return $all_errors; |
595 | 595 | } |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | * Indicates whether or not this migration script should continue |
601 | 601 | * @return boolean |
602 | 602 | */ |
603 | - public function can_continue(){ |
|
604 | - return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
603 | + public function can_continue() { |
|
604 | + return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | * get ordered by the indexes |
614 | 614 | * @return EE_Data_Migration_Script_Stage[] |
615 | 615 | */ |
616 | - protected function stages(){ |
|
617 | - $stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages ); |
|
616 | + protected function stages() { |
|
617 | + $stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages); |
|
618 | 618 | ksort($stages); |
619 | 619 | return $stages; |
620 | 620 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * can be displayed to the user |
627 | 627 | * @return string |
628 | 628 | */ |
629 | - public function get_feedback_message(){ |
|
629 | + public function get_feedback_message() { |
|
630 | 630 | return $this->_feedback_message; |
631 | 631 | } |
632 | 632 | |
@@ -638,16 +638,16 @@ discard block |
||
638 | 638 | * possible that this class is defined when it goes to sleep, but NOT available when it |
639 | 639 | * awakes (eg, this class is part of an addon that is deactivated at some point). |
640 | 640 | */ |
641 | - public function properties_as_array(){ |
|
641 | + public function properties_as_array() { |
|
642 | 642 | $properties = parent::properties_as_array(); |
643 | 643 | $properties['_migration_stages'] = array(); |
644 | - foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){ |
|
644 | + foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) { |
|
645 | 645 | $properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array(); |
646 | 646 | } |
647 | 647 | unset($properties['_mappings']); |
648 | 648 | |
649 | - foreach($this->_mappings as $old_table_name => $mapping_to_new_table){ |
|
650 | - foreach($mapping_to_new_table as $new_table_name => $mapping){ |
|
649 | + foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) { |
|
650 | + foreach ($mapping_to_new_table as $new_table_name => $mapping) { |
|
651 | 651 | $this->_set_mapping_option($old_table_name, $new_table_name, $mapping); |
652 | 652 | } |
653 | 653 | } |
@@ -662,19 +662,19 @@ discard block |
||
662 | 662 | * @param array $array_of_properties like what's produced from properties_as_array() method |
663 | 663 | * @return void |
664 | 664 | */ |
665 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
665 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
666 | 666 | $stages_properties_arrays = $array_of_properties['_migration_stages']; |
667 | 667 | unset($array_of_properties['_migration_stages']); |
668 | 668 | unset($array_of_properties['class']); |
669 | - foreach($array_of_properties as $property_name => $property_value){ |
|
669 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
670 | 670 | $this->{$property_name} = $property_value; |
671 | 671 | } |
672 | 672 | //_migration_stages are already instantiated, but have only default data |
673 | - foreach($this->_migration_stages as $stage){ |
|
674 | - $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays); |
|
673 | + foreach ($this->_migration_stages as $stage) { |
|
674 | + $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays); |
|
675 | 675 | //SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by |
676 | 676 | //an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet) |
677 | - if($stage_data){ |
|
677 | + if ($stage_data) { |
|
678 | 678 | $stage->instantiate_from_array_of_properties($stage_data); |
679 | 679 | } |
680 | 680 | } |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | * @param array $migration_stage_data_arrays |
691 | 691 | * @return null |
692 | 692 | */ |
693 | - private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){ |
|
694 | - foreach($migration_stage_data_arrays as $migration_stage_data_array){ |
|
695 | - if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){ |
|
693 | + private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) { |
|
694 | + foreach ($migration_stage_data_arrays as $migration_stage_data_array) { |
|
695 | + if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) { |
|
696 | 696 | return $migration_stage_data_array; |
697 | 697 | } |
698 | 698 | } |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin |
709 | 709 | * that will be updated to. Eg array('Core','4.1.0') |
710 | 710 | */ |
711 | - public final function migrates_to_version(){ |
|
712 | - return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) ); |
|
711 | + public final function migrates_to_version() { |
|
712 | + return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -721,10 +721,10 @@ discard block |
||
721 | 721 | * Or 'Core' for core (non-addon). |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public function slug(){ |
|
724 | + public function slug() { |
|
725 | 725 | $migrates_to_version_info = $this->migrates_to_version(); |
726 | 726 | //the slug is the first part of the array |
727 | - return $migrates_to_version_info[ 'slug' ]; |
|
727 | + return $migrates_to_version_info['slug']; |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * the database up so it can run), then you can set "A" to priority 3 or something. |
739 | 739 | * @return int |
740 | 740 | */ |
741 | - public function priority(){ |
|
741 | + public function priority() { |
|
742 | 742 | return $this->_priority; |
743 | 743 | } |
744 | 744 | |
@@ -751,18 +751,18 @@ discard block |
||
751 | 751 | * @param boolean $migrating |
752 | 752 | * @return void |
753 | 753 | */ |
754 | - public function set_migrating( $migrating = TRUE ){ |
|
754 | + public function set_migrating($migrating = TRUE) { |
|
755 | 755 | $this->_migrating = $migrating; |
756 | 756 | } |
757 | 757 | |
758 | 758 | /** |
759 | 759 | * Marks that we think this migration class can continue to migrate |
760 | 760 | */ |
761 | - public function reattempt(){ |
|
761 | + public function reattempt() { |
|
762 | 762 | parent::reattempt(); |
763 | 763 | //also, we want to reattempt any stages that were marked as borked |
764 | - foreach( $this->stages() as $stage ) { |
|
765 | - if( $stage->is_broken() ) { |
|
764 | + foreach ($this->stages() as $stage) { |
|
765 | + if ($stage->is_broken()) { |
|
766 | 766 | $stage->reattempt(); |
767 | 767 | } |
768 | 768 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | * @param string $timezone |
34 | 34 | * @param array $date_formats |
35 | 35 | */ |
36 | - protected function __construct( $fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array() ) { |
|
37 | - if ( !isset( $fieldValues[ 'ATT_full_name' ] ) ) { |
|
38 | - $fname = isset( $fieldValues[ 'ATT_fname' ] ) ? $fieldValues[ 'ATT_fname' ] . ' ' : ''; |
|
39 | - $lname = isset( $fieldValues[ 'ATT_lname' ] ) ? $fieldValues[ 'ATT_lname' ] : ''; |
|
40 | - $fieldValues[ 'ATT_full_name' ] = $fname . $lname; |
|
36 | + protected function __construct($fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array()) { |
|
37 | + if ( ! isset($fieldValues['ATT_full_name'])) { |
|
38 | + $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : ''; |
|
39 | + $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
|
40 | + $fieldValues['ATT_full_name'] = $fname.$lname; |
|
41 | 41 | } |
42 | - if ( !isset( $fieldValues[ 'ATT_slug' ] ) ) { |
|
42 | + if ( ! isset($fieldValues['ATT_slug'])) { |
|
43 | 43 | // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
44 | - $fieldValues[ 'ATT_slug' ] = sanitize_title( $fieldValues[ 'ATT_full_name' ] ); |
|
44 | + $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
|
45 | 45 | } |
46 | - if ( !isset( $fieldValues[ 'ATT_short_bio' ] ) && isset( $fieldValues[ 'ATT_bio' ] ) ) { |
|
47 | - $fieldValues[ 'ATT_short_bio' ] = substr( $fieldValues[ 'ATT_bio' ], 0, 50 ); |
|
46 | + if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
47 | + $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
|
48 | 48 | } |
49 | - parent::__construct( $fieldValues, $bydb, $timezone, $date_formats ); |
|
49 | + parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * date_format and the second value is the time format |
61 | 61 | * @return EE_Attendee |
62 | 62 | */ |
63 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
64 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
65 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
63 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
64 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
65 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * the website will be used. |
74 | 74 | * @return EE_Attendee |
75 | 75 | */ |
76 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
77 | - return new self( $props_n_values, TRUE, $timezone ); |
|
76 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
77 | + return new self($props_n_values, TRUE, $timezone); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @access public |
86 | 86 | * @param string $fname |
87 | 87 | */ |
88 | - public function set_fname( $fname = '' ) { |
|
89 | - $this->set( 'ATT_fname', $fname ); |
|
88 | + public function set_fname($fname = '') { |
|
89 | + $this->set('ATT_fname', $fname); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @access public |
98 | 98 | * @param string $lname |
99 | 99 | */ |
100 | - public function set_lname( $lname = '' ) { |
|
101 | - $this->set( 'ATT_lname', $lname ); |
|
100 | + public function set_lname($lname = '') { |
|
101 | + $this->set('ATT_lname', $lname); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @access public |
110 | 110 | * @param string $address |
111 | 111 | */ |
112 | - public function set_address( $address = '' ) { |
|
113 | - $this->set( 'ATT_address', $address ); |
|
112 | + public function set_address($address = '') { |
|
113 | + $this->set('ATT_address', $address); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @access public |
122 | 122 | * @param string $address2 |
123 | 123 | */ |
124 | - public function set_address2( $address2 = '' ) { |
|
125 | - $this->set( 'ATT_address2', $address2 ); |
|
124 | + public function set_address2($address2 = '') { |
|
125 | + $this->set('ATT_address2', $address2); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @access public |
134 | 134 | * @param string $city |
135 | 135 | */ |
136 | - public function set_city( $city = '' ) { |
|
137 | - $this->set( 'ATT_city', $city ); |
|
136 | + public function set_city($city = '') { |
|
137 | + $this->set('ATT_city', $city); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | * @access public |
146 | 146 | * @param int $STA_ID |
147 | 147 | */ |
148 | - public function set_state( $STA_ID = 0 ) { |
|
149 | - $this->set( 'STA_ID', $STA_ID ); |
|
148 | + public function set_state($STA_ID = 0) { |
|
149 | + $this->set('STA_ID', $STA_ID); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * @access public |
158 | 158 | * @param string $CNT_ISO |
159 | 159 | */ |
160 | - public function set_country( $CNT_ISO = '' ) { |
|
161 | - $this->set( 'CNT_ISO', $CNT_ISO ); |
|
160 | + public function set_country($CNT_ISO = '') { |
|
161 | + $this->set('CNT_ISO', $CNT_ISO); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @access public |
170 | 170 | * @param string $zip |
171 | 171 | */ |
172 | - public function set_zip( $zip = '' ) { |
|
173 | - $this->set( 'ATT_zip', $zip ); |
|
172 | + public function set_zip($zip = '') { |
|
173 | + $this->set('ATT_zip', $zip); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @access public |
182 | 182 | * @param string $email |
183 | 183 | */ |
184 | - public function set_email( $email = '' ) { |
|
185 | - $this->set( 'ATT_email', $email ); |
|
184 | + public function set_email($email = '') { |
|
185 | + $this->set('ATT_email', $email); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | * @access public |
194 | 194 | * @param string $phone |
195 | 195 | */ |
196 | - public function set_phone( $phone = '' ) { |
|
197 | - $this->set( 'ATT_phone', $phone ); |
|
196 | + public function set_phone($phone = '') { |
|
197 | + $this->set('ATT_phone', $phone); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @access public |
206 | 206 | * @param bool $ATT_deleted |
207 | 207 | */ |
208 | - public function set_deleted( $ATT_deleted = FALSE ) { |
|
209 | - $this->set( 'ATT_deleted', $ATT_deleted ); |
|
208 | + public function set_deleted($ATT_deleted = FALSE) { |
|
209 | + $this->set('ATT_deleted', $ATT_deleted); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @return int |
220 | 220 | */ |
221 | 221 | public function wp_user() { |
222 | - return $this->get( 'ATT_author' ); |
|
222 | + return $this->get('ATT_author'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return string |
231 | 231 | */ |
232 | 232 | public function fname() { |
233 | - return $this->get( 'ATT_fname' ); |
|
233 | + return $this->get('ATT_fname'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * @param bool $apply_html_entities |
251 | 251 | * @return string |
252 | 252 | */ |
253 | - public function full_name( $apply_html_entities = FALSE ) { |
|
254 | - $full_name = $this->fname() . ' ' . $this->lname(); |
|
255 | - return $apply_html_entities ? htmlentities( $full_name, ENT_QUOTES, 'UTF-8' ) : $full_name; |
|
253 | + public function full_name($apply_html_entities = FALSE) { |
|
254 | + $full_name = $this->fname().' '.$this->lname(); |
|
255 | + return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return string |
264 | 264 | */ |
265 | 265 | public function lname() { |
266 | - return $this->get( 'ATT_lname' ); |
|
266 | + return $this->get('ATT_lname'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -277,26 +277,26 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function full_address_as_array() { |
279 | 279 | $full_address_array = array(); |
280 | - $initial_address_fields = array( 'ATT_address', 'ATT_address2', 'ATT_city', ); |
|
281 | - foreach ( $initial_address_fields as $address_field_name ) { |
|
282 | - $address_fields_value = $this->get( $address_field_name ); |
|
283 | - if ( !empty( $address_fields_value ) ) { |
|
284 | - $full_address_array[ ] = $address_fields_value; |
|
280 | + $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
|
281 | + foreach ($initial_address_fields as $address_field_name) { |
|
282 | + $address_fields_value = $this->get($address_field_name); |
|
283 | + if ( ! empty($address_fields_value)) { |
|
284 | + $full_address_array[] = $address_fields_value; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | //now handle state and country |
288 | 288 | $state_obj = $this->state_obj(); |
289 | - if ( !empty( $state_obj ) ) { |
|
290 | - $full_address_array[ ] = $state_obj->name(); |
|
289 | + if ( ! empty($state_obj)) { |
|
290 | + $full_address_array[] = $state_obj->name(); |
|
291 | 291 | } |
292 | 292 | $country_obj = $this->country_obj(); |
293 | - if ( !empty( $country_obj ) ) { |
|
294 | - $full_address_array[ ] = $country_obj->name(); |
|
293 | + if ( ! empty($country_obj)) { |
|
294 | + $full_address_array[] = $country_obj->name(); |
|
295 | 295 | } |
296 | 296 | //lastly get the xip |
297 | 297 | $zip_value = $this->zip(); |
298 | - if ( !empty( $zip_value ) ) { |
|
299 | - $full_address_array[ ] = $zip_value; |
|
298 | + if ( ! empty($zip_value)) { |
|
299 | + $full_address_array[] = $zip_value; |
|
300 | 300 | } |
301 | 301 | return $full_address_array; |
302 | 302 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @return string |
309 | 309 | */ |
310 | 310 | public function address() { |
311 | - return $this->get( 'ATT_address' ); |
|
311 | + return $this->get('ATT_address'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @return string |
319 | 319 | */ |
320 | 320 | public function address2() { |
321 | - return $this->get( 'ATT_address2' ); |
|
321 | + return $this->get('ATT_address2'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | public function city() { |
331 | - return $this->get( 'ATT_city' ); |
|
331 | + return $this->get('ATT_city'); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @return string |
339 | 339 | */ |
340 | 340 | public function state_ID() { |
341 | - return $this->get( 'STA_ID' ); |
|
341 | + return $this->get('STA_ID'); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @return string |
348 | 348 | */ |
349 | 349 | public function state_abbrev() { |
350 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' ); |
|
350 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso'); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -357,18 +357,18 @@ discard block |
||
357 | 357 | * @return EE_State |
358 | 358 | */ |
359 | 359 | public function state_obj() { |
360 | - return $this->get_first_related( 'State' ); |
|
360 | + return $this->get_first_related('State'); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Returns the state's name, otherwise 'Unknown' |
365 | 365 | * @return string |
366 | 366 | */ |
367 | - public function state_name(){ |
|
368 | - if( $this->state_obj() ){ |
|
367 | + public function state_name() { |
|
368 | + if ($this->state_obj()) { |
|
369 | 369 | return $this->state_obj()->name(); |
370 | - }else{ |
|
371 | - return __( 'Unknown', 'event_espresso' ); |
|
370 | + } else { |
|
371 | + return __('Unknown', 'event_espresso'); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @return string |
382 | 382 | */ |
383 | 383 | public function state() { |
384 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
384 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
385 | 385 | return $this->state_abbrev(); |
386 | 386 | } else { |
387 | 387 | return $this->state_name(); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * @return string |
396 | 396 | */ |
397 | 397 | public function country_ID() { |
398 | - return $this->get( 'CNT_ISO' ); |
|
398 | + return $this->get('CNT_ISO'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -405,18 +405,18 @@ discard block |
||
405 | 405 | * @return EE_Country |
406 | 406 | */ |
407 | 407 | public function country_obj() { |
408 | - return $this->get_first_related( 'Country' ); |
|
408 | + return $this->get_first_related('Country'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
412 | 412 | * Returns the country's name if known, otherwise 'Unknown' |
413 | 413 | * @return string |
414 | 414 | */ |
415 | - public function country_name(){ |
|
416 | - if( $this->country_obj() ){ |
|
415 | + public function country_name() { |
|
416 | + if ($this->country_obj()) { |
|
417 | 417 | return $this->country_obj()->name(); |
418 | - }else{ |
|
419 | - return __( 'Unknown', 'event_espresso' ); |
|
418 | + } else { |
|
419 | + return __('Unknown', 'event_espresso'); |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return string |
430 | 430 | */ |
431 | 431 | public function country() { |
432 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
432 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
433 | 433 | return $this->country_ID(); |
434 | 434 | } else { |
435 | 435 | return $this->country_name(); |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * @return string |
444 | 444 | */ |
445 | 445 | public function zip() { |
446 | - return $this->get( 'ATT_zip' ); |
|
446 | + return $this->get('ATT_zip'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @return string |
454 | 454 | */ |
455 | 455 | public function email() { |
456 | - return $this->get( 'ATT_email' ); |
|
456 | + return $this->get('ATT_email'); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @return string |
464 | 464 | */ |
465 | 465 | public function phone() { |
466 | - return $this->get( 'ATT_phone' ); |
|
466 | + return $this->get('ATT_phone'); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | * @return bool |
474 | 474 | */ |
475 | 475 | public function deleted() { |
476 | - return $this->get( 'ATT_deleted' ); |
|
476 | + return $this->get('ATT_deleted'); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | * @param array $query_params |
484 | 484 | * @return EE_Registration[] |
485 | 485 | */ |
486 | - public function get_registrations( $query_params = array() ) { |
|
487 | - return $this->get_many_related( 'Registration', $query_params ); |
|
486 | + public function get_registrations($query_params = array()) { |
|
487 | + return $this->get_many_related('Registration', $query_params); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @return EE_Registration |
495 | 495 | */ |
496 | 496 | public function get_most_recent_registration() { |
497 | - return $this->get_first_related( 'Registration', array( 'order_by' => array( 'REG_date' => 'DESC' ) ) ); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
497 | + return $this->get_first_related('Registration', array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * @param int $event_id |
505 | 505 | * @return EE_Registration |
506 | 506 | */ |
507 | - public function get_most_recent_registration_for_event( $event_id ) { |
|
508 | - return $this->get_first_related( 'Registration', array(array( 'EVT_ID' => $event_id ), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
507 | + public function get_most_recent_registration_for_event($event_id) { |
|
508 | + return $this->get_first_related('Registration', array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC'))); //, '=', 'OBJECT_K' ); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @return array |
516 | 516 | */ |
517 | 517 | public function events() { |
518 | - return $this->get_many_related( 'Event' ); |
|
518 | + return $this->get_many_related('Event'); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -524,17 +524,17 @@ discard block |
||
524 | 524 | * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
525 | 525 | * @return EE_Form_Section_Proper |
526 | 526 | */ |
527 | - public function billing_info_for_payment_method($payment_method){ |
|
527 | + public function billing_info_for_payment_method($payment_method) { |
|
528 | 528 | $pm_type = $payment_method->type_obj(); |
529 | - if( ! $pm_type instanceof EE_PMT_Base ){ |
|
529 | + if ( ! $pm_type instanceof EE_PMT_Base) { |
|
530 | 530 | return NULL; |
531 | 531 | } |
532 | - $billing_info = $this->get_post_meta( $this->get_billing_info_postmeta_name( $payment_method ), true ); |
|
533 | - if ( ! $billing_info){ |
|
532 | + $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
|
533 | + if ( ! $billing_info) { |
|
534 | 534 | return NULL; |
535 | 535 | } |
536 | 536 | $billing_form = $pm_type->billing_form(); |
537 | - $billing_form->receive_form_submission( array( $billing_form->name() => $billing_info ), FALSE ); |
|
537 | + $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), FALSE); |
|
538 | 538 | return $billing_form; |
539 | 539 | } |
540 | 540 | |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | * @param EE_Payment_Method $payment_method |
545 | 545 | * @return string |
546 | 546 | */ |
547 | - public function get_billing_info_postmeta_name($payment_method){ |
|
548 | - if( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
549 | - return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
550 | - }else{ |
|
547 | + public function get_billing_info_postmeta_name($payment_method) { |
|
548 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
549 | + return 'billing_info_'.$payment_method->type_obj()->system_name(); |
|
550 | + } else { |
|
551 | 551 | return NULL; |
552 | 552 | } |
553 | 553 | } |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | * @param EE_Payment_Method $payment_method |
559 | 559 | * @return boolean |
560 | 560 | */ |
561 | - public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method){ |
|
562 | - if( ! $billing_form instanceof EE_Billing_Attendee_Info_Form ){ |
|
563 | - EE_Error::add_error( __( 'Cannot save billing info because there is none.', 'event_espresso' ) ); |
|
561 | + public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) { |
|
562 | + if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
563 | + EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
|
564 | 564 | return false; |
565 | 565 | } |
566 | 566 | $billing_form->clean_sensitive_data(); |
567 | - return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name( $payment_method ), $billing_form->input_values( true ) ); |
|
567 | + return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), $billing_form->input_values(true)); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_Change_Log extends EE_Base_Class{ |
|
28 | +class EE_Change_Log extends EE_Base_Class { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * date_format and the second value is the time format |
37 | 37 | * @return EE_Attendee |
38 | 38 | */ |
39 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
40 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
41 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
39 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
40 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
41 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * the website will be used. |
50 | 50 | * @return EE_Attendee |
51 | 51 | */ |
52 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
53 | - return new self( $props_n_values, TRUE, $timezone ); |
|
52 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
53 | + return new self($props_n_values, TRUE, $timezone); |
|
54 | 54 | } |
55 | 55 | /** |
56 | 56 | * Gets message |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | * Gets the model object attached to this log |
148 | 148 | * @return EE_Base_Class |
149 | 149 | */ |
150 | - function object(){ |
|
150 | + function object() { |
|
151 | 151 | $model_name_of_related_obj = $this->OBJ_type(); |
152 | 152 | $is_model_name = EE_Registry::instance()->is_model_name($model_name_of_related_obj); |
153 | - if( ! $is_model_name ){ |
|
153 | + if ( ! $is_model_name) { |
|
154 | 154 | return null; |
155 | - }else{ |
|
155 | + } else { |
|
156 | 156 | return $this->get_first_related($model_name_of_related_obj); |
157 | 157 | } |
158 | 158 | } |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | * @param boolean $save |
166 | 166 | * @return boolean if $save=true, NULL is $save=false |
167 | 167 | */ |
168 | - function set_object($object, $save = TRUE ) { |
|
169 | - if($object instanceof EE_Base_Class){ |
|
168 | + function set_object($object, $save = TRUE) { |
|
169 | + if ($object instanceof EE_Base_Class) { |
|
170 | 170 | $this->set_OBJ_type($object->get_model()->get_this_model_name()); |
171 | 171 | $this->set_OBJ_ID($object->ID()); |
172 | - }else{ |
|
172 | + } else { |
|
173 | 173 | $this->set_OBJ_type(NULL); |
174 | 174 | $this->set_OBJ_ID(NULL); |
175 | 175 | } |
176 | - if($save){ |
|
176 | + if ($save) { |
|
177 | 177 | return $this->save(); |
178 | - }else{ |
|
178 | + } else { |
|
179 | 179 | return NULL; |
180 | 180 | } |
181 | 181 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
3 | 3 | /** |
4 | 4 | * Event Espresso |
5 | 5 | * |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @subpackage includes/classes/EE_Checkin.class.php |
24 | 24 | * @author Darren Ethier |
25 | 25 | */ |
26 | -class EE_Checkin extends EE_Base_Class{ |
|
26 | +class EE_Checkin extends EE_Base_Class { |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * date_format and the second value is the time format |
35 | 35 | * @return EE_Checkin |
36 | 36 | */ |
37 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
38 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
39 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
37 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
38 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
39 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * the website will be used. |
48 | 48 | * @return EE_Checkin |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |