@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Loads the class file for a given class name. |
133 | 133 | * |
134 | 134 | * @param string $class The fully-qualified class name. |
135 | - * @return mixed The mapped file name on success, or boolean false on |
|
135 | + * @return string|false The mapped file name on success, or boolean false on |
|
136 | 136 | * failure. |
137 | 137 | */ |
138 | 138 | public function loadClass( $class ) { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @param string $prefix The namespace prefix. |
167 | 167 | * @param string $relative_class The relative class name. |
168 | - * @return mixed Boolean false if no mapped file can be loaded, or the |
|
168 | + * @return string|false Boolean false if no mapped file can be loaded, or the |
|
169 | 169 | * name of the mapped file that was loaded. |
170 | 170 | */ |
171 | 171 | protected function loadMappedFile( $prefix, $relative_class ) { |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | * @param string $prefix |
78 | 78 | * @return array |
79 | 79 | */ |
80 | - public function prefixes( $prefix = '' ) { |
|
81 | - if ( ! empty( $prefix ) ) { |
|
80 | + public function prefixes($prefix = '') { |
|
81 | + if ( ! empty($prefix)) { |
|
82 | 82 | // are there any base directories for this namespace prefix? |
83 | - return isset( $this->prefixes[ $prefix ] ) ? $this->prefixes[ $prefix ] : array(); |
|
83 | + return isset($this->prefixes[$prefix]) ? $this->prefixes[$prefix] : array(); |
|
84 | 84 | } |
85 | 85 | return $this->prefixes; |
86 | 86 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | public function register() { |
96 | - spl_autoload_register( array( $this, 'loadClass' ) ); |
|
96 | + spl_autoload_register(array($this, 'loadClass')); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | * than last. |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function addNamespace( $prefix, $base_dir, $prepend = false ) { |
|
112 | + public function addNamespace($prefix, $base_dir, $prepend = false) { |
|
113 | 113 | // normalize namespace prefix |
114 | - $prefix = trim( $prefix, Psr4Autoloader::NS ) . Psr4Autoloader::NS; |
|
114 | + $prefix = trim($prefix, Psr4Autoloader::NS).Psr4Autoloader::NS; |
|
115 | 115 | // normalize the base directory with a trailing separator |
116 | - $base_dir = \EEH_File::standardise_and_end_with_directory_separator( $base_dir ); |
|
116 | + $base_dir = \EEH_File::standardise_and_end_with_directory_separator($base_dir); |
|
117 | 117 | // initialize the namespace prefix array |
118 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
119 | - $this->prefixes[ $prefix ] = array(); |
|
118 | + if (isset($this->prefixes[$prefix]) === false) { |
|
119 | + $this->prefixes[$prefix] = array(); |
|
120 | 120 | } |
121 | 121 | // retain the base directory for the namespace prefix |
122 | - if ( $prepend ) { |
|
123 | - array_unshift( $this->prefixes[ $prefix ], $base_dir ); |
|
122 | + if ($prepend) { |
|
123 | + array_unshift($this->prefixes[$prefix], $base_dir); |
|
124 | 124 | } else { |
125 | - $this->prefixes[ $prefix ][] = $base_dir; |
|
125 | + $this->prefixes[$prefix][] = $base_dir; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -135,24 +135,24 @@ discard block |
||
135 | 135 | * @return mixed The mapped file name on success, or boolean false on |
136 | 136 | * failure. |
137 | 137 | */ |
138 | - public function loadClass( $class ) { |
|
138 | + public function loadClass($class) { |
|
139 | 139 | // the current namespace prefix |
140 | 140 | $prefix = $class; |
141 | 141 | // work backwards through the namespace names of the fully-qualified |
142 | 142 | // class name to find a mapped file name |
143 | - while ( false !== $pos = strrpos( $prefix, Psr4Autoloader::NS ) ) { |
|
143 | + while (false !== $pos = strrpos($prefix, Psr4Autoloader::NS)) { |
|
144 | 144 | // retain the trailing namespace separator in the prefix |
145 | - $prefix = substr( $class, 0, $pos + 1 ); |
|
145 | + $prefix = substr($class, 0, $pos + 1); |
|
146 | 146 | // the rest is the relative class name |
147 | - $relative_class = substr( $class, $pos + 1 ); |
|
147 | + $relative_class = substr($class, $pos + 1); |
|
148 | 148 | // try to load a mapped file for the prefix and relative class |
149 | - $mapped_file = $this->loadMappedFile( $prefix, $relative_class ); |
|
150 | - if ( $mapped_file ) { |
|
149 | + $mapped_file = $this->loadMappedFile($prefix, $relative_class); |
|
150 | + if ($mapped_file) { |
|
151 | 151 | return $mapped_file; |
152 | 152 | } |
153 | 153 | // remove the trailing namespace separator for the next iteration |
154 | 154 | // of strrpos() |
155 | - $prefix = rtrim( $prefix, Psr4Autoloader::NS ); |
|
155 | + $prefix = rtrim($prefix, Psr4Autoloader::NS); |
|
156 | 156 | } |
157 | 157 | // never found a mapped file |
158 | 158 | return false; |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | * @return mixed Boolean false if no mapped file can be loaded, or the |
169 | 169 | * name of the mapped file that was loaded. |
170 | 170 | */ |
171 | - protected function loadMappedFile( $prefix, $relative_class ) { |
|
171 | + protected function loadMappedFile($prefix, $relative_class) { |
|
172 | 172 | // look through base directories for this namespace prefix |
173 | - foreach ( $this->prefixes( $prefix ) as $base_dir ) { |
|
173 | + foreach ($this->prefixes($prefix) as $base_dir) { |
|
174 | 174 | // replace the namespace prefix with the base directory, |
175 | 175 | // replace namespace separators with directory separators |
176 | 176 | // in the relative class name, append with .php |
177 | 177 | $file = $base_dir |
178 | - . str_replace( Psr4Autoloader::NS, DS, $relative_class ) |
|
178 | + . str_replace(Psr4Autoloader::NS, DS, $relative_class) |
|
179 | 179 | . '.php'; |
180 | 180 | // if the mapped file exists, require it |
181 | - if ( $this->requireFile( $file ) ) { |
|
181 | + if ($this->requireFile($file)) { |
|
182 | 182 | // yes, we're done |
183 | 183 | return $file; |
184 | 184 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * @param string $file The file to require. |
196 | 196 | * @return bool True if the file exists, false if not. |
197 | 197 | */ |
198 | - protected function requireFile( $file ) { |
|
199 | - if ( file_exists( $file ) ) { |
|
198 | + protected function requireFile($file) { |
|
199 | + if (file_exists($file)) { |
|
200 | 200 | require $file; |
201 | 201 | return true; |
202 | 202 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\locators; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param array|string $location |
23 | 23 | * @return \FilesystemIterator |
24 | 24 | */ |
25 | - public function locate( $location ); |
|
25 | + public function locate($location); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | // End of file LocatorInterface.php |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | * base class for all strategies which operate on form inputs. Generally, they |
4 | 4 | * all need to know about the form input they are operating on. |
5 | 5 | */ |
6 | -abstract class EE_Form_Input_Strategy_Base{ |
|
6 | +abstract class EE_Form_Input_Strategy_Base { |
|
7 | 7 | /** |
8 | 8 | * Form Input to display |
9 | 9 | * @var EE_Form_Input_Base |
10 | 10 | */ |
11 | 11 | protected $_input; |
12 | 12 | |
13 | - function __construct(){ |
|
13 | + function __construct() { |
|
14 | 14 | |
15 | 15 | } |
16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * The form input on which this strategy is to perform |
19 | 19 | * @param EE_Form_Input_Base $form_input |
20 | 20 | */ |
21 | - function _construct_finalize(EE_Form_Input_Base $form_input){ |
|
21 | + function _construct_finalize(EE_Form_Input_Base $form_input) { |
|
22 | 22 | $this->_input = $form_input; |
23 | 23 | } |
24 | 24 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * @param bool $add_pound_sign |
28 | 28 | * @return string |
29 | 29 | */ |
30 | - public function get_sub_input_id( $option_value, $add_pound_sign = false ) { |
|
31 | - return $this->_append_chars( $this->_input->html_id( $add_pound_sign ), '-' ) . sanitize_key( $option_value ); |
|
30 | + public function get_sub_input_id($option_value, $add_pound_sign = false) { |
|
31 | + return $this->_append_chars($this->_input->html_id($add_pound_sign), '-').sanitize_key($option_value); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @return array |
41 | 41 | * @throws \EE_Error |
42 | 42 | */ |
43 | - public function get_html_input_ids( $add_pound_sign = false ) { |
|
43 | + public function get_html_input_ids($add_pound_sign = false) { |
|
44 | 44 | $html_input_ids = array(); |
45 | - foreach( $this->get_input()->options() as $value => $display ) { |
|
46 | - $html_input_ids[] = $this->get_sub_input_id( $value, $add_pound_sign ); |
|
45 | + foreach ($this->get_input()->options() as $value => $display) { |
|
46 | + $html_input_ids[] = $this->get_sub_input_id($value, $add_pound_sign); |
|
47 | 47 | } |
48 | 48 | return $html_input_ids; |
49 | 49 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @throws \EE_Error |
59 | 59 | */ |
60 | 60 | public function get_input() { |
61 | - if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base ){ |
|
61 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
62 | 62 | throw new EE_Error( |
63 | 63 | sprintf( |
64 | 64 | __( |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | * @param EE_Messages_Queue $queue |
26 | 26 | * @param string $custom_subject Used if a custom subject is desired for the generated aggregate EE_Message object |
27 | 27 | */ |
28 | - public function __construct( $messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '' ) { |
|
28 | + public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') { |
|
29 | 29 | $this->queue = $queue; |
30 | - parent::__construct( $messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle ); |
|
31 | - if ( $this->valid() ) { |
|
32 | - $this->_message->set_content( $this->_get_content() ); |
|
33 | - $this->_message->set_subject( $this->_get_subject( $custom_subject ) ); |
|
30 | + parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle); |
|
31 | + if ($this->valid()) { |
|
32 | + $this->_message->set_content($this->_get_content()); |
|
33 | + $this->_message->set_subject($this->_get_subject($custom_subject)); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | protected function _get_content() { |
45 | 45 | $content = ''; |
46 | 46 | $this->queue->get_message_repository()->rewind(); |
47 | - while ( $this->queue->get_message_repository()->valid() ) { |
|
47 | + while ($this->queue->get_message_repository()->valid()) { |
|
48 | 48 | $content .= $this->queue->get_message_repository()->current()->content(); |
49 | 49 | $this->queue->get_message_repository()->next(); |
50 | 50 | } |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - protected function _get_subject( $custom_subject = '' ) { |
|
62 | - if ( ! empty( $custom_subject ) ) { |
|
61 | + protected function _get_subject($custom_subject = '') { |
|
62 | + if ( ! empty($custom_subject)) { |
|
63 | 63 | return $custom_subject; |
64 | 64 | } |
65 | 65 | $this->queue->get_message_repository()->rewind(); |
66 | 66 | $count_of_items = $this->queue->get_message_repository()->count(); |
67 | 67 | |
68 | 68 | //if $count of items in queue == 1, then let's just return the subject for that item. |
69 | - if ( $count_of_items === 1 ) { |
|
69 | + if ($count_of_items === 1) { |
|
70 | 70 | return $this->queue->get_message_repository()->current()->subject(); |
71 | 71 | } |
72 | 72 |
@@ -458,8 +458,8 @@ discard block |
||
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 | 460 | if ( empty( $templates['to'][ $context ] ) |
461 | - && ! $this->_generation_queue->get_message_repository()->is_preview() |
|
462 | - && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
461 | + && ! $this->_generation_queue->get_message_repository()->is_preview() |
|
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 | } |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | * Check if there is any generation data, but only if this is not for a preview. |
576 | 576 | */ |
577 | 577 | if ( ! $this->_generation_queue->get_message_repository()->get_generation_data() |
578 | - && ( |
|
579 | - ! $this->_generation_queue->get_message_repository()->is_preview() |
|
580 | - && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
|
578 | + && ( |
|
579 | + ! $this->_generation_queue->get_message_repository()->is_preview() |
|
580 | + && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
|
581 | 581 | ) { |
582 | 582 | $this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' ); |
583 | 583 | } |
@@ -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,10 +116,10 @@ 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_message_repository()->rewind(); |
122 | - while ( $this->_generation_queue->get_message_repository()->valid() ) { |
|
122 | + while ($this->_generation_queue->get_message_repository()->valid()) { |
|
123 | 123 | //reset "current" properties |
124 | 124 | $this->_reset_current_properties(); |
125 | 125 | |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | $this->_generation_queue->get_message_repository()->next(); |
134 | 134 | $next_msg = $this->_generation_queue->get_message_repository()->current(); |
135 | 135 | //restore pointer to current item |
136 | - $this->_generation_queue->get_message_repository()->set_current( $msg ); |
|
136 | + $this->_generation_queue->get_message_repository()->set_current($msg); |
|
137 | 137 | |
138 | 138 | //skip and delete if the current $msg is NOT incomplete (queued for generation) |
139 | - if ( $msg->STS_ID() !== EEM_Message::status_incomplete ) { |
|
139 | + if ($msg->STS_ID() !== EEM_Message::status_incomplete) { |
|
140 | 140 | //we keep this item in the db just remove from the repo. |
141 | - $this->_generation_queue->get_message_repository()->remove( $msg ); |
|
141 | + $this->_generation_queue->get_message_repository()->remove($msg); |
|
142 | 142 | //next item |
143 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
143 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
147 | - if ( $this->_verify() ) { |
|
147 | + if ($this->_verify()) { |
|
148 | 148 | //let's get generating! |
149 | 149 | $this->_generate(); |
150 | 150 | } |
@@ -154,32 +154,32 @@ discard block |
||
154 | 154 | $msg->STS_ID() === EEM_Message::status_debug_only |
155 | 155 | && ! EEM_Message::debug() |
156 | 156 | ) { |
157 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
157 | + do_action('AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
158 | 158 | $this->_generation_queue->get_message_repository()->delete(); |
159 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
159 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | |
163 | 163 | //if there are error messages then let's set the status and the error message. |
164 | - if ( $this->_error_msg ) { |
|
164 | + if ($this->_error_msg) { |
|
165 | 165 | //if the status is already debug only, then let's leave it at that. |
166 | - if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) { |
|
167 | - $msg->set_STS_ID( EEM_Message::status_failed ); |
|
166 | + if ($msg->STS_ID() !== EEM_Message::status_debug_only) { |
|
167 | + $msg->set_STS_ID(EEM_Message::status_failed); |
|
168 | 168 | } |
169 | - do_action( 'AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
169 | + do_action('AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
170 | 170 | $msg->set_error_message( |
171 | - __( 'Message failed to generate for the following reasons: ' ) |
|
171 | + __('Message failed to generate for the following reasons: ') |
|
172 | 172 | . "\n" |
173 | - . implode( "\n", $this->_error_msg ) |
|
173 | + . implode("\n", $this->_error_msg) |
|
174 | 174 | ); |
175 | - $msg->set_modified( time() ); |
|
175 | + $msg->set_modified(time()); |
|
176 | 176 | } else { |
177 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
177 | + do_action('AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
178 | 178 | //remove from db |
179 | 179 | $this->_generation_queue->get_message_repository()->delete(); |
180 | 180 | } |
181 | 181 | //next item |
182 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
182 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | //generation queue is ALWAYS saved to record any errors in the generation process. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * so a EE_Extra_Meta entry could be created and attached to the EE_Message. In those cases the save flag is |
193 | 193 | * irrelevant. |
194 | 194 | */ |
195 | - if ( $save ) { |
|
195 | + if ($save) { |
|
196 | 196 | $this->_ready_queue->save(); |
197 | 197 | } |
198 | 198 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | protected function _reset_current_properties() { |
211 | 211 | $this->_verified = false; |
212 | 212 | //make sure any _data value in the current message type is reset |
213 | - if ( $this->_current_message_type instanceof EE_message_type ) { |
|
213 | + if ($this->_current_message_type instanceof EE_message_type) { |
|
214 | 214 | $this->_current_message_type->reset_data(); |
215 | 215 | } |
216 | 216 | $this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | protected function _generate() { |
231 | 231 | //double check verification has run and that everything is ready to work with (saves us having to validate everything again). |
232 | - if ( ! $this->_verified ) { |
|
232 | + if ( ! $this->_verified) { |
|
233 | 233 | return false; //get out because we don't have a valid setup to work with. |
234 | 234 | } |
235 | 235 | |
@@ -239,35 +239,35 @@ discard block |
||
239 | 239 | $this->_current_data_handler, |
240 | 240 | $this->_generation_queue->get_message_repository()->current()->context() |
241 | 241 | ); |
242 | - } catch ( EE_Error $e ) { |
|
242 | + } catch (EE_Error $e) { |
|
243 | 243 | $this->_error_msg[] = $e->getMessage(); |
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
247 | 247 | |
248 | 248 | //if no addressees then get out because there is nothing to generation (possible bad data). |
249 | - if ( ! $this->_valid_addressees( $addressees ) ) { |
|
250 | - do_action( 'AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
251 | - $this->_generation_queue->get_message_repository()->current()->set_STS_ID( EEM_Message::status_debug_only ); |
|
252 | - $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. |
|
253 | - 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' ); |
|
249 | + if ( ! $this->_valid_addressees($addressees)) { |
|
250 | + do_action('AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
251 | + $this->_generation_queue->get_message_repository()->current()->set_STS_ID(EEM_Message::status_debug_only); |
|
252 | + $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. |
|
253 | + 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'); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | |
257 | 257 | $message_template_group = $this->_get_message_template_group(); |
258 | 258 | |
259 | 259 | //in the unlikely event there is no EE_Message_Template_Group available, get out! |
260 | - if ( ! $message_template_group instanceof EE_Message_Template_Group ) { |
|
261 | - $this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso' ); |
|
260 | + if ( ! $message_template_group instanceof EE_Message_Template_Group) { |
|
261 | + $this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso'); |
|
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | 265 | //get formatted templates for using to parse and setup EE_Message objects. |
266 | - $templates = $this->_get_templates( $message_template_group ); |
|
266 | + $templates = $this->_get_templates($message_template_group); |
|
267 | 267 | |
268 | 268 | |
269 | 269 | //setup new EE_Message objects (and add to _ready_queue) |
270 | - return $this->_assemble_messages( $addressees, $templates, $message_template_group ); |
|
270 | + return $this->_assemble_messages($addressees, $templates, $message_template_group); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | //so let's use that. |
286 | 286 | $GRP_ID = $this->_generation_queue->get_message_repository()->current()->GRP_ID(); |
287 | 287 | |
288 | - if ( $GRP_ID ) { |
|
288 | + if ($GRP_ID) { |
|
289 | 289 | //attempt to retrieve from repo first |
290 | - $GRP = $this->_template_collection->get_by_ID( $GRP_ID ); |
|
291 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
292 | - return $GRP; //got it! |
|
290 | + $GRP = $this->_template_collection->get_by_ID($GRP_ID); |
|
291 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
292 | + return $GRP; //got it! |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | //nope don't have it yet. Get from DB then add to repo if its not here, then that means the current GRP_ID |
296 | 296 | //is not valid, so we'll continue on in the code assuming there's NO GRP_ID. |
297 | - $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
298 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
299 | - $this->_template_collection->add( $GRP ); |
|
297 | + $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
298 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
299 | + $this->_template_collection->add($GRP); |
|
300 | 300 | return $GRP; |
301 | 301 | } |
302 | 302 | } |
@@ -315,41 +315,41 @@ discard block |
||
315 | 315 | //in vanilla EE we're assuming there's only one event. |
316 | 316 | //However, if there are multiple events then we'll just use the default templates instead of different |
317 | 317 | // templates per event (which could create problems). |
318 | - if ( count( $this->_current_data_handler->events ) === 1 ) { |
|
319 | - foreach ( $this->_current_data_handler->events as $event ) { |
|
318 | + if (count($this->_current_data_handler->events) === 1) { |
|
319 | + foreach ($this->_current_data_handler->events as $event) { |
|
320 | 320 | $EVT_ID = $event['ID']; |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | //before going any further, let's see if its in the queue |
325 | - $GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) ); |
|
325 | + $GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID)); |
|
326 | 326 | |
327 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
327 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
328 | 328 | return $GRP; |
329 | 329 | } |
330 | 330 | |
331 | 331 | //nope still no GRP? |
332 | 332 | //first we get the global template in case it has an override set. |
333 | - $global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa ); |
|
334 | - $global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) ); |
|
333 | + $global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa); |
|
334 | + $global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa)); |
|
335 | 335 | |
336 | 336 | //if this is an override, then we just return it. |
337 | - if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) { |
|
338 | - $this->_template_collection->add( $global_GRP, $EVT_ID ); |
|
337 | + if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) { |
|
338 | + $this->_template_collection->add($global_GRP, $EVT_ID); |
|
339 | 339 | return $global_GRP; |
340 | 340 | } |
341 | 341 | |
342 | 342 | //STILL here? Okay that means we want to see if there is event specific group and if there is we return it, |
343 | 343 | //otherwise we return the global group we retrieved. |
344 | - if ( $EVT_ID ) { |
|
344 | + if ($EVT_ID) { |
|
345 | 345 | $template_qa['Event.EVT_ID'] = $EVT_ID; |
346 | 346 | } |
347 | 347 | |
348 | - $GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
348 | + $GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
349 | 349 | $GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP; |
350 | 350 | |
351 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
352 | - $this->_template_collection->add( $GRP, $EVT_ID ); |
|
351 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
352 | + $this->_template_collection->add($GRP, $EVT_ID); |
|
353 | 353 | return $GRP; |
354 | 354 | } |
355 | 355 | |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | * ) |
374 | 374 | * ) |
375 | 375 | */ |
376 | - protected function _get_templates( EE_Message_Template_Group $message_template_group ) { |
|
376 | + protected function _get_templates(EE_Message_Template_Group $message_template_group) { |
|
377 | 377 | $templates = array(); |
378 | 378 | $context_templates = $message_template_group->context_templates(); |
379 | - foreach ( $context_templates as $context => $template_fields ) { |
|
380 | - foreach ( $template_fields as $template_field => $template_obj ) { |
|
381 | - if ( ! $template_obj instanceof EE_Message_Template ) { |
|
379 | + foreach ($context_templates as $context => $template_fields) { |
|
380 | + foreach ($template_fields as $template_field => $template_obj) { |
|
381 | + if ( ! $template_obj instanceof EE_Message_Template) { |
|
382 | 382 | continue; |
383 | 383 | } |
384 | - $templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' ); |
|
384 | + $templates[$template_field][$context] = $template_obj->get('MTP_content'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | return $templates; |
@@ -403,21 +403,21 @@ discard block |
||
403 | 403 | * get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added |
404 | 404 | * to the queue as EEM_Message::status_failed. Very rarely should "false" be returned from this method. |
405 | 405 | */ |
406 | - protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) { |
|
406 | + protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) { |
|
407 | 407 | |
408 | 408 | //if templates are empty then get out because we can't generate anything. |
409 | - if ( ! $templates ) { |
|
410 | - $this->_error_msg[] = __( 'Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso' ); |
|
409 | + if ( ! $templates) { |
|
410 | + $this->_error_msg[] = __('Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso'); |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
414 | 414 | //We use this as the counter for generated messages because don't forget we may be executing this inside of a |
415 | 415 | //generation_queue. So _ready_queue may have generated EE_Message objects already. |
416 | 416 | $generated_count = 0; |
417 | - foreach ( $addressees as $context => $recipients ) { |
|
418 | - foreach ( $recipients as $recipient ) { |
|
419 | - $message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group ); |
|
420 | - if ( $message instanceof EE_Message ) { |
|
417 | + foreach ($addressees as $context => $recipients) { |
|
418 | + foreach ($recipients as $recipient) { |
|
419 | + $message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group); |
|
420 | + if ($message instanceof EE_Message) { |
|
421 | 421 | $this->_ready_queue->add( |
422 | 422 | $message, |
423 | 423 | array(), |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | //if the current MSG being generated is for a test send then we'll only use ONE message in the generation. |
431 | - if ( $this->_generation_queue->get_message_repository()->is_test_send() ) { |
|
431 | + if ($this->_generation_queue->get_message_repository()->is_test_send()) { |
|
432 | 432 | break 2; |
433 | 433 | } |
434 | 434 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | ) { |
458 | 458 | //stuff we already know |
459 | 459 | $transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0; |
460 | - $transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
460 | + $transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
461 | 461 | ? $this->_current_data_handler->txn->ID() |
462 | 462 | : $transaction_id; |
463 | 463 | $message_fields = array( |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | //recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the |
472 | 472 | //info from the att_obj found in the EE_Messages_Addressee object. |
473 | - if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) { |
|
473 | + if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) { |
|
474 | 474 | $message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee |
475 | 475 | ? $recipient->att_obj->ID() |
476 | 476 | : 0; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $message_fields['MSG_recipient_ID'] = $recipient->recipient_id; |
480 | 480 | $message_fields['MSG_recipient_type'] = $recipient->recipient_type; |
481 | 481 | } |
482 | - $message = EE_Message_Factory::create( $message_fields ); |
|
482 | + $message = EE_Message_Factory::create($message_fields); |
|
483 | 483 | |
484 | 484 | //grab valid shortcodes for shortcode parser |
485 | 485 | $mt_shortcodes = $this->_current_message_type->get_valid_shortcodes(); |
@@ -487,43 +487,43 @@ discard block |
||
487 | 487 | |
488 | 488 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this |
489 | 489 | //context is turned off) EXCEPT if we're previewing |
490 | - if ( empty( $templates['to'][ $context ] ) |
|
490 | + if (empty($templates['to'][$context]) |
|
491 | 491 | && ! $this->_generation_queue->get_message_repository()->is_preview() |
492 | - && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
492 | + && ! $this->_current_messenger->allow_empty_to_field()) { |
|
493 | 493 | //we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field. |
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | $error_msg = array(); |
497 | - foreach ( $templates as $field => $field_context ) { |
|
497 | + foreach ($templates as $field => $field_context) { |
|
498 | 498 | $error_msg = array(); |
499 | 499 | //let's setup the valid shortcodes for the incoming context. |
500 | - $valid_shortcodes = $mt_shortcodes[ $context ]; |
|
500 | + $valid_shortcodes = $mt_shortcodes[$context]; |
|
501 | 501 | //merge in valid shortcodes for the field. |
502 | - $shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes; |
|
503 | - if ( isset( $templates[ $field ][ $context ] ) ) { |
|
502 | + $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
|
503 | + if (isset($templates[$field][$context])) { |
|
504 | 504 | //prefix field. |
505 | - $column_name = 'MSG_' . $field; |
|
505 | + $column_name = 'MSG_'.$field; |
|
506 | 506 | try { |
507 | 507 | $content = $this->_shortcode_parser->parse_message_template( |
508 | - $templates[ $field ][ $context ], |
|
508 | + $templates[$field][$context], |
|
509 | 509 | $recipient, |
510 | 510 | $shortcodes, |
511 | 511 | $this->_current_message_type, |
512 | 512 | $this->_current_messenger, |
513 | 513 | $message ); |
514 | - $message->set_field_or_extra_meta( $column_name, $content ); |
|
515 | - } catch ( EE_Error $e ) { |
|
516 | - $error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() ); |
|
517 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
514 | + $message->set_field_or_extra_meta($column_name, $content); |
|
515 | + } catch (EE_Error $e) { |
|
516 | + $error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage()); |
|
517 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
522 | - if ( $message->STS_ID() === EEM_Message::status_failed ) { |
|
523 | - $error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg ); |
|
524 | - $message->set_error_message( $error_msg ); |
|
522 | + if ($message->STS_ID() === EEM_Message::status_failed) { |
|
523 | + $error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg); |
|
524 | + $message->set_error_message($error_msg); |
|
525 | 525 | } else { |
526 | - $message->set_STS_ID( EEM_Message::status_idle ); |
|
526 | + $message->set_STS_ID(EEM_Message::status_idle); |
|
527 | 527 | } |
528 | 528 | return $message; |
529 | 529 | } |
@@ -557,14 +557,14 @@ discard block |
||
557 | 557 | * @param array $addressees Keys correspond to contexts for the message type and values are EE_Messages_Addressee[] |
558 | 558 | * @return bool |
559 | 559 | */ |
560 | - protected function _valid_addressees( $addressees ) { |
|
561 | - if ( ! $addressees || ! is_array( $addressees ) ) { |
|
560 | + protected function _valid_addressees($addressees) { |
|
561 | + if ( ! $addressees || ! is_array($addressees)) { |
|
562 | 562 | return false; |
563 | 563 | } |
564 | 564 | |
565 | - foreach ( $addressees as $addressee_array ) { |
|
566 | - foreach ( $addressee_array as $addressee ) { |
|
567 | - if ( ! $addressee instanceof EE_Messages_Addressee ) { |
|
565 | + foreach ($addressees as $addressee_array) { |
|
566 | + foreach ($addressee_array as $addressee) { |
|
567 | + if ( ! $addressee instanceof EE_Messages_Addressee) { |
|
568 | 568 | return false; |
569 | 569 | } |
570 | 570 | } |
@@ -585,19 +585,19 @@ discard block |
||
585 | 585 | protected function _validate_messenger_and_message_type() { |
586 | 586 | |
587 | 587 | //first are there any existing error messages? If so then return. |
588 | - if ( $this->_error_msg ) { |
|
588 | + if ($this->_error_msg) { |
|
589 | 589 | return false; |
590 | 590 | } |
591 | 591 | /** @type EE_Message $message */ |
592 | 592 | $message = $this->_generation_queue->get_message_repository()->current(); |
593 | 593 | try { |
594 | - $this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null; |
|
595 | - } catch ( Exception $e ) { |
|
594 | + $this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null; |
|
595 | + } catch (Exception $e) { |
|
596 | 596 | $this->_error_msg[] = $e->getMessage(); |
597 | 597 | } |
598 | 598 | try { |
599 | - $this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null; |
|
600 | - } catch ( Exception $e ) { |
|
599 | + $this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null; |
|
600 | + } catch (Exception $e) { |
|
601 | 601 | $this->_error_msg[] = $e->getMessage(); |
602 | 602 | } |
603 | 603 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | ! $this->_generation_queue->get_message_repository()->is_preview() |
610 | 610 | && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
611 | 611 | ) { |
612 | - $this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' ); |
|
612 | + $this->_error_msg[] = __('There is no generation data for this message. Unable to generate.'); |
|
613 | 613 | } |
614 | 614 | |
615 | - return empty( $this->_error_msg ); |
|
615 | + return empty($this->_error_msg); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | //First, are there any existing error messages? If so, return because if there were errors elsewhere this can't |
631 | 631 | //be used anyways. |
632 | - if ( $this->_error_msg ) { |
|
632 | + if ($this->_error_msg) { |
|
633 | 633 | return false; |
634 | 634 | } |
635 | 635 | |
@@ -638,29 +638,29 @@ discard block |
||
638 | 638 | /** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */ |
639 | 639 | $data_handler_class_name = $this->_generation_queue->get_message_repository()->get_data_handler() |
640 | 640 | ? $this->_generation_queue->get_message_repository()->get_data_handler() |
641 | - : 'EE_Messages_' . $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data'; |
|
641 | + : 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data'; |
|
642 | 642 | |
643 | 643 | //If this EE_Message is for a preview, then let's switch out to the preview data handler. |
644 | - if ( $this->_generation_queue->get_message_repository()->is_preview() ) { |
|
645 | - $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
644 | + if ($this->_generation_queue->get_message_repository()->is_preview()) { |
|
645 | + $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | //First get the class name for the data handler (and also verifies it exists. |
649 | - if ( ! class_exists( $data_handler_class_name ) ) { |
|
649 | + if ( ! class_exists($data_handler_class_name)) { |
|
650 | 650 | $this->_error_msg[] = sprintf( |
651 | - __( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso' ), |
|
651 | + __('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso'), |
|
652 | 652 | $data_handler_class_name |
653 | 653 | ); |
654 | 654 | return false; |
655 | 655 | } |
656 | 656 | |
657 | 657 | //convert generation_data for data_handler_instantiation. |
658 | - $generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data ); |
|
658 | + $generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data); |
|
659 | 659 | |
660 | 660 | //note, this may set error messages as well. |
661 | - $this->_set_data_handler( $generation_data, $data_handler_class_name ); |
|
661 | + $this->_set_data_handler($generation_data, $data_handler_class_name); |
|
662 | 662 | |
663 | - return empty( $this->_error_msg ); |
|
663 | + return empty($this->_error_msg); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | |
@@ -677,16 +677,16 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @return void. |
679 | 679 | */ |
680 | - protected function _set_data_handler( $generating_data, $data_handler_class_name ) { |
|
680 | + protected function _set_data_handler($generating_data, $data_handler_class_name) { |
|
681 | 681 | //valid classname for the data handler. Now let's setup the key for the data handler repository to see if there |
682 | 682 | //is already a ready data handler in the repository. |
683 | - $this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) ); |
|
684 | - if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data ) { |
|
683 | + $this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data)); |
|
684 | + if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data) { |
|
685 | 685 | //no saved data_handler in the repo so let's set one up and add it to the repo. |
686 | 686 | try { |
687 | - $this->_current_data_handler = new $data_handler_class_name( $generating_data ); |
|
688 | - $this->_data_handler_collection->add( $this->_current_data_handler, $generating_data ); |
|
689 | - } catch( EE_Error $e ) { |
|
687 | + $this->_current_data_handler = new $data_handler_class_name($generating_data); |
|
688 | + $this->_data_handler_collection->add($this->_current_data_handler, $generating_data); |
|
689 | + } catch (EE_Error $e) { |
|
690 | 690 | $this->_error_msg[] = $e->get_error(); |
691 | 691 | } |
692 | 692 | } |
@@ -706,13 +706,13 @@ discard block |
||
706 | 706 | * @param bool $preview Indicate whether this is being used for a preview or not. |
707 | 707 | * @return mixed Prepped data for persisting to the queue. false is returned if unable to prep data. |
708 | 708 | */ |
709 | - protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) { |
|
709 | + protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) { |
|
710 | 710 | /** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */ |
711 | - $data_handler = $message_to_generate->get_data_handler_class_name( $preview ); |
|
712 | - if ( ! $message_to_generate->valid() ) { |
|
711 | + $data_handler = $message_to_generate->get_data_handler_class_name($preview); |
|
712 | + if ( ! $message_to_generate->valid()) { |
|
713 | 713 | return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid. |
714 | 714 | } |
715 | - return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() ); |
|
715 | + return $data_handler::convert_data_for_persistent_storage($message_to_generate->data()); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | |
@@ -725,26 +725,26 @@ discard block |
||
725 | 725 | * @param EE_Message_To_Generate $message_to_generate |
726 | 726 | * @param bool $test_send Whether this is just a test send or not. Typically used for previews. |
727 | 727 | */ |
728 | - public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) { |
|
728 | + public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) { |
|
729 | 729 | //prep data |
730 | - $data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() ); |
|
730 | + $data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview()); |
|
731 | 731 | |
732 | 732 | $message = $message_to_generate->get_EE_Message(); |
733 | 733 | |
734 | 734 | //is there a GRP_ID in the request? |
735 | - if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) { |
|
736 | - $message->set_GRP_ID( $GRP_ID ); |
|
735 | + if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) { |
|
736 | + $message->set_GRP_ID($GRP_ID); |
|
737 | 737 | } |
738 | 738 | |
739 | - if ( $data === false ) { |
|
740 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
741 | - $message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) ); |
|
739 | + if ($data === false) { |
|
740 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
741 | + $message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso')); |
|
742 | 742 | } else { |
743 | 743 | //make sure that the data handler is cached on the message as well |
744 | 744 | $data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name(); |
745 | 745 | } |
746 | 746 | |
747 | - $this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send ); |
|
747 | + $this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * This is the template for the "Number Bubbles" Progress Steps |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | <!-- progress step display --> |
15 | 15 | <div class="ee-progress-step-main-container"> |
16 | 16 | <div class="progress-step-container number-bubbles-container"> |
17 | - <?php foreach ( $progress_steps as $progress_step ) : ?> |
|
18 | - <div data-step-nmbr="<?php echo $progress_step->order();?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
17 | + <?php foreach ($progress_steps as $progress_step) : ?> |
|
18 | + <div data-step-nmbr="<?php echo $progress_step->order(); ?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
19 | 19 | <div class="progress-step-line"></div> |
20 | 20 | <div class="progress-step-bubble"><p><?php echo $progress_step->order(); ?></p></div> |
21 | 21 | <span class="progress-step-text"><?php echo $progress_step->text(); ?></span> |
22 | 22 | </div> |
23 | - <?php endforeach;?> |
|
23 | + <?php endforeach; ?> |
|
24 | 24 | </div> |
25 | 25 | </div> |
26 | 26 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -abstract class EE_Display_Strategy_Base extends EE_Form_Input_Strategy_Base{ |
|
11 | +abstract class EE_Display_Strategy_Base extends EE_Form_Input_Strategy_Base { |
|
12 | 12 | /** |
13 | 13 | * returns HTML and javascript related to the displaying of this input |
14 | 14 | * @return string |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | * @param string $chars - exact string of characters to remove |
25 | 25 | * @return string |
26 | 26 | */ |
27 | - protected function _remove_chars( $string = '', $chars = '-' ) { |
|
28 | - $char_length = strlen( $chars ) * -1; |
|
27 | + protected function _remove_chars($string = '', $chars = '-') { |
|
28 | + $char_length = strlen($chars) * -1; |
|
29 | 29 | // if last three characters of string is " - ", then remove it |
30 | - return substr( $string, $char_length ) === $chars ? substr( $string, 0, $char_length ) : $string; |
|
30 | + return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | * @param string $chars - exact string of characters to be added to end of string |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - protected function _append_chars( $string = '', $chars = '-' ) { |
|
43 | - return $this->_remove_chars( $string, $chars ) . $chars; |
|
42 | + protected function _append_chars($string = '', $chars = '-') { |
|
43 | + return $this->_remove_chars($string, $chars).$chars; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Gets the HTML IDs of all the inputs |
48 | 48 | * @return array |
49 | 49 | */ |
50 | - public function get_html_input_ids( $add_pound_sign = false ) { |
|
51 | - return array( $this->get_input()->html_id( $add_pound_sign ) ); |
|
50 | + public function get_html_input_ids($add_pound_sign = false) { |
|
51 | + return array($this->get_input()->html_id($add_pound_sign)); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param array $other_js_data |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - public function get_other_js_data( $other_js_data = array() ) { |
|
63 | + public function get_other_js_data($other_js_data = array()) { |
|
64 | 64 | return $other_js_data; |
65 | 65 | } |
66 | 66 |
@@ -6,20 +6,20 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Hidden_Input extends EE_Form_Input_Base{ |
|
9 | +class EE_Hidden_Input extends EE_Form_Input_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $input_settings |
13 | 13 | */ |
14 | - public function __construct($input_settings = array()){ |
|
14 | + public function __construct($input_settings = array()) { |
|
15 | 15 | //require_once('strategies/display_strategies/EE_Text_Input_Display_Strategy.strategy.php'); |
16 | 16 | $this->_set_display_strategy(new EE_Hidden_Display_Strategy()); |
17 | - if ( isset( $input_settings['normalization_strategy'] ) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base ) { |
|
18 | - $this->_set_normalization_strategy( $input_settings['normalization_strategy'] ); |
|
17 | + if (isset($input_settings['normalization_strategy']) && $input_settings['normalization_strategy'] instanceof EE_Normalization_Strategy_Base) { |
|
18 | + $this->_set_normalization_strategy($input_settings['normalization_strategy']); |
|
19 | 19 | } else { |
20 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
20 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
21 | 21 | } |
22 | - parent::__construct( $input_settings ); |
|
22 | + parent::__construct($input_settings); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 |