@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @param \EE_Dependency_Map $dependency_map |
179 | 179 | * @return \EE_Registry instance |
180 | 180 | */ |
181 | - public static function instance( \EE_Dependency_Map $dependency_map = null ) { |
|
181 | + public static function instance(\EE_Dependency_Map $dependency_map = null) { |
|
182 | 182 | // check if class object is instantiated |
183 | - if ( ! self::$_instance instanceof EE_Registry ) { |
|
184 | - self::$_instance = new EE_Registry( $dependency_map ); |
|
183 | + if ( ! self::$_instance instanceof EE_Registry) { |
|
184 | + self::$_instance = new EE_Registry($dependency_map); |
|
185 | 185 | } |
186 | 186 | return self::$_instance; |
187 | 187 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | * @param \EE_Dependency_Map $dependency_map |
197 | 197 | * @return \EE_Registry |
198 | 198 | */ |
199 | - protected function __construct( \EE_Dependency_Map $dependency_map ) { |
|
199 | + protected function __construct(\EE_Dependency_Map $dependency_map) { |
|
200 | 200 | $this->_dependency_map = $dependency_map; |
201 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
201 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -225,19 +225,19 @@ discard block |
||
225 | 225 | $this->modules = new StdClass(); |
226 | 226 | $this->shortcodes = new StdClass(); |
227 | 227 | $this->widgets = new StdClass(); |
228 | - $this->load_core( 'Base', array(), true ); |
|
228 | + $this->load_core('Base', array(), true); |
|
229 | 229 | // add our request and response objects to the cache |
230 | - $request_loader = $this->_dependency_map->class_loader( 'EE_Request' ); |
|
230 | + $request_loader = $this->_dependency_map->class_loader('EE_Request'); |
|
231 | 231 | $this->_set_cached_class( |
232 | 232 | $request_loader(), |
233 | 233 | 'EE_Request' |
234 | 234 | ); |
235 | - $response_loader = $this->_dependency_map->class_loader( 'EE_Response' ); |
|
235 | + $response_loader = $this->_dependency_map->class_loader('EE_Response'); |
|
236 | 236 | $this->_set_cached_class( |
237 | 237 | $response_loader(), |
238 | 238 | 'EE_Response' |
239 | 239 | ); |
240 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) ); |
|
240 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function init() { |
252 | 252 | // Get current page protocol |
253 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
253 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
254 | 254 | // Output admin-ajax.php URL with same protocol as current page |
255 | - self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol ); |
|
256 | - self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false; |
|
255 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
256 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * @return string |
265 | 265 | */ |
266 | 266 | public static function localize_i18n_js_strings() { |
267 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
268 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
269 | - if ( is_scalar( $value ) ) { |
|
270 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
267 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
268 | + foreach ($i18n_js_strings as $key => $value) { |
|
269 | + if (is_scalar($value)) { |
|
270 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
274 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -279,15 +279,15 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * @param mixed string | EED_Module $module |
281 | 281 | */ |
282 | - public function add_module( $module ) { |
|
283 | - if ( $module instanceof EED_Module ) { |
|
284 | - $module_class = get_class( $module ); |
|
282 | + public function add_module($module) { |
|
283 | + if ($module instanceof EED_Module) { |
|
284 | + $module_class = get_class($module); |
|
285 | 285 | $this->modules->{$module_class} = $module; |
286 | 286 | } else { |
287 | - if ( ! class_exists( 'EE_Module_Request_Router' ) ) { |
|
288 | - $this->load_core( 'Module_Request_Router' ); |
|
287 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
288 | + $this->load_core('Module_Request_Router'); |
|
289 | 289 | } |
290 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
290 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @param string $module_name |
298 | 298 | * @return mixed EED_Module | NULL |
299 | 299 | */ |
300 | - public function get_module( $module_name = '' ) { |
|
301 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
300 | + public function get_module($module_name = '') { |
|
301 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | * @param bool $load_only |
313 | 313 | * @return mixed |
314 | 314 | */ |
315 | - public function load_core( $class_name, $arguments = array(), $load_only = false ) { |
|
315 | + public function load_core($class_name, $arguments = array(), $load_only = false) { |
|
316 | 316 | $core_paths = apply_filters( |
317 | 317 | 'FHEE__EE_Registry__load_core__core_paths', |
318 | 318 | array( |
319 | 319 | EE_CORE, |
320 | 320 | EE_ADMIN, |
321 | 321 | EE_CPTS, |
322 | - EE_CORE . 'data_migration_scripts' . DS, |
|
323 | - EE_CORE . 'request_stack' . DS, |
|
324 | - EE_CORE . 'middleware' . DS, |
|
322 | + EE_CORE.'data_migration_scripts'.DS, |
|
323 | + EE_CORE.'request_stack'.DS, |
|
324 | + EE_CORE.'middleware'.DS, |
|
325 | 325 | ) |
326 | 326 | ); |
327 | 327 | // retrieve instantiated class |
328 | - return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only ); |
|
328 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -339,15 +339,15 @@ discard block |
||
339 | 339 | * @param bool $load_only |
340 | 340 | * @return mixed |
341 | 341 | */ |
342 | - public function load_service( $class_name, $arguments = array(), $load_only = false ) { |
|
342 | + public function load_service($class_name, $arguments = array(), $load_only = false) { |
|
343 | 343 | $service_paths = apply_filters( |
344 | 344 | 'FHEE__EE_Registry__load_service__service_paths', |
345 | 345 | array( |
346 | - EE_CORE . 'services' . DS, |
|
346 | + EE_CORE.'services'.DS, |
|
347 | 347 | ) |
348 | 348 | ); |
349 | 349 | // retrieve instantiated class |
350 | - return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only ); |
|
350 | + return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | * @param mixed $arguments |
361 | 361 | * @return EE_Data_Migration_Script_Base |
362 | 362 | */ |
363 | - public function load_dms( $class_name, $arguments = array() ) { |
|
363 | + public function load_dms($class_name, $arguments = array()) { |
|
364 | 364 | // retrieve instantiated class |
365 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false ); |
|
365 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
378 | 378 | * @return EE_Base_Class | bool |
379 | 379 | */ |
380 | - public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) { |
|
381 | - $paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array( |
|
380 | + public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) { |
|
381 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
382 | 382 | EE_CORE, |
383 | 383 | EE_CLASSES, |
384 | 384 | EE_BUSINESS |
385 | - ) ); |
|
385 | + )); |
|
386 | 386 | // retrieve instantiated class |
387 | - return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
387 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | * @param bool $load_only |
398 | 398 | * @return EEH_Base | bool |
399 | 399 | */ |
400 | - public function load_helper( $class_name, $arguments = array(), $load_only = true ) { |
|
400 | + public function load_helper($class_name, $arguments = array(), $load_only = true) { |
|
401 | 401 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
402 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) ); |
|
402 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
403 | 403 | // retrieve instantiated class |
404 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only ); |
|
404 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | * @param bool $cache whether to cache the object or not. |
417 | 417 | * @return mixed |
418 | 418 | */ |
419 | - public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) { |
|
419 | + public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) { |
|
420 | 420 | $paths = array( |
421 | 421 | EE_LIBRARIES, |
422 | - EE_LIBRARIES . 'messages' . DS, |
|
423 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
424 | - EE_LIBRARIES . 'qtips' . DS, |
|
425 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
422 | + EE_LIBRARIES.'messages'.DS, |
|
423 | + EE_LIBRARIES.'shortcodes'.DS, |
|
424 | + EE_LIBRARIES.'qtips'.DS, |
|
425 | + EE_LIBRARIES.'payment_methods'.DS, |
|
426 | 426 | ); |
427 | 427 | // retrieve instantiated class |
428 | - return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only ); |
|
428 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | * @param bool $load_only |
439 | 439 | * @return EEM_Base | bool |
440 | 440 | */ |
441 | - public function load_model( $class_name, $arguments = array(), $load_only = false ) { |
|
442 | - $paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array( |
|
441 | + public function load_model($class_name, $arguments = array(), $load_only = false) { |
|
442 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
443 | 443 | EE_MODELS, |
444 | 444 | EE_CORE |
445 | - ) ); |
|
445 | + )); |
|
446 | 446 | // retrieve instantiated class |
447 | - return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only ); |
|
447 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | |
@@ -457,15 +457,15 @@ discard block |
||
457 | 457 | * @param bool $load_only |
458 | 458 | * @return mixed | bool |
459 | 459 | */ |
460 | - public function load_model_class( $class_name, $arguments = array(), $load_only = true ) { |
|
460 | + public function load_model_class($class_name, $arguments = array(), $load_only = true) { |
|
461 | 461 | $paths = array( |
462 | - EE_MODELS . 'fields' . DS, |
|
463 | - EE_MODELS . 'helpers' . DS, |
|
464 | - EE_MODELS . 'relations' . DS, |
|
465 | - EE_MODELS . 'strategies' . DS |
|
462 | + EE_MODELS.'fields'.DS, |
|
463 | + EE_MODELS.'helpers'.DS, |
|
464 | + EE_MODELS.'relations'.DS, |
|
465 | + EE_MODELS.'strategies'.DS |
|
466 | 466 | ); |
467 | 467 | // retrieve instantiated class |
468 | - return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only ); |
|
468 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
476 | 476 | * @return boolean |
477 | 477 | */ |
478 | - public function is_model_name( $model_name ) { |
|
479 | - return isset( $this->models[ $model_name ] ) ? true : false; |
|
478 | + public function is_model_name($model_name) { |
|
479 | + return isset($this->models[$model_name]) ? true : false; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | * @param bool $load_only |
492 | 492 | * @return mixed |
493 | 493 | */ |
494 | - public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) { |
|
494 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) { |
|
495 | 495 | // retrieve instantiated class |
496 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only ); |
|
496 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | * @param bool $load_only |
509 | 509 | * @return EE_Addon |
510 | 510 | */ |
511 | - public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) { |
|
511 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) { |
|
512 | 512 | // retrieve instantiated class |
513 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only ); |
|
513 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | |
@@ -541,46 +541,46 @@ discard block |
||
541 | 541 | $load_only = false |
542 | 542 | ) { |
543 | 543 | // strip php file extension |
544 | - $class_name = str_replace( '.php', '', trim( $class_name ) ); |
|
544 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
545 | 545 | // does the class have a prefix ? |
546 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
546 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
547 | 547 | // make sure $class_prefix is uppercase |
548 | - $class_prefix = strtoupper( trim( $class_prefix ) ); |
|
548 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
549 | 549 | // add class prefix ONCE!!! |
550 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
550 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
551 | 551 | } |
552 | - $class_exists = class_exists( $class_name ); |
|
552 | + $class_exists = class_exists($class_name); |
|
553 | 553 | // if we're only loading the class and it already exists, then let's just return true immediately |
554 | - if ( $load_only && $class_exists ) { |
|
554 | + if ($load_only && $class_exists) { |
|
555 | 555 | return true; |
556 | 556 | } |
557 | 557 | // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection |
558 | 558 | // $cache is controlled by individual calls to separate Registry loader methods like load_class() |
559 | 559 | // $load_only is also controlled by individual calls to separate Registry loader methods like load_file() |
560 | - if ( $this->_cache_on && $cache && ! $load_only ) { |
|
560 | + if ($this->_cache_on && $cache && ! $load_only) { |
|
561 | 561 | // return object if it's already cached |
562 | - $cached_class = $this->_get_cached_class( $class_name, $class_prefix ); |
|
563 | - if ( $cached_class !== null ) { |
|
562 | + $cached_class = $this->_get_cached_class($class_name, $class_prefix); |
|
563 | + if ($cached_class !== null) { |
|
564 | 564 | return $cached_class; |
565 | 565 | } |
566 | 566 | } |
567 | 567 | // if the class doesn't already exist.. then we need to try and find the file and load it |
568 | - if ( ! $class_exists ) { |
|
568 | + if ( ! $class_exists) { |
|
569 | 569 | // get full path to file |
570 | - $path = $this->_resolve_path( $class_name, $type, $file_paths ); |
|
570 | + $path = $this->_resolve_path($class_name, $type, $file_paths); |
|
571 | 571 | // load the file |
572 | - $loaded = $this->_require_file( $path, $class_name, $type, $file_paths ); |
|
572 | + $loaded = $this->_require_file($path, $class_name, $type, $file_paths); |
|
573 | 573 | // if loading failed, or we are only loading a file but NOT instantiating an object |
574 | - if ( ! $loaded || $load_only ) { |
|
574 | + if ( ! $loaded || $load_only) { |
|
575 | 575 | // return boolean if only loading, or null if an object was expected |
576 | 576 | return $load_only ? $loaded : null; |
577 | 577 | } |
578 | 578 | } |
579 | 579 | // instantiate the requested object |
580 | - $class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db ); |
|
581 | - if ( $this->_cache_on && $cache ) { |
|
580 | + $class_obj = $this->_create_object($class_name, $arguments, $type, $from_db); |
|
581 | + if ($this->_cache_on && $cache) { |
|
582 | 582 | // save it for later... kinda like gum { : $ |
583 | - $this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db ); |
|
583 | + $this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db); |
|
584 | 584 | } |
585 | 585 | $this->_cache_on = true; |
586 | 586 | return $class_obj; |
@@ -603,21 +603,21 @@ discard block |
||
603 | 603 | * @param string $class_prefix |
604 | 604 | * @return null|object |
605 | 605 | */ |
606 | - protected function _get_cached_class( $class_name, $class_prefix = '' ) { |
|
607 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
608 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
606 | + protected function _get_cached_class($class_name, $class_prefix = '') { |
|
607 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
608 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
609 | 609 | } else { |
610 | 610 | // have to specify something, but not anything that will conflict |
611 | 611 | $class_abbreviation = 'FANCY_BATMAN_PANTS'; |
612 | 612 | } |
613 | 613 | // check if class has already been loaded, and return it if it has been |
614 | - if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) { |
|
614 | + if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) { |
|
615 | 615 | return $this->{$class_abbreviation}; |
616 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
616 | + } else if (isset ($this->{$class_name} )) { |
|
617 | 617 | return $this->{$class_name}; |
618 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
618 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
619 | 619 | return $this->LIB->{$class_name}; |
620 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
620 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
621 | 621 | return $this->addons->{$class_name}; |
622 | 622 | } |
623 | 623 | return null; |
@@ -638,20 +638,20 @@ discard block |
||
638 | 638 | * @param array $file_paths |
639 | 639 | * @return string | bool |
640 | 640 | */ |
641 | - protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) { |
|
641 | + protected function _resolve_path($class_name, $type = '', $file_paths = array()) { |
|
642 | 642 | // make sure $file_paths is an array |
643 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
643 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
644 | 644 | // cycle thru paths |
645 | - foreach ( $file_paths as $key => $file_path ) { |
|
645 | + foreach ($file_paths as $key => $file_path) { |
|
646 | 646 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
647 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
647 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
648 | 648 | // prep file type |
649 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
649 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
650 | 650 | // build full file path |
651 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
651 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
652 | 652 | //does the file exist and can be read ? |
653 | - if ( is_readable( $file_paths[ $key ] ) ) { |
|
654 | - return $file_paths[ $key ]; |
|
653 | + if (is_readable($file_paths[$key])) { |
|
654 | + return $file_paths[$key]; |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | return false; |
@@ -673,29 +673,29 @@ discard block |
||
673 | 673 | * @return boolean |
674 | 674 | * @throws \EE_Error |
675 | 675 | */ |
676 | - protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) { |
|
676 | + protected function _require_file($path, $class_name, $type = '', $file_paths = array()) { |
|
677 | 677 | // don't give up! you gotta... |
678 | 678 | try { |
679 | 679 | //does the file exist and can it be read ? |
680 | - if ( ! $path ) { |
|
680 | + if ( ! $path) { |
|
681 | 681 | // so sorry, can't find the file |
682 | - throw new EE_Error ( |
|
682 | + throw new EE_Error( |
|
683 | 683 | sprintf( |
684 | - __( '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' ), |
|
685 | - trim( $type, '.' ), |
|
684 | + __('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'), |
|
685 | + trim($type, '.'), |
|
686 | 686 | $class_name, |
687 | - '<br />' . implode( ',<br />', $file_paths ) |
|
687 | + '<br />'.implode(',<br />', $file_paths) |
|
688 | 688 | ) |
689 | 689 | ); |
690 | 690 | } |
691 | 691 | // get the file |
692 | - require_once( $path ); |
|
692 | + require_once($path); |
|
693 | 693 | // if the class isn't already declared somewhere |
694 | - if ( class_exists( $class_name, false ) === false ) { |
|
694 | + if (class_exists($class_name, false) === false) { |
|
695 | 695 | // so sorry, not a class |
696 | 696 | throw new EE_Error( |
697 | 697 | sprintf( |
698 | - __( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ), |
|
698 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
699 | 699 | $type, |
700 | 700 | $path, |
701 | 701 | $class_name |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | ); |
704 | 704 | } |
705 | 705 | |
706 | - } catch ( EE_Error $e ) { |
|
706 | + } catch (EE_Error $e) { |
|
707 | 707 | $e->get_error(); |
708 | 708 | return false; |
709 | 709 | } |
@@ -735,55 +735,55 @@ discard block |
||
735 | 735 | * @return null | object |
736 | 736 | * @throws \EE_Error |
737 | 737 | */ |
738 | - protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) { |
|
738 | + protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) { |
|
739 | 739 | $class_obj = null; |
740 | 740 | // don't give up! you gotta... |
741 | 741 | try { |
742 | 742 | // create reflection |
743 | - $reflector = $this->get_ReflectionClass( $class_name ); |
|
743 | + $reflector = $this->get_ReflectionClass($class_name); |
|
744 | 744 | // make sure arguments are an array |
745 | - $arguments = is_array( $arguments ) ? $arguments : array( $arguments ); |
|
745 | + $arguments = is_array($arguments) ? $arguments : array($arguments); |
|
746 | 746 | // and if arguments array is numerically and sequentially indexed, then we want it to remain as is, |
747 | 747 | // else wrap it in an additional array so that it doesn't get split into multiple parameters |
748 | - $arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments ) |
|
748 | + $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments) |
|
749 | 749 | ? $arguments |
750 | - : array( $arguments ); |
|
750 | + : array($arguments); |
|
751 | 751 | // attempt to inject dependencies ? |
752 | - if ( $this->_dependency_map->has( $class_name ) ) { |
|
753 | - $arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments ); |
|
752 | + if ($this->_dependency_map->has($class_name)) { |
|
753 | + $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments); |
|
754 | 754 | } |
755 | 755 | // instantiate the class and add to the LIB array for tracking |
756 | 756 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
757 | - if ( $reflector->getConstructor() === null || $reflector->isAbstract() ) { |
|
757 | + if ($reflector->getConstructor() === null || $reflector->isAbstract()) { |
|
758 | 758 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
759 | 759 | //$instantiation_mode = "no constructor"; |
760 | 760 | $class_obj = true; |
761 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
761 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
762 | 762 | //$instantiation_mode = "new_instance_from_db"; |
763 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
764 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
763 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
764 | + } else if (method_exists($class_name, 'new_instance')) { |
|
765 | 765 | //$instantiation_mode = "new_instance"; |
766 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
767 | - } else if ( method_exists( $class_name, 'instance' ) ) { |
|
766 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
767 | + } else if (method_exists($class_name, 'instance')) { |
|
768 | 768 | //$instantiation_mode = "instance"; |
769 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
770 | - } else if ( $reflector->isInstantiable() ) { |
|
769 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
770 | + } else if ($reflector->isInstantiable()) { |
|
771 | 771 | //$instantiation_mode = "isInstantiable"; |
772 | - $class_obj = $reflector->newInstanceArgs( $arguments ); |
|
772 | + $class_obj = $reflector->newInstanceArgs($arguments); |
|
773 | 773 | } else { |
774 | 774 | // heh ? something's not right ! |
775 | 775 | //$instantiation_mode = 'none'; |
776 | 776 | throw new EE_Error( |
777 | 777 | sprintf( |
778 | - __( 'The %s file %s could not be instantiated.', 'event_espresso' ), |
|
778 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
779 | 779 | $type, |
780 | 780 | $class_name |
781 | 781 | ) |
782 | 782 | ); |
783 | 783 | } |
784 | - } catch ( Exception $e ) { |
|
785 | - if ( ! $e instanceof EE_Error ) { |
|
786 | - $e = new EE_Error( $e->getMessage() ); |
|
784 | + } catch (Exception $e) { |
|
785 | + if ( ! $e instanceof EE_Error) { |
|
786 | + $e = new EE_Error($e->getMessage()); |
|
787 | 787 | } |
788 | 788 | $e->get_error(); |
789 | 789 | } |
@@ -797,8 +797,8 @@ discard block |
||
797 | 797 | * @param array $array |
798 | 798 | * @return bool |
799 | 799 | */ |
800 | - protected function _array_is_numerically_and_sequentially_indexed( array $array ) { |
|
801 | - return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true; |
|
800 | + protected function _array_is_numerically_and_sequentially_indexed(array $array) { |
|
801 | + return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | |
@@ -813,14 +813,14 @@ discard block |
||
813 | 813 | * @param string $class_name |
814 | 814 | * @return ReflectionClass |
815 | 815 | */ |
816 | - public function get_ReflectionClass( $class_name ) { |
|
816 | + public function get_ReflectionClass($class_name) { |
|
817 | 817 | if ( |
818 | - ! isset( $this->_reflectors[ $class_name ] ) |
|
819 | - || ! $this->_reflectors[ $class_name ] instanceof ReflectionClass |
|
818 | + ! isset($this->_reflectors[$class_name]) |
|
819 | + || ! $this->_reflectors[$class_name] instanceof ReflectionClass |
|
820 | 820 | ) { |
821 | - $this->_reflectors[ $class_name ] = new ReflectionClass( $class_name ); |
|
821 | + $this->_reflectors[$class_name] = new ReflectionClass($class_name); |
|
822 | 822 | } |
823 | - return $this->_reflectors[ $class_name ]; |
|
823 | + return $this->_reflectors[$class_name]; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -845,45 +845,45 @@ discard block |
||
845 | 845 | * @param array $arguments |
846 | 846 | * @return array |
847 | 847 | */ |
848 | - protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) { |
|
848 | + protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) { |
|
849 | 849 | // let's examine the constructor |
850 | 850 | $constructor = $reflector->getConstructor(); |
851 | 851 | // whu? huh? nothing? |
852 | - if ( ! $constructor ) { |
|
852 | + if ( ! $constructor) { |
|
853 | 853 | return $arguments; |
854 | 854 | } |
855 | 855 | // get constructor parameters |
856 | 856 | $params = $constructor->getParameters(); |
857 | 857 | // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected |
858 | - $argument_keys = array_keys( $arguments ); |
|
858 | + $argument_keys = array_keys($arguments); |
|
859 | 859 | // now loop thru all of the constructors expected parameters |
860 | - foreach ( $params as $index => $param ) { |
|
860 | + foreach ($params as $index => $param) { |
|
861 | 861 | // is this a dependency for a specific class ? |
862 | 862 | $param_class = $param->getClass() ? $param->getClass()->name : null; |
863 | 863 | if ( |
864 | 864 | // param is not even a class |
865 | - empty( $param_class ) |
|
865 | + empty($param_class) |
|
866 | 866 | // and something already exists in the incoming arguments for this param |
867 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
867 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
868 | 868 | ) { |
869 | 869 | // so let's skip this argument and move on to the next |
870 | 870 | continue; |
871 | 871 | } else if ( |
872 | 872 | // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class |
873 | - ! empty( $param_class ) |
|
874 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
875 | - && $arguments[ $argument_keys[ $index ] ] instanceof $param_class |
|
873 | + ! empty($param_class) |
|
874 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
875 | + && $arguments[$argument_keys[$index]] instanceof $param_class |
|
876 | 876 | ) { |
877 | 877 | // skip this argument and move on to the next |
878 | 878 | continue; |
879 | 879 | } else if ( |
880 | 880 | // parameter is type hinted as a class, and should be injected |
881 | - ! empty( $param_class ) |
|
882 | - && $this->_dependency_map->has_dependency_for_class( $class_name, $param_class ) |
|
881 | + ! empty($param_class) |
|
882 | + && $this->_dependency_map->has_dependency_for_class($class_name, $param_class) |
|
883 | 883 | ) { |
884 | - $arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index ); |
|
884 | + $arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index); |
|
885 | 885 | } else { |
886 | - $arguments[ $index ] = $param->getDefaultValue(); |
|
886 | + $arguments[$index] = $param->getDefaultValue(); |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | } |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | * @param mixed $index |
901 | 901 | * @return array |
902 | 902 | */ |
903 | - protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) { |
|
903 | + protected function _resolve_dependency($class_name, $param_class, $arguments, $index) { |
|
904 | 904 | $dependency = null; |
905 | 905 | // should dependency be loaded from cache ? |
906 | 906 | $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency( |
@@ -910,30 +910,30 @@ discard block |
||
910 | 910 | : false; |
911 | 911 | // we might have a dependency... |
912 | 912 | // let's MAYBE try and find it in our cache if that's what's been requested |
913 | - $cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null; |
|
913 | + $cached_class = $cache_on ? $this->_get_cached_class($param_class) : null; |
|
914 | 914 | // and grab it if it exists |
915 | - if ( $cached_class instanceof $param_class ) { |
|
915 | + if ($cached_class instanceof $param_class) { |
|
916 | 916 | $dependency = $cached_class; |
917 | - } else if ( $param_class != $class_name ) { |
|
917 | + } else if ($param_class != $class_name) { |
|
918 | 918 | // obtain the loader method from the dependency map |
919 | - $loader = $this->_dependency_map->class_loader( $param_class ); |
|
919 | + $loader = $this->_dependency_map->class_loader($param_class); |
|
920 | 920 | // is loader a custom closure ? |
921 | - if ( $loader instanceof Closure ) { |
|
921 | + if ($loader instanceof Closure) { |
|
922 | 922 | $dependency = $loader(); |
923 | 923 | } else { |
924 | 924 | // set the cache on property for the recursive loading call |
925 | 925 | $this->_cache_on = $cache_on; |
926 | 926 | // if not, then let's try and load it via the registry |
927 | - $dependency = $this->{$loader}( $param_class ); |
|
927 | + $dependency = $this->{$loader}($param_class); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | // did we successfully find the correct dependency ? |
931 | - if ( $dependency instanceof $param_class ) { |
|
931 | + if ($dependency instanceof $param_class) { |
|
932 | 932 | // then let's inject it into the incoming array of arguments at the correct location |
933 | - if ( isset( $argument_keys[ $index ] ) ) { |
|
934 | - $arguments[ $argument_keys[ $index ] ] = $dependency; |
|
933 | + if (isset($argument_keys[$index])) { |
|
934 | + $arguments[$argument_keys[$index]] = $dependency; |
|
935 | 935 | } else { |
936 | - $arguments[ $index ] = $dependency; |
|
936 | + $arguments[$index] = $dependency; |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | return $arguments; |
@@ -958,16 +958,16 @@ discard block |
||
958 | 958 | * @param bool $from_db |
959 | 959 | * @return void |
960 | 960 | */ |
961 | - protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) { |
|
961 | + protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) { |
|
962 | 962 | // return newly instantiated class |
963 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
964 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
963 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
964 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
965 | 965 | $this->{$class_abbreviation} = $class_obj; |
966 | - } else if ( property_exists( $this, $class_name ) ) { |
|
966 | + } else if (property_exists($this, $class_name)) { |
|
967 | 967 | $this->{$class_name} = $class_obj; |
968 | - } else if ( $class_prefix == 'addon' ) { |
|
968 | + } else if ($class_prefix == 'addon') { |
|
969 | 969 | $this->addons->{$class_name} = $class_obj; |
970 | - } else if ( ! $from_db ) { |
|
970 | + } else if ( ! $from_db) { |
|
971 | 971 | $this->LIB->{$class_name} = $class_obj; |
972 | 972 | } |
973 | 973 | } |
@@ -984,12 +984,12 @@ discard block |
||
984 | 984 | * @param array $arguments |
985 | 985 | * @return object |
986 | 986 | */ |
987 | - public static function factory( $classname, $arguments = array() ) { |
|
988 | - $loader = self::instance()->_dependency_map->class_loader( $classname ); |
|
989 | - if ( $loader instanceof Closure ) { |
|
990 | - return $loader( $arguments ); |
|
991 | - } else if ( method_exists( EE_Registry::instance(), $loader ) ) { |
|
992 | - return EE_Registry::instance()->{$loader}( $classname, $arguments ); |
|
987 | + public static function factory($classname, $arguments = array()) { |
|
988 | + $loader = self::instance()->_dependency_map->class_loader($classname); |
|
989 | + if ($loader instanceof Closure) { |
|
990 | + return $loader($arguments); |
|
991 | + } else if (method_exists(EE_Registry::instance(), $loader)) { |
|
992 | + return EE_Registry::instance()->{$loader}($classname, $arguments); |
|
993 | 993 | } |
994 | 994 | return null; |
995 | 995 | } |
@@ -1002,9 +1002,9 @@ discard block |
||
1002 | 1002 | * @param string $name |
1003 | 1003 | * @return EE_Addon |
1004 | 1004 | */ |
1005 | - public function get_addon_by_name( $name ) { |
|
1006 | - foreach ( $this->addons as $addon ) { |
|
1007 | - if ( $addon->name() == $name ) { |
|
1005 | + public function get_addon_by_name($name) { |
|
1006 | + foreach ($this->addons as $addon) { |
|
1007 | + if ($addon->name() == $name) { |
|
1008 | 1008 | return $addon; |
1009 | 1009 | } |
1010 | 1010 | } |
@@ -1020,8 +1020,8 @@ discard block |
||
1020 | 1020 | */ |
1021 | 1021 | public function get_addons_by_name() { |
1022 | 1022 | $addons = array(); |
1023 | - foreach ( $this->addons as $addon ) { |
|
1024 | - $addons[ $addon->name() ] = $addon; |
|
1023 | + foreach ($this->addons as $addon) { |
|
1024 | + $addons[$addon->name()] = $addon; |
|
1025 | 1025 | } |
1026 | 1026 | return $addons; |
1027 | 1027 | } |
@@ -1036,14 +1036,14 @@ discard block |
||
1036 | 1036 | * @return \EEM_Base |
1037 | 1037 | * @throws \EE_Error |
1038 | 1038 | */ |
1039 | - public function reset_model( $model_name ) { |
|
1040 | - $model = $this->load_model( $model_name ); |
|
1041 | - $model_class_name = get_class( $model ); |
|
1039 | + public function reset_model($model_name) { |
|
1040 | + $model = $this->load_model($model_name); |
|
1041 | + $model_class_name = get_class($model); |
|
1042 | 1042 | //get that model reset it and make sure we nuke the old reference to it |
1043 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
1043 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
1044 | 1044 | $this->LIB->{$model_class_name} = $model::reset(); |
1045 | 1045 | } else { |
1046 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
1046 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
1047 | 1047 | } |
1048 | 1048 | return $this->LIB->{$model_class_name}; |
1049 | 1049 | } |
@@ -1080,13 +1080,13 @@ discard block |
||
1080 | 1080 | * |
1081 | 1081 | * @return EE_Registry |
1082 | 1082 | */ |
1083 | - public static function reset( $hard = false, $reinstantiate = true, $reset_models = true ) { |
|
1083 | + public static function reset($hard = false, $reinstantiate = true, $reset_models = true) { |
|
1084 | 1084 | $instance = self::instance(); |
1085 | 1085 | EEH_Activation::reset(); |
1086 | 1086 | |
1087 | 1087 | //properties that get reset |
1088 | 1088 | $instance->_cache_on = true; |
1089 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
1089 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
1090 | 1090 | $instance->CART = null; |
1091 | 1091 | $instance->MRM = null; |
1092 | 1092 | $instance->LIB = new stdClass(); |
@@ -1094,9 +1094,9 @@ discard block |
||
1094 | 1094 | //messages reset |
1095 | 1095 | EED_Messages::reset(); |
1096 | 1096 | |
1097 | - if ( $reset_models ) { |
|
1098 | - foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) { |
|
1099 | - $instance->reset_model( $model_name ); |
|
1097 | + if ($reset_models) { |
|
1098 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
1099 | + $instance->reset_model($model_name); |
|
1100 | 1100 | } |
1101 | 1101 | } |
1102 | 1102 | |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | * @param $a |
1119 | 1119 | * @param $b |
1120 | 1120 | */ |
1121 | - final function __call( $a, $b ) { |
|
1121 | + final function __call($a, $b) { |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | /** |
1127 | 1127 | * @param $a |
1128 | 1128 | */ |
1129 | - final function __get( $a ) { |
|
1129 | + final function __get($a) { |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | * @param $a |
1136 | 1136 | * @param $b |
1137 | 1137 | */ |
1138 | - final function __set( $a, $b ) { |
|
1138 | + final function __set($a, $b) { |
|
1139 | 1139 | } |
1140 | 1140 | |
1141 | 1141 | |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | /** |
1144 | 1144 | * @param $a |
1145 | 1145 | */ |
1146 | - final function __isset( $a ) { |
|
1146 | + final function __isset($a) { |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | /** |
1152 | 1152 | * @param $a |
1153 | 1153 | */ |
1154 | - final function __unset( $a ) { |
|
1154 | + final function __unset($a) { |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | * @param $a |
1199 | 1199 | * @param $b |
1200 | 1200 | */ |
1201 | - final static function __callStatic( $a, $b ) { |
|
1201 | + final static function __callStatic($a, $b) { |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1207,9 +1207,9 @@ discard block |
||
1207 | 1207 | */ |
1208 | 1208 | public function cpt_models() { |
1209 | 1209 | $cpt_models = array(); |
1210 | - foreach( $this->non_abstract_db_models as $short_name => $classname ) { |
|
1211 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
1212 | - $cpt_models[ $short_name ] = $classname; |
|
1210 | + foreach ($this->non_abstract_db_models as $short_name => $classname) { |
|
1211 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
1212 | + $cpt_models[$short_name] = $classname; |
|
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 | return $cpt_models; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Datetime.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Datetime extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,27 +35,27 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Datetime','event_espresso'); |
|
40 | - $this->plural_item = __('Datetimes','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Datetime', 'event_espresso'); |
|
40 | + $this->plural_item = __('Datetimes', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Datetime'=>array( |
47 | - 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')), |
|
48 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
47 | + 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), |
|
48 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
49 | 49 | 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), |
50 | 50 | 'DTT_description' => new EE_Post_Content_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), |
51 | - 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ), |
|
52 | - 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ), |
|
53 | - 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF), |
|
54 | - 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ), |
|
55 | - 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false), |
|
51 | + 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF), |
|
54 | + 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), |
|
55 | + 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), |
|
56 | 56 | 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), |
57 | - 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ), |
|
58 | - 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ), |
|
57 | + 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), |
|
58 | + 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false), |
|
59 | 59 | )); |
60 | 60 | $this->_model_relations = array( |
61 | 61 | 'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | $this->_model_chain_to_wp_user = 'Event'; |
66 | 66 | //this model is generally available for reading |
67 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
69 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
70 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
71 | - parent::__construct( $timezone ); |
|
67 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
69 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
70 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
71 | + parent::__construct($timezone); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
86 | - 'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30), |
|
87 | - 'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30), |
|
86 | + 'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30), |
|
87 | + 'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30), |
|
88 | 88 | 'DTT_order' => 1, |
89 | 89 | 'DTT_reg_limit' => EE_INF |
90 | 90 | ), |
91 | 91 | $this->_timezone |
92 | 92 | ); |
93 | - $blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) ); |
|
94 | - $blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) ); |
|
95 | - return array( $blank_datetime ); |
|
93 | + $blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone)); |
|
94 | + $blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone)); |
|
95 | + return array($blank_datetime); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param int $EVT_ID |
107 | 107 | * @return EE_Datetime[] array on success, FALSE on fail |
108 | 108 | */ |
109 | - public function get_all_event_dates( $EVT_ID = 0 ) { |
|
110 | - if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
|
109 | + public function get_all_event_dates($EVT_ID = 0) { |
|
110 | + if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
111 | 111 | return $this->create_new_blank_datetime(); |
112 | 112 | } |
113 | - $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
113 | + $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
114 | 114 | |
115 | - if ( empty( $results ) ) { |
|
115 | + if (empty($results)) { |
|
116 | 116 | return $this->create_new_blank_datetime(); |
117 | 117 | } |
118 | 118 | |
@@ -133,26 +133,26 @@ discard block |
||
133 | 133 | * the given number |
134 | 134 | * @return EE_Datetime[] |
135 | 135 | */ |
136 | - public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL ) { |
|
136 | + public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) { |
|
137 | 137 | |
138 | 138 | //sanitize EVT_ID |
139 | - $EVT_ID = intval( $EVT_ID ); |
|
139 | + $EVT_ID = intval($EVT_ID); |
|
140 | 140 | |
141 | 141 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
142 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
143 | - $where_params = array( 'Event.EVT_ID' => $EVT_ID ); |
|
142 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
143 | + $where_params = array('Event.EVT_ID' => $EVT_ID); |
|
144 | 144 | |
145 | - $query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ); |
|
145 | + $query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none'); |
|
146 | 146 | |
147 | - if( ! $include_expired){ |
|
148 | - $query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) ); |
|
147 | + if ( ! $include_expired) { |
|
148 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
149 | 149 | } |
150 | - if( $include_deleted){ |
|
151 | - $query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE )); |
|
150 | + if ($include_deleted) { |
|
151 | + $query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE)); |
|
152 | 152 | } |
153 | 153 | |
154 | - $result = $this->get_all( $query_params ); |
|
155 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
154 | + $result = $this->get_all($query_params); |
|
155 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
156 | 156 | return $result; |
157 | 157 | } |
158 | 158 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param int $limit |
168 | 168 | * @return EE_Datetime[] |
169 | 169 | */ |
170 | - public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){ |
|
171 | - return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID), |
|
170 | + public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) { |
|
171 | + return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID), |
|
172 | 172 | 'limit'=>$limit, |
173 | 173 | 'order_by'=>array('DTT_EVT_start'=>'ASC'), |
174 | 174 | 'default_where_conditions' => 'none')); |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param boolean $include_deleted |
184 | 184 | * @return EE_Datetime |
185 | 185 | */ |
186 | - public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){ |
|
187 | - $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | - if($results){ |
|
186 | + public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) { |
|
187 | + $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | + if ($results) { |
|
189 | 189 | return array_shift($results); |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | return NULL; |
192 | 192 | } |
193 | 193 | } |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | * @param bool $try_to_exclude_deleted |
202 | 202 | * @return \EE_Datetime |
203 | 203 | */ |
204 | - public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){ |
|
205 | - if($try_to_exclude_expired){ |
|
206 | - $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false); |
|
207 | - if($non_expired){ |
|
204 | + public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) { |
|
205 | + if ($try_to_exclude_expired) { |
|
206 | + $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
207 | + if ($non_expired) { |
|
208 | 208 | return $non_expired; |
209 | 209 | } |
210 | 210 | } |
211 | - if($try_to_exclude_deleted){ |
|
211 | + if ($try_to_exclude_deleted) { |
|
212 | 212 | $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
213 | - if($expired_even){ |
|
213 | + if ($expired_even) { |
|
214 | 214 | return $expired_even; |
215 | 215 | } |
216 | 216 | } |
@@ -229,23 +229,23 @@ discard block |
||
229 | 229 | * @param int $limit |
230 | 230 | * @return EE_Datetime[] |
231 | 231 | */ |
232 | - public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){ |
|
232 | + public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
233 | 233 | //sanitize EVT_ID |
234 | - $EVT_ID = intval( $EVT_ID ); |
|
234 | + $EVT_ID = intval($EVT_ID); |
|
235 | 235 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
236 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
237 | - $query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | - if( ! $include_expired){ |
|
239 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
236 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
237 | + $query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | + if ( ! $include_expired) { |
|
239 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
240 | 240 | } |
241 | - if( $include_deleted){ |
|
242 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
241 | + if ($include_deleted) { |
|
242 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
243 | 243 | } |
244 | - if($limit){ |
|
244 | + if ($limit) { |
|
245 | 245 | $query_params['limit'] = $limit; |
246 | 246 | } |
247 | - $result = $this->get_all( $query_params ); |
|
248 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
247 | + $result = $this->get_all($query_params); |
|
248 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
249 | 249 | return $result; |
250 | 250 | } |
251 | 251 | |
@@ -258,23 +258,23 @@ discard block |
||
258 | 258 | * @param int $limit |
259 | 259 | * @return EE_Datetime[] |
260 | 260 | */ |
261 | - public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
|
261 | + public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
262 | 262 | //sanitize TKT_ID |
263 | - $TKT_ID = intval( $TKT_ID ); |
|
263 | + $TKT_ID = intval($TKT_ID); |
|
264 | 264 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
265 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
266 | - $query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | - if( ! $include_expired){ |
|
268 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
265 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
266 | + $query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | + if ( ! $include_expired) { |
|
268 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
269 | 269 | } |
270 | - if( $include_deleted){ |
|
271 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
270 | + if ($include_deleted) { |
|
271 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
272 | 272 | } |
273 | - if($limit){ |
|
273 | + if ($limit) { |
|
274 | 274 | $query_params['limit'] = $limit; |
275 | 275 | } |
276 | - $result = $this->get_all( $query_params ); |
|
277 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
276 | + $result = $this->get_all($query_params); |
|
277 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
278 | 278 | return $result; |
279 | 279 | } |
280 | 280 | |
@@ -290,24 +290,24 @@ discard block |
||
290 | 290 | * that number |
291 | 291 | * @return EE_Datetime[] |
292 | 292 | */ |
293 | - public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) { |
|
293 | + public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
294 | 294 | //sanitize id. |
295 | - $TKT_ID = intval( $TKT_ID ); |
|
295 | + $TKT_ID = intval($TKT_ID); |
|
296 | 296 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
297 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
298 | - $where_params = array( 'Ticket.TKT_ID' => $TKT_ID ); |
|
299 | - $query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) ); |
|
300 | - if( ! $include_expired){ |
|
301 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
297 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
298 | + $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
299 | + $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
300 | + if ( ! $include_expired) { |
|
301 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
302 | 302 | } |
303 | - if( $include_deleted){ |
|
304 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
303 | + if ($include_deleted) { |
|
304 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
305 | 305 | } |
306 | - if($limit){ |
|
306 | + if ($limit) { |
|
307 | 307 | $query_params['limit'] = $limit; |
308 | 308 | } |
309 | - $result = $this->get_all( $query_params ); |
|
310 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
309 | + $result = $this->get_all($query_params); |
|
310 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
311 | 311 | return $result; |
312 | 312 | } |
313 | 313 | |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | * @param int $EVT_ID |
319 | 319 | * @return EE_Datetime |
320 | 320 | */ |
321 | - public function get_most_important_datetime_for_event($EVT_ID){ |
|
321 | + public function get_most_important_datetime_for_event($EVT_ID) { |
|
322 | 322 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | - if($results){ |
|
323 | + if ($results) { |
|
324 | 324 | return array_shift($results); |
325 | - }else{ |
|
325 | + } else { |
|
326 | 326 | return null; |
327 | 327 | } |
328 | 328 | } |
@@ -341,77 +341,77 @@ discard block |
||
341 | 341 | * - inactive = Events that are either not published. |
342 | 342 | * @return wpdb results array |
343 | 343 | */ |
344 | - public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) { |
|
345 | - $current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' ); |
|
346 | - $current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' ); |
|
344 | + public function get_dtt_months_and_years($where_params, $evt_active_status = '') { |
|
345 | + $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
346 | + $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
347 | 347 | |
348 | - switch ( $evt_active_status ) { |
|
348 | + switch ($evt_active_status) { |
|
349 | 349 | case 'upcoming' : |
350 | 350 | $where_params['Event.status'] = 'publish'; |
351 | 351 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
352 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
352 | + if (isset($where_params['DTT_EVT_start'])) { |
|
353 | 353 | $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
354 | 354 | } |
355 | - $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start ); |
|
355 | + $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
359 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
360 | 360 | //get events to exclude |
361 | - $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
|
361 | + $exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))); |
|
362 | 362 | //first get all events that have datetimes where its not expired. |
363 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' ); |
|
364 | - $event_ids = array_keys( $event_ids ); |
|
363 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID'); |
|
364 | + $event_ids = array_keys($event_ids); |
|
365 | 365 | |
366 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
366 | + if (isset($where_params['DTT_EVT_end'])) { |
|
367 | 367 | $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
368 | 368 | } |
369 | - $where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end ); |
|
370 | - $where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids ); |
|
369 | + $where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end); |
|
370 | + $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids); |
|
371 | 371 | break; |
372 | 372 | |
373 | 373 | case 'active' : |
374 | 374 | $where_params['Event.status'] = 'publish'; |
375 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
375 | + if (isset($where_params['DTT_EVT_start'])) { |
|
376 | 376 | $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
377 | 377 | } |
378 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
378 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
379 | 379 | $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
380 | 380 | } |
381 | - $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start ); |
|
382 | - $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end ); |
|
381 | + $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start); |
|
382 | + $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end); |
|
383 | 383 | break; |
384 | 384 | |
385 | 385 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
387 | - if ( isset( $where_params['OR'] ) ) { |
|
386 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
387 | + if (isset($where_params['OR'])) { |
|
388 | 388 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 389 | } |
390 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
390 | + if (isset($where_params['DTT_EVT_end'])) { |
|
391 | 391 | $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
392 | - unset( $where_params['DTT_EVT_end'] ); |
|
392 | + unset($where_params['DTT_EVT_end']); |
|
393 | 393 | } |
394 | 394 | |
395 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
395 | + if (isset($where_params['DTT_EVT_start'])) { |
|
396 | 396 | $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
397 | - unset( $where_params['DTT_EVT_start'] ); |
|
397 | + unset($where_params['DTT_EVT_start']); |
|
398 | 398 | } |
399 | - $where_params['AND']['Event.status'] = array( '!=', 'publish' ); |
|
399 | + $where_params['AND']['Event.status'] = array('!=', 'publish'); |
|
400 | 400 | break; |
401 | 401 | } |
402 | 402 | |
403 | 403 | $query_params[0] = $where_params; |
404 | 404 | $query_params['group_by'] = array('dtt_year', 'dtt_month'); |
405 | - $query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' ); |
|
405 | + $query_params['order_by'] = array('DTT_EVT_start' => 'DESC'); |
|
406 | 406 | |
407 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' ); |
|
407 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start'); |
|
408 | 408 | |
409 | 409 | $columns_to_select = array( |
410 | - 'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'), |
|
411 | - 'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'), |
|
412 | - 'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s') |
|
410 | + 'dtt_year' => array('YEAR('.$query_interval.')', '%s'), |
|
411 | + 'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'), |
|
412 | + 'dtt_month_num' => array('MONTH('.$query_interval.')', '%s') |
|
413 | 413 | ); |
414 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
414 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * for the tickets for each datetime) |
420 | 420 | * @param EE_Datetime[] $datetimes |
421 | 421 | */ |
422 | - public function update_sold($datetimes){ |
|
423 | - foreach($datetimes as $datetime){ |
|
422 | + public function update_sold($datetimes) { |
|
423 | + foreach ($datetimes as $datetime) { |
|
424 | 424 | $datetime->update_sold(); |
425 | 425 | } |
426 | 426 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | * @param array $query_params |
436 | 436 | * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO tickets attached to datetime then FALSE is returned. |
437 | 437 | */ |
438 | - public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) { |
|
439 | - $datetime = $this->get_one_by_ID( $DTT_ID ); |
|
440 | - if ( $datetime instanceof EE_Datetime ) { |
|
441 | - return $datetime->tickets_remaining( $query_params ); |
|
438 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
439 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
440 | + if ($datetime instanceof EE_Datetime) { |
|
441 | + return $datetime->tickets_remaining($query_params); |
|
442 | 442 | } |
443 | 443 | return 0; |
444 | 444 | } |
@@ -460,36 +460,36 @@ discard block |
||
460 | 460 | * EE_Datetime::upcoming |
461 | 461 | * EE_Datetime::expired |
462 | 462 | */ |
463 | - public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) { |
|
463 | + public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) { |
|
464 | 464 | //only accept where conditions for this query. |
465 | - $_where = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
465 | + $_where = isset($query_params[0]) ? $query_params[0] : array(); |
|
466 | 466 | $status_query_args = array( |
467 | 467 | EE_Datetime::active => array_merge( |
468 | 468 | $_where, |
469 | - array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) ) |
|
469 | + array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time())) |
|
470 | 470 | ), |
471 | 471 | EE_Datetime::upcoming => array_merge( |
472 | 472 | $_where, |
473 | - array( 'DTT_EVT_start' => array( '>', time() ) ) |
|
473 | + array('DTT_EVT_start' => array('>', time())) |
|
474 | 474 | ), |
475 | 475 | EE_Datetime::expired => array_merge( |
476 | 476 | $_where, |
477 | - array( 'DTT_EVT_end' => array('<', time() ) ) |
|
477 | + array('DTT_EVT_end' => array('<', time())) |
|
478 | 478 | ) |
479 | 479 | ); |
480 | 480 | |
481 | - if ( ! empty( $stati_to_include ) ) { |
|
482 | - foreach( array_keys( $status_query_args ) as $status ) { |
|
483 | - if ( ! in_array( $status, $stati_to_include ) ) { |
|
484 | - unset( $status_query_args[$status] ); |
|
481 | + if ( ! empty($stati_to_include)) { |
|
482 | + foreach (array_keys($status_query_args) as $status) { |
|
483 | + if ( ! in_array($status, $stati_to_include)) { |
|
484 | + unset($status_query_args[$status]); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | 489 | //loop through and query counts for each stati. |
490 | 490 | $status_query_results = array(); |
491 | - foreach( $status_query_args as $status => $status_where_conditions ) { |
|
492 | - $status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true ); |
|
491 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
492 | + $status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | return $status_query_results; |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | * @param array $query_params |
504 | 504 | * @return int |
505 | 505 | */ |
506 | - public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) { |
|
507 | - $count = $this->get_datetime_counts_by_status( array( $status ), $query_params ); |
|
508 | - return ! empty( $count[$status] ) ? $count[$status] : 0; |
|
506 | + public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) { |
|
507 | + $count = $this->get_datetime_counts_by_status(array($status), $query_params); |
|
508 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -187,7 +189,7 @@ discard block |
||
187 | 189 | $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
188 | 190 | if($results){ |
189 | 191 | return array_shift($results); |
190 | - }else{ |
|
192 | + } else{ |
|
191 | 193 | return NULL; |
192 | 194 | } |
193 | 195 | } |
@@ -322,7 +324,7 @@ discard block |
||
322 | 324 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | 325 | if($results){ |
324 | 326 | return array_shift($results); |
325 | - }else{ |
|
327 | + } else{ |
|
326 | 328 | return null; |
327 | 329 | } |
328 | 330 | } |
@@ -356,7 +358,9 @@ discard block |
||
356 | 358 | break; |
357 | 359 | |
358 | 360 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
361 | + if ( isset( $where_params['Event.status'] ) ) { |
|
362 | + unset( $where_params['Event.status'] ); |
|
363 | + } |
|
360 | 364 | //get events to exclude |
361 | 365 | $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
362 | 366 | //first get all events that have datetimes where its not expired. |
@@ -383,7 +387,9 @@ discard block |
||
383 | 387 | break; |
384 | 388 | |
385 | 389 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
390 | + if ( isset( $where_params['Event.status'] ) ) { |
|
391 | + unset( $where_params['Event.status'] ); |
|
392 | + } |
|
387 | 393 | if ( isset( $where_params['OR'] ) ) { |
388 | 394 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 395 | } |
@@ -11,47 +11,47 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Display_Strategy extends EE_Display_Strategy_Base{ |
|
14 | +class EE_Select_Display_Strategy extends EE_Display_Strategy_Base { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * |
18 | 18 | * @throws EE_Error |
19 | 19 | * @return string of html to display the field |
20 | 20 | */ |
21 | - function display(){ |
|
22 | - if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){ |
|
23 | - throw new EE_Error( sprintf( __( 'Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso' ))); |
|
21 | + function display() { |
|
22 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
23 | + throw new EE_Error(sprintf(__('Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso'))); |
|
24 | 24 | } |
25 | 25 | |
26 | - $html = EEH_HTML::nl( 0, 'select' ); |
|
26 | + $html = EEH_HTML::nl(0, 'select'); |
|
27 | 27 | $html .= '<select'; |
28 | - $html .= ' id="' . $this->_input->html_id() . '"'; |
|
29 | - $html .= ' name="' . $this->_input->html_name() . '"'; |
|
30 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
31 | - $html .= ' class="' . $class . '"'; |
|
28 | + $html .= ' id="'.$this->_input->html_id().'"'; |
|
29 | + $html .= ' name="'.$this->_input->html_name().'"'; |
|
30 | + $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class(); |
|
31 | + $html .= ' class="'.$class.'"'; |
|
32 | 32 | // add html5 required |
33 | 33 | |
34 | 34 | $html .= $this->_input->required() ? ' required' : ''; |
35 | - $html .= ' style="' . $this->_input->html_style() . '"'; |
|
36 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
35 | + $html .= ' style="'.$this->_input->html_style().'"'; |
|
36 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
37 | 37 | $html .= '>'; |
38 | 38 | |
39 | 39 | // EEH_HTML::indent( 1, 'select' ); |
40 | - if ( EEH_Array::is_multi_dimensional_array( $this->_input->options() )) { |
|
41 | - EEH_HTML::indent( 1, 'optgroup' ); |
|
42 | - foreach( $this->_input->options() as $opt_group_label => $opt_group ){ |
|
43 | - $html .= EEH_HTML::nl( 0, 'optgroup' ) . '<optgroup label="' . esc_attr( $opt_group_label ) . '">'; |
|
44 | - EEH_HTML::indent( 1, 'option' ); |
|
45 | - $html .= $this->_display_options( $opt_group ); |
|
40 | + if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
|
41 | + EEH_HTML::indent(1, 'optgroup'); |
|
42 | + foreach ($this->_input->options() as $opt_group_label => $opt_group) { |
|
43 | + $html .= EEH_HTML::nl(0, 'optgroup').'<optgroup label="'.esc_attr($opt_group_label).'">'; |
|
44 | + EEH_HTML::indent(1, 'option'); |
|
45 | + $html .= $this->_display_options($opt_group); |
|
46 | 46 | $html .= EEH_HTML::indent( -1, 'option' ); |
47 | - $html .= EEH_HTML::nl( 0, 'optgroup' ) . '</optgroup>'; |
|
47 | + $html .= EEH_HTML::nl(0, 'optgroup').'</optgroup>'; |
|
48 | 48 | } |
49 | 49 | EEH_HTML::indent( -1, 'optgroup' ); |
50 | 50 | } else { |
51 | - $html.=$this->_display_options( $this->_input->options() ); |
|
51 | + $html .= $this->_display_options($this->_input->options()); |
|
52 | 52 | } |
53 | 53 | |
54 | - $html.= EEH_HTML::nl( 0, 'select' ) . '</select>'; |
|
54 | + $html .= EEH_HTML::nl(0, 'select').'</select>'; |
|
55 | 55 | // $html.= EEH_HTML::nl( -1, 'select' ) . '</select>'; |
56 | 56 | return $html; |
57 | 57 | } |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | * @param array $options |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - protected function _display_options($options){ |
|
66 | + protected function _display_options($options) { |
|
67 | 67 | $html = ''; |
68 | - EEH_HTML::indent( 1, 'option' ); |
|
69 | - foreach( $options as $value => $display_text ){ |
|
70 | - $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one( $value ); |
|
71 | - $selected = $this->_check_if_option_selected( $unnormalized_value ) ? ' selected="selected"' : ''; |
|
72 | - $html.= EEH_HTML::nl( 0, 'option' ) . '<option value="' . esc_attr( $unnormalized_value ) . '"' . $selected . '>' . $display_text . '</option>'; |
|
68 | + EEH_HTML::indent(1, 'option'); |
|
69 | + foreach ($options as $value => $display_text) { |
|
70 | + $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one($value); |
|
71 | + $selected = $this->_check_if_option_selected($unnormalized_value) ? ' selected="selected"' : ''; |
|
72 | + $html .= EEH_HTML::nl(0, 'option').'<option value="'.esc_attr($unnormalized_value).'"'.$selected.'>'.$display_text.'</option>'; |
|
73 | 73 | } |
74 | 74 | EEH_HTML::indent( -1, 'option' ); |
75 | 75 | return $html; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param string|int $value unnormalized value option (string) |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - protected function _check_if_option_selected( $value ){ |
|
85 | + protected function _check_if_option_selected($value) { |
|
86 | 86 | return $this->_input->raw_value() == $value ? TRUE : FALSE; |
87 | 87 | } |
88 | 88 |
@@ -1999,8 +1999,7 @@ discard block |
||
1999 | 1999 | $MTP = EEM_Message_Template_Group::instance(); |
2000 | 2000 | |
2001 | 2001 | if ( empty($GRP_ID) ) |
2002 | - {$this->_message_template_group = $MTP->create_default_object();} |
|
2003 | - else |
|
2002 | + {$this->_message_template_group = $MTP->create_default_object();} else |
|
2004 | 2003 | {$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );} |
2005 | 2004 | |
2006 | 2005 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
@@ -3436,9 +3435,7 @@ discard block |
||
3436 | 3435 | } |
3437 | 3436 | } |
3438 | 3437 | $this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings ); |
3439 | - } |
|
3440 | - |
|
3441 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3438 | + } else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3442 | 3439 | $settings = $this->_req_data['message_type_settings']; |
3443 | 3440 | $messenger = $settings['messenger']; |
3444 | 3441 | $message_type = $settings['message_type']; |
@@ -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 | * |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param bool $routing |
74 | 74 | */ |
75 | - public function __construct( $routing = true ) { |
|
75 | + public function __construct($routing = true) { |
|
76 | 76 | //make sure messages autoloader is running |
77 | 77 | EED_Messages::set_autoloaders(); |
78 | - parent::__construct( $routing ); |
|
78 | + parent::__construct($routing); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array(); |
91 | 91 | |
92 | - $this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null; |
|
92 | + $this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null; |
|
93 | 93 | $this->_load_message_resource_manager(); |
94 | 94 | } |
95 | 95 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @throws EE_Error |
104 | 104 | */ |
105 | 105 | protected function _load_message_resource_manager() { |
106 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
106 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function get_messengers_for_list_table() { |
118 | 118 | $m_values = array(); |
119 | - $active_messengers = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) ); |
|
119 | + $active_messengers = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger')); |
|
120 | 120 | //setup messengers for selects |
121 | 121 | $i = 1; |
122 | - foreach ( $active_messengers as $active_messenger ) { |
|
123 | - if ( $active_messenger instanceof EE_Message ) { |
|
124 | - $m_values[ $i ]['id'] = $active_messenger->messenger(); |
|
125 | - $m_values[ $i ]['text'] = ucwords( $active_messenger->messenger_label() ); |
|
122 | + foreach ($active_messengers as $active_messenger) { |
|
123 | + if ($active_messenger instanceof EE_Message) { |
|
124 | + $m_values[$i]['id'] = $active_messenger->messenger(); |
|
125 | + $m_values[$i]['text'] = ucwords($active_messenger->messenger_label()); |
|
126 | 126 | $i++; |
127 | 127 | } |
128 | 128 | } |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function get_message_types_for_list_table() { |
141 | 141 | $mt_values = array(); |
142 | - $active_messages = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) ); |
|
142 | + $active_messages = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type')); |
|
143 | 143 | $i = 1; |
144 | - foreach ( $active_messages as $active_message ) { |
|
145 | - if ( $active_message instanceof EE_Message ) { |
|
146 | - $mt_values[ $i ]['id'] = $active_message->message_type(); |
|
147 | - $mt_values[ $i ]['text'] = ucwords( $active_message->message_type_label() ); |
|
144 | + foreach ($active_messages as $active_message) { |
|
145 | + if ($active_message instanceof EE_Message) { |
|
146 | + $mt_values[$i]['id'] = $active_message->message_type(); |
|
147 | + $mt_values[$i]['text'] = ucwords($active_message->message_type_label()); |
|
148 | 148 | $i++; |
149 | 149 | } |
150 | 150 | } |
@@ -161,14 +161,14 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function get_contexts_for_message_types_for_list_table() { |
163 | 163 | $contexts = array(); |
164 | - $active_message_contexts = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) ); |
|
165 | - foreach ( $active_message_contexts as $active_message ) { |
|
166 | - if ( $active_message instanceof EE_Message ) { |
|
164 | + $active_message_contexts = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context')); |
|
165 | + foreach ($active_message_contexts as $active_message) { |
|
166 | + if ($active_message instanceof EE_Message) { |
|
167 | 167 | $message_type = $active_message->message_type_object(); |
168 | - if ( $message_type instanceof EE_message_type ) { |
|
168 | + if ($message_type instanceof EE_message_type) { |
|
169 | 169 | $message_type_contexts = $message_type->get_contexts(); |
170 | - foreach ( $message_type_contexts as $context => $context_details ) { |
|
171 | - $contexts[ $context ] = $context_details['label']; |
|
170 | + foreach ($message_type_contexts as $context => $context_details) { |
|
171 | + $contexts[$context] = $context_details['label']; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | protected function _ajax_hooks() { |
182 | - add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) ); |
|
183 | - add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') ); |
|
184 | - add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') ); |
|
185 | - add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) ); |
|
186 | - add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) ); |
|
182 | + add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle')); |
|
183 | + add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle')); |
|
184 | + add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings')); |
|
185 | + add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form')); |
|
186 | + add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack')); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | protected function _set_page_routes() { |
218 | - $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
|
218 | + $grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) |
|
219 | 219 | ? $this->_req_data['GRP_ID'] |
220 | 220 | : 0; |
221 | - $grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) |
|
221 | + $grp_id = empty($grp_id) && ! empty($this->_req_data['id']) |
|
222 | 222 | ? $this->_req_data['id'] |
223 | 223 | : $grp_id; |
224 | - $msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] ) |
|
224 | + $msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID']) |
|
225 | 225 | ? $this->_req_data['MSG_ID'] |
226 | 226 | : 0; |
227 | 227 | |
@@ -263,35 +263,35 @@ discard block |
||
263 | 263 | 'insert_message_template' => array( |
264 | 264 | 'func' => '_insert_or_update_message_template', |
265 | 265 | 'capability' => 'ee_edit_messages', |
266 | - 'args' => array( 'new_template' => true ), |
|
266 | + 'args' => array('new_template' => true), |
|
267 | 267 | 'noheader' => true |
268 | 268 | ), |
269 | 269 | 'update_message_template' => array( |
270 | 270 | 'func' => '_insert_or_update_message_template', |
271 | 271 | 'capability' => 'ee_edit_message', |
272 | 272 | 'obj_id' => $grp_id, |
273 | - 'args' => array( 'new_template' => false ), |
|
273 | + 'args' => array('new_template' => false), |
|
274 | 274 | 'noheader' => true |
275 | 275 | ), |
276 | 276 | 'trash_message_template' => array( |
277 | 277 | 'func' => '_trash_or_restore_message_template', |
278 | 278 | 'capability' => 'ee_delete_message', |
279 | 279 | 'obj_id' => $grp_id, |
280 | - 'args' => array( 'trash' => true, 'all' => true ), |
|
280 | + 'args' => array('trash' => true, 'all' => true), |
|
281 | 281 | 'noheader' => true |
282 | 282 | ), |
283 | 283 | 'trash_message_template_context' => array( |
284 | 284 | 'func' => '_trash_or_restore_message_template', |
285 | 285 | 'capability' => 'ee_delete_message', |
286 | 286 | 'obj_id' => $grp_id, |
287 | - 'args' => array( 'trash' => true ), |
|
287 | + 'args' => array('trash' => true), |
|
288 | 288 | 'noheader' => true |
289 | 289 | ), |
290 | 290 | 'restore_message_template' => array( |
291 | 291 | 'func' => '_trash_or_restore_message_template', |
292 | 292 | 'capability' => 'ee_delete_message', |
293 | 293 | 'obj_id' => $grp_id, |
294 | - 'args' => array( 'trash' => false, 'all' => true ), |
|
294 | + 'args' => array('trash' => false, 'all' => true), |
|
295 | 295 | 'noheader' => true |
296 | 296 | ), |
297 | 297 | 'restore_message_template_context' => array( |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | 'filename' => 'messages_overview_other', |
411 | 411 | ), |
412 | 412 | ), |
413 | - 'help_tour' => array( 'Messages_Overview_Help_Tour' ), |
|
413 | + 'help_tour' => array('Messages_Overview_Help_Tour'), |
|
414 | 414 | 'require_nonce' => false |
415 | 415 | ), |
416 | 416 | 'custom_mtps' => array( |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | ), |
446 | 446 | 'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'), |
447 | 447 | 'has_metaboxes' => true, |
448 | - 'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ), |
|
448 | + 'help_tour' => array('Message_Templates_Edit_Help_Tour'), |
|
449 | 449 | 'help_tabs' => array( |
450 | 450 | 'edit_message_template' => array( |
451 | 451 | 'title' => __('Message Template Editor', 'event_espresso'), |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | 'filename' => 'messages_settings_messengers' |
502 | 502 | ), |
503 | 503 | ), |
504 | - 'help_tour' => array( 'Messages_Settings_Help_Tour' ), |
|
504 | + 'help_tour' => array('Messages_Settings_Help_Tour'), |
|
505 | 505 | 'require_nonce' => false |
506 | 506 | ) |
507 | 507 | ); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | |
536 | 536 | protected function _add_screen_options_default() { |
537 | - $this->_admin_page_title = __( 'Message Activity', 'event_espresso' ); |
|
537 | + $this->_admin_page_title = __('Message Activity', 'event_espresso'); |
|
538 | 538 | $this->_per_page_screen_option(); |
539 | 539 | } |
540 | 540 | |
@@ -556,37 +556,37 @@ discard block |
||
556 | 556 | |
557 | 557 | |
558 | 558 | public function messages_help_tab() { |
559 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' ); |
|
559 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php'); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | |
563 | 563 | public function messengers_help_tab() { |
564 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' ); |
|
564 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | |
568 | 568 | public function message_types_help_tab() { |
569 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' ); |
|
569 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php'); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | |
573 | 573 | public function messages_overview_help_tab() { |
574 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' ); |
|
574 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
578 | 578 | public function message_templates_help_tab() { |
579 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' ); |
|
579 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php'); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
583 | 583 | public function edit_message_template_help_tab() { |
584 | - $args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />'; |
|
585 | - $args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />'; |
|
586 | - $args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />'; |
|
587 | - $args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />'; |
|
588 | - $args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />'; |
|
589 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
584 | + $args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />'; |
|
585 | + $args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />'; |
|
586 | + $args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />'; |
|
587 | + $args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />'; |
|
588 | + $args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />'; |
|
589 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -594,22 +594,22 @@ discard block |
||
594 | 594 | public function message_template_shortcodes_help_tab() { |
595 | 595 | $this->_set_shortcodes(); |
596 | 596 | $args['shortcodes'] = $this->_shortcodes; |
597 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args ); |
|
597 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | |
601 | 601 | |
602 | 602 | public function preview_message_help_tab() { |
603 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' ); |
|
603 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php'); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | |
607 | 607 | public function settings_help_tab() { |
608 | - $args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'; |
|
609 | - $args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'; |
|
608 | + $args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'; |
|
609 | + $args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'; |
|
610 | 610 | $args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>'; |
611 | 611 | $args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>'; |
612 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args); |
|
612 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | |
@@ -617,31 +617,31 @@ discard block |
||
617 | 617 | |
618 | 618 | |
619 | 619 | public function load_scripts_styles() { |
620 | - wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION ); |
|
620 | + wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION); |
|
621 | 621 | wp_enqueue_style('espresso_ee_msg'); |
622 | 622 | |
623 | - wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true ); |
|
624 | - wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION ); |
|
623 | + wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true); |
|
624 | + wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
628 | 628 | |
629 | 629 | public function load_scripts_styles_default() { |
630 | - wp_enqueue_script( 'ee-msg-list-table-js' ); |
|
630 | + wp_enqueue_script('ee-msg-list-table-js'); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | |
634 | 634 | |
635 | 635 | |
636 | 636 | |
637 | - public function wp_editor_css( $mce_css ) { |
|
637 | + public function wp_editor_css($mce_css) { |
|
638 | 638 | //if we're on the edit_message_template route |
639 | - if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger ) { |
|
639 | + if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) { |
|
640 | 640 | $message_type_name = $this->_active_message_type_name; |
641 | 641 | |
642 | 642 | //we're going to REPLACE the existing mce css |
643 | 643 | //we need to get the css file location from the active messenger |
644 | - $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation ); |
|
644 | + $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | return $mce_css; |
@@ -659,15 +659,15 @@ discard block |
||
659 | 659 | $this->_message_template_group->messenger_obj()->label['singular'], |
660 | 660 | $this->_message_template_group->message_type_obj()->label['singular'] |
661 | 661 | ); |
662 | - EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' ); |
|
662 | + EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso'); |
|
663 | 663 | |
664 | - wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION ); |
|
664 | + wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION); |
|
665 | 665 | |
666 | 666 | wp_enqueue_script('ee_admin_js'); |
667 | 667 | wp_enqueue_script('ee_msgs_edit_js'); |
668 | 668 | |
669 | 669 | //add in special css for tiny_mce |
670 | - add_filter( 'mce_css', array( $this, 'wp_editor_css' ) ); |
|
670 | + add_filter('mce_css', array($this, 'wp_editor_css')); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | |
@@ -676,22 +676,22 @@ discard block |
||
676 | 676 | |
677 | 677 | $this->_set_message_template_group(); |
678 | 678 | |
679 | - if ( isset( $this->_req_data['messenger'] ) ) { |
|
680 | - $this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
679 | + if (isset($this->_req_data['messenger'])) { |
|
680 | + $this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
681 | 681 | } |
682 | 682 | |
683 | - $message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : ''; |
|
683 | + $message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : ''; |
|
684 | 684 | |
685 | 685 | |
686 | - wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) ); |
|
686 | + wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation)); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | |
690 | 690 | |
691 | 691 | public function load_scripts_styles_settings() { |
692 | - wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION ); |
|
693 | - wp_enqueue_style( 'ee-text-links' ); |
|
694 | - wp_enqueue_style( 'ee-message-settings' ); |
|
692 | + wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION); |
|
693 | + wp_enqueue_style('ee-text-links'); |
|
694 | + wp_enqueue_style('ee-message-settings'); |
|
695 | 695 | |
696 | 696 | wp_enqueue_script('ee-messages-settings'); |
697 | 697 | } |
@@ -721,40 +721,40 @@ discard block |
||
721 | 721 | * set views array for message queue list table |
722 | 722 | */ |
723 | 723 | public function _set_list_table_views_default() { |
724 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
724 | + EE_Registry::instance()->load_helper('Template'); |
|
725 | 725 | |
726 | - $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
|
726 | + $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions') |
|
727 | 727 | ? array( |
728 | - 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
|
729 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
730 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
731 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
728 | + 'generate_now' => __('Generate Now', 'event_espresso'), |
|
729 | + 'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'), |
|
730 | + 'queue_for_resending' => __('Queue for Resending', 'event_espresso'), |
|
731 | + 'send_now' => __('Send Now', 'event_espresso') |
|
732 | 732 | ) |
733 | 733 | : array(); |
734 | 734 | |
735 | - $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' ) |
|
736 | - ? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) ) |
|
735 | + $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions') |
|
736 | + ? array('delete_ee_messages' => __('Delete Messages', 'event_espresso')) |
|
737 | 737 | : array(); |
738 | 738 | |
739 | 739 | |
740 | 740 | $this->_views = array( |
741 | 741 | 'all' => array( |
742 | 742 | 'slug' => 'all', |
743 | - 'label' => __( 'All', 'event_espresso' ), |
|
743 | + 'label' => __('All', 'event_espresso'), |
|
744 | 744 | 'count' => 0, |
745 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
745 | + 'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action) |
|
746 | 746 | ) |
747 | 747 | ); |
748 | 748 | |
749 | 749 | |
750 | - foreach ( EEM_Message::instance()->all_statuses() as $status ) { |
|
751 | - if ( $status === EEM_Message::status_debug_only && ! EEM_Message::debug() ) { |
|
750 | + foreach (EEM_Message::instance()->all_statuses() as $status) { |
|
751 | + if ($status === EEM_Message::status_debug_only && ! EEM_Message::debug()) { |
|
752 | 752 | continue; |
753 | 753 | } |
754 | 754 | $status_bulk_actions = $common_bulk_actions; |
755 | 755 | //unset bulk actions not applying to status |
756 | - if ( ! empty( $status_bulk_actions ) ) { |
|
757 | - switch ( $status ) { |
|
756 | + if ( ! empty($status_bulk_actions)) { |
|
757 | + switch ($status) { |
|
758 | 758 | case EEM_Message::status_idle : |
759 | 759 | case EEM_Message::status_resend : |
760 | 760 | $status_bulk_actions['send_now'] = $common_bulk_actions['send_now']; |
@@ -766,21 +766,21 @@ discard block |
||
766 | 766 | break; |
767 | 767 | |
768 | 768 | case EEM_Message::status_incomplete : |
769 | - unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] ); |
|
769 | + unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']); |
|
770 | 770 | break; |
771 | 771 | |
772 | 772 | case EEM_Message::status_retry : |
773 | 773 | case EEM_Message::status_sent : |
774 | - unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] ); |
|
774 | + unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']); |
|
775 | 775 | break; |
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
779 | - $this->_views[ strtolower( $status ) ] = array( |
|
780 | - 'slug' => strtolower( $status ), |
|
781 | - 'label' => EEH_Template::pretty_status( $status, false, 'sentence' ), |
|
779 | + $this->_views[strtolower($status)] = array( |
|
780 | + 'slug' => strtolower($status), |
|
781 | + 'label' => EEH_Template::pretty_status($status, false, 'sentence'), |
|
782 | 782 | 'count' => 0, |
783 | - 'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action ) |
|
783 | + 'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action) |
|
784 | 784 | ); |
785 | 785 | } |
786 | 786 | } |
@@ -799,8 +799,8 @@ discard block |
||
799 | 799 | protected function _message_queue_list_table() { |
800 | 800 | $this->_search_btn_label = __('Message Activity', 'event_espresso'); |
801 | 801 | $this->_template_args['per_column'] = 6; |
802 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() ); |
|
803 | - $this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>'; |
|
802 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items()); |
|
803 | + $this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>'; |
|
804 | 804 | $this->display_admin_list_table_page_with_no_sidebar(); |
805 | 805 | } |
806 | 806 | |
@@ -813,8 +813,8 @@ discard block |
||
813 | 813 | $action_css_classes = EEH_MSG_Template::get_message_action_icons(); |
814 | 814 | $action_items = array(); |
815 | 815 | |
816 | - foreach( $action_css_classes as $action_item => $action_details ) { |
|
817 | - if ( $action_item === 'see_notifications_for' ) { |
|
816 | + foreach ($action_css_classes as $action_item => $action_details) { |
|
817 | + if ($action_item === 'see_notifications_for') { |
|
818 | 818 | continue; |
819 | 819 | } |
820 | 820 | $action_items[$action_item] = array( |
@@ -826,37 +826,37 @@ discard block |
||
826 | 826 | /** @type array $status_items status legend setup*/ |
827 | 827 | $status_items = array( |
828 | 828 | 'sent_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'idle_status' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence') |
|
835 | 835 | ), |
836 | 836 | 'failed_status' => array( |
837 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed, |
|
838 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' ) |
|
837 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed, |
|
838 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence') |
|
839 | 839 | ), |
840 | 840 | 'resend_status' => array( |
841 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend, |
|
842 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' ) |
|
841 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend, |
|
842 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence') |
|
843 | 843 | ), |
844 | 844 | 'incomplete_status' => array( |
845 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete, |
|
846 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' ) |
|
845 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete, |
|
846 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence') |
|
847 | 847 | ), |
848 | 848 | 'retry_status' => array( |
849 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry, |
|
850 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' ) |
|
849 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry, |
|
850 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence') |
|
851 | 851 | ) |
852 | 852 | ); |
853 | - if ( EEM_Message::debug() ) { |
|
853 | + if (EEM_Message::debug()) { |
|
854 | 854 | $status_items['debug_only_status'] = array( |
855 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only, |
|
856 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' ) |
|
855 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only, |
|
856 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence') |
|
857 | 857 | ); |
858 | 858 | } |
859 | - return array_merge( $action_items, $status_items ); |
|
859 | + return array_merge($action_items, $status_items); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -866,9 +866,9 @@ discard block |
||
866 | 866 | |
867 | 867 | protected function _custom_mtps_preview() { |
868 | 868 | $this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso'); |
869 | - $this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />'; |
|
869 | + $this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />'; |
|
870 | 870 | $this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso. With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>'; |
871 | - $this->display_admin_caf_preview_page( 'custom_message_types', false ); |
|
871 | + $this->display_admin_caf_preview_page('custom_message_types', false); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
@@ -892,31 +892,31 @@ discard block |
||
892 | 892 | * |
893 | 893 | * @return array |
894 | 894 | */ |
895 | - public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) { |
|
895 | + public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) { |
|
896 | 896 | |
897 | 897 | $MTP = EEM_Message_Template_Group::instance(); |
898 | 898 | |
899 | 899 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby']; |
900 | 900 | $orderby = $this->_req_data['orderby']; |
901 | 901 | |
902 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC'; |
|
902 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
903 | 903 | |
904 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
905 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage; |
|
904 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
905 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage; |
|
906 | 906 | |
907 | - $offset = ($current_page-1)*$per_page; |
|
908 | - $limit = $all ? null : array( $offset, $per_page ); |
|
907 | + $offset = ($current_page - 1) * $per_page; |
|
908 | + $limit = $all ? null : array($offset, $per_page); |
|
909 | 909 | |
910 | 910 | |
911 | 911 | //options will match what is in the _views array property |
912 | - switch( $type ) { |
|
912 | + switch ($type) { |
|
913 | 913 | |
914 | 914 | case 'in_use': |
915 | - $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true ); |
|
915 | + $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true); |
|
916 | 916 | break; |
917 | 917 | |
918 | 918 | default: |
919 | - $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global ); |
|
919 | + $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global); |
|
920 | 920 | |
921 | 921 | } |
922 | 922 | |
@@ -935,8 +935,8 @@ discard block |
||
935 | 935 | $installed_message_types = $this->_message_resource_manager->installed_message_types(); |
936 | 936 | $installed = array(); |
937 | 937 | |
938 | - foreach ( $installed_message_types as $message_type ) { |
|
939 | - $installed[ $message_type->name ] = $message_type; |
|
938 | + foreach ($installed_message_types as $message_type) { |
|
939 | + $installed[$message_type->name] = $message_type; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | return $installed; |
@@ -955,24 +955,24 @@ discard block |
||
955 | 955 | * |
956 | 956 | * @throws EE_error |
957 | 957 | */ |
958 | - protected function _add_message_template( $message_type = '', $messenger='', $GRP_ID = '' ) { |
|
958 | + protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') { |
|
959 | 959 | //set values override any request data |
960 | - $message_type = !empty( $message_type ) ? $message_type : ''; |
|
961 | - $message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type; |
|
960 | + $message_type = ! empty($message_type) ? $message_type : ''; |
|
961 | + $message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type; |
|
962 | 962 | |
963 | - $messenger = !empty( $messenger ) ? $messenger : ''; |
|
964 | - $messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger; |
|
963 | + $messenger = ! empty($messenger) ? $messenger : ''; |
|
964 | + $messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger; |
|
965 | 965 | |
966 | - $GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : ''; |
|
967 | - $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
966 | + $GRP_ID = ! empty($GRP_ID) ? $GRP_ID : ''; |
|
967 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
968 | 968 | |
969 | 969 | //we need messenger and message type. They should be coming from the event editor. If not here then return error |
970 | - if ( empty( $message_type ) || empty( $messenger ) ) |
|
971 | - {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));} |
|
970 | + if (empty($message_type) || empty($messenger)) |
|
971 | + {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); } |
|
972 | 972 | |
973 | 973 | //we need the GRP_ID for the template being used as the base for the new template |
974 | - if ( empty( $GRP_ID ) ) |
|
975 | - {throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );} |
|
974 | + if (empty($GRP_ID)) |
|
975 | + {throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); } |
|
976 | 976 | |
977 | 977 | //let's just make sure the template gets generated! |
978 | 978 | |
@@ -993,8 +993,8 @@ discard block |
||
993 | 993 | * @param int $GRP_ID GRP_ID for the related message template group this new template will be based |
994 | 994 | * off of. |
995 | 995 | */ |
996 | - public function add_message_template( $message_type, $messenger, $GRP_ID ) { |
|
997 | - $this->_add_message_template( $message_type, $messenger, $GRP_ID ); |
|
996 | + public function add_message_template($message_type, $messenger, $GRP_ID) { |
|
997 | + $this->_add_message_template($message_type, $messenger, $GRP_ID); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | |
@@ -1005,14 +1005,14 @@ discard block |
||
1005 | 1005 | * @return void |
1006 | 1006 | */ |
1007 | 1007 | protected function _edit_message_template() { |
1008 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1008 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1009 | 1009 | $template_fields = ''; |
1010 | 1010 | $sidebar_fields = ''; |
1011 | 1011 | //we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates. |
1012 | - add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 ); |
|
1012 | + add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2); |
|
1013 | 1013 | |
1014 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) |
|
1015 | - ? absint( $this->_req_data['id'] ) |
|
1014 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) |
|
1015 | + ? absint($this->_req_data['id']) |
|
1016 | 1016 | : false; |
1017 | 1017 | |
1018 | 1018 | $this->_set_shortcodes(); //this also sets the _message_template property. |
@@ -1020,20 +1020,20 @@ discard block |
||
1020 | 1020 | $c_label = $message_template_group->context_label(); |
1021 | 1021 | $c_config = $message_template_group->contexts_config(); |
1022 | 1022 | |
1023 | - reset( $c_config ); |
|
1024 | - $context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) |
|
1023 | + reset($c_config); |
|
1024 | + $context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) |
|
1025 | 1025 | ? strtolower($this->_req_data['context']) |
1026 | 1026 | : key($c_config); |
1027 | 1027 | |
1028 | 1028 | |
1029 | - if ( empty($GRP_ID) ) { |
|
1029 | + if (empty($GRP_ID)) { |
|
1030 | 1030 | $action = 'insert_message_template'; |
1031 | 1031 | //$button_both = false; |
1032 | 1032 | //$button_text = array( __( 'Save','event_espresso') ); |
1033 | 1033 | //$button_actions = array('something_different'); |
1034 | 1034 | //$referrer = false; |
1035 | 1035 | $edit_message_template_form_url = add_query_arg( |
1036 | - array( 'action' => $action, 'noheader' => true ), |
|
1036 | + array('action' => $action, 'noheader' => true), |
|
1037 | 1037 | EE_MSG_ADMIN_URL |
1038 | 1038 | ); |
1039 | 1039 | } else { |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | //$button_actions = array(); |
1044 | 1044 | //$referrer = $this->_admin_base_url; |
1045 | 1045 | $edit_message_template_form_url = add_query_arg( |
1046 | - array( 'action' => $action, 'noheader' => true ), |
|
1046 | + array('action' => $action, 'noheader' => true), |
|
1047 | 1047 | EE_MSG_ADMIN_URL |
1048 | 1048 | ); |
1049 | 1049 | } |
@@ -1057,14 +1057,14 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | //Do we have any validation errors? |
1059 | 1059 | $validators = $this->_get_transient(); |
1060 | - $v_fields = !empty($validators) ? array_keys($validators) : array(); |
|
1060 | + $v_fields = ! empty($validators) ? array_keys($validators) : array(); |
|
1061 | 1061 | |
1062 | 1062 | |
1063 | 1063 | //we need to assemble the title from Various details |
1064 | 1064 | $context_label = sprintf( |
1065 | 1065 | __('(%s %s)', 'event_espresso'), |
1066 | 1066 | $c_config[$context]['label'], |
1067 | - ucwords($c_label['label'] ) |
|
1067 | + ucwords($c_label['label']) |
|
1068 | 1068 | ); |
1069 | 1069 | |
1070 | 1070 | $title = sprintf( |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | $message_template_group->message_type() |
1086 | 1086 | ); |
1087 | 1087 | |
1088 | - if ( !$template_field_structure ) { |
|
1088 | + if ( ! $template_field_structure) { |
|
1089 | 1089 | $template_field_structure = false; |
1090 | 1090 | $template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso'); |
1091 | 1091 | } |
@@ -1095,51 +1095,51 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | |
1097 | 1097 | //if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array. |
1098 | - if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) { |
|
1099 | - foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) { |
|
1100 | - unset( $template_field_structure[$context][$reference_field] ); |
|
1098 | + if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) { |
|
1099 | + foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) { |
|
1100 | + unset($template_field_structure[$context][$reference_field]); |
|
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | //let's loop through the template_field_structure and actually assemble the input fields! |
1105 | - if ( !empty($template_field_structure) ) { |
|
1106 | - foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) { |
|
1105 | + if ( ! empty($template_field_structure)) { |
|
1106 | + foreach ($template_field_structure[$context] as $template_field => $field_setup_array) { |
|
1107 | 1107 | //if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them. |
1108 | - if ( $template_field == 'extra' ) { |
|
1108 | + if ($template_field == 'extra') { |
|
1109 | 1109 | $this->_template_args['is_extra_fields'] = true; |
1110 | - foreach ( $field_setup_array as $reference_field => $new_fields_array ) { |
|
1111 | - $message_template = $message_templates[ $context ][ $reference_field ]; |
|
1110 | + foreach ($field_setup_array as $reference_field => $new_fields_array) { |
|
1111 | + $message_template = $message_templates[$context][$reference_field]; |
|
1112 | 1112 | $content = $message_template instanceof EE_Message_Template |
1113 | - ? $message_template->get( 'MTP_content' ) |
|
1113 | + ? $message_template->get('MTP_content') |
|
1114 | 1114 | : ''; |
1115 | - foreach ( $new_fields_array as $extra_field => $extra_array ) { |
|
1115 | + foreach ($new_fields_array as $extra_field => $extra_array) { |
|
1116 | 1116 | //let's verify if we need this extra field via the shortcodes parameter. |
1117 | 1117 | $continue = false; |
1118 | - if ( isset( $extra_array['shortcodes_required'] ) ) { |
|
1119 | - foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { |
|
1120 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) |
|
1121 | - {$continue = true;} |
|
1118 | + if (isset($extra_array['shortcodes_required'])) { |
|
1119 | + foreach ((array) $extra_array['shortcodes_required'] as $shortcode) { |
|
1120 | + if ( ! array_key_exists($shortcode, $this->_shortcodes)) |
|
1121 | + {$continue = true; } |
|
1122 | 1122 | } |
1123 | - if ( $continue ) {continue;} |
|
1123 | + if ($continue) {continue; } |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $field_id = $reference_field . '-' . $extra_field . '-content'; |
|
1126 | + $field_id = $reference_field.'-'.$extra_field.'-content'; |
|
1127 | 1127 | $template_form_fields[$field_id] = $extra_array; |
1128 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']'; |
|
1129 | - $css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : ''; |
|
1128 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']'; |
|
1129 | + $css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : ''; |
|
1130 | 1130 | |
1131 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1131 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1132 | 1132 | && in_array($extra_field, $v_fields) |
1133 | 1133 | && |
1134 | 1134 | ( |
1135 | - is_array($validators[$extra_field] ) |
|
1136 | - && isset( $validators[$extra_field]['msg'] ) |
|
1135 | + is_array($validators[$extra_field]) |
|
1136 | + && isset($validators[$extra_field]['msg']) |
|
1137 | 1137 | ) |
1138 | - ? 'validate-error ' . $css_class |
|
1138 | + ? 'validate-error '.$css_class |
|
1139 | 1139 | : $css_class; |
1140 | 1140 | |
1141 | - $template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) |
|
1142 | - ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) |
|
1141 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) |
|
1142 | + ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) |
|
1143 | 1143 | : ''; |
1144 | 1144 | |
1145 | 1145 | //do we have a validation error? if we do then let's use that value instead |
@@ -1155,32 +1155,32 @@ discard block |
||
1155 | 1155 | $field_id |
1156 | 1156 | ); |
1157 | 1157 | |
1158 | - if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) { |
|
1158 | + if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') { |
|
1159 | 1159 | //we want to decode the entities |
1160 | 1160 | $template_form_fields[$field_id]['value'] = stripslashes( |
1161 | - html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1161 | + html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1162 | 1162 | ); |
1163 | 1163 | |
1164 | 1164 | }/**/ |
1165 | 1165 | } |
1166 | - $templatefield_MTP_id = $reference_field . '-MTP_ID'; |
|
1167 | - $templatefield_templatename_id = $reference_field . '-name'; |
|
1166 | + $templatefield_MTP_id = $reference_field.'-MTP_ID'; |
|
1167 | + $templatefield_templatename_id = $reference_field.'-name'; |
|
1168 | 1168 | |
1169 | 1169 | $template_form_fields[$templatefield_MTP_id] = array( |
1170 | - 'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]', |
|
1170 | + 'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]', |
|
1171 | 1171 | 'label' => null, |
1172 | 1172 | 'input' => 'hidden', |
1173 | 1173 | 'type' => 'int', |
1174 | 1174 | 'required' => false, |
1175 | 1175 | 'validation' => false, |
1176 | - 'value' => !empty($message_templates) ? $message_template->ID() : '', |
|
1176 | + 'value' => ! empty($message_templates) ? $message_template->ID() : '', |
|
1177 | 1177 | 'css_class' => '', |
1178 | 1178 | 'format' => '%d', |
1179 | 1179 | 'db-col' => 'MTP_ID' |
1180 | 1180 | ); |
1181 | 1181 | |
1182 | 1182 | $template_form_fields[$templatefield_templatename_id] = array( |
1183 | - 'name' => 'MTP_template_fields[' . $reference_field . '][name]', |
|
1183 | + 'name' => 'MTP_template_fields['.$reference_field.'][name]', |
|
1184 | 1184 | 'label' => null, |
1185 | 1185 | 'input' => 'hidden', |
1186 | 1186 | 'type' => 'string', |
@@ -1194,14 +1194,14 @@ discard block |
||
1194 | 1194 | } |
1195 | 1195 | continue; //skip the next stuff, we got the necessary fields here for this dataset. |
1196 | 1196 | } else { |
1197 | - $field_id = $template_field . '-content'; |
|
1197 | + $field_id = $template_field.'-content'; |
|
1198 | 1198 | $template_form_fields[$field_id] = $field_setup_array; |
1199 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]'; |
|
1200 | - $message_template = isset( $message_templates[ $context ][ $template_field ] ) |
|
1201 | - ? $message_templates[ $context ][ $template_field ] |
|
1199 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]'; |
|
1200 | + $message_template = isset($message_templates[$context][$template_field]) |
|
1201 | + ? $message_templates[$context][$template_field] |
|
1202 | 1202 | : null; |
1203 | - $template_form_fields[$field_id]['value'] = ! empty( $message_templates ) |
|
1204 | - && is_array( $message_templates[$context] ) |
|
1203 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) |
|
1204 | + && is_array($message_templates[$context]) |
|
1205 | 1205 | && $message_template instanceof EE_Message_Template |
1206 | 1206 | ? $message_template->get('MTP_content') |
1207 | 1207 | : ''; |
@@ -1214,10 +1214,10 @@ discard block |
||
1214 | 1214 | |
1215 | 1215 | $template_form_fields[$field_id]['db-col'] = 'MTP_content'; |
1216 | 1216 | $css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : ''; |
1217 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1218 | - && in_array( $template_field, $v_fields ) |
|
1219 | - && isset( $validators[$template_field]['msg'] ) |
|
1220 | - ? 'validate-error ' . $css_class |
|
1217 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1218 | + && in_array($template_field, $v_fields) |
|
1219 | + && isset($validators[$template_field]['msg']) |
|
1220 | + ? 'validate-error '.$css_class |
|
1221 | 1221 | : $css_class; |
1222 | 1222 | |
1223 | 1223 | //shortcode selector |
@@ -1228,12 +1228,12 @@ discard block |
||
1228 | 1228 | |
1229 | 1229 | //k took care of content field(s) now let's take care of others. |
1230 | 1230 | |
1231 | - $templatefield_MTP_id = $template_field . '-MTP_ID'; |
|
1232 | - $templatefield_field_templatename_id = $template_field . '-name'; |
|
1231 | + $templatefield_MTP_id = $template_field.'-MTP_ID'; |
|
1232 | + $templatefield_field_templatename_id = $template_field.'-name'; |
|
1233 | 1233 | |
1234 | 1234 | //foreach template field there are actually two form fields created |
1235 | 1235 | $template_form_fields[$templatefield_MTP_id] = array( |
1236 | - 'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]', |
|
1236 | + 'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]', |
|
1237 | 1237 | 'label' => null, |
1238 | 1238 | 'input' => 'hidden', |
1239 | 1239 | 'type' => 'int', |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | ); |
1247 | 1247 | |
1248 | 1248 | $template_form_fields[$templatefield_field_templatename_id] = array( |
1249 | - 'name' => 'MTP_template_fields[' . $template_field . '][name]', |
|
1249 | + 'name' => 'MTP_template_fields['.$template_field.'][name]', |
|
1250 | 1250 | 'label' => null, |
1251 | 1251 | 'input' => 'hidden', |
1252 | 1252 | 'type' => 'string', |
@@ -1390,13 +1390,13 @@ discard block |
||
1390 | 1390 | 'value' => $GRP_ID |
1391 | 1391 | ); |
1392 | 1392 | $sidebar_form_fields['ee-msg-evt-nonce'] = array( |
1393 | - 'name' => $action . '_nonce', |
|
1393 | + 'name' => $action.'_nonce', |
|
1394 | 1394 | 'input' => 'hidden', |
1395 | 1395 | 'type' => 'string', |
1396 | - 'value' => wp_create_nonce( $action . '_nonce') |
|
1396 | + 'value' => wp_create_nonce($action.'_nonce') |
|
1397 | 1397 | ); |
1398 | 1398 | |
1399 | - if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) { |
|
1399 | + if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) { |
|
1400 | 1400 | $sidebar_form_fields['ee-msg-template-switch'] = array( |
1401 | 1401 | 'name' => 'template_switch', |
1402 | 1402 | 'input' => 'hidden', |
@@ -1406,8 +1406,8 @@ discard block |
||
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | |
1409 | - $template_fields = $this->_generate_admin_form_fields( $template_form_fields ); |
|
1410 | - $sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields ); |
|
1409 | + $template_fields = $this->_generate_admin_form_fields($template_form_fields); |
|
1410 | + $sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields); |
|
1411 | 1411 | |
1412 | 1412 | |
1413 | 1413 | } //end if ( !empty($template_field_structure) ) |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | $GRP_ID, |
1420 | 1420 | false, |
1421 | 1421 | add_query_arg( |
1422 | - array( 'action' => 'global_mtps' ), |
|
1422 | + array('action' => 'global_mtps'), |
|
1423 | 1423 | $this->_admin_base_url |
1424 | 1424 | ) |
1425 | 1425 | ); |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | ), |
1436 | 1436 | $this->_admin_base_url |
1437 | 1437 | ); |
1438 | - $preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>'; |
|
1438 | + $preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>'; |
|
1439 | 1439 | |
1440 | 1440 | |
1441 | 1441 | //setup context switcher |
@@ -1464,16 +1464,16 @@ discard block |
||
1464 | 1464 | |
1465 | 1465 | $this->_template_path = $this->_template_args['GRP_ID'] |
1466 | 1466 | ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' |
1467 | - : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php'; |
|
1467 | + : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php'; |
|
1468 | 1468 | |
1469 | 1469 | //send along EE_Message_Template_Group object for further template use. |
1470 | 1470 | $this->_template_args['MTP'] = $message_template_group; |
1471 | 1471 | |
1472 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true ); |
|
1472 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true); |
|
1473 | 1473 | |
1474 | 1474 | |
1475 | 1475 | //finally, let's set the admin_page title |
1476 | - $this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title ); |
|
1476 | + $this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title); |
|
1477 | 1477 | |
1478 | 1478 | |
1479 | 1479 | //we need to take care of setting the shortcodes property for use elsewhere. |
@@ -1486,7 +1486,7 @@ discard block |
||
1486 | 1486 | } |
1487 | 1487 | |
1488 | 1488 | |
1489 | - public function filter_tinymce_init( $mceInit, $editor_id ) { |
|
1489 | + public function filter_tinymce_init($mceInit, $editor_id) { |
|
1490 | 1490 | return $mceInit; |
1491 | 1491 | } |
1492 | 1492 | |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | } |
1498 | 1498 | |
1499 | 1499 | public function _add_form_element_before() { |
1500 | - return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">'; |
|
1500 | + return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">'; |
|
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | public function _add_form_element_after() { |
@@ -1514,25 +1514,25 @@ discard block |
||
1514 | 1514 | * |
1515 | 1515 | */ |
1516 | 1516 | public function switch_template_pack() { |
1517 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1518 | - $template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : ''; |
|
1517 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1518 | + $template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : ''; |
|
1519 | 1519 | |
1520 | 1520 | //verify we have needed values. |
1521 | - if ( empty( $GRP_ID ) || empty( $template_pack ) ) { |
|
1521 | + if (empty($GRP_ID) || empty($template_pack)) { |
|
1522 | 1522 | $this->_template_args['error'] = true; |
1523 | - EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1523 | + EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1524 | 1524 | } else { |
1525 | 1525 | //get template, set the new template_pack and then reset to default |
1526 | 1526 | /** @type EE_Message_Template_Group $message_template_group */ |
1527 | - $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
1527 | + $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
1528 | 1528 | |
1529 | - $message_template_group->set_template_pack_name( $template_pack ); |
|
1529 | + $message_template_group->set_template_pack_name($template_pack); |
|
1530 | 1530 | $this->_req_data['msgr'] = $message_template_group->messenger(); |
1531 | 1531 | $this->_req_data['mt'] = $message_template_group->message_type(); |
1532 | 1532 | |
1533 | 1533 | $query_args = $this->_reset_to_default_template(); |
1534 | 1534 | |
1535 | - if ( empty( $query_args['id'] ) ) { |
|
1535 | + if (empty($query_args['id'])) { |
|
1536 | 1536 | EE_Error::add_error( |
1537 | 1537 | __( |
1538 | 1538 | 'Something went wrong with switching the template pack. Please try again or contact EE support', |
@@ -1542,7 +1542,7 @@ discard block |
||
1542 | 1542 | ); |
1543 | 1543 | $this->_template_args['error'] = true; |
1544 | 1544 | } else { |
1545 | - $template_label =$message_template_group->get_template_pack()->label; |
|
1545 | + $template_label = $message_template_group->get_template_pack()->label; |
|
1546 | 1546 | $template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels(); |
1547 | 1547 | EE_Error::add_success( |
1548 | 1548 | sprintf( |
@@ -1555,7 +1555,7 @@ discard block |
||
1555 | 1555 | ) |
1556 | 1556 | ); |
1557 | 1557 | //generate the redirect url for js. |
1558 | - $url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1558 | + $url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1559 | 1559 | $this->_template_args['data']['redirect_url'] = $url; |
1560 | 1560 | $this->_template_args['success'] = true; |
1561 | 1561 | } |
@@ -1577,9 +1577,9 @@ discard block |
||
1577 | 1577 | protected function _reset_to_default_template() { |
1578 | 1578 | |
1579 | 1579 | $templates = array(); |
1580 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1580 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1581 | 1581 | //we need to make sure we've got the info we need. |
1582 | - if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) { |
|
1582 | + if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) { |
|
1583 | 1583 | EE_Error::add_error( |
1584 | 1584 | __( |
1585 | 1585 | 'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset. At least one of these is missing.', |
@@ -1591,9 +1591,9 @@ discard block |
||
1591 | 1591 | |
1592 | 1592 | // all templates will be reset to whatever the defaults are |
1593 | 1593 | // for the global template matching the messenger and message type. |
1594 | - $success = !empty( $GRP_ID ) ? true : false; |
|
1594 | + $success = ! empty($GRP_ID) ? true : false; |
|
1595 | 1595 | |
1596 | - if ( $success ) { |
|
1596 | + if ($success) { |
|
1597 | 1597 | |
1598 | 1598 | //let's first determine if the incoming template is a global template, |
1599 | 1599 | // if it isn't then we need to get the global template matching messenger and message type. |
@@ -1601,9 +1601,9 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | |
1603 | 1603 | //note this is ONLY deleting the template fields (Message Template rows) NOT the message template group. |
1604 | - $success = $this->_delete_mtp_permanently( $GRP_ID, false ); |
|
1604 | + $success = $this->_delete_mtp_permanently($GRP_ID, false); |
|
1605 | 1605 | |
1606 | - if ( $success ) { |
|
1606 | + if ($success) { |
|
1607 | 1607 | // if successfully deleted, lets generate the new ones. |
1608 | 1608 | // Note. We set GLOBAL to true, because resets on ANY template |
1609 | 1609 | // will use the related global template defaults for regeneration. |
@@ -1621,32 +1621,32 @@ discard block |
||
1621 | 1621 | } |
1622 | 1622 | |
1623 | 1623 | //any error messages? |
1624 | - if ( !$success ) { |
|
1624 | + if ( ! $success) { |
|
1625 | 1625 | EE_Error::add_error( |
1626 | - __( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ), |
|
1626 | + __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), |
|
1627 | 1627 | __FILE__, __FUNCTION__, __LINE__ |
1628 | 1628 | ); |
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | //all good, let's add a success message! |
1632 | - if ( $success && ! empty( $templates ) ) { |
|
1632 | + if ($success && ! empty($templates)) { |
|
1633 | 1633 | $templates = $templates[0]; //the info for the template we generated is the first element in the returned array. |
1634 | 1634 | EE_Error::overwrite_success(); |
1635 | - EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') ); |
|
1635 | + EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso')); |
|
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | |
1639 | 1639 | $query_args = array( |
1640 | - 'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null, |
|
1641 | - 'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null, |
|
1642 | - 'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps' |
|
1640 | + 'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null, |
|
1641 | + 'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null, |
|
1642 | + 'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps' |
|
1643 | 1643 | ); |
1644 | 1644 | |
1645 | 1645 | //if called via ajax then we return query args otherwise redirect |
1646 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
1646 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1647 | 1647 | return $query_args; |
1648 | 1648 | } else { |
1649 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
1649 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1650 | 1650 | return null; |
1651 | 1651 | } |
1652 | 1652 | } |
@@ -1659,7 +1659,7 @@ discard block |
||
1659 | 1659 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview. |
1660 | 1660 | * @return string |
1661 | 1661 | */ |
1662 | - public function _preview_message( $send = false ) { |
|
1662 | + public function _preview_message($send = false) { |
|
1663 | 1663 | //first make sure we've got the necessary parameters |
1664 | 1664 | if ( |
1665 | 1665 | ! isset( |
@@ -1675,13 +1675,13 @@ discard block |
||
1675 | 1675 | ); |
1676 | 1676 | } |
1677 | 1677 | |
1678 | - EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] ); |
|
1678 | + EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']); |
|
1679 | 1679 | |
1680 | 1680 | |
1681 | 1681 | //get the preview! |
1682 | - $preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send ); |
|
1682 | + $preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send); |
|
1683 | 1683 | |
1684 | - if ( $send ) { |
|
1684 | + if ($send) { |
|
1685 | 1685 | return $preview; |
1686 | 1686 | } |
1687 | 1687 | |
@@ -1691,22 +1691,22 @@ discard block |
||
1691 | 1691 | 'context' => $this->_req_data['context'], |
1692 | 1692 | 'action' => 'edit_message_template' |
1693 | 1693 | ); |
1694 | - $go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1695 | - $preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>'; |
|
1694 | + $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1695 | + $preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>'; |
|
1696 | 1696 | $message_types = $this->get_installed_message_types(); |
1697 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
1697 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
1698 | 1698 | $active_messenger_label = $active_messenger instanceof EE_messenger |
1699 | - ? ucwords( $active_messenger->label['singular'] ) |
|
1700 | - : esc_html__( 'Unknown Messenger', 'event_espresso' ); |
|
1699 | + ? ucwords($active_messenger->label['singular']) |
|
1700 | + : esc_html__('Unknown Messenger', 'event_espresso'); |
|
1701 | 1701 | //let's provide a helpful title for context |
1702 | 1702 | $preview_title = sprintf( |
1703 | - __( 'Viewing Preview for %s %s Message Template', 'event_espresso' ), |
|
1703 | + __('Viewing Preview for %s %s Message Template', 'event_espresso'), |
|
1704 | 1704 | $active_messenger_label, |
1705 | - ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] ) |
|
1705 | + ucwords($message_types[$this->_req_data['message_type']]->label['singular']) |
|
1706 | 1706 | ); |
1707 | 1707 | //setup display of preview. |
1708 | 1708 | $this->_admin_page_title = $preview_title; |
1709 | - $this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview); |
|
1709 | + $this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview); |
|
1710 | 1710 | $this->_template_args['data']['force_json'] = true; |
1711 | 1711 | return ''; |
1712 | 1712 | } |
@@ -1736,9 +1736,9 @@ discard block |
||
1736 | 1736 | * @return void |
1737 | 1737 | */ |
1738 | 1738 | protected function _register_edit_meta_boxes() { |
1739 | - add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' ); |
|
1740 | - add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1741 | - add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1739 | + add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default'); |
|
1740 | + add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1741 | + add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | |
@@ -1757,14 +1757,14 @@ discard block |
||
1757 | 1757 | |
1758 | 1758 | $tp_select_values = array(); |
1759 | 1759 | |
1760 | - foreach ( $tp_collection as $tp ) { |
|
1760 | + foreach ($tp_collection as $tp) { |
|
1761 | 1761 | //only include template packs that support this messenger and message type! |
1762 | 1762 | $supports = $tp->get_supports(); |
1763 | 1763 | if ( |
1764 | - ! isset( $supports[ $this->_message_template_group->messenger() ] ) |
|
1764 | + ! isset($supports[$this->_message_template_group->messenger()]) |
|
1765 | 1765 | || ! in_array( |
1766 | 1766 | $this->_message_template_group->message_type(), |
1767 | - $supports[ $this->_message_template_group->messenger() ] |
|
1767 | + $supports[$this->_message_template_group->messenger()] |
|
1768 | 1768 | ) |
1769 | 1769 | ) { |
1770 | 1770 | //not supported |
@@ -1778,7 +1778,7 @@ discard block |
||
1778 | 1778 | } |
1779 | 1779 | |
1780 | 1780 | //if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack. This still allows for the odd template pack to override. |
1781 | - if ( empty( $tp_select_values ) ) { |
|
1781 | + if (empty($tp_select_values)) { |
|
1782 | 1782 | $tp_select_values[] = array( |
1783 | 1783 | 'text' => __('Default', 'event_espresso'), |
1784 | 1784 | 'id' => 'default' |
@@ -1791,14 +1791,14 @@ discard block |
||
1791 | 1791 | $this->_message_template_group->message_type() |
1792 | 1792 | ); |
1793 | 1793 | $variations_select_values = array(); |
1794 | - foreach ( $variations as $variation => $label ) { |
|
1794 | + foreach ($variations as $variation => $label) { |
|
1795 | 1795 | $variations_select_values[] = array( |
1796 | 1796 | 'text' => $label, |
1797 | 1797 | 'id' => $variation |
1798 | 1798 | ); |
1799 | 1799 | } |
1800 | 1800 | |
1801 | - $template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1801 | + $template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1802 | 1802 | |
1803 | 1803 | $template_args['template_packs_selector'] = EEH_Form_Fields::select_input( |
1804 | 1804 | 'MTP_template_pack', |
@@ -1815,9 +1815,9 @@ discard block |
||
1815 | 1815 | $template_args['template_pack_description'] = $template_pack_labels->template_pack_description; |
1816 | 1816 | $template_args['template_variation_description'] = $template_pack_labels->template_variation_description; |
1817 | 1817 | |
1818 | - $template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php'; |
|
1818 | + $template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php'; |
|
1819 | 1819 | |
1820 | - EEH_Template::display_template( $template, $template_args ); |
|
1820 | + EEH_Template::display_template($template, $template_args); |
|
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | |
@@ -1848,47 +1848,47 @@ discard block |
||
1848 | 1848 | //first we need to see if there are any fields |
1849 | 1849 | $fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields(); |
1850 | 1850 | |
1851 | - if ( !empty( $fields ) ) { |
|
1851 | + if ( ! empty($fields)) { |
|
1852 | 1852 | //yup there be fields |
1853 | - foreach ( $fields as $field => $config ) { |
|
1854 | - $field_id = $this->_message_template_group->messenger() . '_' . $field; |
|
1853 | + foreach ($fields as $field => $config) { |
|
1854 | + $field_id = $this->_message_template_group->messenger().'_'.$field; |
|
1855 | 1855 | $existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings(); |
1856 | - $default = isset( $config['default'] ) ? $config['default'] : ''; |
|
1857 | - $default = isset( $config['value'] ) ? $config['value'] : $default; |
|
1856 | + $default = isset($config['default']) ? $config['default'] : ''; |
|
1857 | + $default = isset($config['value']) ? $config['value'] : $default; |
|
1858 | 1858 | |
1859 | 1859 | //if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults |
1860 | 1860 | $fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : ''; |
1861 | - $existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix; |
|
1861 | + $existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix; |
|
1862 | 1862 | |
1863 | 1863 | $template_form_fields[$field_id] = array( |
1864 | - 'name' => 'test_settings_fld[' . $field . ']', |
|
1864 | + 'name' => 'test_settings_fld['.$field.']', |
|
1865 | 1865 | 'label' => $config['label'], |
1866 | 1866 | 'input' => $config['input'], |
1867 | 1867 | 'type' => $config['type'], |
1868 | 1868 | 'required' => $config['required'], |
1869 | 1869 | 'validation' => $config['validation'], |
1870 | - 'value' => isset( $existing[$field] ) ? $existing[$field] : $default, |
|
1870 | + 'value' => isset($existing[$field]) ? $existing[$field] : $default, |
|
1871 | 1871 | 'css_class' => $config['css_class'], |
1872 | - 'options' => isset( $config['options'] ) ? $config['options'] : array(), |
|
1872 | + 'options' => isset($config['options']) ? $config['options'] : array(), |
|
1873 | 1873 | 'default' => $default, |
1874 | 1874 | 'format' => $config['format'] |
1875 | 1875 | ); |
1876 | 1876 | } |
1877 | 1877 | } |
1878 | 1878 | |
1879 | - $test_settings_fields = !empty( $template_form_fields) |
|
1880 | - ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) |
|
1879 | + $test_settings_fields = ! empty($template_form_fields) |
|
1880 | + ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') |
|
1881 | 1881 | : ''; |
1882 | 1882 | |
1883 | 1883 | $test_settings_html = ''; |
1884 | 1884 | //print out $test_settings_fields |
1885 | - if ( !empty( $test_settings_fields ) ) { |
|
1885 | + if ( ! empty($test_settings_fields)) { |
|
1886 | 1886 | echo $test_settings_fields; |
1887 | - $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>'; |
|
1887 | + $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>'; |
|
1888 | 1888 | } |
1889 | 1889 | |
1890 | 1890 | //and button |
1891 | - echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>'; |
|
1891 | + echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>'; |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | |
@@ -1903,13 +1903,13 @@ discard block |
||
1903 | 1903 | * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
1904 | 1904 | * @return string |
1905 | 1905 | */ |
1906 | - protected function _get_shortcode_selector( $field, $linked_input_id ) { |
|
1906 | + protected function _get_shortcode_selector($field, $linked_input_id) { |
|
1907 | 1907 | $template_args = array( |
1908 | - 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
|
1908 | + 'shortcodes' => $this->_get_shortcodes(array($field), true), |
|
1909 | 1909 | 'fieldname' => $field, |
1910 | 1910 | 'linked_input_id' => $linked_input_id |
1911 | 1911 | ); |
1912 | - return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true ); |
|
1912 | + return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1924,13 +1924,13 @@ discard block |
||
1924 | 1924 | $shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set |
1925 | 1925 | //$messenger = $this->_message_template_group->messenger_obj(); |
1926 | 1926 | //now let's set the content depending on the status of the shortcodes array |
1927 | - if ( empty( $shortcodes ) ) { |
|
1928 | - $content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>'; |
|
1927 | + if (empty($shortcodes)) { |
|
1928 | + $content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>'; |
|
1929 | 1929 | echo $content; |
1930 | 1930 | } else { |
1931 | 1931 | //$alt = 0; |
1932 | 1932 | ?> |
1933 | - <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p> |
|
1933 | + <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p> |
|
1934 | 1934 | <?php |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | protected function _set_shortcodes() { |
1948 | 1948 | |
1949 | 1949 | //no need to run this if the property is already set |
1950 | - if ( !empty($this->_shortcodes ) ) {return;} |
|
1950 | + if ( ! empty($this->_shortcodes)) {return; } |
|
1951 | 1951 | |
1952 | 1952 | $this->_shortcodes = $this->_get_shortcodes(); |
1953 | 1953 | } |
@@ -1969,14 +1969,14 @@ discard block |
||
1969 | 1969 | * @return array Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true |
1970 | 1970 | * just an array of shortcode/label pairs. |
1971 | 1971 | */ |
1972 | - protected function _get_shortcodes( $fields = array(), $merged = true ) { |
|
1972 | + protected function _get_shortcodes($fields = array(), $merged = true) { |
|
1973 | 1973 | $this->_set_message_template_group(); |
1974 | 1974 | |
1975 | 1975 | //we need the messenger and message template to retrieve the valid shortcodes array. |
1976 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false; |
|
1977 | - $context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() ); |
|
1976 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false; |
|
1977 | + $context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config()); |
|
1978 | 1978 | |
1979 | - return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array(); |
|
1979 | + return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array(); |
|
1980 | 1980 | } |
1981 | 1981 | |
1982 | 1982 | |
@@ -1989,19 +1989,19 @@ discard block |
||
1989 | 1989 | */ |
1990 | 1990 | protected function _set_message_template_group() { |
1991 | 1991 | |
1992 | - if ( !empty( $this->_message_template_group ) ) |
|
1993 | - {return;} //get out if this is already set. |
|
1992 | + if ( ! empty($this->_message_template_group)) |
|
1993 | + {return; } //get out if this is already set. |
|
1994 | 1994 | |
1995 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false; |
|
1996 | - $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID; |
|
1995 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false; |
|
1996 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID; |
|
1997 | 1997 | |
1998 | 1998 | //let's get the message templates |
1999 | 1999 | $MTP = EEM_Message_Template_Group::instance(); |
2000 | 2000 | |
2001 | - if ( empty($GRP_ID) ) |
|
2002 | - {$this->_message_template_group = $MTP->create_default_object();} |
|
2001 | + if (empty($GRP_ID)) |
|
2002 | + {$this->_message_template_group = $MTP->create_default_object(); } |
|
2003 | 2003 | else |
2004 | - {$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );} |
|
2004 | + {$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); } |
|
2005 | 2005 | |
2006 | 2006 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
2007 | 2007 | $this->_variation = $this->_message_template_group->get_template_pack_variation(); |
@@ -2020,7 +2020,7 @@ discard block |
||
2020 | 2020 | * @param array $args various things the context switcher needs. |
2021 | 2021 | * |
2022 | 2022 | */ |
2023 | - protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) { |
|
2023 | + protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) { |
|
2024 | 2024 | $context_details = $template_group_object->contexts_config(); |
2025 | 2025 | $context_label = $template_group_object->context_label(); |
2026 | 2026 | ob_start(); |
@@ -2028,20 +2028,20 @@ discard block |
||
2028 | 2028 | <div class="ee-msg-switcher-container"> |
2029 | 2029 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm"> |
2030 | 2030 | <?php |
2031 | - foreach ( $args as $name => $value ) { |
|
2032 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;} |
|
2031 | + foreach ($args as $name => $value) { |
|
2032 | + if ($name == 'context' || empty($value) || $name == 'extra') {continue; } |
|
2033 | 2033 | ?> |
2034 | 2034 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" /> |
2035 | 2035 | <?php |
2036 | 2036 | } |
2037 | 2037 | //setup nonce_url |
2038 | - wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false); |
|
2038 | + wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false); |
|
2039 | 2039 | ?> |
2040 | 2040 | <select name="context"> |
2041 | 2041 | <?php |
2042 | 2042 | $context_templates = $template_group_object->context_templates(); |
2043 | - if ( is_array($context_templates) ) : |
|
2044 | - foreach ( $context_templates as $context => $template_fields ) : |
|
2043 | + if (is_array($context_templates)) : |
|
2044 | + foreach ($context_templates as $context => $template_fields) : |
|
2045 | 2045 | $checked = ($context == $args['context']) ? 'selected="selected"' : ''; |
2046 | 2046 | ?> |
2047 | 2047 | <option value="<?php echo $context; ?>" <?php echo $checked; ?>> |
@@ -2049,7 +2049,7 @@ discard block |
||
2049 | 2049 | </option> |
2050 | 2050 | <?php endforeach; endif; ?> |
2051 | 2051 | </select> |
2052 | - <?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?> |
|
2052 | + <?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?> |
|
2053 | 2053 | <input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>"> |
2054 | 2054 | </form> |
2055 | 2055 | <?php echo $args['extra']; ?> |
@@ -2076,8 +2076,8 @@ discard block |
||
2076 | 2076 | * @return array |
2077 | 2077 | */ |
2078 | 2078 | protected function _set_message_template_column_values($index) { |
2079 | - if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) { |
|
2080 | - foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) { |
|
2079 | + if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) { |
|
2080 | + foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) { |
|
2081 | 2081 | $this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value; |
2082 | 2082 | } |
2083 | 2083 | } /*else { |
@@ -2086,22 +2086,22 @@ discard block |
||
2086 | 2086 | |
2087 | 2087 | |
2088 | 2088 | $set_column_values = array( |
2089 | - 'MTP_ID' => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ), |
|
2090 | - 'GRP_ID' => absint( $this->_req_data[ 'GRP_ID' ] ), |
|
2091 | - 'MTP_user_id' => absint( $this->_req_data[ 'MTP_user_id' ] ), |
|
2092 | - 'MTP_messenger' => strtolower( $this->_req_data[ 'MTP_messenger' ] ), |
|
2093 | - 'MTP_message_type' => strtolower( $this->_req_data[ 'MTP_message_type' ] ), |
|
2094 | - 'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ), |
|
2095 | - 'MTP_context' => strtolower( $this->_req_data[ 'MTP_context' ] ), |
|
2096 | - 'MTP_content' => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ], |
|
2097 | - 'MTP_is_global' => isset( $this->_req_data[ 'MTP_is_global' ] ) |
|
2098 | - ? absint( $this->_req_data[ 'MTP_is_global' ] ) |
|
2089 | + 'MTP_ID' => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']), |
|
2090 | + 'GRP_ID' => absint($this->_req_data['GRP_ID']), |
|
2091 | + 'MTP_user_id' => absint($this->_req_data['MTP_user_id']), |
|
2092 | + 'MTP_messenger' => strtolower($this->_req_data['MTP_messenger']), |
|
2093 | + 'MTP_message_type' => strtolower($this->_req_data['MTP_message_type']), |
|
2094 | + 'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']), |
|
2095 | + 'MTP_context' => strtolower($this->_req_data['MTP_context']), |
|
2096 | + 'MTP_content' => $this->_req_data['MTP_template_fields'][$index]['content'], |
|
2097 | + 'MTP_is_global' => isset($this->_req_data['MTP_is_global']) |
|
2098 | + ? absint($this->_req_data['MTP_is_global']) |
|
2099 | 2099 | : 0, |
2100 | - 'MTP_is_override' => isset( $this->_req_data[ 'MTP_is_override' ] ) |
|
2101 | - ? absint( $this->_req_data[ 'MTP_is_override' ] ) |
|
2100 | + 'MTP_is_override' => isset($this->_req_data['MTP_is_override']) |
|
2101 | + ? absint($this->_req_data['MTP_is_override']) |
|
2102 | 2102 | : 0, |
2103 | - 'MTP_deleted' => absint( $this->_req_data[ 'MTP_deleted' ] ), |
|
2104 | - 'MTP_is_active' => absint( $this->_req_data[ 'MTP_is_active' ] ) |
|
2103 | + 'MTP_deleted' => absint($this->_req_data['MTP_deleted']), |
|
2104 | + 'MTP_is_active' => absint($this->_req_data['MTP_is_active']) |
|
2105 | 2105 | ); |
2106 | 2106 | |
2107 | 2107 | |
@@ -2113,36 +2113,36 @@ discard block |
||
2113 | 2113 | |
2114 | 2114 | |
2115 | 2115 | |
2116 | - protected function _insert_or_update_message_template($new = false ) { |
|
2116 | + protected function _insert_or_update_message_template($new = false) { |
|
2117 | 2117 | |
2118 | - do_action ( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2118 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2119 | 2119 | $success = 0; |
2120 | 2120 | $override = false; |
2121 | 2121 | |
2122 | 2122 | //setup notices description |
2123 | - $messenger = ! empty( $this->_req_data['MTP_messenger'] ) |
|
2124 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_messenger'] ) ) |
|
2123 | + $messenger = ! empty($this->_req_data['MTP_messenger']) |
|
2124 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) |
|
2125 | 2125 | : false; |
2126 | 2126 | |
2127 | - $message_type = ! empty( $this->_req_data['MTP_message_type'] ) |
|
2128 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_message_type'] ) ) |
|
2127 | + $message_type = ! empty($this->_req_data['MTP_message_type']) |
|
2128 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) |
|
2129 | 2129 | : false; |
2130 | 2130 | |
2131 | - $context = ! empty( $this->_req_data['MTP_context'] ) |
|
2132 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_context'] ) ) |
|
2131 | + $context = ! empty($this->_req_data['MTP_context']) |
|
2132 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) |
|
2133 | 2133 | : false; |
2134 | 2134 | |
2135 | - $item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : ''; |
|
2135 | + $item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : ''; |
|
2136 | 2136 | $item_desc .= 'Message Template'; |
2137 | 2137 | $query_args = array(); |
2138 | 2138 | $edit_array = array(); |
2139 | 2139 | $action_desc = ''; |
2140 | 2140 | |
2141 | 2141 | //if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit. |
2142 | - if ( $new ) { |
|
2143 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
2144 | - if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) { |
|
2145 | - if ( empty($edit_array) ) { |
|
2142 | + if ($new) { |
|
2143 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
2144 | + if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) { |
|
2145 | + if (empty($edit_array)) { |
|
2146 | 2146 | $success = 0; |
2147 | 2147 | } else { |
2148 | 2148 | $success = 1; |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | |
2162 | 2162 | |
2163 | 2163 | //run update for each template field in displayed context |
2164 | - if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) { |
|
2164 | + if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) { |
|
2165 | 2165 | EE_Error::add_error( |
2166 | 2166 | __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), |
2167 | 2167 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2170,25 +2170,25 @@ discard block |
||
2170 | 2170 | |
2171 | 2171 | } else { |
2172 | 2172 | //first validate all fields! |
2173 | - $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2173 | + $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2174 | 2174 | |
2175 | 2175 | //if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array. WE need to make sure there is no actual error messages in validates. |
2176 | - if ( is_array($validates) && !empty($validates) ) { |
|
2176 | + if (is_array($validates) && ! empty($validates)) { |
|
2177 | 2177 | //add the transient so when the form loads we know which fields to highlight |
2178 | - $this->_add_transient( 'edit_message_template', $validates ); |
|
2178 | + $this->_add_transient('edit_message_template', $validates); |
|
2179 | 2179 | |
2180 | 2180 | $success = 0; |
2181 | 2181 | |
2182 | 2182 | //setup notices |
2183 | - foreach ( $validates as $field => $error ) { |
|
2184 | - if ( isset($error['msg'] ) ) { |
|
2185 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ ); |
|
2183 | + foreach ($validates as $field => $error) { |
|
2184 | + if (isset($error['msg'])) { |
|
2185 | + EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__); |
|
2186 | 2186 | } |
2187 | 2187 | } |
2188 | 2188 | |
2189 | 2189 | } else { |
2190 | 2190 | $set_column_values = array(); |
2191 | - foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) { |
|
2191 | + foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) { |
|
2192 | 2192 | $set_column_values = $this->_set_message_template_column_values($template_field); |
2193 | 2193 | |
2194 | 2194 | $where_cols_n_values = array( |
@@ -2201,11 +2201,11 @@ discard block |
||
2201 | 2201 | 'MTP_context' => $set_column_values['MTP_context'], |
2202 | 2202 | 'MTP_content' => $set_column_values['MTP_content'] |
2203 | 2203 | ); |
2204 | - if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) { |
|
2205 | - if ( $updated === false ) { |
|
2204 | + if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) { |
|
2205 | + if ($updated === false) { |
|
2206 | 2206 | EE_Error::add_error( |
2207 | 2207 | sprintf( |
2208 | - __( '%s field was NOT updated for some reason', 'event_espresso' ), |
|
2208 | + __('%s field was NOT updated for some reason', 'event_espresso'), |
|
2209 | 2209 | $template_field |
2210 | 2210 | ), |
2211 | 2211 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2219,46 +2219,46 @@ discard block |
||
2219 | 2219 | |
2220 | 2220 | //we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs) |
2221 | 2221 | $mtpg_fields = array( |
2222 | - 'MTP_user_id' => $set_column_values[ 'MTP_user_id' ], |
|
2223 | - 'MTP_messenger' => $set_column_values[ 'MTP_messenger' ], |
|
2224 | - 'MTP_message_type' => $set_column_values[ 'MTP_message_type' ], |
|
2225 | - 'MTP_is_global' => $set_column_values[ 'MTP_is_global' ], |
|
2226 | - 'MTP_is_override' => $set_column_values[ 'MTP_is_override' ], |
|
2227 | - 'MTP_deleted' => $set_column_values[ 'MTP_deleted' ], |
|
2228 | - 'MTP_is_active' => $set_column_values[ 'MTP_is_active' ], |
|
2229 | - 'MTP_name' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] ) |
|
2230 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] |
|
2222 | + 'MTP_user_id' => $set_column_values['MTP_user_id'], |
|
2223 | + 'MTP_messenger' => $set_column_values['MTP_messenger'], |
|
2224 | + 'MTP_message_type' => $set_column_values['MTP_message_type'], |
|
2225 | + 'MTP_is_global' => $set_column_values['MTP_is_global'], |
|
2226 | + 'MTP_is_override' => $set_column_values['MTP_is_override'], |
|
2227 | + 'MTP_deleted' => $set_column_values['MTP_deleted'], |
|
2228 | + 'MTP_is_active' => $set_column_values['MTP_is_active'], |
|
2229 | + 'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) |
|
2230 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] |
|
2231 | 2231 | : '', |
2232 | - 'MTP_description' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] ) |
|
2233 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] |
|
2232 | + 'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) |
|
2233 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] |
|
2234 | 2234 | : '' |
2235 | 2235 | ); |
2236 | 2236 | |
2237 | - $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] ); |
|
2238 | - $updated = $MTPG->update( $mtpg_fields, array($mtpg_where) ); |
|
2237 | + $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']); |
|
2238 | + $updated = $MTPG->update($mtpg_fields, array($mtpg_where)); |
|
2239 | 2239 | |
2240 | - if ( $updated === false ) { |
|
2240 | + if ($updated === false) { |
|
2241 | 2241 | EE_Error::add_error( |
2242 | 2242 | sprintf( |
2243 | - __( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ), |
|
2244 | - $set_column_values[ 'GRP_ID' ] |
|
2243 | + __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), |
|
2244 | + $set_column_values['GRP_ID'] |
|
2245 | 2245 | ), |
2246 | 2246 | __FILE__, __FUNCTION__, __LINE__ |
2247 | 2247 | ); |
2248 | 2248 | } else { |
2249 | 2249 | //k now we need to ensure the template_pack and template_variation fields are set. |
2250 | - $template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) |
|
2250 | + $template_pack = ! empty($this->_req_data['MTP_template_pack']) |
|
2251 | 2251 | ? $this->_req_data['MTP_template_pack'] |
2252 | 2252 | : 'default'; |
2253 | 2253 | |
2254 | - $template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) |
|
2254 | + $template_variation = ! empty($this->_req_data['MTP_template_variation']) |
|
2255 | 2255 | ? $this->_req_data['MTP_template_variation'] |
2256 | 2256 | : 'default'; |
2257 | 2257 | |
2258 | - $mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] ); |
|
2259 | - if ( $mtpg_obj instanceof EE_Message_Template_Group ) { |
|
2260 | - $mtpg_obj->set_template_pack_name( $template_pack ); |
|
2261 | - $mtpg_obj->set_template_pack_variation( $template_variation ); |
|
2258 | + $mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']); |
|
2259 | + if ($mtpg_obj instanceof EE_Message_Template_Group) { |
|
2260 | + $mtpg_obj->set_template_pack_name($template_pack); |
|
2261 | + $mtpg_obj->set_template_pack_variation($template_variation); |
|
2262 | 2262 | } |
2263 | 2263 | $success = 1; |
2264 | 2264 | } |
@@ -2268,7 +2268,7 @@ discard block |
||
2268 | 2268 | } |
2269 | 2269 | |
2270 | 2270 | //we return things differently if doing ajax |
2271 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2271 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2272 | 2272 | $this->_template_args['success'] = $success; |
2273 | 2273 | $this->_template_args['error'] = ! $success ? true : false; |
2274 | 2274 | $this->_template_args['content'] = ''; |
@@ -2276,9 +2276,9 @@ discard block |
||
2276 | 2276 | 'grpID' => $edit_array['GRP_ID'], |
2277 | 2277 | 'templateName' => $edit_array['template_name'] |
2278 | 2278 | ); |
2279 | - if ( $success ) { |
|
2279 | + if ($success) { |
|
2280 | 2280 | EE_Error::overwrite_success(); |
2281 | - EE_Error::add_success( __('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso') ); |
|
2281 | + EE_Error::add_success(__('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso')); |
|
2282 | 2282 | } |
2283 | 2283 | |
2284 | 2284 | $this->_return_json(); |
@@ -2286,13 +2286,13 @@ discard block |
||
2286 | 2286 | |
2287 | 2287 | |
2288 | 2288 | //was a test send triggered? |
2289 | - if ( isset( $this->_req_data['test_button'] ) ) { |
|
2289 | + if (isset($this->_req_data['test_button'])) { |
|
2290 | 2290 | EE_Error::overwrite_success(); |
2291 | - $this->_do_test_send( $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] ); |
|
2291 | + $this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2292 | 2292 | $override = true; |
2293 | 2293 | } |
2294 | 2294 | |
2295 | - if ( empty( $query_args ) ) { |
|
2295 | + if (empty($query_args)) { |
|
2296 | 2296 | $query_args = array( |
2297 | 2297 | 'id' => $this->_req_data['GRP_ID'], |
2298 | 2298 | 'context' => $this->_req_data['MTP_context'], |
@@ -2300,7 +2300,7 @@ discard block |
||
2300 | 2300 | ); |
2301 | 2301 | } |
2302 | 2302 | |
2303 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override ); |
|
2303 | + $this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override); |
|
2304 | 2304 | } |
2305 | 2305 | |
2306 | 2306 | |
@@ -2314,28 +2314,28 @@ discard block |
||
2314 | 2314 | * @param string $message_type message type being tested |
2315 | 2315 | * |
2316 | 2316 | */ |
2317 | - protected function _do_test_send( $context, $messenger, $message_type ) { |
|
2317 | + protected function _do_test_send($context, $messenger, $message_type) { |
|
2318 | 2318 | //set things up for preview |
2319 | 2319 | $this->_req_data['messenger'] = $messenger; |
2320 | 2320 | $this->_req_data['message_type'] = $message_type; |
2321 | 2321 | $this->_req_data['context'] = $context; |
2322 | - $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : ''; |
|
2323 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
2322 | + $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : ''; |
|
2323 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($messenger); |
|
2324 | 2324 | |
2325 | 2325 | //let's save any existing fields that might be required by the messenger |
2326 | 2326 | if ( |
2327 | - isset( $this->_req_data['test_settings_fld'] ) |
|
2327 | + isset($this->_req_data['test_settings_fld']) |
|
2328 | 2328 | && $active_messenger instanceof EE_messenger |
2329 | 2329 | ) { |
2330 | - $active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] ); |
|
2330 | + $active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']); |
|
2331 | 2331 | } |
2332 | 2332 | |
2333 | 2333 | $success = $this->_preview_message(true); |
2334 | 2334 | |
2335 | - if ( $success ) { |
|
2336 | - EE_Error::add_success( __('Test message sent', 'event_espresso') ); |
|
2335 | + if ($success) { |
|
2336 | + EE_Error::add_success(__('Test message sent', 'event_espresso')); |
|
2337 | 2337 | } else { |
2338 | - EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
2338 | + EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2339 | 2339 | } |
2340 | 2340 | } |
2341 | 2341 | |
@@ -2361,11 +2361,11 @@ discard block |
||
2361 | 2361 | protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) { |
2362 | 2362 | |
2363 | 2363 | //if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates. |
2364 | - if ( empty( $message_types ) ) { |
|
2364 | + if (empty($message_types)) { |
|
2365 | 2365 | return true; |
2366 | 2366 | } |
2367 | 2367 | |
2368 | - return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global ); |
|
2368 | + return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global); |
|
2369 | 2369 | } |
2370 | 2370 | |
2371 | 2371 | |
@@ -2381,33 +2381,33 @@ discard block |
||
2381 | 2381 | * |
2382 | 2382 | * @return void |
2383 | 2383 | */ |
2384 | - protected function _trash_or_restore_message_template($trash = true, $all = false ) { |
|
2385 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2384 | + protected function _trash_or_restore_message_template($trash = true, $all = false) { |
|
2385 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2386 | 2386 | $MTP = EEM_Message_Template_Group::instance(); |
2387 | 2387 | |
2388 | 2388 | $success = 1; |
2389 | 2389 | |
2390 | 2390 | //incoming GRP_IDs |
2391 | - if ( $all ) { |
|
2391 | + if ($all) { |
|
2392 | 2392 | //Checkboxes |
2393 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) { |
|
2393 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2394 | 2394 | //if array has more than one element then success message should be plural. |
2395 | 2395 | //todo: what about nonce? |
2396 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2396 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2397 | 2397 | |
2398 | 2398 | //cycle through checkboxes |
2399 | - while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) { |
|
2400 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2401 | - if ( ! $trashed_or_restored ) { |
|
2399 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2400 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2401 | + if ( ! $trashed_or_restored) { |
|
2402 | 2402 | $success = 0; |
2403 | 2403 | } |
2404 | 2404 | } |
2405 | 2405 | } else { |
2406 | 2406 | //grab single GRP_ID and handle |
2407 | - $GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
2408 | - if ( ! empty( $GRP_ID ) ) { |
|
2409 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2410 | - if ( ! $trashed_or_restored ) { |
|
2407 | + $GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
2408 | + if ( ! empty($GRP_ID)) { |
|
2409 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2410 | + if ( ! $trashed_or_restored) { |
|
2411 | 2411 | $success = 0; |
2412 | 2412 | } |
2413 | 2413 | } else { |
@@ -2419,13 +2419,13 @@ discard block |
||
2419 | 2419 | |
2420 | 2420 | $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
2421 | 2421 | |
2422 | - $action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc; |
|
2422 | + $action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc; |
|
2423 | 2423 | |
2424 | 2424 | $item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso'); |
2425 | 2425 | |
2426 | - $item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2426 | + $item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2427 | 2427 | |
2428 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, array() ); |
|
2428 | + $this->_redirect_after_action($success, $item_desc, $action_desc, array()); |
|
2429 | 2429 | |
2430 | 2430 | } |
2431 | 2431 | |
@@ -2441,24 +2441,24 @@ discard block |
||
2441 | 2441 | * @return void |
2442 | 2442 | */ |
2443 | 2443 | protected function _delete_message_template() { |
2444 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2444 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2445 | 2445 | |
2446 | 2446 | //checkboxes |
2447 | - if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) { |
|
2447 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2448 | 2448 | //if array has more than one element then success message should be plural |
2449 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2449 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2450 | 2450 | |
2451 | 2451 | //cycle through bulk action checkboxes |
2452 | - while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) { |
|
2453 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2452 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2453 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2454 | 2454 | } |
2455 | 2455 | } else { |
2456 | 2456 | //grab single grp_id and delete |
2457 | - $GRP_ID = absint($this->_req_data['id'] ); |
|
2458 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2457 | + $GRP_ID = absint($this->_req_data['id']); |
|
2458 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2459 | 2459 | } |
2460 | 2460 | |
2461 | - $this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() ); |
|
2461 | + $this->_redirect_after_action($success, 'Message Templates', 'deleted', array()); |
|
2462 | 2462 | |
2463 | 2463 | } |
2464 | 2464 | |
@@ -2473,20 +2473,20 @@ discard block |
||
2473 | 2473 | * |
2474 | 2474 | * @return bool boolean to indicate the success of the deletes or not. |
2475 | 2475 | */ |
2476 | - private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) { |
|
2476 | + private function _delete_mtp_permanently($GRP_ID, $include_group = true) { |
|
2477 | 2477 | $success = 1; |
2478 | 2478 | $MTPG = EEM_Message_Template_Group::instance(); |
2479 | 2479 | //first let's GET this group |
2480 | - $MTG = $MTPG->get_one_by_ID( $GRP_ID ); |
|
2480 | + $MTG = $MTPG->get_one_by_ID($GRP_ID); |
|
2481 | 2481 | //then delete permanently all the related Message Templates |
2482 | - $deleted = $MTG->delete_related_permanently( 'Message_Template' ); |
|
2482 | + $deleted = $MTG->delete_related_permanently('Message_Template'); |
|
2483 | 2483 | |
2484 | - if ( $deleted === 0 ) |
|
2485 | - {$success = 0;} |
|
2484 | + if ($deleted === 0) |
|
2485 | + {$success = 0; } |
|
2486 | 2486 | |
2487 | 2487 | //now delete permanently this particular group |
2488 | 2488 | |
2489 | - if ( $include_group && ! $MTG->delete_permanently() ) { |
|
2489 | + if ($include_group && ! $MTG->delete_permanently()) { |
|
2490 | 2490 | $success = 0; |
2491 | 2491 | } |
2492 | 2492 | return $success; |
@@ -2504,7 +2504,7 @@ discard block |
||
2504 | 2504 | * @return string |
2505 | 2505 | */ |
2506 | 2506 | protected function _learn_more_about_message_templates_link() { |
2507 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
|
2507 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>'; |
|
2508 | 2508 | } |
2509 | 2509 | |
2510 | 2510 | |
@@ -2522,10 +2522,10 @@ discard block |
||
2522 | 2522 | |
2523 | 2523 | $this->_set_m_mt_settings(); |
2524 | 2524 | |
2525 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2525 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2526 | 2526 | |
2527 | 2527 | //let's setup the messenger tabs |
2528 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger ); |
|
2528 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger); |
|
2529 | 2529 | $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">'; |
2530 | 2530 | $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->'; |
2531 | 2531 | |
@@ -2544,7 +2544,7 @@ discard block |
||
2544 | 2544 | */ |
2545 | 2545 | protected function _set_m_mt_settings() { |
2546 | 2546 | //first if this is already set then lets get out no need to regenerate data. |
2547 | - if ( !empty($this->_m_mt_settings) ) { |
|
2547 | + if ( ! empty($this->_m_mt_settings)) { |
|
2548 | 2548 | return; |
2549 | 2549 | } |
2550 | 2550 | |
@@ -2559,10 +2559,10 @@ discard block |
||
2559 | 2559 | |
2560 | 2560 | //assemble the array for the _tab_text_links helper |
2561 | 2561 | |
2562 | - foreach ( $messengers as $messenger ) { |
|
2562 | + foreach ($messengers as $messenger) { |
|
2563 | 2563 | $this->_m_mt_settings['messenger_tabs'][$messenger->name] = array( |
2564 | 2564 | 'label' => ucwords($messenger->label['singular']), |
2565 | - 'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '', |
|
2565 | + 'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '', |
|
2566 | 2566 | 'href' => $messenger->name, |
2567 | 2567 | 'title' => __('Modify this Messenger', 'event_espresso'), |
2568 | 2568 | 'slug' => $messenger->name, |
@@ -2572,26 +2572,26 @@ discard block |
||
2572 | 2572 | |
2573 | 2573 | $message_types_for_messenger = $messenger->get_valid_message_types(); |
2574 | 2574 | |
2575 | - foreach ( $message_types as $message_type ) { |
|
2575 | + foreach ($message_types as $message_type) { |
|
2576 | 2576 | //first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox. |
2577 | - if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) { |
|
2577 | + if ( ! in_array($message_type->name, $message_types_for_messenger)) { |
|
2578 | 2578 | continue; |
2579 | 2579 | } |
2580 | 2580 | |
2581 | - $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive'; |
|
2581 | + $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive'; |
|
2582 | 2582 | |
2583 | 2583 | $this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array( |
2584 | - 'label' => ucwords( $message_type->label[ 'singular' ] ), |
|
2585 | - 'class' => 'message-type-' . $a_or_i, |
|
2586 | - 'slug_id' => $message_type->name . '-messagetype-' . $messenger->name, |
|
2587 | - 'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ), |
|
2588 | - 'href' => 'espresso_' . $message_type->name . '_message_type_settings', |
|
2584 | + 'label' => ucwords($message_type->label['singular']), |
|
2585 | + 'class' => 'message-type-'.$a_or_i, |
|
2586 | + 'slug_id' => $message_type->name.'-messagetype-'.$messenger->name, |
|
2587 | + 'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'), |
|
2588 | + 'href' => 'espresso_'.$message_type->name.'_message_type_settings', |
|
2589 | 2589 | 'title' => $a_or_i == 'active' |
2590 | - ? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' ) |
|
2591 | - : __( 'Drag this message type to the messenger to activate', 'event_espresso' ), |
|
2590 | + ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') |
|
2591 | + : __('Drag this message type to the messenger to activate', 'event_espresso'), |
|
2592 | 2592 | 'content' => $a_or_i == 'active' |
2593 | - ? $this->_message_type_settings_content( $message_type, $messenger, true ) |
|
2594 | - : $this->_message_type_settings_content( $message_type, $messenger ), |
|
2593 | + ? $this->_message_type_settings_content($message_type, $messenger, true) |
|
2594 | + : $this->_message_type_settings_content($message_type, $messenger), |
|
2595 | 2595 | 'slug' => $message_type->name, |
2596 | 2596 | 'active' => $a_or_i == 'active' ? true : false, |
2597 | 2597 | 'obj' => $message_type |
@@ -2610,34 +2610,34 @@ discard block |
||
2610 | 2610 | * |
2611 | 2611 | * @return string html output for the content |
2612 | 2612 | */ |
2613 | - protected function _message_type_settings_content( $message_type, $messenger, $active = false ) { |
|
2613 | + protected function _message_type_settings_content($message_type, $messenger, $active = false) { |
|
2614 | 2614 | //get message type fields |
2615 | 2615 | $fields = $message_type->get_admin_settings_fields(); |
2616 | - $settings_template_args['template_form_fields']= ''; |
|
2616 | + $settings_template_args['template_form_fields'] = ''; |
|
2617 | 2617 | |
2618 | - if ( !empty( $fields ) && $active ) { |
|
2618 | + if ( ! empty($fields) && $active) { |
|
2619 | 2619 | |
2620 | - $existing_settings = $message_type->get_existing_admin_settings( $messenger->name ); |
|
2620 | + $existing_settings = $message_type->get_existing_admin_settings($messenger->name); |
|
2621 | 2621 | |
2622 | - foreach( $fields as $fldname => $fldprops ) { |
|
2623 | - $field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname; |
|
2622 | + foreach ($fields as $fldname => $fldprops) { |
|
2623 | + $field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname; |
|
2624 | 2624 | $template_form_field[$field_id] = array( |
2625 | - 'name' => 'message_type_settings[' . $fldname . ']', |
|
2625 | + 'name' => 'message_type_settings['.$fldname.']', |
|
2626 | 2626 | 'label' => $fldprops['label'], |
2627 | 2627 | 'input' => $fldprops['field_type'], |
2628 | 2628 | 'type' => $fldprops['value_type'], |
2629 | 2629 | 'required' => $fldprops['required'], |
2630 | 2630 | 'validation' => $fldprops['validation'], |
2631 | - 'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2632 | - 'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(), |
|
2633 | - 'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2631 | + 'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2632 | + 'options' => isset($fldprops['options']) ? $fldprops['options'] : array(), |
|
2633 | + 'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2634 | 2634 | 'css_class' => 'no-drag', |
2635 | 2635 | 'format' => $fldprops['format'] |
2636 | 2636 | ); |
2637 | 2637 | } |
2638 | 2638 | |
2639 | 2639 | |
2640 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : ''; |
|
2640 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : ''; |
|
2641 | 2641 | } |
2642 | 2642 | |
2643 | 2643 | $settings_template_args['description'] = $message_type->description; |
@@ -2657,13 +2657,13 @@ discard block |
||
2657 | 2657 | ) |
2658 | 2658 | ); |
2659 | 2659 | |
2660 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' ); |
|
2661 | - $settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : ''; |
|
2660 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array'); |
|
2661 | + $settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : ''; |
|
2662 | 2662 | |
2663 | 2663 | |
2664 | 2664 | |
2665 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php'; |
|
2666 | - $content = EEH_Template::display_template( $template, $settings_template_args, true ); |
|
2665 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php'; |
|
2666 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2667 | 2667 | return $content; |
2668 | 2668 | } |
2669 | 2669 | |
@@ -2680,27 +2680,27 @@ discard block |
||
2680 | 2680 | $m_boxes = $mt_boxes = array(); |
2681 | 2681 | $m_template_args = $mt_template_args = array(); |
2682 | 2682 | |
2683 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2683 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2684 | 2684 | |
2685 | - if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) { |
|
2686 | - foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) { |
|
2687 | - $hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden'; |
|
2688 | - $hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : ''; |
|
2685 | + if (isset($this->_m_mt_settings['messenger_tabs'])) { |
|
2686 | + foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) { |
|
2687 | + $hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden'; |
|
2688 | + $hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : ''; |
|
2689 | 2689 | //messenger meta boxes |
2690 | 2690 | $active = $selected_messenger == $messenger ? true : false; |
2691 | - $active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] ) |
|
2692 | - ? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] |
|
2691 | + $active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) |
|
2692 | + ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] |
|
2693 | 2693 | : ''; |
2694 | - $m_boxes[ $messenger . '_a_box' ] = sprintf( |
|
2695 | - __( '%s Settings', 'event_espresso' ), |
|
2696 | - $tab_array[ 'label' ] |
|
2694 | + $m_boxes[$messenger.'_a_box'] = sprintf( |
|
2695 | + __('%s Settings', 'event_espresso'), |
|
2696 | + $tab_array['label'] |
|
2697 | 2697 | ); |
2698 | - $m_template_args[ $messenger . '_a_box' ] = array( |
|
2699 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2700 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2701 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2698 | + $m_template_args[$messenger.'_a_box'] = array( |
|
2699 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2700 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2701 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2702 | 2702 | : '', |
2703 | - 'content' => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ), |
|
2703 | + 'content' => $this->_get_messenger_box_content($tab_array['obj']), |
|
2704 | 2704 | 'hidden' => $active ? '' : ' hidden', |
2705 | 2705 | 'hide_on_message' => $hide_on_message, |
2706 | 2706 | 'messenger' => $messenger, |
@@ -2709,11 +2709,11 @@ discard block |
||
2709 | 2709 | // message type meta boxes |
2710 | 2710 | // (which is really just the inactive container for each messenger |
2711 | 2711 | // showing inactive message types for that messenger) |
2712 | - $mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' ); |
|
2713 | - $mt_template_args[ $messenger . '_i_box' ] = array( |
|
2714 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2715 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2716 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2712 | + $mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso'); |
|
2713 | + $mt_template_args[$messenger.'_i_box'] = array( |
|
2714 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2715 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2716 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2717 | 2717 | : '', |
2718 | 2718 | 'hidden' => $active ? '' : ' hidden', |
2719 | 2719 | 'hide_on_message' => $hide_on_message, |
@@ -2726,15 +2726,15 @@ discard block |
||
2726 | 2726 | |
2727 | 2727 | |
2728 | 2728 | //register messenger metaboxes |
2729 | - $m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2730 | - foreach ( $m_boxes as $box => $label ) { |
|
2731 | - $callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] ); |
|
2732 | - $msgr = str_replace( '_a_box', '', $box ); |
|
2729 | + $m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2730 | + foreach ($m_boxes as $box => $label) { |
|
2731 | + $callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]); |
|
2732 | + $msgr = str_replace('_a_box', '', $box); |
|
2733 | 2733 | add_meta_box( |
2734 | - 'espresso_' . $msgr . '_settings', |
|
2734 | + 'espresso_'.$msgr.'_settings', |
|
2735 | 2735 | $label, |
2736 | - function( $post, $metabox ) { |
|
2737 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2736 | + function($post, $metabox) { |
|
2737 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2738 | 2738 | }, |
2739 | 2739 | $this->_current_screen->id, |
2740 | 2740 | 'normal', |
@@ -2744,17 +2744,17 @@ discard block |
||
2744 | 2744 | } |
2745 | 2745 | |
2746 | 2746 | //register message type metaboxes |
2747 | - $mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php'; |
|
2748 | - foreach ( $mt_boxes as $box => $label ) { |
|
2747 | + $mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php'; |
|
2748 | + foreach ($mt_boxes as $box => $label) { |
|
2749 | 2749 | $callback_args = array( |
2750 | - 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ] |
|
2750 | + 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] |
|
2751 | 2751 | ); |
2752 | - $mt = str_replace( '_i_box', '', $box ); |
|
2752 | + $mt = str_replace('_i_box', '', $box); |
|
2753 | 2753 | add_meta_box( |
2754 | - 'espresso_' . $mt . '_inactive_mts', |
|
2754 | + 'espresso_'.$mt.'_inactive_mts', |
|
2755 | 2755 | $label, |
2756 | - function( $post, $metabox ) { |
|
2757 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2756 | + function($post, $metabox) { |
|
2757 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2758 | 2758 | }, |
2759 | 2759 | $this->_current_screen->id, |
2760 | 2760 | 'side', |
@@ -2765,11 +2765,11 @@ discard block |
||
2765 | 2765 | |
2766 | 2766 | //register metabox for global messages settings but only when on the main site. On single site installs this will |
2767 | 2767 | //always result in the metabox showing, on multisite installs the metabox will only show on the main site. |
2768 | - if ( is_main_site() ) { |
|
2768 | + if (is_main_site()) { |
|
2769 | 2769 | add_meta_box( |
2770 | 2770 | 'espresso_global_message_settings', |
2771 | - __( 'Global Message Settings', 'event_espresso' ), |
|
2772 | - array( $this, 'global_messages_settings_metabox_content' ), |
|
2771 | + __('Global Message Settings', 'event_espresso'), |
|
2772 | + array($this, 'global_messages_settings_metabox_content'), |
|
2773 | 2773 | $this->_current_screen->id, |
2774 | 2774 | 'normal', |
2775 | 2775 | 'low', |
@@ -2789,7 +2789,7 @@ discard block |
||
2789 | 2789 | public function global_messages_settings_metabox_content() { |
2790 | 2790 | $form = $this->_generate_global_settings_form(); |
2791 | 2791 | echo $form->form_open( |
2792 | - $this->add_query_args_and_nonce( array( 'action' => 'update_global_settings' ), EE_MSG_ADMIN_URL ), |
|
2792 | + $this->add_query_args_and_nonce(array('action' => 'update_global_settings'), EE_MSG_ADMIN_URL), |
|
2793 | 2793 | 'POST' |
2794 | 2794 | ) |
2795 | 2795 | . $form->get_html() |
@@ -2802,7 +2802,7 @@ discard block |
||
2802 | 2802 | * @return EE_Form_Section_Proper |
2803 | 2803 | */ |
2804 | 2804 | protected function _generate_global_settings_form() { |
2805 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
2805 | + EE_Registry::instance()->load_helper('HTML'); |
|
2806 | 2806 | /** @var EE_Network_Core_Config $network_config */ |
2807 | 2807 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2808 | 2808 | return new EE_Form_Section_Proper( |
@@ -2821,13 +2821,13 @@ discard block |
||
2821 | 2821 | ), |
2822 | 2822 | array( |
2823 | 2823 | 'default' => $network_config->do_messages_on_same_request, |
2824 | - 'html_label_text' => __( 'Generate and send all messages:', 'event_espresso' ), |
|
2825 | - 'html_help_text' => __( 'By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso' ), |
|
2824 | + 'html_label_text' => __('Generate and send all messages:', 'event_espresso'), |
|
2825 | + 'html_help_text' => __('By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso'), |
|
2826 | 2826 | ) |
2827 | 2827 | ), |
2828 | 2828 | 'update_settings' => new EE_Submit_Input( |
2829 | 2829 | array( |
2830 | - 'default' => __( 'Update', 'event_espresso' ), |
|
2830 | + 'default' => __('Update', 'event_espresso'), |
|
2831 | 2831 | 'html_label_text' => ' ' |
2832 | 2832 | ) |
2833 | 2833 | ) |
@@ -2846,28 +2846,28 @@ discard block |
||
2846 | 2846 | /** @var EE_Network_Core_Config $network_config */ |
2847 | 2847 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2848 | 2848 | $form = $this->_generate_global_settings_form(); |
2849 | - if ( $form->was_submitted() ) { |
|
2849 | + if ($form->was_submitted()) { |
|
2850 | 2850 | $form->receive_form_submission(); |
2851 | - if ( $form->is_valid() ) { |
|
2851 | + if ($form->is_valid()) { |
|
2852 | 2852 | $valid_data = $form->valid_data(); |
2853 | - foreach( $valid_data as $property => $value ) { |
|
2854 | - $setter = 'set_' . $property; |
|
2855 | - if ( method_exists( $network_config, $setter ) ) { |
|
2856 | - $network_config->{$setter}( $value ); |
|
2853 | + foreach ($valid_data as $property => $value) { |
|
2854 | + $setter = 'set_'.$property; |
|
2855 | + if (method_exists($network_config, $setter)) { |
|
2856 | + $network_config->{$setter}($value); |
|
2857 | 2857 | } else if ( |
2858 | - property_exists( $network_config, $property ) |
|
2858 | + property_exists($network_config, $property) |
|
2859 | 2859 | && $network_config->{$property} !== $value |
2860 | 2860 | ) { |
2861 | 2861 | $network_config->{$property} = $value; |
2862 | 2862 | } |
2863 | 2863 | } |
2864 | 2864 | //only update if the form submission was valid! |
2865 | - EE_Registry::instance()->NET_CFG->update_config( true, false ); |
|
2865 | + EE_Registry::instance()->NET_CFG->update_config(true, false); |
|
2866 | 2866 | EE_Error::overwrite_success(); |
2867 | - EE_Error::add_success( __( 'Global message settings were updated', 'event_espresso' ) ); |
|
2867 | + EE_Error::add_success(__('Global message settings were updated', 'event_espresso')); |
|
2868 | 2868 | } |
2869 | 2869 | } |
2870 | - $this->_redirect_after_action( 0, '', '', array( 'action' => 'settings' ), true ); |
|
2870 | + $this->_redirect_after_action(0, '', '', array('action' => 'settings'), true); |
|
2871 | 2871 | } |
2872 | 2872 | |
2873 | 2873 | |
@@ -2878,13 +2878,13 @@ discard block |
||
2878 | 2878 | * |
2879 | 2879 | * @return string html formatted tabs |
2880 | 2880 | */ |
2881 | - protected function _get_mt_tabs( $tab_array ) { |
|
2881 | + protected function _get_mt_tabs($tab_array) { |
|
2882 | 2882 | $tab_array = (array) $tab_array; |
2883 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2883 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2884 | 2884 | $tabs = ''; |
2885 | 2885 | |
2886 | - foreach ( $tab_array as $tab ) { |
|
2887 | - $tabs .= EEH_Template::display_template( $template, $tab, true ); |
|
2886 | + foreach ($tab_array as $tab) { |
|
2887 | + $tabs .= EEH_Template::display_template($template, $tab, true); |
|
2888 | 2888 | } |
2889 | 2889 | |
2890 | 2890 | return $tabs; |
@@ -2900,29 +2900,29 @@ discard block |
||
2900 | 2900 | * |
2901 | 2901 | * @return string html formatted content |
2902 | 2902 | */ |
2903 | - protected function _get_messenger_box_content( EE_messenger $messenger ) { |
|
2903 | + protected function _get_messenger_box_content(EE_messenger $messenger) { |
|
2904 | 2904 | |
2905 | 2905 | $fields = $messenger->get_admin_settings_fields(); |
2906 | 2906 | $settings_template_args['template_form_fields'] = ''; |
2907 | 2907 | |
2908 | 2908 | //is $messenger active? |
2909 | - $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
2909 | + $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
2910 | 2910 | |
2911 | 2911 | |
2912 | - if ( ! empty( $fields ) ) { |
|
2912 | + if ( ! empty($fields)) { |
|
2913 | 2913 | |
2914 | 2914 | $existing_settings = $messenger->get_existing_admin_settings(); |
2915 | 2915 | |
2916 | - foreach( $fields as $fldname => $fldprops ) { |
|
2917 | - $field_id = $messenger->name . '-' . $fldname; |
|
2916 | + foreach ($fields as $fldname => $fldprops) { |
|
2917 | + $field_id = $messenger->name.'-'.$fldname; |
|
2918 | 2918 | $template_form_field[$field_id] = array( |
2919 | - 'name' => 'messenger_settings[' . $field_id . ']', |
|
2919 | + 'name' => 'messenger_settings['.$field_id.']', |
|
2920 | 2920 | 'label' => $fldprops['label'], |
2921 | 2921 | 'input' => $fldprops['field_type'], |
2922 | 2922 | 'type' => $fldprops['value_type'], |
2923 | 2923 | 'required' => $fldprops['required'], |
2924 | 2924 | 'validation' => $fldprops['validation'], |
2925 | - 'value' => isset( $existing_settings[$field_id]) |
|
2925 | + 'value' => isset($existing_settings[$field_id]) |
|
2926 | 2926 | ? $existing_settings[$field_id] |
2927 | 2927 | : $fldprops['default'], |
2928 | 2928 | 'css_class' => '', |
@@ -2931,8 +2931,8 @@ discard block |
||
2931 | 2931 | } |
2932 | 2932 | |
2933 | 2933 | |
2934 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) |
|
2935 | - ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) |
|
2934 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) |
|
2935 | + ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') |
|
2936 | 2936 | : ''; |
2937 | 2937 | } |
2938 | 2938 | |
@@ -2949,39 +2949,39 @@ discard block |
||
2949 | 2949 | ); |
2950 | 2950 | |
2951 | 2951 | //make sure any active message types that are existing are included in the hidden fields |
2952 | - if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) { |
|
2953 | - foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) { |
|
2952 | + if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) { |
|
2953 | + foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) { |
|
2954 | 2954 | $settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array( |
2955 | 2955 | 'type' => 'hidden', |
2956 | 2956 | 'value' => $mt |
2957 | 2957 | ); |
2958 | 2958 | } |
2959 | 2959 | } |
2960 | - $settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields( |
|
2961 | - $settings_template_args[ 'hidden_fields' ], |
|
2960 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( |
|
2961 | + $settings_template_args['hidden_fields'], |
|
2962 | 2962 | 'array' |
2963 | 2963 | ); |
2964 | - $active = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
2964 | + $active = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
2965 | 2965 | |
2966 | 2966 | $settings_template_args['messenger'] = $messenger->name; |
2967 | 2967 | $settings_template_args['description'] = $messenger->description; |
2968 | 2968 | $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden'; |
2969 | 2969 | |
2970 | 2970 | |
2971 | - $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ) |
|
2971 | + $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name) |
|
2972 | 2972 | ? $settings_template_args['show_hide_edit_form'] |
2973 | 2973 | : ' hidden'; |
2974 | 2974 | |
2975 | - $settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) |
|
2975 | + $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) |
|
2976 | 2976 | ? ' hidden' |
2977 | 2977 | : $settings_template_args['show_hide_edit_form']; |
2978 | 2978 | |
2979 | 2979 | |
2980 | 2980 | $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on'; |
2981 | - $settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce'); |
|
2981 | + $settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce'); |
|
2982 | 2982 | $settings_template_args['on_off_status'] = $active ? true : false; |
2983 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php'; |
|
2984 | - $content = EEH_Template::display_template( $template, $settings_template_args, true); |
|
2983 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php'; |
|
2984 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2985 | 2985 | return $content; |
2986 | 2986 | } |
2987 | 2987 | |
@@ -2995,9 +2995,9 @@ discard block |
||
2995 | 2995 | $success = true; |
2996 | 2996 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
2997 | 2997 | //let's check that we have required data |
2998 | - if ( !isset( $this->_req_data[ 'messenger' ] ) ) { |
|
2998 | + if ( ! isset($this->_req_data['messenger'])) { |
|
2999 | 2999 | EE_Error::add_error( |
3000 | - __( 'Messenger name needed to toggle activation. None given', 'event_espresso' ), |
|
3000 | + __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
|
3001 | 3001 | __FILE__, |
3002 | 3002 | __FUNCTION__, |
3003 | 3003 | __LINE__ |
@@ -3006,14 +3006,14 @@ discard block |
||
3006 | 3006 | } |
3007 | 3007 | |
3008 | 3008 | //do a nonce check here since we're not arriving via a normal route |
3009 | - $nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : ''; |
|
3010 | - $nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce'; |
|
3009 | + $nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : ''; |
|
3010 | + $nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce'; |
|
3011 | 3011 | |
3012 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3012 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3013 | 3013 | |
3014 | 3014 | |
3015 | 3015 | |
3016 | - if ( !isset( $this->_req_data[ 'status' ])) { |
|
3016 | + if ( ! isset($this->_req_data['status'])) { |
|
3017 | 3017 | EE_Error::add_error( |
3018 | 3018 | __( |
3019 | 3019 | 'Messenger status needed to know whether activation or deactivation is happening. No status is given', |
@@ -3029,11 +3029,11 @@ discard block |
||
3029 | 3029 | //do check to verify we have a valid status. |
3030 | 3030 | $status = $this->_req_data['status']; |
3031 | 3031 | |
3032 | - if ( $status != 'off' && $status != 'on' ) { |
|
3032 | + if ($status != 'off' && $status != 'on') { |
|
3033 | 3033 | EE_Error::add_error( |
3034 | 3034 | sprintf( |
3035 | - __( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ), |
|
3036 | - $this->_req_data[ 'status' ] |
|
3035 | + __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), |
|
3036 | + $this->_req_data['status'] |
|
3037 | 3037 | ), |
3038 | 3038 | __FILE__, |
3039 | 3039 | __FUNCTION__, |
@@ -3042,11 +3042,11 @@ discard block |
||
3042 | 3042 | $success = false; |
3043 | 3043 | } |
3044 | 3044 | |
3045 | - if ( $success ) { |
|
3045 | + if ($success) { |
|
3046 | 3046 | //made it here? Stop dawdling then!! |
3047 | 3047 | $success = $status == 'off' |
3048 | - ? $this->_deactivate_messenger( $this->_req_data['messenger'] ) |
|
3049 | - : $this->_activate_messenger( $this->_req_data['messenger'] ); |
|
3048 | + ? $this->_deactivate_messenger($this->_req_data['messenger']) |
|
3049 | + : $this->_activate_messenger($this->_req_data['messenger']); |
|
3050 | 3050 | } |
3051 | 3051 | |
3052 | 3052 | $this->_template_args['success'] = $success; |
@@ -3069,7 +3069,7 @@ discard block |
||
3069 | 3069 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
3070 | 3070 | |
3071 | 3071 | //let's make sure we have the necessary data |
3072 | - if ( ! isset( $this->_req_data[ 'message_type' ] ) ) { |
|
3072 | + if ( ! isset($this->_req_data['message_type'])) { |
|
3073 | 3073 | EE_Error::add_error( |
3074 | 3074 | __('Message Type name needed to toggle activation. None given', 'event_espresso'), |
3075 | 3075 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3077,7 +3077,7 @@ discard block |
||
3077 | 3077 | $success = false; |
3078 | 3078 | } |
3079 | 3079 | |
3080 | - if ( ! isset( $this->_req_data[ 'messenger' ] ) ) { |
|
3080 | + if ( ! isset($this->_req_data['messenger'])) { |
|
3081 | 3081 | EE_Error::add_error( |
3082 | 3082 | __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
3083 | 3083 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3085,7 +3085,7 @@ discard block |
||
3085 | 3085 | $success = false; |
3086 | 3086 | } |
3087 | 3087 | |
3088 | - if ( ! isset( $this->_req_data[ 'status' ])) { |
|
3088 | + if ( ! isset($this->_req_data['status'])) { |
|
3089 | 3089 | EE_Error::add_error( |
3090 | 3090 | __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), |
3091 | 3091 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3097,7 +3097,7 @@ discard block |
||
3097 | 3097 | //do check to verify we have a valid status. |
3098 | 3098 | $status = $this->_req_data['status']; |
3099 | 3099 | |
3100 | - if ( $status != 'activate' && $status != 'deactivate' ) { |
|
3100 | + if ($status != 'activate' && $status != 'deactivate') { |
|
3101 | 3101 | EE_Error::add_error( |
3102 | 3102 | sprintf( |
3103 | 3103 | __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), |
@@ -3110,16 +3110,16 @@ discard block |
||
3110 | 3110 | |
3111 | 3111 | |
3112 | 3112 | //do a nonce check here since we're not arriving via a normal route |
3113 | - $nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : ''; |
|
3114 | - $nonce_ref = $this->_req_data['message_type'] . '_nonce'; |
|
3113 | + $nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : ''; |
|
3114 | + $nonce_ref = $this->_req_data['message_type'].'_nonce'; |
|
3115 | 3115 | |
3116 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3116 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3117 | 3117 | |
3118 | - if ( $success ) { |
|
3118 | + if ($success) { |
|
3119 | 3119 | //made it here? um, what are you waiting for then? |
3120 | 3120 | $success = $status == 'deactivate' |
3121 | - ? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ) |
|
3122 | - : $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ); |
|
3121 | + ? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']) |
|
3122 | + : $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']); |
|
3123 | 3123 | } |
3124 | 3124 | |
3125 | 3125 | $this->_template_args['success'] = $success; |
@@ -3133,30 +3133,30 @@ discard block |
||
3133 | 3133 | * @param string $messenger_name The name of the messenger being activated |
3134 | 3134 | * @return bool |
3135 | 3135 | */ |
3136 | - protected function _activate_messenger( $messenger_name ) { |
|
3136 | + protected function _activate_messenger($messenger_name) { |
|
3137 | 3137 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3138 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3138 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3139 | 3139 | $message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array(); |
3140 | 3140 | |
3141 | 3141 | //ensure is active |
3142 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate ); |
|
3142 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate); |
|
3143 | 3143 | |
3144 | 3144 | //set response_data for reload |
3145 | - foreach( $message_types_to_activate as $message_type_name ) { |
|
3145 | + foreach ($message_types_to_activate as $message_type_name) { |
|
3146 | 3146 | /** @var EE_message_type $message_type */ |
3147 | - $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3148 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
|
3147 | + $message_type = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3148 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name) |
|
3149 | 3149 | && $message_type instanceof EE_message_type |
3150 | 3150 | ) { |
3151 | 3151 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3152 | - if ( $message_type->get_admin_settings_fields() ) { |
|
3152 | + if ($message_type->get_admin_settings_fields()) { |
|
3153 | 3153 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3154 | 3154 | } |
3155 | 3155 | } |
3156 | 3156 | } |
3157 | 3157 | |
3158 | 3158 | //add success message for activating messenger |
3159 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger ); |
|
3159 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger); |
|
3160 | 3160 | |
3161 | 3161 | } |
3162 | 3162 | |
@@ -3167,11 +3167,11 @@ discard block |
||
3167 | 3167 | * @param string $messenger_name The name of the messenger being activated |
3168 | 3168 | * @return bool |
3169 | 3169 | */ |
3170 | - protected function _deactivate_messenger( $messenger_name ) { |
|
3170 | + protected function _deactivate_messenger($messenger_name) { |
|
3171 | 3171 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3172 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3173 | - $this->_message_resource_manager->deactivate_messenger( $messenger_name ); |
|
3174 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger ); |
|
3172 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3173 | + $this->_message_resource_manager->deactivate_messenger($messenger_name); |
|
3174 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger); |
|
3175 | 3175 | } |
3176 | 3176 | |
3177 | 3177 | |
@@ -3182,23 +3182,23 @@ discard block |
||
3182 | 3182 | * @param string $message_type_name The name of the message type being activated for the messenger |
3183 | 3183 | * @return bool |
3184 | 3184 | */ |
3185 | - protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3185 | + protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3186 | 3186 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3187 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3187 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3188 | 3188 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3189 | - $message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3189 | + $message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3190 | 3190 | |
3191 | 3191 | //ensure is active |
3192 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name ); |
|
3192 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name); |
|
3193 | 3193 | |
3194 | 3194 | //set response for load |
3195 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
3195 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
3196 | 3196 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3197 | - if ( $message_type_to_activate->get_admin_settings_fields() ) { |
|
3197 | + if ($message_type_to_activate->get_admin_settings_fields()) { |
|
3198 | 3198 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3199 | 3199 | } |
3200 | 3200 | } |
3201 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate ); |
|
3201 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate); |
|
3202 | 3202 | } |
3203 | 3203 | |
3204 | 3204 | |
@@ -3210,13 +3210,13 @@ discard block |
||
3210 | 3210 | * @param string $message_type_name The name of the message type being deactivated for the messenger |
3211 | 3211 | * @return bool |
3212 | 3212 | */ |
3213 | - protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3213 | + protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3214 | 3214 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3215 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3215 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3216 | 3216 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3217 | - $message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3218 | - $this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name ); |
|
3219 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate ); |
|
3217 | + $message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3218 | + $this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name); |
|
3219 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate); |
|
3220 | 3220 | } |
3221 | 3221 | |
3222 | 3222 | |
@@ -3247,9 +3247,9 @@ discard block |
||
3247 | 3247 | EE_Message_Type $message_type = null |
3248 | 3248 | ) { |
3249 | 3249 | //if $messenger isn't a valid messenger object then get out. |
3250 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3250 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3251 | 3251 | EE_Error::add_error( |
3252 | - __( 'The messenger being activated is not a valid messenger', 'event_espresso' ), |
|
3252 | + __('The messenger being activated is not a valid messenger', 'event_espresso'), |
|
3253 | 3253 | __FILE__, |
3254 | 3254 | __FUNCTION__, |
3255 | 3255 | __LINE__ |
@@ -3257,32 +3257,32 @@ discard block |
||
3257 | 3257 | return false; |
3258 | 3258 | } |
3259 | 3259 | //activated |
3260 | - if ( $this->_template_args['data']['active_mts'] ) { |
|
3260 | + if ($this->_template_args['data']['active_mts']) { |
|
3261 | 3261 | EE_Error::overwrite_success(); |
3262 | 3262 | //activated a message type with the messenger |
3263 | - if ( $message_type instanceof EE_message_type ) { |
|
3263 | + if ($message_type instanceof EE_message_type) { |
|
3264 | 3264 | EE_Error::add_success( |
3265 | 3265 | sprintf( |
3266 | 3266 | __('%s message type has been successfully activated with the %s messenger', 'event_espresso'), |
3267 | - ucwords( $message_type->label['singular'] ), |
|
3268 | - ucwords( $messenger->label['singular'] ) |
|
3267 | + ucwords($message_type->label['singular']), |
|
3268 | + ucwords($messenger->label['singular']) |
|
3269 | 3269 | ) |
3270 | 3270 | ); |
3271 | 3271 | |
3272 | 3272 | //if message type was invoice then let's make sure we activate the invoice payment method. |
3273 | - if ( $message_type->name == 'invoice' ) { |
|
3274 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3275 | - $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
3276 | - if ( $pm instanceof EE_Payment_Method ) { |
|
3277 | - EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) ); |
|
3273 | + if ($message_type->name == 'invoice') { |
|
3274 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3275 | + $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
3276 | + if ($pm instanceof EE_Payment_Method) { |
|
3277 | + EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso')); |
|
3278 | 3278 | } |
3279 | 3279 | } |
3280 | 3280 | //just toggles the entire messenger |
3281 | 3281 | } else { |
3282 | 3282 | EE_Error::add_success( |
3283 | 3283 | sprintf( |
3284 | - __( '%s messenger has been successfully activated', 'event_espresso' ), |
|
3285 | - ucwords( $messenger->label[ 'singular' ] ) |
|
3284 | + __('%s messenger has been successfully activated', 'event_espresso'), |
|
3285 | + ucwords($messenger->label['singular']) |
|
3286 | 3286 | ) |
3287 | 3287 | ); |
3288 | 3288 | } |
@@ -3292,12 +3292,12 @@ discard block |
||
3292 | 3292 | //message types after the activation process. However its possible some messengers don't HAVE any default_message_types |
3293 | 3293 | //in which case we just give a success message for the messenger being successfully activated. |
3294 | 3294 | } else { |
3295 | - if ( ! $messenger->get_default_message_types() ) { |
|
3295 | + if ( ! $messenger->get_default_message_types()) { |
|
3296 | 3296 | //messenger doesn't have any default message types so still a success. |
3297 | 3297 | EE_Error::add_success( |
3298 | 3298 | sprintf( |
3299 | - __('%s messenger was successfully activated.', 'event_espresso' ), |
|
3300 | - ucwords( $messenger->label['singular'] ) |
|
3299 | + __('%s messenger was successfully activated.', 'event_espresso'), |
|
3300 | + ucwords($messenger->label['singular']) |
|
3301 | 3301 | ) |
3302 | 3302 | ); |
3303 | 3303 | return true; |
@@ -3305,13 +3305,13 @@ discard block |
||
3305 | 3305 | EE_Error::add_error( |
3306 | 3306 | $message_type instanceof EE_message_type |
3307 | 3307 | ? sprintf( |
3308 | - __( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ), |
|
3309 | - ucwords( $message_type->label['singular'] ), |
|
3310 | - ucwords( $messenger->label['singular'] ) |
|
3308 | + __('%s message type was not successfully activated with the %s messenger', 'event_espresso'), |
|
3309 | + ucwords($message_type->label['singular']), |
|
3310 | + ucwords($messenger->label['singular']) |
|
3311 | 3311 | ) |
3312 | 3312 | : sprintf( |
3313 | - __( '%s messenger was not successfully activated', 'event_espresso' ), |
|
3314 | - ucwords( $messenger->label['singular'] ) |
|
3313 | + __('%s messenger was not successfully activated', 'event_espresso'), |
|
3314 | + ucwords($messenger->label['singular']) |
|
3315 | 3315 | ), |
3316 | 3316 | __FILE__, |
3317 | 3317 | __FUNCTION__, |
@@ -3339,9 +3339,9 @@ discard block |
||
3339 | 3339 | EE_Error::overwrite_success(); |
3340 | 3340 | |
3341 | 3341 | //if $messenger isn't a valid messenger object then get out. |
3342 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3342 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3343 | 3343 | EE_Error::add_error( |
3344 | - __( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ), |
|
3344 | + __('The messenger being deactivated is not a valid messenger', 'event_espresso'), |
|
3345 | 3345 | __FILE__, |
3346 | 3346 | __FUNCTION__, |
3347 | 3347 | __LINE__ |
@@ -3349,13 +3349,13 @@ discard block |
||
3349 | 3349 | return false; |
3350 | 3350 | } |
3351 | 3351 | |
3352 | - if ( $message_type instanceof EE_message_type ) { |
|
3352 | + if ($message_type instanceof EE_message_type) { |
|
3353 | 3353 | $message_type_name = $message_type->name; |
3354 | 3354 | EE_Error::add_success( |
3355 | 3355 | sprintf( |
3356 | 3356 | __('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'), |
3357 | - ucwords( $message_type->label['singular'] ), |
|
3358 | - ucwords ( $messenger->label['singular'] ) |
|
3357 | + ucwords($message_type->label['singular']), |
|
3358 | + ucwords($messenger->label['singular']) |
|
3359 | 3359 | ) |
3360 | 3360 | ); |
3361 | 3361 | } else { |
@@ -3363,20 +3363,20 @@ discard block |
||
3363 | 3363 | EE_Error::add_success( |
3364 | 3364 | sprintf( |
3365 | 3365 | __('%s messenger has been successfully deactivated.', 'event_espresso'), |
3366 | - ucwords( $messenger->label['singular'] ) |
|
3366 | + ucwords($messenger->label['singular']) |
|
3367 | 3367 | ) |
3368 | 3368 | ); |
3369 | 3369 | } |
3370 | 3370 | |
3371 | 3371 | //if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method. |
3372 | - if ( $messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3373 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3374 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' ); |
|
3375 | - if ( $count_updated > 0 ) { |
|
3372 | + if ($messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3373 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3374 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice'); |
|
3375 | + if ($count_updated > 0) { |
|
3376 | 3376 | $msg = $message_type_name == 'invoice' |
3377 | - ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) |
|
3378 | - : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ); |
|
3379 | - EE_Error::add_attention( $msg ); |
|
3377 | + ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') |
|
3378 | + : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso'); |
|
3379 | + EE_Error::add_attention($msg); |
|
3380 | 3380 | } |
3381 | 3381 | } |
3382 | 3382 | return true; |
@@ -3387,17 +3387,17 @@ discard block |
||
3387 | 3387 | * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax) |
3388 | 3388 | */ |
3389 | 3389 | public function update_mt_form() { |
3390 | - if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) { |
|
3391 | - EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3390 | + if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) { |
|
3391 | + EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__); |
|
3392 | 3392 | $this->_return_json(); |
3393 | 3393 | } |
3394 | 3394 | |
3395 | 3395 | $message_types = $this->get_installed_message_types(); |
3396 | 3396 | |
3397 | - $message_type = $message_types[ $this->_req_data['message_type'] ]; |
|
3398 | - $messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
3397 | + $message_type = $message_types[$this->_req_data['message_type']]; |
|
3398 | + $messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
3399 | 3399 | |
3400 | - $content = $this->_message_type_settings_content ( $message_type, $messenger, true ); |
|
3400 | + $content = $this->_message_type_settings_content($message_type, $messenger, true); |
|
3401 | 3401 | $this->_template_args['success'] = true; |
3402 | 3402 | $this->_template_args['content'] = $content; |
3403 | 3403 | $this->_return_json(); |
@@ -3411,45 +3411,45 @@ discard block |
||
3411 | 3411 | * |
3412 | 3412 | */ |
3413 | 3413 | public function save_settings() { |
3414 | - if ( !isset( $this->_req_data['type'] ) ) { |
|
3415 | - EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3414 | + if ( ! isset($this->_req_data['type'])) { |
|
3415 | + EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3416 | 3416 | $this->_template_args['error'] = true; |
3417 | 3417 | $this->_return_json(); |
3418 | 3418 | } |
3419 | 3419 | |
3420 | 3420 | |
3421 | - if ( $this->_req_data['type'] == 'messenger' ) { |
|
3421 | + if ($this->_req_data['type'] == 'messenger') { |
|
3422 | 3422 | $settings = $this->_req_data['messenger_settings']; //this should be an array. |
3423 | 3423 | $messenger = $settings['messenger']; |
3424 | 3424 | //let's setup the settings data |
3425 | - foreach ( $settings as $key => $value ) { |
|
3426 | - switch ( $key ) { |
|
3425 | + foreach ($settings as $key => $value) { |
|
3426 | + switch ($key) { |
|
3427 | 3427 | case 'messenger' : |
3428 | - unset( $settings['messenger'] ); |
|
3428 | + unset($settings['messenger']); |
|
3429 | 3429 | break; |
3430 | 3430 | case 'message_types' : |
3431 | - unset( $settings['message_types'] ); |
|
3431 | + unset($settings['message_types']); |
|
3432 | 3432 | break; |
3433 | 3433 | default : |
3434 | 3434 | $settings[$key] = $value; |
3435 | 3435 | break; |
3436 | 3436 | } |
3437 | 3437 | } |
3438 | - $this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings ); |
|
3438 | + $this->_message_resource_manager->add_settings_for_messenger($messenger, $settings); |
|
3439 | 3439 | } |
3440 | 3440 | |
3441 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3441 | + else if ($this->_req_data['type'] == 'message_type') { |
|
3442 | 3442 | $settings = $this->_req_data['message_type_settings']; |
3443 | 3443 | $messenger = $settings['messenger']; |
3444 | 3444 | $message_type = $settings['message_type']; |
3445 | 3445 | |
3446 | - foreach ( $settings as $key => $value ) { |
|
3447 | - switch ( $key ) { |
|
3446 | + foreach ($settings as $key => $value) { |
|
3447 | + switch ($key) { |
|
3448 | 3448 | case 'messenger' : |
3449 | - unset( $settings['messenger'] ); |
|
3449 | + unset($settings['messenger']); |
|
3450 | 3450 | break; |
3451 | 3451 | case 'message_type' : |
3452 | - unset( $settings['message_type'] ); |
|
3452 | + unset($settings['message_type']); |
|
3453 | 3453 | break; |
3454 | 3454 | default : |
3455 | 3455 | $settings[$key] = $value; |
@@ -3457,16 +3457,16 @@ discard block |
||
3457 | 3457 | } |
3458 | 3458 | } |
3459 | 3459 | |
3460 | - $this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings ); |
|
3460 | + $this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings); |
|
3461 | 3461 | } |
3462 | 3462 | |
3463 | 3463 | //okay we should have the data all setup. Now we just update! |
3464 | 3464 | $success = $this->_message_resource_manager->update_active_messengers_option(); |
3465 | 3465 | |
3466 | - if ( $success ) { |
|
3467 | - EE_Error::add_success( __('Settings updated', 'event_espresso') ); |
|
3466 | + if ($success) { |
|
3467 | + EE_Error::add_success(__('Settings updated', 'event_espresso')); |
|
3468 | 3468 | } else { |
3469 | - EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3469 | + EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3470 | 3470 | } |
3471 | 3471 | |
3472 | 3472 | $this->_template_args['success'] = $success; |
@@ -3488,8 +3488,8 @@ discard block |
||
3488 | 3488 | */ |
3489 | 3489 | protected function _generate_now() { |
3490 | 3490 | $msg_ids = $this->_get_msg_ids_from_request(); |
3491 | - EED_Messages::generate_now( $msg_ids ); |
|
3492 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3491 | + EED_Messages::generate_now($msg_ids); |
|
3492 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3493 | 3493 | } |
3494 | 3494 | |
3495 | 3495 | |
@@ -3504,7 +3504,7 @@ discard block |
||
3504 | 3504 | protected function _generate_and_send_now() { |
3505 | 3505 | $this->_generate_now(); |
3506 | 3506 | $this->_send_now(); |
3507 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3507 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3508 | 3508 | } |
3509 | 3509 | |
3510 | 3510 | |
@@ -3518,8 +3518,8 @@ discard block |
||
3518 | 3518 | */ |
3519 | 3519 | protected function _queue_for_resending() { |
3520 | 3520 | $msg_ids = $this->_get_msg_ids_from_request(); |
3521 | - EED_Messages::queue_for_resending( $msg_ids ); |
|
3522 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3521 | + EED_Messages::queue_for_resending($msg_ids); |
|
3522 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3523 | 3523 | } |
3524 | 3524 | |
3525 | 3525 | |
@@ -3532,8 +3532,8 @@ discard block |
||
3532 | 3532 | */ |
3533 | 3533 | protected function _send_now() { |
3534 | 3534 | $msg_ids = $this->_get_msg_ids_from_request(); |
3535 | - EED_Messages::send_now( $msg_ids ); |
|
3536 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3535 | + EED_Messages::send_now($msg_ids); |
|
3536 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3537 | 3537 | } |
3538 | 3538 | |
3539 | 3539 | |
@@ -3547,23 +3547,23 @@ discard block |
||
3547 | 3547 | protected function _delete_ee_messages() { |
3548 | 3548 | $msg_ids = $this->_get_msg_ids_from_request(); |
3549 | 3549 | $deleted_count = 0; |
3550 | - foreach ( $msg_ids as $msg_id ) { |
|
3551 | - if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) { |
|
3550 | + foreach ($msg_ids as $msg_id) { |
|
3551 | + if (EEM_Message::instance()->delete_by_ID($msg_id)) { |
|
3552 | 3552 | $deleted_count++; |
3553 | 3553 | } |
3554 | 3554 | } |
3555 | - if ( $deleted_count ) { |
|
3555 | + if ($deleted_count) { |
|
3556 | 3556 | $this->_redirect_after_action( |
3557 | 3557 | true, |
3558 | - _n( 'message', 'messages', $deleted_count, 'event_espresso' ), |
|
3558 | + _n('message', 'messages', $deleted_count, 'event_espresso'), |
|
3559 | 3559 | __('deleted', 'event_espresso') |
3560 | 3560 | ); |
3561 | 3561 | } else { |
3562 | 3562 | EE_Error::add_error( |
3563 | - _n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ), |
|
3563 | + _n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'), |
|
3564 | 3564 | __FILE__, __FUNCTION__, __LINE__ |
3565 | 3565 | ); |
3566 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3566 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3567 | 3567 | } |
3568 | 3568 | } |
3569 | 3569 | |
@@ -3576,10 +3576,10 @@ discard block |
||
3576 | 3576 | * @return array |
3577 | 3577 | */ |
3578 | 3578 | protected function _get_msg_ids_from_request() { |
3579 | - if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
|
3579 | + if ( ! isset($this->_req_data['MSG_ID'])) { |
|
3580 | 3580 | return array(); |
3581 | 3581 | } |
3582 | - return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] ); |
|
3582 | + return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']); |
|
3583 | 3583 | } |
3584 | 3584 | |
3585 | 3585 |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | ?> |
4 | -<h1><?php _e("Data Migration Error", "event_espresso");?></h1> |
|
5 | -<p class='error'><?php printf(__("Your last data migration had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"),"<b>","</b>");?></p> |
|
6 | -<a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Errors", 'event_espresso');?></a> |
|
4 | +<h1><?php _e("Data Migration Error", "event_espresso"); ?></h1> |
|
5 | +<p class='error'><?php printf(__("Your last data migration had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"), "<b>", "</b>"); ?></p> |
|
6 | +<a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Errors", 'event_espresso'); ?></a> |
|
7 | 7 | <ul class="migration-warnings" style="display:none"> |
8 | -<?php foreach($most_recent_migration->get_errors() as $error){ ?> |
|
8 | +<?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
|
9 | 9 | <li style="overflow-y:auto;max-height:100px"><?php echo esc_html($error)?></li> |
10 | 10 | <?php }?> |
11 | 11 | </ul> |
12 | -<h2><?php _e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso");?></h2> |
|
13 | -<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL);?>' method='post'> |
|
12 | +<h2><?php _e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso"); ?></h2> |
|
13 | +<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL); ?>' method='post'> |
|
14 | 14 | <table class='widefat'> |
15 | - <tr><td><label for='from'><?php _e("From/Reply-To:", "event_espresso");?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email','display'); ?>'></td></tr> |
|
16 | - <tr><td><label for='from_name'><?php _e("Your Name", "event_espresso");?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(__("Admin of %s", "event_espresso"),get_bloginfo('name','display'));?>'></td></tr> |
|
17 | - <tr><td><label for='body'><?php _e("Comments", "event_espresso");?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php _e("Enter any comments about why you think the error may have occurred", "event_espresso");?></textarea> |
|
18 | - <p class='description'><?php _e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso");?></p></td></tr> |
|
19 | - <tr><td colspan="2"><input type="submit" value="<?php _e("Mail Crash Report to Event Espresso", "event_espresso");?>"/></td></tr> |
|
15 | + <tr><td><label for='from'><?php _e("From/Reply-To:", "event_espresso"); ?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email', 'display'); ?>'></td></tr> |
|
16 | + <tr><td><label for='from_name'><?php _e("Your Name", "event_espresso"); ?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(__("Admin of %s", "event_espresso"), get_bloginfo('name', 'display')); ?>'></td></tr> |
|
17 | + <tr><td><label for='body'><?php _e("Comments", "event_espresso"); ?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php _e("Enter any comments about why you think the error may have occurred", "event_espresso"); ?></textarea> |
|
18 | + <p class='description'><?php _e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso"); ?></p></td></tr> |
|
19 | + <tr><td colspan="2"><input type="submit" value="<?php _e("Mail Crash Report to Event Espresso", "event_espresso"); ?>"/></td></tr> |
|
20 | 20 | </table> |
21 | 21 | </form> |
22 | 22 | <br> |
23 | -<p><?php printf(__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),'<a href="mailto:'.EE_SUPPORT_EMAIL.'">',EE_SUPPORT_EMAIL,"</a>");?></p> |
|
24 | -<textarea class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati())?></textarea> |
|
25 | -<p><?php printf( __( '%1$sNext Step%2$s', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p> |
|
26 | -<p><?php printf( __( '...or %1$sDON\'T send migration crash report%2$s.', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p> |
|
23 | +<p><?php printf(__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">', EE_SUPPORT_EMAIL, "</a>"); ?></p> |
|
24 | +<textarea class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati())?></textarea> |
|
25 | +<p><?php printf(__('%1$sNext Step%2$s', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p> |
|
26 | +<p><?php printf(__('...or %1$sDON\'T send migration crash report%2$s.', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p> |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | |
164 | 164 | /** |
165 | 165 | * grab url requests and route them |
166 | - * @access private |
|
167 | - * @return void |
|
168 | - */ |
|
166 | + * @access private |
|
167 | + * @return void |
|
168 | + */ |
|
169 | 169 | public function _set_page_routes() { |
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'title' => __('Registrations Other', 'event_espresso'), |
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | - ), |
|
440 | + ), |
|
441 | 441 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
452 | 452 | 'persistent' => FALSE |
453 | 453 | ), |
454 | - 'help_tabs' => array( |
|
454 | + 'help_tabs' => array( |
|
455 | 455 | 'registrations_details_help_tab' => array( |
456 | 456 | 'title' => __('Registration Details', 'event_espresso'), |
457 | 457 | 'filename' => 'registrations_details' |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | 'order' => 20 |
516 | 516 | ), |
517 | 517 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
518 | - 'help_tabs' => array( |
|
518 | + 'help_tabs' => array( |
|
519 | 519 | 'registrations_contact_list_help_tab' => array( |
520 | 520 | 'title' => __('Registrations Contact List', 'event_espresso'), |
521 | 521 | 'filename' => 'registrations_contact_list' |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | 'title' => __('Contact List Other', 'event_espresso'), |
533 | 533 | 'filename' => 'registrations_contact_list_other' |
534 | 534 | ) |
535 | - ), |
|
535 | + ), |
|
536 | 536 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
537 | 537 | 'metaboxes' => array(), |
538 | 538 | 'require_nonce' => FALSE |
@@ -566,9 +566,9 @@ discard block |
||
566 | 566 | |
567 | 567 | /** |
568 | 568 | * get list of registration statuses |
569 | - * @access private |
|
570 | - * @return void |
|
571 | - */ |
|
569 | + * @access private |
|
570 | + * @return void |
|
571 | + */ |
|
572 | 572 | private function _get_registration_status_array() { |
573 | 573 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
574 | 574 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | return TRUE; |
887 | 887 | } |
888 | 888 | |
889 | - $REG = EEM_Registration::instance(); |
|
889 | + $REG = EEM_Registration::instance(); |
|
890 | 890 | |
891 | 891 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
892 | 892 | |
@@ -1107,9 +1107,9 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | /** |
1109 | 1109 | * generates HTML for the View Registration Details Admin page |
1110 | - * @access protected |
|
1111 | - * @return void |
|
1112 | - */ |
|
1110 | + * @access protected |
|
1111 | + * @return void |
|
1112 | + */ |
|
1113 | 1113 | protected function _registration_details() { |
1114 | 1114 | |
1115 | 1115 | $this->_template_args = array(); |
@@ -1187,9 +1187,9 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | /** |
1189 | 1189 | * _set_approve_or_decline_reg_status_buttons |
1190 | - * @access protected |
|
1191 | - * @return string |
|
1192 | - */ |
|
1190 | + * @access protected |
|
1191 | + * @return string |
|
1192 | + */ |
|
1193 | 1193 | public function set_reg_status_buttons_metabox() { |
1194 | 1194 | |
1195 | 1195 | //is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown. |
@@ -1378,10 +1378,10 @@ discard block |
||
1378 | 1378 | |
1379 | 1379 | /** |
1380 | 1380 | * approve_registration |
1381 | - * @access protected |
|
1382 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1383 | - * @return void |
|
1384 | - */ |
|
1381 | + * @access protected |
|
1382 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1383 | + * @return void |
|
1384 | + */ |
|
1385 | 1385 | protected function approve_registration( $notify = false ) { |
1386 | 1386 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
1387 | 1387 | } |
@@ -1391,10 +1391,10 @@ discard block |
||
1391 | 1391 | |
1392 | 1392 | /** |
1393 | 1393 | * decline_registration |
1394 | - * @access protected |
|
1395 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1396 | - * @return void |
|
1397 | - */ |
|
1394 | + * @access protected |
|
1395 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1396 | + * @return void |
|
1397 | + */ |
|
1398 | 1398 | protected function decline_registration( $notify = false ) { |
1399 | 1399 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
1400 | 1400 | } |
@@ -1404,10 +1404,10 @@ discard block |
||
1404 | 1404 | |
1405 | 1405 | /** |
1406 | 1406 | * cancel_registration |
1407 | - * @access protected |
|
1408 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1409 | - * @return void |
|
1410 | - */ |
|
1407 | + * @access protected |
|
1408 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1409 | + * @return void |
|
1410 | + */ |
|
1411 | 1411 | protected function cancel_registration( $notify = false ) { |
1412 | 1412 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
1413 | 1413 | } |
@@ -1418,10 +1418,10 @@ discard block |
||
1418 | 1418 | |
1419 | 1419 | /** |
1420 | 1420 | * not_approve_registration |
1421 | - * @access protected |
|
1422 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1423 | - * @return void |
|
1424 | - */ |
|
1421 | + * @access protected |
|
1422 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1423 | + * @return void |
|
1424 | + */ |
|
1425 | 1425 | protected function not_approve_registration( $notify = false ) { |
1426 | 1426 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
1427 | 1427 | } |
@@ -1430,10 +1430,10 @@ discard block |
||
1430 | 1430 | |
1431 | 1431 | /** |
1432 | 1432 | * decline_registration |
1433 | - * @access protected |
|
1434 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1435 | - * @return void |
|
1436 | - */ |
|
1433 | + * @access protected |
|
1434 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1435 | + * @return void |
|
1436 | + */ |
|
1437 | 1437 | protected function pending_registration( $notify = false ) { |
1438 | 1438 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
1439 | 1439 | } |
@@ -1443,9 +1443,9 @@ discard block |
||
1443 | 1443 | |
1444 | 1444 | /** |
1445 | 1445 | * generates HTML for the Registration main meta box |
1446 | - * @access public |
|
1447 | - * @return void |
|
1448 | - */ |
|
1446 | + * @access public |
|
1447 | + * @return void |
|
1448 | + */ |
|
1449 | 1449 | public function _reg_details_meta_box() { |
1450 | 1450 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1451 | 1451 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | * |
1529 | 1529 | * @access public |
1530 | 1530 | * @return void |
1531 | - */ |
|
1531 | + */ |
|
1532 | 1532 | public function _reg_questions_meta_box() { |
1533 | 1533 | //allow someone to override this method entirely |
1534 | 1534 | if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
@@ -1730,12 +1730,12 @@ discard block |
||
1730 | 1730 | |
1731 | 1731 | /** |
1732 | 1732 | * generates HTML for the Registration main meta box |
1733 | - * @access public |
|
1734 | - * @return void |
|
1735 | - */ |
|
1733 | + * @access public |
|
1734 | + * @return void |
|
1735 | + */ |
|
1736 | 1736 | public function _reg_attendees_meta_box() { |
1737 | 1737 | |
1738 | - $REG = EEM_Registration::instance(); |
|
1738 | + $REG = EEM_Registration::instance(); |
|
1739 | 1739 | //get all other registrations on this transaction, and cache |
1740 | 1740 | //the attendees for them so we don't have to run another query using force_join |
1741 | 1741 | $registrations = $REG->get_all(array( |
@@ -1787,9 +1787,9 @@ discard block |
||
1787 | 1787 | |
1788 | 1788 | /** |
1789 | 1789 | * generates HTML for the Edit Registration side meta box |
1790 | - * @access public |
|
1791 | - * @return void |
|
1792 | - */ |
|
1790 | + * @access public |
|
1791 | + * @return void |
|
1792 | + */ |
|
1793 | 1793 | public function _reg_registrant_side_meta_box() { |
1794 | 1794 | |
1795 | 1795 | /*@var $attendee EE_Attendee */ |
@@ -2167,9 +2167,9 @@ discard block |
||
2167 | 2167 | |
2168 | 2168 | /** |
2169 | 2169 | * set_reg_event |
2170 | - * @access private |
|
2171 | - * @return boolean |
|
2172 | - */ |
|
2170 | + * @access private |
|
2171 | + * @return boolean |
|
2172 | + */ |
|
2173 | 2173 | private function _set_reg_event() { |
2174 | 2174 | if ( is_object( $this->_reg_event )) { |
2175 | 2175 | return TRUE; |
@@ -2309,9 +2309,9 @@ discard block |
||
2309 | 2309 | |
2310 | 2310 | /** |
2311 | 2311 | * generates HTML for the Attendee Contact List |
2312 | - * @access protected |
|
2313 | - * @return void |
|
2314 | - */ |
|
2312 | + * @access protected |
|
2313 | + * @return void |
|
2314 | + */ |
|
2315 | 2315 | protected function _attendee_contact_list_table() { |
2316 | 2316 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2317 | 2317 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2325,9 +2325,9 @@ discard block |
||
2325 | 2325 | /** |
2326 | 2326 | * get_attendees |
2327 | 2327 | * @param bool $count whether to return count or data. |
2328 | - * @access public |
|
2329 | - * @return array |
|
2330 | - */ |
|
2328 | + * @access public |
|
2329 | + * @return array |
|
2330 | + */ |
|
2331 | 2331 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2332 | 2332 | |
2333 | 2333 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2660,9 +2660,9 @@ discard block |
||
2660 | 2660 | |
2661 | 2661 | /** |
2662 | 2662 | * _attendee_details |
2663 | - * @access protected |
|
2664 | - * @return void |
|
2665 | - */ |
|
2663 | + * @access protected |
|
2664 | + * @return void |
|
2665 | + */ |
|
2666 | 2666 | public function attendee_registrations_meta_box( $post ) { |
2667 | 2667 | |
2668 | 2668 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2695,10 +2695,10 @@ discard block |
||
2695 | 2695 | |
2696 | 2696 | /** |
2697 | 2697 | * _trash_or_restore_attendee |
2698 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2699 | - * @access protected |
|
2700 | - * @return void |
|
2701 | - */ |
|
2698 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2699 | + * @access protected |
|
2700 | + * @return void |
|
2701 | + */ |
|
2702 | 2702 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2703 | 2703 | |
2704 | 2704 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | public function clear_comment_link( $link, $comment, $args ) { |
119 | 121 | //gotta make sure this only happens on this route |
120 | 122 | $post_type = get_post_type( $comment->comment_post_ID); |
121 | - if ( $post_type == 'espresso_attendees' ) |
|
122 | - return '#commentsdiv'; |
|
123 | + if ( $post_type == 'espresso_attendees' ) { |
|
124 | + return '#commentsdiv'; |
|
125 | + } |
|
123 | 126 | return $link; |
124 | 127 | } |
125 | 128 | |
@@ -890,9 +893,9 @@ discard block |
||
890 | 893 | |
891 | 894 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
892 | 895 | |
893 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
894 | - return TRUE; |
|
895 | - else { |
|
896 | + if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) { |
|
897 | + return TRUE; |
|
898 | + } else { |
|
896 | 899 | $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
897 | 900 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
898 | 901 | $this->_registration = NULL; |
@@ -987,7 +990,7 @@ discard block |
||
987 | 990 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
988 | 991 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
989 | 992 | )); |
990 | - }elseif($this_month_a || $this_month){ |
|
993 | + } elseif($this_month_a || $this_month){ |
|
991 | 994 | $this_month_r = date('m', current_time('timestamp')); |
992 | 995 | $days_this_month = date( 't', current_time('timestamp') ); |
993 | 996 | $_where['REG_date']= array('BETWEEN', |
@@ -995,18 +998,18 @@ discard block |
||
995 | 998 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
996 | 999 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
997 | 1000 | )); |
998 | - }elseif($month_range){ |
|
1001 | + } elseif($month_range){ |
|
999 | 1002 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1000 | 1003 | $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
1001 | 1004 | $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
1002 | 1005 | $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
1003 | 1006 | $_where['REG_date']= array('BETWEEN', |
1004 | 1007 | array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
1005 | - }elseif($start_date && $end_date){ |
|
1008 | + } elseif($start_date && $end_date){ |
|
1006 | 1009 | throw new EE_Error("not yet supported"); |
1007 | - }elseif($start_date){ |
|
1010 | + } elseif($start_date){ |
|
1008 | 1011 | throw new EE_Error("not yet supported"); |
1009 | - }elseif($end_date){ |
|
1012 | + } elseif($end_date){ |
|
1010 | 1013 | throw new EE_Error("not yet supported"); |
1011 | 1014 | } |
1012 | 1015 | |
@@ -1939,8 +1942,9 @@ discard block |
||
1939 | 1942 | // cycle thru checkboxes |
1940 | 1943 | while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
1941 | 1944 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1942 | - if ( ! $REG instanceof EE_Registration ) |
|
1943 | - continue; |
|
1945 | + if ( ! $REG instanceof EE_Registration ) { |
|
1946 | + continue; |
|
1947 | + } |
|
1944 | 1948 | $deleted = $this->_delete_registration($REG); |
1945 | 1949 | if ( !$deleted ) { |
1946 | 1950 | $success = 0; |
@@ -1979,8 +1983,9 @@ discard block |
||
1979 | 1983 | |
1980 | 1984 | $all_trashed = TRUE; |
1981 | 1985 | foreach ( $REGS as $registration ) { |
1982 | - if ( ! $registration->get('REG_deleted') ) |
|
1983 | - $all_trashed = FALSE; |
|
1986 | + if ( ! $registration->get('REG_deleted') ) { |
|
1987 | + $all_trashed = FALSE; |
|
1988 | + } |
|
1984 | 1989 | } |
1985 | 1990 | |
1986 | 1991 | if ( ! $all_trashed ) { |
@@ -2006,8 +2011,10 @@ discard block |
||
2006 | 2011 | //now delete permanently the checkins related to this registration. |
2007 | 2012 | $registration->delete_related_permanently('Checkin'); |
2008 | 2013 | |
2009 | - if ( $registration->ID() === $REG->ID() ) |
|
2010 | - continue; //we don't want to delete permanently the existing registration just yet. |
|
2014 | + if ( $registration->ID() === $REG->ID() ) { |
|
2015 | + continue; |
|
2016 | + } |
|
2017 | + //we don't want to delete permanently the existing registration just yet. |
|
2011 | 2018 | |
2012 | 2019 | //remove relation to transaction for these registrations if NOT the existing registrations |
2013 | 2020 | $registration->_remove_relations('Transaction'); |
@@ -2559,8 +2566,9 @@ discard block |
||
2559 | 2566 | } |
2560 | 2567 | } |
2561 | 2568 | |
2562 | - if ( $success === FALSE ) |
|
2563 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2569 | + if ( $success === FALSE ) { |
|
2570 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2571 | + } |
|
2564 | 2572 | |
2565 | 2573 | } |
2566 | 2574 |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | 'nav' => array( |
449 | 449 | 'label' => __('REG Details', 'event_espresso'), |
450 | 450 | 'order' => 15, |
451 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
451 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
452 | 452 | 'persistent' => FALSE |
453 | 453 | ), |
454 | 454 | 'help_tabs' => array( |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | 'filename' => 'registrations_details_registrant_details' |
470 | 470 | ) |
471 | 471 | ), |
472 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
473 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
472 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
473 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
474 | 474 | 'require_nonce' => FALSE |
475 | 475 | ), |
476 | 476 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | 'order' => 15, |
495 | 495 | 'persistent' => FALSE |
496 | 496 | ), |
497 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
497 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
498 | 498 | 'require_nonce' => FALSE |
499 | 499 | ), |
500 | 500 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | 'label' => __('Edit Contact', 'event_espresso'), |
504 | 504 | 'order' => 15, |
505 | 505 | 'persistent' => FALSE, |
506 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
506 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
507 | 507 | ), |
508 | 508 | 'metaboxes' => array('attendee_editor_metaboxes'), |
509 | 509 | 'require_nonce' => FALSE |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | 'filename' => 'registrations_contact_list_other' |
534 | 534 | ) |
535 | 535 | ), |
536 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
536 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
537 | 537 | 'metaboxes' => array(), |
538 | 538 | 'require_nonce' => FALSE |
539 | 539 | ), |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | protected function _add_screen_options() {} |
553 | 553 | protected function _add_feature_pointers() {} |
554 | 554 | public function admin_init() { |
555 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
555 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
556 | 556 | } |
557 | 557 | public function admin_notices() {} |
558 | 558 | public function admin_footer_scripts() {} |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @return void |
571 | 571 | */ |
572 | 572 | private function _get_registration_status_array() { |
573 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
573 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | public function load_scripts_styles() { |
594 | 594 | //style |
595 | 595 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
596 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
596 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
597 | 597 | wp_enqueue_style('espresso_reg'); |
598 | 598 | |
599 | 599 | //script |
600 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
601 | 601 | wp_enqueue_script('espresso_reg'); |
602 | 602 | } |
603 | 603 | |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | public function load_scripts_styles_edit_attendee() { |
607 | 607 | //stuff to only show up on our attendee edit details page. |
608 | 608 | $attendee_details_translations = array( |
609 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
609 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
610 | 610 | ); |
611 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
611 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
612 | 612 | wp_enqueue_script('jquery-validate'); |
613 | 613 | } |
614 | 614 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | //styles |
618 | 618 | wp_enqueue_style('espresso-ui-theme'); |
619 | 619 | //scripts |
620 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
621 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
620 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
621 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | public function load_scripts_styles_contact_list() { |
630 | 630 | wp_deregister_style('espresso_reg'); |
631 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
631 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
632 | 632 | wp_enqueue_style('espresso_att'); |
633 | 633 | } |
634 | 634 | |
@@ -637,9 +637,9 @@ discard block |
||
637 | 637 | |
638 | 638 | |
639 | 639 | public function load_scripts_styles_new_registration() { |
640 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
640 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
641 | 641 | wp_enqueue_script('ee-spco-for-admin'); |
642 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
642 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
643 | 643 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
644 | 644 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
645 | 645 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | //for notification related bulk actions we need to make sure only active messengers have an option. |
667 | 667 | EED_Messages::set_autoloaders(); |
668 | 668 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
669 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
669 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
670 | 670 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
671 | 671 | //key= bulk_action_slug, value= message type. |
672 | 672 | $match_array = array( |
@@ -679,23 +679,23 @@ discard block |
||
679 | 679 | |
680 | 680 | /** setup reg status bulk actions **/ |
681 | 681 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
682 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
682 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
683 | 683 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
684 | 684 | } |
685 | 685 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
686 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
686 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
687 | 687 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
688 | 688 | } |
689 | 689 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
690 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
690 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
691 | 691 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
692 | 692 | } |
693 | 693 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
694 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
694 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
695 | 695 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
696 | 696 | } |
697 | 697 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
698 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
698 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
699 | 699 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
700 | 700 | } |
701 | 701 | |
@@ -704,29 +704,29 @@ discard block |
||
704 | 704 | 'slug' => 'all', |
705 | 705 | 'label' => __('View All Registrations', 'event_espresso'), |
706 | 706 | 'count' => 0, |
707 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
707 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
708 | 708 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
709 | - ) ) |
|
709 | + )) |
|
710 | 710 | ), |
711 | 711 | 'month' => array( |
712 | 712 | 'slug' => 'month', |
713 | 713 | 'label' => __('This Month', 'event_espresso'), |
714 | 714 | 'count' => 0, |
715 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
715 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
716 | 716 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
717 | 717 | )) |
718 | 718 | ), |
719 | 719 | 'today' => array( |
720 | 720 | 'slug' => 'today', |
721 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
721 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
722 | 722 | 'count' => 0, |
723 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
723 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
724 | 724 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
725 | 725 | )) |
726 | 726 | ) |
727 | 727 | ); |
728 | 728 | |
729 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
729 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
730 | 730 | $this->_views['incomplete'] = array( |
731 | 731 | 'slug' => 'incomplete', |
732 | 732 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | ) |
763 | 763 | ); |
764 | 764 | |
765 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
765 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
766 | 766 | $this->_views['trash'] = array( |
767 | 767 | 'slug' => 'trash', |
768 | 768 | 'label' => __('Trash', 'event_espresso'), |
@@ -801,18 +801,18 @@ discard block |
||
801 | 801 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
802 | 802 | ), |
803 | 803 | ); |
804 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
804 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
805 | 805 | $fc_items['resend_registration'] = array( |
806 | 806 | 'class' => 'dashicons dashicons-email-alt', |
807 | 807 | 'desc' => __('Resend Registration Details', 'event_espresso') |
808 | 808 | ); |
809 | 809 | } else { |
810 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
810 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
811 | 811 | } |
812 | 812 | |
813 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
814 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
815 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
813 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
814 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
815 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
816 | 816 | $fc_items['view_related_messages'] = array( |
817 | 817 | 'class' => $related_for_icon['css_class'], |
818 | 818 | 'desc' => $related_for_icon['label'], |
@@ -822,31 +822,31 @@ discard block |
||
822 | 822 | |
823 | 823 | $sc_items = array( |
824 | 824 | 'approved_status' => array( |
825 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
826 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
825 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
826 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
827 | 827 | ), |
828 | 828 | 'pending_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'incomplete_status' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
835 | 835 | ), |
836 | 836 | 'not_approved' => array( |
837 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
838 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
837 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
838 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
839 | 839 | ), |
840 | 840 | 'declined_status' => array( |
841 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
842 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
841 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
842 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
843 | 843 | ), |
844 | 844 | 'cancelled_status' => array( |
845 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
846 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
845 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
846 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
847 | 847 | ) |
848 | 848 | ); |
849 | - return array_merge( $fc_items, $sc_items ); |
|
849 | + return array_merge($fc_items, $sc_items); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | |
@@ -859,15 +859,15 @@ discard block |
||
859 | 859 | |
860 | 860 | |
861 | 861 | protected function _registrations_overview_list_table() { |
862 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
863 | - if ( $EVT_ID ) { |
|
864 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
865 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
862 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
863 | + if ($EVT_ID) { |
|
864 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
865 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
866 | 866 | } |
867 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
868 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
867 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
868 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
869 | 869 | } |
870 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
870 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
871 | 871 | $this->display_admin_list_table_page_with_no_sidebar(); |
872 | 872 | } |
873 | 873 | |
@@ -882,19 +882,19 @@ discard block |
||
882 | 882 | */ |
883 | 883 | private function _set_registration_object() { |
884 | 884 | //get out if we've already set the object |
885 | - if ( is_object( $this->_registration )) { |
|
885 | + if (is_object($this->_registration)) { |
|
886 | 886 | return TRUE; |
887 | 887 | } |
888 | 888 | |
889 | 889 | $REG = EEM_Registration::instance(); |
890 | 890 | |
891 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
891 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
892 | 892 | |
893 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
893 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
894 | 894 | return TRUE; |
895 | 895 | else { |
896 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
897 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
896 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
897 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
898 | 898 | $this->_registration = NULL; |
899 | 899 | return FALSE; |
900 | 900 | } |
@@ -912,24 +912,24 @@ discard block |
||
912 | 912 | * @throws \EE_Error |
913 | 913 | * @return mixed (int|array) int = count || array of registration objects |
914 | 914 | */ |
915 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
916 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
917 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
918 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
919 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
920 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
921 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
915 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
916 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
917 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
918 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
919 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
920 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
921 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
922 | 922 | $start_date = FALSE; |
923 | 923 | $end_date = FALSE; |
924 | 924 | $_where = array(); |
925 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
926 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
925 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
926 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
927 | 927 | |
928 | 928 | //set orderby |
929 | 929 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
930 | 930 | |
931 | 931 | |
932 | - switch ( $this->_req_data['orderby'] ) { |
|
932 | + switch ($this->_req_data['orderby']) { |
|
933 | 933 | case '_REG_ID': |
934 | 934 | $orderby = 'REG_ID'; |
935 | 935 | break; |
@@ -949,26 +949,26 @@ discard block |
||
949 | 949 | $orderby = 'REG_date'; |
950 | 950 | } |
951 | 951 | |
952 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
953 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
954 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
952 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
953 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
954 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
955 | 955 | |
956 | 956 | |
957 | - $offset = ($current_page-1)*$per_page; |
|
958 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
957 | + $offset = ($current_page - 1) * $per_page; |
|
958 | + $limit = $count ? NULL : array($offset, $per_page); |
|
959 | 959 | |
960 | - if($EVT_ID){ |
|
961 | - $_where['EVT_ID']=$EVT_ID; |
|
960 | + if ($EVT_ID) { |
|
961 | + $_where['EVT_ID'] = $EVT_ID; |
|
962 | 962 | } |
963 | - if($CAT_ID){ |
|
963 | + if ($CAT_ID) { |
|
964 | 964 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
965 | 965 | } |
966 | - if ( $incomplete ) { |
|
966 | + if ($incomplete) { |
|
967 | 967 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
968 | 968 | } else if ( ! $trash) { |
969 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
969 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
970 | 970 | } |
971 | - if($reg_status){ |
|
971 | + if ($reg_status) { |
|
972 | 972 | $_where['STS_ID'] = $reg_status; |
973 | 973 | } |
974 | 974 | |
@@ -980,105 +980,105 @@ discard block |
||
980 | 980 | $time_start = ' 00:00:00'; |
981 | 981 | $time_end = ' 23:59:59'; |
982 | 982 | |
983 | - if($today_a || $today ){ |
|
983 | + if ($today_a || $today) { |
|
984 | 984 | $curdate = date('Y-m-d', current_time('timestamp')); |
985 | - $_where['REG_date']= array('BETWEEN', |
|
985 | + $_where['REG_date'] = array('BETWEEN', |
|
986 | 986 | array( |
987 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
988 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
987 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
988 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
989 | 989 | )); |
990 | - }elseif($this_month_a || $this_month){ |
|
990 | + }elseif ($this_month_a || $this_month) { |
|
991 | 991 | $this_month_r = date('m', current_time('timestamp')); |
992 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
993 | - $_where['REG_date']= array('BETWEEN', |
|
992 | + $days_this_month = date('t', current_time('timestamp')); |
|
993 | + $_where['REG_date'] = array('BETWEEN', |
|
994 | 994 | array( |
995 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
996 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
995 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
996 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
997 | 997 | )); |
998 | - }elseif($month_range){ |
|
998 | + }elseif ($month_range) { |
|
999 | 999 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1000 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
1001 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1002 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
1003 | - $_where['REG_date']= array('BETWEEN', |
|
1004 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
1005 | - }elseif($start_date && $end_date){ |
|
1000 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
1001 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1002 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
1003 | + $_where['REG_date'] = array('BETWEEN', |
|
1004 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
1005 | + }elseif ($start_date && $end_date) { |
|
1006 | 1006 | throw new EE_Error("not yet supported"); |
1007 | - }elseif($start_date){ |
|
1007 | + }elseif ($start_date) { |
|
1008 | 1008 | throw new EE_Error("not yet supported"); |
1009 | - }elseif($end_date){ |
|
1009 | + }elseif ($end_date) { |
|
1010 | 1010 | throw new EE_Error("not yet supported"); |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1014 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1013 | + if ( ! empty($this->_req_data['s'])) { |
|
1014 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1015 | 1015 | $_where['OR'] = array( |
1016 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1017 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1018 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1019 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1020 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1021 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1022 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1023 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1024 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1025 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1026 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1027 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1028 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1029 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1030 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1031 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1032 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1033 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1016 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1017 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1018 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1019 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1020 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1021 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1022 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1023 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1024 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1025 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1026 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1027 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1028 | + 'REG_code' => array('LIKE', $sstr), |
|
1029 | + 'REG_count' => array('LIKE', $sstr), |
|
1030 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1031 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1032 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1033 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1034 | 1034 | ); |
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | //capability checks |
1038 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1038 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1039 | 1039 | $_where['AND'] = array( |
1040 | 1040 | 'Event.EVT_wp_user' => get_current_user_id() |
1041 | 1041 | ); |
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | |
1045 | - if( $count ){ |
|
1046 | - if ( $trash ) { |
|
1047 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1048 | - } else if ( $incomplete ) { |
|
1049 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1045 | + if ($count) { |
|
1046 | + if ($trash) { |
|
1047 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1048 | + } else if ($incomplete) { |
|
1049 | + return EEM_Registration::instance()->count(array($_where)); |
|
1050 | 1050 | } else { |
1051 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1051 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1052 | 1052 | } |
1053 | 1053 | } else { |
1054 | 1054 | //make sure we remove default where conditions cause all registrations matching query are returned |
1055 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1056 | - if ( $per_page !== -1 ) { |
|
1055 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1056 | + if ($per_page !== -1) { |
|
1057 | 1057 | $query_params['limit'] = $limit; |
1058 | 1058 | } |
1059 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1059 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1060 | 1060 | |
1061 | 1061 | |
1062 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1062 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1063 | 1063 | $first_registration = $registrations[0]; |
1064 | 1064 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1065 | 1065 | $event_name = $first_registration->event_obj()->name(); |
1066 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1066 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1067 | 1067 | // edit event link |
1068 | - if ( $event_name != '' ) { |
|
1069 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1070 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1071 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1068 | + if ($event_name != '') { |
|
1069 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1070 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1071 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1075 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1074 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1075 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1076 | 1076 | |
1077 | 1077 | $this->_template_args['before_admin_page_content'] = ' |
1078 | 1078 | <div id="admin-page-header"> |
1079 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1080 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1081 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1079 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1080 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1081 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1082 | 1082 | </div> |
1083 | 1083 | '; |
1084 | 1084 | |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | $this->_set_registration_object(); |
1118 | 1118 | |
1119 | - if ( is_object( $this->_registration )) { |
|
1119 | + if (is_object($this->_registration)) { |
|
1120 | 1120 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1121 | 1121 | $this->_session = $transaction->session_data(); |
1122 | 1122 | |
@@ -1124,10 +1124,10 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | |
1126 | 1126 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1127 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1127 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1128 | 1128 | |
1129 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime( 'REG_date' ); |
|
1130 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1129 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
1130 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1131 | 1131 | |
1132 | 1132 | $this->_template_args['grand_total'] = $transaction->total(); |
1133 | 1133 | |
@@ -1135,19 +1135,19 @@ discard block |
||
1135 | 1135 | // link back to overview |
1136 | 1136 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1137 | 1137 | $this->_template_args['registration'] = $this->_registration; |
1138 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1139 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1140 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1138 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1139 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1140 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1141 | 1141 | |
1142 | 1142 | //next and previous links |
1143 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1144 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1145 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1146 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1143 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1144 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1145 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1146 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1147 | 1147 | |
1148 | 1148 | // grab header |
1149 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1150 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1149 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1150 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1151 | 1151 | |
1152 | 1152 | } else { |
1153 | 1153 | |
@@ -1166,17 +1166,17 @@ discard block |
||
1166 | 1166 | |
1167 | 1167 | |
1168 | 1168 | protected function _registration_details_metaboxes() { |
1169 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1169 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1170 | 1170 | $this->_set_registration_object(); |
1171 | 1171 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1172 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1173 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1174 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1175 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1172 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1173 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1174 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1175 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1176 | 1176 | } |
1177 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1178 | - if ( $this->_registration->group_size() > 1 ) { |
|
1179 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1177 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1178 | + if ($this->_registration->group_size() > 1) { |
|
1179 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1180 | 1180 | } |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1197,23 +1197,23 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | //let's get an array of all possible buttons that we can just reference |
1199 | 1199 | $status_buttons = $this->_get_reg_status_buttons(); |
1200 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1201 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1200 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1201 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1202 | 1202 | $template_args['attendee'] = $this->_registration->attendee(); |
1203 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1204 | - if ( $this->_set_registration_object() ) { |
|
1203 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1204 | + if ($this->_set_registration_object()) { |
|
1205 | 1205 | $current_status = $this->_registration->status_ID(); |
1206 | - unset( $status_buttons[$current_status] ); |
|
1207 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1208 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1206 | + unset($status_buttons[$current_status]); |
|
1207 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1208 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1209 | 1209 | } |
1210 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1210 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1211 | 1211 | } |
1212 | 1212 | $template_args['form_url'] = REG_ADMIN_URL; |
1213 | 1213 | $template_args['REG_ID'] = $this->_registration->ID(); |
1214 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1214 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1215 | 1215 | |
1216 | - EEH_Template::display_template( $template, $template_args ); |
|
1216 | + EEH_Template::display_template($template, $template_args); |
|
1217 | 1217 | |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1227,11 +1227,11 @@ discard block |
||
1227 | 1227 | private function _get_reg_status_buttons() { |
1228 | 1228 | |
1229 | 1229 | $buttons = array( |
1230 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1231 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1232 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1233 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1234 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1230 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1231 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1232 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1233 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1234 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1235 | 1235 | ); |
1236 | 1236 | return $buttons; |
1237 | 1237 | } |
@@ -1245,13 +1245,13 @@ discard block |
||
1245 | 1245 | * |
1246 | 1246 | * @return array (array with reg_id(s) updated and whether update was successful. |
1247 | 1247 | */ |
1248 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1249 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1248 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1249 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1250 | 1250 | |
1251 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1251 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1252 | 1252 | |
1253 | 1253 | //notify? |
1254 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1254 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1255 | 1255 | $this->_process_resend_registration(); |
1256 | 1256 | } |
1257 | 1257 | |
@@ -1269,19 +1269,19 @@ discard block |
||
1269 | 1269 | * @param bool $status |
1270 | 1270 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1271 | 1271 | */ |
1272 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1272 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1273 | 1273 | $success = true; |
1274 | 1274 | // set default status if none is passed |
1275 | 1275 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1276 | 1276 | |
1277 | 1277 | //typecast and sanitize reg_id |
1278 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1278 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1279 | 1279 | |
1280 | 1280 | //loop through REG_ID's and change status |
1281 | - foreach ( $reg_ids as $r_id ) { |
|
1282 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1283 | - if ( $registration instanceof EE_Registration ) { |
|
1284 | - $registration->set_status( $status ); |
|
1281 | + foreach ($reg_ids as $r_id) { |
|
1282 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1283 | + if ($registration instanceof EE_Registration) { |
|
1284 | + $registration->set_status($status); |
|
1285 | 1285 | $result = $registration->save(); |
1286 | 1286 | |
1287 | 1287 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | $this->_req_data['_REG_ID'] = $reg_ids; |
1294 | 1294 | |
1295 | 1295 | //return $success and processed registrations |
1296 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1296 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | |
@@ -1305,37 +1305,37 @@ discard block |
||
1305 | 1305 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1306 | 1306 | * @return void |
1307 | 1307 | */ |
1308 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1308 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1309 | 1309 | |
1310 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1310 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1311 | 1311 | |
1312 | 1312 | |
1313 | - $success = isset( $result['success'] ) && $result['success']; |
|
1313 | + $success = isset($result['success']) && $result['success']; |
|
1314 | 1314 | |
1315 | 1315 | //setup success message |
1316 | - if ( $success ) { |
|
1317 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1318 | - EE_Error::add_success( $msg ); |
|
1316 | + if ($success) { |
|
1317 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1318 | + EE_Error::add_success($msg); |
|
1319 | 1319 | } else { |
1320 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1320 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1323 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1324 | 1324 | //unset nonces |
1325 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1326 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1327 | - unset( $this->_req_data[$ref] ); |
|
1325 | + foreach ($this->_req_data as $ref => $value) { |
|
1326 | + if (strpos($ref, 'nonce') !== false) { |
|
1327 | + unset($this->_req_data[$ref]); |
|
1328 | 1328 | continue; |
1329 | 1329 | } |
1330 | 1330 | |
1331 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1331 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1332 | 1332 | $this->_req_data[$ref] = $value; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | //merge request vars so that the reloaded list table contains any existing filter query params |
1336 | - $route = array_merge( $this->_req_data, $route ); |
|
1336 | + $route = array_merge($this->_req_data, $route); |
|
1337 | 1337 | |
1338 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1338 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | |
@@ -1347,29 +1347,29 @@ discard block |
||
1347 | 1347 | protected function _change_reg_status() { |
1348 | 1348 | $this->_req_data['return'] = 'view_registration'; |
1349 | 1349 | //set notify based on whether the send notifications toggle is set or not |
1350 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1351 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1350 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1351 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1352 | 1352 | |
1353 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1354 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1355 | - $this->approve_registration( $notify ); |
|
1353 | + switch ($this->_req_data['_reg_status_id']) { |
|
1354 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1355 | + $this->approve_registration($notify); |
|
1356 | 1356 | break; |
1357 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1358 | - $this->pending_registration( $notify ); |
|
1357 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1358 | + $this->pending_registration($notify); |
|
1359 | 1359 | break; |
1360 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1361 | - $this->not_approve_registration( $notify ); |
|
1360 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1361 | + $this->not_approve_registration($notify); |
|
1362 | 1362 | break; |
1363 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1364 | - $this->decline_registration( $notify ); |
|
1363 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1364 | + $this->decline_registration($notify); |
|
1365 | 1365 | break; |
1366 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1367 | - $this->cancel_registration( $notify ); |
|
1366 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1367 | + $this->cancel_registration($notify); |
|
1368 | 1368 | break; |
1369 | 1369 | default : |
1370 | 1370 | $result['success'] = false; |
1371 | - unset( $this->_req_data['return'] ); |
|
1372 | - $this->_reg_status_change_return( '', false ); |
|
1371 | + unset($this->_req_data['return']); |
|
1372 | + $this->_reg_status_change_return('', false); |
|
1373 | 1373 | break; |
1374 | 1374 | } |
1375 | 1375 | } |
@@ -1382,8 +1382,8 @@ discard block |
||
1382 | 1382 | * @param bool $notify whether or not to notify the registrant about their approval. |
1383 | 1383 | * @return void |
1384 | 1384 | */ |
1385 | - protected function approve_registration( $notify = false ) { |
|
1386 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1385 | + protected function approve_registration($notify = false) { |
|
1386 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | * @param bool $notify whether or not to notify the registrant about their approval. |
1396 | 1396 | * @return void |
1397 | 1397 | */ |
1398 | - protected function decline_registration( $notify = false ) { |
|
1399 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1398 | + protected function decline_registration($notify = false) { |
|
1399 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | |
@@ -1408,8 +1408,8 @@ discard block |
||
1408 | 1408 | * @param bool $notify whether or not to notify the registrant about their approval. |
1409 | 1409 | * @return void |
1410 | 1410 | */ |
1411 | - protected function cancel_registration( $notify = false ) { |
|
1412 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1411 | + protected function cancel_registration($notify = false) { |
|
1412 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | |
@@ -1422,8 +1422,8 @@ discard block |
||
1422 | 1422 | * @param bool $notify whether or not to notify the registrant about their approval. |
1423 | 1423 | * @return void |
1424 | 1424 | */ |
1425 | - protected function not_approve_registration( $notify = false ) { |
|
1426 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1425 | + protected function not_approve_registration($notify = false) { |
|
1426 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | * @param bool $notify whether or not to notify the registrant about their approval. |
1435 | 1435 | * @return void |
1436 | 1436 | */ |
1437 | - protected function pending_registration( $notify = false ) { |
|
1438 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1437 | + protected function pending_registration($notify = false) { |
|
1438 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | |
@@ -1449,75 +1449,75 @@ discard block |
||
1449 | 1449 | public function _reg_details_meta_box() { |
1450 | 1450 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1451 | 1451 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1452 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1452 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1453 | 1453 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1454 | 1454 | $this->_session = $transaction->session_data(); |
1455 | 1455 | |
1456 | 1456 | $filters = new EE_Line_Item_Filter_Collection(); |
1457 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1458 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1459 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1457 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1458 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1459 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1460 | 1460 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1461 | 1461 | |
1462 | 1462 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1463 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1464 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1463 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1464 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1465 | 1465 | |
1466 | 1466 | |
1467 | 1467 | $attendee = $this->_registration->attendee(); |
1468 | 1468 | |
1469 | 1469 | |
1470 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), esc_html__( ' View Transaction', 'event_espresso' ), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1471 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), esc_html__( ' Resend Registration', 'event_espresso' ), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1470 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ?EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), esc_html__(' View Transaction', 'event_espresso'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1471 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ?EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), esc_html__(' Resend Registration', 'event_espresso'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1472 | 1472 | |
1473 | 1473 | |
1474 | 1474 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1475 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1475 | + $payment = $transaction->get_first_related('Payment'); |
|
1476 | 1476 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1477 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1477 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1478 | 1478 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1479 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1479 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1480 | 1480 | $reg_details = array( |
1481 | 1481 | 'payment_method' => $payment_method->name(), |
1482 | 1482 | 'response_msg' => $payment->gateway_response(), |
1483 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1483 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1484 | 1484 | 'registration_session' => $this->_registration->session_ID(), |
1485 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1486 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1485 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1486 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1487 | 1487 | ); |
1488 | 1488 | |
1489 | 1489 | |
1490 | - if ( isset( $reg_details['registration_id'] )) { |
|
1490 | + if (isset($reg_details['registration_id'])) { |
|
1491 | 1491 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1492 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1492 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1493 | 1493 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1494 | 1494 | } |
1495 | 1495 | |
1496 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1496 | + if (isset($reg_details['payment_method'])) { |
|
1497 | 1497 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1498 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1498 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1499 | 1499 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1500 | 1500 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1501 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1501 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1502 | 1502 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1506 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1506 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1507 | 1507 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1508 | 1508 | |
1509 | 1509 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1510 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1510 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1511 | 1511 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1512 | 1512 | |
1513 | 1513 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1514 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1514 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1515 | 1515 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1516 | 1516 | |
1517 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1517 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1518 | 1518 | |
1519 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1520 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1519 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1520 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1521 | 1521 | |
1522 | 1522 | } |
1523 | 1523 | |
@@ -1531,14 +1531,14 @@ discard block |
||
1531 | 1531 | */ |
1532 | 1532 | public function _reg_questions_meta_box() { |
1533 | 1533 | //allow someone to override this method entirely |
1534 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1535 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1536 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1534 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1535 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1536 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1537 | 1537 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1538 | 1538 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1539 | 1539 | |
1540 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1541 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1540 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1541 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1542 | 1542 | } |
1543 | 1543 | } |
1544 | 1544 | |
@@ -1552,12 +1552,12 @@ discard block |
||
1552 | 1552 | * @param string $output |
1553 | 1553 | * @return string |
1554 | 1554 | */ |
1555 | - public function form_before_question_group( $output ) { |
|
1555 | + public function form_before_question_group($output) { |
|
1556 | 1556 | EE_Error::doing_it_wrong( |
1557 | - __CLASS__ . '::' . __FUNCTION__, |
|
1558 | - __( 'This method would have been protected but was used on a filter callback' |
|
1557 | + __CLASS__.'::'.__FUNCTION__, |
|
1558 | + __('This method would have been protected but was used on a filter callback' |
|
1559 | 1559 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1560 | - 'event_espresso' ), |
|
1560 | + 'event_espresso'), |
|
1561 | 1561 | '4.8.32.rc.000' |
1562 | 1562 | ); |
1563 | 1563 | return ' |
@@ -1576,20 +1576,20 @@ discard block |
||
1576 | 1576 | * @param string $output |
1577 | 1577 | * @return string |
1578 | 1578 | */ |
1579 | - public function form_after_question_group( $output ) { |
|
1579 | + public function form_after_question_group($output) { |
|
1580 | 1580 | EE_Error::doing_it_wrong( |
1581 | - __CLASS__ . '::' . __FUNCTION__, |
|
1582 | - __( 'This method would have been protected but was used on a filter callback' |
|
1581 | + __CLASS__.'::'.__FUNCTION__, |
|
1582 | + __('This method would have been protected but was used on a filter callback' |
|
1583 | 1583 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1584 | - 'event_espresso' ), |
|
1584 | + 'event_espresso'), |
|
1585 | 1585 | '4.8.32.rc.000' |
1586 | 1586 | ); |
1587 | 1587 | return ' |
1588 | 1588 | <tr class="hide-if-no-js"> |
1589 | 1589 | <th> </th> |
1590 | 1590 | <td class="reg-admin-edit-attendee-question-td"> |
1591 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1592 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1591 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1592 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1593 | 1593 | <div class="dashicons dashicons-edit"></div> |
1594 | 1594 | </a> |
1595 | 1595 | </td> |
@@ -1609,18 +1609,18 @@ discard block |
||
1609 | 1609 | * @param string $label |
1610 | 1610 | * @return string |
1611 | 1611 | */ |
1612 | - public function form_form_field_label_wrap( $label ) { |
|
1612 | + public function form_form_field_label_wrap($label) { |
|
1613 | 1613 | EE_Error::doing_it_wrong( |
1614 | - __CLASS__ . '::' . __FUNCTION__, |
|
1615 | - __( 'This method would have been protected but was used on a filter callback' |
|
1614 | + __CLASS__.'::'.__FUNCTION__, |
|
1615 | + __('This method would have been protected but was used on a filter callback' |
|
1616 | 1616 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1617 | - 'event_espresso' ), |
|
1617 | + 'event_espresso'), |
|
1618 | 1618 | '4.8.32.rc.000' |
1619 | 1619 | ); |
1620 | 1620 | return ' |
1621 | 1621 | <tr> |
1622 | 1622 | <th> |
1623 | - ' . $label . ' |
|
1623 | + ' . $label.' |
|
1624 | 1624 | </th>'; |
1625 | 1625 | } |
1626 | 1626 | |
@@ -1634,17 +1634,17 @@ discard block |
||
1634 | 1634 | * @param string $input |
1635 | 1635 | * @return string |
1636 | 1636 | */ |
1637 | - public function form_form_field_input__wrap( $input ) { |
|
1637 | + public function form_form_field_input__wrap($input) { |
|
1638 | 1638 | EE_Error::doing_it_wrong( |
1639 | - __CLASS__ . '::' . __FUNCTION__, |
|
1640 | - __( 'This method would have been protected but was used on a filter callback' |
|
1639 | + __CLASS__.'::'.__FUNCTION__, |
|
1640 | + __('This method would have been protected but was used on a filter callback' |
|
1641 | 1641 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1642 | - 'event_espresso' ), |
|
1642 | + 'event_espresso'), |
|
1643 | 1643 | '4.8.32.rc.000' |
1644 | 1644 | ); |
1645 | 1645 | return ' |
1646 | 1646 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1647 | - ' . $input . ' |
|
1647 | + ' . $input.' |
|
1648 | 1648 | </td> |
1649 | 1649 | </tr>'; |
1650 | 1650 | } |
@@ -1658,14 +1658,14 @@ discard block |
||
1658 | 1658 | * @return void |
1659 | 1659 | */ |
1660 | 1660 | protected function _update_attendee_registration_form() { |
1661 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1662 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1663 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1664 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1665 | - if( $success ) { |
|
1661 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1662 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1663 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1664 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1665 | + if ($success) { |
|
1666 | 1666 | $what = __('Registration Form', 'event_espresso'); |
1667 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1668 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1667 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1668 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1669 | 1669 | } |
1670 | 1670 | } |
1671 | 1671 | } |
@@ -1676,11 +1676,11 @@ discard block |
||
1676 | 1676 | * @param int $REG_ID |
1677 | 1677 | * @return EE_Registration_Custom_Questions_Form |
1678 | 1678 | */ |
1679 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1680 | - if( ! $this->_reg_custom_questions_form ) { |
|
1681 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1682 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1683 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1679 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1680 | + if ( ! $this->_reg_custom_questions_form) { |
|
1681 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1682 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1683 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1684 | 1684 | } |
1685 | 1685 | return $this->_reg_custom_questions_form; |
1686 | 1686 | } |
@@ -1693,17 +1693,17 @@ discard block |
||
1693 | 1693 | * @param bool $REG_ID |
1694 | 1694 | * @return bool |
1695 | 1695 | */ |
1696 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1696 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1697 | 1697 | |
1698 | 1698 | if ( ! $REG_ID) { |
1699 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1699 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1700 | 1700 | } |
1701 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1702 | - $form->receive_form_submission( $this->_req_data ); |
|
1701 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1702 | + $form->receive_form_submission($this->_req_data); |
|
1703 | 1703 | $success = false; |
1704 | - if( $form->is_valid() ) { |
|
1705 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1706 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1704 | + if ($form->is_valid()) { |
|
1705 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1706 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1707 | 1707 | $where_conditions = array( |
1708 | 1708 | 'QST_ID' => $question_id, |
1709 | 1709 | 'REG_ID' => $REG_ID |
@@ -1711,19 +1711,19 @@ discard block |
||
1711 | 1711 | $possibly_new_values = array( |
1712 | 1712 | 'ANS_value' => $input->normalized_value() |
1713 | 1713 | ); |
1714 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1715 | - if( $answer instanceof EE_Answer ) { |
|
1716 | - $success = $answer->save( $possibly_new_values ); |
|
1714 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1715 | + if ($answer instanceof EE_Answer) { |
|
1716 | + $success = $answer->save($possibly_new_values); |
|
1717 | 1717 | } else { |
1718 | 1718 | //insert it then |
1719 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1720 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1719 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1720 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1721 | 1721 | $success = $answer->save(); |
1722 | 1722 | } |
1723 | 1723 | } |
1724 | 1724 | } |
1725 | 1725 | } else { |
1726 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1726 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1727 | 1727 | } |
1728 | 1728 | return $success; |
1729 | 1729 | } |
@@ -1741,30 +1741,30 @@ discard block |
||
1741 | 1741 | $registrations = $REG->get_all(array( |
1742 | 1742 | array( |
1743 | 1743 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1744 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1744 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1745 | 1745 | ), |
1746 | 1746 | 'force_join'=>array('Attendee'))); |
1747 | 1747 | |
1748 | 1748 | $this->_template_args['attendees'] = array(); |
1749 | 1749 | $this->_template_args['attendee_notice'] = ''; |
1750 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1751 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1750 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1751 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1752 | 1752 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1753 | 1753 | } else { |
1754 | 1754 | |
1755 | 1755 | $att_nmbr = 1; |
1756 | - foreach ( $registrations as $registration ) { |
|
1756 | + foreach ($registrations as $registration) { |
|
1757 | 1757 | /* @var $registration EE_Registration */ |
1758 | 1758 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1759 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1760 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1761 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1762 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1759 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1760 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1761 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1762 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1763 | 1763 | |
1764 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1764 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1765 | 1765 | |
1766 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1767 | - $this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name(); |
|
1766 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1767 | + $this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name(); |
|
1768 | 1768 | |
1769 | 1769 | $att_nmbr++; |
1770 | 1770 | } |
@@ -1774,8 +1774,8 @@ discard block |
||
1774 | 1774 | |
1775 | 1775 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1776 | 1776 | } |
1777 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1778 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1777 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1778 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1779 | 1779 | |
1780 | 1780 | } |
1781 | 1781 | |
@@ -1796,11 +1796,11 @@ discard block |
||
1796 | 1796 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1797 | 1797 | |
1798 | 1798 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1799 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1799 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1800 | 1800 | $primary_registration = $this->_registration->get_primary_registration(); |
1801 | 1801 | $primary_attendee = $primary_registration->attendee(); |
1802 | 1802 | |
1803 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1803 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1804 | 1804 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1805 | 1805 | $primary_registration = NULL; |
1806 | 1806 | } |
@@ -1809,27 +1809,27 @@ discard block |
||
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1812 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1813 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1814 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1812 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1813 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1814 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1815 | 1815 | $this->_template_args['phone'] = $attendee->phone(); |
1816 | 1816 | |
1817 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1817 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1818 | 1818 | |
1819 | 1819 | |
1820 | 1820 | //edit link |
1821 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1821 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1822 | 1822 | $this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso'); |
1823 | 1823 | |
1824 | 1824 | //create link |
1825 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1825 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1826 | 1826 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1827 | 1827 | |
1828 | 1828 | $this->_template_args['att_check'] = $att_check; |
1829 | 1829 | |
1830 | 1830 | |
1831 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1832 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1831 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1832 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1833 | 1833 | } |
1834 | 1834 | |
1835 | 1835 | |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | * @access protected |
1843 | 1843 | * @return void |
1844 | 1844 | */ |
1845 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1845 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1846 | 1846 | $REGM = EEM_Registration::instance(); |
1847 | 1847 | |
1848 | 1848 | $success = 1; |
@@ -1852,26 +1852,26 @@ discard block |
||
1852 | 1852 | $dtts = array(); |
1853 | 1853 | |
1854 | 1854 | //if empty _REG_ID then get out because there's nothing to do |
1855 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1855 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1856 | 1856 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1857 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1858 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1857 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1858 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1859 | 1859 | } |
1860 | 1860 | |
1861 | 1861 | //Checkboxes |
1862 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1862 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1863 | 1863 | // if array has more than one element than success message should be plural |
1864 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1864 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1865 | 1865 | // cycle thru checkboxes |
1866 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1866 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1867 | 1867 | |
1868 | 1868 | $REG = $REGM->get_one_by_ID($REG_ID); |
1869 | 1869 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1870 | - if ( $payment_count > 0 ) { |
|
1871 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1870 | + if ($payment_count > 0) { |
|
1871 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1872 | 1872 | $error = 1; |
1873 | 1873 | $success = 0; |
1874 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1874 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1875 | 1875 | continue; //can't trash this registration because it has payments. |
1876 | 1876 | } |
1877 | 1877 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1880,7 +1880,7 @@ discard block |
||
1880 | 1880 | $dtts = array_merge($dtts, $dtt); |
1881 | 1881 | |
1882 | 1882 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1883 | - if ( !$updated ) { |
|
1883 | + if ( ! $updated) { |
|
1884 | 1884 | $success = 0; |
1885 | 1885 | } else { |
1886 | 1886 | $success = 2; |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | $tickets[$ticket->ID()] = $ticket; |
1896 | 1896 | $dtts = $ticket->get_many_related('Datetime'); |
1897 | 1897 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1898 | - if ( ! $updated ) { |
|
1898 | + if ( ! $updated) { |
|
1899 | 1899 | $success = 0; |
1900 | 1900 | } |
1901 | 1901 | |
@@ -1905,10 +1905,10 @@ discard block |
||
1905 | 1905 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1906 | 1906 | EEM_Datetime::instance()->update_sold($dtts); |
1907 | 1907 | |
1908 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1909 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1908 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1909 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1910 | 1910 | $overwrite_msgs = $error ? TRUE : FALSE; |
1911 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1911 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | |
@@ -1932,16 +1932,16 @@ discard block |
||
1932 | 1932 | $success = 1; |
1933 | 1933 | |
1934 | 1934 | //Checkboxes |
1935 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1935 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1936 | 1936 | // if array has more than one element than success message should be plural |
1937 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1937 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1938 | 1938 | // cycle thru checkboxes |
1939 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1939 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1940 | 1940 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1941 | - if ( ! $REG instanceof EE_Registration ) |
|
1941 | + if ( ! $REG instanceof EE_Registration) |
|
1942 | 1942 | continue; |
1943 | 1943 | $deleted = $this->_delete_registration($REG); |
1944 | - if ( !$deleted ) { |
|
1944 | + if ( ! $deleted) { |
|
1945 | 1945 | $success = 0; |
1946 | 1946 | } |
1947 | 1947 | } |
@@ -1951,15 +1951,15 @@ discard block |
||
1951 | 1951 | $REG_ID = $this->_req_data['_REG_ID']; |
1952 | 1952 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1953 | 1953 | $deleted = $this->_delete_registration($REG); |
1954 | - if ( ! $deleted ) { |
|
1954 | + if ( ! $deleted) { |
|
1955 | 1955 | $success = 0; |
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | } |
1959 | 1959 | |
1960 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1961 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1962 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1960 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1961 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1962 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1963 | 1963 | } |
1964 | 1964 | |
1965 | 1965 | |
@@ -1971,31 +1971,31 @@ discard block |
||
1971 | 1971 | * @param EE_Registration $REG registration to be deleted permenantly |
1972 | 1972 | * @return boolean true = successful deletion, false = fail. |
1973 | 1973 | */ |
1974 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1974 | + protected function _delete_registration(EE_Registration $REG) { |
|
1975 | 1975 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1976 | 1976 | $TXN = $REG->get_first_related('Transaction'); |
1977 | 1977 | $REGS = $TXN->get_many_related('Registration'); |
1978 | 1978 | |
1979 | 1979 | $all_trashed = TRUE; |
1980 | - foreach ( $REGS as $registration ) { |
|
1981 | - if ( ! $registration->get('REG_deleted') ) |
|
1980 | + foreach ($REGS as $registration) { |
|
1981 | + if ( ! $registration->get('REG_deleted')) |
|
1982 | 1982 | $all_trashed = FALSE; |
1983 | 1983 | } |
1984 | 1984 | |
1985 | - if ( ! $all_trashed ) { |
|
1986 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1985 | + if ( ! $all_trashed) { |
|
1986 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1987 | 1987 | return false; |
1988 | 1988 | } |
1989 | 1989 | |
1990 | 1990 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1991 | - foreach ( $REGS as $registration ) { |
|
1991 | + foreach ($REGS as $registration) { |
|
1992 | 1992 | |
1993 | 1993 | //delete related answers |
1994 | 1994 | $registration->delete_related_permanently('Answer'); |
1995 | 1995 | |
1996 | 1996 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1997 | 1997 | $attendee = $registration->get_first_related('Attendee'); |
1998 | - if ( $attendee instanceof EE_Attendee ) { |
|
1998 | + if ($attendee instanceof EE_Attendee) { |
|
1999 | 1999 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2000 | 2000 | } |
2001 | 2001 | |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | //now delete permanently the checkins related to this registration. |
2006 | 2006 | $registration->delete_related_permanently('Checkin'); |
2007 | 2007 | |
2008 | - if ( $registration->ID() === $REG->ID() ) |
|
2008 | + if ($registration->ID() === $REG->ID()) |
|
2009 | 2009 | continue; //we don't want to delete permanently the existing registration just yet. |
2010 | 2010 | |
2011 | 2011 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2038,35 +2038,35 @@ discard block |
||
2038 | 2038 | * @return void |
2039 | 2039 | */ |
2040 | 2040 | public function new_registration() { |
2041 | - if ( ! $this->_set_reg_event() ) { |
|
2042 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2041 | + if ( ! $this->_set_reg_event()) { |
|
2042 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2043 | 2043 | } |
2044 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2044 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2045 | 2045 | // gotta start with a clean slate if we're not coming here via ajax |
2046 | 2046 | if ( |
2047 | - ! defined('DOING_AJAX' ) |
|
2048 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2047 | + ! defined('DOING_AJAX') |
|
2048 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2049 | 2049 | ) { |
2050 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2050 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2051 | 2051 | } |
2052 | 2052 | |
2053 | - $this->_template_args['event_name'] = '' ; |
|
2053 | + $this->_template_args['event_name'] = ''; |
|
2054 | 2054 | // event name |
2055 | - if ( $this->_reg_event ) { |
|
2055 | + if ($this->_reg_event) { |
|
2056 | 2056 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2057 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2058 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2059 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2057 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2058 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2059 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2060 | 2060 | } |
2061 | 2061 | |
2062 | 2062 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2063 | 2063 | |
2064 | - if ( defined('DOING_AJAX' ) ) { |
|
2064 | + if (defined('DOING_AJAX')) { |
|
2065 | 2065 | $this->_return_json(); |
2066 | 2066 | } |
2067 | 2067 | // grab header |
2068 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2069 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2068 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2069 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2070 | 2070 | |
2071 | 2071 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2072 | 2072 | // the details template wrapper |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | * @return string html |
2084 | 2084 | */ |
2085 | 2085 | protected function _get_registration_step_content() { |
2086 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2086 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2087 | 2087 | $warning_msg = sprintf( |
2088 | 2088 | __( |
2089 | 2089 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2099,7 +2099,7 @@ discard block |
||
2099 | 2099 | '</b>' |
2100 | 2100 | ); |
2101 | 2101 | return ' |
2102 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2102 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2103 | 2103 | <script > |
2104 | 2104 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2105 | 2105 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2134,16 +2134,16 @@ discard block |
||
2134 | 2134 | $cart = EE_Registry::instance()->SSN->cart(); |
2135 | 2135 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2136 | 2136 | |
2137 | - switch ( $step ) { |
|
2137 | + switch ($step) { |
|
2138 | 2138 | case 'ticket' : |
2139 | 2139 | $hidden_fields['processing_registration']['value'] = 1; |
2140 | 2140 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2141 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2141 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2142 | 2142 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2143 | 2143 | $template_args['show_notification_toggle'] = FALSE; |
2144 | 2144 | break; |
2145 | 2145 | case 'questions' : |
2146 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2146 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2147 | 2147 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2148 | 2148 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2149 | 2149 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2152,10 +2152,10 @@ discard block |
||
2152 | 2152 | break; |
2153 | 2153 | } |
2154 | 2154 | |
2155 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2155 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2156 | 2156 | |
2157 | 2157 | return EEH_Template::display_template( |
2158 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2158 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2159 | 2159 | ); |
2160 | 2160 | } |
2161 | 2161 | |
@@ -2170,11 +2170,11 @@ discard block |
||
2170 | 2170 | * @return boolean |
2171 | 2171 | */ |
2172 | 2172 | private function _set_reg_event() { |
2173 | - if ( is_object( $this->_reg_event )) { |
|
2173 | + if (is_object($this->_reg_event)) { |
|
2174 | 2174 | return TRUE; |
2175 | 2175 | } |
2176 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2177 | - if ( ! $EVT_ID ) { |
|
2176 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2177 | + if ( ! $EVT_ID) { |
|
2178 | 2178 | return FALSE; |
2179 | 2179 | } |
2180 | 2180 | |
@@ -2195,82 +2195,82 @@ discard block |
||
2195 | 2195 | public function process_reg_step() { |
2196 | 2196 | EE_System::do_not_cache(); |
2197 | 2197 | $this->_set_reg_event(); |
2198 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2198 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2199 | 2199 | |
2200 | 2200 | //what step are we on? |
2201 | 2201 | $cart = EE_Registry::instance()->SSN->cart(); |
2202 | 2202 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2203 | 2203 | |
2204 | 2204 | //if doing ajax then we need to verify the nonce |
2205 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2206 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2207 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2205 | + if (defined('DOING_AJAX')) { |
|
2206 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2207 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2208 | 2208 | } |
2209 | 2209 | |
2210 | - switch ( $step ) { |
|
2210 | + switch ($step) { |
|
2211 | 2211 | |
2212 | 2212 | case 'ticket' : |
2213 | 2213 | //process ticket selection |
2214 | 2214 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2215 | - if ( $success ) { |
|
2216 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2215 | + if ($success) { |
|
2216 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2217 | 2217 | } else { |
2218 | 2218 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2219 | 2219 | } |
2220 | - if ( defined('DOING_AJAX') ) { |
|
2220 | + if (defined('DOING_AJAX')) { |
|
2221 | 2221 | $this->new_registration(); //display next step |
2222 | 2222 | } else { |
2223 | 2223 | $query_args['action'] = 'new_registration'; |
2224 | 2224 | $query_args['processing_registration'] = 1; |
2225 | 2225 | $query_args['event_id'] = $this->_reg_event->ID(); |
2226 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2226 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2227 | 2227 | } |
2228 | 2228 | break; |
2229 | 2229 | |
2230 | 2230 | case 'questions' : |
2231 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2232 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2231 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2232 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2233 | 2233 | } |
2234 | 2234 | //process registration |
2235 | 2235 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2236 | - if ( $cart instanceof EE_Cart ) { |
|
2236 | + if ($cart instanceof EE_Cart) { |
|
2237 | 2237 | $grand_total = $cart->get_cart_grand_total(); |
2238 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2238 | + if ($grand_total instanceof EE_Line_Item) { |
|
2239 | 2239 | $grand_total->save_this_and_descendants_to_txn(); |
2240 | 2240 | } |
2241 | 2241 | } |
2242 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2242 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2243 | 2243 | $query_args = array( |
2244 | 2244 | 'action' => 'new_registration', |
2245 | 2245 | 'processing_registration' => 2, |
2246 | 2246 | 'event_id' => $this->_reg_event->ID() |
2247 | 2247 | ); |
2248 | 2248 | |
2249 | - if ( defined('DOING_AJAX' )) { |
|
2249 | + if (defined('DOING_AJAX')) { |
|
2250 | 2250 | //display registration form again because there are errors (maybe validation?) |
2251 | 2251 | $this->new_registration(); |
2252 | 2252 | return; |
2253 | 2253 | } else { |
2254 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2254 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2255 | 2255 | return; |
2256 | 2256 | } |
2257 | 2257 | } |
2258 | 2258 | /** @type EE_Transaction_Payments $transaction_payments */ |
2259 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2259 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2260 | 2260 | // maybe update status, and make sure to save transaction if not done already |
2261 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2261 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2262 | 2262 | $transaction->save(); |
2263 | 2263 | } |
2264 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2264 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2265 | 2265 | $this->_req_data = array(); |
2266 | 2266 | $query_args = array( |
2267 | 2267 | 'action' => 'redirect_to_txn', |
2268 | 2268 | 'TXN_ID' => $transaction->ID(), |
2269 | 2269 | 'EVT_ID' => $this->_reg_event->ID(), |
2270 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2270 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2271 | 2271 | 'redirect_from' => 'new_registration' |
2272 | 2272 | ); |
2273 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2273 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2274 | 2274 | break; |
2275 | 2275 | } |
2276 | 2276 | |
@@ -2287,21 +2287,21 @@ discard block |
||
2287 | 2287 | */ |
2288 | 2288 | public function redirect_to_txn() { |
2289 | 2289 | EE_System::do_not_cache(); |
2290 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2290 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2291 | 2291 | $query_args = array( |
2292 | 2292 | 'action' => 'view_transaction', |
2293 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2293 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2294 | 2294 | 'page' => 'espresso_transactions' |
2295 | 2295 | ); |
2296 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2297 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2298 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2299 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2296 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2297 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2298 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2299 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2300 | 2300 | } |
2301 | 2301 | EE_Error::add_success( |
2302 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2302 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2303 | 2303 | ); |
2304 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2304 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2305 | 2305 | } |
2306 | 2306 | |
2307 | 2307 | |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | * @return void |
2313 | 2313 | */ |
2314 | 2314 | protected function _attendee_contact_list_table() { |
2315 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2315 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2316 | 2316 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2317 | 2317 | $this->display_admin_list_table_page_with_no_sidebar(); |
2318 | 2318 | } |
@@ -2327,10 +2327,10 @@ discard block |
||
2327 | 2327 | * @access public |
2328 | 2328 | * @return array |
2329 | 2329 | */ |
2330 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2330 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2331 | 2331 | |
2332 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2333 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2332 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2333 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2334 | 2334 | $ATT_MDL = EEM_Attendee::instance(); |
2335 | 2335 | |
2336 | 2336 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2358,47 +2358,47 @@ discard block |
||
2358 | 2358 | $orderby = 'ATT_lname'; |
2359 | 2359 | } |
2360 | 2360 | |
2361 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2361 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2362 | 2362 | |
2363 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2364 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2365 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2363 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2364 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2365 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2366 | 2366 | |
2367 | 2367 | $_where = array(); |
2368 | 2368 | |
2369 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2370 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2369 | + if (isset($this->_req_data['s'])) { |
|
2370 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2371 | 2371 | $_where['OR'] = array( |
2372 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2373 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2374 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2375 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2376 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2377 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2378 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2379 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2380 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2381 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2382 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2383 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2384 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2385 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2386 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2387 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2388 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2372 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2373 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2374 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2375 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2376 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2377 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2378 | + 'ATT_email' => array('LIKE', $sstr), |
|
2379 | + 'ATT_address' => array('LIKE', $sstr), |
|
2380 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2381 | + 'ATT_city' => array('LIKE', $sstr), |
|
2382 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2383 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2384 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2385 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2386 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2387 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2388 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2389 | 2389 | ); |
2390 | 2390 | } |
2391 | 2391 | |
2392 | 2392 | |
2393 | - $offset = ($current_page-1)*$per_page; |
|
2394 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2393 | + $offset = ($current_page - 1) * $per_page; |
|
2394 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2395 | 2395 | |
2396 | - if ( $trash ) { |
|
2397 | - $_where['status'] = array( '!=', 'publish' ); |
|
2398 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2396 | + if ($trash) { |
|
2397 | + $_where['status'] = array('!=', 'publish'); |
|
2398 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2399 | 2399 | } else { |
2400 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2401 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2400 | + $_where['status'] = array('IN', array('publish')); |
|
2401 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | return $all_attendees; |
@@ -2415,10 +2415,10 @@ discard block |
||
2415 | 2415 | */ |
2416 | 2416 | protected function _resend_registration() { |
2417 | 2417 | $this->_process_resend_registration(); |
2418 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2418 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2419 | 2419 | 'action' => 'default' |
2420 | 2420 | ); |
2421 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2421 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2422 | 2422 | } |
2423 | 2423 | |
2424 | 2424 | |
@@ -2426,26 +2426,26 @@ discard block |
||
2426 | 2426 | |
2427 | 2427 | |
2428 | 2428 | |
2429 | - public function _registrations_report(){ |
|
2430 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2431 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2429 | + public function _registrations_report() { |
|
2430 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2431 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2432 | 2432 | array( |
2433 | 2433 | 'page' => 'espresso_batch', |
2434 | 2434 | 'batch' => 'file', |
2435 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2436 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2437 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2438 | - )) ); |
|
2435 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2436 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2437 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2438 | + ))); |
|
2439 | 2439 | } else { |
2440 | 2440 | $new_request_args = array( |
2441 | 2441 | 'export' => 'report', |
2442 | 2442 | 'action' => 'registrations_report_for_event', |
2443 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2443 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2444 | 2444 | ); |
2445 | 2445 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2446 | 2446 | |
2447 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2448 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2447 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2448 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2449 | 2449 | $EE_Export = EE_Export::instance($this->_req_data); |
2450 | 2450 | $EE_Export->export(); |
2451 | 2451 | } |
@@ -2454,26 +2454,26 @@ discard block |
||
2454 | 2454 | |
2455 | 2455 | |
2456 | 2456 | |
2457 | - public function _contact_list_export(){ |
|
2458 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2459 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2457 | + public function _contact_list_export() { |
|
2458 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2459 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2460 | 2460 | $EE_Export = EE_Export::instance($this->_req_data); |
2461 | 2461 | $EE_Export->export_attendees(); |
2462 | 2462 | } |
2463 | 2463 | } |
2464 | 2464 | |
2465 | - public function _contact_list_report(){ |
|
2466 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2467 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2465 | + public function _contact_list_report() { |
|
2466 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2467 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2468 | 2468 | array( |
2469 | 2469 | 'page' => 'espresso_batch', |
2470 | 2470 | 'batch' => 'file', |
2471 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2472 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2473 | - )) ); |
|
2471 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2472 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2473 | + ))); |
|
2474 | 2474 | } else { |
2475 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2476 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2475 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2476 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2477 | 2477 | $EE_Export = EE_Export::instance($this->_req_data); |
2478 | 2478 | $EE_Export->report_attendees(); |
2479 | 2479 | } |
@@ -2493,73 +2493,73 @@ discard block |
||
2493 | 2493 | * @return void |
2494 | 2494 | */ |
2495 | 2495 | protected function _duplicate_attendee() { |
2496 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2496 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2497 | 2497 | //verify we have necessary info |
2498 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2499 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2500 | - $query_args = array( 'action' => $action ); |
|
2498 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2499 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2500 | + $query_args = array('action' => $action); |
|
2501 | 2501 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2502 | 2502 | } |
2503 | 2503 | |
2504 | 2504 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2505 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2505 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2506 | 2506 | $attendee = $registration->attendee(); |
2507 | 2507 | |
2508 | 2508 | //remove relation of existing attendee on registration |
2509 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2509 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2510 | 2510 | //new attendee |
2511 | 2511 | $new_attendee = clone $attendee; |
2512 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2512 | + $new_attendee->set('ATT_ID', 0); |
|
2513 | 2513 | $new_attendee->save(); |
2514 | 2514 | |
2515 | 2515 | //add new attendee to reg |
2516 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2516 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2517 | 2517 | |
2518 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2518 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2519 | 2519 | |
2520 | 2520 | //redirect to edit page for attendee |
2521 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2521 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2522 | 2522 | |
2523 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2523 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2524 | 2524 | } |
2525 | 2525 | |
2526 | 2526 | |
2527 | 2527 | //related to cpt routes |
2528 | 2528 | protected function _insert_update_cpt_item($post_id, $post) { |
2529 | 2529 | $success = true; |
2530 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2530 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2531 | 2531 | //for attendee updates |
2532 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2532 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2533 | 2533 | //note we should only be UPDATING attendees at this point. |
2534 | 2534 | $updated_fields = array( |
2535 | 2535 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2536 | 2536 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2537 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2537 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2538 | 2538 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2539 | 2539 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2540 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2541 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2542 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2543 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2544 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2545 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2540 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2541 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2542 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2543 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2544 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2545 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2546 | 2546 | ); |
2547 | - foreach ( $updated_fields as $field => $value ) { |
|
2547 | + foreach ($updated_fields as $field => $value) { |
|
2548 | 2548 | $attendee->set($field, $value); |
2549 | 2549 | } |
2550 | 2550 | |
2551 | 2551 | $success = $attendee->save(); |
2552 | 2552 | |
2553 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2554 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2555 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2556 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2553 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2554 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2555 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2556 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2557 | 2557 | } |
2558 | 2558 | } |
2559 | 2559 | } |
2560 | 2560 | |
2561 | - if ( $success === FALSE ) |
|
2562 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2561 | + if ($success === FALSE) |
|
2562 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2563 | 2563 | |
2564 | 2564 | } |
2565 | 2565 | |
@@ -2579,17 +2579,17 @@ discard block |
||
2579 | 2579 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2580 | 2580 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2581 | 2581 | |
2582 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2583 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2582 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2583 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2584 | 2584 | } |
2585 | 2585 | |
2586 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2586 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2587 | 2587 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2588 | 2588 | } |
2589 | 2589 | |
2590 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2591 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2592 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2590 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2591 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2592 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2593 | 2593 | } |
2594 | 2594 | |
2595 | 2595 | |
@@ -2598,10 +2598,10 @@ discard block |
||
2598 | 2598 | * @param WP_Post $post wp post object |
2599 | 2599 | * @return string attendee contact info ( and form ) |
2600 | 2600 | */ |
2601 | - public function attendee_contact_info( $post ) { |
|
2601 | + public function attendee_contact_info($post) { |
|
2602 | 2602 | //get attendee object ( should already have it ) |
2603 | 2603 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2604 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2604 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2605 | 2605 | EEH_Template::display_template($template, $this->_template_args); |
2606 | 2606 | } |
2607 | 2607 | |
@@ -2617,12 +2617,12 @@ discard block |
||
2617 | 2617 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2618 | 2618 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2619 | 2619 | new EE_Question_Form_Input( |
2620 | - EE_Question::new_instance( array( |
|
2620 | + EE_Question::new_instance(array( |
|
2621 | 2621 | 'QST_ID' => 0, |
2622 | 2622 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2623 | 2623 | 'QST_system' => 'admin-state' |
2624 | 2624 | )), |
2625 | - EE_Answer::new_instance( array( |
|
2625 | + EE_Answer::new_instance(array( |
|
2626 | 2626 | 'ANS_ID' => 0, |
2627 | 2627 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2628 | 2628 | )), |
@@ -2635,12 +2635,12 @@ discard block |
||
2635 | 2635 | )); |
2636 | 2636 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2637 | 2637 | new EE_Question_Form_Input( |
2638 | - EE_Question::new_instance( array( |
|
2638 | + EE_Question::new_instance(array( |
|
2639 | 2639 | 'QST_ID' => 0, |
2640 | 2640 | 'QST_display_text' => __('Country', 'event_espresso'), |
2641 | 2641 | 'QST_system' => 'admin-country' |
2642 | 2642 | )), |
2643 | - EE_Answer::new_instance( array( |
|
2643 | + EE_Answer::new_instance(array( |
|
2644 | 2644 | 'ANS_ID' => 0, |
2645 | 2645 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2646 | 2646 | )), |
@@ -2651,8 +2651,8 @@ discard block |
||
2651 | 2651 | 'append_qstn_id' => FALSE |
2652 | 2652 | ) |
2653 | 2653 | )); |
2654 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2655 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2654 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2655 | + EEH_Template::display_template($template, $this->_template_args); |
|
2656 | 2656 | |
2657 | 2657 | } |
2658 | 2658 | |
@@ -2662,11 +2662,11 @@ discard block |
||
2662 | 2662 | * @access protected |
2663 | 2663 | * @return void |
2664 | 2664 | */ |
2665 | - public function attendee_registrations_meta_box( $post ) { |
|
2665 | + public function attendee_registrations_meta_box($post) { |
|
2666 | 2666 | |
2667 | 2667 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2668 | 2668 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2669 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2669 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2670 | 2670 | EEH_Template::display_template($template, $this->_template_args); |
2671 | 2671 | |
2672 | 2672 | } |
@@ -2680,8 +2680,8 @@ discard block |
||
2680 | 2680 | * @return string html for new form. |
2681 | 2681 | */ |
2682 | 2682 | public function after_title_form_fields($post) { |
2683 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2684 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2683 | + if ($post->post_type == 'espresso_attendees') { |
|
2684 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2685 | 2685 | $template_args['attendee'] = $this->_cpt_model_obj; |
2686 | 2686 | EEH_Template::display_template($template, $template_args); |
2687 | 2687 | } |
@@ -2698,21 +2698,21 @@ discard block |
||
2698 | 2698 | * @access protected |
2699 | 2699 | * @return void |
2700 | 2700 | */ |
2701 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2701 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2702 | 2702 | |
2703 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2703 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2704 | 2704 | |
2705 | 2705 | $ATT_MDL = EEM_Attendee::instance(); |
2706 | 2706 | |
2707 | 2707 | $success = 1; |
2708 | 2708 | //Checkboxes |
2709 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2709 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2710 | 2710 | // if array has more than one element than success message should be plural |
2711 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2711 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2712 | 2712 | // cycle thru checkboxes |
2713 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2714 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2715 | - if ( !$updated ) { |
|
2713 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2714 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2715 | + if ( ! $updated) { |
|
2716 | 2716 | $success = 0; |
2717 | 2717 | } |
2718 | 2718 | } |
@@ -2721,18 +2721,18 @@ discard block |
||
2721 | 2721 | // grab single id and delete |
2722 | 2722 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2723 | 2723 | //get attendee |
2724 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2724 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2725 | 2725 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2726 | 2726 | $updated = $att->save(); |
2727 | - if ( ! $updated ) { |
|
2727 | + if ( ! $updated) { |
|
2728 | 2728 | $success = 0; |
2729 | 2729 | } |
2730 | 2730 | |
2731 | 2731 | } |
2732 | 2732 | |
2733 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2734 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2735 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2733 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2734 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2735 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2736 | 2736 | |
2737 | 2737 | } |
2738 | 2738 |