@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | // add generic non-identifying messages for non-privileged users |
119 | 119 | if ( ! WP_DEBUG ) { |
120 | 120 | $output .= '<span class="ee-error-user-msg-spn">' |
121 | - . trim( $msg ) |
|
122 | - . '</span> <sup>' |
|
123 | - . $code |
|
124 | - . '</sup><br />'; |
|
121 | + . trim( $msg ) |
|
122 | + . '</span> <sup>' |
|
123 | + . $code |
|
124 | + . '</sup><br />'; |
|
125 | 125 | } else { |
126 | 126 | // or helpful developer messages if debugging is on |
127 | 127 | $output .= ' |
@@ -130,39 +130,39 @@ discard block |
||
130 | 130 | ' |
131 | 131 | . sprintf( |
132 | 132 | __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ), |
133 | - '<strong class="ee-error-dev-msg-str">', |
|
133 | + '<strong class="ee-error-dev-msg-str">', |
|
134 | 134 | get_class( $exception ), |
135 | 135 | '</strong> <span>', |
136 | 136 | $code . '</span>' |
137 | 137 | ) |
138 | 138 | . '<br /> |
139 | 139 | <span class="big-text">"' |
140 | - . trim( $msg ) |
|
141 | - . '"</span><br/> |
|
140 | + . trim( $msg ) |
|
141 | + . '"</span><br/> |
|
142 | 142 | <a id="display-ee-error-trace-1' |
143 | - . $time |
|
144 | - . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1' |
|
145 | - . $time |
|
146 | - . '"> |
|
143 | + . $time |
|
144 | + . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1' |
|
145 | + . $time |
|
146 | + . '"> |
|
147 | 147 | ' |
148 | - . __( 'click to view backtrace and class/method details', 'event_espresso' ) |
|
149 | - . ' |
|
148 | + . __( 'click to view backtrace and class/method details', 'event_espresso' ) |
|
149 | + . ' |
|
150 | 150 | </a><br /> |
151 | 151 | ' |
152 | - . $exception->getFile() |
|
153 | - . sprintf( |
|
154 | - __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ), |
|
155 | - ' <span class="small-text lt-grey-text">', |
|
156 | - $exception->getLine(), |
|
157 | - '</span>' |
|
158 | - ) |
|
159 | - . ' |
|
152 | + . $exception->getFile() |
|
153 | + . sprintf( |
|
154 | + __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ), |
|
155 | + ' <span class="small-text lt-grey-text">', |
|
156 | + $exception->getLine(), |
|
157 | + '</span>' |
|
158 | + ) |
|
159 | + . ' |
|
160 | 160 | </p> |
161 | 161 | <div id="ee-error-trace-1' |
162 | - . $time |
|
163 | - . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
162 | + . $time |
|
163 | + . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
164 | 164 | ' |
165 | - . $trace_details; |
|
165 | + . $trace_details; |
|
166 | 166 | if ( ! empty( $class ) ) { |
167 | 167 | $output .= ' |
168 | 168 | <div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;"> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\exceptions; |
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,9 +22,9 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param \Exception $exception |
24 | 24 | */ |
25 | - public function __construct( \Exception $exception ) { |
|
26 | - if ( WP_DEBUG ) { |
|
27 | - $this->displayException( $exception ); |
|
25 | + public function __construct(\Exception $exception) { |
|
26 | + if (WP_DEBUG) { |
|
27 | + $this->displayException($exception); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
@@ -34,27 +34,27 @@ discard block |
||
34 | 34 | * @access protected |
35 | 35 | * @param \Exception $exception |
36 | 36 | */ |
37 | - protected function displayException( \Exception $exception ) { |
|
37 | + protected function displayException(\Exception $exception) { |
|
38 | 38 | |
39 | 39 | $error_code = ''; |
40 | 40 | $trace_details = ''; |
41 | 41 | $time = time(); |
42 | 42 | $trace = $exception->getTrace(); |
43 | 43 | // get separate user and developer messages if they exist |
44 | - $msg = explode( '||', $exception->getMessage() ); |
|
44 | + $msg = explode('||', $exception->getMessage()); |
|
45 | 45 | $user_msg = $msg[0]; |
46 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
46 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
47 | 47 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
48 | 48 | // start gathering output |
49 | 49 | $output = $this->exceptionStyles(); |
50 | 50 | $output .= ' |
51 | 51 | <div id="ee-error-message" class="error">'; |
52 | - if ( ! WP_DEBUG ) { |
|
52 | + if ( ! WP_DEBUG) { |
|
53 | 53 | $output .= ' |
54 | 54 | <p>'; |
55 | 55 | } |
56 | 56 | // process trace info |
57 | - if ( empty( $trace ) ) { |
|
57 | + if (empty($trace)) { |
|
58 | 58 | $trace_details .= __( |
59 | 59 | 'Sorry, but no trace information was available for this exception.', |
60 | 60 | 'event_espresso' |
@@ -67,47 +67,47 @@ discard block |
||
67 | 67 | <th scope="col" align="right" style="width:2.5%;">#</th> |
68 | 68 | <th scope="col" align="right" style="width:3.5%;">Line</th> |
69 | 69 | <th scope="col" align="left" style="width:40%;">File</th> |
70 | - <th scope="col" align="left">' . __( 'Class', 'event_espresso' ) . '->' . __( 'Method( arguments )', 'event_espresso' ) . '</th> |
|
70 | + <th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__('Method( arguments )', 'event_espresso').'</th> |
|
71 | 71 | </tr>'; |
72 | - $last_on_stack = count( $trace ) - 1; |
|
72 | + $last_on_stack = count($trace) - 1; |
|
73 | 73 | // reverse array so that stack is in proper chronological order |
74 | - $sorted_trace = array_reverse( $trace ); |
|
75 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
76 | - $file = isset( $trace['file'] ) ? $trace['file'] : ''; |
|
77 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
78 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
79 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
80 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
81 | - $args = isset( $trace['args'] ) && count( $trace['args'] ) > 4 ? ' <br />' . $args . '<br />' : $args; |
|
82 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
74 | + $sorted_trace = array_reverse($trace); |
|
75 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
76 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
77 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
78 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
79 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
80 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
81 | + $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />' : $args; |
|
82 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
83 | 83 | $zebra = $nmbr % 2 !== 0 ? ' odd' : ''; |
84 | - if ( empty( $file ) && ! empty( $class ) ) { |
|
85 | - $a = new \ReflectionClass( $class ); |
|
84 | + if (empty($file) && ! empty($class)) { |
|
85 | + $a = new \ReflectionClass($class); |
|
86 | 86 | $file = $a->getFileName(); |
87 | - if ( empty( $line ) && ! empty( $function ) ) { |
|
88 | - $b = new \ReflectionMethod( $class, $function ); |
|
87 | + if (empty($line) && ! empty($function)) { |
|
88 | + $b = new \ReflectionMethod($class, $function); |
|
89 | 89 | $line = $b->getStartLine(); |
90 | 90 | } |
91 | 91 | } |
92 | - if ( $nmbr === $last_on_stack ) { |
|
92 | + if ($nmbr === $last_on_stack) { |
|
93 | 93 | $file = $exception->getFile() !== '' ? $exception->getFile() : $file; |
94 | 94 | $line = $exception->getLine() !== '' ? $exception->getLine() : $line; |
95 | - $error_code = $this->generate_error_code( $file, $trace['function'], $line ); |
|
95 | + $error_code = $this->generate_error_code($file, $trace['function'], $line); |
|
96 | 96 | } |
97 | - $file = \EEH_File::standardise_directory_separators( $file ); |
|
98 | - $nmbr = ! empty( $nmbr ) ? $nmbr : ' '; |
|
99 | - $line = ! empty( $line ) ? $line : ' '; |
|
100 | - $file = ! empty( $file ) ? $file : ' '; |
|
101 | - $class_display = ! empty( $class ) ? $class : ''; |
|
102 | - $type = ! empty( $type ) ? $type : ''; |
|
103 | - $function = ! empty( $function ) ? $function : ''; |
|
104 | - $args = ! empty( $args ) ? '( ' . $args . ' )' : '()'; |
|
97 | + $file = \EEH_File::standardise_directory_separators($file); |
|
98 | + $nmbr = ! empty($nmbr) ? $nmbr : ' '; |
|
99 | + $line = ! empty($line) ? $line : ' '; |
|
100 | + $file = ! empty($file) ? $file : ' '; |
|
101 | + $class_display = ! empty($class) ? $class : ''; |
|
102 | + $type = ! empty($type) ? $type : ''; |
|
103 | + $function = ! empty($function) ? $function : ''; |
|
104 | + $args = ! empty($args) ? '( '.$args.' )' : '()'; |
|
105 | 105 | $trace_details .= ' |
106 | 106 | <tr> |
107 | - <td align="right" valign="top" class="' . $zebra . '">' . $nmbr . '</td> |
|
108 | - <td align="right" valign="top" class="' . $zebra . '">' . $line . '</td> |
|
109 | - <td align="left" valign="top" class="' . $zebra . '">' . $file . '</td> |
|
110 | - <td align="left" valign="top" class="' . $zebra . '">' . $class_display . $type . $function . $args . '</td> |
|
107 | + <td align="right" valign="top" class="' . $zebra.'">'.$nmbr.'</td> |
|
108 | + <td align="right" valign="top" class="' . $zebra.'">'.$line.'</td> |
|
109 | + <td align="left" valign="top" class="' . $zebra.'">'.$file.'</td> |
|
110 | + <td align="left" valign="top" class="' . $zebra.'">'.$class_display.$type.$function.$args.'</td> |
|
111 | 111 | </tr>'; |
112 | 112 | } |
113 | 113 | $trace_details .= ' |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | } |
117 | 117 | $code = $exception->getCode() ? $exception->getCode() : $error_code; |
118 | 118 | // add generic non-identifying messages for non-privileged users |
119 | - if ( ! WP_DEBUG ) { |
|
119 | + if ( ! WP_DEBUG) { |
|
120 | 120 | $output .= '<span class="ee-error-user-msg-spn">' |
121 | - . trim( $msg ) |
|
121 | + . trim($msg) |
|
122 | 122 | . '</span> <sup>' |
123 | 123 | . $code |
124 | 124 | . '</sup><br />'; |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | <p class="ee-error-dev-msg-pg"> |
130 | 130 | ' |
131 | 131 | . sprintf( |
132 | - __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ), |
|
132 | + __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'), |
|
133 | 133 | '<strong class="ee-error-dev-msg-str">', |
134 | - get_class( $exception ), |
|
134 | + get_class($exception), |
|
135 | 135 | '</strong> <span>', |
136 | - $code . '</span>' |
|
136 | + $code.'</span>' |
|
137 | 137 | ) |
138 | 138 | . '<br /> |
139 | 139 | <span class="big-text">"' |
140 | - . trim( $msg ) |
|
140 | + . trim($msg) |
|
141 | 141 | . '"</span><br/> |
142 | 142 | <a id="display-ee-error-trace-1' |
143 | 143 | . $time |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | . $time |
146 | 146 | . '"> |
147 | 147 | ' |
148 | - . __( 'click to view backtrace and class/method details', 'event_espresso' ) |
|
148 | + . __('click to view backtrace and class/method details', 'event_espresso') |
|
149 | 149 | . ' |
150 | 150 | </a><br /> |
151 | 151 | ' |
152 | 152 | . $exception->getFile() |
153 | 153 | . sprintf( |
154 | - __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ), |
|
154 | + __('%1$s( line no: %2$s )%3$s', 'event_espresso'), |
|
155 | 155 | ' <span class="small-text lt-grey-text">', |
156 | 156 | $exception->getLine(), |
157 | 157 | '</span>' |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | . '-dv" class="ee-error-trace-dv" style="display: none;"> |
164 | 164 | ' |
165 | 165 | . $trace_details; |
166 | - if ( ! empty( $class ) ) { |
|
166 | + if ( ! empty($class)) { |
|
167 | 167 | $output .= ' |
168 | 168 | <div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;"> |
169 | 169 | <div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;"> |
170 | - <h3>' . __( 'Class Details', 'event_espresso' ) . '</h3>'; |
|
171 | - $a = new \ReflectionClass( $class ); |
|
170 | + <h3>' . __('Class Details', 'event_espresso').'</h3>'; |
|
171 | + $a = new \ReflectionClass($class); |
|
172 | 172 | $output .= ' |
173 | - <pre>' . $a . '</pre> |
|
173 | + <pre>' . $a.'</pre> |
|
174 | 174 | </div> |
175 | 175 | </div>'; |
176 | 176 | } |
@@ -180,16 +180,16 @@ discard block |
||
180 | 180 | <br />'; |
181 | 181 | } |
182 | 182 | // remove last linebreak |
183 | - $output = substr( $output, 0, count( $output ) - 7 ); |
|
184 | - if ( ! WP_DEBUG ) { |
|
183 | + $output = substr($output, 0, count($output) - 7); |
|
184 | + if ( ! WP_DEBUG) { |
|
185 | 185 | $output .= ' |
186 | 186 | </p>'; |
187 | 187 | } |
188 | 188 | $output .= ' |
189 | 189 | </div>'; |
190 | - $output .= $this->printScripts( true ); |
|
191 | - if ( defined( 'DOING_AJAX' ) ) { |
|
192 | - echo wp_json_encode( array( 'error' => $output ) ); |
|
190 | + $output .= $this->printScripts(true); |
|
191 | + if (defined('DOING_AJAX')) { |
|
192 | + echo wp_json_encode(array('error' => $output)); |
|
193 | 193 | exit(); |
194 | 194 | } |
195 | 195 | echo $output; |
@@ -206,56 +206,56 @@ discard block |
||
206 | 206 | * @param bool $array |
207 | 207 | * @return string |
208 | 208 | */ |
209 | - private function _convert_args_to_string( $arguments = array(), $indent = 0, $array = false ) { |
|
209 | + private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false) { |
|
210 | 210 | $args = array(); |
211 | - $args_count = count( $arguments ); |
|
212 | - if ( $args_count > 2 ) { |
|
211 | + $args_count = count($arguments); |
|
212 | + if ($args_count > 2) { |
|
213 | 213 | $indent++; |
214 | 214 | $args[] = '<br />'; |
215 | 215 | } |
216 | 216 | $x = 0; |
217 | - foreach ( $arguments as $arg ) { |
|
217 | + foreach ($arguments as $arg) { |
|
218 | 218 | $x++; |
219 | - for( $i = 0; $i < $indent; $i++ ) { |
|
219 | + for ($i = 0; $i < $indent; $i++) { |
|
220 | 220 | $args[] = ' '; |
221 | 221 | } |
222 | - if ( is_string( $arg ) ) { |
|
223 | - if ( ! $array && strlen( $arg ) > 75 ) { |
|
222 | + if (is_string($arg)) { |
|
223 | + if ( ! $array && strlen($arg) > 75) { |
|
224 | 224 | $args[] = "<br />"; |
225 | - for ( $i = 0; $i <= $indent; $i++ ) { |
|
225 | + for ($i = 0; $i <= $indent; $i++) { |
|
226 | 226 | $args[] = ' '; |
227 | 227 | } |
228 | - $args[] = "'" . $arg . "'<br />"; |
|
228 | + $args[] = "'".$arg."'<br />"; |
|
229 | 229 | } else { |
230 | - $args[] = " '" . $arg . "'"; |
|
230 | + $args[] = " '".$arg."'"; |
|
231 | 231 | } |
232 | - } elseif ( is_array( $arg ) ) { |
|
233 | - $arg_count = count( $arg ); |
|
234 | - if ( $arg_count > 2 ) { |
|
232 | + } elseif (is_array($arg)) { |
|
233 | + $arg_count = count($arg); |
|
234 | + if ($arg_count > 2) { |
|
235 | 235 | $indent++; |
236 | - $args[] = " array(" . $this->_convert_args_to_string( $arg, $indent, true ) . ")"; |
|
236 | + $args[] = " array(".$this->_convert_args_to_string($arg, $indent, true).")"; |
|
237 | 237 | $indent--; |
238 | - } else if ( $arg_count === 0 ) { |
|
238 | + } else if ($arg_count === 0) { |
|
239 | 239 | $args[] = " array()"; |
240 | 240 | } else { |
241 | - $args[] = " array( " . $this->_convert_args_to_string( $arg ) . " )"; |
|
241 | + $args[] = " array( ".$this->_convert_args_to_string($arg)." )"; |
|
242 | 242 | } |
243 | - } elseif ( $arg === null ) { |
|
243 | + } elseif ($arg === null) { |
|
244 | 244 | $args[] = ' null'; |
245 | - } elseif ( is_bool( $arg ) ) { |
|
245 | + } elseif (is_bool($arg)) { |
|
246 | 246 | $args[] = $arg ? ' true' : ' false'; |
247 | - } elseif ( is_object( $arg ) ) { |
|
248 | - $args[] = get_class( $arg ); |
|
249 | - } elseif ( is_resource( $arg ) ) { |
|
250 | - $args[] = get_resource_type( $arg ); |
|
247 | + } elseif (is_object($arg)) { |
|
248 | + $args[] = get_class($arg); |
|
249 | + } elseif (is_resource($arg)) { |
|
250 | + $args[] = get_resource_type($arg); |
|
251 | 251 | } else { |
252 | 252 | $args[] = $arg; |
253 | 253 | } |
254 | - if ( $x === $args_count ) { |
|
255 | - if ( $args_count > 2 ) { |
|
254 | + if ($x === $args_count) { |
|
255 | + if ($args_count > 2) { |
|
256 | 256 | $args[] = "<br />"; |
257 | 257 | $indent--; |
258 | - for ( $i = 1; $i < $indent; $i++ ) { |
|
258 | + for ($i = 1; $i < $indent; $i++) { |
|
259 | 259 | $args[] = ' '; |
260 | 260 | } |
261 | 261 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $args[] = $args_count > 2 ? ",<br />" : ', '; |
264 | 264 | } |
265 | 265 | } |
266 | - return implode( '', $args ); |
|
266 | + return implode('', $args); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | * @param string $line |
279 | 279 | * @return string |
280 | 280 | */ |
281 | - protected function generate_error_code( $file = '', $func = '', $line = '' ) { |
|
282 | - $file_bits = explode( '.', basename( $file ) ); |
|
283 | - $error_code = ! empty( $file_bits[0] ) ? $file_bits[0] : ''; |
|
284 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
285 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
281 | + protected function generate_error_code($file = '', $func = '', $line = '') { |
|
282 | + $file_bits = explode('.', basename($file)); |
|
283 | + $error_code = ! empty($file_bits[0]) ? $file_bits[0] : ''; |
|
284 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
285 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
286 | 286 | return $error_code; |
287 | 287 | } |
288 | 288 | |
@@ -366,26 +366,26 @@ discard block |
||
366 | 366 | * @param bool $force_print |
367 | 367 | * @return string|void |
368 | 368 | */ |
369 | - private function printScripts( $force_print = false ) { |
|
370 | - if ( ! $force_print && ( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' ) ) ) { |
|
371 | - if ( wp_script_is( 'ee_error_js', 'enqueued' ) ) { |
|
369 | + private function printScripts($force_print = false) { |
|
370 | + if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) { |
|
371 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
372 | 372 | return ''; |
373 | - } else if ( wp_script_is( 'ee_error_js', 'registered' ) ) { |
|
374 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
375 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
376 | - wp_enqueue_script( 'ee_error_js' ); |
|
377 | - wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) ); |
|
373 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
374 | + add_filter('FHEE_load_css', '__return_true'); |
|
375 | + add_filter('FHEE_load_js', '__return_true'); |
|
376 | + wp_enqueue_script('ee_error_js'); |
|
377 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG)); |
|
378 | 378 | } |
379 | 379 | } else { |
380 | 380 | return ' |
381 | 381 | <script> |
382 | 382 | /* <![CDATA[ */ |
383 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
383 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
384 | 384 | /* ]]> */ |
385 | 385 | </script> |
386 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
387 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
388 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
386 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
387 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
388 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
389 | 389 | '; |
390 | 390 | } |
391 | 391 | return ''; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\form_sections\form_handlers; |
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 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * @param int $code |
27 | 27 | * @param \Exception $previous |
28 | 28 | */ |
29 | - public function __construct( $actual, $message = '', $code = 0, \Exception $previous = null ) { |
|
30 | - if ( empty( $message ) ) { |
|
29 | + public function __construct($actual, $message = '', $code = 0, \Exception $previous = null) { |
|
30 | + if (empty($message)) { |
|
31 | 31 | $message = sprintf( |
32 | 32 | __( |
33 | 33 | 'A valid Form Handler was expected but instead "%1$s" was received.', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $actual |
37 | 37 | ); |
38 | 38 | } |
39 | - parent::__construct( $message, $code, $previous ); |
|
39 | + parent::__construct($message, $code, $previous); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EE_Form_Section_Proper; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @param \EE_Form_Section_Proper $form |
38 | 38 | */ |
39 | - public function setForm( \EE_Form_Section_Proper $form ); |
|
39 | + public function setForm(\EE_Form_Section_Proper $form); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @param boolean $displayable |
55 | 55 | */ |
56 | - public function setDisplayable( $displayable = false ); |
|
56 | + public function setDisplayable($displayable = false); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * @param string $submit_btn_text |
96 | 96 | */ |
97 | - public function setSubmitBtnText( $submit_btn_text ); |
|
97 | + public function setSubmitBtnText($submit_btn_text); |
|
98 | 98 | |
99 | 99 | |
100 | 100 | |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * @param string $form_action |
110 | 110 | */ |
111 | - public function setFormAction( $form_action ); |
|
111 | + public function setFormAction($form_action); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * @param array $form_args |
117 | 117 | */ |
118 | - public function addFormActionArgs( $form_args = array() ); |
|
118 | + public function addFormActionArgs($form_args = array()); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param string $form_config |
137 | 137 | */ |
138 | - public function setFormConfig( $form_config ); |
|
138 | + public function setFormConfig($form_config); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param array $submitted_form_data |
188 | 188 | * @return bool |
189 | 189 | */ |
190 | - public function process( $submitted_form_data = array() ); |
|
190 | + public function process($submitted_form_data = array()); |
|
191 | 191 | |
192 | 192 | |
193 | 193 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param string $text |
198 | 198 | * @return \EE_Submit_Input |
199 | 199 | */ |
200 | - public function generateSubmitButton( $text = '' ); |
|
200 | + public function generateSubmitButton($text = ''); |
|
201 | 201 | |
202 | 202 | |
203 | 203 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param string $text |
217 | 217 | * @return \EE_Submit_Input |
218 | 218 | */ |
219 | - public function generateCancelButton( $text = '' ); |
|
219 | + public function generateCancelButton($text = ''); |
|
220 | 220 | |
221 | 221 | |
222 | 222 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
5 | 5 | use InvalidArgumentException; |
6 | 6 | |
7 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
8 | - exit( 'No direct script access allowed' ); |
|
7 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param int $order |
33 | 33 | * @throws InvalidArgumentException |
34 | 34 | */ |
35 | - public function setOrder( $order ); |
|
35 | + public function setOrder($order); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @throws InvalidDataTypeException |
49 | 49 | * @throws InvalidArgumentException |
50 | 50 | */ |
51 | - public function setRedirectUrl( $redirect_url ); |
|
51 | + public function setRedirectUrl($redirect_url); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @throws InvalidDataTypeException |
58 | 58 | * @throws InvalidArgumentException |
59 | 59 | */ |
60 | - public function addRedirectArgs( $redirect_args = array() ); |
|
60 | + public function addRedirectArgs($redirect_args = array()); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | /** |
72 | 72 | * @param string $redirect_to |
73 | 73 | */ |
74 | - public function setRedirectTo( $redirect_to ); |
|
74 | + public function setRedirectTo($redirect_to); |
|
75 | 75 | |
76 | 76 | |
77 | 77 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
5 | 5 | use InvalidArgumentException; |
6 | 6 | |
7 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
8 | - exit( 'No direct script access allowed' ); |
|
7 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $form_config = 'add_form_tags_and_submit', |
87 | 87 | \EE_Registry $registry |
88 | 88 | ) { |
89 | - $this->setOrder( $order ); |
|
90 | - parent::__construct( $form_name, $admin_name, $slug, $form_action, $form_config, $registry ); |
|
89 | + $this->setOrder($order); |
|
90 | + parent::__construct($form_name, $admin_name, $slug, $form_action, $form_config, $registry); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | * @param int $order |
106 | 106 | * @throws InvalidArgumentException |
107 | 107 | */ |
108 | - public function setOrder( $order ) { |
|
109 | - $order = absint( $order ); |
|
110 | - if ( ! $order > 0 ) { |
|
108 | + public function setOrder($order) { |
|
109 | + $order = absint($order); |
|
110 | + if ( ! $order > 0) { |
|
111 | 111 | throw new InvalidArgumentException( |
112 | - __( 'The form order property must be a positive integer.', 'event_espresso' ) |
|
112 | + __('The form order property must be a positive integer.', 'event_espresso') |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | $this->order = $order; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @return string |
123 | 123 | */ |
124 | 124 | public function redirectUrl() { |
125 | - return ! empty( $this->redirect_args ) |
|
126 | - ? add_query_arg( $this->redirect_args, $this->redirect_url ) |
|
125 | + return ! empty($this->redirect_args) |
|
126 | + ? add_query_arg($this->redirect_args, $this->redirect_url) |
|
127 | 127 | : $this->redirect_url; |
128 | 128 | } |
129 | 129 | |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * @throws InvalidDataTypeException |
135 | 135 | * @throws InvalidArgumentException |
136 | 136 | */ |
137 | - public function setRedirectUrl( $redirect_url ) { |
|
138 | - if ( ! is_string( $redirect_url ) ) { |
|
139 | - throw new InvalidDataTypeException( '$redirect_url', $redirect_url, 'string' ); |
|
137 | + public function setRedirectUrl($redirect_url) { |
|
138 | + if ( ! is_string($redirect_url)) { |
|
139 | + throw new InvalidDataTypeException('$redirect_url', $redirect_url, 'string'); |
|
140 | 140 | } |
141 | - if ( empty( $redirect_url ) ) { |
|
141 | + if (empty($redirect_url)) { |
|
142 | 142 | throw new InvalidArgumentException( |
143 | - __( 'The redirect URL can not be an empty string.', 'event_espresso' ) |
|
143 | + __('The redirect URL can not be an empty string.', 'event_espresso') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | $this->redirect_url = $redirect_url; |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | * @throws InvalidDataTypeException |
154 | 154 | * @throws InvalidArgumentException |
155 | 155 | */ |
156 | - public function addRedirectArgs( $redirect_args = array() ) { |
|
157 | - if ( is_object( $redirect_args ) ) { |
|
156 | + public function addRedirectArgs($redirect_args = array()) { |
|
157 | + if (is_object($redirect_args)) { |
|
158 | 158 | throw new InvalidDataTypeException( |
159 | 159 | '$redirect_args', |
160 | 160 | $redirect_args, |
161 | 161 | 'anything other than an object was expected.' |
162 | 162 | ); |
163 | 163 | } |
164 | - if ( empty( $redirect_args ) ) { |
|
164 | + if (empty($redirect_args)) { |
|
165 | 165 | throw new InvalidArgumentException( |
166 | - __( 'The redirect argument can not be an empty array.', 'event_espresso' ) |
|
166 | + __('The redirect argument can not be an empty array.', 'event_espresso') |
|
167 | 167 | ); |
168 | 168 | } |
169 | - $this->redirect_args = array_merge( $this->redirect_args, (array) $redirect_args ); |
|
169 | + $this->redirect_args = array_merge($this->redirect_args, (array) $redirect_args); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -176,21 +176,21 @@ discard block |
||
176 | 176 | * @throws InvalidDataTypeException |
177 | 177 | * @throws InvalidArgumentException |
178 | 178 | */ |
179 | - public function removeRedirectArgs( $redirect_arg_keys_to_remove = array() ) { |
|
180 | - if ( is_object( $redirect_arg_keys_to_remove ) ) { |
|
179 | + public function removeRedirectArgs($redirect_arg_keys_to_remove = array()) { |
|
180 | + if (is_object($redirect_arg_keys_to_remove)) { |
|
181 | 181 | throw new InvalidDataTypeException( |
182 | 182 | '$redirect_arg_keys_to_remove', |
183 | 183 | $redirect_arg_keys_to_remove, |
184 | 184 | 'anything other than an object was expected.' |
185 | 185 | ); |
186 | 186 | } |
187 | - if ( empty( $redirect_arg_keys_to_remove ) ) { |
|
187 | + if (empty($redirect_arg_keys_to_remove)) { |
|
188 | 188 | throw new InvalidArgumentException( |
189 | - __( 'The $redirect_arg_keys_to_remove argument can not be an empty array.', 'event_espresso' ) |
|
189 | + __('The $redirect_arg_keys_to_remove argument can not be an empty array.', 'event_espresso') |
|
190 | 190 | ); |
191 | 191 | } |
192 | - foreach ( $redirect_arg_keys_to_remove as $redirect_arg_key ) { |
|
193 | - unset( $this->redirect_args[ $redirect_arg_key ] ); |
|
192 | + foreach ($redirect_arg_keys_to_remove as $redirect_arg_key) { |
|
193 | + unset($this->redirect_args[$redirect_arg_key]); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | /** |
209 | 209 | * @param string $redirect_to |
210 | 210 | */ |
211 | - public function setRedirectTo( $redirect_to ) { |
|
211 | + public function setRedirectTo($redirect_to) { |
|
212 | 212 | if ( |
213 | 213 | ! in_array( |
214 | 214 | $redirect_to, |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * "Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler" |
60 | 60 | * then the following code: |
61 | 61 | * |
62 | - * $CommandHandlerManager = EE_Registry::instance()->create( 'CommandHandlerManagerInterface' ); |
|
62 | + * $CommandHandlerManager = EE_Registry::instance()->create( 'CommandHandlerManagerInterface' ); |
|
63 | 63 | * $CommandHandlerManager->addCommandHandler( |
64 | 64 | * new Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler(), |
65 | 65 | * 'Vendor\some\namespace\DoSomethingCommand' |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\commands; |
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 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param \EE_Registry $registry |
39 | 39 | */ |
40 | - public function __construct( \EE_Registry $registry ) { |
|
40 | + public function __construct(\EE_Registry $registry) { |
|
41 | 41 | $this->registry = $registry; |
42 | 42 | } |
43 | 43 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * @param string $fqcn_for_command Fully Qualified ClassName for Command |
72 | 72 | * @return mixed |
73 | 73 | */ |
74 | - public function addCommandHandler( CommandHandlerInterface $command_handler, $fqcn_for_command = '' ) |
|
74 | + public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = '') |
|
75 | 75 | { |
76 | - $command = ! empty( $fqcn_for_command ) |
|
76 | + $command = ! empty($fqcn_for_command) |
|
77 | 77 | ? $fqcn_for_command |
78 | - : str_replace( 'CommandHandler', 'Command', get_class( $command_handler ) ); |
|
79 | - if ( empty( $command ) ) { |
|
80 | - throw new InvalidCommandHandlerException( $command ); |
|
78 | + : str_replace('CommandHandler', 'Command', get_class($command_handler)); |
|
79 | + if (empty($command)) { |
|
80 | + throw new InvalidCommandHandlerException($command); |
|
81 | 81 | } |
82 | - $this->commandHandlers[ $command ] = $command_handler; |
|
82 | + $this->commandHandlers[$command] = $command_handler; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | * @param \EventEspresso\core\services\commands\CommandInterface $command |
89 | 89 | * @return mixed |
90 | 90 | */ |
91 | - public function getCommandHandler( CommandInterface $command ) |
|
91 | + public function getCommandHandler(CommandInterface $command) |
|
92 | 92 | { |
93 | - $command_name = get_class( $command ); |
|
94 | - $command_handler = str_replace( 'Command', 'CommandHandler', $command_name ); |
|
93 | + $command_name = get_class($command); |
|
94 | + $command_handler = str_replace('Command', 'CommandHandler', $command_name); |
|
95 | 95 | // has a command handler already been set for this class ? |
96 | 96 | // if not, can we find one via the FQCN ? |
97 | - if ( isset( $this->commandHandlers[ $command_name ] ) ) { |
|
98 | - return $this->commandHandlers[ $command_name ]; |
|
99 | - } else if ( class_exists( $command_handler ) ) { |
|
100 | - return $this->registry->create( $command_handler ); |
|
97 | + if (isset($this->commandHandlers[$command_name])) { |
|
98 | + return $this->commandHandlers[$command_name]; |
|
99 | + } else if (class_exists($command_handler)) { |
|
100 | + return $this->registry->create($command_handler); |
|
101 | 101 | } |
102 | - throw new CommandHandlerNotFoundException( $command_handler ); |
|
102 | + throw new CommandHandlerNotFoundException($command_handler); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return EED_Messages |
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', 'execute_batch_request' ); |
|
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', 'execute_batch_request'); |
|
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,9 +235,9 @@ discard block |
||
235 | 235 | * This is triggered by the 'msg_cron_trigger' route. |
236 | 236 | * @param WP $WP |
237 | 237 | */ |
238 | - public function execute_batch_request( $WP ) { |
|
238 | + public function execute_batch_request($WP) { |
|
239 | 239 | $this->run_cron(); |
240 | - header( 'HTTP/1.1 200 OK' ); |
|
240 | + header('HTTP/1.1 200 OK'); |
|
241 | 241 | exit(); |
242 | 242 | } |
243 | 243 | |
@@ -251,35 +251,35 @@ discard block |
||
251 | 251 | public function run_cron() { |
252 | 252 | self::_load_controller(); |
253 | 253 | //get required vars |
254 | - $cron_type = EE_Registry::instance()->REQ->get( 'type' ); |
|
255 | - $transient_key = EE_Registry::instance()->REQ->get( 'key' ); |
|
254 | + $cron_type = EE_Registry::instance()->REQ->get('type'); |
|
255 | + $transient_key = EE_Registry::instance()->REQ->get('key'); |
|
256 | 256 | |
257 | 257 | //now let's verify transient, if not valid exit immediately |
258 | - if ( ! get_transient( $transient_key ) ) { |
|
258 | + if ( ! get_transient($transient_key)) { |
|
259 | 259 | /** |
260 | 260 | * trigger error so this gets in the error logs. This is important because it happens on a non-user request. |
261 | 261 | */ |
262 | - trigger_error( esc_attr__( 'Invalid Request (Transient does not exist)', 'event_espresso' ) ); |
|
262 | + trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso')); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | //if made it here, lets' delete the transient to keep the db clean |
266 | - delete_transient( $transient_key ); |
|
266 | + delete_transient($transient_key); |
|
267 | 267 | |
268 | - if ( apply_filters( 'FHEE__EED_Messages__run_cron__use_wp_cron', true ) ) { |
|
268 | + if (apply_filters('FHEE__EED_Messages__run_cron__use_wp_cron', true)) { |
|
269 | 269 | |
270 | - $method = 'batch_' . $cron_type . '_from_queue'; |
|
271 | - if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) { |
|
270 | + $method = 'batch_'.$cron_type.'_from_queue'; |
|
271 | + if (method_exists(self::$_MSG_PROCESSOR, $method)) { |
|
272 | 272 | self::$_MSG_PROCESSOR->$method(); |
273 | 273 | } else { |
274 | 274 | //no matching task |
275 | 275 | /** |
276 | 276 | * trigger error so this gets in the error logs. This is important because it happens on a non user request. |
277 | 277 | */ |
278 | - trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) ); |
|
278 | + trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type))); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | - do_action( 'FHEE__EED_Messages__run_cron__end' ); |
|
282 | + do_action('FHEE__EED_Messages__run_cron__end'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return EE_Messages_Template_Pack |
297 | 297 | */ |
298 | - public static function get_template_pack( $template_pack_name ) { |
|
299 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
300 | - return EEH_MSG_Template::get_template_pack( $template_pack_name ); |
|
298 | + public static function get_template_pack($template_pack_name) { |
|
299 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
300 | + return EEH_MSG_Template::get_template_pack($template_pack_name); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | * @return EE_Messages_Template_Pack[] |
312 | 312 | */ |
313 | 313 | public static function get_template_packs() { |
314 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
314 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
315 | 315 | |
316 | 316 | //for backward compat, let's make sure this returns in the same format as originally. |
317 | 317 | $template_pack_collection = EEH_MSG_Template::get_template_pack_collection(); |
318 | 318 | $template_pack_collection->rewind(); |
319 | 319 | $template_packs = array(); |
320 | - while ( $template_pack_collection->valid() ) { |
|
321 | - $template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current(); |
|
320 | + while ($template_pack_collection->valid()) { |
|
321 | + $template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current(); |
|
322 | 322 | $template_pack_collection->next(); |
323 | 323 | } |
324 | 324 | return $template_packs; |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | * @return void |
335 | 335 | */ |
336 | 336 | public static function set_autoloaders() { |
337 | - if ( empty( self::$_MSG_PATHS ) ) { |
|
337 | + if (empty(self::$_MSG_PATHS)) { |
|
338 | 338 | self::_set_messages_paths(); |
339 | - foreach ( self::$_MSG_PATHS as $path ) { |
|
340 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path ); |
|
339 | + foreach (self::$_MSG_PATHS as $path) { |
|
340 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path); |
|
341 | 341 | } |
342 | 342 | // add aliases |
343 | - EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' ); |
|
344 | - EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' ); |
|
343 | + EEH_Autoloader::add_alias('EE_messages', 'EE_messages'); |
|
344 | + EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger'); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | 'shortcodes', |
370 | 370 | ); |
371 | 371 | $paths = array(); |
372 | - foreach ( $dir_ref as $index => $dir ) { |
|
373 | - $paths[ $index ] = EE_LIBRARIES . $dir; |
|
372 | + foreach ($dir_ref as $index => $dir) { |
|
373 | + $paths[$index] = EE_LIBRARIES.$dir; |
|
374 | 374 | } |
375 | - self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths ); |
|
375 | + self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -383,12 +383,12 @@ discard block |
||
383 | 383 | * @return void |
384 | 384 | */ |
385 | 385 | protected static function _load_controller() { |
386 | - if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) { |
|
387 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
386 | + if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) { |
|
387 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
388 | 388 | self::set_autoloaders(); |
389 | - self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' ); |
|
390 | - self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
391 | - self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
389 | + self::$_EEMSG = EE_Registry::instance()->load_lib('messages'); |
|
390 | + self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
391 | + self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
@@ -397,10 +397,10 @@ discard block |
||
397 | 397 | /** |
398 | 398 | * @param EE_Transaction $transaction |
399 | 399 | */ |
400 | - public static function payment_reminder( EE_Transaction $transaction ) { |
|
400 | + public static function payment_reminder(EE_Transaction $transaction) { |
|
401 | 401 | self::_load_controller(); |
402 | - $data = array( $transaction, null ); |
|
403 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data ); |
|
402 | + $data = array($transaction, null); |
|
403 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | * @param EE_Payment object |
412 | 412 | * @return void |
413 | 413 | */ |
414 | - public static function payment( EE_Transaction $transaction, EE_Payment $payment ) { |
|
414 | + public static function payment(EE_Transaction $transaction, EE_Payment $payment) { |
|
415 | 415 | self::_load_controller(); |
416 | - $data = array( $transaction, $payment ); |
|
417 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
418 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
416 | + $data = array($transaction, $payment); |
|
417 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
418 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
419 | 419 | //if payment amount is less than 0 then switch to payment_refund message type. |
420 | 420 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
421 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
421 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | /** |
427 | 427 | * @param EE_Transaction $transaction |
428 | 428 | */ |
429 | - public static function cancelled_registration( EE_Transaction $transaction ) { |
|
429 | + public static function cancelled_registration(EE_Transaction $transaction) { |
|
430 | 430 | self::_load_controller(); |
431 | - $data = array( $transaction, null ); |
|
432 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data ); |
|
431 | + $data = array($transaction, null); |
|
432 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | * @param array $extra_details |
443 | 443 | * @return void |
444 | 444 | */ |
445 | - public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) { |
|
445 | + public static function maybe_registration(EE_Registration $registration, $extra_details = array()) { |
|
446 | 446 | |
447 | - if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) { |
|
447 | + if ( ! self::_verify_registration_notification_send($registration, $extra_details)) { |
|
448 | 448 | //no messages please |
449 | 449 | return; |
450 | 450 | } |
@@ -459,22 +459,22 @@ discard block |
||
459 | 459 | $mtgs = array(); |
460 | 460 | |
461 | 461 | //loop through registrations and trigger messages once per status. |
462 | - foreach ( $all_registrations as $reg ) { |
|
462 | + foreach ($all_registrations as $reg) { |
|
463 | 463 | |
464 | 464 | //already triggered? |
465 | - if ( in_array( $reg->status_ID(), $statuses_sent ) ) { |
|
465 | + if (in_array($reg->status_ID(), $statuses_sent)) { |
|
466 | 466 | continue; |
467 | 467 | } |
468 | 468 | |
469 | - $message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() ); |
|
470 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ); |
|
469 | + $message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID()); |
|
470 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID())); |
|
471 | 471 | $statuses_sent[] = $reg->status_ID(); |
472 | 472 | } |
473 | 473 | |
474 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) ); |
|
474 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null)); |
|
475 | 475 | |
476 | 476 | //batch queue and initiate request |
477 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs ); |
|
477 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs); |
|
478 | 478 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
479 | 479 | } |
480 | 480 | |
@@ -489,39 +489,39 @@ discard block |
||
489 | 489 | * |
490 | 490 | * @return bool true = send away, false = nope halt the presses. |
491 | 491 | */ |
492 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
492 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
493 | 493 | //self::log( |
494 | 494 | // __CLASS__, __FUNCTION__, __LINE__, |
495 | 495 | // $registration->transaction(), |
496 | 496 | // array( '$extra_details' => $extra_details ) |
497 | 497 | //); |
498 | 498 | // currently only using this to send messages for the primary registrant |
499 | - if ( ! $registration->is_primary_registrant() ) { |
|
499 | + if ( ! $registration->is_primary_registrant()) { |
|
500 | 500 | return false; |
501 | 501 | } |
502 | 502 | // first we check if we're in admin and not doing front ajax |
503 | - if ( is_admin() && ! EE_FRONT_AJAX ) { |
|
503 | + if (is_admin() && ! EE_FRONT_AJAX) { |
|
504 | 504 | //make sure appropriate admin params are set for sending messages |
505 | - if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) { |
|
505 | + if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { |
|
506 | 506 | //no messages sent please. |
507 | 507 | return false; |
508 | 508 | } |
509 | 509 | } else { |
510 | 510 | // frontend request (either regular or via AJAX) |
511 | 511 | // TXN is NOT finalized ? |
512 | - if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) { |
|
512 | + if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) { |
|
513 | 513 | return false; |
514 | 514 | } |
515 | 515 | // return visit but nothing changed ??? |
516 | 516 | if ( |
517 | - isset( $extra_details['revisit'], $extra_details['status_updates'] ) && |
|
517 | + isset($extra_details['revisit'], $extra_details['status_updates']) && |
|
518 | 518 | $extra_details['revisit'] && ! $extra_details['status_updates'] |
519 | 519 | ) { |
520 | 520 | return false; |
521 | 521 | } |
522 | 522 | // NOT sending messages && reg status is something other than "Not-Approved" |
523 | 523 | if ( |
524 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
524 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
525 | 525 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
526 | 526 | ) { |
527 | 527 | return false; |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @return array |
545 | 545 | */ |
546 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
547 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
548 | - return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
549 | - ? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
546 | + protected static function _get_reg_status_array($reg_status = '') { |
|
547 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
548 | + return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
549 | + ? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
550 | 550 | : EEH_MSG_Template::reg_status_to_message_type_array(); |
551 | 551 | } |
552 | 552 | |
@@ -562,10 +562,10 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @return string|bool The payment message type slug matching the status or false if no match. |
564 | 564 | */ |
565 | - protected static function _get_payment_message_type( $payment_status ) { |
|
566 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
567 | - return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
568 | - ? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
565 | + protected static function _get_payment_message_type($payment_status) { |
|
566 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
567 | + return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
568 | + ? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
569 | 569 | : false; |
570 | 570 | } |
571 | 571 | |
@@ -579,33 +579,33 @@ discard block |
||
579 | 579 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
580 | 580 | * @return bool success/fail |
581 | 581 | */ |
582 | - public static function process_resend( $req_data ) { |
|
582 | + public static function process_resend($req_data) { |
|
583 | 583 | self::_load_controller(); |
584 | 584 | |
585 | 585 | //if $msgID in this request then skip to the new resend_message |
586 | - if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) { |
|
586 | + if (EE_Registry::instance()->REQ->get('MSG_ID')) { |
|
587 | 587 | return self::resend_message(); |
588 | 588 | } |
589 | 589 | |
590 | 590 | //make sure any incoming request data is set on the REQ so that it gets picked up later. |
591 | 591 | $req_data = (array) $req_data; |
592 | - foreach( $req_data as $request_key => $request_value ) { |
|
593 | - EE_Registry::instance()->REQ->set( $request_key, $request_value ); |
|
592 | + foreach ($req_data as $request_key => $request_value) { |
|
593 | + EE_Registry::instance()->REQ->set($request_key, $request_value); |
|
594 | 594 | } |
595 | 595 | |
596 | - if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) { |
|
596 | + if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) { |
|
597 | 597 | return false; |
598 | 598 | } |
599 | 599 | |
600 | 600 | try { |
601 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send ); |
|
601 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send); |
|
602 | 602 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
603 | - } catch( EE_Error $e ) { |
|
604 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
603 | + } catch (EE_Error $e) { |
|
604 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | EE_Error::add_success( |
608 | - __( 'Messages have been successfully queued for generation and sending.', 'event_espresso' ) |
|
608 | + __('Messages have been successfully queued for generation and sending.', 'event_espresso') |
|
609 | 609 | ); |
610 | 610 | return true; //everything got queued. |
611 | 611 | } |
@@ -618,17 +618,17 @@ discard block |
||
618 | 618 | public static function resend_message() { |
619 | 619 | self::_load_controller(); |
620 | 620 | |
621 | - $msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' ); |
|
622 | - if ( ! $msgID ) { |
|
623 | - EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
621 | + $msgID = EE_Registry::instance()->REQ->get('MSG_ID'); |
|
622 | + if ( ! $msgID) { |
|
623 | + EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
624 | 624 | return false; |
625 | 625 | } |
626 | 626 | |
627 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID ); |
|
627 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID); |
|
628 | 628 | |
629 | 629 | //setup success message. |
630 | - $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
631 | - EE_Error::add_success( sprintf( |
|
630 | + $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
631 | + EE_Error::add_success(sprintf( |
|
632 | 632 | _n( |
633 | 633 | 'There was %d message queued for resending.', |
634 | 634 | 'There were %d messages queued for resending.', |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | 'event_espresso' |
637 | 637 | ), |
638 | 638 | $count_ready_for_resend |
639 | - ) ); |
|
639 | + )); |
|
640 | 640 | return true; |
641 | 641 | } |
642 | 642 | |
@@ -649,13 +649,13 @@ discard block |
||
649 | 649 | * @param EE_Payment $payment EE_payment object |
650 | 650 | * @return bool success/fail |
651 | 651 | */ |
652 | - public static function process_admin_payment( EE_Payment $payment ) { |
|
653 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
652 | + public static function process_admin_payment(EE_Payment $payment) { |
|
653 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
654 | 654 | //we need to get the transaction object |
655 | 655 | $transaction = $payment->transaction(); |
656 | - if ( $transaction instanceof EE_Transaction ) { |
|
657 | - $data = array( $transaction, $payment ); |
|
658 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
656 | + if ($transaction instanceof EE_Transaction) { |
|
657 | + $data = array($transaction, $payment); |
|
658 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
659 | 659 | |
660 | 660 | //if payment amount is less than 0 then switch to payment_refund message type. |
661 | 661 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -665,22 +665,22 @@ discard block |
||
665 | 665 | |
666 | 666 | self::_load_controller(); |
667 | 667 | |
668 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
668 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
669 | 669 | |
670 | 670 | //get count of queued for generation |
671 | - $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( array( EEM_Message::status_incomplete, EEM_Message::status_idle ) ); |
|
671 | + $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(array(EEM_Message::status_incomplete, EEM_Message::status_idle)); |
|
672 | 672 | |
673 | - if ( $count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0 ) { |
|
674 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' ); |
|
673 | + if ($count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0) { |
|
674 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true'); |
|
675 | 675 | return true; |
676 | 676 | } else { |
677 | - $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() ); |
|
677 | + $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending()); |
|
678 | 678 | /** |
679 | 679 | * Verify that there are actually errors. If not then we return a success message because the queue might have been emptied due to successful |
680 | 680 | * IMMEDIATE generation. |
681 | 681 | */ |
682 | - if ( $count_failed > 0 ) { |
|
683 | - EE_Error::add_error( sprintf( |
|
682 | + if ($count_failed > 0) { |
|
683 | + EE_Error::add_error(sprintf( |
|
684 | 684 | _n( |
685 | 685 | 'The payment notification generation failed.', |
686 | 686 | '%d payment notifications failed being sent.', |
@@ -688,11 +688,11 @@ discard block |
||
688 | 688 | 'event_espresso' |
689 | 689 | ), |
690 | 690 | $count_failed |
691 | - ), __FILE__, __FUNCTION__, __LINE__ ); |
|
691 | + ), __FILE__, __FUNCTION__, __LINE__); |
|
692 | 692 | |
693 | 693 | return false; |
694 | 694 | } else { |
695 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' ); |
|
695 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true'); |
|
696 | 696 | return true; |
697 | 697 | } |
698 | 698 | } |
@@ -716,11 +716,11 @@ discard block |
||
716 | 716 | * @param int $grp_id a specific message template group id. |
717 | 717 | * @return void |
718 | 718 | */ |
719 | - public static function send_newsletter_message( $registrations, $grp_id ) { |
|
719 | + public static function send_newsletter_message($registrations, $grp_id) { |
|
720 | 720 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
721 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
721 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
722 | 722 | self::_load_controller(); |
723 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations ); |
|
723 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -735,9 +735,9 @@ discard block |
||
735 | 735 | * @param string $message_type |
736 | 736 | * @return string |
737 | 737 | */ |
738 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
738 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
739 | 739 | // whitelist $messenger |
740 | - switch ( $messenger ) { |
|
740 | + switch ($messenger) { |
|
741 | 741 | case 'pdf' : |
742 | 742 | $sending_messenger = 'pdf'; |
743 | 743 | $generating_messenger = 'html'; |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | break; |
750 | 750 | } |
751 | 751 | // whitelist $message_type |
752 | - switch ( $message_type ) { |
|
752 | + switch ($message_type) { |
|
753 | 753 | case 'receipt' : |
754 | 754 | $message_type = 'receipt'; |
755 | 755 | break; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | break; |
760 | 760 | } |
761 | 761 | // verify that both the messenger AND the message type are active |
762 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
762 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
763 | 763 | //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?) |
764 | 764 | $template_query_params = array( |
765 | 765 | 'MTP_is_active' => true, |
@@ -768,16 +768,16 @@ discard block |
||
768 | 768 | 'Event.EVT_ID' => $registration->event_ID() |
769 | 769 | ); |
770 | 770 | //get the message template group. |
771 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
771 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
772 | 772 | //if we don't have an EE_Message_Template_Group then return |
773 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
773 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
774 | 774 | // remove EVT_ID from query params so that global templates get picked up |
775 | - unset( $template_query_params['Event.EVT_ID'] ); |
|
775 | + unset($template_query_params['Event.EVT_ID']); |
|
776 | 776 | //get global template as the fallback |
777 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
777 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
778 | 778 | } |
779 | 779 | //if we don't have an EE_Message_Template_Group then return |
780 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
780 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
781 | 781 | return ''; |
782 | 782 | } |
783 | 783 | // generate the URL |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
807 | 807 | * @return string|bool The body of the message or if send is requested, sends. |
808 | 808 | */ |
809 | - public static function preview_message( $type, $context, $messenger, $send = false ) { |
|
809 | + public static function preview_message($type, $context, $messenger, $send = false) { |
|
810 | 810 | self::_load_controller(); |
811 | 811 | $mtg = new EE_Message_To_Generate( |
812 | 812 | $messenger, |
@@ -815,8 +815,8 @@ discard block |
||
815 | 815 | $context, |
816 | 816 | true |
817 | 817 | ); |
818 | - $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg, $send ); |
|
819 | - if ( $generated_preview_queue instanceof EE_Messages_Queue ) { |
|
818 | + $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg, $send); |
|
819 | + if ($generated_preview_queue instanceof EE_Messages_Queue) { |
|
820 | 820 | return $generated_preview_queue->get_message_repository()->current()->content(); |
821 | 821 | } else { |
822 | 822 | return $generated_preview_queue; |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * |
844 | 844 | * @return bool success or fail. |
845 | 845 | */ |
846 | - public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) { |
|
846 | + public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') { |
|
847 | 847 | self::_load_controller(); |
848 | 848 | /** @type EE_Message_To_Generate_From_Queue $message_to_generate */ |
849 | 849 | $message_to_generate = EE_Registry::instance()->load_lib( |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $custom_subject, |
856 | 856 | ) |
857 | 857 | ); |
858 | - return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate ); |
|
858 | + return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | |
@@ -868,24 +868,24 @@ discard block |
||
868 | 868 | * @param array $message_ids An array of message ids |
869 | 869 | * @return bool | EE_Messages_Queue false if nothing was generated, EE_Messages_Queue containing generated messages. |
870 | 870 | */ |
871 | - public static function generate_now( $message_ids ) { |
|
871 | + public static function generate_now($message_ids) { |
|
872 | 872 | self::_load_controller(); |
873 | 873 | $messages = EEM_Message::instance()->get_all( |
874 | 874 | array( |
875 | 875 | 0 => array( |
876 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
876 | + 'MSG_ID' => array('IN', $message_ids), |
|
877 | 877 | 'STS_ID' => EEM_Message::status_incomplete, |
878 | 878 | ) |
879 | 879 | ) |
880 | 880 | ); |
881 | 881 | $generated_queue = false; |
882 | - if ( $messages ) { |
|
883 | - $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages ); |
|
882 | + if ($messages) { |
|
883 | + $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages); |
|
884 | 884 | } |
885 | 885 | |
886 | - if ( ! $generated_queue instanceof EE_Messages_Queue ) { |
|
886 | + if ( ! $generated_queue instanceof EE_Messages_Queue) { |
|
887 | 887 | EE_Error::add_error( |
888 | - __( 'The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.', 'event_espresso' ), |
|
888 | + __('The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.', 'event_espresso'), |
|
889 | 889 | __FILE__, __FUNCTION__, __LINE__ |
890 | 890 | ); |
891 | 891 | } |
@@ -904,30 +904,30 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @return bool | EE_Messages_Queue false if no messages sent. |
906 | 906 | */ |
907 | - public static function send_now( $message_ids ) { |
|
907 | + public static function send_now($message_ids) { |
|
908 | 908 | self::_load_controller(); |
909 | 909 | $messages = EEM_Message::instance()->get_all( |
910 | 910 | array( |
911 | 911 | 0 => array( |
912 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
913 | - 'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) ) |
|
912 | + 'MSG_ID' => array('IN', $message_ids), |
|
913 | + 'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry)) |
|
914 | 914 | ) |
915 | 915 | ) |
916 | 916 | ); |
917 | 917 | $sent_queue = false; |
918 | - if ( $messages ) { |
|
919 | - $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages ); |
|
918 | + if ($messages) { |
|
919 | + $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages); |
|
920 | 920 | } |
921 | 921 | |
922 | - if ( ! $sent_queue instanceof EE_Messages_Queue ) { |
|
922 | + if ( ! $sent_queue instanceof EE_Messages_Queue) { |
|
923 | 923 | EE_Error::add_error( |
924 | - __( 'The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.', 'event_espresso' ), |
|
924 | + __('The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } else { |
928 | 928 | //can count how many sent by using the messages in the queue |
929 | - $sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() ); |
|
930 | - if ( $sent_count > 0 ) { |
|
929 | + $sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent()); |
|
930 | + if ($sent_count > 0) { |
|
931 | 931 | EE_Error::add_success( |
932 | 932 | sprintf( |
933 | 933 | _n( |
@@ -942,8 +942,8 @@ discard block |
||
942 | 942 | } else { |
943 | 943 | EE_Error::overwrite_errors(); |
944 | 944 | EE_Error::add_error( |
945 | - __( '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. |
|
946 | - If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ), |
|
945 | + __('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. |
|
946 | + If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'), |
|
947 | 947 | __FILE__, __FUNCTION__, __LINE__ |
948 | 948 | ); |
949 | 949 | } |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return bool true means messages were successfully queued for resending, false means none were queued for resending. |
966 | 966 | */ |
967 | - public static function queue_for_resending( $message_ids ) { |
|
967 | + public static function queue_for_resending($message_ids) { |
|
968 | 968 | self::_load_controller(); |
969 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids ); |
|
969 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids); |
|
970 | 970 | |
971 | 971 | //get queue and count |
972 | - $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
972 | + $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
973 | 973 | |
974 | 974 | if ( |
975 | 975 | $queue_count > 0 |
@@ -989,11 +989,11 @@ discard block |
||
989 | 989 | * @see filter usage in EE_Messages_Queue::initiate_request_by_priority |
990 | 990 | */ |
991 | 991 | } elseif ( |
992 | - apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true ) |
|
992 | + apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true) |
|
993 | 993 | || EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request |
994 | 994 | ) { |
995 | - $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_sent ); |
|
996 | - if ( $queue_count > 0 ) { |
|
995 | + $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_sent); |
|
996 | + if ($queue_count > 0) { |
|
997 | 997 | EE_Error::add_success( |
998 | 998 | sprintf( |
999 | 999 | _n( |
@@ -1007,13 +1007,13 @@ discard block |
||
1007 | 1007 | ); |
1008 | 1008 | } else { |
1009 | 1009 | EE_Error::add_error( |
1010 | - __( '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' ), |
|
1010 | + __('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'), |
|
1011 | 1011 | __FILE__, __FUNCTION__, __LINE__ |
1012 | 1012 | ); |
1013 | 1013 | } |
1014 | 1014 | } else { |
1015 | 1015 | EE_Error::add_error( |
1016 | - __( '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' ), |
|
1016 | + __('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'), |
|
1017 | 1017 | __FILE__, __FUNCTION__, __LINE__ |
1018 | 1018 | ); |
1019 | 1019 | } |
@@ -1035,16 +1035,16 @@ discard block |
||
1035 | 1035 | * @param array $info |
1036 | 1036 | * @param bool $display_request |
1037 | 1037 | */ |
1038 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
1039 | - if ( WP_DEBUG && false ) { |
|
1040 | - if ( $transaction instanceof EE_Transaction ) { |
|
1038 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
1039 | + if (WP_DEBUG && false) { |
|
1040 | + if ($transaction instanceof EE_Transaction) { |
|
1041 | 1041 | // don't serialize objects |
1042 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
1042 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
1043 | 1043 | $info['TXN_status'] = $transaction->status_ID(); |
1044 | 1044 | $info['TXN_reg_steps'] = $transaction->reg_steps(); |
1045 | - if ( $transaction->ID() ) { |
|
1046 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
1047 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
1045 | + if ($transaction->ID()) { |
|
1046 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
1047 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
1048 | 1048 | } |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -560,7 +560,7 @@ |
||
560 | 560 | * |
561 | 561 | * @param string $payment_status The payment status being matched. |
562 | 562 | * |
563 | - * @return string|bool The payment message type slug matching the status or false if no match. |
|
563 | + * @return string|false The payment message type slug matching the status or false if no match. |
|
564 | 564 | */ |
565 | 565 | protected static function _get_payment_message_type( $payment_status ) { |
566 | 566 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
@@ -6,7 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage modules, messages |
8 | 8 | */ |
9 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | + exit('No direct script access allowed'); |
|
11 | +} |
|
10 | 12 | /** |
11 | 13 | * |
12 | 14 | * Messages module. Takes care of registering all the triggers for messages. |
@@ -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 | /** |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class Extend_Support_Admin_Page extends Support_Admin_Page { |
31 | 31 | |
32 | - public function __construct( $routing = TRUE ) { |
|
33 | - parent::__construct( $routing ); |
|
34 | - define( 'EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/' ); |
|
32 | + public function __construct($routing = TRUE) { |
|
33 | + parent::__construct($routing); |
|
34 | + define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'support/templates/'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | 40 | protected function _extend_page_config() { |
41 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support'; |
|
41 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'support'; |
|
42 | 42 | //new routes and new configs (or overrides ) |
43 | 43 | $new_page_routes = array( |
44 | 44 | 'faq' => array( |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'capability' => 'ee_read_ee' |
47 | 47 | ) |
48 | 48 | ); |
49 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
49 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
50 | 50 | |
51 | 51 | $new_page_config = array( |
52 | 52 | 'faq' => array( |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'require_nonce' => FALSE |
58 | 58 | ) |
59 | 59 | ); |
60 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
60 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
61 | 61 | |
62 | 62 | $this->_page_config['default']['metaboxes'][] = '_installation_boxes'; |
63 | 63 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | |
67 | 67 | |
68 | 68 | protected function _faq() { |
69 | - $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php'; |
|
70 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
69 | + $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_faq.template.php'; |
|
70 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
71 | 71 | $this->display_admin_page_with_sidebar(); |
72 | 72 | |
73 | 73 | } |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | protected function _installation_boxes() { |
78 | - $callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_additional_information.template.php'); |
|
79 | - add_meta_box( 'espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);' ), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
78 | + $callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_additional_information.template.php'); |
|
79 | + add_meta_box('espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 |
@@ -1,6 +1,7 @@ |
||
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 |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - public function layout_form_begin( $additional_args = array() ) { |
|
16 | + public function layout_form_begin($additional_args = array()) { |
|
17 | 17 | $this->_form_section->set_html_class('form-table'); |
18 | - return parent::layout_form_begin( $additional_args ); |
|
18 | + return parent::layout_form_begin($additional_args); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | * @param EE_Form_Section_Proper $form_section |
26 | 26 | * @return string |
27 | 27 | */ |
28 | - public function layout_subsection( $form_section ){ |
|
29 | - if ( $form_section instanceof EE_Form_Section_Proper ) { |
|
30 | - return EEH_HTML::no_row( $form_section->get_html(), 2 ); |
|
31 | - } else if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
32 | - return EEH_HTML::no_row( $form_section->get_html(), 2 ); |
|
28 | + public function layout_subsection($form_section) { |
|
29 | + if ($form_section instanceof EE_Form_Section_Proper) { |
|
30 | + return EEH_HTML::no_row($form_section->get_html(), 2); |
|
31 | + } else if ($form_section instanceof EE_Form_Section_HTML) { |
|
32 | + return EEH_HTML::no_row($form_section->get_html(), 2); |
|
33 | 33 | } |
34 | 34 | return ''; |
35 | 35 | } |
@@ -41,30 +41,30 @@ discard block |
||
41 | 41 | * @param EE_Form_Input_Base $input |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - public function layout_input( $input ) { |
|
44 | + public function layout_input($input) { |
|
45 | 45 | |
46 | 46 | if ( |
47 | 47 | $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || |
48 | 48 | $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || |
49 | 49 | $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
50 | 50 | ) { |
51 | - $input->set_html_class( $input->html_class() . ' large-text' ); |
|
51 | + $input->set_html_class($input->html_class().' large-text'); |
|
52 | 52 | } |
53 | - if ( $input instanceof EE_Text_Area_Input ) { |
|
54 | - $input->set_rows( 4 ); |
|
55 | - $input->set_cols( 60 ); |
|
53 | + if ($input instanceof EE_Text_Area_Input) { |
|
54 | + $input->set_rows(4); |
|
55 | + $input->set_cols(60); |
|
56 | 56 | } |
57 | 57 | $input_html = $input->get_html_for_input(); |
58 | 58 | // maybe add errors and help text ? |
59 | - $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
60 | - $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
59 | + $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
60 | + $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
61 | 61 | //overriding parent to add wp admin specific things. |
62 | 62 | $html = ''; |
63 | - if ( $input instanceof EE_Hidden_Input ) { |
|
64 | - $html .= EEH_HTML::no_row( $input->get_html_for_input(), 2 ); |
|
63 | + if ($input instanceof EE_Hidden_Input) { |
|
64 | + $html .= EEH_HTML::no_row($input->get_html_for_input(), 2); |
|
65 | 65 | } else { |
66 | 66 | $html .= EEH_HTML::tr( |
67 | - EEH_HTML::th( $input->get_html_for_label(), '', '', '', 'scope="row"' ) . EEH_HTML::td( $input_html ) |
|
67 | + EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"').EEH_HTML::td($input_html) |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | return $html; |