@@ -50,79 +50,79 @@ discard block |
||
50 | 50 | * @throws \EE_Error |
51 | 51 | * } |
52 | 52 | */ |
53 | - public static function register( $mt_name = NULL, $setup_args = array() ) { |
|
53 | + public static function register($mt_name = NULL, $setup_args = array()) { |
|
54 | 54 | //required fields MUST be present, so let's make sure they are. |
55 | 55 | if ( |
56 | - ! isset( $mt_name ) |
|
57 | - || ! is_array( $setup_args ) |
|
58 | - || empty( $setup_args['mtfilename'] ) || empty( $setup_args['autoloadpaths'] ) |
|
59 | - ){ |
|
56 | + ! isset($mt_name) |
|
57 | + || ! is_array($setup_args) |
|
58 | + || empty($setup_args['mtfilename']) || empty($setup_args['autoloadpaths']) |
|
59 | + ) { |
|
60 | 60 | throw new EE_Error( |
61 | - __( 'In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"', 'event_espresso' ) |
|
61 | + __('In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"', 'event_espresso') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | //make sure we don't register twice |
66 | - if( isset( self::$_ee_message_type_registry[ $mt_name ] ) ){ |
|
66 | + if (isset(self::$_ee_message_type_registry[$mt_name])) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | 70 | //make sure this was called in the right place! |
71 | 71 | if ( |
72 | - ! did_action( 'EE_Brewing_Regular___messages_caf' ) |
|
73 | - || did_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ) |
|
72 | + ! did_action('EE_Brewing_Regular___messages_caf') |
|
73 | + || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations') |
|
74 | 74 | ) { |
75 | 75 | EE_Error::doing_it_wrong( |
76 | 76 | __METHOD__, |
77 | 77 | sprintf( |
78 | - __('A message type named "%s" has been attempted to be registered with the EE Messages System. It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.','event_espresso'), |
|
78 | + __('A message type named "%s" has been attempted to be registered with the EE Messages System. It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.', 'event_espresso'), |
|
79 | 79 | $mt_name |
80 | 80 | ), |
81 | 81 | '4.3.0' |
82 | 82 | ); |
83 | 83 | } |
84 | 84 | //setup $__ee_message_type_registry array from incoming values. |
85 | - self::$_ee_message_type_registry[ $mt_name ] = array( |
|
85 | + self::$_ee_message_type_registry[$mt_name] = array( |
|
86 | 86 | 'mtfilename' => (string) $setup_args['mtfilename'], |
87 | 87 | 'autoloadpaths' => (array) $setup_args['autoloadpaths'], |
88 | - 'messengers_to_activate_with' => ! empty( $setup_args['messengers_to_activate_with'] ) |
|
88 | + 'messengers_to_activate_with' => ! empty($setup_args['messengers_to_activate_with']) |
|
89 | 89 | ? (array) $setup_args['messengers_to_activate_with'] |
90 | 90 | : array(), |
91 | - 'messengers_to_validate_with' => ! empty( $setup_args['messengers_to_validate_with'] ) |
|
91 | + 'messengers_to_validate_with' => ! empty($setup_args['messengers_to_validate_with']) |
|
92 | 92 | ? (array) $setup_args['messengers_to_validate_with'] |
93 | 93 | : array(), |
94 | - 'force_activation' => ! empty( $setup_args['force_activation'] ) |
|
94 | + 'force_activation' => ! empty($setup_args['force_activation']) |
|
95 | 95 | ? (bool) $setup_args['force_activation'] |
96 | 96 | : array() |
97 | 97 | ); |
98 | 98 | //add filters |
99 | 99 | add_filter( |
100 | 100 | 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', |
101 | - array( 'EE_Register_Message_Type', 'register_msgs_autoload_paths' ), |
|
101 | + array('EE_Register_Message_Type', 'register_msgs_autoload_paths'), |
|
102 | 102 | 10 |
103 | 103 | ); |
104 | 104 | add_filter( |
105 | 105 | 'FHEE__EE_messages__get_installed__messagetype_files', |
106 | - array( 'EE_Register_Message_Type', 'register_messagetype_files' ), |
|
106 | + array('EE_Register_Message_Type', 'register_messagetype_files'), |
|
107 | 107 | 10, |
108 | 108 | 1 |
109 | 109 | ); |
110 | 110 | add_filter( |
111 | 111 | 'FHEE__EE_messenger__get_default_message_types__default_types', |
112 | - array( 'EE_Register_Message_Type', 'register_messengers_to_activate_mt_with' ), |
|
112 | + array('EE_Register_Message_Type', 'register_messengers_to_activate_mt_with'), |
|
113 | 113 | 10, |
114 | 114 | 2 |
115 | 115 | ); |
116 | 116 | add_filter( |
117 | 117 | 'FHEE__EE_messenger__get_valid_message_types__valid_types', |
118 | - array( 'EE_Register_Message_Type', 'register_messengers_to_validate_mt_with' ), |
|
118 | + array('EE_Register_Message_Type', 'register_messengers_to_validate_mt_with'), |
|
119 | 119 | 10, |
120 | 120 | 2 |
121 | 121 | ); |
122 | 122 | //actions |
123 | 123 | add_action( |
124 | 124 | 'AHEE__EE_Addon__initialize_default_data__begin', |
125 | - array( 'EE_Register_Message_Type', 'set_defaults' ) |
|
125 | + array('EE_Register_Message_Type', 'set_defaults') |
|
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function set_defaults() { |
135 | 135 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
136 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
136 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
137 | 137 | |
138 | 138 | //for any message types with force activation, let's ensure they are activated |
139 | - foreach ( self::$_ee_message_type_registry as $message_type_name => $settings ) { |
|
140 | - if ( $settings['force_activation'] ) { |
|
141 | - foreach ( $settings['messengers_to_activate_with'] as $messenger ) { |
|
139 | + foreach (self::$_ee_message_type_registry as $message_type_name => $settings) { |
|
140 | + if ($settings['force_activation']) { |
|
141 | + foreach ($settings['messengers_to_activate_with'] as $messenger) { |
|
142 | 142 | //DO not force activation if this message type has already been activated in the system |
143 | - if ( ! $message_resource_manager->has_message_type_been_activated_for_messenger( $message_type_name, $messenger ) ) { |
|
144 | - $message_resource_manager->ensure_message_type_is_active( $message_type_name, $messenger ); |
|
143 | + if ( ! $message_resource_manager->has_message_type_been_activated_for_messenger($message_type_name, $messenger)) { |
|
144 | + $message_resource_manager->ensure_message_type_is_active($message_type_name, $messenger); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
@@ -158,13 +158,13 @@ discard block |
||
158 | 158 | * @param string $message_type_name the name for the message type that was previously registered |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - public static function deregister( $message_type_name = null ) { |
|
162 | - if ( ! empty( self::$_ee_message_type_registry[ $message_type_name ] ) ) { |
|
161 | + public static function deregister($message_type_name = null) { |
|
162 | + if ( ! empty(self::$_ee_message_type_registry[$message_type_name])) { |
|
163 | 163 | //let's make sure that we remove any place this message type was made active |
164 | 164 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
165 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
166 | - $Message_Resource_Manager->deactivate_message_type( $message_type_name ); |
|
167 | - unset( self::$_ee_message_type_registry[ $message_type_name ] ); |
|
165 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
166 | + $Message_Resource_Manager->deactivate_message_type($message_type_name); |
|
167 | + unset(self::$_ee_message_type_registry[$message_type_name]); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | * @param array $messagetype_files The current array of message type file names |
179 | 179 | * @return array Array of message type file names |
180 | 180 | */ |
181 | - public static function register_messagetype_files( $messagetype_files ) { |
|
182 | - if ( empty( self::$_ee_message_type_registry ) ) { |
|
181 | + public static function register_messagetype_files($messagetype_files) { |
|
182 | + if (empty(self::$_ee_message_type_registry)) { |
|
183 | 183 | return $messagetype_files; |
184 | 184 | } |
185 | - foreach ( self::$_ee_message_type_registry as $mt_reg ) { |
|
186 | - if ( empty( $mt_reg['mtfilename' ] ) ) { |
|
185 | + foreach (self::$_ee_message_type_registry as $mt_reg) { |
|
186 | + if (empty($mt_reg['mtfilename'])) { |
|
187 | 187 | continue; |
188 | 188 | } |
189 | 189 | $messagetype_files[] = $mt_reg['mtfilename']; |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | * @param array $paths array of paths to be checked by EE_messages autoloader. |
204 | 204 | * @return array |
205 | 205 | */ |
206 | - public static function register_msgs_autoload_paths( $paths ) { |
|
207 | - if ( ! empty( self::$_ee_message_type_registry ) ) { |
|
208 | - foreach ( self::$_ee_message_type_registry as $mt_reg ) { |
|
209 | - if ( empty( $mt_reg['autoloadpaths'] ) ) { |
|
206 | + public static function register_msgs_autoload_paths($paths) { |
|
207 | + if ( ! empty(self::$_ee_message_type_registry)) { |
|
208 | + foreach (self::$_ee_message_type_registry as $mt_reg) { |
|
209 | + if (empty($mt_reg['autoloadpaths'])) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | - $paths = array_merge( $paths, $mt_reg['autoloadpaths'] ); |
|
212 | + $paths = array_merge($paths, $mt_reg['autoloadpaths']); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | return $paths; |
@@ -228,18 +228,18 @@ discard block |
||
228 | 228 | * @param EE_messenger $messenger The EE_messenger the filter is called from. |
229 | 229 | * @return array |
230 | 230 | */ |
231 | - public static function register_messengers_to_activate_mt_with( $default_types, EE_messenger $messenger ) { |
|
232 | - if ( empty( self::$_ee_message_type_registry ) ) { |
|
231 | + public static function register_messengers_to_activate_mt_with($default_types, EE_messenger $messenger) { |
|
232 | + if (empty(self::$_ee_message_type_registry)) { |
|
233 | 233 | return $default_types; |
234 | 234 | } |
235 | - foreach ( self::$_ee_message_type_registry as $message_type_name => $mt_reg ) { |
|
236 | - if ( empty( $mt_reg['messengers_to_activate_with'] ) || empty( $mt_reg['mtfilename'] ) ) { |
|
235 | + foreach (self::$_ee_message_type_registry as $message_type_name => $mt_reg) { |
|
236 | + if (empty($mt_reg['messengers_to_activate_with']) || empty($mt_reg['mtfilename'])) { |
|
237 | 237 | continue; |
238 | 238 | } |
239 | 239 | // loop through each of the messengers and if it matches the loaded class |
240 | 240 | // then we add this message type to the |
241 | - foreach ( $mt_reg['messengers_to_activate_with'] as $msgr ) { |
|
242 | - if ( $messenger->name == $msgr ) { |
|
241 | + foreach ($mt_reg['messengers_to_activate_with'] as $msgr) { |
|
242 | + if ($messenger->name == $msgr) { |
|
243 | 243 | $default_types[] = $message_type_name; |
244 | 244 | } |
245 | 245 | } |
@@ -259,18 +259,18 @@ discard block |
||
259 | 259 | * @param EE_messenger $messenger The EE_messenger the filter is called from. |
260 | 260 | * @return array |
261 | 261 | */ |
262 | - public static function register_messengers_to_validate_mt_with( $valid_types, EE_messenger $messenger ) { |
|
263 | - if ( empty( self::$_ee_message_type_registry ) ) { |
|
262 | + public static function register_messengers_to_validate_mt_with($valid_types, EE_messenger $messenger) { |
|
263 | + if (empty(self::$_ee_message_type_registry)) { |
|
264 | 264 | return $valid_types; |
265 | 265 | } |
266 | - foreach ( self::$_ee_message_type_registry as $message_type_name => $mt_reg ) { |
|
267 | - if ( empty( $mt_reg['messengers_to_validate_with'] ) || empty( $mt_reg['mtfilename'] ) ) { |
|
266 | + foreach (self::$_ee_message_type_registry as $message_type_name => $mt_reg) { |
|
267 | + if (empty($mt_reg['messengers_to_validate_with']) || empty($mt_reg['mtfilename'])) { |
|
268 | 268 | continue; |
269 | 269 | } |
270 | 270 | // loop through each of the messengers and if it matches the loaded class |
271 | 271 | // then we add this message type to the |
272 | - foreach ( $mt_reg['messengers_to_validate_with'] as $msgr ) { |
|
273 | - if ( $messenger->name == $msgr ) { |
|
272 | + foreach ($mt_reg['messengers_to_validate_with'] as $msgr) { |
|
273 | + if ($messenger->name == $msgr) { |
|
274 | 274 | $valid_types[] = $message_type_name; |
275 | 275 | } |
276 | 276 | } |
@@ -251,14 +251,14 @@ |
||
251 | 251 | |
252 | 252 | |
253 | 253 | /** |
254 | - * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter. |
|
255 | - * |
|
256 | - * @since 4.3.0 |
|
257 | - * @param array $valid_types array of message types valid with messenger ( |
|
258 | - * corresponds to the $name property of message type) |
|
259 | - * @param EE_messenger $messenger The EE_messenger the filter is called from. |
|
260 | - * @return array |
|
261 | - */ |
|
254 | + * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter. |
|
255 | + * |
|
256 | + * @since 4.3.0 |
|
257 | + * @param array $valid_types array of message types valid with messenger ( |
|
258 | + * corresponds to the $name property of message type) |
|
259 | + * @param EE_messenger $messenger The EE_messenger the filter is called from. |
|
260 | + * @return array |
|
261 | + */ |
|
262 | 262 | public static function register_messengers_to_validate_mt_with( $valid_types, EE_messenger $messenger ) { |
263 | 263 | if ( empty( self::$_ee_message_type_registry ) ) { |
264 | 264 | return $valid_types; |
@@ -5,7 +5,9 @@ |
||
5 | 5 | * @subpackage plugin api, messages |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Use this to register or deregister a new message type for the EE messages system. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Prepares incoming data from the json or $_REQUEST parameters for the models' |
57 | 57 | * "$query_params". |
58 | - * @param EE_Model_Field_Base $field_obj |
|
58 | + * @param \EE_Model_Field_Base $field_obj |
|
59 | 59 | * @param mixed $original_value |
60 | 60 | * @param string $requested_version |
61 | 61 | * @return mixed |
@@ -77,6 +77,7 @@ discard block |
||
77 | 77 | * Prepares a field's value for display in the API |
78 | 78 | * @param \EE_Model_Field_Base $field_obj |
79 | 79 | * @param mixed $original_value |
80 | + * @param string $requested_version |
|
80 | 81 | * @return mixed |
81 | 82 | */ |
82 | 83 | public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
@@ -131,6 +132,9 @@ discard block |
||
131 | 132 | return $query_param_for_models; |
132 | 133 | } |
133 | 134 | |
135 | + /** |
|
136 | + * @return string |
|
137 | + */ |
|
134 | 138 | public static function remove_stars_and_anything_after_from_condition_query_param_key( $condition_query_param_key ) { |
135 | 139 | $pos_of_star = strpos($condition_query_param_key, '*'); |
136 | 140 | if($pos_of_star === FALSE){ |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $pos_of_star = strpos($condition_query_param_key, '*'); |
136 | 136 | if($pos_of_star === FALSE){ |
137 | 137 | return $condition_query_param_key; |
138 | - }else{ |
|
138 | + } else{ |
|
139 | 139 | $condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star); |
140 | 140 | return $condition_query_param_sans_star; |
141 | 141 | } |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | $last_query_param_part = $query_param_parts[ count($query_param_parts) - 1 ]; |
160 | 160 | if($number_of_parts == 1){ |
161 | 161 | $field_name = $last_query_param_part; |
162 | - }else{// $number_of_parts >= 2 |
|
162 | + } else{// $number_of_parts >= 2 |
|
163 | 163 | //the last part is the column name, and there are only 2parts. therefore... |
164 | 164 | $field_name = $last_query_param_part; |
165 | 165 | $model = \EE_Registry::instance()->load_model( $query_param_parts[ $number_of_parts - 2 ]); |
166 | 166 | } |
167 | 167 | try{ |
168 | 168 | return $model->field_settings_for($field_name); |
169 | - }catch(\EE_Error $e){ |
|
169 | + } catch(\EE_Error $e){ |
|
170 | 170 | return null; |
171 | 171 | } |
172 | 172 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | |
24 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
25 | - exit( 'No direct script access allowed' ); |
|
24 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
25 | + exit('No direct script access allowed'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | class Model_Data_Translator { |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | * @param string $requested_version |
41 | 41 | * @return mixed |
42 | 42 | */ |
43 | - public static function prepare_field_values_from_json( $field_obj, $original_value_maybe_array, $requested_version ) { |
|
44 | - if( is_array( $original_value_maybe_array ) ) { |
|
43 | + public static function prepare_field_values_from_json($field_obj, $original_value_maybe_array, $requested_version) { |
|
44 | + if (is_array($original_value_maybe_array)) { |
|
45 | 45 | $new_value_maybe_array = array(); |
46 | - foreach( $original_value_maybe_array as $array_key => $array_item ) { |
|
47 | - $new_value_maybe_array[ $array_key ] = Model_Data_Translator::prepare_field_value_from_json( $field_obj, $array_item, $requested_version ); |
|
46 | + foreach ($original_value_maybe_array as $array_key => $array_item) { |
|
47 | + $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_from_json($field_obj, $array_item, $requested_version); |
|
48 | 48 | } |
49 | 49 | } else { |
50 | - $new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json( $field_obj, $original_value_maybe_array, $requested_version ); |
|
50 | + $new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json($field_obj, $original_value_maybe_array, $requested_version); |
|
51 | 51 | } |
52 | 52 | return $new_value_maybe_array; |
53 | 53 | } |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | * @param string $request_version (eg 4.8.36) |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public static function prepare_field_values_for_json( $field_obj, $original_value_maybe_array, $request_version ){ |
|
63 | - if( is_array( $original_value_maybe_array ) ) { |
|
62 | + public static function prepare_field_values_for_json($field_obj, $original_value_maybe_array, $request_version) { |
|
63 | + if (is_array($original_value_maybe_array)) { |
|
64 | 64 | $new_value_maybe_array = array(); |
65 | - foreach( $original_value_maybe_array as $array_key => $array_item ) { |
|
66 | - $new_value_maybe_array[ $array_key ] = Model_Data_Translator::prepare_field_value_for_json( $field_obj, $array_item, $request_version ); |
|
65 | + foreach ($original_value_maybe_array as $array_key => $array_item) { |
|
66 | + $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_for_json($field_obj, $array_item, $request_version); |
|
67 | 67 | } |
68 | 68 | } else { |
69 | - $new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json( $field_obj, $original_value_maybe_array, $request_version ); |
|
69 | + $new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json($field_obj, $original_value_maybe_array, $request_version); |
|
70 | 70 | } |
71 | 71 | return $new_value_maybe_array; |
72 | 72 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | * @param string $requested_version |
80 | 80 | * @return mixed |
81 | 81 | */ |
82 | - public static function prepare_field_value_from_json( $field_obj, $original_value, $requested_version ) { |
|
82 | + public static function prepare_field_value_from_json($field_obj, $original_value, $requested_version) { |
|
83 | 83 | $new_value = null; |
84 | - if( $field_obj instanceof \EE_Infinite_Integer_Field |
|
85 | - && in_array( $original_value, array( null, '' ), true ) ) { |
|
84 | + if ($field_obj instanceof \EE_Infinite_Integer_Field |
|
85 | + && in_array($original_value, array(null, ''), true)) { |
|
86 | 86 | $new_value = EE_INF; |
87 | - } elseif( $field_obj instanceof \EE_Datetime_Field ) { |
|
88 | - $new_value = rest_parse_date( $original_value ); |
|
87 | + } elseif ($field_obj instanceof \EE_Datetime_Field) { |
|
88 | + $new_value = rest_parse_date($original_value); |
|
89 | 89 | } else { |
90 | 90 | $new_value = $original_value; |
91 | 91 | } |
@@ -98,22 +98,22 @@ discard block |
||
98 | 98 | * @param mixed $original_value |
99 | 99 | * @return mixed |
100 | 100 | */ |
101 | - public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
|
102 | - if( $original_value === EE_INF ) { |
|
101 | + public static function prepare_field_value_for_json($field_obj, $original_value, $requested_version) { |
|
102 | + if ($original_value === EE_INF) { |
|
103 | 103 | $new_value = Model_Data_Translator::ee_inf_in_rest; |
104 | - } elseif( $field_obj instanceof \EE_Datetime_Field ) { |
|
105 | - if( $original_value instanceof \DateTime ) { |
|
106 | - $new_value = $original_value->format( 'Y-m-d H:i:s' ); |
|
107 | - } elseif( is_int( $original_value ) ) { |
|
108 | - $new_value = date( 'Y-m-d H:i:s', $original_value ); |
|
104 | + } elseif ($field_obj instanceof \EE_Datetime_Field) { |
|
105 | + if ($original_value instanceof \DateTime) { |
|
106 | + $new_value = $original_value->format('Y-m-d H:i:s'); |
|
107 | + } elseif (is_int($original_value)) { |
|
108 | + $new_value = date('Y-m-d H:i:s', $original_value); |
|
109 | 109 | } else { |
110 | 110 | $new_value = $original_value; |
111 | 111 | } |
112 | - $new_value = mysql_to_rfc3339( $new_value ); |
|
112 | + $new_value = mysql_to_rfc3339($new_value); |
|
113 | 113 | } else { |
114 | 114 | $new_value = $original_value; |
115 | 115 | } |
116 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
116 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
117 | 117 | $new_value, |
118 | 118 | $field_obj, |
119 | 119 | $original_value, |
@@ -129,29 +129,29 @@ discard block |
||
129 | 129 | * @param string $requested_version |
130 | 130 | * @return array |
131 | 131 | */ |
132 | - public static function prepare_conditions_query_params_for_models( $inputted_query_params_of_this_type, \EEM_Base $model, $requested_version ) { |
|
132 | + public static function prepare_conditions_query_params_for_models($inputted_query_params_of_this_type, \EEM_Base $model, $requested_version) { |
|
133 | 133 | $query_param_for_models = array(); |
134 | - foreach( $inputted_query_params_of_this_type as $query_param_key => $query_param_value ) { |
|
134 | + foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) { |
|
135 | 135 | $field = Model_Data_Translator::deduce_field_from_query_param( |
136 | - Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key( $query_param_key ), |
|
136 | + Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key), |
|
137 | 137 | $model |
138 | 138 | ); |
139 | - if( $field instanceof \EE_Model_Field_Base ) { |
|
139 | + if ($field instanceof \EE_Model_Field_Base) { |
|
140 | 140 | //did they specify an operator? |
141 | - if( is_array( $query_param_value ) ) { |
|
142 | - $op = $query_param_value[ 0 ]; |
|
143 | - $translated_value = array( $op ); |
|
144 | - if( isset( $query_param_value[ 1 ] ) ) { |
|
145 | - $value = $query_param_value[ 1 ]; |
|
146 | - $translated_value[1] = Model_Data_Translator::prepare_field_values_from_json( $field, $value, $requested_version ); |
|
141 | + if (is_array($query_param_value)) { |
|
142 | + $op = $query_param_value[0]; |
|
143 | + $translated_value = array($op); |
|
144 | + if (isset($query_param_value[1])) { |
|
145 | + $value = $query_param_value[1]; |
|
146 | + $translated_value[1] = Model_Data_Translator::prepare_field_values_from_json($field, $value, $requested_version); |
|
147 | 147 | } |
148 | 148 | } else { |
149 | - $translated_value = Model_Data_Translator::prepare_field_value_from_json( $field, $query_param_value, $requested_version ); |
|
149 | + $translated_value = Model_Data_Translator::prepare_field_value_from_json($field, $query_param_value, $requested_version); |
|
150 | 150 | } |
151 | - $query_param_for_models[ $query_param_key ] = $translated_value; |
|
151 | + $query_param_for_models[$query_param_key] = $translated_value; |
|
152 | 152 | } else { |
153 | 153 | //so it's not for a field, assume it's a logic query param key |
154 | - $query_param_for_models[ $query_param_key ] = Model_Data_Translator::prepare_conditions_query_params_for_models( $query_param_value, $model, $requested_version ); |
|
154 | + $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_models($query_param_value, $model, $requested_version); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | return $query_param_for_models; |
@@ -164,27 +164,27 @@ discard block |
||
164 | 164 | * @param string $requested_version eg "4.8.36". If null is provided, defaults to the latest release of the EE4 REST API |
165 | 165 | * @return array which can be passed into the EE4 REST API when querying a model resource |
166 | 166 | */ |
167 | - public static function prepare_query_params_for_rest_api( $model_query_params, \EEM_Base $model, $requested_version = null ) { |
|
168 | - if( $requested_version === null ) { |
|
169 | - $requested_version = \EED_Core_Rest_Api::latest_rest_api_version() ; |
|
167 | + public static function prepare_query_params_for_rest_api($model_query_params, \EEM_Base $model, $requested_version = null) { |
|
168 | + if ($requested_version === null) { |
|
169 | + $requested_version = \EED_Core_Rest_Api::latest_rest_api_version(); |
|
170 | 170 | } |
171 | 171 | $rest_query_params = $model_query_params; |
172 | - if ( isset( $model_query_params[0] ) ) { |
|
173 | - $rest_query_params[ 'where' ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
174 | - $model_query_params[ 0 ], |
|
172 | + if (isset($model_query_params[0])) { |
|
173 | + $rest_query_params['where'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
174 | + $model_query_params[0], |
|
175 | 175 | $model, |
176 | 176 | $requested_version |
177 | 177 | ); |
178 | - unset( $rest_query_params[0] ); |
|
178 | + unset($rest_query_params[0]); |
|
179 | 179 | } |
180 | - if ( isset( $model_query_params[ 'having' ] ) ) { |
|
181 | - $rest_query_params[ 'having' ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
182 | - $model_query_params[ 'having' ], |
|
180 | + if (isset($model_query_params['having'])) { |
|
181 | + $rest_query_params['having'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
182 | + $model_query_params['having'], |
|
183 | 183 | $model, |
184 | 184 | $requested_version |
185 | 185 | ); |
186 | 186 | } |
187 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api', $rest_query_params, $model_query_params, $model, $requested_version ); |
|
187 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api', $rest_query_params, $model_query_params, $model, $requested_version); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -194,39 +194,39 @@ discard block |
||
194 | 194 | * @param string $requested_version eg "4.8.36" |
195 | 195 | * @return array ready for use in the rest api query params |
196 | 196 | */ |
197 | - public static function prepare_conditions_query_params_for_rest_api( $inputted_query_params_of_this_type, \EEM_Base $model, $requested_version ) { |
|
197 | + public static function prepare_conditions_query_params_for_rest_api($inputted_query_params_of_this_type, \EEM_Base $model, $requested_version) { |
|
198 | 198 | $query_param_for_models = array(); |
199 | - foreach( $inputted_query_params_of_this_type as $query_param_key => $query_param_value ) { |
|
199 | + foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) { |
|
200 | 200 | $field = Model_Data_Translator::deduce_field_from_query_param( |
201 | - Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key( $query_param_key ), |
|
201 | + Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key), |
|
202 | 202 | $model |
203 | 203 | ); |
204 | - if( $field instanceof \EE_Model_Field_Base ) { |
|
204 | + if ($field instanceof \EE_Model_Field_Base) { |
|
205 | 205 | //did they specify an operator? |
206 | - if( is_array( $query_param_value ) ) { |
|
207 | - $op = $query_param_value[ 0 ]; |
|
208 | - $translated_value = array( $op ); |
|
209 | - if( isset( $query_param_value[ 1 ] ) ) { |
|
210 | - $value = $query_param_value[ 1 ]; |
|
211 | - $translated_value[1] = Model_Data_Translator::prepare_field_values_for_json( $field, $value, $requested_version ); |
|
206 | + if (is_array($query_param_value)) { |
|
207 | + $op = $query_param_value[0]; |
|
208 | + $translated_value = array($op); |
|
209 | + if (isset($query_param_value[1])) { |
|
210 | + $value = $query_param_value[1]; |
|
211 | + $translated_value[1] = Model_Data_Translator::prepare_field_values_for_json($field, $value, $requested_version); |
|
212 | 212 | } |
213 | 213 | } else { |
214 | - $translated_value = Model_Data_Translator::prepare_field_value_for_json( $field, $query_param_value, $requested_version ); |
|
214 | + $translated_value = Model_Data_Translator::prepare_field_value_for_json($field, $query_param_value, $requested_version); |
|
215 | 215 | } |
216 | - $query_param_for_models[ $query_param_key ] = $translated_value; |
|
216 | + $query_param_for_models[$query_param_key] = $translated_value; |
|
217 | 217 | } else { |
218 | 218 | //so it's not for a field, assume it's a logic query param key |
219 | - $query_param_for_models[ $query_param_key ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( $query_param_value, $model, $requested_version ); |
|
219 | + $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api($query_param_value, $model, $requested_version); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | return $query_param_for_models; |
223 | 223 | } |
224 | 224 | |
225 | - public static function remove_stars_and_anything_after_from_condition_query_param_key( $condition_query_param_key ) { |
|
225 | + public static function remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key) { |
|
226 | 226 | $pos_of_star = strpos($condition_query_param_key, '*'); |
227 | - if($pos_of_star === FALSE){ |
|
227 | + if ($pos_of_star === FALSE) { |
|
228 | 228 | return $condition_query_param_key; |
229 | - }else{ |
|
229 | + } else { |
|
230 | 230 | $condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star); |
231 | 231 | return $condition_query_param_sans_star; |
232 | 232 | } |
@@ -238,26 +238,26 @@ discard block |
||
238 | 238 | * @throws EE_Error |
239 | 239 | * @return EE_Model_Field_Base |
240 | 240 | */ |
241 | - public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model){ |
|
241 | + public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model) { |
|
242 | 242 | //ok, now proceed with deducing which part is the model's name, and which is the field's name |
243 | 243 | //which will help us find the database table and column |
244 | 244 | |
245 | - $query_param_parts = explode(".",$query_param_name); |
|
246 | - if(empty($query_param_parts)){ |
|
247 | - throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s",'event_espresso'),$query_param_name)); |
|
245 | + $query_param_parts = explode(".", $query_param_name); |
|
246 | + if (empty($query_param_parts)) { |
|
247 | + throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s", 'event_espresso'), $query_param_name)); |
|
248 | 248 | } |
249 | 249 | $number_of_parts = count($query_param_parts); |
250 | - $last_query_param_part = $query_param_parts[ count($query_param_parts) - 1 ]; |
|
251 | - if($number_of_parts == 1){ |
|
250 | + $last_query_param_part = $query_param_parts[count($query_param_parts) - 1]; |
|
251 | + if ($number_of_parts == 1) { |
|
252 | 252 | $field_name = $last_query_param_part; |
253 | - }else{// $number_of_parts >= 2 |
|
253 | + } else {// $number_of_parts >= 2 |
|
254 | 254 | //the last part is the column name, and there are only 2parts. therefore... |
255 | 255 | $field_name = $last_query_param_part; |
256 | - $model = \EE_Registry::instance()->load_model( $query_param_parts[ $number_of_parts - 2 ]); |
|
256 | + $model = \EE_Registry::instance()->load_model($query_param_parts[$number_of_parts - 2]); |
|
257 | 257 | } |
258 | - try{ |
|
258 | + try { |
|
259 | 259 | return $model->field_settings_for($field_name); |
260 | - }catch(\EE_Error $e){ |
|
260 | + } catch (\EE_Error $e) { |
|
261 | 261 | return null; |
262 | 262 | } |
263 | 263 | } |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | - * Prepares a field's value for display in the API |
|
97 | - * @param \EE_Model_Field_Base $field_obj |
|
98 | - * @param mixed $original_value |
|
99 | - * @return mixed |
|
100 | - */ |
|
96 | + * Prepares a field's value for display in the API |
|
97 | + * @param \EE_Model_Field_Base $field_obj |
|
98 | + * @param mixed $original_value |
|
99 | + * @return mixed |
|
100 | + */ |
|
101 | 101 | public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
102 | 102 | if( $original_value === EE_INF ) { |
103 | 103 | $new_value = Model_Data_Translator::ee_inf_in_rest; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $original_value, |
120 | 120 | $requested_version |
121 | 121 | ); |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Prepares condition-query-parameters (like what's in where and having) from |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | * @since $VID:$ |
14 | 14 | * |
15 | 15 | */ |
16 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
17 | - exit( 'No direct script access allowed' ); |
|
16 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
17 | + exit('No direct script access allowed'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | class Rest_Exception extends \EE_Error { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected $_wp_error_data = array(); |
26 | 26 | protected $_wp_error_code = ''; |
27 | - public function __construct( $string_code, $message, $wp_error_data = array(), $previous = null ) { |
|
27 | + public function __construct($string_code, $message, $wp_error_data = array(), $previous = null) { |
|
28 | 28 | parent::__construct( |
29 | 29 | $message, |
30 | 30 | 500, |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct() { |
24 | 24 | $this->name = 'newsletter'; |
25 | - $this->description = __( 'Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso' ); |
|
25 | + $this->description = __('Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso'); |
|
26 | 26 | $this->label = array( |
27 | - 'singular' => __( 'newsletter', 'event_espresso' ), |
|
28 | - 'plural' => __( 'newsletters', 'event_espresso' ) |
|
27 | + 'singular' => __('newsletter', 'event_espresso'), |
|
28 | + 'plural' => __('newsletters', 'event_espresso') |
|
29 | 29 | ); |
30 | 30 | $this->_master_templates = array( |
31 | 31 | 'email' => 'registration', |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
52 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
53 | 53 | //newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects. |
54 | - return array( $registration ); |
|
54 | + return array($registration); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | |
65 | 65 | protected function _set_contexts() { |
66 | 66 | $this->_context_label = array( |
67 | - 'label' => __( 'recipient', 'event_espresso' ), |
|
68 | - 'plural' => __( 'recipients', 'event_espresso' ), |
|
69 | - 'description' => __( 'Recipient\'s are who will receive the message.', 'event_espresso' ) |
|
67 | + 'label' => __('recipient', 'event_espresso'), |
|
68 | + 'plural' => __('recipients', 'event_espresso'), |
|
69 | + 'description' => __('Recipient\'s are who will receive the message.', 'event_espresso') |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->_contexts = array( |
73 | 73 | 'attendee' => array( |
74 | - 'label' => __( 'Registrant', 'event_espresso' ), |
|
75 | - 'description' => __( 'This template goes to selected registrants.', 'event_espresso' ) |
|
74 | + 'label' => __('Registrant', 'event_espresso'), |
|
75 | + 'description' => __('This template goes to selected registrants.', 'event_espresso') |
|
76 | 76 | ) |
77 | 77 | ); |
78 | 78 | } |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | 'newsletter', |
99 | 99 | ); |
100 | 100 | |
101 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
102 | - foreach ( $shortcodes as $key => $shortcode ) { |
|
103 | - if ( ! in_array( $shortcode, $included_shortcodes ) ) { |
|
104 | - unset( $this->_valid_shortcodes[ $context ][ $key ] ); |
|
101 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
102 | + foreach ($shortcodes as $key => $shortcode) { |
|
103 | + if ( ! in_array($shortcode, $included_shortcodes)) { |
|
104 | + unset($this->_valid_shortcodes[$context][$key]); |
|
105 | 105 | } |
106 | 106 | } |
107 | - $this->_valid_shortcodes[ $context ][] = 'newsletter'; |
|
107 | + $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | } |
@@ -118,44 +118,44 @@ discard block |
||
118 | 118 | $addressee = array(); |
119 | 119 | |
120 | 120 | //looping through registrations |
121 | - foreach ( $this->_data->registrations as $reg_id => $details ) { |
|
121 | + foreach ($this->_data->registrations as $reg_id => $details) { |
|
122 | 122 | //set $attendee array to blank on each loop |
123 | 123 | $aee = array(); |
124 | 124 | |
125 | 125 | //need to get the attendee from this registration. |
126 | - $attendee = isset( $details['att_obj'] ) && $details['att_obj'] instanceof EE_Attendee |
|
126 | + $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee |
|
127 | 127 | ? $details['att_obj'] |
128 | 128 | : null; |
129 | 129 | |
130 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
130 | + if ( ! $attendee instanceof EE_Attendee) { |
|
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
134 | 134 | //set $aee from attendee object |
135 | 135 | $aee['att_obj'] = $attendee; |
136 | - $aee['reg_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
137 | - ? $this->_data->attendees[ $attendee->ID() ]['reg_objs'] |
|
136 | + $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs']) |
|
137 | + ? $this->_data->attendees[$attendee->ID()]['reg_objs'] |
|
138 | 138 | : array(); |
139 | 139 | $aee['attendee_email'] = $attendee->email(); |
140 | - $aee['tkt_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] ) |
|
141 | - ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] |
|
140 | + $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs']) |
|
141 | + ? $this->_data->attendees[$attendee->ID()]['tkt_objs'] |
|
142 | 142 | : array(); |
143 | 143 | |
144 | - if ( isset( $this->_data->attendees[ $attendee->ID() ]['evt_objs'] ) ) { |
|
145 | - $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
146 | - $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
144 | + if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) { |
|
145 | + $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
146 | + $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
147 | 147 | } else { |
148 | 148 | $aee['evt_objs'] = $aee['events'] = array(); |
149 | 149 | } |
150 | 150 | |
151 | - $aee['reg_obj'] = isset( $details['reg_obj'] ) |
|
151 | + $aee['reg_obj'] = isset($details['reg_obj']) |
|
152 | 152 | ? $details['reg_obj'] |
153 | 153 | : null; |
154 | 154 | $aee['attendees'] = $this->_data->attendees; |
155 | 155 | |
156 | 156 | //merge in the primary attendee data |
157 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
158 | - $addressee[] = new EE_Messages_Addressee( $aee ); |
|
157 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
158 | + $addressee[] = new EE_Messages_Addressee($aee); |
|
159 | 159 | } |
160 | 160 | return $addressee; |
161 | 161 | } |
@@ -5,7 +5,9 @@ |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * The message type for newsletter type of messages. |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function __construct() { |
44 | 44 | // construct request stack and run middleware apps as soon as all WP plugins are loaded |
45 | - add_action( 'plugins_loaded', array( $this, 'run_request_stack' ), 0 ); |
|
45 | + add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
46 | 46 | // set framework for the rest of EE to hook into when loading |
47 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_espresso_addons' ), 1 ); |
|
48 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'detect_activations_or_upgrades' ), 3 ); |
|
49 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_core_configuration' ), 5 ); |
|
50 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
51 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'brew_espresso' ), 9 ); |
|
47 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
48 | + add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
49 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
50 | + add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
51 | + add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | new EE_Load_Espresso_Core() |
66 | 66 | ); |
67 | 67 | $this->_request_stack->handle_request( |
68 | - new EE_Request( $_GET, $_POST, $_COOKIE ), |
|
68 | + new EE_Request($_GET, $_POST, $_COOKIE), |
|
69 | 69 | new EE_Response() |
70 | 70 | ); |
71 | 71 | $this->_request_stack->handle_response(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function load_autoloader() { |
80 | 80 | // load interfaces |
81 | - espresso_load_required( 'EEH_Autoloader', EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' ); |
|
81 | + espresso_load_required('EEH_Autoloader', EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php'); |
|
82 | 82 | EEH_Autoloader::instance(); |
83 | 83 | } |
84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function set_autoloaders_for_required_files() { |
91 | 91 | // load interfaces |
92 | - espresso_load_required( 'EEI_Interfaces', EE_CORE . 'interfaces' . DS . 'EEI_Interfaces.php' ); |
|
92 | + espresso_load_required('EEI_Interfaces', EE_CORE.'interfaces'.DS.'EEI_Interfaces.php'); |
|
93 | 93 | // load helpers |
94 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS ); |
|
94 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
95 | 95 | // load request stack |
96 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'request_stack' . DS ); |
|
96 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
97 | 97 | // load middleware |
98 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'middleware' . DS ); |
|
98 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | // load middleware onto stack : FILO (First In Last Out) |
121 | - foreach ( (array)$stack_apps as $stack_app ) { |
|
121 | + foreach ((array) $stack_apps as $stack_app) { |
|
122 | 122 | //$request_stack_builder->push( $stack_app ); |
123 | - $request_stack_builder->unshift( $stack_app ); |
|
123 | + $request_stack_builder->unshift($stack_app); |
|
124 | 124 | } |
125 | 125 | return apply_filters( |
126 | 126 | 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * no other logic should be performed at this point |
138 | 138 | */ |
139 | 139 | public static function load_espresso_addons() { |
140 | - do_action( 'AHEE__EE_Bootstrap__load_espresso_addons' ); |
|
140 | + do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * we can determine if anything needs activating or upgrading |
150 | 150 | */ |
151 | 151 | public static function detect_activations_or_upgrades() { |
152 | - do_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' ); |
|
152 | + do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * we can load and set all of the system configurations |
162 | 162 | */ |
163 | 163 | public static function load_core_configuration() { |
164 | - do_action( 'AHEE__EE_Bootstrap__load_core_configuration' ); |
|
164 | + do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * so that they are ready to be used throughout the system |
174 | 174 | */ |
175 | 175 | public static function register_shortcodes_modules_and_widgets() { |
176 | - do_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' ); |
|
176 | + do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * so let the fun begin... |
186 | 186 | */ |
187 | 187 | public static function brew_espresso() { |
188 | - do_action( 'AHEE__EE_Bootstrap__brew_espresso' ); |
|
188 | + do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | * @param array $post |
61 | 61 | * @param array $cookie |
62 | 62 | */ |
63 | - public function __construct( $get, $post, $cookie ) { |
|
63 | + public function __construct($get, $post, $cookie) { |
|
64 | 64 | // grab request vars |
65 | 65 | $this->_get = $get; |
66 | 66 | $this->_post = $post; |
67 | 67 | $this->_cookie = $cookie; |
68 | - $this->_params = array_merge( $get, $post ); |
|
68 | + $this->_params = array_merge($get, $post); |
|
69 | 69 | // AJAX ??? |
70 | - $this->ajax = defined( 'DOING_AJAX' ) ? true : false; |
|
71 | - $this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false; |
|
70 | + $this->ajax = defined('DOING_AJAX') ? true : false; |
|
71 | + $this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | * @param bool $override_ee |
120 | 120 | * @return void |
121 | 121 | */ |
122 | - public function set( $key, $value, $override_ee = FALSE ) { |
|
122 | + public function set($key, $value, $override_ee = FALSE) { |
|
123 | 123 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
124 | - if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) { |
|
125 | - $this->_params[ $key ] = $value; |
|
124 | + if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) { |
|
125 | + $this->_params[$key] = $value; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * @param null $default |
137 | 137 | * @return mixed |
138 | 138 | */ |
139 | - public function get( $key, $default = NULL ) { |
|
140 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
139 | + public function get($key, $default = NULL) { |
|
140 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param $key |
150 | 150 | * @return boolean |
151 | 151 | */ |
152 | - public function is_set( $key ) { |
|
153 | - return isset( $this->_params[ $key ] ) ? TRUE : FALSE; |
|
152 | + public function is_set($key) { |
|
153 | + return isset($this->_params[$key]) ? TRUE : FALSE; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * @param $key |
163 | 163 | * @param bool $unset_from_global_too |
164 | 164 | */ |
165 | - public function un_set( $key, $unset_from_global_too = false ) { |
|
166 | - unset( $this->_params[ $key ] ); |
|
167 | - if ( $unset_from_global_too ) { |
|
168 | - unset( $_REQUEST[ $key ] ); |
|
165 | + public function un_set($key, $unset_from_global_too = false) { |
|
166 | + unset($this->_params[$key]); |
|
167 | + if ($unset_from_global_too) { |
|
168 | + unset($_REQUEST[$key]); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * class EE_Request |
4 | 6 | * |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @since $VID:$ |
16 | 16 | * |
17 | 17 | */ |
18 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
19 | - exit( 'No direct script access allowed' ); |
|
18 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | + exit('No direct script access allowed'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Datetime extends Calculations_Base { |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @return int |
33 | 33 | * @throws \EE_Error |
34 | 34 | */ |
35 | - public static function spaces_remaining_considering_tickets( $wpdb_row, $request, $controller ){ |
|
36 | - if( is_array( $wpdb_row ) && isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
37 | - $dtt_obj = \EEM_Datetime::instance()->get_one_by_ID( $wpdb_row[ 'Datetime.DTT_ID' ] ); |
|
35 | + public static function spaces_remaining_considering_tickets($wpdb_row, $request, $controller) { |
|
36 | + if (is_array($wpdb_row) && isset($wpdb_row['Datetime.DTT_ID'])) { |
|
37 | + $dtt_obj = \EEM_Datetime::instance()->get_one_by_ID($wpdb_row['Datetime.DTT_ID']); |
|
38 | 38 | } else { |
39 | 39 | $dtt_obj = null; |
40 | 40 | } |
41 | - if( $dtt_obj instanceof \EE_Datetime ) { |
|
42 | - return $dtt_obj->spaces_remaining( true ); |
|
41 | + if ($dtt_obj instanceof \EE_Datetime) { |
|
42 | + return $dtt_obj->spaces_remaining(true); |
|
43 | 43 | } else { |
44 | 44 | throw new \EE_Error( |
45 | 45 | sprintf( |
46 | - __( 'Cannot calculate spaces_remaining_considering_tickets because the datetime with ID %1$s (from database row %2$s) was not found', 'event_espresso' ), |
|
47 | - $wpdb_row[ 'Datetime.DTT_ID' ], |
|
48 | - print_r( $wpdb_row, true ) |
|
46 | + __('Cannot calculate spaces_remaining_considering_tickets because the datetime with ID %1$s (from database row %2$s) was not found', 'event_espresso'), |
|
47 | + $wpdb_row['Datetime.DTT_ID'], |
|
48 | + print_r($wpdb_row, true) |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | } |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | * @throws \EE_Error |
64 | 64 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
65 | 65 | */ |
66 | - public static function registrations_checked_in_count( $wpdb_row, $request, $controller ){ |
|
67 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
66 | + public static function registrations_checked_in_count($wpdb_row, $request, $controller) { |
|
67 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
68 | 68 | throw new \EE_Error( |
69 | 69 | sprintf( |
70 | - __( 'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso' ), |
|
71 | - print_r( $wpdb_row, true ) |
|
70 | + __('Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso'), |
|
71 | + print_r($wpdb_row, true) |
|
72 | 72 | ) |
73 | 73 | ); |
74 | 74 | } |
75 | - self::_verify_current_user_can( 'ee_read_checkins', 'registrations_checked_in_count' ); |
|
76 | - return \EEM_Registration::instance()->count_registrations_checked_into_datetime( $wpdb_row[ 'Datetime.DTT_ID' ], true ); |
|
75 | + self::_verify_current_user_can('ee_read_checkins', 'registrations_checked_in_count'); |
|
76 | + return \EEM_Registration::instance()->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], true); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -88,17 +88,17 @@ discard block |
||
88 | 88 | * @throws \EE_Error |
89 | 89 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
90 | 90 | */ |
91 | - public static function registrations_checked_out_count( $wpdb_row, $request, $controller ){ |
|
92 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
91 | + public static function registrations_checked_out_count($wpdb_row, $request, $controller) { |
|
92 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
93 | 93 | throw new \EE_Error( |
94 | 94 | sprintf( |
95 | - __( 'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso' ), |
|
96 | - print_r( $wpdb_row, true ) |
|
95 | + __('Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso'), |
|
96 | + print_r($wpdb_row, true) |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | - self::_verify_current_user_can( 'ee_read_checkins', 'registrations_checked_out_count' ); |
|
101 | - return \EEM_Registration::instance()->count_registrations_checked_into_datetime( $wpdb_row[ 'Datetime.DTT_ID' ], false ); |
|
100 | + self::_verify_current_user_can('ee_read_checkins', 'registrations_checked_out_count'); |
|
101 | + return \EEM_Registration::instance()->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], false); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -114,20 +114,20 @@ discard block |
||
114 | 114 | * @throws \EE_Error |
115 | 115 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
116 | 116 | */ |
117 | - public static function spots_taken_pending_payment( $wpdb_row, $request, $controller ){ |
|
118 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
117 | + public static function spots_taken_pending_payment($wpdb_row, $request, $controller) { |
|
118 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
119 | 119 | throw new \EE_Error( |
120 | 120 | sprintf( |
121 | - __( 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso' ), |
|
122 | - print_r( $wpdb_row, true ) |
|
121 | + __('Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso'), |
|
122 | + print_r($wpdb_row, true) |
|
123 | 123 | ) |
124 | 124 | ); |
125 | 125 | } |
126 | - self::_verify_current_user_can( 'ee_read_registrations', 'spots_taken_pending_payment' ); |
|
126 | + self::_verify_current_user_can('ee_read_registrations', 'spots_taken_pending_payment'); |
|
127 | 127 | return \EEM_Registration::instance()->count( |
128 | 128 | array( |
129 | 129 | array( |
130 | - 'Ticket.Datetime.DTT_ID' => $wpdb_row[ 'Datetime.DTT_ID' ], |
|
130 | + 'Ticket.Datetime.DTT_ID' => $wpdb_row['Datetime.DTT_ID'], |
|
131 | 131 | 'STS_ID' => \EEM_Registration::status_id_pending_payment |
132 | 132 | ) |
133 | 133 | ), |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param mixed $info |
40 | 40 | * @return bool |
41 | 41 | */ |
42 | - public function add( $object, $info = null ) { |
|
43 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | - return parent::add( $object, $info ); |
|
42 | + public function add($object, $info = null) { |
|
43 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | + return parent::add($object, $info); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param mixed $info |
58 | 58 | * @return bool |
59 | 59 | */ |
60 | - public function set_info( $object, $info = null ) { |
|
61 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | - return parent::set_info( $object, $info ); |
|
60 | + public function set_info($object, $info = null) { |
|
61 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | + return parent::set_info($object, $info); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * @param mixed |
75 | 75 | * @return null | object |
76 | 76 | */ |
77 | - public function get_by_info( $info ) { |
|
78 | - return parent::get_by_info( str_replace( ' ', '_', strtolower( $info ) ) ); |
|
77 | + public function get_by_info($info) { |
|
78 | + return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @param object $object |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public function has( $object ) { |
|
93 | - return parent::has( $object ); |
|
92 | + public function has($object) { |
|
93 | + return parent::has($object); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $message_type_name |
105 | 105 | * @return bool |
106 | 106 | */ |
107 | - public function has_by_name( $message_type_name ) { |
|
108 | - return $this->get_by_info( $message_type_name ) instanceof $this->interface ? true : false; |
|
107 | + public function has_by_name($message_type_name) { |
|
108 | + return $this->get_by_info($message_type_name) instanceof $this->interface ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param $object |
120 | 120 | * @return bool |
121 | 121 | */ |
122 | - public function remove( $object ) { |
|
123 | - return parent::remove( $object ); |
|
122 | + public function remove($object) { |
|
123 | + return parent::remove($object); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @param $object |
135 | 135 | * @return void |
136 | 136 | */ |
137 | - public function set_current( $object ) { |
|
138 | - parent::set_current( $object ); |
|
137 | + public function set_current($object) { |
|
138 | + parent::set_current($object); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param $info |
150 | 150 | * @return void |
151 | 151 | */ |
152 | - public function set_current_by_info( $info ) { |
|
153 | - parent::set_current_by_info( $info ); |
|
152 | + public function set_current_by_info($info) { |
|
153 | + parent::set_current_by_info($info); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | * @return void |
165 | 165 | */ |
166 | 166 | public function show_collection_classes() { |
167 | - if ( WP_DEBUG ) { |
|
167 | + if (WP_DEBUG) { |
|
168 | 168 | $this->rewind(); |
169 | - while ( $this->valid() ) { |
|
170 | - echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>'; |
|
169 | + while ($this->valid()) { |
|
170 | + echo '<h5 style="color:#2EA2CC;">'.__CLASS__.' class : <span style="color:#E76700">'.$this->getInfo().'</span></h5>'; |
|
171 | 171 | $this->next(); |
172 | 172 | } |
173 | 173 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param mixed $info |
40 | 40 | * @return bool |
41 | 41 | */ |
42 | - public function add( $object, $info = null ) { |
|
43 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | - return parent::add( $object, $info ); |
|
42 | + public function add($object, $info = null) { |
|
43 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
44 | + return parent::add($object, $info); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param mixed $info |
58 | 58 | * @return bool |
59 | 59 | */ |
60 | - public function set_info( $object, $info = null ) { |
|
61 | - $info = empty( $info ) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | - return parent::set_info( $object, $info ); |
|
60 | + public function set_info($object, $info = null) { |
|
61 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
62 | + return parent::set_info($object, $info); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * @param mixed |
75 | 75 | * @return null | object |
76 | 76 | */ |
77 | - public function get_by_info( $info ) { |
|
78 | - return parent::get_by_info( str_replace( ' ', '_', strtolower( $info ) ) ); |
|
77 | + public function get_by_info($info) { |
|
78 | + return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @param object $object |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public function has( $object ) { |
|
93 | - return parent::has( $object ); |
|
92 | + public function has($object) { |
|
93 | + return parent::has($object); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $messenger_name |
105 | 105 | * @return bool |
106 | 106 | */ |
107 | - public function has_by_name( $messenger_name ) { |
|
108 | - return $this->get_by_info( $messenger_name ) instanceof $this->interface ? true : false; |
|
107 | + public function has_by_name($messenger_name) { |
|
108 | + return $this->get_by_info($messenger_name) instanceof $this->interface ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param $object |
120 | 120 | * @return bool |
121 | 121 | */ |
122 | - public function remove( $object ) { |
|
123 | - return parent::remove( $object ); |
|
122 | + public function remove($object) { |
|
123 | + return parent::remove($object); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | * @param $object |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public function set_current( $object ) { |
|
152 | - parent::set_current( $object ); |
|
151 | + public function set_current($object) { |
|
152 | + parent::set_current($object); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * @param $info |
164 | 164 | * @return void |
165 | 165 | */ |
166 | - public function set_current_by_info( $info ) { |
|
167 | - parent::set_current_by_info( $info ); |
|
166 | + public function set_current_by_info($info) { |
|
167 | + parent::set_current_by_info($info); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @return void |
179 | 179 | */ |
180 | 180 | public function show_collection_classes() { |
181 | - if ( WP_DEBUG ) { |
|
181 | + if (WP_DEBUG) { |
|
182 | 182 | $this->rewind(); |
183 | - while ( $this->valid() ) { |
|
184 | - echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : . <span style="color:#E76700">' . $this->getInfo() . '</span></h5>'; |
|
183 | + while ($this->valid()) { |
|
184 | + echo '<h5 style="color:#2EA2CC;">'.__CLASS__.' class : . <span style="color:#E76700">'.$this->getInfo().'</span></h5>'; |
|
185 | 185 | $this->next(); |
186 | 186 | } |
187 | 187 | } |