@@ -72,7 +72,7 @@ |
||
72 | 72 | /** |
73 | 73 | * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the messages system. |
74 | 74 | * @param array $dir_ref original array of paths |
75 | - * @return array appended paths |
|
75 | + * @return string[] appended paths |
|
76 | 76 | */ |
77 | 77 | public function messages_autoload_paths( $dir_ref ) { |
78 | 78 | $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @since 4.3.2 |
16 | 16 | * @author Darren Ethier |
17 | 17 | */ |
18 | -class EE_Caf_Messages { |
|
18 | +class EE_Caf_Messages { |
|
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
@@ -34,32 +34,32 @@ discard block |
||
34 | 34 | * @return void |
35 | 35 | */ |
36 | 36 | private function _caf_hooks() { |
37 | - add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 ); |
|
38 | - add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 ); |
|
39 | - add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 ); |
|
40 | - add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 ); |
|
41 | - add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 ); |
|
37 | + add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
38 | + add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2); |
|
39 | + add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2); |
|
40 | + add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7); |
|
41 | + add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2); |
|
42 | 42 | |
43 | 43 | //shortcode parsers |
44 | - add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 ); |
|
45 | - add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 ); |
|
46 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 ); |
|
47 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 ); |
|
48 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 ); |
|
49 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 ); |
|
44 | + add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
45 | + add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
46 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
47 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5); |
|
48 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
49 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @since 4.2.0 |
53 | 53 | */ |
54 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 ); |
|
55 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 ); |
|
54 | + add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
55 | + add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @since 4.3.0 |
59 | 59 | */ |
60 | 60 | //eat our own dogfood! |
61 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) ); |
|
62 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) ); |
|
61 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
62 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
63 | 63 | do_action('EE_Brewing_Regular___messages_caf'); |
64 | 64 | } |
65 | 65 | |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | * @param array $dir_ref original array of paths |
71 | 71 | * @return array appended paths |
72 | 72 | */ |
73 | - public function messages_autoload_paths( $dir_ref ) { |
|
74 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
73 | + public function messages_autoload_paths($dir_ref) { |
|
74 | + $dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/'; |
|
75 | 75 | return $dir_ref; |
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | - public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) { |
|
80 | + public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) { |
|
81 | 81 | $validator_config['attendee_list'] = array( |
82 | 82 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
83 | 83 | 'required' => array('[ATTENDEE_LIST]') |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | - public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) { |
|
95 | + public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) { |
|
96 | 96 | $template_fields['extra']['content']['question_list'] = array( |
97 | 97 | 'input' => 'textarea', |
98 | 98 | 'label' => '[QUESTION_LIST]', |
@@ -109,39 +109,39 @@ discard block |
||
109 | 109 | |
110 | 110 | |
111 | 111 | |
112 | - public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) { |
|
112 | + public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) { |
|
113 | 113 | |
114 | 114 | //we're only modifying templates for the default template pack |
115 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) { |
|
115 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
116 | 116 | return $contents; |
117 | 117 | } |
118 | 118 | |
119 | 119 | //the template file name we're replacing contents for. |
120 | - $template_file_prefix = $field . '_' . $context; |
|
121 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_' ; |
|
120 | + $template_file_prefix = $field.'_'.$context; |
|
121 | + $msg_prefix = $messenger->name.'_'.$message_type->name.'_'; |
|
122 | 122 | |
123 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
123 | + $base_path = EE_CAF_LIBRARIES.'messages/defaults/default/'; |
|
124 | 124 | |
125 | - if ( $messenger->name == 'email' && $message_type->name == 'registration' ) { |
|
125 | + if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
126 | 126 | |
127 | - switch ( $template_file_prefix ) { |
|
127 | + switch ($template_file_prefix) { |
|
128 | 128 | |
129 | 129 | case 'question_list_admin' : |
130 | 130 | case 'question_list_attendee' : |
131 | 131 | case 'question_list_primary_attendee' : |
132 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
133 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
132 | + $path = $base_path.$msg_prefix.'question_list.template.php'; |
|
133 | + $contents = EEH_Template::display_template($path, array(), true); |
|
134 | 134 | break; |
135 | 135 | |
136 | 136 | case 'attendee_list_primary_attendee' : |
137 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
138 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
137 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
138 | + $contents = EEH_Template::display_template($path, array(), true); |
|
139 | 139 | break; |
140 | 140 | |
141 | 141 | case 'attendee_list_admin' : |
142 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
143 | - $contents = EEH_Template::display_template( $path, |
|
144 | - array(), true ); |
|
142 | + $path = $base_path.$msg_prefix.'attendee_list_admin.template.php'; |
|
143 | + $contents = EEH_Template::display_template($path, |
|
144 | + array(), true); |
|
145 | 145 | break; |
146 | 146 | |
147 | 147 | case 'attendee_list_attendee' : |
@@ -149,26 +149,26 @@ discard block |
||
149 | 149 | break; |
150 | 150 | |
151 | 151 | case 'event_list_attendee' : |
152 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
153 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
152 | + $path = $base_path.$msg_prefix.'event_list_attendee.template.php'; |
|
153 | + $contents = EEH_Template::display_template($path, array(), true); |
|
154 | 154 | break; |
155 | 155 | } |
156 | - } elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) { |
|
157 | - switch( $template_file_prefix ) { |
|
156 | + } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
157 | + switch ($template_file_prefix) { |
|
158 | 158 | |
159 | 159 | case 'content_attendee' : |
160 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
161 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
160 | + $path = $base_path.$msg_prefix.'content.template.php'; |
|
161 | + $contents = EEH_Template::display_template($path, array(), true); |
|
162 | 162 | break; |
163 | 163 | |
164 | 164 | case 'newsletter_content_attendee' : |
165 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
166 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
165 | + $path = $base_path.$msg_prefix.'newsletter_content.template.php'; |
|
166 | + $contents = EEH_Template::display_template($path, array(), true); |
|
167 | 167 | break; |
168 | 168 | |
169 | 169 | case 'newsletter_subject_attendee' : |
170 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
171 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
170 | + $path = $base_path.$msg_prefix.'subject.template.php'; |
|
171 | + $contents = EEH_Template::display_template($path, array(), true); |
|
172 | 172 | break; |
173 | 173 | } |
174 | 174 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | |
182 | - public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) { |
|
182 | + public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) { |
|
183 | 183 | //make sure question_list and question are ONLY added for the core message types. Any other message types will have to explicitly set question_list as a valid shortcode. |
184 | 184 | $include_with = array( |
185 | 185 | 'registration', |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | 'payment_reminder', |
194 | 194 | 'pending_approval' |
195 | 195 | ); |
196 | - if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) { |
|
196 | + if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
197 | 197 | $contexts = array_keys($msg->get_contexts()); |
198 | - foreach ( $contexts as $context ) { |
|
198 | + foreach ($contexts as $context) { |
|
199 | 199 | $valid_shortcodes[$context][] = 'question_list'; |
200 | 200 | $valid_shortcodes[$context][] = 'question'; |
201 | 201 | } |
@@ -207,35 +207,35 @@ discard block |
||
207 | 207 | |
208 | 208 | |
209 | 209 | |
210 | - public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) { |
|
210 | + public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) { |
|
211 | 211 | $shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', 'event_espresso'); |
212 | 212 | return $shortcodes; |
213 | 213 | } |
214 | 214 | |
215 | 215 | |
216 | 216 | |
217 | - public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
217 | + public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
218 | 218 | |
219 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
219 | + if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations)) |
|
220 | 220 | return $parsed; |
221 | 221 | |
222 | 222 | //let's get the question from the code. |
223 | 223 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
224 | - $shortcode = trim( str_replace(']', '', $shortcode) ); |
|
224 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
225 | 225 | |
226 | 226 | $registration = $data instanceof EE_Registration ? $data : null; |
227 | - $registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
227 | + $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
228 | 228 | |
229 | 229 | $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
230 | - $aee = ! $aee instanceof EE_Messages_Adressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee; |
|
230 | + $aee = ! $aee instanceof EE_Messages_Adressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
231 | 231 | |
232 | - if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) { |
|
232 | + if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
233 | 233 | return $parsed; |
234 | 234 | } |
235 | 235 | |
236 | 236 | //now let's figure out which question has this text. |
237 | - foreach ( $aee->questions as $ansid => $question ) { |
|
238 | - if ( $question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) |
|
237 | + foreach ($aee->questions as $ansid => $question) { |
|
238 | + if ($question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])) |
|
239 | 239 | return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
240 | 240 | } |
241 | 241 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return array array of shortcodes and |
257 | 257 | * descriptions |
258 | 258 | */ |
259 | - public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) { |
|
259 | + public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) { |
|
260 | 260 | $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso'); |
261 | 261 | $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso'); |
262 | 262 | $shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', 'event_espresso'); |
@@ -278,13 +278,13 @@ discard block |
||
278 | 278 | * @param EE_Datetime_Shortcodes $shortcode_parser |
279 | 279 | * @return string The new parsed string. |
280 | 280 | */ |
281 | - public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
281 | + public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
282 | 282 | |
283 | - if ( ! $data instanceof EE_Datetime ) { |
|
283 | + if ( ! $data instanceof EE_Datetime) { |
|
284 | 284 | return ''; //get out because we can only parse with the datetime object. |
285 | 285 | } |
286 | 286 | |
287 | - switch ( $shortcode ) { |
|
287 | + switch ($shortcode) { |
|
288 | 288 | case '[DTT_NAME]' : |
289 | 289 | return $data->name(); |
290 | 290 | break; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | return $data->description(); |
293 | 293 | break; |
294 | 294 | case '[DTT_NAME_OR_DATES]' : |
295 | - return $data->get_dtt_display_name( TRUE ); |
|
295 | + return $data->get_dtt_display_name(TRUE); |
|
296 | 296 | break; |
297 | 297 | default : |
298 | 298 | return $parsed; |
@@ -304,43 +304,43 @@ discard block |
||
304 | 304 | |
305 | 305 | |
306 | 306 | |
307 | - public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
307 | + public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) { |
|
308 | 308 | $shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', 'event_espresso'); |
309 | 309 | return $shortcodes; |
310 | 310 | } |
311 | 311 | |
312 | 312 | |
313 | - public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
313 | + public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
314 | 314 | |
315 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
315 | + if (array($data) && ! isset($data['data'])) |
|
316 | 316 | return $parsed; |
317 | 317 | |
318 | 318 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
319 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
319 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
320 | 320 | |
321 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
321 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
322 | 322 | return $parsed; |
323 | 323 | |
324 | 324 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
325 | 325 | |
326 | - switch ( $shortcode ) { |
|
326 | + switch ($shortcode) { |
|
327 | 327 | case '[RECIPIENT_QUESTION_LIST]' : |
328 | - if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee ) |
|
328 | + if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee) |
|
329 | 329 | return ''; |
330 | 330 | |
331 | 331 | $registration = $recipient->reg_obj; |
332 | 332 | $attendee = $recipient->att_obj; |
333 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
333 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
334 | 334 | $valid_shortcodes = array('question'); |
335 | 335 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
336 | - $answers = !empty($recipient->registrations[$registration->ID()]['ans_objs']) ? $recipient->registrations[$registration->ID()]['ans_objs'] : array(); |
|
336 | + $answers = ! empty($recipient->registrations[$registration->ID()]['ans_objs']) ? $recipient->registrations[$registration->ID()]['ans_objs'] : array(); |
|
337 | 337 | $question_list = ''; |
338 | - foreach ( $answers as $answer ) { |
|
338 | + foreach ($answers as $answer) { |
|
339 | 339 | $question = $answer->question(); |
340 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
340 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
341 | 341 | continue; |
342 | 342 | } |
343 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data); |
|
343 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data); |
|
344 | 344 | } |
345 | 345 | return $question_list; |
346 | 346 | break; |
@@ -352,41 +352,41 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | |
355 | - public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
355 | + public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) { |
|
356 | 356 | $shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', 'event_espresso'); |
357 | 357 | return $shortcodes; |
358 | 358 | } |
359 | 359 | |
360 | 360 | |
361 | - public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
362 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
361 | + public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
362 | + if (array($data) && ! isset($data['data'])) |
|
363 | 363 | return $parsed; |
364 | 364 | |
365 | 365 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
366 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
366 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
367 | 367 | |
368 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
368 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
369 | 369 | return $parsed; |
370 | 370 | |
371 | 371 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
372 | 372 | |
373 | - switch ( $shortcode ) { |
|
373 | + switch ($shortcode) { |
|
374 | 374 | case '[RECIPIENT_QUESTION_LIST]' : |
375 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
375 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) |
|
376 | 376 | return ''; |
377 | 377 | $attendee = $recipient->primary_att_obj; |
378 | 378 | $registration = $recipient->primary_reg_obj; |
379 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
379 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
380 | 380 | $valid_shortcodes = array('question'); |
381 | 381 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
382 | 382 | $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
383 | 383 | $question_list = ''; |
384 | - foreach ( $answers as $answer ) { |
|
384 | + foreach ($answers as $answer) { |
|
385 | 385 | $question = $answer->question(); |
386 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
386 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
387 | 387 | continue; |
388 | 388 | } |
389 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data); |
|
389 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data); |
|
390 | 390 | } |
391 | 391 | return $question_list; |
392 | 392 | break; |
@@ -411,67 +411,67 @@ discard block |
||
411 | 411 | $setup_args = array( |
412 | 412 | 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
413 | 413 | 'autoloadpaths' => array( |
414 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
414 | + EE_CAF_LIBRARIES.'messages/message_type/newsletter/' |
|
415 | 415 | ), |
416 | - 'messengers_to_activate_with' => array( 'email' ), |
|
417 | - 'messengers_to_validate_with' => array( 'email' ) |
|
416 | + 'messengers_to_activate_with' => array('email'), |
|
417 | + 'messengers_to_validate_with' => array('email') |
|
418 | 418 | ); |
419 | - EE_Register_Message_Type::register( 'newsletter', $setup_args ); |
|
419 | + EE_Register_Message_Type::register('newsletter', $setup_args); |
|
420 | 420 | |
421 | 421 | //register payment reminder message type |
422 | 422 | $setup_args = array( |
423 | 423 | 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
424 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ), |
|
425 | - 'messengers_to_activate_with' => array( 'email' ), |
|
426 | - 'messengers_to_validate_with' => array( 'email' ) |
|
424 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'), |
|
425 | + 'messengers_to_activate_with' => array('email'), |
|
426 | + 'messengers_to_validate_with' => array('email') |
|
427 | 427 | ); |
428 | - EE_Register_Message_Type::register( 'payment_reminder', $setup_args ); |
|
428 | + EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
429 | 429 | |
430 | 430 | //register payment declined message type |
431 | 431 | $setup_args = array( |
432 | 432 | 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
433 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ), |
|
434 | - 'messengers_to_activate_with' => array( 'email' ), |
|
435 | - 'messengers_to_validate_with' => array( 'email' ) |
|
433 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'), |
|
434 | + 'messengers_to_activate_with' => array('email'), |
|
435 | + 'messengers_to_validate_with' => array('email') |
|
436 | 436 | ); |
437 | - EE_Register_Message_Type::register( 'payment_declined', $setup_args ); |
|
437 | + EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
438 | 438 | |
439 | 439 | //register registration declined message type |
440 | 440 | $setup_args = array( |
441 | 441 | 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
442 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ), |
|
443 | - 'messengers_to_activate_with' => array( 'email' ), |
|
444 | - 'messengers_to_validate_with' => array( 'email' ) |
|
442 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'), |
|
443 | + 'messengers_to_activate_with' => array('email'), |
|
444 | + 'messengers_to_validate_with' => array('email') |
|
445 | 445 | ); |
446 | - EE_Register_Message_Type::register( 'declined_registration', $setup_args ); |
|
446 | + EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
447 | 447 | |
448 | 448 | //register registration cancelled message type |
449 | 449 | $setup_args = array( |
450 | 450 | 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
451 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ), |
|
452 | - 'messengers_to_activate_with' => array( 'email' ), |
|
453 | - 'messengers_to_validate_with' => array( 'email' ) |
|
451 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'), |
|
452 | + 'messengers_to_activate_with' => array('email'), |
|
453 | + 'messengers_to_validate_with' => array('email') |
|
454 | 454 | ); |
455 | - EE_Register_Message_Type::register( 'cancelled_registration', $setup_args ); |
|
455 | + EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
456 | 456 | |
457 | 457 | |
458 | 458 | //register payment failed message type |
459 | 459 | $setup_args = array( |
460 | 460 | 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
461 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ), |
|
462 | - 'messengers_to_activate_with' => array( 'email' ), |
|
463 | - 'messengers_to_validate_with' => array( 'email' ) |
|
461 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'), |
|
462 | + 'messengers_to_activate_with' => array('email'), |
|
463 | + 'messengers_to_validate_with' => array('email') |
|
464 | 464 | ); |
465 | - EE_Register_Message_Type::register( 'payment_failed', $setup_args ); |
|
465 | + EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
466 | 466 | |
467 | 467 | //register payment declined message type |
468 | 468 | $setup_args = array( |
469 | 469 | 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
470 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ), |
|
471 | - 'messengers_to_activate_with' => array( 'email' ), |
|
472 | - 'messengers_to_validate_with' => array( 'email' ) |
|
470 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'), |
|
471 | + 'messengers_to_activate_with' => array('email'), |
|
472 | + 'messengers_to_validate_with' => array('email') |
|
473 | 473 | ); |
474 | - EE_Register_Message_Type::register( 'payment_cancelled', $setup_args ); |
|
474 | + EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -487,12 +487,12 @@ discard block |
||
487 | 487 | public function register_caf_shortcodes() { |
488 | 488 | $setup_args = array( |
489 | 489 | 'autoloadpaths' => array( |
490 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
490 | + EE_CAF_LIBRARIES.'shortcodes/' |
|
491 | 491 | ), |
492 | - 'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ), |
|
493 | - 'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ), |
|
494 | - 'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' ) |
|
492 | + 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
493 | + 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
494 | + 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
495 | 495 | ); |
496 | - EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args ); |
|
496 | + EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
497 | 497 | } |
498 | 498 | } |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage plugin api, messages |
6 | 6 | * @since 4.3.2 |
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 | * Used to initialize all EE messages caffeianted functionality. |
@@ -216,8 +218,9 @@ discard block |
||
216 | 218 | |
217 | 219 | public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
218 | 220 | |
219 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
220 | - return $parsed; |
|
221 | + if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) { |
|
222 | + return $parsed; |
|
223 | + } |
|
221 | 224 | |
222 | 225 | //let's get the question from the code. |
223 | 226 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
@@ -235,8 +238,9 @@ discard block |
||
235 | 238 | |
236 | 239 | //now let's figure out which question has this text. |
237 | 240 | foreach ( $aee->questions as $ansid => $question ) { |
238 | - if ( $question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) |
|
239 | - return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
241 | + if ( $question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) { |
|
242 | + return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
243 | + } |
|
240 | 244 | } |
241 | 245 | |
242 | 246 | //nothing! |
@@ -312,21 +316,24 @@ discard block |
||
312 | 316 | |
313 | 317 | public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
314 | 318 | |
315 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
316 | - return $parsed; |
|
319 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
320 | + return $parsed; |
|
321 | + } |
|
317 | 322 | |
318 | 323 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
319 | 324 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
320 | 325 | |
321 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
322 | - return $parsed; |
|
326 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
327 | + return $parsed; |
|
328 | + } |
|
323 | 329 | |
324 | 330 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
325 | 331 | |
326 | 332 | switch ( $shortcode ) { |
327 | 333 | case '[RECIPIENT_QUESTION_LIST]' : |
328 | - if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee ) |
|
329 | - return ''; |
|
334 | + if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee ) { |
|
335 | + return ''; |
|
336 | + } |
|
330 | 337 | |
331 | 338 | $registration = $recipient->reg_obj; |
332 | 339 | $attendee = $recipient->att_obj; |
@@ -359,21 +366,24 @@ discard block |
||
359 | 366 | |
360 | 367 | |
361 | 368 | public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
362 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
363 | - return $parsed; |
|
369 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
370 | + return $parsed; |
|
371 | + } |
|
364 | 372 | |
365 | 373 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
366 | 374 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
367 | 375 | |
368 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
369 | - return $parsed; |
|
376 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
377 | + return $parsed; |
|
378 | + } |
|
370 | 379 | |
371 | 380 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
372 | 381 | |
373 | 382 | switch ( $shortcode ) { |
374 | 383 | case '[RECIPIENT_QUESTION_LIST]' : |
375 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
376 | - return ''; |
|
384 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) { |
|
385 | + return ''; |
|
386 | + } |
|
377 | 387 | $attendee = $recipient->primary_att_obj; |
378 | 388 | $registration = $recipient->primary_reg_obj; |
379 | 389 | $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
@@ -109,7 +109,7 @@ |
||
109 | 109 | * @access public |
110 | 110 | * @param EE_Events_Archive_Config $CFG |
111 | 111 | * @param EE_Request_Handler $REQ |
112 | - * @return void |
|
112 | + * @return EE_Events_Archive_Config |
|
113 | 113 | */ |
114 | 114 | public static function update_template_settings( $CFG, $REQ ) { |
115 | 115 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
54 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
54 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param WP $WP |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public static function template_settings_form() { |
81 | 81 | // grab general settings admin page and remove the existing hook callback |
82 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
83 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
84 | - remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 ); |
|
82 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
83 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
84 | + remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); |
|
85 | 85 | } |
86 | 86 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
87 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
88 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
87 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
88 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
89 | 89 | $events_archive_settings = array( |
90 | 90 | 'display_status_banner' => 0, |
91 | 91 | 'display_description' => 1, |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | 'display_venue' => 0, |
95 | 95 | 'display_expired_events' => 0 |
96 | 96 | ); |
97 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
98 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
97 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
98 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | * @param EE_Request_Handler $REQ |
112 | 112 | * @return void |
113 | 113 | */ |
114 | - public static function update_template_settings( $CFG, $REQ ) { |
|
114 | + public static function update_template_settings($CFG, $REQ) { |
|
115 | 115 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
116 | 116 | // unless we are resetting the config... |
117 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
118 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
119 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
120 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
121 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
122 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
123 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
117 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
118 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
119 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
120 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
121 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
122 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
123 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
124 | 124 | return $CFG; |
125 | 125 | } |
126 | 126 |
@@ -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 | * Event Espresso |
4 | 6 | * |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * process_recaptcha |
288 | 288 | * |
289 | 289 | * @access private |
290 | - * @return boolean |
|
290 | + * @return boolean|null |
|
291 | 291 | */ |
292 | 292 | private static function _get_recaptcha_response() { |
293 | 293 | EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @access public |
576 | 576 | * @param EE_Registration_Config $EE_Registration_Config |
577 | - * @return array |
|
577 | + * @return EE_Registration_Config |
|
578 | 578 | */ |
579 | 579 | public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
580 | 580 | try { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Recaptcha |
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | - return parent::get_instance( __CLASS__ ); |
|
46 | + return parent::get_instance(__CLASS__); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function set_hooks() { |
58 | 58 | // use_captcha ? |
59 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
59 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
60 | 60 | EED_Recaptcha::set_definitions(); |
61 | 61 | EED_Recaptcha::enqueue_styles_and_scripts(); |
62 | - add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
|
63 | - add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 ); |
|
64 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
65 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
66 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
62 | + add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
63 | + add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0); |
|
64 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
65 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
66 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | public static function set_hooks_admin() { |
79 | 79 | EED_Recaptcha::set_definitions(); |
80 | 80 | // use_captcha ? |
81 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
81 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
82 | 82 | EED_Recaptcha::enqueue_styles_and_scripts(); |
83 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
84 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
85 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
83 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
84 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
85 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
86 | 86 | } |
87 | 87 | // admin settings |
88 | - add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
|
89 | - add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
|
88 | + add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
89 | + add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | public static function set_definitions() { |
101 | - if ( is_user_logged_in() ) { |
|
101 | + if (is_user_logged_in()) { |
|
102 | 102 | EED_Recaptcha::$_not_a_robot = true; |
103 | 103 | } |
104 | - define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
105 | - define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
104 | + define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
105 | + define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public static function set_late_hooks() { |
117 | 117 | add_filter( |
118 | 118 | 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
119 | - array( 'EED_Recaptcha', 'not_a_robot' ) |
|
119 | + array('EED_Recaptcha', 'not_a_robot') |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 | |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | public static function enqueue_styles_and_scripts() { |
132 | - wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
133 | - wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
134 | - EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
135 | - EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
136 | - EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
132 | + wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
133 | + wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE); |
|
134 | + EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
135 | + EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
136 | + EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @access public |
145 | 145 | * @param \WP $WP |
146 | 146 | */ |
147 | - public function run( $WP ) { |
|
147 | + public function run($WP) { |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -154,8 +154,7 @@ discard block |
||
154 | 154 | * @return boolean |
155 | 155 | */ |
156 | 156 | public static function not_a_robot() { |
157 | - $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
|
158 | - EED_Recaptcha::recaptcha_passed(); |
|
157 | + $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
|
159 | 158 | return $not_a_robot; |
160 | 159 | } |
161 | 160 | |
@@ -171,23 +170,23 @@ discard block |
||
171 | 170 | */ |
172 | 171 | public static function display_recaptcha() { |
173 | 172 | // logged in means you have already passed a turing test of sorts |
174 | - if ( is_user_logged_in() ) { |
|
173 | + if (is_user_logged_in()) { |
|
175 | 174 | return; |
176 | 175 | } |
177 | 176 | // don't display if not using recaptcha or user is logged in |
178 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
177 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
179 | 178 | // only display if they have NOT passed the test yet |
180 | - if ( ! EED_Recaptcha::$_not_a_robot ) { |
|
181 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
179 | + if ( ! EED_Recaptcha::$_not_a_robot) { |
|
180 | + EE_Registry::instance()->load_helper('Template'); |
|
182 | 181 | EEH_Template::display_template( |
183 | - RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
182 | + RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
|
184 | 183 | array( |
185 | 184 | 'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
186 | 185 | 'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
187 | 186 | 'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
188 | 187 | ) |
189 | 188 | ); |
190 | - wp_enqueue_script( 'google_recaptcha' ); |
|
189 | + wp_enqueue_script('google_recaptcha'); |
|
191 | 190 | } |
192 | 191 | } |
193 | 192 | } |
@@ -205,17 +204,17 @@ discard block |
||
205 | 204 | */ |
206 | 205 | public static function recaptcha_passed() { |
207 | 206 | // logged in means you have already passed a turing test of sorts |
208 | - if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
207 | + if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
|
209 | 208 | return TRUE; |
210 | 209 | } |
211 | 210 | // was test already passed? |
212 | - $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
|
213 | - $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
211 | + $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
212 | + $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
|
214 | 213 | // verify recaptcha |
215 | 214 | EED_Recaptcha::_get_recaptcha_response(); |
216 | - if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
215 | + if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
|
217 | 216 | $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
218 | - EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
217 | + EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
|
219 | 218 | EE_Registry::instance()->SSN->update(); |
220 | 219 | } |
221 | 220 | EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
@@ -231,8 +230,8 @@ discard block |
||
231 | 230 | * @param array $recaptcha_response |
232 | 231 | * @return boolean |
233 | 232 | */ |
234 | - public static function recaptcha_response( $recaptcha_response = array() ) { |
|
235 | - if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
233 | + public static function recaptcha_response($recaptcha_response = array()) { |
|
234 | + if (EED_Recaptcha::_bypass_recaptcha()) { |
|
236 | 235 | $recaptcha_response['bypass_recaptcha'] = TRUE; |
237 | 236 | $recaptcha_response['recaptcha_passed'] = TRUE; |
238 | 237 | } else { |
@@ -252,16 +251,16 @@ discard block |
||
252 | 251 | */ |
253 | 252 | private static function _bypass_recaptcha() { |
254 | 253 | // an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
255 | - $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
254 | + $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
|
256 | 255 | // does $bypass_request_params_array have any values ? |
257 | - if ( empty( $bypass_request_params_array )) { |
|
256 | + if (empty($bypass_request_params_array)) { |
|
258 | 257 | return FALSE; |
259 | 258 | } |
260 | 259 | // initially set bypass to TRUE |
261 | 260 | $bypass_recaptcha = TRUE; |
262 | - foreach ( $bypass_request_params_array as $key => $value ) { |
|
261 | + foreach ($bypass_request_params_array as $key => $value) { |
|
263 | 262 | // if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass |
264 | - $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
263 | + $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
|
265 | 264 | } |
266 | 265 | return $bypass_recaptcha; |
267 | 266 | } |
@@ -276,7 +275,7 @@ discard block |
||
276 | 275 | * @return boolean |
277 | 276 | */ |
278 | 277 | private static function _get_recaptcha_response() { |
279 | - EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
278 | + EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
|
280 | 279 | } |
281 | 280 | |
282 | 281 | |
@@ -290,22 +289,22 @@ discard block |
||
290 | 289 | */ |
291 | 290 | private static function _process_recaptcha_response() { |
292 | 291 | // verify library is loaded |
293 | - if ( ! class_exists( 'ReCaptcha' )) { |
|
294 | - require_once( RECAPTCHA_BASE_PATH . 'recaptchalib.php' ); |
|
292 | + if ( ! class_exists('ReCaptcha')) { |
|
293 | + require_once(RECAPTCHA_BASE_PATH.'recaptchalib.php'); |
|
295 | 294 | } |
296 | 295 | // The response from reCAPTCHA |
297 | 296 | EED_Recaptcha::_get_recaptcha_response(); |
298 | 297 | $recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
299 | 298 | // Was there a reCAPTCHA response? |
300 | - if ( $recaptcha_response ) { |
|
301 | - $reCaptcha = new ReCaptcha( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ); |
|
299 | + if ($recaptcha_response) { |
|
300 | + $reCaptcha = new ReCaptcha(EE_Registry::instance()->CFG->registration->recaptcha_privatekey); |
|
302 | 301 | $recaptcha_response = $reCaptcha->verifyResponse( |
303 | 302 | $_SERVER['REMOTE_ADDR'], |
304 | 303 | EED_Recaptcha::$_recaptcha_response |
305 | 304 | ); |
306 | 305 | } |
307 | 306 | // sorry... it appears you can't read gibberish chicken scratches !!! |
308 | - if ( $recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success ) { |
|
307 | + if ($recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success) { |
|
309 | 308 | return TRUE; |
310 | 309 | } |
311 | 310 | return FALSE; |
@@ -339,8 +338,8 @@ discard block |
||
339 | 338 | */ |
340 | 339 | protected static function _recaptcha_settings_form() { |
341 | 340 | |
342 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
343 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
341 | + EE_Registry::instance()->load_helper('HTML'); |
|
342 | + EE_Registry::instance()->load_helper('Template'); |
|
344 | 343 | |
345 | 344 | return new EE_Form_Section_Proper( |
346 | 345 | array( |
@@ -350,12 +349,12 @@ discard block |
||
350 | 349 | 'subsections' => apply_filters( |
351 | 350 | 'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
352 | 351 | array( |
353 | - 'main_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))), |
|
352 | + 'main_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))), |
|
354 | 353 | 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
355 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
354 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Appearance', 'event_espresso'))), |
|
356 | 355 | 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
357 | 356 | // 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
358 | - 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
357 | + 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
|
359 | 358 | ) |
360 | 359 | ) |
361 | 360 | ) |
@@ -382,28 +381,28 @@ discard block |
||
382 | 381 | array( |
383 | 382 | 'use_captcha' => new EE_Yes_No_Input( |
384 | 383 | array( |
385 | - 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
384 | + 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
|
386 | 385 | 'html_help_text' => sprintf( |
387 | - __( 'reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ), |
|
386 | + __('reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'), |
|
388 | 387 | '<a href="https://www.google.com/recaptcha/intro/index.html">', |
389 | 388 | '</a>' |
390 | 389 | ), |
391 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
390 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
392 | 391 | 'display_html_label_text' => FALSE |
393 | 392 | ) |
394 | 393 | ), |
395 | 394 | 'recaptcha_publickey' => new EE_Text_Input( |
396 | 395 | array( |
397 | - 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
|
398 | - 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
|
399 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
396 | + 'html_label_text' => __('Site Key', 'event_espresso'), |
|
397 | + 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
398 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
|
400 | 399 | ) |
401 | 400 | ), |
402 | 401 | 'recaptcha_privatekey' => new EE_Text_Input( |
403 | 402 | array( |
404 | - 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
|
405 | - 'html_help_text' => __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ), |
|
406 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
403 | + 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
404 | + 'html_help_text' => __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'), |
|
405 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
|
407 | 406 | ) |
408 | 407 | ) |
409 | 408 | ) |
@@ -435,81 +434,81 @@ discard block |
||
435 | 434 | array( |
436 | 435 | 'recaptcha_theme' => new EE_Radio_Button_Input( |
437 | 436 | array( |
438 | - 'light' => __( 'Light', 'event_espresso' ), |
|
439 | - 'dark' => __( 'Dark', 'event_espresso' ) |
|
437 | + 'light' => __('Light', 'event_espresso'), |
|
438 | + 'dark' => __('Dark', 'event_espresso') |
|
440 | 439 | ), |
441 | 440 | array( |
442 | - 'html_label_text' => __( 'Theme', 'event_espresso' ), |
|
443 | - 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
|
444 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
441 | + 'html_label_text' => __('Theme', 'event_espresso'), |
|
442 | + 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
443 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
445 | 444 | 'display_html_label_text' => FALSE |
446 | 445 | ) |
447 | 446 | ), |
448 | 447 | 'recaptcha_type' => new EE_Radio_Button_Input( |
449 | 448 | array( |
450 | - 'image' => __( 'Image', 'event_espresso' ), |
|
451 | - 'audio' => __( 'Audio', 'event_espresso' ) |
|
449 | + 'image' => __('Image', 'event_espresso'), |
|
450 | + 'audio' => __('Audio', 'event_espresso') |
|
452 | 451 | ), |
453 | 452 | array( |
454 | - 'html_label_text' => __( 'Type', 'event_espresso' ), |
|
455 | - 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
|
456 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
453 | + 'html_label_text' => __('Type', 'event_espresso'), |
|
454 | + 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
455 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
457 | 456 | 'display_html_label_text' =>FALSE |
458 | 457 | ) |
459 | 458 | ), |
460 | 459 | 'recaptcha_language' => new EE_Select_Input( |
461 | 460 | array( |
462 | - 'ar' => __( 'Arabic', 'event_espresso' ), |
|
463 | - 'bg' => __( 'Bulgarian', 'event_espresso' ), |
|
464 | - 'ca' => __( 'Catalan', 'event_espresso' ), |
|
465 | - 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
|
466 | - 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
|
467 | - 'hr' => __( 'Croatian', 'event_espresso' ), |
|
468 | - 'cs' => __( 'Czech', 'event_espresso' ), |
|
469 | - 'da' => __( 'Danish', 'event_espresso' ), |
|
470 | - 'nl' => __( 'Dutch', 'event_espresso' ), |
|
471 | - 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
|
472 | - 'en' => __( 'English (US)', 'event_espresso' ), |
|
473 | - 'fil' => __( 'Filipino', 'event_espresso' ), |
|
474 | - 'fi' => __( 'Finnish', 'event_espresso' ), |
|
475 | - 'fr' => __( 'French', 'event_espresso' ), |
|
476 | - 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
|
477 | - 'de' => __( 'German', 'event_espresso' ), |
|
478 | - 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
|
479 | - 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
|
480 | - 'el' => __( 'Greek', 'event_espresso' ), |
|
481 | - 'iw' => __( 'Hebrew', 'event_espresso' ), |
|
482 | - 'hi' => __( 'Hindi', 'event_espresso' ), |
|
483 | - 'hu' => __( 'Hungarian', 'event_espresso' ), |
|
484 | - 'id' => __( 'Indonesian', 'event_espresso' ), |
|
485 | - 'it' => __( 'Italian', 'event_espresso' ), |
|
486 | - 'ja' => __( 'Japanese', 'event_espresso' ), |
|
487 | - 'ko' => __( 'Korean', 'event_espresso' ), |
|
488 | - 'lv' => __( 'Latvian', 'event_espresso' ), |
|
489 | - 'lt' => __( 'Lithuanian', 'event_espresso' ), |
|
490 | - 'no' => __( 'Norwegian', 'event_espresso' ), |
|
491 | - 'fa' => __( 'Persian', 'event_espresso' ), |
|
492 | - 'pl' => __( 'Polish', 'event_espresso' ), |
|
493 | - 'pt' => __( 'Portuguese', 'event_espresso' ), |
|
494 | - 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
|
495 | - 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
|
496 | - 'ro' => __( 'Romanian', 'event_espresso' ), |
|
497 | - 'ru' => __( 'Russian', 'event_espresso' ), |
|
498 | - 'sr' => __( 'Serbian', 'event_espresso' ), |
|
499 | - 'sk' => __( 'Slovak', 'event_espresso' ), |
|
500 | - 'sl' => __( 'Slovenian', 'event_espresso' ), |
|
501 | - 'es' => __( 'Spanish', 'event_espresso' ), |
|
502 | - 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
|
503 | - 'sv' => __( 'Swedish', 'event_espresso' ), |
|
504 | - 'th' => __( 'Thai', 'event_espresso' ), |
|
505 | - 'tr' => __( 'Turkish', 'event_espresso' ), |
|
506 | - 'uk' => __( 'Ukrainian', 'event_espresso' ), |
|
507 | - 'vi' => __( 'Vietnamese', 'event_espresso') |
|
461 | + 'ar' => __('Arabic', 'event_espresso'), |
|
462 | + 'bg' => __('Bulgarian', 'event_espresso'), |
|
463 | + 'ca' => __('Catalan', 'event_espresso'), |
|
464 | + 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
465 | + 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
466 | + 'hr' => __('Croatian', 'event_espresso'), |
|
467 | + 'cs' => __('Czech', 'event_espresso'), |
|
468 | + 'da' => __('Danish', 'event_espresso'), |
|
469 | + 'nl' => __('Dutch', 'event_espresso'), |
|
470 | + 'en-GB' => __('English (UK)', 'event_espresso'), |
|
471 | + 'en' => __('English (US)', 'event_espresso'), |
|
472 | + 'fil' => __('Filipino', 'event_espresso'), |
|
473 | + 'fi' => __('Finnish', 'event_espresso'), |
|
474 | + 'fr' => __('French', 'event_espresso'), |
|
475 | + 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
476 | + 'de' => __('German', 'event_espresso'), |
|
477 | + 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
478 | + 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
479 | + 'el' => __('Greek', 'event_espresso'), |
|
480 | + 'iw' => __('Hebrew', 'event_espresso'), |
|
481 | + 'hi' => __('Hindi', 'event_espresso'), |
|
482 | + 'hu' => __('Hungarian', 'event_espresso'), |
|
483 | + 'id' => __('Indonesian', 'event_espresso'), |
|
484 | + 'it' => __('Italian', 'event_espresso'), |
|
485 | + 'ja' => __('Japanese', 'event_espresso'), |
|
486 | + 'ko' => __('Korean', 'event_espresso'), |
|
487 | + 'lv' => __('Latvian', 'event_espresso'), |
|
488 | + 'lt' => __('Lithuanian', 'event_espresso'), |
|
489 | + 'no' => __('Norwegian', 'event_espresso'), |
|
490 | + 'fa' => __('Persian', 'event_espresso'), |
|
491 | + 'pl' => __('Polish', 'event_espresso'), |
|
492 | + 'pt' => __('Portuguese', 'event_espresso'), |
|
493 | + 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
494 | + 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
495 | + 'ro' => __('Romanian', 'event_espresso'), |
|
496 | + 'ru' => __('Russian', 'event_espresso'), |
|
497 | + 'sr' => __('Serbian', 'event_espresso'), |
|
498 | + 'sk' => __('Slovak', 'event_espresso'), |
|
499 | + 'sl' => __('Slovenian', 'event_espresso'), |
|
500 | + 'es' => __('Spanish', 'event_espresso'), |
|
501 | + 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
502 | + 'sv' => __('Swedish', 'event_espresso'), |
|
503 | + 'th' => __('Thai', 'event_espresso'), |
|
504 | + 'tr' => __('Turkish', 'event_espresso'), |
|
505 | + 'uk' => __('Ukrainian', 'event_espresso'), |
|
506 | + 'vi' => __('Vietnamese', 'event_espresso') |
|
508 | 507 | ), |
509 | 508 | array( |
510 | - 'html_label_text' => __( 'Language', 'event_espresso' ), |
|
511 | - 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
|
512 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
509 | + 'html_label_text' => __('Language', 'event_espresso'), |
|
510 | + 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
511 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
513 | 512 | ) |
514 | 513 | ) |
515 | 514 | ) |
@@ -557,25 +556,25 @@ discard block |
||
557 | 556 | * @param EE_Registration_Config $EE_Registration_Config |
558 | 557 | * @return array |
559 | 558 | */ |
560 | - public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
559 | + public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
|
561 | 560 | try { |
562 | 561 | $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
563 | 562 | // if not displaying a form, then check for form submission |
564 | - if ( $recaptcha_settings_form->was_submitted() ) { |
|
563 | + if ($recaptcha_settings_form->was_submitted()) { |
|
565 | 564 | // capture form data |
566 | 565 | $recaptcha_settings_form->receive_form_submission(); |
567 | 566 | // validate form data |
568 | - if ( $recaptcha_settings_form->is_valid() ) { |
|
567 | + if ($recaptcha_settings_form->is_valid()) { |
|
569 | 568 | // grab validated data from form |
570 | 569 | $valid_data = $recaptcha_settings_form->valid_data(); |
571 | 570 | // user proofing recaptcha: If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message. |
572 | 571 | if ( |
573 | - apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
572 | + apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
|
574 | 573 | && $valid_data['main_settings']['use_captcha'] |
575 | - && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
574 | + && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
|
576 | 575 | ) { |
577 | 576 | $valid_data['main_settings']['use_captcha'] = FALSE; |
578 | - EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
577 | + EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
579 | 578 | } |
580 | 579 | $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
581 | 580 | $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
@@ -584,12 +583,12 @@ discard block |
||
584 | 583 | $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
585 | 584 | $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
586 | 585 | } else { |
587 | - if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
|
588 | - EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
586 | + if ($recaptcha_settings_form->submission_error_message() != '') { |
|
587 | + EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
589 | 588 | } |
590 | 589 | } |
591 | 590 | } |
592 | - } catch( EE_Error $e ) { |
|
591 | + } catch (EE_Error $e) { |
|
593 | 592 | $e->get_error(); |
594 | 593 | } |
595 | 594 |
@@ -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 | * Event Espresso |
4 | 6 | * |
@@ -150,7 +150,7 @@ |
||
150 | 150 | * @param EE_Template_Config $CFG |
151 | 151 | * @param array $REQ incoming request |
152 | 152 | * |
153 | - * @return void |
|
153 | + * @return EE_Template_Config |
|
154 | 154 | */ |
155 | 155 | public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
156 | 156 | if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
@@ -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 | * |
4 | 6 | * EED_Ticket_Selector_Caff |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Ticket_Selector_Caff |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -37,22 +37,22 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks_admin() { |
40 | - define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
41 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 ); |
|
42 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 ); |
|
40 | + define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
41 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10); |
|
42 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | //just required because of abstract declaration |
47 | - public function run( $WP ) {} |
|
47 | + public function run($WP) {} |
|
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - protected function set_config(){ |
|
53 | - $this->set_config_section( 'template_settings' ); |
|
54 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
55 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
52 | + protected function set_config() { |
|
53 | + $this->set_config_section('template_settings'); |
|
54 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
55 | + $this->set_config_name('EED_Ticket_Selector'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'subsections' => apply_filters( |
87 | 87 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', |
88 | 88 | array( |
89 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h3( __( 'Ticket Selector Template Settings', 'event_espresso' ))), |
|
89 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h3(__('Ticket Selector Template Settings', 'event_espresso'))), |
|
90 | 90 | 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings() |
91 | 91 | ) |
92 | 92 | ) |
@@ -109,17 +109,17 @@ discard block |
||
109 | 109 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array( |
110 | 110 | 'show_ticket_details' => new EE_Yes_No_Input( |
111 | 111 | array( |
112 | - 'html_label_text' => __('Show Ticket Details?', 'event_espresso' ), |
|
113 | - 'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
114 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
112 | + 'html_label_text' => __('Show Ticket Details?', 'event_espresso'), |
|
113 | + 'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
114 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
115 | 115 | 'display_html_label_text' => false |
116 | 116 | ) |
117 | 117 | ), |
118 | 118 | 'show_ticket_sale_columns' => new EE_Yes_No_Input( |
119 | 119 | array( |
120 | - 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ), |
|
121 | - 'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
122 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
120 | + 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'), |
|
121 | + 'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
122 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
123 | 123 | 'display_html_label_text' => false |
124 | 124 | ) |
125 | 125 | ) |
@@ -142,21 +142,21 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return void |
144 | 144 | */ |
145 | - public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
|
146 | - if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
|
145 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
146 | + if ( ! isset($CFG->EED_Ticket_Selector)) { |
|
147 | 147 | $CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
148 | 148 | } |
149 | 149 | try { |
150 | 150 | $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form(); |
151 | 151 | |
152 | 152 | //check for form submission |
153 | - if ( $ticket_selector_form->was_submitted() ) { |
|
153 | + if ($ticket_selector_form->was_submitted()) { |
|
154 | 154 | |
155 | 155 | //capture form data |
156 | 156 | $ticket_selector_form->receive_form_submission(); |
157 | 157 | |
158 | 158 | //validate form data |
159 | - if ( $ticket_selector_form->is_valid() ) { |
|
159 | + if ($ticket_selector_form->is_valid()) { |
|
160 | 160 | |
161 | 161 | //grab validated data from form |
162 | 162 | $valid_data = $ticket_selector_form->valid_data(); |
@@ -165,13 +165,13 @@ discard block |
||
165 | 165 | $CFG->EED_Ticket_Selector->show_ticket_sale_columns = $valid_data['appearance_settings']['show_ticket_sale_columns']; |
166 | 166 | $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details']; |
167 | 167 | } else { |
168 | - if ( $ticket_selector_form->submission_error_message() != '' ) { |
|
169 | - EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
168 | + if ($ticket_selector_form->submission_error_message() != '') { |
|
169 | + EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
174 | - } catch( EE_Error $e ) { |
|
174 | + } catch (EE_Error $e) { |
|
175 | 175 | $e->get_error(); |
176 | 176 | } |
177 | 177 |
@@ -206,7 +206,8 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * Posts the request to AuthorizeNet & returns response. |
208 | 208 | * |
209 | - * @return AuthorizeNetARB_Response The response. |
|
209 | + * @param EEI_Payment $payment |
|
210 | + * @return EE_AuthorizeNetAIM_Response The response. |
|
210 | 211 | */ |
211 | 212 | private function _sendRequest($payment) { |
212 | 213 | $this->_x_post_fields['login'] = $this->_login_id; |
@@ -353,9 +354,6 @@ discard block |
||
353 | 354 | * Constructor. Parses the AuthorizeNet response string. |
354 | 355 | * |
355 | 356 | * @param string $response The response from the AuthNet server. |
356 | - * @param string $delimiter The delimiter used (default is ",") |
|
357 | - * @param string $encap_char The encap_char used (default is "|") |
|
358 | - * @param array $custom_fields Any custom fields set in the request. |
|
359 | 357 | */ |
360 | 358 | |
361 | 359 | public function __construct($response) { |
@@ -135,7 +135,7 @@ |
||
135 | 135 | //in which case, we need to generate teh invoice num per request right here... |
136 | 136 | $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
137 | 137 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
138 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
138 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | if ($this->_test_transactions) { |
@@ -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 |
@@ -107,7 +108,7 @@ discard block |
||
107 | 108 | foreach($total_line_item->tax_descendants() as $tax_line_item){ |
108 | 109 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
109 | 110 | } |
110 | - }else{//partial payment |
|
111 | + } else{//partial payment |
|
111 | 112 | $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
112 | 113 | } |
113 | 114 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Aim extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Aim extends EE_Onsite_Gateway { |
|
29 | 29 | protected $_login_id; |
30 | 30 | protected $_transaction_key; |
31 | 31 | protected $_currencies_supported = array( |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | $primary_registrant = $transaction->primary_registration(); |
99 | 99 | //if we're are charging for the full amount, show the normal line items |
100 | 100 | //and the itemized total adds up properly |
101 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
101 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
102 | 102 | $total_line_item = $transaction->total_line_item(); |
103 | 103 | foreach ($total_line_item->get_items() as $line_item) { |
104 | 104 | $this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N'); |
105 | 105 | $order_description .= $line_item->desc().', '; |
106 | 106 | } |
107 | - foreach($total_line_item->tax_descendants() as $tax_line_item){ |
|
107 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
108 | 108 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
109 | 109 | } |
110 | - }else{//partial payment |
|
111 | - $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
110 | + } else {//partial payment |
|
111 | + $order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | //start transaction |
118 | 118 | $this->setField('amount', $this->format_currency($payment->amount())); |
119 | - $this->setField('description',substr(rtrim($order_description, ', '), 0, 255)); |
|
119 | + $this->setField('description', substr(rtrim($order_description, ', '), 0, 255)); |
|
120 | 120 | $this->setField('card_num', $billing_info['credit_card']); |
121 | 121 | $this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']); |
122 | 122 | $this->setField('card_code', $billing_info['cvv']); |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | $this->setField('email', $billing_info['email']); |
126 | 126 | $this->setField('address', $billing_info['address'].' '.$billing_info['address2']); |
127 | 127 | $this->setField('city', $billing_info['city']); |
128 | - $this->setField('state', $billing_info['state'] ); |
|
129 | - $this->setField('country', $billing_info['country'] ); |
|
128 | + $this->setField('state', $billing_info['state']); |
|
129 | + $this->setField('country', $billing_info['country']); |
|
130 | 130 | $this->setField('zip', $billing_info['zip']); |
131 | 131 | $this->setField('cust_id', $primary_registrant->ID()); |
132 | 132 | $this->setField('phone', $billing_info['phone']); |
133 | 133 | //invoice_num would be nice to have itbe unique per SPCO page-load, taht way if users |
134 | 134 | //press back, they don't submit a duplicate. However, we may be keepin gthe user on teh same spco page |
135 | 135 | //in which case, we need to generate teh invoice num per request right here... |
136 | - $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
136 | + $this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
137 | 137 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
138 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
138 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | if ($this->_test_transactions) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | //Capture response |
146 | 146 | $this->type = "AUTH_CAPTURE"; |
147 | 147 | $response = $this->_sendRequest($payment); |
148 | - if (!empty($response)){ |
|
148 | + if ( ! empty($response)) { |
|
149 | 149 | if ($this->_debug_mode) { |
150 | 150 | $txn_id = $response->invoice_number; |
151 | 151 | } else { |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status(); |
155 | 155 | $payment->set_status($payment_status); |
156 | 156 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators) |
157 | - $payment->set_amount( floatval( $response->amount ) ); |
|
158 | - $payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code)); |
|
157 | + $payment->set_amount(floatval($response->amount)); |
|
158 | + $payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code)); |
|
159 | 159 | $payment->set_extra_accntng($primary_registrant->reg_code()); |
160 | - $payment->set_details(print_r($response,true)); |
|
160 | + $payment->set_details(print_r($response, true)); |
|
161 | 161 | } else { |
162 | 162 | $payment->set_status($this->_pay_model->failed_status()); |
163 | 163 | $payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso')); |
164 | - $payment->set_details(print_r($response,true)); |
|
164 | + $payment->set_details(print_r($response, true)); |
|
165 | 165 | } |
166 | 166 | return $payment; |
167 | 167 | } |
@@ -212,22 +212,22 @@ discard block |
||
212 | 212 | $this->_x_post_fields['tran_key'] = $this->_transaction_key; |
213 | 213 | $x_keys = array(); |
214 | 214 | foreach ($this->_x_post_fields as $key => $value) { |
215 | - $x_keys[] = "x_$key=" . urlencode($value); |
|
215 | + $x_keys[] = "x_$key=".urlencode($value); |
|
216 | 216 | } |
217 | 217 | // Add line items |
218 | 218 | foreach ($this->_additional_line_items as $key => $value) { |
219 | - $x_keys[] = "x_line_item=" . urlencode($value); |
|
219 | + $x_keys[] = "x_line_item=".urlencode($value); |
|
220 | 220 | } |
221 | 221 | $this->_log_clean_request($x_keys, $payment); |
222 | 222 | $post_url = ($this->_debug_mode ? self::SANDBOX_URL : self::LIVE_URL); |
223 | 223 | $curl_request = curl_init($post_url); |
224 | - curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys)); |
|
224 | + curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys)); |
|
225 | 225 | curl_setopt($curl_request, CURLOPT_HEADER, 0); |
226 | 226 | curl_setopt($curl_request, CURLOPT_TIMEOUT, 45); |
227 | 227 | curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); |
228 | 228 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2); |
229 | 229 | if ($this->VERIFY_PEER) { |
230 | - curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem'); |
|
230 | + curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)).'/ssl/cert.pem'); |
|
231 | 231 | } else { |
232 | 232 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
233 | 233 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $response = curl_exec($curl_request); |
240 | 240 | |
241 | 241 | curl_close($curl_request); |
242 | - $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
242 | + $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
243 | 243 | |
244 | 244 | return $this->_log_and_clean_response($response_obj, $payment); |
245 | 245 | } |
@@ -248,18 +248,18 @@ discard block |
||
248 | 248 | * @param array $request_array |
249 | 249 | * @param EEI_Payment $payment |
250 | 250 | */ |
251 | - private function _log_clean_request($request_array,$payment){ |
|
252 | - $keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' ); |
|
253 | - foreach($request_array as $index => $keyvaltogether ) { |
|
254 | - foreach( $keys_to_filter_out as $key ) { |
|
255 | - if( strpos( $keyvaltogether, $key ) === 0 ){ |
|
251 | + private function _log_clean_request($request_array, $payment) { |
|
252 | + $keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date'); |
|
253 | + foreach ($request_array as $index => $keyvaltogether) { |
|
254 | + foreach ($keys_to_filter_out as $key) { |
|
255 | + if (strpos($keyvaltogether, $key) === 0) { |
|
256 | 256 | //found it at the first character |
257 | 257 | //so its one of them |
258 | - unset( $request_array[ $index ] ); |
|
258 | + unset($request_array[$index]); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - $this->log(array('AIM Request sent:'=>$request_array),$payment); |
|
262 | + $this->log(array('AIM Request sent:'=>$request_array), $payment); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | * @param EE_AuthorizeNetAIM_Response $response_obj |
268 | 268 | * @param EE_Payment $payment |
269 | 269 | */ |
270 | - private function _log_and_clean_response($response_obj,$payment){ |
|
270 | + private function _log_and_clean_response($response_obj, $payment) { |
|
271 | 271 | $response_obj->account_number = ''; |
272 | - $this->log(array('AIM Response received:'=>$response_obj),$payment); |
|
272 | + $this->log(array('AIM Response received:'=>$response_obj), $payment); |
|
273 | 273 | return $response_obj; |
274 | 274 | } |
275 | 275 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // Split Array |
366 | 366 | $this->response = $response; |
367 | 367 | if ($encap_char) { |
368 | - $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
368 | + $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
369 | 369 | } else { |
370 | 370 | $this->_response_array = explode($delimiter, $response); |
371 | 371 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $this->held = ($this->response_code == self::HELD); |
436 | 436 | |
437 | 437 | if ($this->error || $this->declined || $this->held) { |
438 | - $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
438 | + $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
439 | 439 | |
440 | 440 | |
441 | 441 | /* $this->error_message = "AuthorizeNet Error: |
@@ -207,7 +207,7 @@ |
||
207 | 207 | |
208 | 208 | /** |
209 | 209 | * constructor |
210 | - * @param EE_Admin_Page $admin_page the calling admin_page_object |
|
210 | + * @param EE_Admin_Page $adminpage the calling admin_page_object |
|
211 | 211 | */ |
212 | 212 | public function __construct( EE_Admin_Page $adminpage ) { |
213 | 213 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * constructor |
210 | 210 | * @param EE_Admin_Page $admin_page the calling admin_page_object |
211 | 211 | */ |
212 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
212 | + public function __construct(EE_Admin_Page $adminpage) { |
|
213 | 213 | |
214 | 214 | $this->_adminpage_obj = $adminpage; |
215 | 215 | $this->_req_data = array_merge($_GET, $_POST); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $this->_set_hooks_properties(); |
218 | 218 | |
219 | 219 | //first let's verify we're on the right page |
220 | - if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) |
|
220 | + if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page'])) |
|
221 | 221 | return; //get out nothing more to be done here. |
222 | 222 | |
223 | 223 | //allow for extends to modify properties |
224 | - if ( method_exists( $this, '_extend_properties' ) ) |
|
224 | + if (method_exists($this, '_extend_properties')) |
|
225 | 225 | $this->_extend_properties(); |
226 | 226 | |
227 | 227 | $this->_set_page_object(); |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | $this->_load_custom_methods(); |
230 | 230 | $this->_load_routed_hooks(); |
231 | 231 | |
232 | - add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) ); |
|
233 | - add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 ); |
|
234 | - add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 ); |
|
232 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
233 | + add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20); |
|
234 | + add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15); |
|
235 | 235 | |
236 | 236 | $this->_ajax_hooks(); |
237 | 237 | |
@@ -272,15 +272,15 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function enqueue_scripts_styles() { |
274 | 274 | |
275 | - if ( !empty( $this->_scripts_styles ) ) { |
|
275 | + if ( ! empty($this->_scripts_styles)) { |
|
276 | 276 | //first let's do all the registrations |
277 | - if ( !isset($this->_scripts_styles['registers'] ) ) { |
|
277 | + if ( ! isset($this->_scripts_styles['registers'])) { |
|
278 | 278 | $msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso'); |
279 | - $msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' ); |
|
280 | - throw new EE_Error( implode( '||', $msg ) ); |
|
279 | + $msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>'); |
|
280 | + throw new EE_Error(implode('||', $msg)); |
|
281 | 281 | } |
282 | 282 | |
283 | - foreach( $this->_scripts_styles['registers'] as $ref => $details ) { |
|
283 | + foreach ($this->_scripts_styles['registers'] as $ref => $details) { |
|
284 | 284 | $defaults = array( |
285 | 285 | 'type' => 'js', |
286 | 286 | 'url' => '', |
@@ -289,48 +289,48 @@ discard block |
||
289 | 289 | 'footer' => TRUE |
290 | 290 | ); |
291 | 291 | $details = wp_parse_args($details, $defaults); |
292 | - extract( $details ); |
|
292 | + extract($details); |
|
293 | 293 | |
294 | 294 | //let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do |
295 | 295 | $this->_scripts_styles['registers'][$ref]['type'] = $type; |
296 | 296 | |
297 | 297 | //let's make sure we're not missing any REQUIRED parameters |
298 | - if ( empty($url) ) { |
|
299 | - $msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' ); |
|
300 | - $msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref ); |
|
301 | - throw new EE_Error( implode( '||', $msg ) ); |
|
298 | + if (empty($url)) { |
|
299 | + $msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet'); |
|
300 | + $msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref); |
|
301 | + throw new EE_Error(implode('||', $msg)); |
|
302 | 302 | } |
303 | 303 | //made it here so let's do the appropriate registration |
304 | - $type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version ); |
|
304 | + $type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | //k now lets do the enqueues |
308 | - if( !isset( $this->_scripts_styles['enqueues'] ) ) |
|
309 | - return; //not sure if we should throw an error here or not. |
|
310 | - foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) { |
|
308 | + if ( ! isset($this->_scripts_styles['enqueues'])) |
|
309 | + return; //not sure if we should throw an error here or not. |
|
310 | + foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) { |
|
311 | 311 | //make sure $routes is an array |
312 | 312 | $routes = (array) $routes; |
313 | 313 | |
314 | - if ( in_array($this->_current_route, $routes ) ) { |
|
314 | + if (in_array($this->_current_route, $routes)) { |
|
315 | 315 | $this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref); |
316 | 316 | //if we have a localization for the script let's do that too. |
317 | - if ( isset( $this->_scripts_styles['localize'][$ref] ) ) { |
|
318 | - foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) { |
|
319 | - wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] ); |
|
317 | + if (isset($this->_scripts_styles['localize'][$ref])) { |
|
318 | + foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) { |
|
319 | + wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | 325 | //let's do the deregisters |
326 | - if ( !isset( $this->_scripts_styles['deregisters'] ) ) |
|
326 | + if ( ! isset($this->_scripts_styles['deregisters'])) |
|
327 | 327 | return; |
328 | - foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) { |
|
328 | + foreach ($this->_scripts_styles['deregisters'] as $ref => $details) { |
|
329 | 329 | $defaults = array( |
330 | 330 | 'type' => 'js' |
331 | 331 | ); |
332 | - $details = wp_parse_args( $details, $defaults ); |
|
333 | - extract( $details ); |
|
332 | + $details = wp_parse_args($details, $defaults); |
|
333 | + extract($details); |
|
334 | 334 | |
335 | 335 | $type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref); |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | private function _set_defaults() { |
351 | 351 | $this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array(); |
352 | - $this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
352 | + $this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
353 | 353 | $this->caller = get_class($this); |
354 | 354 | $this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE; |
355 | 355 | } |
@@ -364,35 +364,35 @@ discard block |
||
364 | 364 | */ |
365 | 365 | protected function _set_page_object() { |
366 | 366 | //first make sure $this->_name is set |
367 | - if ( empty( $this->_name ) ) { |
|
367 | + if (empty($this->_name)) { |
|
368 | 368 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
369 | - $msg[] = sprintf( __("This is because the %s child class has not set the |
|
370 | - '_name' property", 'event_espresso'), $this->caller ); |
|
371 | - throw new EE_Error( implode( '||', $msg ) ); |
|
369 | + $msg[] = sprintf(__("This is because the %s child class has not set the |
|
370 | + '_name' property", 'event_espresso'), $this->caller); |
|
371 | + throw new EE_Error(implode('||', $msg)); |
|
372 | 372 | } |
373 | 373 | |
374 | - $ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message |
|
375 | - $ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message |
|
374 | + $ref = str_replace('_', ' ', $this->_name); //take the_message -> the message |
|
375 | + $ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message |
|
376 | 376 | |
377 | 377 | //first default file (if exists) |
378 | - $decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php'; |
|
379 | - if ( is_readable( $decaf_file ) ) |
|
380 | - require_once( $decaf_file ); |
|
378 | + $decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php'; |
|
379 | + if (is_readable($decaf_file)) |
|
380 | + require_once($decaf_file); |
|
381 | 381 | |
382 | 382 | //now we have to do require for extended file (if needed) |
383 | - if ( $this->_extend ) { |
|
384 | - require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' ); |
|
383 | + if ($this->_extend) { |
|
384 | + require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php'); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
388 | 388 | //if we've got an extended class we use that! |
389 | - $ref = $this->_extend ? 'Extend_' . $ref : $ref; |
|
389 | + $ref = $this->_extend ? 'Extend_'.$ref : $ref; |
|
390 | 390 | |
391 | 391 | //let's make sure the class exists |
392 | - if ( !class_exists( $ref ) ) { |
|
392 | + if ( ! class_exists($ref)) { |
|
393 | 393 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
394 | - $msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref ); |
|
395 | - throw new EE_Error( implode( '||', $msg ) ); |
|
394 | + $msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref); |
|
395 | + throw new EE_Error(implode('||', $msg)); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | $a = new ReflectionClass($ref); |
@@ -417,27 +417,27 @@ discard block |
||
417 | 417 | $method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route; |
418 | 418 | |
419 | 419 | //these run before the Admin_Page route executes. |
420 | - if ( method_exists( $this, $method_callback ) ) { |
|
421 | - call_user_func( array( $this, $method_callback) ); |
|
420 | + if (method_exists($this, $method_callback)) { |
|
421 | + call_user_func(array($this, $method_callback)); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
425 | 425 | //these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes. There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens. |
426 | 426 | //first the actions |
427 | 427 | //note that these action hooks will have the $query_args value available. |
428 | - $admin_class_name = get_class( $this->_adminpage_obj ); |
|
428 | + $admin_class_name = get_class($this->_adminpage_obj); |
|
429 | 429 | |
430 | - if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) { |
|
431 | - add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 ); |
|
430 | + if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) { |
|
431 | + add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10); |
|
432 | 432 | } |
433 | 433 | |
434 | - if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) { |
|
435 | - add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 ); |
|
434 | + if (method_exists($this, '_redirect_action_'.$this->_current_route)) { |
|
435 | + add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | //let's hook into the _redirect itself and allow for changing where the user goes after redirect. This will have $query_args and $redirect_url available. |
439 | - if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) { |
|
440 | - add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 ); |
|
439 | + if (method_exists($this, '_redirect_filter_'.$this->_current_route)) { |
|
440 | + add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | } |
@@ -460,12 +460,12 @@ discard block |
||
460 | 460 | 'argnum' => 1, |
461 | 461 | 'priority' => 10 |
462 | 462 | ), |
463 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array( |
|
463 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array( |
|
464 | 464 | 'type' => 'filter', |
465 | 465 | 'argnum' => 1, |
466 | 466 | 'priority' => 10 |
467 | 467 | ), |
468 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array( |
|
468 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array( |
|
469 | 469 | 'type' => 'filter', |
470 | 470 | 'argnum' => 1, |
471 | 471 | 'priority' => 10 |
@@ -484,14 +484,14 @@ discard block |
||
484 | 484 | |
485 | 485 | |
486 | 486 | |
487 | - foreach ( $hook_filter_array as $hook => $args ) { |
|
488 | - if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) { |
|
489 | - if ( isset( $this->_wp_action_filters_priority[$hook] ) ) |
|
487 | + foreach ($hook_filter_array as $hook => $args) { |
|
488 | + if (method_exists($this, $this->_current_route.'_'.$hook)) { |
|
489 | + if (isset($this->_wp_action_filters_priority[$hook])) |
|
490 | 490 | $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
491 | - if ( $args['type'] == 'action' ) |
|
492 | - add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
491 | + if ($args['type'] == 'action') |
|
492 | + add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
493 | 493 | else |
494 | - add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
494 | + add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
@@ -504,18 +504,18 @@ discard block |
||
504 | 504 | */ |
505 | 505 | private function _ajax_hooks() { |
506 | 506 | |
507 | - if ( empty( $this->_ajax_func) ) |
|
507 | + if (empty($this->_ajax_func)) |
|
508 | 508 | return; //get out there's nothing to take care of. |
509 | 509 | |
510 | - foreach ( $this->_ajax_func as $action => $method ) { |
|
510 | + foreach ($this->_ajax_func as $action => $method) { |
|
511 | 511 | //make sure method exists |
512 | - if ( !method_exists($this, $method) ) { |
|
513 | - $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />'; |
|
514 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
515 | - throw new EE_Error( implode('||', $msg ) ); |
|
512 | + if ( ! method_exists($this, $method)) { |
|
513 | + $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />'; |
|
514 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
515 | + throw new EE_Error(implode('||', $msg)); |
|
516 | 516 | } |
517 | 517 | |
518 | - add_action('wp_ajax_' . $action, array( $this, $method ) ); |
|
518 | + add_action('wp_ajax_'.$action, array($this, $method)); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | } |
@@ -528,21 +528,21 @@ discard block |
||
528 | 528 | * @return void |
529 | 529 | */ |
530 | 530 | protected function _init_hooks() { |
531 | - if ( empty( $this->_init_func) ) |
|
531 | + if (empty($this->_init_func)) |
|
532 | 532 | return; //get out there's nothing to take care of. |
533 | 533 | |
534 | 534 | //We need to determine what page_route we are on! |
535 | - $current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
535 | + $current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
536 | 536 | |
537 | - foreach ( $this->_init_func as $route => $method ) { |
|
537 | + foreach ($this->_init_func as $route => $method) { |
|
538 | 538 | //make sure method exists |
539 | - if ( !method_exists($this, $method) ) { |
|
540 | - $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />'; |
|
541 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
542 | - throw new EE_Error( implode('||', $msg ) ); |
|
539 | + if ( ! method_exists($this, $method)) { |
|
540 | + $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />'; |
|
541 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
542 | + throw new EE_Error(implode('||', $msg)); |
|
543 | 543 | } |
544 | - if ( $route == $this->_current_route ) |
|
545 | - add_action('admin_init', array( $this, $method ) ); |
|
544 | + if ($route == $this->_current_route) |
|
545 | + add_action('admin_init', array($this, $method)); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | } |
@@ -557,28 +557,28 @@ discard block |
||
557 | 557 | * @return void |
558 | 558 | */ |
559 | 559 | public function add_metaboxes() { |
560 | - if ( empty( $this->_metaboxes ) ) |
|
560 | + if (empty($this->_metaboxes)) |
|
561 | 561 | return; //get out we don't have any metaboxes to set for this connection |
562 | 562 | |
563 | - $this->_handle_metabox_array( $this->_metaboxes ); |
|
563 | + $this->_handle_metabox_array($this->_metaboxes); |
|
564 | 564 | |
565 | 565 | } |
566 | 566 | |
567 | 567 | |
568 | 568 | |
569 | - private function _handle_metabox_array( $boxes, $add = TRUE ) { |
|
569 | + private function _handle_metabox_array($boxes, $add = TRUE) { |
|
570 | 570 | |
571 | - foreach ( $boxes as $box ) { |
|
572 | - if ( !isset($box['page_route']) ) |
|
571 | + foreach ($boxes as $box) { |
|
572 | + if ( ! isset($box['page_route'])) |
|
573 | 573 | continue; //we dont' have a valid array |
574 | 574 | |
575 | 575 | //let's make sure $box['page_route'] is an array so the "foreach" will work. |
576 | 576 | $box['page_route'] = (array) $box['page_route']; |
577 | 577 | |
578 | - foreach ( $box['page_route'] as $route ) { |
|
579 | - if ( $route != $this->_current_route ) |
|
578 | + foreach ($box['page_route'] as $route) { |
|
579 | + if ($route != $this->_current_route) |
|
580 | 580 | continue; //get out we only add metaboxes for set route. |
581 | - if ( $add ) |
|
581 | + if ($add) |
|
582 | 582 | $this->_add_metabox($box); |
583 | 583 | else |
584 | 584 | $this->_remove_metabox($box); |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | */ |
597 | 597 | public function remove_metaboxes() { |
598 | 598 | |
599 | - if ( empty( $this->_remove_metaboxes ) ) |
|
599 | + if (empty($this->_remove_metaboxes)) |
|
600 | 600 | return; //get out there are no metaboxes to remove |
601 | 601 | |
602 | - $this->_handle_metabox_array( $this->_remove_metaboxes, FALSE ); |
|
602 | + $this->_handle_metabox_array($this->_remove_metaboxes, FALSE); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | |
@@ -609,53 +609,53 @@ discard block |
||
609 | 609 | * @access private |
610 | 610 | * @param array $args an array of args that have been set for this metabox by the child class |
611 | 611 | */ |
612 | - private function _add_metabox( $args ) { |
|
612 | + private function _add_metabox($args) { |
|
613 | 613 | $current_screen = get_current_screen(); |
614 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
615 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
614 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
615 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
616 | 616 | |
617 | 617 | //set defaults |
618 | 618 | $defaults = array( |
619 | 619 | 'func' => $func, |
620 | - 'id' => $this->caller . '_' . $func . '_metabox', |
|
620 | + 'id' => $this->caller.'_'.$func.'_metabox', |
|
621 | 621 | 'priority' => 'default', |
622 | 622 | 'label' => $this->caller, |
623 | 623 | 'context' => 'advanced', |
624 | 624 | 'callback_args' => array(), |
625 | - 'page' => isset( $args['page'] ) ? $args['page'] : $screen_id |
|
625 | + 'page' => isset($args['page']) ? $args['page'] : $screen_id |
|
626 | 626 | ); |
627 | 627 | |
628 | - $args = wp_parse_args( $args, $defaults ); |
|
628 | + $args = wp_parse_args($args, $defaults); |
|
629 | 629 | extract($args); |
630 | 630 | |
631 | 631 | |
632 | 632 | //make sure method exists |
633 | - if ( !method_exists($this, $func) ) { |
|
634 | - $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />'; |
|
635 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller ); |
|
636 | - throw new EE_Error( implode('||', $msg ) ); |
|
633 | + if ( ! method_exists($this, $func)) { |
|
634 | + $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />'; |
|
635 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller); |
|
636 | + throw new EE_Error(implode('||', $msg)); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | //everything checks out so lets add the metabox |
640 | - add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args); |
|
640 | + add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | |
644 | 644 | |
645 | - private function _remove_metabox( $args ) { |
|
645 | + private function _remove_metabox($args) { |
|
646 | 646 | $current_screen = get_current_screen(); |
647 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
648 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
647 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
648 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
649 | 649 | |
650 | 650 | //set defaults |
651 | 651 | $defaults = array( |
652 | - 'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox', |
|
652 | + 'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox', |
|
653 | 653 | 'context' => 'default', |
654 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id |
|
654 | + 'screen' => isset($args['screen']) ? $args['screen'] : $screen_id |
|
655 | 655 | ); |
656 | 656 | |
657 | - $args = wp_parse_args( $args, $defaults ); |
|
658 | - extract( $args ); |
|
657 | + $args = wp_parse_args($args, $defaults); |
|
658 | + extract($args); |
|
659 | 659 | |
660 | 660 | //everything checks out so lets remove the box! |
661 | 661 | remove_meta_box($id, $screen, $context); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -217,12 +218,15 @@ discard block |
||
217 | 218 | $this->_set_hooks_properties(); |
218 | 219 | |
219 | 220 | //first let's verify we're on the right page |
220 | - if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) |
|
221 | - return; //get out nothing more to be done here. |
|
221 | + if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) { |
|
222 | + return; |
|
223 | + } |
|
224 | + //get out nothing more to be done here. |
|
222 | 225 | |
223 | 226 | //allow for extends to modify properties |
224 | - if ( method_exists( $this, '_extend_properties' ) ) |
|
225 | - $this->_extend_properties(); |
|
227 | + if ( method_exists( $this, '_extend_properties' ) ) { |
|
228 | + $this->_extend_properties(); |
|
229 | + } |
|
226 | 230 | |
227 | 231 | $this->_set_page_object(); |
228 | 232 | $this->_init_hooks(); |
@@ -305,8 +309,10 @@ discard block |
||
305 | 309 | } |
306 | 310 | |
307 | 311 | //k now lets do the enqueues |
308 | - if( !isset( $this->_scripts_styles['enqueues'] ) ) |
|
309 | - return; //not sure if we should throw an error here or not. |
|
312 | + if( !isset( $this->_scripts_styles['enqueues'] ) ) { |
|
313 | + return; |
|
314 | + } |
|
315 | + //not sure if we should throw an error here or not. |
|
310 | 316 | foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) { |
311 | 317 | //make sure $routes is an array |
312 | 318 | $routes = (array) $routes; |
@@ -323,8 +329,9 @@ discard block |
||
323 | 329 | } |
324 | 330 | |
325 | 331 | //let's do the deregisters |
326 | - if ( !isset( $this->_scripts_styles['deregisters'] ) ) |
|
327 | - return; |
|
332 | + if ( !isset( $this->_scripts_styles['deregisters'] ) ) { |
|
333 | + return; |
|
334 | + } |
|
328 | 335 | foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) { |
329 | 336 | $defaults = array( |
330 | 337 | 'type' => 'js' |
@@ -376,8 +383,9 @@ discard block |
||
376 | 383 | |
377 | 384 | //first default file (if exists) |
378 | 385 | $decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php'; |
379 | - if ( is_readable( $decaf_file ) ) |
|
380 | - require_once( $decaf_file ); |
|
386 | + if ( is_readable( $decaf_file ) ) { |
|
387 | + require_once( $decaf_file ); |
|
388 | + } |
|
381 | 389 | |
382 | 390 | //now we have to do require for extended file (if needed) |
383 | 391 | if ( $this->_extend ) { |
@@ -486,12 +494,14 @@ discard block |
||
486 | 494 | |
487 | 495 | foreach ( $hook_filter_array as $hook => $args ) { |
488 | 496 | if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) { |
489 | - if ( isset( $this->_wp_action_filters_priority[$hook] ) ) |
|
490 | - $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
|
491 | - if ( $args['type'] == 'action' ) |
|
492 | - add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
493 | - else |
|
494 | - add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
497 | + if ( isset( $this->_wp_action_filters_priority[$hook] ) ) { |
|
498 | + $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
|
499 | + } |
|
500 | + if ( $args['type'] == 'action' ) { |
|
501 | + add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
502 | + } else { |
|
503 | + add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
504 | + } |
|
495 | 505 | } |
496 | 506 | } |
497 | 507 | |
@@ -504,8 +514,10 @@ discard block |
||
504 | 514 | */ |
505 | 515 | private function _ajax_hooks() { |
506 | 516 | |
507 | - if ( empty( $this->_ajax_func) ) |
|
508 | - return; //get out there's nothing to take care of. |
|
517 | + if ( empty( $this->_ajax_func) ) { |
|
518 | + return; |
|
519 | + } |
|
520 | + //get out there's nothing to take care of. |
|
509 | 521 | |
510 | 522 | foreach ( $this->_ajax_func as $action => $method ) { |
511 | 523 | //make sure method exists |
@@ -528,8 +540,10 @@ discard block |
||
528 | 540 | * @return void |
529 | 541 | */ |
530 | 542 | protected function _init_hooks() { |
531 | - if ( empty( $this->_init_func) ) |
|
532 | - return; //get out there's nothing to take care of. |
|
543 | + if ( empty( $this->_init_func) ) { |
|
544 | + return; |
|
545 | + } |
|
546 | + //get out there's nothing to take care of. |
|
533 | 547 | |
534 | 548 | //We need to determine what page_route we are on! |
535 | 549 | $current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
@@ -541,8 +555,9 @@ discard block |
||
541 | 555 | $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
542 | 556 | throw new EE_Error( implode('||', $msg ) ); |
543 | 557 | } |
544 | - if ( $route == $this->_current_route ) |
|
545 | - add_action('admin_init', array( $this, $method ) ); |
|
558 | + if ( $route == $this->_current_route ) { |
|
559 | + add_action('admin_init', array( $this, $method ) ); |
|
560 | + } |
|
546 | 561 | } |
547 | 562 | |
548 | 563 | } |
@@ -557,8 +572,10 @@ discard block |
||
557 | 572 | * @return void |
558 | 573 | */ |
559 | 574 | public function add_metaboxes() { |
560 | - if ( empty( $this->_metaboxes ) ) |
|
561 | - return; //get out we don't have any metaboxes to set for this connection |
|
575 | + if ( empty( $this->_metaboxes ) ) { |
|
576 | + return; |
|
577 | + } |
|
578 | + //get out we don't have any metaboxes to set for this connection |
|
562 | 579 | |
563 | 580 | $this->_handle_metabox_array( $this->_metaboxes ); |
564 | 581 | |
@@ -569,19 +586,24 @@ discard block |
||
569 | 586 | private function _handle_metabox_array( $boxes, $add = TRUE ) { |
570 | 587 | |
571 | 588 | foreach ( $boxes as $box ) { |
572 | - if ( !isset($box['page_route']) ) |
|
573 | - continue; //we dont' have a valid array |
|
589 | + if ( !isset($box['page_route']) ) { |
|
590 | + continue; |
|
591 | + } |
|
592 | + //we dont' have a valid array |
|
574 | 593 | |
575 | 594 | //let's make sure $box['page_route'] is an array so the "foreach" will work. |
576 | 595 | $box['page_route'] = (array) $box['page_route']; |
577 | 596 | |
578 | 597 | foreach ( $box['page_route'] as $route ) { |
579 | - if ( $route != $this->_current_route ) |
|
580 | - continue; //get out we only add metaboxes for set route. |
|
581 | - if ( $add ) |
|
582 | - $this->_add_metabox($box); |
|
583 | - else |
|
584 | - $this->_remove_metabox($box); |
|
598 | + if ( $route != $this->_current_route ) { |
|
599 | + continue; |
|
600 | + } |
|
601 | + //get out we only add metaboxes for set route. |
|
602 | + if ( $add ) { |
|
603 | + $this->_add_metabox($box); |
|
604 | + } else { |
|
605 | + $this->_remove_metabox($box); |
|
606 | + } |
|
585 | 607 | } |
586 | 608 | } |
587 | 609 | } |
@@ -596,8 +618,10 @@ discard block |
||
596 | 618 | */ |
597 | 619 | public function remove_metaboxes() { |
598 | 620 | |
599 | - if ( empty( $this->_remove_metaboxes ) ) |
|
600 | - return; //get out there are no metaboxes to remove |
|
621 | + if ( empty( $this->_remove_metaboxes ) ) { |
|
622 | + return; |
|
623 | + } |
|
624 | + //get out there are no metaboxes to remove |
|
601 | 625 | |
602 | 626 | $this->_handle_metabox_array( $this->_remove_metaboxes, FALSE ); |
603 | 627 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * _get_hidden_fields |
306 | 306 | * returns a html string of hidden fields so if any table filters are used the current view will be respected. |
307 | - * @return html string |
|
307 | + * @return string string |
|
308 | 308 | */ |
309 | 309 | protected function _get_hidden_fields() { |
310 | 310 | $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @since 4.1 |
513 | 513 | * @access public |
514 | 514 | * |
515 | - * @param object $item The current item |
|
515 | + * @param EE_Message_Template_Group $item The current item |
|
516 | 516 | */ |
517 | 517 | public function single_row( $item ) { |
518 | 518 | $row_class = $this->_get_row_class( $item ); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | |
34 | 34 | if ( ! class_exists( 'WP_List_Table' )) { |
35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
35 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * ------------------------------------------------------------------------ |
32 | 32 | */ |
33 | 33 | |
34 | -if ( ! class_exists( 'WP_List_Table' )) { |
|
35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
34 | +if ( ! class_exists('WP_List_Table')) { |
|
35 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -215,16 +215,16 @@ discard block |
||
215 | 215 | * constructor |
216 | 216 | * @param EE_Admin_Page object $admin_page we use this for obtaining everything we need in the list table. |
217 | 217 | */ |
218 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
218 | + public function __construct(EE_Admin_Page $admin_page) { |
|
219 | 219 | $this->_admin_page = $admin_page; |
220 | 220 | $this->_req_data = $this->_admin_page->get_request_data(); |
221 | 221 | $this->_view = $this->_admin_page->get_view(); |
222 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
222 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
223 | 223 | $this->_current_page = $this->get_pagenum(); |
224 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
225 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
224 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
225 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
226 | 226 | |
227 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
227 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
228 | 228 | |
229 | 229 | $this->_setup_data(); |
230 | 230 | $this->_add_view_counts(); |
@@ -307,17 +307,17 @@ discard block |
||
307 | 307 | * @return html string |
308 | 308 | */ |
309 | 309 | protected function _get_hidden_fields() { |
310 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
311 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
310 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
311 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
312 | 312 | //if action is STILL empty, then we set it to default |
313 | - $action = empty( $action ) ? 'default' : $action; |
|
314 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
315 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
316 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
313 | + $action = empty($action) ? 'default' : $action; |
|
314 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
315 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
316 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
317 | 317 | |
318 | 318 | $bulk_actions = $this->_get_bulk_actions(); |
319 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
320 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
319 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
320 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | return $field; |
@@ -347,15 +347,15 @@ discard block |
||
347 | 347 | * |
348 | 348 | * @var array |
349 | 349 | */ |
350 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
350 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
351 | 351 | |
352 | 352 | $sortable = array(); |
353 | - foreach ( $_sortable as $id => $data ) { |
|
354 | - if ( empty( $data ) ) |
|
353 | + foreach ($_sortable as $id => $data) { |
|
354 | + if (empty($data)) |
|
355 | 355 | continue; |
356 | 356 | |
357 | 357 | //fix for offset errors with WP_List_Table default get_columninfo() |
358 | - if ( is_array($data) ) { |
|
358 | + if (is_array($data)) { |
|
359 | 359 | $_data[0] = key($data); |
360 | 360 | $_data[1] = isset($data[1]) ? $data[1] : false; |
361 | 361 | } else { |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | |
365 | 365 | $data = (array) $data; |
366 | 366 | |
367 | - if ( !isset( $data[1] ) ) |
|
367 | + if ( ! isset($data[1])) |
|
368 | 368 | $_data[1] = false; |
369 | 369 | |
370 | 370 | |
371 | 371 | $sortable[$id] = $_data; |
372 | 372 | } |
373 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
373 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | protected function _get_bulk_actions() { |
387 | 387 | $actions = array(); |
388 | 388 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
389 | - foreach ( $this->_views as $view => $args) { |
|
390 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
389 | + foreach ($this->_views as $view => $args) { |
|
390 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view) |
|
391 | 391 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
392 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
393 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
392 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
393 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
394 | 394 | $actions[$route] = $label; |
395 | 395 | } |
396 | 396 | } |
@@ -408,18 +408,18 @@ discard block |
||
408 | 408 | */ |
409 | 409 | private function _filters() { |
410 | 410 | $classname = get_class($this); |
411 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
411 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
412 | 412 | |
413 | - if ( empty( $filters )) { |
|
413 | + if (empty($filters)) { |
|
414 | 414 | return; |
415 | 415 | } |
416 | - foreach ( $filters as $filter ) { |
|
416 | + foreach ($filters as $filter) { |
|
417 | 417 | echo $filter; |
418 | 418 | } |
419 | 419 | //add filter button at end |
420 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
420 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
421 | 421 | //add reset filters button at end |
422 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
422 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | array( |
437 | 437 | 'total_items' => $total_items, |
438 | 438 | 'per_page' => $this->_per_page, |
439 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
439 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
440 | 440 | ) |
441 | 441 | ); |
442 | 442 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @return string html content for the column |
454 | 454 | */ |
455 | - public function column_default( $item, $column_name ) { |
|
455 | + public function column_default($item, $column_name) { |
|
456 | 456 | /** |
457 | 457 | * Dynamic hook allowing for adding additional column content in this list table. |
458 | 458 | * Note that $this->screen->id is in the format |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | * hook prefix ("event-espresso") will be different. |
463 | 463 | * |
464 | 464 | */ |
465 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
465 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @var array |
480 | 480 | */ |
481 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
481 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
482 | 482 | return $columns; |
483 | 483 | } |
484 | 484 | |
@@ -490,18 +490,18 @@ discard block |
||
490 | 490 | $views = $this->get_views(); |
491 | 491 | $assembled_views = ''; |
492 | 492 | |
493 | - if ( empty( $views )) { |
|
493 | + if (empty($views)) { |
|
494 | 494 | return; |
495 | 495 | } |
496 | 496 | echo "<ul class='subsubsub'>\n"; |
497 | - foreach ( $views as $view ) { |
|
498 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
499 | - if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { |
|
500 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
497 | + foreach ($views as $view) { |
|
498 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
499 | + if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { |
|
500 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | |
504 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
504 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
505 | 505 | echo "</ul>"; |
506 | 506 | } |
507 | 507 | |
@@ -514,10 +514,10 @@ discard block |
||
514 | 514 | * |
515 | 515 | * @param object $item The current item |
516 | 516 | */ |
517 | - public function single_row( $item ) { |
|
518 | - $row_class = $this->_get_row_class( $item ); |
|
519 | - echo '<tr' . $row_class . '>'; |
|
520 | - $this->single_row_columns( $item ); |
|
517 | + public function single_row($item) { |
|
518 | + $row_class = $this->_get_row_class($item); |
|
519 | + echo '<tr'.$row_class.'>'; |
|
520 | + $this->single_row_columns($item); |
|
521 | 521 | echo '</tr>'; |
522 | 522 | } |
523 | 523 | |
@@ -528,16 +528,16 @@ discard block |
||
528 | 528 | * @param object $item the current item |
529 | 529 | * @return string |
530 | 530 | */ |
531 | - protected function _get_row_class( $item ) { |
|
531 | + protected function _get_row_class($item) { |
|
532 | 532 | static $row_class = ''; |
533 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
533 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
534 | 534 | |
535 | 535 | $new_row = $row_class; |
536 | 536 | |
537 | - if ( !empty($this->_ajax_sorting_callback) ) |
|
537 | + if ( ! empty($this->_ajax_sorting_callback)) |
|
538 | 538 | $new_row .= ' rowsortable'; |
539 | 539 | |
540 | - return ' class="' . $new_row . '"'; |
|
540 | + return ' class="'.$new_row.'"'; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -552,13 +552,13 @@ discard block |
||
552 | 552 | |
553 | 553 | public function get_hidden_columns() { |
554 | 554 | $user_id = get_current_user_id(); |
555 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
556 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
557 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
558 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
555 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
556 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
557 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
558 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
559 | 559 | } |
560 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
561 | - $saved_columns = (array) get_user_option( $ref, $user_id ); |
|
560 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
561 | + $saved_columns = (array) get_user_option($ref, $user_id); |
|
562 | 562 | return $saved_columns; |
563 | 563 | } |
564 | 564 | |
@@ -574,31 +574,31 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @param object $item The current item |
576 | 576 | */ |
577 | - protected function single_row_columns( $item ) { |
|
578 | - list( $columns, $hidden ) = $this->get_column_info(); |
|
577 | + protected function single_row_columns($item) { |
|
578 | + list($columns, $hidden) = $this->get_column_info(); |
|
579 | 579 | |
580 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
580 | + foreach ($columns as $column_name => $column_display_name) { |
|
581 | 581 | $class = "class='$column_name column-$column_name'"; |
582 | 582 | |
583 | 583 | $style = ''; |
584 | - if ( in_array( $column_name, $hidden ) ) |
|
584 | + if (in_array($column_name, $hidden)) |
|
585 | 585 | $style = ' style="display:none;"'; |
586 | 586 | |
587 | 587 | $attributes = "$class$style"; |
588 | 588 | |
589 | - if ( 'cb' == $column_name ) { |
|
589 | + if ('cb' == $column_name) { |
|
590 | 590 | echo '<th scope="row" class="check-column">'; |
591 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
591 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
592 | 592 | echo '</th>'; |
593 | 593 | } |
594 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
594 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
595 | 595 | echo "<td $attributes>"; |
596 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
596 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
597 | 597 | echo "</td>"; |
598 | 598 | } |
599 | 599 | else { |
600 | 600 | echo "<td $attributes>"; |
601 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
601 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
602 | 602 | echo "</td>"; |
603 | 603 | } |
604 | 604 | } |
@@ -606,19 +606,19 @@ discard block |
||
606 | 606 | |
607 | 607 | |
608 | 608 | |
609 | - public function extra_tablenav( $which ) { |
|
610 | - if ( $which == 'top' ) { |
|
609 | + public function extra_tablenav($which) { |
|
610 | + if ($which == 'top') { |
|
611 | 611 | $this->_filters(); |
612 | 612 | echo $this->_get_hidden_fields(); |
613 | 613 | echo '<br class="clear">'; |
614 | - }else{ |
|
614 | + } else { |
|
615 | 615 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
616 | - foreach($this->_bottom_buttons as $type => $action){ |
|
617 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
618 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
616 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
617 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
618 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
619 | 619 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request); |
620 | 620 | } |
621 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
621 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
622 | 622 | echo '</div>'; |
623 | 623 | } |
624 | 624 | //echo $this->_entries_per_page_dropdown; |
@@ -668,13 +668,13 @@ discard block |
||
668 | 668 | * |
669 | 669 | * @return string The assembled action elements container. |
670 | 670 | */ |
671 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
671 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
672 | 672 | $content = ''; |
673 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
674 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
675 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
676 | - $content .= apply_filters( 'FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this ); |
|
677 | - $content .= ! empty( $container ) ? '</' . $container . '>' : ''; |
|
673 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
674 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
675 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
676 | + $content .= apply_filters('FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this); |
|
677 | + $content .= ! empty($container) ? '</'.$container.'>' : ''; |
|
678 | 678 | return $content; |
679 | 679 | } |
680 | 680 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | |
6 | 7 | /** |
@@ -351,8 +352,9 @@ discard block |
||
351 | 352 | |
352 | 353 | $sortable = array(); |
353 | 354 | foreach ( $_sortable as $id => $data ) { |
354 | - if ( empty( $data ) ) |
|
355 | - continue; |
|
355 | + if ( empty( $data ) ) { |
|
356 | + continue; |
|
357 | + } |
|
356 | 358 | |
357 | 359 | //fix for offset errors with WP_List_Table default get_columninfo() |
358 | 360 | if ( is_array($data) ) { |
@@ -364,8 +366,9 @@ discard block |
||
364 | 366 | |
365 | 367 | $data = (array) $data; |
366 | 368 | |
367 | - if ( !isset( $data[1] ) ) |
|
368 | - $_data[1] = false; |
|
369 | + if ( !isset( $data[1] ) ) { |
|
370 | + $_data[1] = false; |
|
371 | + } |
|
369 | 372 | |
370 | 373 | |
371 | 374 | $sortable[$id] = $_data; |
@@ -387,11 +390,12 @@ discard block |
||
387 | 390 | $actions = array(); |
388 | 391 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
389 | 392 | foreach ( $this->_views as $view => $args) { |
390 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
391 | - //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
393 | + if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) { |
|
394 | + //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
392 | 395 | foreach ( $args['bulk_action'] as $route =>$label ) { |
393 | 396 | if ( $this->_admin_page->check_user_access( $route, true ) ) { |
394 | 397 | $actions[$route] = $label; |
398 | + } |
|
395 | 399 | } |
396 | 400 | } |
397 | 401 | } |
@@ -534,8 +538,9 @@ discard block |
||
534 | 538 | |
535 | 539 | $new_row = $row_class; |
536 | 540 | |
537 | - if ( !empty($this->_ajax_sorting_callback) ) |
|
538 | - $new_row .= ' rowsortable'; |
|
541 | + if ( !empty($this->_ajax_sorting_callback) ) { |
|
542 | + $new_row .= ' rowsortable'; |
|
543 | + } |
|
539 | 544 | |
540 | 545 | return ' class="' . $new_row . '"'; |
541 | 546 | } |
@@ -581,8 +586,9 @@ discard block |
||
581 | 586 | $class = "class='$column_name column-$column_name'"; |
582 | 587 | |
583 | 588 | $style = ''; |
584 | - if ( in_array( $column_name, $hidden ) ) |
|
585 | - $style = ' style="display:none;"'; |
|
589 | + if ( in_array( $column_name, $hidden ) ) { |
|
590 | + $style = ' style="display:none;"'; |
|
591 | + } |
|
586 | 592 | |
587 | 593 | $attributes = "$class$style"; |
588 | 594 | |
@@ -590,13 +596,11 @@ discard block |
||
590 | 596 | echo '<th scope="row" class="check-column">'; |
591 | 597 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
592 | 598 | echo '</th>'; |
593 | - } |
|
594 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
599 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
595 | 600 | echo "<td $attributes>"; |
596 | 601 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
597 | 602 | echo "</td>"; |
598 | - } |
|
599 | - else { |
|
603 | + } else { |
|
600 | 604 | echo "<td $attributes>"; |
601 | 605 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
602 | 606 | echo "</td>"; |
@@ -611,7 +615,7 @@ discard block |
||
611 | 615 | $this->_filters(); |
612 | 616 | echo $this->_get_hidden_fields(); |
613 | 617 | echo '<br class="clear">'; |
614 | - }else{ |
|
618 | + } else{ |
|
615 | 619 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
616 | 620 | foreach($this->_bottom_buttons as $type => $action){ |
617 | 621 | $route = isset( $action['route'] ) ? $action['route'] : ''; |
@@ -150,7 +150,7 @@ |
||
150 | 150 | * |
151 | 151 | * @param array $menu_args An array of arguments used to setup the menu |
152 | 152 | * properties on construct. |
153 | - * @param array $required An array of keys that should be in the $menu_args, this |
|
153 | + * @param string[] $required An array of keys that should be in the $menu_args, this |
|
154 | 154 | * is used to validate that the items that should be defined |
155 | 155 | * are present. |
156 | 156 | * @return void |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @package Event Espresso |
16 | 16 | * @subpackage admin |
17 | 17 | */ |
18 | -abstract class EE_Admin_Page_Menu_Map { |
|
18 | +abstract class EE_Admin_Page_Menu_Map { |
|
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
@@ -155,28 +155,28 @@ discard block |
||
155 | 155 | * are present. |
156 | 156 | * @return void |
157 | 157 | */ |
158 | - public function __construct( $menu_args, $required ) { |
|
158 | + public function __construct($menu_args, $required) { |
|
159 | 159 | //filter all args before processing so plugins can manipulate various settings for menus. |
160 | - $menu_args = apply_filters( 'FHEE__EE_Admin_Page_Menu_Map__construct__menu_args', $menu_args, $required, get_class( $this ) ); |
|
160 | + $menu_args = apply_filters('FHEE__EE_Admin_Page_Menu_Map__construct__menu_args', $menu_args, $required, get_class($this)); |
|
161 | 161 | |
162 | 162 | |
163 | 163 | //verify that required keys are present in the incoming array. |
164 | - $missing = array_diff( (array) $required, array_keys( (array) $menu_args ) ); |
|
164 | + $missing = array_diff((array) $required, array_keys((array) $menu_args)); |
|
165 | 165 | |
166 | - if ( !empty( $missing ) ) { |
|
167 | - throw new EE_Error( sprintf( __('%s is missing some expected keys in the argument array. The following keys are missing: %s', 'event_espresso'), get_class( $this ), implode(', ', $missing ) ) ); |
|
166 | + if ( ! empty($missing)) { |
|
167 | + throw new EE_Error(sprintf(__('%s is missing some expected keys in the argument array. The following keys are missing: %s', 'event_espresso'), get_class($this), implode(', ', $missing))); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | //made it here okay, so let's set the properties! |
171 | - foreach ( $menu_args as $prop => $value ) { |
|
171 | + foreach ($menu_args as $prop => $value) { |
|
172 | 172 | |
173 | - switch ( $prop ) { |
|
173 | + switch ($prop) { |
|
174 | 174 | case 'show_on_menu' : |
175 | 175 | $value = (int) $value; |
176 | 176 | break; |
177 | 177 | case 'admin_init_page' : |
178 | - if ( in_array( 'admin_init_page', $required ) && ! $value instanceof EE_Admin_Page_Init ) { |
|
179 | - throw new EE_Error( sprintf( __('The value for the "admin_init_page" argument must be an instance of an EE_Admin_Page_Init object. Instead %s was given as the value.', 'event_espresso'), print_r($value, TRUE) ) ); |
|
178 | + if (in_array('admin_init_page', $required) && ! $value instanceof EE_Admin_Page_Init) { |
|
179 | + throw new EE_Error(sprintf(__('The value for the "admin_init_page" argument must be an instance of an EE_Admin_Page_Init object. Instead %s was given as the value.', 'event_espresso'), print_r($value, TRUE))); |
|
180 | 180 | } |
181 | 181 | break; |
182 | 182 | case 'menu_callback' : |
@@ -187,24 +187,24 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | } |
190 | - if ( ! EEH_Class_Tools::has_property( $this, $prop ) ) |
|
191 | - throw new EE_Error( sprintf( __('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class( $this ), $prop ) ); |
|
190 | + if ( ! EEH_Class_Tools::has_property($this, $prop)) |
|
191 | + throw new EE_Error(sprintf(__('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class($this), $prop)); |
|
192 | 192 | $this->{$prop} = $value; |
193 | 193 | |
194 | 194 | } |
195 | 195 | |
196 | 196 | //filter capabilities (both static and dynamic) |
197 | - $this->capability = apply_filters( 'FHEE_management_capability', $this->capability, NULL ); |
|
198 | - $this->capability = apply_filters( 'FHEE_' . $this->menu_slug . '_capability', $this->capability, NULL ); |
|
197 | + $this->capability = apply_filters('FHEE_management_capability', $this->capability, NULL); |
|
198 | + $this->capability = apply_filters('FHEE_'.$this->menu_slug.'_capability', $this->capability, NULL); |
|
199 | 199 | |
200 | 200 | //Might need to change parent slug depending on maintenance mode. |
201 | - if ( ! empty( $this->maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
201 | + if ( ! empty($this->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
202 | 202 | $this->parent_slug = $this->maintenance_mode_parent; |
203 | 203 | } |
204 | 204 | |
205 | 205 | //if empty menu_callback let's set default (but only if we have admin page init object) |
206 | - if ( empty( $this->menu_callback ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) |
|
207 | - $this->menu_callback = array( $this->admin_init_page, 'initialize_admin_page' ); |
|
206 | + if (empty($this->menu_callback) && $this->admin_init_page instanceof EE_Admin_Page_Init) |
|
207 | + $this->menu_callback = array($this->admin_init_page, 'initialize_admin_page'); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -226,21 +226,21 @@ discard block |
||
226 | 226 | * @param boolean $network_admin whether this is being added to the network admin page or not |
227 | 227 | * @since 4.4.0 |
228 | 228 | */ |
229 | - public function add_menu_page( $network_admin = FALSE ) { |
|
229 | + public function add_menu_page($network_admin = FALSE) { |
|
230 | 230 | |
231 | 231 | $show_on_menu_int = (int) $this->show_on_menu; |
232 | - if( ( $network_admin && in_array( $show_on_menu_int, array( self::BLOG_AND_NETWORK_ADMIN, self::NETWORK_ADMIN_ONLY ), TRUE ) ) |
|
232 | + if (($network_admin && in_array($show_on_menu_int, array(self::BLOG_AND_NETWORK_ADMIN, self::NETWORK_ADMIN_ONLY), TRUE)) |
|
233 | 233 | || |
234 | - ( ! $network_admin && in_array( $show_on_menu_int, array( self::BLOG_AND_NETWORK_ADMIN, self::BLOG_ADMIN_ONLY ), TRUE )) ){ |
|
234 | + ( ! $network_admin && in_array($show_on_menu_int, array(self::BLOG_AND_NETWORK_ADMIN, self::BLOG_ADMIN_ONLY), TRUE))) { |
|
235 | 235 | $wp_page_slug = $this->_add_menu_page(); |
236 | - }else{ |
|
236 | + } else { |
|
237 | 237 | $wp_page_slug = ''; |
238 | 238 | } |
239 | 239 | |
240 | - if ( !empty( $wp_page_slug ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) { |
|
240 | + if ( ! empty($wp_page_slug) && $this->admin_init_page instanceof EE_Admin_Page_Init) { |
|
241 | 241 | try { |
242 | - $this->admin_init_page->set_page_dependencies( $wp_page_slug ); |
|
243 | - } catch( EE_Error $e ) { |
|
242 | + $this->admin_init_page->set_page_dependencies($wp_page_slug); |
|
243 | + } catch (EE_Error $e) { |
|
244 | 244 | $e->get_error(); |
245 | 245 | } |
246 | 246 | } |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | public $position; |
294 | 294 | |
295 | 295 | |
296 | - public function __construct( $menu_args ) { |
|
297 | - $required = array( 'menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page'); |
|
296 | + public function __construct($menu_args) { |
|
297 | + $required = array('menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page'); |
|
298 | 298 | |
299 | - parent::__construct( $menu_args, $required ); |
|
299 | + parent::__construct($menu_args, $required); |
|
300 | 300 | |
301 | - $this->position = ! empty( $this->position ) ? (int) $this->position : $this->position; |
|
301 | + $this->position = ! empty($this->position) ? (int) $this->position : $this->position; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * Uses the proper WP utility for registering a menu page for the main WP pages. |
307 | 307 | */ |
308 | 308 | protected function _add_menu_page() { |
309 | - $main = add_menu_page( $this->title, $this->menu_label, $this->capability, $this->parent_slug, $this->menu_callback, $this->icon_url, $this->position ); |
|
310 | - if ( ! empty( $this->subtitle ) ) { |
|
311 | - add_submenu_page( $this->parent_slug, $this->subtitle, $this->subtitle, $this->capability, $this->menu_slug, $this->menu_callback ); |
|
309 | + $main = add_menu_page($this->title, $this->menu_label, $this->capability, $this->parent_slug, $this->menu_callback, $this->icon_url, $this->position); |
|
310 | + if ( ! empty($this->subtitle)) { |
|
311 | + add_submenu_page($this->parent_slug, $this->subtitle, $this->subtitle, $this->capability, $this->menu_slug, $this->menu_callback); |
|
312 | 312 | } |
313 | 313 | return $main; |
314 | 314 | } |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | */ |
326 | 326 | class EE_Admin_Page_Sub_Menu extends EE_Admin_Page_Main_Menu { |
327 | 327 | |
328 | - public function __construct( $menu_args ) { |
|
329 | - parent::__construct( $menu_args ); |
|
328 | + public function __construct($menu_args) { |
|
329 | + parent::__construct($menu_args); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
333 | 333 | protected function _add_menu_page() { |
334 | - return add_submenu_page( $this->parent_slug, $this->title, $this->menu_label, $this->capability, $this->menu_slug, $this->menu_callback ); |
|
334 | + return add_submenu_page($this->parent_slug, $this->title, $this->menu_label, $this->capability, $this->menu_slug, $this->menu_callback); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | } //end class EE_Admin_Page_Menu_Map |
@@ -352,18 +352,18 @@ discard block |
||
352 | 352 | |
353 | 353 | |
354 | 354 | |
355 | - public function __construct( $menu_args = array() ) { |
|
356 | - $required = array( 'menu_label', 'menu_slug', 'menu_order', 'parent_slug' ); |
|
357 | - parent::__construct( $menu_args, $required ); |
|
355 | + public function __construct($menu_args = array()) { |
|
356 | + $required = array('menu_label', 'menu_slug', 'menu_order', 'parent_slug'); |
|
357 | + parent::__construct($menu_args, $required); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
361 | 361 | protected function _add_menu_page() { |
362 | - return add_submenu_page( $this->parent_slug, $this->menu_label, $this->_group_link(), $this->capability, $this->menu_slug, '__return_false' ); |
|
362 | + return add_submenu_page($this->parent_slug, $this->menu_label, $this->_group_link(), $this->capability, $this->menu_slug, '__return_false'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
366 | 366 | private function _group_link() { |
367 | - return '<span class="ee_menu_group" onclick="return false;">' . $this->menu_label . '</span>'; |
|
367 | + return '<span class="ee_menu_group" onclick="return false;">'.$this->menu_label.'</span>'; |
|
368 | 368 | } |
369 | 369 | } //end EE_Admin_Page_Menu_Group |
@@ -187,8 +187,9 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | } |
190 | - if ( ! EEH_Class_Tools::has_property( $this, $prop ) ) |
|
191 | - throw new EE_Error( sprintf( __('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class( $this ), $prop ) ); |
|
190 | + if ( ! EEH_Class_Tools::has_property( $this, $prop ) ) { |
|
191 | + throw new EE_Error( sprintf( __('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class( $this ), $prop ) ); |
|
192 | + } |
|
192 | 193 | $this->{$prop} = $value; |
193 | 194 | |
194 | 195 | } |
@@ -203,8 +204,9 @@ discard block |
||
203 | 204 | } |
204 | 205 | |
205 | 206 | //if empty menu_callback let's set default (but only if we have admin page init object) |
206 | - if ( empty( $this->menu_callback ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) |
|
207 | - $this->menu_callback = array( $this->admin_init_page, 'initialize_admin_page' ); |
|
207 | + if ( empty( $this->menu_callback ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) { |
|
208 | + $this->menu_callback = array( $this->admin_init_page, 'initialize_admin_page' ); |
|
209 | + } |
|
208 | 210 | |
209 | 211 | } |
210 | 212 | |
@@ -233,7 +235,7 @@ discard block |
||
233 | 235 | || |
234 | 236 | ( ! $network_admin && in_array( $show_on_menu_int, array( self::BLOG_AND_NETWORK_ADMIN, self::BLOG_ADMIN_ONLY ), TRUE )) ){ |
235 | 237 | $wp_page_slug = $this->_add_menu_page(); |
236 | - }else{ |
|
238 | + } else{ |
|
237 | 239 | $wp_page_slug = ''; |
238 | 240 | } |
239 | 241 |
@@ -111,7 +111,7 @@ |
||
111 | 111 | * |
112 | 112 | * @access public |
113 | 113 | * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
114 | - * @return void |
|
114 | + * @return EE_Help_Tour |
|
115 | 115 | */ |
116 | 116 | public function __construct($caf = FALSE) { |
117 | 117 | $this->_is_caf = $caf; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function __construct($caf = FALSE) { |
117 | 117 | $this->_is_caf = $caf; |
118 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
118 | + $this->_req_data = array_merge($_GET, $_POST); |
|
119 | 119 | $this->_set_tour_properties(); |
120 | 120 | $this->_set_tour_stops(); |
121 | 121 | $this->_set_tour_options(); |
@@ -158,36 +158,36 @@ discard block |
||
158 | 158 | * @access protected |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - protected function _set_tour_options( $options = array() ) { |
|
161 | + protected function _set_tour_options($options = array()) { |
|
162 | 162 | $defaults = array( |
163 | - 'tipLocation' => 'bottom', // 'top', 'bottom', 'right', 'left' in relation to parent |
|
164 | - 'nubPosition' => 'auto', // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
165 | - 'tipAdjustmentY' => 0, //allow for adjustment of tip |
|
166 | - 'tipAdjustmentX' => 0, //allow for adjustment of tip |
|
163 | + 'tipLocation' => 'bottom', // 'top', 'bottom', 'right', 'left' in relation to parent |
|
164 | + 'nubPosition' => 'auto', // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
165 | + 'tipAdjustmentY' => 0, //allow for adjustment of tip |
|
166 | + 'tipAdjustmentX' => 0, //allow for adjustment of tip |
|
167 | 167 | 'scroll' => true, //whether to scrollTo the next step or not |
168 | - 'scrollSpeed' => 300, // Page scrolling speed in ms |
|
169 | - 'timer' => 0, // 0 = off, all other numbers = time(ms) |
|
170 | - 'autoStart' => true, // true or false - false tour starts when restart called |
|
171 | - 'startTimerOnClick' => true, // true/false to start timer on first click |
|
172 | - 'nextButton' => true, // true/false for next button visibility |
|
168 | + 'scrollSpeed' => 300, // Page scrolling speed in ms |
|
169 | + 'timer' => 0, // 0 = off, all other numbers = time(ms) |
|
170 | + 'autoStart' => true, // true or false - false tour starts when restart called |
|
171 | + 'startTimerOnClick' => true, // true/false to start timer on first click |
|
172 | + 'nextButton' => true, // true/false for next button visibility |
|
173 | 173 | 'button_text' => __('Next', 'event_espresso'), |
174 | - 'tipAnimation' => 'fade', // 'pop' or 'fade' in each tip |
|
175 | - 'pauseAfter' => array(), // array of indexes where to pause the tour after |
|
176 | - 'tipAnimationFadeSpeed' => 300, // if 'fade'- speed in ms of transition |
|
177 | - 'cookieMonster' => true, // true/false for whether cookies are used |
|
178 | - 'cookieName' => $this->get_slug(), // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
179 | - 'cookieDomain' => false, // set to false or yoursite.com |
|
174 | + 'tipAnimation' => 'fade', // 'pop' or 'fade' in each tip |
|
175 | + 'pauseAfter' => array(), // array of indexes where to pause the tour after |
|
176 | + 'tipAnimationFadeSpeed' => 300, // if 'fade'- speed in ms of transition |
|
177 | + 'cookieMonster' => true, // true/false for whether cookies are used |
|
178 | + 'cookieName' => $this->get_slug(), // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
179 | + 'cookieDomain' => false, // set to false or yoursite.com |
|
180 | 180 | //'tipContainer' => 'body', // Where the tip be attached if not inline |
181 | - 'modal' => false, // Whether to cover page with modal during the tour |
|
182 | - 'expose' => false, // Whether to expose the elements at each step in the tour (requires modal:true), |
|
183 | - 'postExposeCallback' => 'EEHelpTour.postExposeCallback', // A method to call after an element has been exposed |
|
184 | - 'preRideCallback' => 'EEHelpTour_preRideCallback', // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
185 | - 'postRideCallback' => 'EEHelpTour_postRideCallback', // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
186 | - 'preStepCallback' => 'EEHelpTour_preStepCallback', // A method to call before each step |
|
187 | - 'postStepCallback' => 'EEHelpTour_postStepCallback', // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
181 | + 'modal' => false, // Whether to cover page with modal during the tour |
|
182 | + 'expose' => false, // Whether to expose the elements at each step in the tour (requires modal:true), |
|
183 | + 'postExposeCallback' => 'EEHelpTour.postExposeCallback', // A method to call after an element has been exposed |
|
184 | + 'preRideCallback' => 'EEHelpTour_preRideCallback', // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
185 | + 'postRideCallback' => 'EEHelpTour_postRideCallback', // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
186 | + 'preStepCallback' => 'EEHelpTour_preStepCallback', // A method to call before each step |
|
187 | + 'postStepCallback' => 'EEHelpTour_postStepCallback', // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
188 | 188 | ); |
189 | 189 | |
190 | - $options = !empty( $options ) && is_array($options) ? array_merge( $defaults, $options ) : $defaults; |
|
190 | + $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
191 | 191 | $this->_options = $options; |
192 | 192 | } |
193 | 193 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | * @return string slug for the tour |
203 | 203 | */ |
204 | 204 | public function get_slug() { |
205 | - if ( empty( $this->_slug ) ) |
|
206 | - throw new EE_Error( sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
205 | + if (empty($this->_slug)) |
|
206 | + throw new EE_Error(sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this))); |
|
207 | 207 | return $this->_slug; |
208 | 208 | } |
209 | 209 | |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @return string |
216 | 216 | */ |
217 | 217 | public function get_label() { |
218 | - if ( empty( $this->_label ) ) |
|
219 | - throw new EE_Error( sprintf( __('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
218 | + if (empty($this->_label)) |
|
219 | + throw new EE_Error(sprintf(__('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this))); |
|
220 | 220 | return $this->_label; |
221 | 221 | } |
222 | 222 | |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | * @return array |
228 | 228 | */ |
229 | 229 | public function get_stops() { |
230 | - foreach( $this->_stops as $ind => $stop ) { |
|
231 | - if ( ! isset( $stop['button_text'] ) ) { |
|
230 | + foreach ($this->_stops as $ind => $stop) { |
|
231 | + if ( ! isset($stop['button_text'])) { |
|
232 | 232 | $this->_stops[$ind]['button_text'] = $this->_options['button_text']; |
233 | 233 | } |
234 | 234 | } |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function get_options() { |
245 | 245 | //let's make sure there are not pauses set |
246 | - foreach ( $this->_stops as $ind => $stop ) { |
|
247 | - if ( isset( $stop['pause_after'] ) && $stop['pause_after'] ) { |
|
246 | + foreach ($this->_stops as $ind => $stop) { |
|
247 | + if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
248 | 248 | $this->_options['pauseAfter'][] = $ind; |
249 | 249 | } |
250 | 250 | } |
251 | - return apply_filters( 'FHEE__' . get_class($this) . '__get_options', $this->_options, $this ); |
|
251 | + return apply_filters('FHEE__'.get_class($this).'__get_options', $this->_options, $this); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -202,8 +203,9 @@ discard block |
||
202 | 203 | * @return string slug for the tour |
203 | 204 | */ |
204 | 205 | public function get_slug() { |
205 | - if ( empty( $this->_slug ) ) |
|
206 | - throw new EE_Error( sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
206 | + if ( empty( $this->_slug ) ) { |
|
207 | + throw new EE_Error( sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
208 | + } |
|
207 | 209 | return $this->_slug; |
208 | 210 | } |
209 | 211 | |
@@ -215,8 +217,9 @@ discard block |
||
215 | 217 | * @return string |
216 | 218 | */ |
217 | 219 | public function get_label() { |
218 | - if ( empty( $this->_label ) ) |
|
219 | - throw new EE_Error( sprintf( __('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
220 | + if ( empty( $this->_label ) ) { |
|
221 | + throw new EE_Error( sprintf( __('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
222 | + } |
|
220 | 223 | return $this->_label; |
221 | 224 | } |
222 | 225 |