@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * Class EE_Line_Item_Filter_Collection |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this |
465 | 465 | //context is turned off) EXCEPT if we're previewing |
466 | 466 | if ( empty( $templates['to'][ $context ] ) |
467 | - && ! $this->_generation_queue->get_queue()->is_preview() |
|
468 | - && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
467 | + && ! $this->_generation_queue->get_queue()->is_preview() |
|
468 | + && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
469 | 469 | //we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field. |
470 | 470 | return false; |
471 | 471 | } |
@@ -583,9 +583,9 @@ discard block |
||
583 | 583 | * Check if there is any generation data, but only if this is not for a preview. |
584 | 584 | */ |
585 | 585 | if ( ! $this->_generation_queue->get_queue()->get_generation_data() |
586 | - && ( |
|
587 | - ! $this->_generation_queue->get_queue()->is_preview() |
|
588 | - && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
|
586 | + && ( |
|
587 | + ! $this->_generation_queue->get_queue()->is_preview() |
|
588 | + && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
|
589 | 589 | ) { |
590 | 590 | $this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' ); |
591 | 591 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * This class is used for generating EE_Message objects with given info. |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return EE_Messages_Queue The new queue for holding generated EE_Message objects. |
118 | 118 | */ |
119 | - public function generate( $save = true ) { |
|
119 | + public function generate($save = true) { |
|
120 | 120 | //iterate through the messages in the queue, generate, and add to new queue. |
121 | 121 | $this->_generation_queue->get_queue()->rewind(); |
122 | - while ( $this->_generation_queue->get_queue()->valid() ) { |
|
122 | + while ($this->_generation_queue->get_queue()->valid()) { |
|
123 | 123 | //reset "current" properties |
124 | 124 | $this->_reset_current_properties(); |
125 | 125 | |
126 | 126 | /** @type EE_Message $msg */ |
127 | 127 | $msg = $this->_generation_queue->get_queue()->current(); |
128 | 128 | |
129 | - if ( $this->_verify() ) { |
|
129 | + if ($this->_verify()) { |
|
130 | 130 | //let's get generating! |
131 | 131 | $this->_generate(); |
132 | 132 | } |
@@ -138,26 +138,26 @@ discard block |
||
138 | 138 | $this->_generation_queue->get_queue()->next(); |
139 | 139 | $next_msg = $this->_generation_queue->get_queue()->current(); |
140 | 140 | //restore pointer to current item |
141 | - $this->_generation_queue->get_queue()->set_current( $msg ); |
|
141 | + $this->_generation_queue->get_queue()->set_current($msg); |
|
142 | 142 | |
143 | 143 | //if there are error messages then let's set the status and the error message. |
144 | - if ( $this->_error_msg ) { |
|
144 | + if ($this->_error_msg) { |
|
145 | 145 | //if the status is already debug only, then let's leave it at that. |
146 | - if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) { |
|
147 | - $msg->set_STS_ID( EEM_Message::status_failed ); |
|
146 | + if ($msg->STS_ID() !== EEM_Message::status_debug_only) { |
|
147 | + $msg->set_STS_ID(EEM_Message::status_failed); |
|
148 | 148 | } |
149 | 149 | $msg->set_error_message( |
150 | - __( 'Message failed to generate for the following reasons: ' ) |
|
150 | + __('Message failed to generate for the following reasons: ') |
|
151 | 151 | . "\n" |
152 | - . implode( "\n", $this->_error_msg ) |
|
152 | + . implode("\n", $this->_error_msg) |
|
153 | 153 | ); |
154 | - $msg->set_modified( time() ); |
|
154 | + $msg->set_modified(time()); |
|
155 | 155 | } else { |
156 | 156 | //remove from db |
157 | 157 | $this->_generation_queue->get_queue()->delete(); |
158 | 158 | } |
159 | 159 | //next item |
160 | - $this->_generation_queue->get_queue()->set_current( $next_msg ); |
|
160 | + $this->_generation_queue->get_queue()->set_current($next_msg); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | //generation queue is ALWAYS saved to record any errors in the generation process. |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * so a EE_Extra_Meta entry could be created and attached to the EE_Message. In those cases the save flag is |
171 | 171 | * irrelevant. |
172 | 172 | */ |
173 | - if ( $save ) { |
|
173 | + if ($save) { |
|
174 | 174 | $this->_ready_queue->save(); |
175 | 175 | } |
176 | 176 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | protected function _reset_current_properties() { |
189 | 189 | $this->_verified = false; |
190 | 190 | //make sure any _data value in the current message type is reset |
191 | - if ( $this->_current_message_type instanceof EE_message_type ) { |
|
191 | + if ($this->_current_message_type instanceof EE_message_type) { |
|
192 | 192 | $this->_current_message_type->reset_data(); |
193 | 193 | } |
194 | 194 | $this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function _generate() { |
209 | 209 | //double check verification has run and that everything is ready to work with (saves us having to validate everything again). |
210 | - if ( ! $this->_verified ) { |
|
210 | + if ( ! $this->_verified) { |
|
211 | 211 | return false; //get out because we don't have a valid setup to work with. |
212 | 212 | } |
213 | 213 | |
@@ -217,34 +217,34 @@ discard block |
||
217 | 217 | $this->_current_data_handler, |
218 | 218 | $this->_generation_queue->get_queue()->current()->context() |
219 | 219 | ); |
220 | - } catch ( EE_Error $e ) { |
|
220 | + } catch (EE_Error $e) { |
|
221 | 221 | $this->_error_msg[] = $e->getMessage(); |
222 | 222 | return false; |
223 | 223 | } |
224 | 224 | |
225 | 225 | |
226 | 226 | //if no addressees then get out because there is nothing to generation (possible bad data). |
227 | - if ( ! $this->_valid_addressees( $addressees ) ) { |
|
228 | - $this->_generation_queue->get_queue()->current()->set_STS_ID( EEM_Message::status_debug_only ); |
|
229 | - $this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
230 | - Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' ); |
|
227 | + if ( ! $this->_valid_addressees($addressees)) { |
|
228 | + $this->_generation_queue->get_queue()->current()->set_STS_ID(EEM_Message::status_debug_only); |
|
229 | + $this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
230 | + Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso'); |
|
231 | 231 | return false; |
232 | 232 | } |
233 | 233 | |
234 | 234 | $message_template_group = $this->_get_message_template_group(); |
235 | 235 | |
236 | 236 | //in the unlikely event there is no EE_Message_Template_Group available, get out! |
237 | - if ( ! $message_template_group instanceof EE_Message_Template_Group ) { |
|
238 | - $this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso' ); |
|
237 | + if ( ! $message_template_group instanceof EE_Message_Template_Group) { |
|
238 | + $this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso'); |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
242 | 242 | //get formatted templates for using to parse and setup EE_Message objects. |
243 | - $templates = $this->_get_templates( $message_template_group ); |
|
243 | + $templates = $this->_get_templates($message_template_group); |
|
244 | 244 | |
245 | 245 | |
246 | 246 | //setup new EE_Message objects (and add to _ready_queue) |
247 | - return $this->_assemble_messages( $addressees, $templates, $message_template_group ); |
|
247 | + return $this->_assemble_messages($addressees, $templates, $message_template_group); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | //so let's use that. |
263 | 263 | $GRP_ID = $this->_generation_queue->get_queue()->current()->GRP_ID(); |
264 | 264 | |
265 | - if ( $GRP_ID ) { |
|
265 | + if ($GRP_ID) { |
|
266 | 266 | //attempt to retrieve from repo first |
267 | - $GRP = $this->_template_collection->get_by_ID( $GRP_ID ); |
|
268 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
269 | - return $GRP; //got it! |
|
267 | + $GRP = $this->_template_collection->get_by_ID($GRP_ID); |
|
268 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
269 | + return $GRP; //got it! |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | //nope don't have it yet. Get from DB then add to repo |
273 | - $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
274 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
275 | - $this->_template_collection->add( $GRP ); |
|
273 | + $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
274 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
275 | + $this->_template_collection->add($GRP); |
|
276 | 276 | } |
277 | 277 | return $GRP; |
278 | 278 | } |
@@ -291,41 +291,41 @@ discard block |
||
291 | 291 | //in vanilla EE we're assuming there's only one event. |
292 | 292 | //However, if there are multiple events then we'll just use the default templates instead of different |
293 | 293 | // templates per event (which could create problems). |
294 | - if ( count( $this->_current_data_handler->events ) === 1 ) { |
|
295 | - foreach ( $this->_current_data_handler->events as $event ) { |
|
294 | + if (count($this->_current_data_handler->events) === 1) { |
|
295 | + foreach ($this->_current_data_handler->events as $event) { |
|
296 | 296 | $EVT_ID = $event['ID']; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | 300 | //before going any further, let's see if its in the queue |
301 | - $GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) ); |
|
301 | + $GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID)); |
|
302 | 302 | |
303 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
303 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
304 | 304 | return $GRP; |
305 | 305 | } |
306 | 306 | |
307 | 307 | //nope still no GRP? |
308 | 308 | //first we get the global template in case it has an override set. |
309 | - $global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa ); |
|
310 | - $global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) ); |
|
309 | + $global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa); |
|
310 | + $global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa)); |
|
311 | 311 | |
312 | 312 | //if this is an override, then we just return it. |
313 | - if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) { |
|
314 | - $this->_template_collection->add( $global_GRP, $EVT_ID ); |
|
313 | + if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) { |
|
314 | + $this->_template_collection->add($global_GRP, $EVT_ID); |
|
315 | 315 | return $global_GRP; |
316 | 316 | } |
317 | 317 | |
318 | 318 | //STILL here? Okay that means we want to see if there is event specific group and if there is we return it, |
319 | 319 | //otherwise we return the global group we retrieved. |
320 | - if ( $EVT_ID ) { |
|
320 | + if ($EVT_ID) { |
|
321 | 321 | $template_qa['Event.EVT_ID'] = $EVT_ID; |
322 | 322 | } |
323 | 323 | |
324 | - $GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
324 | + $GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
325 | 325 | $GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP; |
326 | 326 | |
327 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
328 | - $this->_template_collection->add( $GRP, $EVT_ID ); |
|
327 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
328 | + $this->_template_collection->add($GRP, $EVT_ID); |
|
329 | 329 | return $GRP; |
330 | 330 | } |
331 | 331 | |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | * ) |
350 | 350 | * ) |
351 | 351 | */ |
352 | - protected function _get_templates( EE_Message_Template_Group $message_template_group ) { |
|
352 | + protected function _get_templates(EE_Message_Template_Group $message_template_group) { |
|
353 | 353 | $templates = array(); |
354 | 354 | $context_templates = $message_template_group->context_templates(); |
355 | - foreach ( $context_templates as $context => $template_fields ) { |
|
356 | - foreach ( $template_fields as $template_field => $template_obj ) { |
|
357 | - if ( ! $template_obj instanceof EE_Message_Template ) { |
|
355 | + foreach ($context_templates as $context => $template_fields) { |
|
356 | + foreach ($template_fields as $template_field => $template_obj) { |
|
357 | + if ( ! $template_obj instanceof EE_Message_Template) { |
|
358 | 358 | continue; |
359 | 359 | } |
360 | - $templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' ); |
|
360 | + $templates[$template_field][$context] = $template_obj->get('MTP_content'); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | return $templates; |
@@ -379,20 +379,20 @@ discard block |
||
379 | 379 | * get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added |
380 | 380 | * to the queue as EEM_Message::status_failed. Very rarely should "false" be returned from this method. |
381 | 381 | */ |
382 | - protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) { |
|
382 | + protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) { |
|
383 | 383 | |
384 | 384 | //if templates are empty then get out because we can't generate anything. |
385 | - if ( ! $templates ) { |
|
385 | + if ( ! $templates) { |
|
386 | 386 | return false; |
387 | 387 | } |
388 | 388 | |
389 | 389 | //We use this as the counter for generated messages because don't forget we may be executing this inside of a |
390 | 390 | //generation_queue. So _ready_queue may have generated EE_Message objects already. |
391 | 391 | $generated_count = 0; |
392 | - foreach ( $addressees as $context => $recipients ) { |
|
393 | - foreach ( $recipients as $recipient ) { |
|
394 | - $message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group ); |
|
395 | - if ( $message instanceof EE_Message ) { |
|
392 | + foreach ($addressees as $context => $recipients) { |
|
393 | + foreach ($recipients as $recipient) { |
|
394 | + $message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group); |
|
395 | + if ($message instanceof EE_Message) { |
|
396 | 396 | $this->_ready_queue->add( |
397 | 397 | $message, |
398 | 398 | array(), |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | ) { |
428 | 428 | //stuff we already know |
429 | 429 | $transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0; |
430 | - $transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
430 | + $transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
431 | 431 | ? $this->_current_data_handler->txn->ID() |
432 | 432 | : $transaction_id; |
433 | 433 | $message_fields = array( |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | //recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the |
442 | 442 | //info from the att_obj found in the EE_Messages_Addressee object. |
443 | - if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) { |
|
443 | + if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) { |
|
444 | 444 | $message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee |
445 | 445 | ? $recipient->att_obj->ID() |
446 | 446 | : 0; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $message_fields['MSG_recipient_ID'] = $recipient->recipient_id; |
450 | 450 | $message_fields['MSG_recipient_type'] = $recipient->recipient_type; |
451 | 451 | } |
452 | - $message = EE_Message_Factory::create( $message_fields ); |
|
452 | + $message = EE_Message_Factory::create($message_fields); |
|
453 | 453 | |
454 | 454 | //grab valid shortcodes for shortcode parser |
455 | 455 | $mt_shortcodes = $this->_current_message_type->get_valid_shortcodes(); |
@@ -457,43 +457,43 @@ discard block |
||
457 | 457 | |
458 | 458 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this |
459 | 459 | //context is turned off) EXCEPT if we're previewing |
460 | - if ( empty( $templates['to'][ $context ] ) |
|
460 | + if (empty($templates['to'][$context]) |
|
461 | 461 | && ! $this->_generation_queue->get_queue()->is_preview() |
462 | - && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
462 | + && ! $this->_current_messenger->allow_empty_to_field()) { |
|
463 | 463 | //we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field. |
464 | 464 | return false; |
465 | 465 | } |
466 | 466 | $error_msg = array(); |
467 | - foreach ( $templates as $field => $field_context ) { |
|
467 | + foreach ($templates as $field => $field_context) { |
|
468 | 468 | $error_msg = array(); |
469 | 469 | //let's setup the valid shortcodes for the incoming context. |
470 | - $valid_shortcodes = $mt_shortcodes[ $context ]; |
|
470 | + $valid_shortcodes = $mt_shortcodes[$context]; |
|
471 | 471 | //merge in valid shortcodes for the field. |
472 | - $shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes; |
|
473 | - if ( isset( $templates[ $field ][ $context ] ) ) { |
|
472 | + $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
|
473 | + if (isset($templates[$field][$context])) { |
|
474 | 474 | //prefix field. |
475 | - $column_name = 'MSG_' . $field; |
|
475 | + $column_name = 'MSG_'.$field; |
|
476 | 476 | try { |
477 | 477 | $content = $this->_shortcode_parser->parse_message_template( |
478 | - $templates[ $field ][ $context ], |
|
478 | + $templates[$field][$context], |
|
479 | 479 | $recipient, |
480 | 480 | $shortcodes, |
481 | 481 | $this->_current_message_type, |
482 | 482 | $this->_current_messenger, |
483 | 483 | $message ); |
484 | - $message->set_field_or_extra_meta( $column_name, $content ); |
|
485 | - } catch ( EE_Error $e ) { |
|
486 | - $error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() ); |
|
487 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
484 | + $message->set_field_or_extra_meta($column_name, $content); |
|
485 | + } catch (EE_Error $e) { |
|
486 | + $error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage()); |
|
487 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | - if ( $message->STS_ID() === EEM_Message::status_failed ) { |
|
493 | - $error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg ); |
|
494 | - $message->set_error_message( $error_msg ); |
|
492 | + if ($message->STS_ID() === EEM_Message::status_failed) { |
|
493 | + $error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg); |
|
494 | + $message->set_error_message($error_msg); |
|
495 | 495 | } else { |
496 | - $message->set_STS_ID( EEM_Message::status_idle ); |
|
496 | + $message->set_STS_ID(EEM_Message::status_idle); |
|
497 | 497 | } |
498 | 498 | return $message; |
499 | 499 | } |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | * @param array $addressees Keys correspond to contexts for the message type and values are EE_Messages_Addressee[] |
528 | 528 | * @return bool |
529 | 529 | */ |
530 | - protected function _valid_addressees( $addressees ) { |
|
531 | - if ( ! $addressees || ! is_array( $addressees ) ) { |
|
530 | + protected function _valid_addressees($addressees) { |
|
531 | + if ( ! $addressees || ! is_array($addressees)) { |
|
532 | 532 | return false; |
533 | 533 | } |
534 | 534 | |
535 | - foreach( $addressees as $addressee_array ) { |
|
536 | - foreach ( $addressee_array as $addressee ) { |
|
537 | - if ( ! $addressee instanceof EE_Messages_Addressee ) { |
|
535 | + foreach ($addressees as $addressee_array) { |
|
536 | + foreach ($addressee_array as $addressee) { |
|
537 | + if ( ! $addressee instanceof EE_Messages_Addressee) { |
|
538 | 538 | return false; |
539 | 539 | } |
540 | 540 | } |
@@ -555,19 +555,19 @@ discard block |
||
555 | 555 | protected function _validate_messenger_and_message_type() { |
556 | 556 | |
557 | 557 | //first are there any existing error messages? If so then return. |
558 | - if ( $this->_error_msg ) { |
|
558 | + if ($this->_error_msg) { |
|
559 | 559 | return false; |
560 | 560 | } |
561 | 561 | /** @type EE_Message $message */ |
562 | 562 | $message = $this->_generation_queue->get_queue()->current(); |
563 | 563 | try { |
564 | - $this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null; |
|
565 | - } catch ( Exception $e ) { |
|
564 | + $this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null; |
|
565 | + } catch (Exception $e) { |
|
566 | 566 | $this->_error_msg[] = $e->getMessage(); |
567 | 567 | } |
568 | 568 | try { |
569 | - $this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null; |
|
570 | - } catch ( Exception $e ) { |
|
569 | + $this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null; |
|
570 | + } catch (Exception $e) { |
|
571 | 571 | $this->_error_msg[] = $e->getMessage(); |
572 | 572 | } |
573 | 573 | |
@@ -579,10 +579,10 @@ discard block |
||
579 | 579 | ! $this->_generation_queue->get_queue()->is_preview() |
580 | 580 | && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
581 | 581 | ) { |
582 | - $this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' ); |
|
582 | + $this->_error_msg[] = __('There is no generation data for this message. Unable to generate.'); |
|
583 | 583 | } |
584 | 584 | |
585 | - return empty( $this->_error_msg ); |
|
585 | + return empty($this->_error_msg); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | //First, are there any existing error messages? If so, return because if there were errors elsewhere this can't |
601 | 601 | //be used anyways. |
602 | - if ( $this->_error_msg ) { |
|
602 | + if ($this->_error_msg) { |
|
603 | 603 | return false; |
604 | 604 | } |
605 | 605 | |
@@ -608,29 +608,29 @@ discard block |
||
608 | 608 | /** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */ |
609 | 609 | $data_handler_class_name = $this->_generation_queue->get_queue()->get_data_handler() |
610 | 610 | ? $this->_generation_queue->get_queue()->get_data_handler() |
611 | - : 'EE_Messages_' . $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data'; |
|
611 | + : 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data'; |
|
612 | 612 | |
613 | 613 | //If this EE_Message is for a preview, then let's switch out to the preview data handler. |
614 | - if ( $this->_generation_queue->get_queue()->is_preview() ) { |
|
615 | - $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
614 | + if ($this->_generation_queue->get_queue()->is_preview()) { |
|
615 | + $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | //First get the class name for the data handler (and also verifies it exists. |
619 | - if ( ! class_exists( $data_handler_class_name ) ) { |
|
619 | + if ( ! class_exists($data_handler_class_name)) { |
|
620 | 620 | $this->_error_msg[] = sprintf( |
621 | - __( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso' ), |
|
621 | + __('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso'), |
|
622 | 622 | $data_handler_class_name |
623 | 623 | ); |
624 | 624 | return false; |
625 | 625 | } |
626 | 626 | |
627 | 627 | //convert generation_data for data_handler_instantiation. |
628 | - $generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data ); |
|
628 | + $generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data); |
|
629 | 629 | |
630 | 630 | //note, this may set error messages as well. |
631 | - $this->_set_data_handler( $generation_data, $data_handler_class_name ); |
|
631 | + $this->_set_data_handler($generation_data, $data_handler_class_name); |
|
632 | 632 | |
633 | - return empty( $this->_error_msg ); |
|
633 | + return empty($this->_error_msg); |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | |
@@ -647,16 +647,16 @@ discard block |
||
647 | 647 | * |
648 | 648 | * @return void. |
649 | 649 | */ |
650 | - protected function _set_data_handler( $generating_data, $data_handler_class_name ) { |
|
650 | + protected function _set_data_handler($generating_data, $data_handler_class_name) { |
|
651 | 651 | //valid classname for the data handler. Now let's setup the key for the data handler repository to see if there |
652 | 652 | //is already a ready data handler in the repository. |
653 | - $this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) ); |
|
654 | - if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data ) { |
|
653 | + $this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data)); |
|
654 | + if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data) { |
|
655 | 655 | //no saved data_handler in the repo so let's set one up and add it to the repo. |
656 | 656 | try { |
657 | - $this->_current_data_handler = new $data_handler_class_name( $generating_data ); |
|
658 | - $this->_data_handler_collection->add( $this->_current_data_handler, $generating_data ); |
|
659 | - } catch( EE_Error $e ) { |
|
657 | + $this->_current_data_handler = new $data_handler_class_name($generating_data); |
|
658 | + $this->_data_handler_collection->add($this->_current_data_handler, $generating_data); |
|
659 | + } catch (EE_Error $e) { |
|
660 | 660 | $this->_error_msg[] = $e->get_error(); |
661 | 661 | } |
662 | 662 | } |
@@ -676,13 +676,13 @@ discard block |
||
676 | 676 | * @param bool $preview Indicate whether this is being used for a preview or not. |
677 | 677 | * @return mixed Prepped data for persisting to the queue. false is returned if unable to prep data. |
678 | 678 | */ |
679 | - protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) { |
|
679 | + protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) { |
|
680 | 680 | /** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */ |
681 | - $data_handler = $message_to_generate->get_data_handler_class_name( $preview ); |
|
682 | - if ( ! $message_to_generate->valid() ) { |
|
681 | + $data_handler = $message_to_generate->get_data_handler_class_name($preview); |
|
682 | + if ( ! $message_to_generate->valid()) { |
|
683 | 683 | return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid. |
684 | 684 | } |
685 | - return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() ); |
|
685 | + return $data_handler::convert_data_for_persistent_storage($message_to_generate->data()); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | |
@@ -695,26 +695,26 @@ discard block |
||
695 | 695 | * @param EE_Message_To_Generate $message_to_generate |
696 | 696 | * @param bool $test_send Whether this is just a test send or not. Typically used for previews. |
697 | 697 | */ |
698 | - public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) { |
|
698 | + public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) { |
|
699 | 699 | //prep data |
700 | - $data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() ); |
|
700 | + $data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview()); |
|
701 | 701 | |
702 | 702 | $message = $message_to_generate->get_EE_Message(); |
703 | 703 | |
704 | 704 | //is there a GRP_ID in the request? |
705 | - if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) { |
|
706 | - $message->set_GRP_ID( $GRP_ID ); |
|
705 | + if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) { |
|
706 | + $message->set_GRP_ID($GRP_ID); |
|
707 | 707 | } |
708 | 708 | |
709 | - if ( $data === false ) { |
|
710 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
711 | - $message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) ); |
|
709 | + if ($data === false) { |
|
710 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
711 | + $message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso')); |
|
712 | 712 | } else { |
713 | 713 | //make sure that the data handler is cached on the message as well |
714 | 714 | $data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name(); |
715 | 715 | } |
716 | 716 | |
717 | - $this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send ); |
|
717 | + $this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 |
@@ -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 |
@@ -717,8 +718,9 @@ discard block |
||
717 | 718 | $wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type ); |
718 | 719 | |
719 | 720 | //check file exists and is readable |
720 | - if ( !is_readable( $wrapper_template ) ) |
|
721 | - throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper. The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) ); |
|
721 | + if ( !is_readable( $wrapper_template ) ) { |
|
722 | + throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper. The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) ); |
|
723 | + } |
|
722 | 724 | |
723 | 725 | //require template helper |
724 | 726 | EE_Registry::instance()->load_helper( 'Template' ); |
@@ -788,20 +790,24 @@ discard block |
||
788 | 790 | */ |
789 | 791 | public function get_field_label( $field ) { |
790 | 792 | //first let's see if the field requests is in the top level array. |
791 | - if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) ) |
|
792 | - return $this->_template[$field]['label']; |
|
793 | + if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) ) { |
|
794 | + return $this->_template[$field]['label']; |
|
795 | + } |
|
793 | 796 | |
794 | 797 | //nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index. |
795 | - if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] ) ) |
|
796 | - return $this->_template_fields['extra'][$field]['main']['label']; |
|
798 | + if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] ) ) { |
|
799 | + return $this->_template_fields['extra'][$field]['main']['label']; |
|
800 | + } |
|
797 | 801 | |
798 | 802 | //now it's possible this field may just be existing in any of the extra array items. |
799 | 803 | if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) { |
800 | 804 | foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) { |
801 | - if ( !is_array( $subfields ) ) |
|
802 | - continue; |
|
803 | - if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) ) |
|
804 | - return $subfields[$field]['label']; |
|
805 | + if ( !is_array( $subfields ) ) { |
|
806 | + continue; |
|
807 | + } |
|
808 | + if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) ) { |
|
809 | + return $subfields[$field]['label']; |
|
810 | + } |
|
805 | 811 | } |
806 | 812 | } |
807 | 813 |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | /** |
504 | 504 | * @param $message_types |
505 | 505 | * @param array $extra |
506 | - * @return mixed|string |
|
506 | + * @return string |
|
507 | 507 | */ |
508 | 508 | protected function _get_admin_content_events_edit( $message_types, $extra ) { |
509 | 509 | //defaults |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * All this does is set the existing test settings (in the db) for the messenger |
772 | 772 | * |
773 | 773 | * @access public |
774 | - * @param $settings |
|
774 | + * @param string $settings |
|
775 | 775 | * @return bool success/fail |
776 | 776 | */ |
777 | 777 | public function set_existing_test_settings( $settings ) { |
@@ -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 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @return void |
290 | 290 | */ |
291 | 291 | public function enqueue_scripts_styles() { |
292 | - do_action( 'AHEE__EE_messenger__enqueue_scripts_styles'); |
|
292 | + do_action('AHEE__EE_messenger__enqueue_scripts_styles'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | $this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure. Usually these affect things like font style, color, borders etc. In some cases the styles will also make minor layout changes.'); |
361 | 361 | |
362 | - $this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this ); |
|
362 | + $this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | * @return stdClass |
375 | 375 | */ |
376 | 376 | public function get_supports_labels() { |
377 | - if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) { |
|
377 | + if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) { |
|
378 | 378 | $this->_set_supports_labels_defaults(); |
379 | 379 | } |
380 | - return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this ); |
|
380 | + return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -397,10 +397,10 @@ discard block |
||
397 | 397 | * |
398 | 398 | * @return string path or url for the requested variation. |
399 | 399 | */ |
400 | - public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) { |
|
400 | + public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) { |
|
401 | 401 | $this->_tmp_pack = $pack; |
402 | - $variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters ); |
|
403 | - $variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path; |
|
402 | + $variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters); |
|
403 | + $variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path; |
|
404 | 404 | return $variation_path; |
405 | 405 | |
406 | 406 | } |
@@ -418,13 +418,13 @@ discard block |
||
418 | 418 | * @return array |
419 | 419 | */ |
420 | 420 | public function get_default_message_types() { |
421 | - $class = get_class( $this ); |
|
421 | + $class = get_class($this); |
|
422 | 422 | |
423 | 423 | //messenger specific filter |
424 | - $default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this ); |
|
424 | + $default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this); |
|
425 | 425 | |
426 | 426 | //all messengers filter |
427 | - $default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this ); |
|
427 | + $default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this); |
|
428 | 428 | return $default_types; |
429 | 429 | } |
430 | 430 | |
@@ -439,14 +439,14 @@ discard block |
||
439 | 439 | * @return array |
440 | 440 | */ |
441 | 441 | public function get_valid_message_types() { |
442 | - $class = get_class( $this ); |
|
442 | + $class = get_class($this); |
|
443 | 443 | |
444 | 444 | //messenger specific filter |
445 | 445 | //messenger specific filter |
446 | - $valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this ); |
|
446 | + $valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this); |
|
447 | 447 | |
448 | 448 | //all messengers filter |
449 | - $valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this ); |
|
449 | + $valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this); |
|
450 | 450 | return $valid_types; |
451 | 451 | } |
452 | 452 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @access public |
461 | 461 | * @param array $new_config Whatever is put in here will reset the _validator_config property |
462 | 462 | */ |
463 | - public function set_validator_config( $new_config ) { |
|
463 | + public function set_validator_config($new_config) { |
|
464 | 464 | $this->_validator_config = $new_config; |
465 | 465 | } |
466 | 466 | |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | public function get_validator_config() { |
477 | 477 | $class = get_class($this); |
478 | 478 | |
479 | - $config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this ); |
|
480 | - $config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this ); |
|
479 | + $config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this); |
|
480 | + $config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this); |
|
481 | 481 | return $config; |
482 | 482 | } |
483 | 483 | |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | * @access public |
495 | 495 | * @return string content for page |
496 | 496 | */ |
497 | - public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) { |
|
498 | - return $this->_get_admin_page_content( $page, $action, $extra, $message_types ); |
|
497 | + public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) { |
|
498 | + return $this->_get_admin_page_content($page, $action, $extra, $message_types); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -505,20 +505,20 @@ discard block |
||
505 | 505 | * @param array $extra |
506 | 506 | * @return mixed|string |
507 | 507 | */ |
508 | - protected function _get_admin_content_events_edit( $message_types, $extra ) { |
|
508 | + protected function _get_admin_content_events_edit($message_types, $extra) { |
|
509 | 509 | //defaults |
510 | 510 | $template_args = array(); |
511 | 511 | $selector_rows = ''; |
512 | 512 | |
513 | 513 | //we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event. |
514 | - $event_id = isset( $extra['event'] ) ? $extra['event'] : NULL; |
|
514 | + $event_id = isset($extra['event']) ? $extra['event'] : NULL; |
|
515 | 515 | |
516 | - $template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php'; |
|
517 | - $template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php'; |
|
516 | + $template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php'; |
|
517 | + $template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php'; |
|
518 | 518 | |
519 | 519 | //array of template objects for global and custom (non-trashed) (but remember just for this messenger!) |
520 | 520 | $global_templates = EEM_Message_Template_Group::instance()->get_all( |
521 | - array( array( 'MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true ) ) |
|
521 | + array(array('MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true)) |
|
522 | 522 | ); |
523 | 523 | $templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event( |
524 | 524 | $event_id, |
@@ -527,55 +527,55 @@ discard block |
||
527 | 527 | 'MTP_is_active' => true |
528 | 528 | ) |
529 | 529 | ); |
530 | - $templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array(); |
|
530 | + $templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array(); |
|
531 | 531 | |
532 | 532 | //so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups) |
533 | - foreach ( $global_templates as $mtpgID => $mtpg ) { |
|
534 | - if ( $mtpg instanceof EE_Message_Template_Group ) { |
|
533 | + foreach ($global_templates as $mtpgID => $mtpg) { |
|
534 | + if ($mtpg instanceof EE_Message_Template_Group) { |
|
535 | 535 | //verify this message type is supposed to show on this page |
536 | 536 | $mtp_obj = $mtpg->message_type_obj(); |
537 | - if ( ! $mtp_obj instanceof EE_message_type ) { |
|
537 | + if ( ! $mtp_obj instanceof EE_message_type) { |
|
538 | 538 | continue; |
539 | 539 | } |
540 | - $mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages; |
|
541 | - if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) { |
|
540 | + $mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages; |
|
541 | + if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) { |
|
542 | 542 | continue; |
543 | 543 | } |
544 | 544 | $select_values = array(); |
545 | - $select_values[ $mtpgID ] = __( 'Global', 'event_espresso' ); |
|
546 | - $default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null; |
|
545 | + $select_values[$mtpgID] = __('Global', 'event_espresso'); |
|
546 | + $default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null; |
|
547 | 547 | //if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override. |
548 | - if ( ! $mtpg->get( 'MTP_is_override' ) ) { |
|
548 | + if ( ! $mtpg->get('MTP_is_override')) { |
|
549 | 549 | //any custom templates for this message type? |
550 | - $custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() ); |
|
551 | - foreach ( $custom_templates as $cmtpgID => $cmtpg ) { |
|
552 | - $select_values[ $cmtpgID ] = $cmtpg->name(); |
|
553 | - $default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value; |
|
550 | + $custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type()); |
|
551 | + foreach ($custom_templates as $cmtpgID => $cmtpg) { |
|
552 | + $select_values[$cmtpgID] = $cmtpg->name(); |
|
553 | + $default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value; |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | //if there is no $default_value then we set it as the global |
557 | - $default_value = empty( $default_value ) ? $mtpgID : $default_value; |
|
558 | - $edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) ); |
|
559 | - $create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) ); |
|
560 | - $st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] ); |
|
561 | - $st_args[ 'mt_slug' ] = $mtpg->message_type(); |
|
562 | - $st_args[ 'messenger_slug' ] = $this->name; |
|
563 | - $st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' ); |
|
557 | + $default_value = empty($default_value) ? $mtpgID : $default_value; |
|
558 | + $edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php')); |
|
559 | + $create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php')); |
|
560 | + $st_args['mt_name'] = ucwords($mtp_obj->label['singular']); |
|
561 | + $st_args['mt_slug'] = $mtpg->message_type(); |
|
562 | + $st_args['messenger_slug'] = $this->name; |
|
563 | + $st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector'); |
|
564 | 564 | //note that message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates). |
565 | - $st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>'; |
|
566 | - $st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ? $st_args[ 'create_button' ] : ''; |
|
567 | - $st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : ''; |
|
568 | - $selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true ); |
|
565 | + $st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>'; |
|
566 | + $st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template') ? $st_args['create_button'] : ''; |
|
567 | + $st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : ''; |
|
568 | + $selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true); |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | 572 | //if no selectors present then get out. |
573 | - if ( empty( $selector_rows ) ) { |
|
573 | + if (empty($selector_rows)) { |
|
574 | 574 | return ''; |
575 | 575 | } |
576 | 576 | |
577 | 577 | $template_args['selector_rows'] = $selector_rows; |
578 | - return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE ); |
|
578 | + return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | * @return array $this->_template_fields |
591 | 591 | */ |
592 | 592 | public function get_template_fields() { |
593 | - $template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this ); |
|
594 | - $template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this ); |
|
593 | + $template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this); |
|
594 | + $template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this); |
|
595 | 595 | return $template_fields; |
596 | 596 | } |
597 | 597 | |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | * @param mixed $value |
606 | 606 | */ |
607 | 607 | protected function _set_template_value($item, $value) { |
608 | - if ( array_key_exists($item, $this->_template_fields) ) { |
|
609 | - $prop = '_' . $item; |
|
610 | - $this->{$prop}= $value; |
|
608 | + if (array_key_exists($item, $this->_template_fields)) { |
|
609 | + $prop = '_'.$item; |
|
610 | + $this->{$prop} = $value; |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * @return bool Very important that all messengers return bool for successful send or not. Error messages can be |
619 | 619 | * added to EE_Error. |
620 | 620 | */ |
621 | - public function send_message( $message, EE_message_type $message_type ) { |
|
622 | - $this->_validate_and_setup( $message ); |
|
621 | + public function send_message($message, EE_message_type $message_type) { |
|
622 | + $this->_validate_and_setup($message); |
|
623 | 623 | $this->_incoming_message_type = $message_type; |
624 | 624 | return $this->_send_message(); |
625 | 625 | } |
@@ -633,28 +633,28 @@ discard block |
||
633 | 633 | * @param bool $send true we will actually use the _send method (for test sends). FALSE we just return preview |
634 | 634 | * @return string return the message html content |
635 | 635 | */ |
636 | - public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) { |
|
637 | - $this->_validate_and_setup( $message ); |
|
636 | + public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) { |
|
637 | + $this->_validate_and_setup($message); |
|
638 | 638 | |
639 | 639 | $this->_incoming_message_type = $message_type; |
640 | 640 | |
641 | - if ( $send ) { |
|
641 | + if ($send) { |
|
642 | 642 | //are we overriding any existing template fields? |
643 | 643 | $settings = $this->get_existing_test_settings(); |
644 | - if ( !empty( $settings ) ) { |
|
645 | - foreach( $settings as $field => $value ) { |
|
646 | - $this->_set_template_value( $field, $value ); |
|
644 | + if ( ! empty($settings)) { |
|
645 | + foreach ($settings as $field => $value) { |
|
646 | + $this->_set_template_value($field, $value); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
651 | 651 | //enqueue preview js so that any links/buttons on the page are disabled. |
652 | - if ( ! $send ) { |
|
652 | + if ( ! $send) { |
|
653 | 653 | // the below may seem like duplication. However, typically if a messenger enqueues scripts/styles, |
654 | 654 | // it deregisters all existing wp scripts and styles first. So the second hook ensures our previewer still gets setup. |
655 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 ); |
|
656 | - add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 ); |
|
657 | - add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 ); |
|
655 | + add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10); |
|
656 | + add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10); |
|
657 | + add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10); |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | return $send ? $this->_send_message() : $this->_preview(); |
@@ -672,10 +672,10 @@ discard block |
||
672 | 672 | */ |
673 | 673 | public function add_preview_script() { |
674 | 674 | //error message |
675 | - EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup. To test generated links, you must trigger an actual message notification.', 'event_espresso' ); |
|
676 | - wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true ); |
|
677 | - wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
678 | - wp_enqueue_script( 'ee-messages-preview-js' ); |
|
675 | + EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup. To test generated links, you must trigger an actual message notification.', 'event_espresso'); |
|
676 | + wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true); |
|
677 | + wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings); |
|
678 | + wp_enqueue_script('ee-messages-preview-js'); |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -686,13 +686,13 @@ discard block |
||
686 | 686 | * @param EE_Message $message |
687 | 687 | * @throws EE_Error |
688 | 688 | */ |
689 | - protected function _validate_and_setup( EE_Message $message ) { |
|
689 | + protected function _validate_and_setup(EE_Message $message) { |
|
690 | 690 | $template_pack = $message->get_template_pack(); |
691 | 691 | $variation = $message->get_template_pack_variation(); |
692 | 692 | |
693 | 693 | //verify we have the required template pack value on the $message object. |
694 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack ) { |
|
695 | - throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) ); |
|
694 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack) { |
|
695 | + throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso')); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | $this->_tmp_pack = $template_pack; |
@@ -701,11 +701,11 @@ discard block |
||
701 | 701 | |
702 | 702 | $template_fields = $this->get_template_fields(); |
703 | 703 | |
704 | - foreach ( $template_fields as $template => $value ) { |
|
705 | - if ( $template !== 'extra' ) { |
|
706 | - $column_value = $message->get_field_or_extra_meta( 'MSG_' . $template ); |
|
704 | + foreach ($template_fields as $template => $value) { |
|
705 | + if ($template !== 'extra') { |
|
706 | + $column_value = $message->get_field_or_extra_meta('MSG_'.$template); |
|
707 | 707 | $message_template_value = $column_value ? $column_value : null; |
708 | - $this->_set_template_value( $template, $message_template_value ); |
|
708 | + $this->_set_template_value($template, $message_template_value); |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | } |
@@ -720,19 +720,19 @@ discard block |
||
720 | 720 | * @return string |
721 | 721 | * @throws \EE_Error |
722 | 722 | */ |
723 | - protected function _get_main_template( $preview = FALSE ) { |
|
723 | + protected function _get_main_template($preview = FALSE) { |
|
724 | 724 | $type = $preview ? 'preview' : 'main'; |
725 | 725 | |
726 | - $wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type ); |
|
726 | + $wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type); |
|
727 | 727 | |
728 | 728 | //check file exists and is readable |
729 | - if ( !is_readable( $wrapper_template ) ) |
|
730 | - throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper. The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) ); |
|
729 | + if ( ! is_readable($wrapper_template)) |
|
730 | + throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper. The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template)); |
|
731 | 731 | |
732 | 732 | //add message type to template args |
733 | 733 | $this->_template_args['message_type'] = $this->_incoming_message_type; |
734 | 734 | |
735 | - return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE ); |
|
735 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -768,9 +768,9 @@ discard block |
||
768 | 768 | */ |
769 | 769 | public function get_existing_test_settings() { |
770 | 770 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
771 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
771 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
772 | 772 | $settings = $Message_Resource_Manager->get_active_messengers_option(); |
773 | - return isset( $settings[ $this->name ]['test_settings'] ) ? $settings[ $this->name ]['test_settings'] : array(); |
|
773 | + return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array(); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | |
@@ -782,12 +782,12 @@ discard block |
||
782 | 782 | * @param $settings |
783 | 783 | * @return bool success/fail |
784 | 784 | */ |
785 | - public function set_existing_test_settings( $settings ) { |
|
785 | + public function set_existing_test_settings($settings) { |
|
786 | 786 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
787 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
787 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
788 | 788 | $existing = $Message_Resource_Manager->get_active_messengers_option(); |
789 | - $existing[ $this->name ]['test_settings'] = $settings; |
|
790 | - return $Message_Resource_Manager->update_active_messengers_option( $existing ); |
|
789 | + $existing[$this->name]['test_settings'] = $settings; |
|
790 | + return $Message_Resource_Manager->update_active_messengers_option($existing); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | |
@@ -800,21 +800,21 @@ discard block |
||
800 | 800 | * @param string $field The field to retrieve the label for |
801 | 801 | * @return string The label |
802 | 802 | */ |
803 | - public function get_field_label( $field ) { |
|
803 | + public function get_field_label($field) { |
|
804 | 804 | //first let's see if the field requests is in the top level array. |
805 | - if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) ) |
|
805 | + if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label'])) |
|
806 | 806 | return $this->_template[$field]['label']; |
807 | 807 | |
808 | 808 | //nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index. |
809 | - if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] ) ) |
|
809 | + if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label'])) |
|
810 | 810 | return $this->_template_fields['extra'][$field]['main']['label']; |
811 | 811 | |
812 | 812 | //now it's possible this field may just be existing in any of the extra array items. |
813 | - if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) { |
|
814 | - foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) { |
|
815 | - if ( !is_array( $subfields ) ) |
|
813 | + if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) { |
|
814 | + foreach ($this->_template_fields['extra'] as $main_field => $subfields) { |
|
815 | + if ( ! is_array($subfields)) |
|
816 | 816 | continue; |
817 | - if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) ) |
|
817 | + if (isset($subfields[$field]) && ! empty($subfields[$field]['label'])) |
|
818 | 818 | return $subfields[$field]['label']; |
819 | 819 | } |
820 | 820 | } |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | * |
836 | 836 | * @return void |
837 | 837 | */ |
838 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
838 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
839 | 839 | return; |
840 | 840 | } |
841 | 841 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | * @param array $data |
44 | 44 | * @throws \EE_Error |
45 | 45 | */ |
46 | - public function __construct( $data ) { |
|
46 | + public function __construct($data) { |
|
47 | 47 | |
48 | 48 | //test for valid params |
49 | - if ( ! ( $data[0] instanceof EE_Transaction )) |
|
50 | - throw new EE_Error( __('Incoming data for the Gateways data handler must have an EE_Transaction object as the value for the first array index.', 'event_espresso') ); |
|
49 | + if ( ! ($data[0] instanceof EE_Transaction)) |
|
50 | + throw new EE_Error(__('Incoming data for the Gateways data handler must have an EE_Transaction object as the value for the first array index.', 'event_espresso')); |
|
51 | 51 | |
52 | - if ( empty( $data[1] ) || ! $data[1] instanceof EE_Payment ) |
|
53 | - $pmt_obj = $this->_get_empty_payment_obj( $data[0] ); |
|
52 | + if (empty($data[1]) || ! $data[1] instanceof EE_Payment) |
|
53 | + $pmt_obj = $this->_get_empty_payment_obj($data[0]); |
|
54 | 54 | |
55 | - if ( ! empty( $data[2] ) ) { |
|
55 | + if ( ! empty($data[2])) { |
|
56 | 56 | $filtered_reg_status = $data[2]; |
57 | 57 | } |
58 | 58 | |
59 | 59 | $data = array( |
60 | 60 | 'txn_obj' => $data[0], |
61 | 61 | 'pmt_obj' => isset($pmt_obj) ? $pmt_obj : $data[1], |
62 | - 'filtered_reg_status' => isset( $filtered_reg_status ) ? $filtered_reg_status : null |
|
62 | + 'filtered_reg_status' => isset($filtered_reg_status) ? $filtered_reg_status : null |
|
63 | 63 | ); |
64 | - parent::__construct( $data ); |
|
64 | + parent::__construct($data); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return array The prepped data for db |
77 | 77 | */ |
78 | - static public function convert_data_for_persistent_storage( $data ) { |
|
78 | + static public function convert_data_for_persistent_storage($data) { |
|
79 | 79 | $prepped_data = array(); |
80 | 80 | |
81 | - if ( $data[0] instanceof EE_Transaction ) { |
|
81 | + if ($data[0] instanceof EE_Transaction) { |
|
82 | 82 | $prepped_data['Transaction'] = $data[0]->ID(); |
83 | 83 | } |
84 | 84 | |
85 | - if ( isset( $data[1] ) && $data[1] instanceof EE_Payment ) { |
|
85 | + if (isset($data[1]) && $data[1] instanceof EE_Payment) { |
|
86 | 86 | $prepped_data['Payment'] = $data[1]->ID(); |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! empty( $data[2] ) ) { |
|
89 | + if ( ! empty($data[2])) { |
|
90 | 90 | $prepped_data['filter'] = $data[2]; |
91 | 91 | } |
92 | 92 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return array |
108 | 108 | */ |
109 | - static public function convert_data_from_persistent_storage( $data ) { |
|
109 | + static public function convert_data_from_persistent_storage($data) { |
|
110 | 110 | $prepped_data = array( |
111 | - 0 => isset( $data['Transaction'] ) ? EEM_Transaction::instance()->get_one_by_ID( $data['Transaction'] ) : null, |
|
112 | - 1 => isset( $data['Payment'] ) ? EEM_Payment::instance()->get_one_by_ID( $data['Payment'] ) : null, |
|
113 | - 2 => isset( $data['filter'] ) ? $data['filter'] : null |
|
111 | + 0 => isset($data['Transaction']) ? EEM_Transaction::instance()->get_one_by_ID($data['Transaction']) : null, |
|
112 | + 1 => isset($data['Payment']) ? EEM_Payment::instance()->get_one_by_ID($data['Payment']) : null, |
|
113 | + 2 => isset($data['filter']) ? $data['filter'] : null |
|
114 | 114 | ); |
115 | 115 | return $prepped_data; |
116 | 116 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @param \EE_Transaction $txn |
122 | 122 | * @return \EE_Payment |
123 | 123 | */ |
124 | - private function _get_empty_payment_obj( EE_Transaction $txn ) { |
|
125 | - $PMT = EE_Payment::new_instance( array( |
|
124 | + private function _get_empty_payment_obj(EE_Transaction $txn) { |
|
125 | + $PMT = EE_Payment::new_instance(array( |
|
126 | 126 | 'STS_ID' => EEM_Payment::status_id_pending, |
127 | 127 | 'PAY_timestamp' => time(), |
128 | 128 | 'PMD_ID' => $txn->payment_method_ID(), |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | |
151 | 151 | |
152 | 152 | //other data from the session (if possible) |
153 | - $this->user_id = isset( $session_data['user_id'] ) ? $session_data['user_id'] : ''; |
|
154 | - $this->ip_address = isset( $session_data['ip_address'] ) ? $session_data['ip_address'] : ''; |
|
155 | - $this->user_agent = isset( $session_data['user_agent'] ) ? $session_data['user_agent'] : ''; |
|
153 | + $this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : ''; |
|
154 | + $this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : ''; |
|
155 | + $this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : ''; |
|
156 | 156 | $this->init_access = $this->last_access = ''; |
157 | 157 | |
158 | 158 | $this->reg_objs = $this->txn->get_many_related('Registration'); |
@@ -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 | /** |
@@ -50,31 +50,31 @@ discard block |
||
50 | 50 | '[RECIPIENT_ADDRESS2]' => __('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'), |
51 | 51 | '[RECIPIENT_CITY]' => __('The city for the recipient of the message.', 'event_espresso'), |
52 | 52 | '[RECIPIENT_ZIP_PC]' => __('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'), |
53 | - '[RECIPIENT_ADDRESS_STATE]' => __('The state/province for the recipient of the message.', 'event_espresso' ), |
|
53 | + '[RECIPIENT_ADDRESS_STATE]' => __('The state/province for the recipient of the message.', 'event_espresso'), |
|
54 | 54 | '[RECIPIENT_COUNTRY]' => __('The country for the recipient of the message.', 'event_espresso'), |
55 | - '[RECIPIENT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ) |
|
55 | + '[RECIPIENT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso') |
|
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | - protected function _parser( $shortcode ) { |
|
61 | + protected function _parser($shortcode) { |
|
62 | 62 | |
63 | 63 | //make sure we end up with a copy of the EE_Messages_Addressee object |
64 | 64 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
65 | - $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $this->_recipient; |
|
66 | - $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $this->_recipient; |
|
65 | + $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $this->_recipient; |
|
66 | + $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $this->_recipient; |
|
67 | 67 | |
68 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) |
|
68 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) |
|
69 | 69 | return ''; |
70 | 70 | |
71 | 71 | $attendee = $this->_recipient->att_obj; |
72 | - if ( ! $attendee instanceof EE_Attendee ) |
|
72 | + if ( ! $attendee instanceof EE_Attendee) |
|
73 | 73 | return ''; |
74 | 74 | |
75 | - $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] : array(); |
|
75 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] : array(); |
|
76 | 76 | |
77 | - switch ( $shortcode ) { |
|
77 | + switch ($shortcode) { |
|
78 | 78 | case '[RECIPIENT_FNAME]' : |
79 | 79 | return $attendee->fname(); |
80 | 80 | break; |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | break; |
89 | 89 | |
90 | 90 | case '[RECIPIENT_REGISTRATION_CODE]' : |
91 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) |
|
91 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) |
|
92 | 92 | return ''; |
93 | 93 | return $this->_get_reg_code(); |
94 | 94 | break; |
95 | 95 | |
96 | 96 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
97 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) |
|
97 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) |
|
98 | 98 | return ''; |
99 | 99 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
100 | 100 | break; |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | break; |
131 | 131 | } |
132 | 132 | |
133 | - if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) { |
|
134 | - $shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode ); |
|
135 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
133 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
134 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
135 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //now let's figure out what question has this text |
139 | - if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
139 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
140 | 140 | return ''; |
141 | 141 | } |
142 | 142 | |
143 | - foreach ( $this->_recipient->questions as $ansid => $question ) { |
|
144 | - if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset( $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid] ) ) { |
|
145 | - return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
143 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
144 | + if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid])) { |
|
145 | + return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
@@ -173,53 +173,53 @@ discard block |
||
173 | 173 | protected function _get_reg_code() { |
174 | 174 | |
175 | 175 | //if only one related registration for the recipient then just return that reg code. |
176 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
176 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
177 | 177 | return $this->_recipient->reg_obj->reg_code(); |
178 | 178 | } |
179 | 179 | |
180 | 180 | //k more than one registration so let's see if we can get specific to context |
181 | 181 | //are we parsing event_list? |
182 | - if ( $this->_data instanceof EE_Event ) { |
|
182 | + if ($this->_data instanceof EE_Event) { |
|
183 | 183 | $reg_code = array(); |
184 | 184 | //loop through registrations for recipient and see if there is a match for this event |
185 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
186 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
185 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
186 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
187 | 187 | $reg_code[] = $reg->reg_code(); |
188 | 188 | } |
189 | 189 | } |
190 | - return implode( ', ', $reg_code ); |
|
190 | + return implode(', ', $reg_code); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | //are we parsing ticket list? |
194 | - if ( $this->_data instanceof EE_Ticket ) { |
|
194 | + if ($this->_data instanceof EE_Ticket) { |
|
195 | 195 | $reg_code = array(); |
196 | 196 | //loop through each registration for recipient and see if there is a match for this ticket |
197 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
198 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
197 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
198 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
199 | 199 | $reg_code = $reg->reg_code(); |
200 | 200 | } |
201 | 201 | } |
202 | - return implode( ', ', $reg_code ); |
|
202 | + return implode(', ', $reg_code); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | //do we have a specific reg_obj? Let's use it |
206 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
206 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
207 | 207 | return $this->_data->reg_obj->reg_code(); |
208 | 208 | } |
209 | 209 | |
210 | 210 | //do we have a specific reg_obj? Let's use it |
211 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
211 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
212 | 212 | return $this->_data->reg_obj->reg_code(); |
213 | 213 | } |
214 | 214 | |
215 | 215 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
216 | 216 | $reg_code = array(); |
217 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
218 | - if ( $reg instanceof EE_Registration ) { |
|
217 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
218 | + if ($reg instanceof EE_Registration) { |
|
219 | 219 | $reg_code[] = $reg->reg_code(); |
220 | 220 | } |
221 | 221 | } |
222 | - return implode(', ', $reg_code ); |
|
222 | + return implode(', ', $reg_code); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 |
@@ -912,11 +912,11 @@ |
||
912 | 912 | sprintf( |
913 | 913 | _n( |
914 | 914 | '%d message successfully queued for resending.', |
915 | - '%d messages successfully queued for resending.', |
|
916 | - $queue_count, |
|
917 | - 'event_espresso' |
|
918 | - ), |
|
919 | - $queue_count |
|
915 | + '%d messages successfully queued for resending.', |
|
916 | + $queue_count, |
|
917 | + 'event_espresso' |
|
918 | + ), |
|
919 | + $queue_count |
|
920 | 920 | ) |
921 | 921 | ); |
922 | 922 | } else { |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @param string $payment_status The payment status being matched. |
543 | 543 | * |
544 | - * @return string|bool The payment message type slug matching the status or false if no match. |
|
544 | + * @return string|false The payment message type slug matching the status or false if no match. |
|
545 | 545 | */ |
546 | 546 | protected static function _get_payment_message_type( $payment_status ) { |
547 | 547 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | * @since 4.9.0 |
872 | 872 | * @param $message_ids |
873 | 873 | * |
874 | - * @return bool | EE_Messages_Queue false if no messages sent. |
|
874 | + * @return EE_Messages_Queue | EE_Messages_Queue false if no messages sent. |
|
875 | 875 | */ |
876 | 876 | public static function send_now( $message_ids ) { |
877 | 877 | self::_load_controller(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return EED_Module |
70 | 70 | */ |
71 | 71 | public static function instance() { |
72 | - return parent::get_instance( __CLASS__ ); |
|
72 | + return parent::get_instance(__CLASS__); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks() { |
86 | 86 | //actions |
87 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
88 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 ); |
|
87 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
88 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2); |
|
89 | 89 | //filters |
90 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
91 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
90 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
91 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
92 | 92 | //register routes |
93 | 93 | self::_register_routes(); |
94 | 94 | } |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public static function set_hooks_admin() { |
103 | 103 | //actions |
104 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
105 | - add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder' ), 10 ); |
|
106 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 ); |
|
107 | - add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array( 'EED_Messages', 'send_newsletter_message' ), 10, 2 ); |
|
108 | - add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 ); |
|
109 | - add_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', array( 'EED_Messages', 'process_admin_payment' ), 10, 1 ); |
|
104 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
105 | + add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10); |
|
106 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3); |
|
107 | + add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array('EED_Messages', 'send_newsletter_message'), 10, 2); |
|
108 | + add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10); |
|
109 | + add_action('AHEE__EE_Admin_Page___process_admin_payment_notification', array('EED_Messages', 'process_admin_payment'), 10, 1); |
|
110 | 110 | //filters |
111 | - add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 ); |
|
112 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
113 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
111 | + add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2); |
|
112 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
113 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * @return void |
125 | 125 | */ |
126 | 126 | protected static function _register_routes() { |
127 | - EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' ); |
|
128 | - EE_Config::register_route( 'msg_cron_trigger', 'Messages', 'run_cron' ); |
|
129 | - EE_Config::register_route( 'msg_browser_trigger', 'Messages', 'browser_trigger' ); |
|
130 | - EE_Config::register_route( 'msg_browser_error_trigger', 'Messages', 'browser_error_trigger' ); |
|
131 | - do_action( 'AHEE__EED_Messages___register_routes' ); |
|
127 | + EE_Config::register_route('msg_url_trigger', 'Messages', 'run'); |
|
128 | + EE_Config::register_route('msg_cron_trigger', 'Messages', 'run_cron'); |
|
129 | + EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger'); |
|
130 | + EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger'); |
|
131 | + do_action('AHEE__EED_Messages___register_routes'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -139,18 +139,18 @@ discard block |
||
139 | 139 | * @since 4.9.0 |
140 | 140 | * @param WP $WP |
141 | 141 | */ |
142 | - public function browser_trigger( $WP ) { |
|
142 | + public function browser_trigger($WP) { |
|
143 | 143 | //ensure controller is loaded |
144 | 144 | self::_load_controller(); |
145 | - $token = EE_Registry::instance()->REQ->get( 'token' ); |
|
145 | + $token = EE_Registry::instance()->REQ->get('token'); |
|
146 | 146 | try { |
147 | - $mtg = new EE_Message_Generated_From_Token( $token, 'html', self::$_message_resource_manager ); |
|
148 | - self::$_MSG_PROCESSOR->generate_and_send_now( $mtg ); |
|
149 | - } catch( EE_Error $e ) { |
|
150 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
147 | + $mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager); |
|
148 | + self::$_MSG_PROCESSOR->generate_and_send_now($mtg); |
|
149 | + } catch (EE_Error $e) { |
|
150 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
151 | 151 | // add specific message for developers if WP_DEBUG in on |
152 | - $error_msg .= '||' . $e->getMessage(); |
|
153 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
152 | + $error_msg .= '||'.$e->getMessage(); |
|
153 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | * @since 4.9.0 |
167 | 167 | * @param $WP |
168 | 168 | */ |
169 | - public function browser_error_trigger( $WP ) { |
|
170 | - $token = EE_Registry::instance()->REQ->get( 'token' ); |
|
171 | - if ( $token ) { |
|
172 | - $message = EEM_Message::instance()->get_one_by_token( $token ); |
|
173 | - if ( $message instanceof EE_Message ) { |
|
174 | - header( 'HTTP/1.1 200 OK' ); |
|
175 | - $error_msg = nl2br( $message->error_message() ); |
|
169 | + public function browser_error_trigger($WP) { |
|
170 | + $token = EE_Registry::instance()->REQ->get('token'); |
|
171 | + if ($token) { |
|
172 | + $message = EEM_Message::instance()->get_one_by_token($token); |
|
173 | + if ($message instanceof EE_Message) { |
|
174 | + header('HTTP/1.1 200 OK'); |
|
175 | + $error_msg = nl2br($message->error_message()); |
|
176 | 176 | ?> |
177 | 177 | <!DOCTYPE html> |
178 | 178 | <html> |
179 | 179 | <head></head> |
180 | 180 | <body> |
181 | - <?php echo empty( $error_msg ) |
|
182 | - ? esc_html__( 'Unfortunately, we were unable to capture the error message for this message.', 'event_espresso' ) |
|
181 | + <?php echo empty($error_msg) |
|
182 | + ? esc_html__('Unfortunately, we were unable to capture the error message for this message.', 'event_espresso') |
|
183 | 183 | : wp_kses( |
184 | 184 | $error_msg, |
185 | 185 | array( |
@@ -214,19 +214,19 @@ discard block |
||
214 | 214 | * @throws EE_Error |
215 | 215 | * @return void |
216 | 216 | */ |
217 | - public function run( $WP ) { |
|
217 | + public function run($WP) { |
|
218 | 218 | //ensure controller is loaded |
219 | 219 | self::_load_controller(); |
220 | 220 | // attempt to process message |
221 | 221 | try { |
222 | 222 | /** @type EE_Message_To_Generate_From_Request $message_to_generate */ |
223 | - $message_to_generate = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
224 | - self::$_MSG_PROCESSOR->generate_and_send_now( $message_to_generate ); |
|
225 | - } catch ( EE_Error $e ) { |
|
226 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
223 | + $message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
224 | + self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate); |
|
225 | + } catch (EE_Error $e) { |
|
226 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
227 | 227 | // add specific message for developers if WP_DEBUG in on |
228 | - $error_msg .= '||' . $e->getMessage(); |
|
229 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
228 | + $error_msg .= '||'.$e->getMessage(); |
|
229 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
@@ -235,33 +235,33 @@ discard block |
||
235 | 235 | * This is triggered by the 'msg_cron_trigger' route. |
236 | 236 | * @param WP $WP |
237 | 237 | */ |
238 | - public function run_cron( $WP ) { |
|
238 | + public function run_cron($WP) { |
|
239 | 239 | self::_load_controller(); |
240 | 240 | //get required vars |
241 | - $cron_type = EE_Registry::instance()->REQ->get( 'type' ); |
|
242 | - $transient_key = EE_Registry::instance()->REQ->get( 'key' ); |
|
243 | - header( 'HTTP/1.1 200 OK' ); |
|
241 | + $cron_type = EE_Registry::instance()->REQ->get('type'); |
|
242 | + $transient_key = EE_Registry::instance()->REQ->get('key'); |
|
243 | + header('HTTP/1.1 200 OK'); |
|
244 | 244 | |
245 | 245 | //now let's verify transient, if not valid exit immediately |
246 | - if ( ! get_transient( $transient_key ) ) { |
|
246 | + if ( ! get_transient($transient_key)) { |
|
247 | 247 | /** |
248 | 248 | * trigger error so this gets in the error logs. This is important because it happens on a non-user request. |
249 | 249 | */ |
250 | - trigger_error( esc_attr__( 'Invalid Request (Transient does not exist)', 'event_espresso' ) ); |
|
250 | + trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso')); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | //if made it here, lets' delete the transient to keep the db clean |
254 | - delete_transient( $transient_key ); |
|
254 | + delete_transient($transient_key); |
|
255 | 255 | |
256 | - $method = 'batch_' . $cron_type . '_from_queue'; |
|
257 | - if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) { |
|
256 | + $method = 'batch_'.$cron_type.'_from_queue'; |
|
257 | + if (method_exists(self::$_MSG_PROCESSOR, $method)) { |
|
258 | 258 | self::$_MSG_PROCESSOR->$method(); |
259 | 259 | } else { |
260 | 260 | //no matching task |
261 | 261 | /** |
262 | 262 | * trigger error so this gets in the error logs. This is important because it happens on a non user request. |
263 | 263 | */ |
264 | - trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) ); |
|
264 | + trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type))); |
|
265 | 265 | } |
266 | 266 | exit(); |
267 | 267 | } |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return EE_Messages_Template_Pack |
281 | 281 | */ |
282 | - public static function get_template_pack( $template_pack_name ) { |
|
283 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
284 | - return EEH_MSG_Template::get_template_pack( $template_pack_name ); |
|
282 | + public static function get_template_pack($template_pack_name) { |
|
283 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
284 | + return EEH_MSG_Template::get_template_pack($template_pack_name); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -295,14 +295,14 @@ discard block |
||
295 | 295 | * @return EE_Messages_Template_Pack[] |
296 | 296 | */ |
297 | 297 | public static function get_template_packs() { |
298 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
298 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
299 | 299 | |
300 | 300 | //for backward compat, let's make sure this returns in the same format as originally. |
301 | 301 | $template_pack_collection = EEH_MSG_Template::get_template_pack_collection(); |
302 | 302 | $template_pack_collection->rewind(); |
303 | 303 | $template_packs = array(); |
304 | - while ( $template_pack_collection->valid() ) { |
|
305 | - $template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current(); |
|
304 | + while ($template_pack_collection->valid()) { |
|
305 | + $template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current(); |
|
306 | 306 | $template_pack_collection->next(); |
307 | 307 | } |
308 | 308 | return $template_packs; |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | * @return void |
319 | 319 | */ |
320 | 320 | public static function set_autoloaders() { |
321 | - if ( empty( self::$_MSG_PATHS ) ) { |
|
321 | + if (empty(self::$_MSG_PATHS)) { |
|
322 | 322 | self::_set_messages_paths(); |
323 | - foreach ( self::$_MSG_PATHS as $path ) { |
|
324 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path ); |
|
323 | + foreach (self::$_MSG_PATHS as $path) { |
|
324 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path); |
|
325 | 325 | } |
326 | 326 | // add aliases |
327 | - EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' ); |
|
328 | - EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' ); |
|
327 | + EEH_Autoloader::add_alias('EE_messages', 'EE_messages'); |
|
328 | + EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger'); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | 'shortcodes', |
354 | 354 | ); |
355 | 355 | $paths = array(); |
356 | - foreach ( $dir_ref as $index => $dir ) { |
|
357 | - $paths[ $index ] = EE_LIBRARIES . $dir; |
|
356 | + foreach ($dir_ref as $index => $dir) { |
|
357 | + $paths[$index] = EE_LIBRARIES.$dir; |
|
358 | 358 | } |
359 | - self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths ); |
|
359 | + self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | * @return void |
368 | 368 | */ |
369 | 369 | protected static function _load_controller() { |
370 | - if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) { |
|
371 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
370 | + if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) { |
|
371 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
372 | 372 | self::set_autoloaders(); |
373 | - self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' ); |
|
374 | - self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
375 | - self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
373 | + self::$_EEMSG = EE_Registry::instance()->load_lib('messages'); |
|
374 | + self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
375 | + self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
@@ -381,10 +381,10 @@ discard block |
||
381 | 381 | /** |
382 | 382 | * @param EE_Transaction $transaction |
383 | 383 | */ |
384 | - public static function payment_reminder( EE_Transaction $transaction ) { |
|
384 | + public static function payment_reminder(EE_Transaction $transaction) { |
|
385 | 385 | self::_load_controller(); |
386 | - $data = array( $transaction, null ); |
|
387 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data ); |
|
386 | + $data = array($transaction, null); |
|
387 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -395,14 +395,14 @@ discard block |
||
395 | 395 | * @param EE_Payment object |
396 | 396 | * @return void |
397 | 397 | */ |
398 | - public static function payment( EE_Transaction $transaction, EE_Payment $payment ) { |
|
398 | + public static function payment(EE_Transaction $transaction, EE_Payment $payment) { |
|
399 | 399 | self::_load_controller(); |
400 | - $data = array( $transaction, $payment ); |
|
401 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
402 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
400 | + $data = array($transaction, $payment); |
|
401 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
402 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
403 | 403 | //if payment amount is less than 0 then switch to payment_refund message type. |
404 | 404 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
405 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
405 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -410,10 +410,10 @@ discard block |
||
410 | 410 | /** |
411 | 411 | * @param EE_Transaction $transaction |
412 | 412 | */ |
413 | - public static function cancelled_registration( EE_Transaction $transaction ) { |
|
413 | + public static function cancelled_registration(EE_Transaction $transaction) { |
|
414 | 414 | self::_load_controller(); |
415 | - $data = array( $transaction, null ); |
|
416 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data ); |
|
415 | + $data = array($transaction, null); |
|
416 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | * @param array $extra_details |
427 | 427 | * @return void |
428 | 428 | */ |
429 | - public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) { |
|
429 | + public static function maybe_registration(EE_Registration $registration, $extra_details = array()) { |
|
430 | 430 | |
431 | - if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) { |
|
431 | + if ( ! self::_verify_registration_notification_send($registration, $extra_details)) { |
|
432 | 432 | //no messages please |
433 | 433 | return; |
434 | 434 | } |
@@ -443,22 +443,22 @@ discard block |
||
443 | 443 | $mtgs = array(); |
444 | 444 | |
445 | 445 | //loop through registrations and trigger messages once per status. |
446 | - foreach ( $all_registrations as $reg ) { |
|
446 | + foreach ($all_registrations as $reg) { |
|
447 | 447 | |
448 | 448 | //already triggered? |
449 | - if ( in_array( $reg->status_ID(), $statuses_sent ) ) { |
|
449 | + if (in_array($reg->status_ID(), $statuses_sent)) { |
|
450 | 450 | continue; |
451 | 451 | } |
452 | 452 | |
453 | - $message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() ); |
|
454 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ); |
|
453 | + $message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID()); |
|
454 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID())); |
|
455 | 455 | $statuses_sent[] = $reg->status_ID(); |
456 | 456 | } |
457 | 457 | |
458 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) ); |
|
458 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null)); |
|
459 | 459 | |
460 | 460 | //batch queue and initiate request |
461 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs ); |
|
461 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs); |
|
462 | 462 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
463 | 463 | } |
464 | 464 | |
@@ -473,39 +473,39 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @return bool true = send away, false = nope halt the presses. |
475 | 475 | */ |
476 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
476 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
477 | 477 | //self::log( |
478 | 478 | // __CLASS__, __FUNCTION__, __LINE__, |
479 | 479 | // $registration->transaction(), |
480 | 480 | // array( '$extra_details' => $extra_details ) |
481 | 481 | //); |
482 | 482 | // currently only using this to send messages for the primary registrant |
483 | - if ( ! $registration->is_primary_registrant() ) { |
|
483 | + if ( ! $registration->is_primary_registrant()) { |
|
484 | 484 | return false; |
485 | 485 | } |
486 | 486 | // first we check if we're in admin and not doing front ajax |
487 | - if ( is_admin() && ! EE_FRONT_AJAX ) { |
|
487 | + if (is_admin() && ! EE_FRONT_AJAX) { |
|
488 | 488 | //make sure appropriate admin params are set for sending messages |
489 | - if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) { |
|
489 | + if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { |
|
490 | 490 | //no messages sent please. |
491 | 491 | return false; |
492 | 492 | } |
493 | 493 | } else { |
494 | 494 | // frontend request (either regular or via AJAX) |
495 | 495 | // TXN is NOT finalized ? |
496 | - if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) { |
|
496 | + if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) { |
|
497 | 497 | return false; |
498 | 498 | } |
499 | 499 | // return visit but nothing changed ??? |
500 | 500 | if ( |
501 | - isset( $extra_details['revisit'], $extra_details['status_updates'] ) && |
|
501 | + isset($extra_details['revisit'], $extra_details['status_updates']) && |
|
502 | 502 | $extra_details['revisit'] && ! $extra_details['status_updates'] |
503 | 503 | ) { |
504 | 504 | return false; |
505 | 505 | } |
506 | 506 | // NOT sending messages && reg status is something other than "Not-Approved" |
507 | 507 | if ( |
508 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
508 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
509 | 509 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
510 | 510 | ) { |
511 | 511 | return false; |
@@ -527,10 +527,10 @@ discard block |
||
527 | 527 | * |
528 | 528 | * @return array |
529 | 529 | */ |
530 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
531 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
532 | - return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
533 | - ? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
530 | + protected static function _get_reg_status_array($reg_status = '') { |
|
531 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
532 | + return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
533 | + ? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
534 | 534 | : EEH_MSG_Template::reg_status_to_message_type_array(); |
535 | 535 | } |
536 | 536 | |
@@ -546,10 +546,10 @@ discard block |
||
546 | 546 | * |
547 | 547 | * @return string|bool The payment message type slug matching the status or false if no match. |
548 | 548 | */ |
549 | - protected static function _get_payment_message_type( $payment_status ) { |
|
550 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
551 | - return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
552 | - ? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
549 | + protected static function _get_payment_message_type($payment_status) { |
|
550 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
551 | + return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
552 | + ? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
553 | 553 | : false; |
554 | 554 | } |
555 | 555 | |
@@ -563,33 +563,33 @@ discard block |
||
563 | 563 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
564 | 564 | * @return bool success/fail |
565 | 565 | */ |
566 | - public static function process_resend( $req_data ) { |
|
566 | + public static function process_resend($req_data) { |
|
567 | 567 | self::_load_controller(); |
568 | 568 | |
569 | 569 | //if $msgID in this request then skip to the new resend_message |
570 | - if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) { |
|
570 | + if (EE_Registry::instance()->REQ->get('MSG_ID')) { |
|
571 | 571 | return self::resend_message(); |
572 | 572 | } |
573 | 573 | |
574 | 574 | //make sure any incoming request data is set on the REQ so that it gets picked up later. |
575 | 575 | $req_data = (array) $req_data; |
576 | - foreach( $req_data as $request_key => $request_value ) { |
|
577 | - EE_Registry::instance()->REQ->set( $request_key, $request_value ); |
|
576 | + foreach ($req_data as $request_key => $request_value) { |
|
577 | + EE_Registry::instance()->REQ->set($request_key, $request_value); |
|
578 | 578 | } |
579 | 579 | |
580 | - if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) { |
|
580 | + if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) { |
|
581 | 581 | return false; |
582 | 582 | } |
583 | 583 | |
584 | 584 | try { |
585 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send ); |
|
585 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send); |
|
586 | 586 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
587 | - } catch( EE_Error $e ) { |
|
588 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
587 | + } catch (EE_Error $e) { |
|
588 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
589 | 589 | return false; |
590 | 590 | } |
591 | 591 | EE_Error::add_success( |
592 | - __( 'Messages have been successfully queued for generation and sending.', 'event_espresso' ) |
|
592 | + __('Messages have been successfully queued for generation and sending.', 'event_espresso') |
|
593 | 593 | ); |
594 | 594 | return true; //everything got queued. |
595 | 595 | } |
@@ -602,17 +602,17 @@ discard block |
||
602 | 602 | public static function resend_message() { |
603 | 603 | self::_load_controller(); |
604 | 604 | |
605 | - $msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' ); |
|
606 | - if ( ! $msgID ) { |
|
607 | - EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
605 | + $msgID = EE_Registry::instance()->REQ->get('MSG_ID'); |
|
606 | + if ( ! $msgID) { |
|
607 | + EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
608 | 608 | return false; |
609 | 609 | } |
610 | 610 | |
611 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID ); |
|
611 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID); |
|
612 | 612 | |
613 | 613 | //setup success message. |
614 | - $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
615 | - EE_Error::add_success( sprintf( |
|
614 | + $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
615 | + EE_Error::add_success(sprintf( |
|
616 | 616 | _n( |
617 | 617 | 'There was %d message queued for resending.', |
618 | 618 | 'There were %d messages queued for resending.', |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | 'event_espresso' |
621 | 621 | ), |
622 | 622 | $count_ready_for_resend |
623 | - ) ); |
|
623 | + )); |
|
624 | 624 | return true; |
625 | 625 | } |
626 | 626 | |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | * @param EE_Payment $payment EE_payment object |
634 | 634 | * @return bool success/fail |
635 | 635 | */ |
636 | - public static function process_admin_payment( EE_Payment $payment ) { |
|
637 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
636 | + public static function process_admin_payment(EE_Payment $payment) { |
|
637 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
638 | 638 | //we need to get the transaction object |
639 | 639 | $transaction = $payment->transaction(); |
640 | - if ( $transaction instanceof EE_Transaction ) { |
|
641 | - $data = array( $transaction, $payment ); |
|
642 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
640 | + if ($transaction instanceof EE_Transaction) { |
|
641 | + $data = array($transaction, $payment); |
|
642 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
643 | 643 | |
644 | 644 | //if payment amount is less than 0 then switch to payment_refund message type. |
645 | 645 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -649,17 +649,17 @@ discard block |
||
649 | 649 | |
650 | 650 | self::_load_controller(); |
651 | 651 | |
652 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
652 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
653 | 653 | |
654 | 654 | //get count of queued for generation |
655 | - $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
655 | + $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
656 | 656 | |
657 | - if ( $count_to_generate > 0 ) { |
|
658 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' ); |
|
657 | + if ($count_to_generate > 0) { |
|
658 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true'); |
|
659 | 659 | return true; |
660 | 660 | } else { |
661 | - $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() ); |
|
662 | - EE_Error::add_error( sprintf( |
|
661 | + $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending()); |
|
662 | + EE_Error::add_error(sprintf( |
|
663 | 663 | _n( |
664 | 664 | 'The payment notification generation failed.', |
665 | 665 | '%d payment notifications failed being sent.', |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | 'event_espresso' |
668 | 668 | ), |
669 | 669 | $count_failed |
670 | - ), __FILE__, __FUNCTION__, __LINE__ ); |
|
670 | + ), __FILE__, __FUNCTION__, __LINE__); |
|
671 | 671 | return false; |
672 | 672 | } |
673 | 673 | } else { |
@@ -690,11 +690,11 @@ discard block |
||
690 | 690 | * @param int $grp_id a specific message template group id. |
691 | 691 | * @return void |
692 | 692 | */ |
693 | - public static function send_newsletter_message( $registrations, $grp_id ) { |
|
693 | + public static function send_newsletter_message($registrations, $grp_id) { |
|
694 | 694 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
695 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
695 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
696 | 696 | self::_load_controller(); |
697 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations ); |
|
697 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | * @param string $message_type |
710 | 710 | * @return string |
711 | 711 | */ |
712 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
712 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
713 | 713 | // whitelist $messenger |
714 | - switch ( $messenger ) { |
|
714 | + switch ($messenger) { |
|
715 | 715 | case 'pdf' : |
716 | 716 | $sending_messenger = 'pdf'; |
717 | 717 | $generating_messenger = 'html'; |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | break; |
724 | 724 | } |
725 | 725 | // whitelist $message_type |
726 | - switch ( $message_type ) { |
|
726 | + switch ($message_type) { |
|
727 | 727 | case 'receipt' : |
728 | 728 | $message_type = 'receipt'; |
729 | 729 | break; |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | break; |
734 | 734 | } |
735 | 735 | // verify that both the messenger AND the message type are active |
736 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
736 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
737 | 737 | //need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?) |
738 | 738 | $template_query_params = array( |
739 | 739 | 'MTP_is_active' => true, |
@@ -742,16 +742,16 @@ discard block |
||
742 | 742 | 'Event.EVT_ID' => $registration->event_ID() |
743 | 743 | ); |
744 | 744 | //get the message template group. |
745 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
745 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
746 | 746 | //if we don't have an EE_Message_Template_Group then return |
747 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
747 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
748 | 748 | // remove EVT_ID from query params so that global templates get picked up |
749 | - unset( $template_query_params['Event.EVT_ID'] ); |
|
749 | + unset($template_query_params['Event.EVT_ID']); |
|
750 | 750 | //get global template as the fallback |
751 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
751 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
752 | 752 | } |
753 | 753 | //if we don't have an EE_Message_Template_Group then return |
754 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
754 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
755 | 755 | return ''; |
756 | 756 | } |
757 | 757 | // generate the URL |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
781 | 781 | * @return string The body of the message. |
782 | 782 | */ |
783 | - public static function preview_message( $type, $context, $messenger, $send = false ) { |
|
783 | + public static function preview_message($type, $context, $messenger, $send = false) { |
|
784 | 784 | self::_load_controller(); |
785 | 785 | $mtg = new EE_Message_To_Generate( |
786 | 786 | $messenger, |
@@ -789,8 +789,8 @@ discard block |
||
789 | 789 | $context, |
790 | 790 | true |
791 | 791 | ); |
792 | - $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg ); |
|
793 | - if ( $generated_preview_queue instanceof EE_Messages_Queue ) { |
|
792 | + $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg); |
|
793 | + if ($generated_preview_queue instanceof EE_Messages_Queue) { |
|
794 | 794 | return $generated_preview_queue->get_queue()->current()->content(); |
795 | 795 | } else { |
796 | 796 | return $generated_preview_queue; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | * |
818 | 818 | * @return bool success or fail. |
819 | 819 | */ |
820 | - public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) { |
|
820 | + public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') { |
|
821 | 821 | self::_load_controller(); |
822 | 822 | /** @type EE_Message_To_Generate_From_Queue $message_to_generate */ |
823 | 823 | $message_to_generate = EE_Registry::instance()->load_lib( |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $custom_subject, |
830 | 830 | ) |
831 | 831 | ); |
832 | - return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate ); |
|
832 | + return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate); |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | |
@@ -842,22 +842,22 @@ discard block |
||
842 | 842 | * @param array $message_ids An array of message ids |
843 | 843 | * @return bool | EE_Messages_Queue false if nothing was generated, EE_Messages_Queue containing generated messages. |
844 | 844 | */ |
845 | - public static function generate_now( $message_ids ) { |
|
845 | + public static function generate_now($message_ids) { |
|
846 | 846 | self::_load_controller(); |
847 | 847 | $messages = EEM_Message::instance()->get_all( |
848 | 848 | array( |
849 | 849 | 0 => array( |
850 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
850 | + 'MSG_ID' => array('IN', $message_ids), |
|
851 | 851 | 'STS_ID' => EEM_Message::status_incomplete, |
852 | 852 | ) |
853 | 853 | ) |
854 | 854 | ); |
855 | 855 | |
856 | - $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages ); |
|
856 | + $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages); |
|
857 | 857 | |
858 | - if ( ! $generated_queue instanceof EE_Messages_Queue ) { |
|
858 | + if ( ! $generated_queue instanceof EE_Messages_Queue) { |
|
859 | 859 | EE_Error::add_error( |
860 | - __( 'The messages were not generated. This is usually because there is already a batch being generated on a separate request. You can wait a minute or two and try again.', 'event_espresso' ), |
|
860 | + __('The messages were not generated. This is usually because there is already a batch being generated on a separate request. You can wait a minute or two and try again.', 'event_espresso'), |
|
861 | 861 | __FILE__, __FUNCTION__, __LINE__ |
862 | 862 | ); |
863 | 863 | } |
@@ -876,28 +876,28 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @return bool | EE_Messages_Queue false if no messages sent. |
878 | 878 | */ |
879 | - public static function send_now( $message_ids ) { |
|
879 | + public static function send_now($message_ids) { |
|
880 | 880 | self::_load_controller(); |
881 | 881 | $messages = EEM_Message::instance()->get_all( |
882 | 882 | array( |
883 | 883 | 0 => array( |
884 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
885 | - 'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) ) |
|
884 | + 'MSG_ID' => array('IN', $message_ids), |
|
885 | + 'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry)) |
|
886 | 886 | ) |
887 | 887 | ) |
888 | 888 | ); |
889 | 889 | |
890 | - $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages ); |
|
890 | + $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages); |
|
891 | 891 | |
892 | - if ( ! $sent_queue instanceof EE_Messages_Queue ) { |
|
892 | + if ( ! $sent_queue instanceof EE_Messages_Queue) { |
|
893 | 893 | EE_Error::add_error( |
894 | - __( 'The messages were not sent. This is usually because there is already a batch being sent on a separate request. You can wait a minute or two and try again.', 'event_espresso' ), |
|
894 | + __('The messages were not sent. This is usually because there is already a batch being sent on a separate request. You can wait a minute or two and try again.', 'event_espresso'), |
|
895 | 895 | __FILE__, __FUNCTION__, __LINE__ |
896 | 896 | ); |
897 | 897 | } else { |
898 | 898 | //can count how many sent by using the messages in the queue |
899 | - $sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() ); |
|
900 | - if ( $sent_count > 0 ) { |
|
899 | + $sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent()); |
|
900 | + if ($sent_count > 0) { |
|
901 | 901 | EE_Error::add_success( |
902 | 902 | sprintf( |
903 | 903 | _n( |
@@ -912,8 +912,8 @@ discard block |
||
912 | 912 | } else { |
913 | 913 | EE_Error::overwrite_errors(); |
914 | 914 | EE_Error::add_error( |
915 | - __( 'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error. |
|
916 | - If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ), |
|
915 | + __('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error. |
|
916 | + If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'), |
|
917 | 917 | __FILE__, __FUNCTION__, __LINE__ |
918 | 918 | ); |
919 | 919 | } |
@@ -934,13 +934,13 @@ discard block |
||
934 | 934 | * |
935 | 935 | * @return bool true means messages were successfully queued for resending, false means none were queued for resending. |
936 | 936 | */ |
937 | - public static function queue_for_resending( $message_ids ) { |
|
937 | + public static function queue_for_resending($message_ids) { |
|
938 | 938 | self::_load_controller(); |
939 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids ); |
|
939 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids); |
|
940 | 940 | |
941 | 941 | //get queue and count |
942 | - $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
943 | - if ( $queue_count > 0 ) { |
|
942 | + $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
943 | + if ($queue_count > 0) { |
|
944 | 944 | EE_Error::add_success( |
945 | 945 | sprintf( |
946 | 946 | _n( |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | ); |
955 | 955 | } else { |
956 | 956 | EE_Error::add_error( |
957 | - __( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ), |
|
957 | + __('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'), |
|
958 | 958 | __FILE__, __FUNCTION__, __LINE__ |
959 | 959 | ); |
960 | 960 | } |
@@ -976,16 +976,16 @@ discard block |
||
976 | 976 | * @param array $info |
977 | 977 | * @param bool $display_request |
978 | 978 | */ |
979 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
980 | - if ( WP_DEBUG && false ) { |
|
981 | - if ( $transaction instanceof EE_Transaction ) { |
|
979 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
980 | + if (WP_DEBUG && false) { |
|
981 | + if ($transaction instanceof EE_Transaction) { |
|
982 | 982 | // don't serialize objects |
983 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
983 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
984 | 984 | $info['TXN_status'] = $transaction->status_ID(); |
985 | 985 | $info['TXN_reg_steps'] = $transaction->reg_steps(); |
986 | - if ( $transaction->ID() ) { |
|
987 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
988 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
986 | + if ($transaction->ID()) { |
|
987 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
988 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
989 | 989 | } |
990 | 990 | } |
991 | 991 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | /** |
122 | - * @param mixed $min_core_version |
|
122 | + * @param string $min_core_version |
|
123 | 123 | */ |
124 | 124 | public function set_min_core_version( $min_core_version = NULL ) { |
125 | 125 | $this->_min_core_version = $min_core_version; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | /** |
141 | 141 | * Sets addon_name |
142 | 142 | * @param string $addon_name |
143 | - * @return boolean |
|
143 | + * @return string |
|
144 | 144 | */ |
145 | 145 | function set_name( $addon_name ) { |
146 | 146 | return $this->_addon_name = $addon_name; |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @author Brent Christensen |
14 | 14 | * |
15 | 15 | */ |
16 | -class EE_DMS_4_9_0_Email_System_Question extends EE_Data_Migration_Script_Stage_Table{ |
|
16 | +class EE_DMS_4_9_0_Email_System_Question extends EE_Data_Migration_Script_Stage_Table { |
|
17 | 17 | |
18 | 18 | |
19 | 19 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | global $wpdb; |
27 | - $this->_pretty_name = __( 'Email - System Question', 'event_espresso' ); |
|
27 | + $this->_pretty_name = __('Email - System Question', 'event_espresso'); |
|
28 | 28 | $this->_old_table = $wpdb->prefix.'esp_question'; |
29 | 29 | $this->_extra_where_sql = "WHERE QST_system = 'email'"; |
30 | 30 | parent::__construct(); |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | * @param array $question an associative array where keys are column names and values are their values. |
38 | 38 | * @return null |
39 | 39 | */ |
40 | - protected function _migrate_old_row( $question ) { |
|
41 | - if ( $question['QST_ID'] && $question['QST_system'] == 'email' ) { |
|
40 | + protected function _migrate_old_row($question) { |
|
41 | + if ($question['QST_ID'] && $question['QST_system'] == 'email') { |
|
42 | 42 | global $wpdb; |
43 | 43 | $success = $wpdb->update( |
44 | 44 | $this->_old_table, |
45 | - array( 'QST_type' => 'EMAIL' ), // data |
|
46 | - array( 'QST_ID' => $question['QST_ID'] ), // where |
|
47 | - array( '%s' ), // data format |
|
48 | - array( '%d' ) // where format |
|
45 | + array('QST_type' => 'EMAIL'), // data |
|
46 | + array('QST_ID' => $question['QST_ID']), // where |
|
47 | + array('%s'), // data format |
|
48 | + array('%d') // where format |
|
49 | 49 | ); |
50 | - if ( ! $success ) { |
|
50 | + if ( ! $success) { |
|
51 | 51 | $this->add_error( |
52 | 52 | sprintf( |
53 | - __( 'Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso' ), |
|
54 | - json_encode( $question['QST_system'] ), |
|
53 | + __('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'), |
|
54 | + json_encode($question['QST_system']), |
|
55 | 55 | $question['QST_ID'], |
56 | 56 | $wpdb->last_error |
57 | 57 | ) |
@@ -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 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @author Brent Christensen |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage{ |
|
17 | +class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage { |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @return EE_DMS_4_9_0_Answers_With_No_Registration |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - $this->_pretty_name = __( 'Answer Cleanup', 'event_espresso' ); |
|
27 | + $this->_pretty_name = __('Answer Cleanup', 'event_espresso'); |
|
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | protected function _migration_step($num_items_to_migrate = 50) { |
49 | 49 | global $wpdb; |
50 | 50 | $wpdb->delete( |
51 | - $wpdb->prefix . 'esp_answer', |
|
52 | - array( 'REG_ID' => 0 ), |
|
53 | - array( '%d' ) |
|
51 | + $wpdb->prefix.'esp_answer', |
|
52 | + array('REG_ID' => 0), |
|
53 | + array('%d') |
|
54 | 54 | ); |
55 | 55 | $this->set_completed(); |
56 | 56 | return 1; |