@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'FHEE__EE_System__parse_model_names' ) || did_action( 'FHEE__EE_System__parse_implemented_model_names' )) { |
58 | - EE_Error::doing_it_wrong( |
|
58 | + EE_Error::doing_it_wrong( |
|
59 | 59 | __METHOD__, |
60 | 60 | sprintf( |
61 | 61 | __('An attempt was made to register "%s" as a group models has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.','event_espresso'), |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ), |
64 | 64 | '4.5' |
65 | 65 | ); |
66 | - } |
|
66 | + } |
|
67 | 67 | self::$_model_registry[$model_id] = $config; |
68 | 68 | |
69 | 69 | EE_Registry::instance()->load_helper('File'); |
@@ -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 | /** |
@@ -43,22 +43,22 @@ discard block |
||
43 | 43 | * } |
44 | 44 | * @throws EE_Error |
45 | 45 | */ |
46 | - public static function register( $model_id = NULL, $config = array() ){ |
|
46 | + public static function register($model_id = NULL, $config = array()) { |
|
47 | 47 | //required fields MUST be present, so let's make sure they are. |
48 | - if ( empty( $model_id ) || ! is_array( $config ) || empty( $config['model_paths'] )) { |
|
49 | - throw new EE_Error( __( 'In order to register Models with EE_Register_Model::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_paths" (an array of full server paths to folders that contain models)', 'event_espresso' )); |
|
48 | + if (empty($model_id) || ! is_array($config) || empty($config['model_paths'])) { |
|
49 | + throw new EE_Error(__('In order to register Models with EE_Register_Model::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_paths" (an array of full server paths to folders that contain models)', 'event_espresso')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | //make sure we don't register twice |
53 | - if( isset( self::$_model_registry[ $model_id ] ) ){ |
|
53 | + if (isset(self::$_model_registry[$model_id])) { |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'FHEE__EE_System__parse_model_names' ) || did_action( 'FHEE__EE_System__parse_implemented_model_names' )) { |
|
57 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('FHEE__EE_System__parse_model_names') || did_action('FHEE__EE_System__parse_implemented_model_names')) { |
|
58 | 58 | EE_Error::doing_it_wrong( |
59 | 59 | __METHOD__, |
60 | 60 | sprintf( |
61 | - __('An attempt was made to register "%s" as a group models has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.','event_espresso'), |
|
61 | + __('An attempt was made to register "%s" as a group models has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.', 'event_espresso'), |
|
62 | 62 | $model_id |
63 | 63 | ), |
64 | 64 | '4.5' |
@@ -67,42 +67,42 @@ discard block |
||
67 | 67 | self::$_model_registry[$model_id] = $config; |
68 | 68 | |
69 | 69 | EE_Registry::instance()->load_helper('File'); |
70 | - if( ( isset( $config['model_paths'] ) && ! isset( $config['class_paths'] ) ) || |
|
71 | - ( ! isset( $config['model_paths'] ) && isset( $config['class_paths'] ) ) ){ |
|
72 | - throw new EE_Error( sprintf( __( 'You must register both "model_paths" AND "class_paths", not just one or the other You provided %s', 'event_espresso' ), implode(", ", array_keys( $config ) ) ) ); |
|
70 | + if ((isset($config['model_paths']) && ! isset($config['class_paths'])) || |
|
71 | + ( ! isset($config['model_paths']) && isset($config['class_paths']))) { |
|
72 | + throw new EE_Error(sprintf(__('You must register both "model_paths" AND "class_paths", not just one or the other You provided %s', 'event_espresso'), implode(", ", array_keys($config)))); |
|
73 | 73 | } |
74 | - if(isset($config['model_paths'])){ |
|
74 | + if (isset($config['model_paths'])) { |
|
75 | 75 | //make sure they passed in an array |
76 | - if( ! is_array( $config['model_paths'] ) ){ |
|
77 | - $config['model_paths'] = array( $config['model_paths'] ); |
|
76 | + if ( ! is_array($config['model_paths'])) { |
|
77 | + $config['model_paths'] = array($config['model_paths']); |
|
78 | 78 | } |
79 | 79 | //we want to add this as a model folder |
80 | 80 | //and autoload them all |
81 | 81 | $class_to_filepath_map = EEH_File::get_contents_of_folders($config['model_paths']); |
82 | 82 | EEH_Autoloader::register_autoloader($class_to_filepath_map); |
83 | 83 | $model_name_to_classname_map = array(); |
84 | - foreach(array_keys($class_to_filepath_map) as $classname){ |
|
85 | - $model_name_to_classname_map[str_replace("EEM_","",$classname)] = $classname; |
|
84 | + foreach (array_keys($class_to_filepath_map) as $classname) { |
|
85 | + $model_name_to_classname_map[str_replace("EEM_", "", $classname)] = $classname; |
|
86 | 86 | } |
87 | 87 | self::$_model_name_to_classname_map[$model_id] = $model_name_to_classname_map; |
88 | - add_filter('FHEE__EE_System__parse_model_names', array('EE_Register_Model','add_addon_models')); |
|
89 | - add_filter('FHEE__EE_System__parse_implemented_model_names', array('EE_Register_Model','add_addon_models')); |
|
90 | - add_filter('FHEE__EE_Registry__load_model__paths',array('EE_Register_Model','add_model_folders')); |
|
88 | + add_filter('FHEE__EE_System__parse_model_names', array('EE_Register_Model', 'add_addon_models')); |
|
89 | + add_filter('FHEE__EE_System__parse_implemented_model_names', array('EE_Register_Model', 'add_addon_models')); |
|
90 | + add_filter('FHEE__EE_Registry__load_model__paths', array('EE_Register_Model', 'add_model_folders')); |
|
91 | 91 | unset($config['model_paths']); |
92 | 92 | } |
93 | - if(isset($config['class_paths'])){ |
|
93 | + if (isset($config['class_paths'])) { |
|
94 | 94 | //make sure they passed in an array |
95 | - if( ! is_array( $config['class_paths'] ) ){ |
|
96 | - $config['class_paths'] = array( $config['class_paths'] ); |
|
95 | + if ( ! is_array($config['class_paths'])) { |
|
96 | + $config['class_paths'] = array($config['class_paths']); |
|
97 | 97 | } |
98 | 98 | $class_to_filepath_map = EEH_File::get_contents_of_folders($config['class_paths']); |
99 | 99 | EEH_Autoloader::register_autoloader($class_to_filepath_map); |
100 | - add_filter('FHEE__EE_Registry__load_class__paths',array('EE_Register_Model','add_class_folders')); |
|
100 | + add_filter('FHEE__EE_Registry__load_class__paths', array('EE_Register_Model', 'add_class_folders')); |
|
101 | 101 | unset($config['class_paths']); |
102 | 102 | } |
103 | - foreach($config as $unknown_key => $unknown_config){ |
|
104 | - self::deregister( $model_id ); |
|
105 | - throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"),$unknown_key)); |
|
103 | + foreach ($config as $unknown_key => $unknown_config) { |
|
104 | + self::deregister($model_id); |
|
105 | + throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key)); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | * @param array $core_models |
112 | 112 | * @return array keys are model names (eg 'Event') and values are their classes (eg 'EE_Event') |
113 | 113 | */ |
114 | - public static function add_addon_models( $core_models = array() ){ |
|
115 | - foreach(self::$_model_name_to_classname_map as $model_name_to_class_map){ |
|
116 | - $core_models = array_merge($core_models,$model_name_to_class_map); |
|
114 | + public static function add_addon_models($core_models = array()) { |
|
115 | + foreach (self::$_model_name_to_classname_map as $model_name_to_class_map) { |
|
116 | + $core_models = array_merge($core_models, $model_name_to_class_map); |
|
117 | 117 | } |
118 | 118 | return $core_models; |
119 | 119 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | * @param array $folders |
123 | 123 | * @return array of folder paths |
124 | 124 | */ |
125 | - public static function add_model_folders( $folders = array() ){ |
|
126 | - foreach(self::$_model_registry as $config){ |
|
127 | - if(isset($config['model_paths'])){ |
|
128 | - $folders = array_merge($folders,$config['model_paths']); |
|
125 | + public static function add_model_folders($folders = array()) { |
|
126 | + foreach (self::$_model_registry as $config) { |
|
127 | + if (isset($config['model_paths'])) { |
|
128 | + $folders = array_merge($folders, $config['model_paths']); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | return $folders; |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | * @param array $folders |
136 | 136 | * @return array of folder paths |
137 | 137 | */ |
138 | - public static function add_class_folders( $folders = array() ){ |
|
139 | - foreach(self::$_model_registry as $config){ |
|
140 | - if(isset($config['class_paths'])){ |
|
141 | - $folders = array_merge( $folders, $config['class_paths'] ); |
|
138 | + public static function add_class_folders($folders = array()) { |
|
139 | + foreach (self::$_model_registry as $config) { |
|
140 | + if (isset($config['class_paths'])) { |
|
141 | + $folders = array_merge($folders, $config['class_paths']); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | return $folders; |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * deregister |
151 | 151 | * @param string $model_id |
152 | 152 | */ |
153 | - public static function deregister( $model_id = NULL ){ |
|
154 | - if( isset( self::$_model_registry[ $model_id ] ) ){ |
|
155 | - unset( self::$_model_registry[ $model_id ] ); |
|
156 | - unset( self::$_model_name_to_classname_map[ $model_id ] ); |
|
153 | + public static function deregister($model_id = NULL) { |
|
154 | + if (isset(self::$_model_registry[$model_id])) { |
|
155 | + unset(self::$_model_registry[$model_id]); |
|
156 | + unset(self::$_model_name_to_classname_map[$model_id]); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
@@ -1,7 +1,8 @@ |
||
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 | * Event Espresso |
7 | 8 | * |
@@ -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 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct(){ |
73 | 73 | if( ! $this->_model_name_extended){ |
74 | - throw new EE_Error( |
|
75 | - __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | - "event_espresso" ) |
|
77 | - ); |
|
74 | + throw new EE_Error( |
|
75 | + __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | + "event_espresso" ) |
|
77 | + ); |
|
78 | 78 | } |
79 | 79 | $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
80 | 80 | if ( did_action( $construct_end_action )) { |
@@ -95,30 +95,30 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | - /** |
|
99 | - * @param array $existing_tables |
|
100 | - * @return array |
|
101 | - */ |
|
102 | - public function add_extra_tables_on_filter( $existing_tables ){ |
|
103 | - return array_merge( (array)$existing_tables, $this->_extra_tables ); |
|
98 | + /** |
|
99 | + * @param array $existing_tables |
|
100 | + * @return array |
|
101 | + */ |
|
102 | + public function add_extra_tables_on_filter( $existing_tables ){ |
|
103 | + return array_merge( (array)$existing_tables, $this->_extra_tables ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * @param array $existing_fields |
|
110 | - * @return array |
|
111 | - */ |
|
112 | - public function add_extra_fields_on_filter( $existing_fields ){ |
|
108 | + /** |
|
109 | + * @param array $existing_fields |
|
110 | + * @return array |
|
111 | + */ |
|
112 | + public function add_extra_fields_on_filter( $existing_fields ){ |
|
113 | 113 | if( $this->_extra_fields){ |
114 | 114 | foreach($this->_extra_fields as $table_alias => $fields){ |
115 | 115 | if( ! isset( $existing_fields[ $table_alias ] ) ){ |
116 | 116 | $existing_fields[ $table_alias ] = array(); |
117 | 117 | } |
118 | 118 | $existing_fields[$table_alias] = array_merge( |
119 | - (array)$existing_fields[$table_alias], |
|
120 | - $this->_extra_fields[$table_alias] |
|
121 | - ); |
|
119 | + (array)$existing_fields[$table_alias], |
|
120 | + $this->_extra_fields[$table_alias] |
|
121 | + ); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | } |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | |
130 | - /** |
|
131 | - * @param array $existing_relations |
|
132 | - * @return array |
|
133 | - */ |
|
134 | - public function add_extra_relations_on_filter( $existing_relations ){ |
|
135 | - return array_merge((array)$existing_relations,$this->_extra_relations); |
|
130 | + /** |
|
131 | + * @param array $existing_relations |
|
132 | + * @return array |
|
133 | + */ |
|
134 | + public function add_extra_relations_on_filter( $existing_relations ){ |
|
135 | + return array_merge((array)$existing_relations,$this->_extra_relations); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
169 | 169 | } |
170 | 170 | } |
171 | - /** @var EEM_Base $model_to_reset */ |
|
172 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
171 | + /** @var EEM_Base $model_to_reset */ |
|
172 | + $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
173 | 173 | if ( class_exists( $model_to_reset ) ) { |
174 | 174 | $model_to_reset::reset(); |
175 | 175 | } |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | - /** |
|
181 | - * @param string $callback_method_name |
|
182 | - * @param array $args |
|
183 | - * @return mixed |
|
184 | - * @throws EE_Error |
|
185 | - */ |
|
186 | - public function __call( $callback_method_name, $args){ |
|
180 | + /** |
|
181 | + * @param string $callback_method_name |
|
182 | + * @param array $args |
|
183 | + * @return mixed |
|
184 | + * @throws EE_Error |
|
185 | + */ |
|
186 | + public function __call( $callback_method_name, $args){ |
|
187 | 187 | if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
188 | 188 | //it's a dynamic callback for a method name |
189 | 189 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
@@ -194,23 +194,23 @@ discard block |
||
194 | 194 | return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
195 | 195 | }else{ |
196 | 196 | throw new EE_Error( |
197 | - sprintf( |
|
198 | - __("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"), |
|
199 | - $this->_model_name_extended, |
|
200 | - get_class($this), |
|
201 | - $extending_method,$extending_method |
|
202 | - ) |
|
203 | - ); |
|
197 | + sprintf( |
|
198 | + __("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"), |
|
199 | + $this->_model_name_extended, |
|
200 | + get_class($this), |
|
201 | + $extending_method,$extending_method |
|
202 | + ) |
|
203 | + ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | }else{ |
207 | 207 | throw new EE_Error( |
208 | - sprintf( |
|
209 | - __("There is no method named '%s' on '%s'", "event_espresso"), |
|
210 | - $callback_method_name, |
|
211 | - get_class($this) |
|
212 | - ) |
|
213 | - ); |
|
208 | + sprintf( |
|
209 | + __("There is no method named '%s' on '%s'", "event_espresso"), |
|
210 | + $callback_method_name, |
|
211 | + get_class($this) |
|
212 | + ) |
|
213 | + ); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 |
@@ -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,27 +69,27 @@ 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( |
75 | - __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | - "event_espresso" ) |
|
75 | + __("When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | + "event_espresso") |
|
77 | 77 | ); |
78 | 78 | } |
79 | 79 | $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
80 | - if ( did_action( $construct_end_action )) { |
|
80 | + if (did_action($construct_end_action)) { |
|
81 | 81 | throw new EE_Error( |
82 | 82 | sprintf( |
83 | - __( "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"), |
|
83 | + __("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"), |
|
84 | 84 | get_class($this), |
85 | 85 | $this->_model_name_extended, |
86 | 86 | $construct_end_action |
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | } |
90 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
91 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
92 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
90 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
91 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
92 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
93 | 93 | $this->_register_extending_methods(); |
94 | 94 | } |
95 | 95 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param array $existing_tables |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - public function add_extra_tables_on_filter( $existing_tables ){ |
|
103 | - return array_merge( (array)$existing_tables, $this->_extra_tables ); |
|
102 | + public function add_extra_tables_on_filter($existing_tables) { |
|
103 | + return array_merge((array) $existing_tables, $this->_extra_tables); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | * @param array $existing_fields |
110 | 110 | * @return array |
111 | 111 | */ |
112 | - public function add_extra_fields_on_filter( $existing_fields ){ |
|
113 | - if( $this->_extra_fields){ |
|
114 | - foreach($this->_extra_fields as $table_alias => $fields){ |
|
115 | - if( ! isset( $existing_fields[ $table_alias ] ) ){ |
|
116 | - $existing_fields[ $table_alias ] = array(); |
|
112 | + public function add_extra_fields_on_filter($existing_fields) { |
|
113 | + if ($this->_extra_fields) { |
|
114 | + foreach ($this->_extra_fields as $table_alias => $fields) { |
|
115 | + if ( ! isset($existing_fields[$table_alias])) { |
|
116 | + $existing_fields[$table_alias] = array(); |
|
117 | 117 | } |
118 | 118 | $existing_fields[$table_alias] = array_merge( |
119 | - (array)$existing_fields[$table_alias], |
|
119 | + (array) $existing_fields[$table_alias], |
|
120 | 120 | $this->_extra_fields[$table_alias] |
121 | 121 | ); |
122 | 122 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param array $existing_relations |
132 | 132 | * @return array |
133 | 133 | */ |
134 | - public function add_extra_relations_on_filter( $existing_relations ){ |
|
135 | - return array_merge((array)$existing_relations,$this->_extra_relations); |
|
134 | + public function add_extra_relations_on_filter($existing_relations) { |
|
135 | + return array_merge((array) $existing_relations, $this->_extra_relations); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
142 | 142 | * model extended. (Internally uses filters, and the __call magic method) |
143 | 143 | */ |
144 | - protected function _register_extending_methods(){ |
|
144 | + protected function _register_extending_methods() { |
|
145 | 145 | $all_methods = get_class_methods(get_class($this)); |
146 | - foreach($all_methods as $method_name){ |
|
147 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
146 | + foreach ($all_methods as $method_name) { |
|
147 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
148 | 148 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
149 | 149 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
150 | - add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10); |
|
150 | + add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
@@ -156,21 +156,21 @@ discard block |
||
156 | 156 | * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
157 | 157 | * model extended. (Internally uses filters, and the __call magic method) |
158 | 158 | */ |
159 | - public function deregister(){ |
|
160 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
161 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
162 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
159 | + public function deregister() { |
|
160 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
161 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
162 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
163 | 163 | $all_methods = get_class_methods(get_class($this)); |
164 | - foreach($all_methods as $method_name){ |
|
165 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
164 | + foreach ($all_methods as $method_name) { |
|
165 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
166 | 166 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
167 | 167 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
168 | - remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
|
168 | + remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | /** @var EEM_Base $model_to_reset */ |
172 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
173 | - if ( class_exists( $model_to_reset ) ) { |
|
172 | + $model_to_reset = 'EEM_'.$this->_model_name_extended; |
|
173 | + if (class_exists($model_to_reset)) { |
|
174 | 174 | $model_to_reset::reset(); |
175 | 175 | } |
176 | 176 | } |
@@ -183,27 +183,27 @@ discard block |
||
183 | 183 | * @return mixed |
184 | 184 | * @throws EE_Error |
185 | 185 | */ |
186 | - public function __call( $callback_method_name, $args){ |
|
187 | - if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
|
186 | + public function __call($callback_method_name, $args) { |
|
187 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
188 | 188 | //it's a dynamic callback for a method name |
189 | 189 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
190 | - list( $original_return_val, $model_called, $args_provided_to_method_on_model ) = (array) $args; |
|
190 | + list($original_return_val, $model_called, $args_provided_to_method_on_model) = (array) $args; |
|
191 | 191 | $this->_ = $model_called; |
192 | 192 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
193 | - if(method_exists($this, $extending_method)){ |
|
194 | - return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
|
195 | - }else{ |
|
193 | + if (method_exists($this, $extending_method)) { |
|
194 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
195 | + } else { |
|
196 | 196 | throw new EE_Error( |
197 | 197 | sprintf( |
198 | 198 | __("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"), |
199 | 199 | $this->_model_name_extended, |
200 | 200 | get_class($this), |
201 | - $extending_method,$extending_method |
|
201 | + $extending_method, $extending_method |
|
202 | 202 | ) |
203 | 203 | ); |
204 | 204 | } |
205 | 205 | |
206 | - }else{ |
|
206 | + } else { |
|
207 | 207 | throw new EE_Error( |
208 | 208 | sprintf( |
209 | 209 | __("There is no method named '%s' on '%s'", "event_espresso"), |
@@ -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 |