@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage plugin api |
8 | 8 | */ |
9 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit('NO direct script access allowed'); } |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); } |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * EE_Register_Model_Extensions |
@@ -34,26 +34,26 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return void |
36 | 36 | */ |
37 | - public static function register( $model_id = NULL, $config = array() ) { |
|
37 | + public static function register($model_id = NULL, $config = array()) { |
|
38 | 38 | //required fields MUST be present, so let's make sure they are. |
39 | - if ( empty( $model_id ) || ! is_array( $config ) || ( empty( $config['model_extension_paths'] ) && empty( $config['class_extension_paths'] ) ) ) { |
|
40 | - throw new EE_Error( __( 'In order to register Model extensions with EE_Register_Model_Extensions::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_extension_paths" (an array of full server paths to folders that contain model extensions), and "class_extension_paths" (an array of full server paths to folders that contain class extensions)', 'event_espresso' )); |
|
39 | + if (empty($model_id) || ! is_array($config) || (empty($config['model_extension_paths']) && empty($config['class_extension_paths']))) { |
|
40 | + throw new EE_Error(__('In order to register Model extensions with EE_Register_Model_Extensions::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_extension_paths" (an array of full server paths to folders that contain model extensions), and "class_extension_paths" (an array of full server paths to folders that contain class extensions)', 'event_espresso')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | //make sure we don't register twice |
44 | - if( isset( self::$_registry[ $model_id ] ) ){ |
|
44 | + if (isset(self::$_registry[$model_id])) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | //check correct loading |
48 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_Admin__loaded' )) { |
|
48 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_Admin__loaded')) { |
|
49 | 49 | EE_Error::doing_it_wrong( |
50 | 50 | __METHOD__, |
51 | 51 | sprintf( |
52 | - __('An attempt was made to register "%1$s" as a Model extension has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.%2$s Hook Status: %2$s "AHEE__EE_System__load_espresso_addons" : %3$s %2$s "AHEE__EE_Admin__loaded" : %4$s%2$s','event_espresso'), |
|
52 | + __('An attempt was made to register "%1$s" as a Model extension has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.%2$s Hook Status: %2$s "AHEE__EE_System__load_espresso_addons" : %3$s %2$s "AHEE__EE_Admin__loaded" : %4$s%2$s', 'event_espresso'), |
|
53 | 53 | $model_id, |
54 | 54 | '<br />', |
55 | - did_action( 'AHEE__EE_System__load_espresso_addons' ) ? 'action done' : 'action NOT done', |
|
56 | - did_action( 'AHEE__EE_Admin__loaded' ) ? 'action done' : 'action NOT done' |
|
55 | + did_action('AHEE__EE_System__load_espresso_addons') ? 'action done' : 'action NOT done', |
|
56 | + did_action('AHEE__EE_Admin__loaded') ? 'action done' : 'action NOT done' |
|
57 | 57 | ), |
58 | 58 | '4.3' |
59 | 59 | ); |
@@ -63,26 +63,26 @@ discard block |
||
63 | 63 | self::$_extensions[$model_id] = array(); |
64 | 64 | EE_Registry::instance()->load_helper('File'); |
65 | 65 | |
66 | - if(isset($config['model_extension_paths'])){ |
|
66 | + if (isset($config['model_extension_paths'])) { |
|
67 | 67 | require_once(EE_LIBRARIES.'plugin_api/db/EEME_Base.lib.php'); |
68 | 68 | $class_to_filepath_map = EEH_File::get_contents_of_folders($config['model_extension_paths']); |
69 | 69 | EEH_Autoloader::register_autoloader($class_to_filepath_map); |
70 | - foreach(array_keys($class_to_filepath_map) as $classname){ |
|
70 | + foreach (array_keys($class_to_filepath_map) as $classname) { |
|
71 | 71 | self::$_extensions[$model_id]['models'][$classname] = new $classname; |
72 | 72 | } |
73 | 73 | unset($config['model_extension_paths']); |
74 | 74 | } |
75 | - if(isset($config['class_extension_paths'])){ |
|
75 | + if (isset($config['class_extension_paths'])) { |
|
76 | 76 | require_once(EE_LIBRARIES.'plugin_api/db/EEE_Base_Class.lib.php'); |
77 | 77 | $class_to_filepath_map = EEH_File::get_contents_of_folders($config['class_extension_paths']); |
78 | 78 | EEH_Autoloader::register_autoloader($class_to_filepath_map); |
79 | - foreach(array_keys($class_to_filepath_map) as $classname){ |
|
79 | + foreach (array_keys($class_to_filepath_map) as $classname) { |
|
80 | 80 | self::$_extensions[$model_id]['classes'][$classname] = new $classname; |
81 | 81 | } |
82 | 82 | unset($config['class_extension_paths']); |
83 | 83 | } |
84 | - foreach($config as $unknown_key => $unknown_config){ |
|
85 | - throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"),$unknown_key)); |
|
84 | + foreach ($config as $unknown_key => $unknown_config) { |
|
85 | + throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key)); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | * deregister |
92 | 92 | * @param string $model_id |
93 | 93 | */ |
94 | - public static function deregister( $model_id = NULL ){ |
|
95 | - if(isset(self::$_registry[$model_id])){ |
|
94 | + public static function deregister($model_id = NULL) { |
|
95 | + if (isset(self::$_registry[$model_id])) { |
|
96 | 96 | unset(self::$_registry[$model_id]); |
97 | - foreach(self::$_extensions[$model_id] as $extension_of_type){ |
|
98 | - foreach($extension_of_type as $extension ){ |
|
97 | + foreach (self::$_extensions[$model_id] as $extension_of_type) { |
|
98 | + foreach ($extension_of_type as $extension) { |
|
99 | 99 | $extension->deregister(); |
100 | 100 | } |
101 | 101 | } |
@@ -44,33 +44,33 @@ discard block |
||
44 | 44 | * @type array module_paths an array of full server paths to folders containing any EED_Modules, or to the EED_Module files themselves |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public static function register( $module_id = NULL, $setup_args = array() ) { |
|
47 | + public static function register($module_id = NULL, $setup_args = array()) { |
|
48 | 48 | |
49 | 49 | //required fields MUST be present, so let's make sure they are. |
50 | - if ( empty( $module_id ) || ! is_array( $setup_args ) || empty( $setup_args['module_paths'] )) { |
|
51 | - throw new EE_Error( __( 'In order to register Modules with EE_Register_Module::register(), you must include a "module_id" (a unique identifier for this set of modules), and an array containing the following keys: "module_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)', 'event_espresso' )); |
|
50 | + if (empty($module_id) || ! is_array($setup_args) || empty($setup_args['module_paths'])) { |
|
51 | + throw new EE_Error(__('In order to register Modules with EE_Register_Module::register(), you must include a "module_id" (a unique identifier for this set of modules), and an array containing the following keys: "module_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)', 'event_espresso')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | //make sure we don't register twice |
55 | - if( isset( self::$_settings[ $module_id ] ) ){ |
|
55 | + if (isset(self::$_settings[$module_id])) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | 59 | //make sure this was called in the right place! |
60 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) { |
|
60 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) { |
|
61 | 61 | EE_Error::doing_it_wrong( |
62 | 62 | __METHOD__, |
63 | - __( 'An attempt to register modules has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register modules.','event_espresso'), |
|
63 | + __('An attempt to register modules has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register modules.', 'event_espresso'), |
|
64 | 64 | '4.3.0' |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | //setup $_settings array from incoming values. |
68 | - self::$_settings[ $module_id ] = array( |
|
68 | + self::$_settings[$module_id] = array( |
|
69 | 69 | // array of full server paths to any EED_Modules used by the module |
70 | - 'module_paths' => isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(), |
|
70 | + 'module_paths' => isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(), |
|
71 | 71 | ); |
72 | 72 | // add to list of modules to be registered |
73 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( 'EE_Register_Module', 'add_modules' )); |
|
73 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array('EE_Register_Module', 'add_modules')); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param array $modules_to_register array of paths to all modules that require registering |
84 | 84 | * @return array |
85 | 85 | */ |
86 | - public static function add_modules( $modules_to_register ){ |
|
87 | - foreach( self::$_settings as $settings ) { |
|
88 | - $modules_to_register = array_merge( $modules_to_register, $settings['module_paths'] ); |
|
86 | + public static function add_modules($modules_to_register) { |
|
87 | + foreach (self::$_settings as $settings) { |
|
88 | + $modules_to_register = array_merge($modules_to_register, $settings['module_paths']); |
|
89 | 89 | } |
90 | 90 | return $modules_to_register; |
91 | 91 | } |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param string $module_id the name for the module that was previously registered |
102 | 102 | * @return void |
103 | 103 | */ |
104 | - public static function deregister( $module_id = NULL ) { |
|
105 | - if ( isset( self::$_settings[ $module_id ] )) { |
|
106 | - unset( self::$_settings[ $module_id ] ); |
|
104 | + public static function deregister($module_id = NULL) { |
|
105 | + if (isset(self::$_settings[$module_id])) { |
|
106 | + unset(self::$_settings[$module_id]); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 |
@@ -48,33 +48,33 @@ discard block |
||
48 | 48 | * @type array payment_method_paths an array of full server paths to folders containing any EE_PMT_Base children, or to the EED_Module files themselves |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public static function register( $payment_method_id = NULL, $setup_args = array() ) { |
|
51 | + public static function register($payment_method_id = NULL, $setup_args = array()) { |
|
52 | 52 | |
53 | 53 | //required fields MUST be present, so let's make sure they are. |
54 | - if ( empty( $payment_method_id ) || ! is_array( $setup_args ) || empty( $setup_args['payment_method_paths'] )) { |
|
55 | - throw new EE_Error( __( 'In order to register Payment Methods with EE_Register_Payment_Method::register(), you must include a "payment_method_id" (a unique identifier for this set of modules), and an array containing the following keys: "payment_method_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)', 'event_espresso' )); |
|
54 | + if (empty($payment_method_id) || ! is_array($setup_args) || empty($setup_args['payment_method_paths'])) { |
|
55 | + throw new EE_Error(__('In order to register Payment Methods with EE_Register_Payment_Method::register(), you must include a "payment_method_id" (a unique identifier for this set of modules), and an array containing the following keys: "payment_method_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)', 'event_espresso')); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | //make sure we don't register twice |
59 | - if( isset( self::$_settings[ $payment_method_id ] ) ){ |
|
59 | + if (isset(self::$_settings[$payment_method_id])) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | //make sure this was called in the right place! |
64 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) { |
|
64 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) { |
|
65 | 65 | EE_Error::doing_it_wrong( |
66 | 66 | __METHOD__, |
67 | - __( 'An attempt to register modules has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register modules.','event_espresso'), |
|
67 | + __('An attempt to register modules has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register modules.', 'event_espresso'), |
|
68 | 68 | '4.3.0' |
69 | 69 | ); |
70 | 70 | } |
71 | 71 | //setup $_settings array from incoming values. |
72 | - self::$_settings[ $payment_method_id ] = array( |
|
72 | + self::$_settings[$payment_method_id] = array( |
|
73 | 73 | // array of full server paths to any EE_PMT_Base children used |
74 | - 'payment_method_paths' => isset( $setup_args['payment_method_paths'] ) ? (array)$setup_args['payment_method_paths'] : array(), |
|
74 | + 'payment_method_paths' => isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(), |
|
75 | 75 | ); |
76 | 76 | // add to list of modules to be registered |
77 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( 'EE_Register_Payment_Method', 'add_payment_methods' )); |
|
77 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array('EE_Register_Payment_Method', 'add_payment_methods')); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * If EE_Payment_Method_Manager::register_payment_methods has already been called, we need it to be called again |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * will be called only once per payment method from an addon, so going with that assumption we should always do this. |
83 | 83 | * If that assumption is false, we should verify this newly-registered paymetn method isn't on the EE_Payment_Method_Manager::_payment_method_types array before calling this (this code should be changed to improve performance) |
84 | 84 | */ |
85 | - if ( did_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' ) ) { |
|
85 | + if (did_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods')) { |
|
86 | 86 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
87 | - EE_Payment_Method_Manager::instance()->maybe_register_payment_methods( TRUE ); |
|
87 | + EE_Payment_Method_Manager::instance()->maybe_register_payment_methods(TRUE); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * @param array $payment_method_folders array of paths to all payment methods that require registering |
98 | 98 | * @return array |
99 | 99 | */ |
100 | - public static function add_payment_methods( $payment_method_folders ){ |
|
101 | - foreach( self::$_settings as $settings ) { |
|
102 | - $payment_method_folders = array_merge( $payment_method_folders, $settings['payment_method_paths'] ); |
|
100 | + public static function add_payment_methods($payment_method_folders) { |
|
101 | + foreach (self::$_settings as $settings) { |
|
102 | + $payment_method_folders = array_merge($payment_method_folders, $settings['payment_method_paths']); |
|
103 | 103 | } |
104 | 104 | return $payment_method_folders; |
105 | 105 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * @param string $module_id the name for the module that was previously registered |
115 | 115 | * @return void |
116 | 116 | */ |
117 | - public static function deregister( $module_id = NULL ) { |
|
118 | - if ( isset( self::$_settings[ $module_id ] )) { |
|
119 | - unset( self::$_settings[ $module_id ] ); |
|
117 | + public static function deregister($module_id = NULL) { |
|
118 | + if (isset(self::$_settings[$module_id])) { |
|
119 | + unset(self::$_settings[$module_id]); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 |
@@ -44,33 +44,33 @@ discard block |
||
44 | 44 | * @throws EE_Error |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public static function register( $shortcode_id = NULL, $setup_args = array() ) { |
|
47 | + public static function register($shortcode_id = NULL, $setup_args = array()) { |
|
48 | 48 | |
49 | 49 | //required fields MUST be present, so let's make sure they are. |
50 | - if ( empty( $shortcode_id ) || ! is_array( $setup_args ) || empty( $setup_args['shortcode_paths'] )) { |
|
51 | - throw new EE_Error( __( 'In order to register Modules with EE_Register_Shortcode::register(), you must include a "shortcode_id" (a unique identifier for this set of shortcodes), and an array containing the following keys: "shortcode_paths" (an array of full server paths to folders that contain shortcodes, or to the shortcode files themselves)', 'event_espresso' )); |
|
50 | + if (empty($shortcode_id) || ! is_array($setup_args) || empty($setup_args['shortcode_paths'])) { |
|
51 | + throw new EE_Error(__('In order to register Modules with EE_Register_Shortcode::register(), you must include a "shortcode_id" (a unique identifier for this set of shortcodes), and an array containing the following keys: "shortcode_paths" (an array of full server paths to folders that contain shortcodes, or to the shortcode files themselves)', 'event_espresso')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | //make sure we don't register twice |
55 | - if( isset( self::$_settings[ $shortcode_id ] ) ){ |
|
55 | + if (isset(self::$_settings[$shortcode_id])) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | 59 | //make sure this was called in the right place! |
60 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) { |
|
60 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) { |
|
61 | 61 | EE_Error::doing_it_wrong( |
62 | 62 | __METHOD__, |
63 | - __( 'An attempt to register shortcodes has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register shortcodes.','event_espresso'), |
|
63 | + __('An attempt to register shortcodes has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register shortcodes.', 'event_espresso'), |
|
64 | 64 | '4.3.0' |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | //setup $_settings array from incoming values. |
68 | - self::$_settings[ $shortcode_id ] = array( |
|
68 | + self::$_settings[$shortcode_id] = array( |
|
69 | 69 | // array of full server paths to any EES_Shortcodes used by the shortcode |
70 | - 'shortcode_paths' => isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(), |
|
70 | + 'shortcode_paths' => isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(), |
|
71 | 71 | ); |
72 | 72 | // add to list of shortcodes to be registered |
73 | - add_filter( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', array( 'EE_Register_Shortcode', 'add_shortcodes' )); |
|
73 | + add_filter('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', array('EE_Register_Shortcode', 'add_shortcodes')); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param array $shortcodes_to_register array of paths to all shortcodes that require registering |
83 | 83 | * @return array |
84 | 84 | */ |
85 | - public static function add_shortcodes( $shortcodes_to_register ){ |
|
86 | - foreach( self::$_settings as $settings ) { |
|
87 | - $shortcodes_to_register = array_merge( $shortcodes_to_register, $settings['shortcode_paths'] ); |
|
85 | + public static function add_shortcodes($shortcodes_to_register) { |
|
86 | + foreach (self::$_settings as $settings) { |
|
87 | + $shortcodes_to_register = array_merge($shortcodes_to_register, $settings['shortcode_paths']); |
|
88 | 88 | } |
89 | 89 | return $shortcodes_to_register; |
90 | 90 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | * @param string $shortcode_id the name for the shortcode that was previously registered |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public static function deregister( $shortcode_id = NULL ) { |
|
104 | - if ( isset( self::$_settings[ $shortcode_id ] )) { |
|
105 | - unset( self::$_settings[ $shortcode_id ] ); |
|
103 | + public static function deregister($shortcode_id = NULL) { |
|
104 | + if (isset(self::$_settings[$shortcode_id])) { |
|
105 | + unset(self::$_settings[$shortcode_id]); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -44,34 +44,34 @@ discard block |
||
44 | 44 | * @throws EE_Error |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public static function register( $widget_id = NULL, $setup_args = array() ) { |
|
47 | + public static function register($widget_id = NULL, $setup_args = array()) { |
|
48 | 48 | |
49 | 49 | //required fields MUST be present, so let's make sure they are. |
50 | - if ( empty( $widget_id ) || ! is_array( $setup_args ) || empty( $setup_args['widget_paths'] )) { |
|
51 | - throw new EE_Error( __( 'In order to register Widgets with EE_Register_Widget::register(), you must include a "widget_id" (a unique identifier for this set of widgets), and an array containing the following keys: "widget_paths" (an array of full server paths to folders that contain widgets, or to the widget files themselves)', 'event_espresso' )); |
|
50 | + if (empty($widget_id) || ! is_array($setup_args) || empty($setup_args['widget_paths'])) { |
|
51 | + throw new EE_Error(__('In order to register Widgets with EE_Register_Widget::register(), you must include a "widget_id" (a unique identifier for this set of widgets), and an array containing the following keys: "widget_paths" (an array of full server paths to folders that contain widgets, or to the widget files themselves)', 'event_espresso')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | //make sure we don't register twice |
55 | - if( isset( self::$_settings[ $widget_id ] ) ){ |
|
55 | + if (isset(self::$_settings[$widget_id])) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | //make sure this was called in the right place! |
61 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) { |
|
61 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) { |
|
62 | 62 | EE_Error::doing_it_wrong( |
63 | 63 | __METHOD__, |
64 | - __( 'An attempt to register widgets has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register widgets.','event_espresso'), |
|
64 | + __('An attempt to register widgets has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register widgets.', 'event_espresso'), |
|
65 | 65 | '4.3.0' |
66 | 66 | ); |
67 | 67 | } |
68 | 68 | //setup $_settings array from incoming values. |
69 | - self::$_settings[ $widget_id ] = array( |
|
69 | + self::$_settings[$widget_id] = array( |
|
70 | 70 | // array of full server paths to any EED_Widgets used by the widget |
71 | - 'widget_paths' => isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(), |
|
71 | + 'widget_paths' => isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(), |
|
72 | 72 | ); |
73 | 73 | // add to list of widgets to be registered |
74 | - add_filter( 'FHEE__EE_Config__register_widgets__widgets_to_register', array( 'EE_Register_Widget', 'add_widgets' )); |
|
74 | + add_filter('FHEE__EE_Config__register_widgets__widgets_to_register', array('EE_Register_Widget', 'add_widgets')); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param array $widgets_to_register array of paths to all widgets that require registering |
84 | 84 | * @return array |
85 | 85 | */ |
86 | - public static function add_widgets( $widgets_to_register = array() ) { |
|
87 | - foreach( self::$_settings as $settings ) { |
|
88 | - $widgets_to_register = array_merge( $widgets_to_register, $settings['widget_paths'] ); |
|
86 | + public static function add_widgets($widgets_to_register = array()) { |
|
87 | + foreach (self::$_settings as $settings) { |
|
88 | + $widgets_to_register = array_merge($widgets_to_register, $settings['widget_paths']); |
|
89 | 89 | } |
90 | 90 | return $widgets_to_register; |
91 | 91 | } |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param string $widget_id the name for the widget that was previously registered |
102 | 102 | * @return void |
103 | 103 | */ |
104 | - public static function deregister( $widget_id = NULL ) { |
|
105 | - if ( isset( self::$_settings[ $widget_id ] )) { |
|
106 | - unset( self::$_settings[ $widget_id ] ); |
|
104 | + public static function deregister($widget_id = NULL) { |
|
105 | + if (isset(self::$_settings[$widget_id])) { |
|
106 | + unset(self::$_settings[$widget_id]); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected $_ = NULL; |
49 | 49 | |
50 | - public function __construct(){ |
|
51 | - if( ! $this->_model_name_extended){ |
|
50 | + public function __construct() { |
|
51 | + if ( ! $this->_model_name_extended) { |
|
52 | 52 | throw new EE_Error(sprintf(__("When declaring a class extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", "event_espresso"))); |
53 | 53 | } |
54 | - if(did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')){ |
|
55 | - throw new EE_Error(sprintf(__("Hooked in model object extension '%s' too late! The model object %s has already been used!", "event_espresso"),get_class($this),$this->_model_name_extended)); |
|
54 | + if (did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')) { |
|
55 | + throw new EE_Error(sprintf(__("Hooked in model object extension '%s' too late! The model object %s has already been used!", "event_espresso"), get_class($this), $this->_model_name_extended)); |
|
56 | 56 | } |
57 | 57 | $this->_register_extending_methods(); |
58 | 58 | } |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
62 | 62 | * model extended. (Internally uses filters, and the __call magic method) |
63 | 63 | */ |
64 | - protected function _register_extending_methods(){ |
|
64 | + protected function _register_extending_methods() { |
|
65 | 65 | $all_methods = get_class_methods(get_class($this)); |
66 | - foreach($all_methods as $method_name){ |
|
67 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
66 | + foreach ($all_methods as $method_name) { |
|
67 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
68 | 68 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
69 | 69 | $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
70 | - add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10); |
|
70 | + add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
76 | 76 | * model extended. (Internally uses filters, and the __call magic method) |
77 | 77 | */ |
78 | - public function deregister(){ |
|
78 | + public function deregister() { |
|
79 | 79 | $all_methods = get_class_methods(get_class($this)); |
80 | - foreach($all_methods as $method_name){ |
|
81 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
80 | + foreach ($all_methods as $method_name) { |
|
81 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
82 | 82 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
83 | 83 | $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
84 | - remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
|
84 | + remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | - public function __call($callback_method_name,$args){ |
|
91 | - if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
|
90 | + public function __call($callback_method_name, $args) { |
|
91 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
92 | 92 | //it's a dynamic callback for a method name |
93 | 93 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
94 | 94 | $original_return_val = $args[0]; |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $this->_ = $model_called; |
97 | 97 | $args_provided_to_method_on_model = $args[2]; |
98 | 98 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
99 | - if(method_exists($this, $extending_method)){ |
|
100 | - return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
|
101 | - }else{ |
|
102 | - throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method)); |
|
99 | + if (method_exists($this, $extending_method)) { |
|
100 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
101 | + } else { |
|
102 | + throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), $this->_model_name_extended, get_class($this), $extending_method, $extending_method)); |
|
103 | 103 | } |
104 | 104 | |
105 | - }else{ |
|
106 | - throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this))); |
|
105 | + } else { |
|
106 | + throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"), $callback_method_name, get_class($this))); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * |
@@ -159,11 +160,11 @@ discard block |
||
159 | 160 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
160 | 161 | if(method_exists($this, $extending_method)){ |
161 | 162 | return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
162 | - }else{ |
|
163 | + } else{ |
|
163 | 164 | throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method)); |
164 | 165 | } |
165 | 166 | |
166 | - }else{ |
|
167 | + } else{ |
|
167 | 168 | throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this))); |
168 | 169 | } |
169 | 170 | } |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * |
@@ -159,11 +160,11 @@ discard block |
||
159 | 160 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
160 | 161 | if(method_exists($this, $extending_method)){ |
161 | 162 | return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
162 | - }else{ |
|
163 | + } else{ |
|
163 | 164 | throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method)); |
164 | 165 | } |
165 | 166 | |
166 | - }else{ |
|
167 | + } else{ |
|
167 | 168 | throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this))); |
168 | 169 | } |
169 | 170 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -69,58 +69,58 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @throws \EE_Error |
71 | 71 | */ |
72 | - public function __construct(){ |
|
73 | - if( ! $this->_model_name_extended){ |
|
72 | + public function __construct() { |
|
73 | + if ( ! $this->_model_name_extended) { |
|
74 | 74 | throw new EE_Error(sprintf(__("When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", "event_espresso"))); |
75 | 75 | } |
76 | 76 | $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
77 | - if ( did_action( $construct_end_action )) { |
|
77 | + if (did_action($construct_end_action)) { |
|
78 | 78 | throw new EE_Error( |
79 | 79 | sprintf( |
80 | - __( "Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"), |
|
80 | + __("Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"), |
|
81 | 81 | get_class($this), |
82 | 82 | $this->_model_name_extended, |
83 | 83 | $construct_end_action |
84 | 84 | ) |
85 | 85 | ); |
86 | 86 | } |
87 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
88 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
89 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
87 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
88 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
89 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
90 | 90 | $this->_register_extending_methods(); |
91 | 91 | } |
92 | 92 | |
93 | - public function add_extra_tables_on_filter( $existing_tables ){ |
|
94 | - $tables = array_merge( $existing_tables, $this->_extra_tables ); |
|
93 | + public function add_extra_tables_on_filter($existing_tables) { |
|
94 | + $tables = array_merge($existing_tables, $this->_extra_tables); |
|
95 | 95 | return $tables; |
96 | 96 | } |
97 | - public function add_extra_fields_on_filter($existing_fields){ |
|
98 | - if( $this->_extra_fields){ |
|
99 | - foreach($this->_extra_fields as $table_alias => $fields){ |
|
100 | - if( ! isset( $existing_fields[ $table_alias ] ) ){ |
|
101 | - $existing_fields[ $table_alias ] = array(); |
|
97 | + public function add_extra_fields_on_filter($existing_fields) { |
|
98 | + if ($this->_extra_fields) { |
|
99 | + foreach ($this->_extra_fields as $table_alias => $fields) { |
|
100 | + if ( ! isset($existing_fields[$table_alias])) { |
|
101 | + $existing_fields[$table_alias] = array(); |
|
102 | 102 | } |
103 | - $existing_fields[$table_alias] = array_merge($existing_fields[$table_alias],$this->_extra_fields[$table_alias]); |
|
103 | + $existing_fields[$table_alias] = array_merge($existing_fields[$table_alias], $this->_extra_fields[$table_alias]); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | } |
107 | 107 | return $existing_fields; |
108 | 108 | } |
109 | - public function add_extra_relations_on_filter($existing_relations){ |
|
110 | - $relations = array_merge($existing_relations,$this->_extra_relations); |
|
109 | + public function add_extra_relations_on_filter($existing_relations) { |
|
110 | + $relations = array_merge($existing_relations, $this->_extra_relations); |
|
111 | 111 | return $relations; |
112 | 112 | } |
113 | 113 | /** |
114 | 114 | * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
115 | 115 | * model extended. (Internally uses filters, and the __call magic method) |
116 | 116 | */ |
117 | - protected function _register_extending_methods(){ |
|
117 | + protected function _register_extending_methods() { |
|
118 | 118 | $all_methods = get_class_methods(get_class($this)); |
119 | - foreach($all_methods as $method_name){ |
|
120 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
119 | + foreach ($all_methods as $method_name) { |
|
120 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
121 | 121 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
122 | 122 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
123 | - add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10); |
|
123 | + add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
@@ -129,27 +129,27 @@ discard block |
||
129 | 129 | * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
130 | 130 | * model extended. (Internally uses filters, and the __call magic method) |
131 | 131 | */ |
132 | - public function deregister(){ |
|
133 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
134 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
135 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
132 | + public function deregister() { |
|
133 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
134 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
135 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
136 | 136 | $all_methods = get_class_methods(get_class($this)); |
137 | - foreach($all_methods as $method_name){ |
|
138 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
137 | + foreach ($all_methods as $method_name) { |
|
138 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
139 | 139 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
140 | 140 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
141 | - remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
|
141 | + remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10); |
|
142 | 142 | } |
143 | 143 | } |
144 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
145 | - if ( class_exists( $model_to_reset ) ) { |
|
144 | + $model_to_reset = 'EEM_'.$this->_model_name_extended; |
|
145 | + if (class_exists($model_to_reset)) { |
|
146 | 146 | $model_to_reset::reset(); |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | - public function __call($callback_method_name,$args){ |
|
152 | - if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
|
151 | + public function __call($callback_method_name, $args) { |
|
152 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
153 | 153 | //it's a dynamic callback for a method name |
154 | 154 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
155 | 155 | $original_return_val = $args[0]; |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | $this->_ = $model_called; |
158 | 158 | $args_provided_to_method_on_model = $args[2]; |
159 | 159 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
160 | - if(method_exists($this, $extending_method)){ |
|
161 | - return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
|
162 | - }else{ |
|
163 | - throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method)); |
|
160 | + if (method_exists($this, $extending_method)) { |
|
161 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
162 | + } else { |
|
163 | + throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), $this->_model_name_extended, get_class($this), $extending_method, $extending_method)); |
|
164 | 164 | } |
165 | 165 | |
166 | - }else{ |
|
167 | - throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this))); |
|
166 | + } else { |
|
167 | + throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"), $callback_method_name, get_class($this))); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - protected function _parser( $shortcode ) { |
|
52 | - switch ( $shortcode ) { |
|
51 | + protected function _parser($shortcode) { |
|
52 | + switch ($shortcode) { |
|
53 | 53 | case '[ATTENDEE_LIST]' : |
54 | 54 | return $this->_get_attendee_list(); |
55 | 55 | break; |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | $this->_validate_list_requirements(); |
68 | 68 | $this->_set_shortcode_helper(); |
69 | 69 | |
70 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
70 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) |
|
71 | 71 | return $this->_get_attendee_list_for_main(); |
72 | 72 | |
73 | - else if ( $this->_data['data'] instanceof EE_Event ) |
|
73 | + else if ($this->_data['data'] instanceof EE_Event) |
|
74 | 74 | return $this->_get_attendee_list_for_event(); |
75 | 75 | |
76 | - else if ( $this->_data['data'] instanceof EE_Ticket ) |
|
76 | + else if ($this->_data['data'] instanceof EE_Ticket) |
|
77 | 77 | return $this->_get_registration_list_for_ticket(); |
78 | 78 | |
79 | 79 | //prevent recursive loop |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | |
95 | 95 | //now we need to loop through the attendee list and send data to the EE_Parser helper. |
96 | - foreach ( $data->reg_objs as $registration ) { |
|
96 | + foreach ($data->reg_objs as $registration) { |
|
97 | 97 | $attnds .= $this->_shortcode_helper->parse_attendee_list_template($template, $registration, $valid_shortcodes, $this->_extra_data); |
98 | 98 | } |
99 | 99 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | * @return string |
108 | 108 | */ |
109 | 109 | private function _get_attendee_list_for_event() { |
110 | - $valid_shortcodes = array('attendee', 'ticket_list', 'question_list', 'recipient_details' ); |
|
111 | - $template = is_array( $this->_data['template'] ) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
110 | + $valid_shortcodes = array('attendee', 'ticket_list', 'question_list', 'recipient_details'); |
|
111 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
112 | 112 | $event = $this->_data['data']; |
113 | 113 | |
114 | 114 | //let's remove any existing [EVENT_LIST] shortcode from the attendee list template so that we don't get recursion. |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $registrations = $this->_get_registrations_from_event($event); |
120 | 120 | |
121 | 121 | //each attendee in this case should be an attendee object. |
122 | - foreach ( $registrations as $registration ) { |
|
122 | + foreach ($registrations as $registration) { |
|
123 | 123 | $att_result .= $this->_shortcode_helper->parse_attendee_list_template($template, $registration, $valid_shortcodes, $this->_extra_data); |
124 | 124 | } |
125 | 125 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @return string |
134 | 134 | */ |
135 | 135 | private function _get_registration_list_for_ticket() { |
136 | - $valid_shortcodes = array( 'attendee', 'event_list', 'question_list', 'recipient_details' ); |
|
137 | - $template = is_array( $this->_data['template'] ) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
136 | + $valid_shortcodes = array('attendee', 'event_list', 'question_list', 'recipient_details'); |
|
137 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
138 | 138 | $ticket = $this->_data['data']; |
139 | 139 | |
140 | 140 | //let's remove any existing [TICKET_LIST] (or related) shortcode from the attendee list template so that we don't get recursion. |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | |
145 | 145 | //here we're setting up the attendees for the attendee_list template for THIS ticket. |
146 | 146 | $att_result = ''; |
147 | - $registrations = isset( $this->_extra_data['data']->tickets ) ? $this->_extra_data['data']->tickets[$ticket->ID()]['reg_objs'] : array(); |
|
147 | + $registrations = isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[$ticket->ID()]['reg_objs'] : array(); |
|
148 | 148 | |
149 | 149 | //each attendee in this case should be an attendee object. |
150 | - foreach ( $registrations as $registration ) { |
|
150 | + foreach ($registrations as $registration) { |
|
151 | 151 | $att_result .= $this->_shortcode_helper->parse_attendee_list_template($template, $registration, $valid_shortcodes, $this->_extra_data); |
152 | 152 | } |
153 | 153 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | |
160 | - private function _get_registrations_from_event( EE_Event $event ) { |
|
160 | + private function _get_registrations_from_event(EE_Event $event) { |
|
161 | 161 | return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['reg_objs'] : array(); |
162 | 162 | } |
163 | 163 |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -67,18 +68,18 @@ discard block |
||
67 | 68 | $this->_validate_list_requirements(); |
68 | 69 | $this->_set_shortcode_helper(); |
69 | 70 | |
70 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
71 | - return $this->_get_attendee_list_for_main(); |
|
72 | - |
|
73 | - else if ( $this->_data['data'] instanceof EE_Event ) |
|
74 | - return $this->_get_attendee_list_for_event(); |
|
75 | - |
|
76 | - else if ( $this->_data['data'] instanceof EE_Ticket ) |
|
77 | - return $this->_get_registration_list_for_ticket(); |
|
71 | + if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
72 | + return $this->_get_attendee_list_for_main(); |
|
73 | + } else if ( $this->_data['data'] instanceof EE_Event ) { |
|
74 | + return $this->_get_attendee_list_for_event(); |
|
75 | + } else if ( $this->_data['data'] instanceof EE_Ticket ) { |
|
76 | + return $this->_get_registration_list_for_ticket(); |
|
77 | + } |
|
78 | 78 | |
79 | 79 | //prevent recursive loop |
80 | - else |
|
81 | - return ''; |
|
80 | + else { |
|
81 | + return ''; |
|
82 | + } |
|
82 | 83 | } |
83 | 84 | |
84 | 85 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -60,34 +60,34 @@ discard block |
||
60 | 60 | '[ADDRESS2]' => __('Whatever was in the address 2 field for the registration.', 'event_espresso'), |
61 | 61 | '[CITY]' => __('The city for the registration.', 'event_espresso'), |
62 | 62 | '[ZIP_PC]' => __('The ZIP (or Postal) Code for the Registration.', 'event_espresso'), |
63 | - '[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso' ), |
|
63 | + '[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso'), |
|
64 | 64 | '[COUNTRY]' => __('The country for the registration.', 'event_espresso') |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | - protected function _parser( $shortcode ) { |
|
69 | + protected function _parser($shortcode) { |
|
70 | 70 | |
71 | 71 | |
72 | - $this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL; |
|
72 | + $this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL; |
|
73 | 73 | |
74 | 74 | //incoming object should only be a registration object. |
75 | 75 | $registration = ! $this->_data instanceof EE_Registration ? NULL : $this->_data; |
76 | 76 | |
77 | - if ( ! $registration instanceof EE_Registration ) { |
|
77 | + if ( ! $registration instanceof EE_Registration) { |
|
78 | 78 | //let's attempt to get the txn_id for the error message. |
79 | - $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' ); |
|
80 | - throw new EE_Error( __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' ) . '|' . sprintf( __('The transaction ID for this request is: %s', 'event_espresso' ), $txn_id ) ); |
|
79 | + $txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso'); |
|
80 | + throw new EE_Error(__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso').'|'.sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | //attendee obj for this registration |
84 | - $attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ; |
|
84 | + $attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null; |
|
85 | 85 | |
86 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
87 | - throw new EE_Error( __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' ) . '|' . sprintf( __('The registration ID for this request is: %s', 'event_espresso' ), $registration->ID() ) ); |
|
86 | + if ( ! $attendee instanceof EE_Attendee) { |
|
87 | + throw new EE_Error(__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso').'|'.sprintf(__('The registration ID for this request is: %s', 'event_espresso'), $registration->ID())); |
|
88 | 88 | } |
89 | 89 | |
90 | - switch ( $shortcode ) { |
|
90 | + switch ($shortcode) { |
|
91 | 91 | |
92 | 92 | case '[FNAME]' : |
93 | 93 | return $attendee->fname(); |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |