@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | * @param string $timezone |
20 | 20 | * @return EE_Registration_Payment |
21 | 21 | */ |
22 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
23 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
24 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
22 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
23 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
24 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param string $timezone |
32 | 32 | * @return EE_Registration_Payment |
33 | 33 | */ |
34 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
35 | - return new self( $props_n_values, true, $timezone ); |
|
34 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
35 | + return new self($props_n_values, true, $timezone); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return int |
44 | 44 | */ |
45 | 45 | public function registration_ID() { |
46 | - return $this->get( 'REG_ID' ); |
|
46 | + return $this->get('REG_ID'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return int |
55 | 55 | */ |
56 | 56 | public function payment_ID() { |
57 | - return $this->get( 'PAY_ID' ); |
|
57 | + return $this->get('PAY_ID'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @return float |
66 | 66 | */ |
67 | 67 | public function amount() { |
68 | - return $this->get( 'RPY_amount' ); |
|
68 | + return $this->get('RPY_amount'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @param float $amount |
77 | 77 | */ |
78 | - public function set_amount( $amount = 0.000 ) { |
|
79 | - $this->set( 'RPY_amount', $amount ); |
|
78 | + public function set_amount($amount = 0.000) { |
|
79 | + $this->set('RPY_amount', $amount); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return \EE_Registration |
88 | 88 | */ |
89 | 89 | public function registration() { |
90 | - return $this->get_first_related( 'Registration' ); |
|
90 | + return $this->get_first_related('Registration'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return \EE_Payment |
99 | 99 | */ |
100 | 100 | public function payment() { |
101 | - return $this->get_first_related( 'Payment' ); |
|
101 | + return $this->get_first_related('Payment'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * date_format and the second value is the time format |
67 | 67 | * @return EE_Ticket |
68 | 68 | */ |
69 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
70 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
71 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
69 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
70 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
71 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * the website will be used. |
80 | 80 | * @return EE_Ticket |
81 | 81 | */ |
82 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
83 | - return new self( $props_n_values, TRUE, $timezone ); |
|
82 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
83 | + return new self($props_n_values, TRUE, $timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return bool |
90 | 90 | */ |
91 | 91 | public function parent() { |
92 | - return $this->get( 'TKT_parent' ); |
|
92 | + return $this->get('TKT_parent'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @param int $DTT_ID the primary key for a particular datetime |
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | - public function available( $DTT_ID = 0 ) { |
|
102 | + public function available($DTT_ID = 0) { |
|
103 | 103 | // are we checking availability for a particular datetime ? |
104 | - if ( $DTT_ID ) { |
|
104 | + if ($DTT_ID) { |
|
105 | 105 | // get that datetime object |
106 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
106 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
107 | 107 | // if ticket sales for this datetime have exceeded the reg limit... |
108 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
108 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
109 | 109 | return FALSE; |
110 | 110 | } |
111 | 111 | } |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
121 | 121 | * @return mixed(int|string) status int if the display string isn't requested |
122 | 122 | */ |
123 | - public function ticket_status( $display = FALSE ) { |
|
124 | - if ( ! $this->is_remaining() ) { |
|
125 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
123 | + public function ticket_status($display = FALSE) { |
|
124 | + if ( ! $this->is_remaining()) { |
|
125 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
126 | 126 | } |
127 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
128 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
127 | + if ($this->get('TKT_deleted')) { |
|
128 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
129 | 129 | } |
130 | - if ( $this->is_expired() ) { |
|
131 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
130 | + if ($this->is_expired()) { |
|
131 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
132 | 132 | } |
133 | - if ( $this->is_pending() ) { |
|
134 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
133 | + if ($this->is_pending()) { |
|
134 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
135 | 135 | } |
136 | - if ( $this->is_on_sale() ) { |
|
137 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
136 | + if ($this->is_on_sale()) { |
|
137 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
138 | 138 | } |
139 | 139 | return ''; |
140 | 140 | } |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
149 | 149 | * @return boolean true = tickets remaining, false not. |
150 | 150 | */ |
151 | - public function is_remaining( $DTT_ID = 0 ) { |
|
152 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
153 | - if ( $num_remaining === 0 ) { |
|
151 | + public function is_remaining($DTT_ID = 0) { |
|
152 | + $num_remaining = $this->remaining($DTT_ID); |
|
153 | + if ($num_remaining === 0) { |
|
154 | 154 | return FALSE; |
155 | 155 | } |
156 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
156 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
157 | 157 | return FALSE; |
158 | 158 | } |
159 | 159 | return TRUE; |
@@ -167,25 +167,25 @@ discard block |
||
167 | 167 | * all related datetimes |
168 | 168 | * @return int |
169 | 169 | */ |
170 | - public function remaining( $DTT_ID = 0 ) { |
|
170 | + public function remaining($DTT_ID = 0) { |
|
171 | 171 | // are we checking availability for a particular datetime ? |
172 | - if ( $DTT_ID ) { |
|
172 | + if ($DTT_ID) { |
|
173 | 173 | // get array with the one requested datetime |
174 | - $datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
174 | + $datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
175 | 175 | } else { |
176 | 176 | // we need to check availability of ALL datetimes |
177 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
177 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
178 | 178 | } |
179 | 179 | // d( $datetimes ); |
180 | 180 | // if datetime reg limit is not unlimited |
181 | - if ( ! empty( $datetimes ) ) { |
|
181 | + if ( ! empty($datetimes)) { |
|
182 | 182 | // although TKT_qty and $datetime->spaces_remaining() could both be EE_INF |
183 | 183 | // we only need to check for EE_INF explicitly if we want to optimize. |
184 | 184 | // because EE_INF - x = EE_INF; and min(x,EE_INF) = x; |
185 | 185 | $tickets_remaining = $this->qty() - $this->sold(); |
186 | - foreach ( $datetimes as $datetime ) { |
|
187 | - if ( $datetime instanceof EE_Datetime ) { |
|
188 | - $tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() ); |
|
186 | + foreach ($datetimes as $datetime) { |
|
187 | + if ($datetime instanceof EE_Datetime) { |
|
188 | + $tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining()); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | return $tickets_remaining; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return int |
201 | 201 | */ |
202 | 202 | function min() { |
203 | - return $this->get( 'TKT_min' ); |
|
203 | + return $this->get('TKT_min'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean |
211 | 211 | */ |
212 | 212 | public function is_expired() { |
213 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
213 | + return ($this->get_raw('TKT_end_date') < time()); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return boolean |
221 | 221 | */ |
222 | 222 | public function is_pending() { |
223 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
223 | + return ($this->get_raw('TKT_start_date') > time()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return boolean |
231 | 231 | */ |
232 | 232 | public function is_on_sale() { |
233 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
233 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
242 | 242 | * @return array |
243 | 243 | */ |
244 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
245 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
246 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
244 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
245 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
246 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
247 | 247 | |
248 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
248 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | * @return EE_Datetime |
256 | 256 | */ |
257 | 257 | public function first_datetime() { |
258 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
259 | - return reset( $datetimes ); |
|
258 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
259 | + return reset($datetimes); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @param array $query_params see EEM_Base::get_all() |
268 | 268 | * @return EE_Datetime[] |
269 | 269 | */ |
270 | - public function datetimes( $query_params = array() ) { |
|
271 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
272 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
270 | + public function datetimes($query_params = array()) { |
|
271 | + if ( ! isset($query_params['order_by'])) { |
|
272 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
273 | 273 | } |
274 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
274 | + return $this->get_many_related('Datetime', $query_params); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @return EE_Datetime |
282 | 282 | */ |
283 | 283 | public function last_datetime() { |
284 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
285 | - return end( $datetimes ); |
|
284 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
285 | + return end($datetimes); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -296,22 +296,22 @@ discard block |
||
296 | 296 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
297 | 297 | * @return mixed (array|int) how many tickets have sold |
298 | 298 | */ |
299 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
299 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
300 | 300 | $total = 0; |
301 | 301 | $tickets_sold = $this->_all_tickets_sold(); |
302 | - switch ( $what ) { |
|
302 | + switch ($what) { |
|
303 | 303 | case 'ticket' : |
304 | - return $tickets_sold[ 'ticket' ]; |
|
304 | + return $tickets_sold['ticket']; |
|
305 | 305 | break; |
306 | 306 | case 'datetime' : |
307 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
307 | + if (empty($tickets_sold['datetime'])) { |
|
308 | 308 | return $total; |
309 | 309 | } |
310 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
311 | - EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
310 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
311 | + EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
312 | 312 | return $total; |
313 | 313 | } |
314 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
314 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
315 | 315 | break; |
316 | 316 | default: |
317 | 317 | return $total; |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | * @return EE_Ticket[] |
326 | 326 | */ |
327 | 327 | protected function _all_tickets_sold() { |
328 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
328 | + $datetimes = $this->get_many_related('Datetime'); |
|
329 | 329 | $tickets_sold = array(); |
330 | - if ( ! empty( $datetimes ) ) { |
|
331 | - foreach ( $datetimes as $datetime ) { |
|
332 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
330 | + if ( ! empty($datetimes)) { |
|
331 | + foreach ($datetimes as $datetime) { |
|
332 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | //Tickets sold |
336 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
336 | + $tickets_sold['ticket'] = $this->sold(); |
|
337 | 337 | return $tickets_sold; |
338 | 338 | } |
339 | 339 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
347 | 347 | * @return EE_Price |
348 | 348 | */ |
349 | - public function base_price( $return_array = FALSE ) { |
|
350 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
351 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
349 | + public function base_price($return_array = FALSE) { |
|
350 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
351 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @return EE_Price[] |
361 | 361 | */ |
362 | 362 | public function price_modifiers() { |
363 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
364 | - return $this->prices( $query_params ); |
|
363 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
364 | + return $this->prices($query_params); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param array $query_params like EEM_Base::get_all |
372 | 372 | * @return EE_Price[] |
373 | 373 | */ |
374 | - public function prices( $query_params = array() ) { |
|
375 | - return $this->get_many_related( 'Price', $query_params ); |
|
374 | + public function prices($query_params = array()) { |
|
375 | + return $this->get_many_related('Price', $query_params); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @param array $query_params see EEM_Base::get_all() |
383 | 383 | * @return EE_Datetime_Ticket |
384 | 384 | */ |
385 | - public function datetime_tickets( $query_params = array() ) { |
|
386 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
385 | + public function datetime_tickets($query_params = array()) { |
|
386 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | * @param boolean $show_deleted |
395 | 395 | * @return EE_Datetime[] |
396 | 396 | */ |
397 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
398 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
397 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
398 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return string |
406 | 406 | */ |
407 | 407 | function ID() { |
408 | - return $this->get( 'TKT_ID' ); |
|
408 | + return $this->get('TKT_ID'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return EE_Ticket_Template |
430 | 430 | */ |
431 | 431 | public function template() { |
432 | - return $this->get_first_related( 'Ticket_Template' ); |
|
432 | + return $this->get_first_related('Ticket_Template'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @return bool |
449 | 449 | */ |
450 | 450 | public function ticket_price() { |
451 | - return $this->get( 'TKT_price' ); |
|
451 | + return $this->get('TKT_price'); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @return mixed |
458 | 458 | */ |
459 | 459 | public function pretty_price() { |
460 | - return $this->get_pretty( 'TKT_price' ); |
|
460 | + return $this->get_pretty('TKT_price'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | * @param bool $no_cache |
477 | 477 | * @return float |
478 | 478 | */ |
479 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
480 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
479 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
480 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
481 | 481 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
482 | 482 | } |
483 | - return (float)$this->_ticket_total_with_taxes; |
|
483 | + return (float) $this->_ticket_total_with_taxes; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
487 | 487 | |
488 | 488 | public function ensure_TKT_Price_correct() { |
489 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
489 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
490 | 490 | $this->save(); |
491 | 491 | } |
492 | 492 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return float |
497 | 497 | */ |
498 | 498 | public function get_ticket_subtotal() { |
499 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
499 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @return float |
507 | 507 | */ |
508 | 508 | public function get_ticket_taxes_total_for_admin() { |
509 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
509 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @param string $name |
517 | 517 | * @return boolean |
518 | 518 | */ |
519 | - function set_name( $name ) { |
|
520 | - $this->set( 'TKT_name', $name ); |
|
519 | + function set_name($name) { |
|
520 | + $this->set('TKT_name', $name); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return string |
528 | 528 | */ |
529 | 529 | function description() { |
530 | - return $this->get( 'TKT_description' ); |
|
530 | + return $this->get('TKT_description'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * @param string $description |
538 | 538 | * @return boolean |
539 | 539 | */ |
540 | - function set_description( $description ) { |
|
541 | - $this->set( 'TKT_description', $description ); |
|
540 | + function set_description($description) { |
|
541 | + $this->set('TKT_description', $description); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | * @param string $tm_frmt |
550 | 550 | * @return string |
551 | 551 | */ |
552 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
553 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
552 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
553 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | * @param string $start_date |
561 | 561 | * @return void |
562 | 562 | */ |
563 | - function set_start_date( $start_date ) { |
|
564 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
563 | + function set_start_date($start_date) { |
|
564 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | * @param string $tm_frmt |
573 | 573 | * @return string |
574 | 574 | */ |
575 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
576 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
575 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
576 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -583,8 +583,8 @@ discard block |
||
583 | 583 | * @param string $end_date |
584 | 584 | * @return void |
585 | 585 | */ |
586 | - function set_end_date( $end_date ) { |
|
587 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
586 | + function set_end_date($end_date) { |
|
587 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
598 | 598 | */ |
599 | - function set_end_time( $time ) { |
|
600 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
599 | + function set_end_time($time) { |
|
600 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * @param int $min |
608 | 608 | * @return boolean |
609 | 609 | */ |
610 | - function set_min( $min ) { |
|
611 | - $this->set( 'TKT_min', $min ); |
|
610 | + function set_min($min) { |
|
611 | + $this->set('TKT_min', $min); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @return int |
619 | 619 | */ |
620 | 620 | function max() { |
621 | - return $this->get( 'TKT_max' ); |
|
621 | + return $this->get('TKT_max'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | * @param int $max |
629 | 629 | * @return boolean |
630 | 630 | */ |
631 | - function set_max( $max ) { |
|
632 | - $this->set( 'TKT_max', $max ); |
|
631 | + function set_max($max) { |
|
632 | + $this->set('TKT_max', $max); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @param float $price |
640 | 640 | * @return boolean |
641 | 641 | */ |
642 | - function set_price( $price ) { |
|
643 | - $this->set( 'TKT_price', $price ); |
|
642 | + function set_price($price) { |
|
643 | + $this->set('TKT_price', $price); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @return int |
651 | 651 | */ |
652 | 652 | function sold() { |
653 | - return $this->get_raw( 'TKT_sold' ); |
|
653 | + return $this->get_raw('TKT_sold'); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | * @param int $qty |
661 | 661 | * @return boolean |
662 | 662 | */ |
663 | - function increase_sold( $qty = 1 ) { |
|
663 | + function increase_sold($qty = 1) { |
|
664 | 664 | $sold = $this->sold() + $qty; |
665 | - $this->_increase_sold_for_datetimes( $qty ); |
|
666 | - return $this->set_sold( $sold ); |
|
665 | + $this->_increase_sold_for_datetimes($qty); |
|
666 | + return $this->set_sold($sold); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | * @param int $qty |
674 | 674 | * @return boolean |
675 | 675 | */ |
676 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
676 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
677 | 677 | $datetimes = $this->datetimes(); |
678 | - if ( is_array( $datetimes ) ) { |
|
679 | - foreach ( $datetimes as $datetime ) { |
|
680 | - if ( $datetime instanceof EE_Datetime ) { |
|
681 | - $datetime->increase_sold( $qty ); |
|
678 | + if (is_array($datetimes)) { |
|
679 | + foreach ($datetimes as $datetime) { |
|
680 | + if ($datetime instanceof EE_Datetime) { |
|
681 | + $datetime->increase_sold($qty); |
|
682 | 682 | $datetime->save(); |
683 | 683 | } |
684 | 684 | } |
@@ -692,10 +692,10 @@ discard block |
||
692 | 692 | * @param int $sold |
693 | 693 | * @return boolean |
694 | 694 | */ |
695 | - function set_sold( $sold ) { |
|
695 | + function set_sold($sold) { |
|
696 | 696 | // sold can not go below zero |
697 | - $sold = max( 0, $sold ); |
|
698 | - $this->set( 'TKT_sold', $sold ); |
|
697 | + $sold = max(0, $sold); |
|
698 | + $this->set('TKT_sold', $sold); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
@@ -705,10 +705,10 @@ discard block |
||
705 | 705 | * @param int $qty |
706 | 706 | * @return boolean |
707 | 707 | */ |
708 | - function decrease_sold( $qty = 1 ) { |
|
708 | + function decrease_sold($qty = 1) { |
|
709 | 709 | $sold = $this->sold() - $qty; |
710 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
711 | - return $this->set_sold( $sold ); |
|
710 | + $this->_decrease_sold_for_datetimes($qty); |
|
711 | + return $this->set_sold($sold); |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | |
@@ -719,12 +719,12 @@ discard block |
||
719 | 719 | * @param int $qty |
720 | 720 | * @return boolean |
721 | 721 | */ |
722 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
722 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
723 | 723 | $datetimes = $this->datetimes(); |
724 | - if ( is_array( $datetimes ) ) { |
|
725 | - foreach ( $datetimes as $datetime ) { |
|
726 | - if ( $datetime instanceof EE_Datetime ) { |
|
727 | - $datetime->decrease_sold( $qty ); |
|
724 | + if (is_array($datetimes)) { |
|
725 | + foreach ($datetimes as $datetime) { |
|
726 | + if ($datetime instanceof EE_Datetime) { |
|
727 | + $datetime->decrease_sold($qty); |
|
728 | 728 | $datetime->save(); |
729 | 729 | } |
730 | 730 | } |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @return int |
747 | 747 | */ |
748 | - function qty( $context = '' ) { |
|
749 | - switch ( $context ) { |
|
748 | + function qty($context = '') { |
|
749 | + switch ($context) { |
|
750 | 750 | case 'reg_limit' : |
751 | 751 | return $this->real_quantity_on_ticket(); |
752 | 752 | case 'saleable' : |
753 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
753 | + return $this->real_quantity_on_ticket('saleable'); |
|
754 | 754 | default: |
755 | - return $this->get_raw( 'TKT_qty' ); |
|
755 | + return $this->get_raw('TKT_qty'); |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
@@ -769,38 +769,38 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @return int |
771 | 771 | */ |
772 | - function real_quantity_on_ticket( $context = 'reg_limit' ) { |
|
772 | + function real_quantity_on_ticket($context = 'reg_limit') { |
|
773 | 773 | // start with the original db value for ticket quantity |
774 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
774 | + $raw = $this->get_raw('TKT_qty'); |
|
775 | 775 | // return immediately if it's zero |
776 | - if ( $raw === 0 ) { |
|
776 | + if ($raw === 0) { |
|
777 | 777 | return $raw; |
778 | 778 | } |
779 | 779 | // ensure qty doesn't exceed raw value for THIS ticket |
780 | - $qty = min( EE_INF, $raw ); |
|
780 | + $qty = min(EE_INF, $raw); |
|
781 | 781 | // NOW that we know the maximum number of tickets available for the ticket |
782 | 782 | // we need to calculate the maximum number of tickets available for the datetime |
783 | 783 | // without really factoring this ticket into the calculations |
784 | 784 | $datetimes = $this->datetimes(); |
785 | - foreach ( $datetimes as $datetime ) { |
|
786 | - if ( $datetime instanceof EE_Datetime ) { |
|
785 | + foreach ($datetimes as $datetime) { |
|
786 | + if ($datetime instanceof EE_Datetime) { |
|
787 | 787 | // initialize with no restrictions for each datetime |
788 | 788 | // but adjust datetime qty based on datetime reg limit |
789 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
789 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
790 | 790 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
791 | 791 | // for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in) |
792 | - if ( $context == 'saleable' ) { |
|
793 | - $datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 ); |
|
792 | + if ($context == 'saleable') { |
|
793 | + $datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0); |
|
794 | 794 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
795 | 795 | } |
796 | - $qty = min( $datetime_qty, $qty ); |
|
796 | + $qty = min($datetime_qty, $qty); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | } |
800 | 800 | // we need to factor in the details for this specific ticket |
801 | - if ( $qty > 0 && $context == 'saleable' ) { |
|
801 | + if ($qty > 0 && $context == 'saleable') { |
|
802 | 802 | // and subtract the sales for THIS ticket |
803 | - $qty = max( $qty - $this->sold(), 0 ); |
|
803 | + $qty = max($qty - $this->sold(), 0); |
|
804 | 804 | //echo ' $qty: ' . $qty . "<br />"; |
805 | 805 | } |
806 | 806 | //echo '$qty: ' . $qty . "<br />"; |
@@ -816,14 +816,14 @@ discard block |
||
816 | 816 | * @return bool |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - function set_qty( $qty ) { |
|
819 | + function set_qty($qty) { |
|
820 | 820 | $datetimes = $this->datetimes(); |
821 | - foreach ( $datetimes as $datetime ) { |
|
822 | - if ( $datetime instanceof EE_Datetime ) { |
|
823 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
821 | + foreach ($datetimes as $datetime) { |
|
822 | + if ($datetime instanceof EE_Datetime) { |
|
823 | + $qty = min($qty, $datetime->reg_limit()); |
|
824 | 824 | } |
825 | 825 | } |
826 | - $this->set( 'TKT_qty', $qty ); |
|
826 | + $this->set('TKT_qty', $qty); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | * @return int |
834 | 834 | */ |
835 | 835 | function uses() { |
836 | - return $this->get( 'TKT_uses' ); |
|
836 | + return $this->get('TKT_uses'); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | * @param int $uses |
844 | 844 | * @return boolean |
845 | 845 | */ |
846 | - function set_uses( $uses ) { |
|
847 | - $this->set( 'TKT_uses', $uses ); |
|
846 | + function set_uses($uses) { |
|
847 | + $this->set('TKT_uses', $uses); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | * @return boolean |
855 | 855 | */ |
856 | 856 | public function required() { |
857 | - return $this->get( 'TKT_required' ); |
|
857 | + return $this->get('TKT_required'); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | |
@@ -864,8 +864,8 @@ discard block |
||
864 | 864 | * @param boolean $required |
865 | 865 | * @return boolean |
866 | 866 | */ |
867 | - public function set_required( $required ) { |
|
868 | - $this->set( 'TKT_required', $required ); |
|
867 | + public function set_required($required) { |
|
868 | + $this->set('TKT_required', $required); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | * @return boolean |
876 | 876 | */ |
877 | 877 | function taxable() { |
878 | - return $this->get( 'TKT_taxable' ); |
|
878 | + return $this->get('TKT_taxable'); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -885,8 +885,8 @@ discard block |
||
885 | 885 | * @param boolean $taxable |
886 | 886 | * @return boolean |
887 | 887 | */ |
888 | - function set_taxable( $taxable ) { |
|
889 | - $this->set( 'TKT_taxable', $taxable ); |
|
888 | + function set_taxable($taxable) { |
|
889 | + $this->set('TKT_taxable', $taxable); |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * @return boolean |
897 | 897 | */ |
898 | 898 | function is_default() { |
899 | - return $this->get( 'TKT_is_default' ); |
|
899 | + return $this->get('TKT_is_default'); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | |
@@ -906,8 +906,8 @@ discard block |
||
906 | 906 | * @param boolean $is_default |
907 | 907 | * @return boolean |
908 | 908 | */ |
909 | - function set_is_default( $is_default ) { |
|
910 | - $this->set( 'TKT_is_default', $is_default ); |
|
909 | + function set_is_default($is_default) { |
|
910 | + $this->set('TKT_is_default', $is_default); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | * @return int |
918 | 918 | */ |
919 | 919 | function order() { |
920 | - return $this->get( 'TKT_order' ); |
|
920 | + return $this->get('TKT_order'); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | * @param int $order |
928 | 928 | * @return boolean |
929 | 929 | */ |
930 | - function set_order( $order ) { |
|
931 | - $this->set( 'TKT_order', $order ); |
|
930 | + function set_order($order) { |
|
931 | + $this->set('TKT_order', $order); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | * @return int |
939 | 939 | */ |
940 | 940 | function row() { |
941 | - return $this->get( 'TKT_row' ); |
|
941 | + return $this->get('TKT_row'); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
@@ -948,8 +948,8 @@ discard block |
||
948 | 948 | * @param int $row |
949 | 949 | * @return boolean |
950 | 950 | */ |
951 | - function set_row( $row ) { |
|
952 | - $this->set( 'TKT_row', $row ); |
|
951 | + function set_row($row) { |
|
952 | + $this->set('TKT_row', $row); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | * @return boolean |
960 | 960 | */ |
961 | 961 | function deleted() { |
962 | - return $this->get( 'TKT_deleted' ); |
|
962 | + return $this->get('TKT_deleted'); |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | * @param boolean $deleted |
970 | 970 | * @return boolean |
971 | 971 | */ |
972 | - function set_deleted( $deleted ) { |
|
973 | - $this->set( 'TKT_deleted', $deleted ); |
|
972 | + function set_deleted($deleted) { |
|
973 | + $this->set('TKT_deleted', $deleted); |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | * @return int |
981 | 981 | */ |
982 | 982 | function parent_ID() { |
983 | - return $this->get( 'TKT_parent' ); |
|
983 | + return $this->get('TKT_parent'); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | |
@@ -990,8 +990,8 @@ discard block |
||
990 | 990 | * @param int $parent |
991 | 991 | * @return boolean |
992 | 992 | */ |
993 | - function set_parent_ID( $parent ) { |
|
994 | - $this->set( 'TKT_parent', $parent ); |
|
993 | + function set_parent_ID($parent) { |
|
994 | + $this->set('TKT_parent', $parent); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | |
@@ -1002,10 +1002,10 @@ discard block |
||
1002 | 1002 | */ |
1003 | 1003 | function name_and_info() { |
1004 | 1004 | $times = array(); |
1005 | - foreach ( $this->datetimes() as $datetime ) { |
|
1005 | + foreach ($this->datetimes() as $datetime) { |
|
1006 | 1006 | $times[] = $datetime->start_date_and_time(); |
1007 | 1007 | } |
1008 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
1008 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | * @return string |
1016 | 1016 | */ |
1017 | 1017 | function name() { |
1018 | - return $this->get( 'TKT_name' ); |
|
1018 | + return $this->get('TKT_name'); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | * @return float |
1026 | 1026 | */ |
1027 | 1027 | function price() { |
1028 | - return $this->get( 'TKT_price' ); |
|
1028 | + return $this->get('TKT_price'); |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | * @param array $query_params like EEM_Base::get_all's |
1036 | 1036 | * @return EE_Registration[] |
1037 | 1037 | */ |
1038 | - public function registrations( $query_params = array() ) { |
|
1039 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1038 | + public function registrations($query_params = array()) { |
|
1039 | + return $this->get_many_related('Registration', $query_params); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | |
@@ -1047,8 +1047,8 @@ discard block |
||
1047 | 1047 | * @return int |
1048 | 1048 | */ |
1049 | 1049 | public function update_tickets_sold() { |
1050 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
1051 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
1050 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
1051 | + $this->set_sold($count_regs_for_this_ticket); |
|
1052 | 1052 | $this->save(); |
1053 | 1053 | return $count_regs_for_this_ticket; |
1054 | 1054 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @param array $query_params like EEM_Base::get_all's |
1061 | 1061 | * @return int |
1062 | 1062 | */ |
1063 | - public function count_registrations( $query_params = array() ) { |
|
1063 | + public function count_registrations($query_params = array()) { |
|
1064 | 1064 | return $this->count_related('Registration', $query_params); |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | public function get_related_event() { |
1086 | 1086 | //get one datetime to use for getting the event |
1087 | 1087 | $datetime = $this->first_datetime(); |
1088 | - if ( $datetime instanceof EE_Datetime ) { |
|
1088 | + if ($datetime instanceof EE_Datetime) { |
|
1089 | 1089 | return $datetime->event(); |
1090 | 1090 | } |
1091 | 1091 | return null; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * This returns the chronologically last datetime that this ticket is associated with |
240 | 240 | * @param string $dt_frmt |
241 | 241 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
242 | - * @return array |
|
242 | + * @return string |
|
243 | 243 | */ |
244 | 244 | public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
245 | 245 | $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
382 | 382 | * @param array $query_params see EEM_Base::get_all() |
383 | - * @return EE_Datetime_Ticket |
|
383 | + * @return EE_Base_Class[] |
|
384 | 384 | */ |
385 | 385 | public function datetime_tickets( $query_params = array() ) { |
386 | 386 | return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | /** |
515 | 515 | * Sets name |
516 | 516 | * @param string $name |
517 | - * @return boolean |
|
517 | + * @return boolean|null |
|
518 | 518 | */ |
519 | 519 | function set_name( $name ) { |
520 | 520 | $this->set( 'TKT_name', $name ); |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | /** |
536 | 536 | * Sets description |
537 | 537 | * @param string $description |
538 | - * @return boolean |
|
538 | + * @return boolean|null |
|
539 | 539 | */ |
540 | 540 | function set_description( $description ) { |
541 | 541 | $this->set( 'TKT_description', $description ); |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | /** |
606 | 606 | * Sets min |
607 | 607 | * @param int $min |
608 | - * @return boolean |
|
608 | + * @return boolean|null |
|
609 | 609 | */ |
610 | 610 | function set_min( $min ) { |
611 | 611 | $this->set( 'TKT_min', $min ); |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | /** |
627 | 627 | * Sets max |
628 | 628 | * @param int $max |
629 | - * @return boolean |
|
629 | + * @return boolean|null |
|
630 | 630 | */ |
631 | 631 | function set_max( $max ) { |
632 | 632 | $this->set( 'TKT_max', $max ); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | /** |
638 | 638 | * Sets price |
639 | 639 | * @param float $price |
640 | - * @return boolean |
|
640 | + * @return boolean|null |
|
641 | 641 | */ |
642 | 642 | function set_price( $price ) { |
643 | 643 | $this->set( 'TKT_price', $price ); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | /** |
659 | 659 | * increments sold by amount passed by $qty |
660 | 660 | * @param int $qty |
661 | - * @return boolean |
|
661 | + * @return boolean|null |
|
662 | 662 | */ |
663 | 663 | function increase_sold( $qty = 1 ) { |
664 | 664 | $sold = $this->sold() + $qty; |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | /** |
672 | 672 | * Increases sold on related datetimes |
673 | 673 | * @param int $qty |
674 | - * @return boolean |
|
674 | + * @return boolean|null |
|
675 | 675 | */ |
676 | 676 | protected function _increase_sold_for_datetimes( $qty = 1 ) { |
677 | 677 | $datetimes = $this->datetimes(); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | /** |
691 | 691 | * Sets sold |
692 | 692 | * @param int $sold |
693 | - * @return boolean |
|
693 | + * @return boolean|null |
|
694 | 694 | */ |
695 | 695 | function set_sold( $sold ) { |
696 | 696 | // sold can not go below zero |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | /** |
704 | 704 | * decrements (subtracts) sold by amount passed by $qty |
705 | 705 | * @param int $qty |
706 | - * @return boolean |
|
706 | + * @return boolean|null |
|
707 | 707 | */ |
708 | 708 | function decrease_sold( $qty = 1 ) { |
709 | 709 | $sold = $this->sold() - $qty; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | * Decreases sold on related datetimes |
718 | 718 | * |
719 | 719 | * @param int $qty |
720 | - * @return boolean |
|
720 | + * @return boolean|null |
|
721 | 721 | */ |
722 | 722 | protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
723 | 723 | $datetimes = $this->datetimes(); |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * Sets qty - IMPORTANT!!! Does NOT allow QTY to be set higher than the lowest reg limit of any related datetimes |
814 | 814 | * |
815 | 815 | * @param int $qty |
816 | - * @return bool |
|
816 | + * @return boolean|null |
|
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | 819 | function set_qty( $qty ) { |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | /** |
842 | 842 | * Sets uses |
843 | 843 | * @param int $uses |
844 | - * @return boolean |
|
844 | + * @return boolean|null |
|
845 | 845 | */ |
846 | 846 | function set_uses( $uses ) { |
847 | 847 | $this->set( 'TKT_uses', $uses ); |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | /** |
863 | 863 | * sets the TKT_required property |
864 | 864 | * @param boolean $required |
865 | - * @return boolean |
|
865 | + * @return boolean|null |
|
866 | 866 | */ |
867 | 867 | public function set_required( $required ) { |
868 | 868 | $this->set( 'TKT_required', $required ); |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | /** |
884 | 884 | * Sets taxable |
885 | 885 | * @param boolean $taxable |
886 | - * @return boolean |
|
886 | + * @return boolean|null |
|
887 | 887 | */ |
888 | 888 | function set_taxable( $taxable ) { |
889 | 889 | $this->set( 'TKT_taxable', $taxable ); |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | /** |
905 | 905 | * Sets is_default |
906 | 906 | * @param boolean $is_default |
907 | - * @return boolean |
|
907 | + * @return boolean|null |
|
908 | 908 | */ |
909 | 909 | function set_is_default( $is_default ) { |
910 | 910 | $this->set( 'TKT_is_default', $is_default ); |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | /** |
926 | 926 | * Sets order |
927 | 927 | * @param int $order |
928 | - * @return boolean |
|
928 | + * @return boolean|null |
|
929 | 929 | */ |
930 | 930 | function set_order( $order ) { |
931 | 931 | $this->set( 'TKT_order', $order ); |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | /** |
947 | 947 | * Sets row |
948 | 948 | * @param int $row |
949 | - * @return boolean |
|
949 | + * @return boolean|null |
|
950 | 950 | */ |
951 | 951 | function set_row( $row ) { |
952 | 952 | $this->set( 'TKT_row', $row ); |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | /** |
968 | 968 | * Sets deleted |
969 | 969 | * @param boolean $deleted |
970 | - * @return boolean |
|
970 | + * @return boolean|null |
|
971 | 971 | */ |
972 | 972 | function set_deleted( $deleted ) { |
973 | 973 | $this->set( 'TKT_deleted', $deleted ); |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | /** |
989 | 989 | * Sets parent |
990 | 990 | * @param int $parent |
991 | - * @return boolean |
|
991 | + * @return boolean|null |
|
992 | 992 | */ |
993 | 993 | function set_parent_ID( $parent ) { |
994 | 994 | $this->set( 'TKT_parent', $parent ); |
@@ -714,11 +714,11 @@ |
||
714 | 714 | |
715 | 715 | |
716 | 716 | /** |
717 | - * Decreases sold on related datetimes |
|
718 | - * |
|
719 | - * @param int $qty |
|
720 | - * @return boolean |
|
721 | - */ |
|
717 | + * Decreases sold on related datetimes |
|
718 | + * |
|
719 | + * @param int $qty |
|
720 | + * @return boolean |
|
721 | + */ |
|
722 | 722 | protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
723 | 723 | $datetimes = $this->datetimes(); |
724 | 724 | if ( is_array( $datetimes ) ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Price|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone, $date_formats ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone, $date_formats); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Price |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //is for lower than 4.8.33 |
14 | 14 | add_filter( |
15 | 15 | 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
16 | - array( $this, 'remove_checkin_routes_earlier_than_4_8_33' ), |
|
16 | + array($this, 'remove_checkin_routes_earlier_than_4_8_33'), |
|
17 | 17 | 10, |
18 | 18 | 2 |
19 | 19 | ); |
20 | 20 | add_filter( |
21 | 21 | 'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return', |
22 | - array( $this, 'dont_add_headers_from_ee_notices' ), |
|
22 | + array($this, 'dont_add_headers_from_ee_notices'), |
|
23 | 23 | 10, |
24 | 24 | 2 |
25 | 25 | ); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @param string $version |
33 | 33 | * @return array like $routes_on_this_version |
34 | 34 | */ |
35 | - public function remove_checkin_routes_earlier_than_4_8_33( $routes_on_this_version, $version ) { |
|
36 | - if( $this->applies_to_version( $version ) ) { |
|
37 | - unset( $routes_on_this_version[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] ); |
|
35 | + public function remove_checkin_routes_earlier_than_4_8_33($routes_on_this_version, $version) { |
|
36 | + if ($this->applies_to_version($version)) { |
|
37 | + unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']); |
|
38 | 38 | } |
39 | 39 | return $routes_on_this_version; |
40 | 40 | } |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param string $requested_version |
46 | 46 | * @return array |
47 | 47 | */ |
48 | - public function dont_add_headers_from_ee_notices( $headers_from_ee_notices, $requested_version ) { |
|
49 | - if( $this->applies_to_version( $requested_version ) ) { |
|
48 | + public function dont_add_headers_from_ee_notices($headers_from_ee_notices, $requested_version) { |
|
49 | + if ($this->applies_to_version($requested_version)) { |
|
50 | 50 | return array(); |
51 | 51 | } |
52 | 52 | return $headers_from_ee_notices; |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @return boolean true: this class' name indicates its filters and actions |
57 | 57 | * should take effect. False: this class' name indicates it shouldn't do anything |
58 | 58 | */ |
59 | - public function applies_to_version( $requested_version ) { |
|
60 | - if( $this->version() > $requested_version ) { |
|
59 | + public function applies_to_version($requested_version) { |
|
60 | + if ($this->version() > $requested_version) { |
|
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | return false; |
@@ -71,24 +71,24 @@ discard block |
||
71 | 71 | * @throws \EE_Error |
72 | 72 | */ |
73 | 73 | public function version() { |
74 | - if( $this->_version === null ) { |
|
74 | + if ($this->_version === null) { |
|
75 | 75 | $matches = array(); |
76 | 76 | $regex = '~Changes_In_(.*)_(.*)_(.*)$~'; |
77 | 77 | $success = preg_match( |
78 | 78 | $regex, |
79 | - get_class( $this ), |
|
79 | + get_class($this), |
|
80 | 80 | $matches |
81 | 81 | ); |
82 | - if( ! $success ) { |
|
82 | + if ( ! $success) { |
|
83 | 83 | throw new \EE_Error( |
84 | 84 | sprintf( |
85 | - __( 'The class %1$s was misnamed. It name should match the regex "%2$s"', 'event_espresso' ), |
|
86 | - get_class( $this ), |
|
85 | + __('The class %1$s was misnamed. It name should match the regex "%2$s"', 'event_espresso'), |
|
86 | + get_class($this), |
|
87 | 87 | $regex |
88 | 88 | ) |
89 | 89 | ); |
90 | 90 | } |
91 | - $this->_version = $matches[1] . '.' . $matches[2] . '.' . $matches[3]; |
|
91 | + $this->_version = $matches[1].'.'.$matches[2].'.'.$matches[3]; |
|
92 | 92 | } |
93 | 93 | return $this->_version; |
94 | 94 | } |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | use EventEspresso\core\libraries\rest_api\controllers\Base as Base; |
3 | 3 | use EventEspresso\core\libraries\rest_api\controllers\model\Read; |
4 | 4 | |
5 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
6 | - exit( 'No direct script access allowed' ); |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | + exit('No direct script access allowed'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | /** |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * @param \WP_REST_Request $request |
25 | 25 | * @return \WP_Error|\WP_REST_Response |
26 | 26 | */ |
27 | - public static function handle_request_toggle_checkin( \WP_REST_Request $request ) { |
|
27 | + public static function handle_request_toggle_checkin(\WP_REST_Request $request) { |
|
28 | 28 | $controller = new Checkin(); |
29 | - return $controller->_create_checkin_checkout_object( $request ); |
|
29 | + return $controller->_create_checkin_checkout_object($request); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
@@ -37,47 +37,47 @@ discard block |
||
37 | 37 | * @param \WP_REST_Request $request |
38 | 38 | * @return \WP_Error|\WP_REST_Response |
39 | 39 | */ |
40 | - protected function _create_checkin_checkout_object( \WP_REST_Request $request ) { |
|
41 | - $reg_id = $request->get_param( 'REG_ID' ); |
|
42 | - $dtt_id = $request->get_param( 'DTT_ID' ); |
|
43 | - $force = $request->get_param( 'force' ); |
|
44 | - if( $force == 'true' ) { |
|
40 | + protected function _create_checkin_checkout_object(\WP_REST_Request $request) { |
|
41 | + $reg_id = $request->get_param('REG_ID'); |
|
42 | + $dtt_id = $request->get_param('DTT_ID'); |
|
43 | + $force = $request->get_param('force'); |
|
44 | + if ($force == 'true') { |
|
45 | 45 | $force = true; |
46 | 46 | } else { |
47 | 47 | $force = false; |
48 | 48 | } |
49 | - $reg = \EEM_Registration::instance()->get_one_by_ID( $reg_id ); |
|
50 | - if( ! $reg instanceof \EE_Registration ) { |
|
49 | + $reg = \EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
50 | + if ( ! $reg instanceof \EE_Registration) { |
|
51 | 51 | return $this->send_response( |
52 | 52 | new \WP_Error( |
53 | 53 | 'rest_registration_toggle_checkin_invalid_id', |
54 | 54 | sprintf( |
55 | - __( 'You cannot checkin registration with ID %1$s because it doesn\'t exist.', 'event_espresso' ), |
|
55 | + __('You cannot checkin registration with ID %1$s because it doesn\'t exist.', 'event_espresso'), |
|
56 | 56 | $reg_id |
57 | 57 | ), |
58 | - array( 'status' => 422 ) |
|
58 | + array('status' => 422) |
|
59 | 59 | ) |
60 | 60 | ); |
61 | 61 | } |
62 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id ) ) { |
|
62 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) { |
|
63 | 63 | return $this->send_response( |
64 | 64 | new \WP_Error( |
65 | 65 | 'rest_user_cannot_toggle_checkin', |
66 | 66 | sprintf( |
67 | - __( 'You are not allowed to checkin registration with ID %1$s.', 'event_espresso' ), |
|
67 | + __('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'), |
|
68 | 68 | $reg_id |
69 | 69 | ), |
70 | - array( 'status' => 403 ) |
|
70 | + array('status' => 403) |
|
71 | 71 | ) |
72 | 72 | ); |
73 | 73 | } |
74 | - $success = $reg->toggle_checkin_status( $dtt_id, ! $force ); |
|
75 | - if( $success === false ) { |
|
74 | + $success = $reg->toggle_checkin_status($dtt_id, ! $force); |
|
75 | + if ($success === false) { |
|
76 | 76 | //rely on EE_Error::add_error messages to have been added to give more data about hwy it failed |
77 | 77 | return $this->send_response( |
78 | 78 | new \WP_Error( |
79 | 79 | 'rest_toggle_checkin_failed', |
80 | - __( 'Registration checkin failed. Please see additional error data.', 'event_espresso' ) |
|
80 | + __('Registration checkin failed. Please see additional error data.', 'event_espresso') |
|
81 | 81 | ) |
82 | 82 | ); |
83 | 83 | } |
@@ -92,28 +92,28 @@ discard block |
||
92 | 92 | ) |
93 | 93 | ) |
94 | 94 | ); |
95 | - if( ! $checkin instanceof \EE_Checkin ) { |
|
95 | + if ( ! $checkin instanceof \EE_Checkin) { |
|
96 | 96 | return $this->send_response( |
97 | 97 | new \WP_Error( |
98 | 98 | 'rest_toggle_checkin_error', |
99 | 99 | sprintf( |
100 | - __( 'Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', 'event_espresso' ), |
|
100 | + __('Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', 'event_espresso'), |
|
101 | 101 | $reg_id, |
102 | 102 | $dtt_id |
103 | 103 | ) |
104 | 104 | ) |
105 | 105 | ); |
106 | 106 | } |
107 | - $requested_version = $this->get_requested_version( $request->get_route() ); |
|
107 | + $requested_version = $this->get_requested_version($request->get_route()); |
|
108 | 108 | $get_request = new \WP_REST_Request( |
109 | 109 | 'GET', |
110 | - \EED_Core_Rest_Api::ee_api_namespace . $requested_version . '/checkins/' . $checkin->ID() |
|
110 | + \EED_Core_Rest_Api::ee_api_namespace.$requested_version.'/checkins/'.$checkin->ID() |
|
111 | 111 | ); |
112 | 112 | $get_request->set_url_params( |
113 | 113 | array( |
114 | 114 | 'id' => $checkin->ID() |
115 | 115 | ) |
116 | 116 | ); |
117 | - return Read::handle_request_get_one( $get_request ); |
|
117 | + return Read::handle_request_get_one($get_request); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -2430,7 +2430,7 @@ discard block |
||
2430 | 2430 | * @param int $GRP_ID The group being deleted |
2431 | 2431 | * @param bool $include_group whether to delete the Message Template Group as well. |
2432 | 2432 | * |
2433 | - * @return bool boolean to indicate the success of the deletes or not. |
|
2433 | + * @return integer boolean to indicate the success of the deletes or not. |
|
2434 | 2434 | */ |
2435 | 2435 | private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) { |
2436 | 2436 | $success = 1; |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | * This just prepares the content for the message type settings |
2566 | 2566 | * |
2567 | 2567 | * @param object $message_type The message type object |
2568 | - * @param object $messenger The messenger object |
|
2568 | + * @param EE_messenger|null $messenger The messenger object |
|
2569 | 2569 | * @param boolean $active Whether the message type is active or not |
2570 | 2570 | * |
2571 | 2571 | * @return string html output for the content |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * |
103 | 103 | * @throws EE_Error |
104 | - */ |
|
104 | + */ |
|
105 | 105 | protected function _load_message_resource_manager() { |
106 | 106 | $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
107 | 107 | } |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | |
212 | 212 | /** |
213 | 213 | * an array for storing key => value pairs of request actions and their corresponding methods |
214 | - * @access protected |
|
215 | - * @return void |
|
216 | - */ |
|
214 | + * @access protected |
|
215 | + * @return void |
|
216 | + */ |
|
217 | 217 | protected function _set_page_routes() { |
218 | 218 | $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
219 | 219 | ? $this->_req_data['GRP_ID'] |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | protected function _add_screen_options_global_mtps() { |
518 | 518 | /** |
519 | 519 | * Note: the reason for the value swap here on $this->_admin_page_title is because $this->_per_page_screen_options |
520 | - * uses the $_admin_page_title property and we want different outputs in the different spots. |
|
521 | - */ |
|
520 | + * uses the $_admin_page_title property and we want different outputs in the different spots. |
|
521 | + */ |
|
522 | 522 | $page_title = $this->_admin_page_title; |
523 | 523 | $this->_admin_page_title = __('Global Message Templates', 'event_espresso'); |
524 | 524 | $this->_per_page_screen_option(); |
@@ -721,9 +721,9 @@ discard block |
||
721 | 721 | $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
722 | 722 | ? array( |
723 | 723 | 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
724 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
725 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
726 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
724 | + 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
725 | + 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
726 | + 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
727 | 727 | ) |
728 | 728 | : array(); |
729 | 729 | |
@@ -734,10 +734,10 @@ discard block |
||
734 | 734 | |
735 | 735 | $this->_views = array( |
736 | 736 | 'all' => array( |
737 | - 'slug' => 'all', |
|
738 | - 'label' => __( 'All', 'event_espresso' ), |
|
739 | - 'count' => 0, |
|
740 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
737 | + 'slug' => 'all', |
|
738 | + 'label' => __( 'All', 'event_espresso' ), |
|
739 | + 'count' => 0, |
|
740 | + 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
741 | 741 | ) |
742 | 742 | ); |
743 | 743 | |
@@ -1127,9 +1127,9 @@ discard block |
||
1127 | 1127 | && in_array($extra_field, $v_fields) |
1128 | 1128 | && |
1129 | 1129 | ( |
1130 | - is_array($validators[$extra_field] ) |
|
1130 | + is_array($validators[$extra_field] ) |
|
1131 | 1131 | && isset( $validators[$extra_field]['msg'] ) |
1132 | - ) |
|
1132 | + ) |
|
1133 | 1133 | ? 'validate-error ' . $css_class |
1134 | 1134 | : $css_class; |
1135 | 1135 | |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | $GRP_ID, |
1415 | 1415 | false, |
1416 | 1416 | add_query_arg( |
1417 | - array( 'action' => 'global_mtps' ), |
|
1418 | - $this->_admin_base_url |
|
1417 | + array( 'action' => 'global_mtps' ), |
|
1418 | + $this->_admin_base_url |
|
1419 | 1419 | ) |
1420 | 1420 | ); |
1421 | 1421 | |
@@ -1890,14 +1890,14 @@ discard block |
||
1890 | 1890 | |
1891 | 1891 | |
1892 | 1892 | /** |
1893 | - * This returns the shortcode selector skeleton for a given context and field. |
|
1894 | - * |
|
1895 | - * @since 4.9.rc.000 |
|
1896 | - * |
|
1893 | + * This returns the shortcode selector skeleton for a given context and field. |
|
1894 | + * |
|
1895 | + * @since 4.9.rc.000 |
|
1896 | + * |
|
1897 | 1897 | * @param string $field The name of the field retrieving shortcodes for. |
1898 | - * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
1899 | - * @return string |
|
1900 | - */ |
|
1898 | + * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
1899 | + * @return string |
|
1900 | + */ |
|
1901 | 1901 | protected function _get_shortcode_selector( $field, $linked_input_id ) { |
1902 | 1902 | $template_args = array( |
1903 | 1903 | 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
@@ -2495,9 +2495,9 @@ discard block |
||
2495 | 2495 | |
2496 | 2496 | /** |
2497 | 2497 | * _learn_more_about_message_templates_link |
2498 | - * @access protected |
|
2499 | - * @return string |
|
2500 | - */ |
|
2498 | + * @access protected |
|
2499 | + * @return string |
|
2500 | + */ |
|
2501 | 2501 | protected function _learn_more_about_message_templates_link() { |
2502 | 2502 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
2503 | 2503 | } |
@@ -3038,7 +3038,7 @@ discard block |
||
3038 | 3038 | /** @var EE_message_type $message_type */ |
3039 | 3039 | $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
3040 | 3040 | if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
3041 | - && $message_type instanceof EE_message_type |
|
3041 | + && $message_type instanceof EE_message_type |
|
3042 | 3042 | ) { |
3043 | 3043 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3044 | 3044 | if ( $message_type->get_admin_settings_fields() ) { |
@@ -3374,10 +3374,10 @@ discard block |
||
3374 | 3374 | |
3375 | 3375 | /** |
3376 | 3376 | * This immediately generates any EE_Message ID's that are selected that are EEM_Message::status_incomplete |
3377 | - * However, this does not send immediately, it just queues for sending. |
|
3378 | - * |
|
3379 | - * @since 4.9.0 |
|
3380 | - */ |
|
3377 | + * However, this does not send immediately, it just queues for sending. |
|
3378 | + * |
|
3379 | + * @since 4.9.0 |
|
3380 | + */ |
|
3381 | 3381 | protected function _generate_now() { |
3382 | 3382 | $msg_ids = $this->_get_msg_ids_from_request(); |
3383 | 3383 | EED_Messages::generate_now( $msg_ids ); |
@@ -3388,11 +3388,11 @@ discard block |
||
3388 | 3388 | |
3389 | 3389 | /** |
3390 | 3390 | * This immediately generates AND sends any EE_Message's selected that are EEM_Message::status_incomplete or that are |
3391 | - * EEM_Message::status_resend or EEM_Message::status_idle |
|
3392 | - * |
|
3393 | - * @since 4.9.0 |
|
3394 | - * |
|
3395 | - */ |
|
3391 | + * EEM_Message::status_resend or EEM_Message::status_idle |
|
3392 | + * |
|
3393 | + * @since 4.9.0 |
|
3394 | + * |
|
3395 | + */ |
|
3396 | 3396 | protected function _generate_and_send_now() { |
3397 | 3397 | $this->_generate_now(); |
3398 | 3398 | $this->_send_now(); |
@@ -3405,9 +3405,9 @@ discard block |
||
3405 | 3405 | |
3406 | 3406 | /** |
3407 | 3407 | * This queues any EEM_Message::status_sent EE_Message ids in the request for resending. |
3408 | - * |
|
3409 | - * @since 4.9.0 |
|
3410 | - */ |
|
3408 | + * |
|
3409 | + * @since 4.9.0 |
|
3410 | + */ |
|
3411 | 3411 | protected function _queue_for_resending() { |
3412 | 3412 | $msg_ids = $this->_get_msg_ids_from_request(); |
3413 | 3413 | EED_Messages::queue_for_resending( $msg_ids ); |
@@ -3419,9 +3419,9 @@ discard block |
||
3419 | 3419 | |
3420 | 3420 | /** |
3421 | 3421 | * This sends immediately any EEM_Message::status_idle or EEM_Message::status_resend messages in the queue |
3422 | - * |
|
3423 | - * @since 4.9.0 |
|
3424 | - */ |
|
3422 | + * |
|
3423 | + * @since 4.9.0 |
|
3424 | + */ |
|
3425 | 3425 | protected function _send_now() { |
3426 | 3426 | $msg_ids = $this->_get_msg_ids_from_request(); |
3427 | 3427 | EED_Messages::send_now( $msg_ids ); |
@@ -3433,9 +3433,9 @@ discard block |
||
3433 | 3433 | |
3434 | 3434 | /** |
3435 | 3435 | * Deletes EE_messages for IDs in the request. |
3436 | - * |
|
3437 | - * @since 4.9.0 |
|
3438 | - */ |
|
3436 | + * |
|
3437 | + * @since 4.9.0 |
|
3438 | + */ |
|
3439 | 3439 | protected function _delete_ee_messages() { |
3440 | 3440 | $msg_ids = $this->_get_msg_ids_from_request(); |
3441 | 3441 | $deleted_count = 0; |
@@ -3464,9 +3464,9 @@ discard block |
||
3464 | 3464 | |
3465 | 3465 | /** |
3466 | 3466 | * This looks for 'MSG_ID' key in the request and returns an array of MSG_ID's if present. |
3467 | - * @since 4.9.0 |
|
3468 | - * @return array |
|
3469 | - */ |
|
3467 | + * @since 4.9.0 |
|
3468 | + * @return array |
|
3469 | + */ |
|
3470 | 3470 | protected function _get_msg_ids_from_request() { |
3471 | 3471 | if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
3472 | 3472 | return array(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | - {exit('NO direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
2 | + {exit('NO direct script access allowed'); } |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param bool $routing |
74 | 74 | */ |
75 | - public function __construct( $routing = true ) { |
|
75 | + public function __construct($routing = true) { |
|
76 | 76 | //make sure messages autoloader is running |
77 | 77 | EED_Messages::set_autoloaders(); |
78 | - parent::__construct( $routing ); |
|
78 | + parent::__construct($routing); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array(); |
91 | 91 | |
92 | - $this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null; |
|
92 | + $this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null; |
|
93 | 93 | $this->_load_message_resource_manager(); |
94 | 94 | } |
95 | 95 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @throws EE_Error |
104 | 104 | */ |
105 | 105 | protected function _load_message_resource_manager() { |
106 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
106 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function get_messengers_for_list_table() { |
118 | 118 | $m_values = array(); |
119 | - $active_messengers = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) ); |
|
119 | + $active_messengers = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger')); |
|
120 | 120 | //setup messengers for selects |
121 | 121 | $i = 1; |
122 | - foreach ( $active_messengers as $active_messenger ) { |
|
123 | - if ( $active_messenger instanceof EE_Message ) { |
|
124 | - $m_values[ $i ]['id'] = $active_messenger->messenger(); |
|
125 | - $m_values[ $i ]['text'] = ucwords( $active_messenger->messenger_label() ); |
|
122 | + foreach ($active_messengers as $active_messenger) { |
|
123 | + if ($active_messenger instanceof EE_Message) { |
|
124 | + $m_values[$i]['id'] = $active_messenger->messenger(); |
|
125 | + $m_values[$i]['text'] = ucwords($active_messenger->messenger_label()); |
|
126 | 126 | $i++; |
127 | 127 | } |
128 | 128 | } |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function get_message_types_for_list_table() { |
141 | 141 | $mt_values = array(); |
142 | - $active_messages = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) ); |
|
142 | + $active_messages = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type')); |
|
143 | 143 | $i = 1; |
144 | - foreach ( $active_messages as $active_message ) { |
|
145 | - if ( $active_message instanceof EE_Message ) { |
|
146 | - $mt_values[ $i ]['id'] = $active_message->message_type(); |
|
147 | - $mt_values[ $i ]['text'] = ucwords( $active_message->message_type_label() ); |
|
144 | + foreach ($active_messages as $active_message) { |
|
145 | + if ($active_message instanceof EE_Message) { |
|
146 | + $mt_values[$i]['id'] = $active_message->message_type(); |
|
147 | + $mt_values[$i]['text'] = ucwords($active_message->message_type_label()); |
|
148 | 148 | $i++; |
149 | 149 | } |
150 | 150 | } |
@@ -161,14 +161,14 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function get_contexts_for_message_types_for_list_table() { |
163 | 163 | $contexts = array(); |
164 | - $active_message_contexts = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) ); |
|
165 | - foreach ( $active_message_contexts as $active_message ) { |
|
166 | - if ( $active_message instanceof EE_Message ) { |
|
164 | + $active_message_contexts = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context')); |
|
165 | + foreach ($active_message_contexts as $active_message) { |
|
166 | + if ($active_message instanceof EE_Message) { |
|
167 | 167 | $message_type = $active_message->message_type_object(); |
168 | - if ( $message_type instanceof EE_message_type ) { |
|
168 | + if ($message_type instanceof EE_message_type) { |
|
169 | 169 | $message_type_contexts = $message_type->get_contexts(); |
170 | - foreach ( $message_type_contexts as $context => $context_details ) { |
|
171 | - $contexts[ $context ] = $context_details['label']; |
|
170 | + foreach ($message_type_contexts as $context => $context_details) { |
|
171 | + $contexts[$context] = $context_details['label']; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | protected function _ajax_hooks() { |
182 | - add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) ); |
|
183 | - add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') ); |
|
184 | - add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') ); |
|
185 | - add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) ); |
|
186 | - add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) ); |
|
182 | + add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle')); |
|
183 | + add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle')); |
|
184 | + add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings')); |
|
185 | + add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form')); |
|
186 | + add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack')); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | protected function _set_page_routes() { |
218 | - $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
|
218 | + $grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) |
|
219 | 219 | ? $this->_req_data['GRP_ID'] |
220 | 220 | : 0; |
221 | - $grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) |
|
221 | + $grp_id = empty($grp_id) && ! empty($this->_req_data['id']) |
|
222 | 222 | ? $this->_req_data['id'] |
223 | 223 | : $grp_id; |
224 | - $msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] ) |
|
224 | + $msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID']) |
|
225 | 225 | ? $this->_req_data['MSG_ID'] |
226 | 226 | : 0; |
227 | 227 | |
@@ -263,35 +263,35 @@ discard block |
||
263 | 263 | 'insert_message_template' => array( |
264 | 264 | 'func' => '_insert_or_update_message_template', |
265 | 265 | 'capability' => 'ee_edit_messages', |
266 | - 'args' => array( 'new_template' => true ), |
|
266 | + 'args' => array('new_template' => true), |
|
267 | 267 | 'noheader' => true |
268 | 268 | ), |
269 | 269 | 'update_message_template' => array( |
270 | 270 | 'func' => '_insert_or_update_message_template', |
271 | 271 | 'capability' => 'ee_edit_message', |
272 | 272 | 'obj_id' => $grp_id, |
273 | - 'args' => array( 'new_template' => false ), |
|
273 | + 'args' => array('new_template' => false), |
|
274 | 274 | 'noheader' => true |
275 | 275 | ), |
276 | 276 | 'trash_message_template' => array( |
277 | 277 | 'func' => '_trash_or_restore_message_template', |
278 | 278 | 'capability' => 'ee_delete_message', |
279 | 279 | 'obj_id' => $grp_id, |
280 | - 'args' => array( 'trash' => true, 'all' => true ), |
|
280 | + 'args' => array('trash' => true, 'all' => true), |
|
281 | 281 | 'noheader' => true |
282 | 282 | ), |
283 | 283 | 'trash_message_template_context' => array( |
284 | 284 | 'func' => '_trash_or_restore_message_template', |
285 | 285 | 'capability' => 'ee_delete_message', |
286 | 286 | 'obj_id' => $grp_id, |
287 | - 'args' => array( 'trash' => true ), |
|
287 | + 'args' => array('trash' => true), |
|
288 | 288 | 'noheader' => true |
289 | 289 | ), |
290 | 290 | 'restore_message_template' => array( |
291 | 291 | 'func' => '_trash_or_restore_message_template', |
292 | 292 | 'capability' => 'ee_delete_message', |
293 | 293 | 'obj_id' => $grp_id, |
294 | - 'args' => array( 'trash' => false, 'all' => true ), |
|
294 | + 'args' => array('trash' => false, 'all' => true), |
|
295 | 295 | 'noheader' => true |
296 | 296 | ), |
297 | 297 | 'restore_message_template_context' => array( |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | 'filename' => 'messages_overview_other', |
411 | 411 | ), |
412 | 412 | ), |
413 | - 'help_tour' => array( 'Messages_Overview_Help_Tour' ), |
|
413 | + 'help_tour' => array('Messages_Overview_Help_Tour'), |
|
414 | 414 | 'require_nonce' => false |
415 | 415 | ), |
416 | 416 | 'custom_mtps' => array( |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | ), |
446 | 446 | 'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'), |
447 | 447 | 'has_metaboxes' => true, |
448 | - 'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ), |
|
448 | + 'help_tour' => array('Message_Templates_Edit_Help_Tour'), |
|
449 | 449 | 'help_tabs' => array( |
450 | 450 | 'edit_message_template' => array( |
451 | 451 | 'title' => __('Message Template Editor', 'event_espresso'), |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | 'filename' => 'messages_settings_messengers' |
502 | 502 | ), |
503 | 503 | ), |
504 | - 'help_tour' => array( 'Messages_Settings_Help_Tour' ), |
|
504 | + 'help_tour' => array('Messages_Settings_Help_Tour'), |
|
505 | 505 | 'require_nonce' => false |
506 | 506 | ) |
507 | 507 | ); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | |
536 | 536 | protected function _add_screen_options_default() { |
537 | - $this->_admin_page_title = __( 'Message Activity', 'event_espresso' ); |
|
537 | + $this->_admin_page_title = __('Message Activity', 'event_espresso'); |
|
538 | 538 | $this->_per_page_screen_option(); |
539 | 539 | } |
540 | 540 | |
@@ -556,37 +556,37 @@ discard block |
||
556 | 556 | |
557 | 557 | |
558 | 558 | public function messages_help_tab() { |
559 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' ); |
|
559 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php'); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | |
563 | 563 | public function messengers_help_tab() { |
564 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' ); |
|
564 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | |
568 | 568 | public function message_types_help_tab() { |
569 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' ); |
|
569 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php'); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | |
573 | 573 | public function messages_overview_help_tab() { |
574 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' ); |
|
574 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
578 | 578 | public function message_templates_help_tab() { |
579 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' ); |
|
579 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php'); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
583 | 583 | public function edit_message_template_help_tab() { |
584 | - $args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />'; |
|
585 | - $args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />'; |
|
586 | - $args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />'; |
|
587 | - $args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />'; |
|
588 | - $args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />'; |
|
589 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
584 | + $args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />'; |
|
585 | + $args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />'; |
|
586 | + $args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />'; |
|
587 | + $args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />'; |
|
588 | + $args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />'; |
|
589 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -594,22 +594,22 @@ discard block |
||
594 | 594 | public function message_template_shortcodes_help_tab() { |
595 | 595 | $this->_set_shortcodes(); |
596 | 596 | $args['shortcodes'] = $this->_shortcodes; |
597 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args ); |
|
597 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | |
601 | 601 | |
602 | 602 | public function preview_message_help_tab() { |
603 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' ); |
|
603 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php'); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | |
607 | 607 | public function settings_help_tab() { |
608 | - $args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'; |
|
609 | - $args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'; |
|
608 | + $args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'; |
|
609 | + $args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'; |
|
610 | 610 | $args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>'; |
611 | 611 | $args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>'; |
612 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args); |
|
612 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | |
@@ -617,31 +617,31 @@ discard block |
||
617 | 617 | |
618 | 618 | |
619 | 619 | public function load_scripts_styles() { |
620 | - wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION ); |
|
620 | + wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION); |
|
621 | 621 | wp_enqueue_style('espresso_ee_msg'); |
622 | 622 | |
623 | - wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true ); |
|
624 | - wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION ); |
|
623 | + wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true); |
|
624 | + wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
628 | 628 | |
629 | 629 | public function load_scripts_styles_default() { |
630 | - wp_enqueue_script( 'ee-msg-list-table-js' ); |
|
630 | + wp_enqueue_script('ee-msg-list-table-js'); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | |
634 | 634 | |
635 | 635 | |
636 | 636 | |
637 | - public function wp_editor_css( $mce_css ) { |
|
637 | + public function wp_editor_css($mce_css) { |
|
638 | 638 | //if we're on the edit_message_template route |
639 | - if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger ) { |
|
639 | + if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) { |
|
640 | 640 | $message_type_name = $this->_active_message_type_name; |
641 | 641 | |
642 | 642 | //we're going to REPLACE the existing mce css |
643 | 643 | //we need to get the css file location from the active messenger |
644 | - $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation ); |
|
644 | + $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | return $mce_css; |
@@ -659,15 +659,15 @@ discard block |
||
659 | 659 | $this->_message_template_group->messenger_obj()->label['singular'], |
660 | 660 | $this->_message_template_group->message_type_obj()->label['singular'] |
661 | 661 | ); |
662 | - EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' ); |
|
662 | + EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso'); |
|
663 | 663 | |
664 | - wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION ); |
|
664 | + wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION); |
|
665 | 665 | |
666 | 666 | wp_enqueue_script('ee_admin_js'); |
667 | 667 | wp_enqueue_script('ee_msgs_edit_js'); |
668 | 668 | |
669 | 669 | //add in special css for tiny_mce |
670 | - add_filter( 'mce_css', array( $this, 'wp_editor_css' ) ); |
|
670 | + add_filter('mce_css', array($this, 'wp_editor_css')); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | |
@@ -676,22 +676,22 @@ discard block |
||
676 | 676 | |
677 | 677 | $this->_set_message_template_group(); |
678 | 678 | |
679 | - if ( isset( $this->_req_data['messenger'] ) ) { |
|
680 | - $this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
679 | + if (isset($this->_req_data['messenger'])) { |
|
680 | + $this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
681 | 681 | } |
682 | 682 | |
683 | - $message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : ''; |
|
683 | + $message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : ''; |
|
684 | 684 | |
685 | 685 | |
686 | - wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) ); |
|
686 | + wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation)); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | |
690 | 690 | |
691 | 691 | public function load_scripts_styles_settings() { |
692 | - wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION ); |
|
693 | - wp_enqueue_style( 'ee-text-links' ); |
|
694 | - wp_enqueue_style( 'ee-message-settings' ); |
|
692 | + wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION); |
|
693 | + wp_enqueue_style('ee-text-links'); |
|
694 | + wp_enqueue_style('ee-message-settings'); |
|
695 | 695 | |
696 | 696 | wp_enqueue_script('ee-messages-settings'); |
697 | 697 | } |
@@ -721,40 +721,40 @@ discard block |
||
721 | 721 | * set views array for message queue list table |
722 | 722 | */ |
723 | 723 | public function _set_list_table_views_default() { |
724 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
724 | + EE_Registry::instance()->load_helper('Template'); |
|
725 | 725 | |
726 | - $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
|
726 | + $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions') |
|
727 | 727 | ? array( |
728 | - 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
|
729 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
730 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
731 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
728 | + 'generate_now' => __('Generate Now', 'event_espresso'), |
|
729 | + 'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'), |
|
730 | + 'queue_for_resending' => __('Queue for Resending', 'event_espresso'), |
|
731 | + 'send_now' => __('Send Now', 'event_espresso') |
|
732 | 732 | ) |
733 | 733 | : array(); |
734 | 734 | |
735 | - $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' ) |
|
736 | - ? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) ) |
|
735 | + $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions') |
|
736 | + ? array('delete_ee_messages' => __('Delete Messages', 'event_espresso')) |
|
737 | 737 | : array(); |
738 | 738 | |
739 | 739 | |
740 | 740 | $this->_views = array( |
741 | 741 | 'all' => array( |
742 | 742 | 'slug' => 'all', |
743 | - 'label' => __( 'All', 'event_espresso' ), |
|
743 | + 'label' => __('All', 'event_espresso'), |
|
744 | 744 | 'count' => 0, |
745 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
745 | + 'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action) |
|
746 | 746 | ) |
747 | 747 | ); |
748 | 748 | |
749 | 749 | |
750 | - foreach ( EEM_Message::instance()->all_statuses() as $status ) { |
|
751 | - if ( $status === EEM_Message::status_debug_only && ! EEM_Message::debug() ) { |
|
750 | + foreach (EEM_Message::instance()->all_statuses() as $status) { |
|
751 | + if ($status === EEM_Message::status_debug_only && ! EEM_Message::debug()) { |
|
752 | 752 | continue; |
753 | 753 | } |
754 | 754 | $status_bulk_actions = $common_bulk_actions; |
755 | 755 | //unset bulk actions not applying to status |
756 | - if ( ! empty( $status_bulk_actions ) ) { |
|
757 | - switch ( $status ) { |
|
756 | + if ( ! empty($status_bulk_actions)) { |
|
757 | + switch ($status) { |
|
758 | 758 | case EEM_Message::status_idle : |
759 | 759 | case EEM_Message::status_resend : |
760 | 760 | $status_bulk_actions['send_now'] = $common_bulk_actions['send_now']; |
@@ -766,21 +766,21 @@ discard block |
||
766 | 766 | break; |
767 | 767 | |
768 | 768 | case EEM_Message::status_incomplete : |
769 | - unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] ); |
|
769 | + unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']); |
|
770 | 770 | break; |
771 | 771 | |
772 | 772 | case EEM_Message::status_retry : |
773 | 773 | case EEM_Message::status_sent : |
774 | - unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] ); |
|
774 | + unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']); |
|
775 | 775 | break; |
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
779 | - $this->_views[ strtolower( $status ) ] = array( |
|
780 | - 'slug' => strtolower( $status ), |
|
781 | - 'label' => EEH_Template::pretty_status( $status, false, 'sentence' ), |
|
779 | + $this->_views[strtolower($status)] = array( |
|
780 | + 'slug' => strtolower($status), |
|
781 | + 'label' => EEH_Template::pretty_status($status, false, 'sentence'), |
|
782 | 782 | 'count' => 0, |
783 | - 'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action ) |
|
783 | + 'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action) |
|
784 | 784 | ); |
785 | 785 | } |
786 | 786 | } |
@@ -799,8 +799,8 @@ discard block |
||
799 | 799 | protected function _message_queue_list_table() { |
800 | 800 | $this->_search_btn_label = __('Message Activity', 'event_espresso'); |
801 | 801 | $this->_template_args['per_column'] = 6; |
802 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() ); |
|
803 | - $this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>'; |
|
802 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items()); |
|
803 | + $this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>'; |
|
804 | 804 | $this->display_admin_list_table_page_with_no_sidebar(); |
805 | 805 | } |
806 | 806 | |
@@ -813,8 +813,8 @@ discard block |
||
813 | 813 | $action_css_classes = EEH_MSG_Template::get_message_action_icons(); |
814 | 814 | $action_items = array(); |
815 | 815 | |
816 | - foreach( $action_css_classes as $action_item => $action_details ) { |
|
817 | - if ( $action_item === 'see_notifications_for' ) { |
|
816 | + foreach ($action_css_classes as $action_item => $action_details) { |
|
817 | + if ($action_item === 'see_notifications_for') { |
|
818 | 818 | continue; |
819 | 819 | } |
820 | 820 | $action_items[$action_item] = array( |
@@ -826,37 +826,37 @@ discard block |
||
826 | 826 | /** @type array $status_items status legend setup*/ |
827 | 827 | $status_items = array( |
828 | 828 | 'sent_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'idle_status' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence') |
|
835 | 835 | ), |
836 | 836 | 'failed_status' => array( |
837 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed, |
|
838 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' ) |
|
837 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed, |
|
838 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence') |
|
839 | 839 | ), |
840 | 840 | 'resend_status' => array( |
841 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend, |
|
842 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' ) |
|
841 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend, |
|
842 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence') |
|
843 | 843 | ), |
844 | 844 | 'incomplete_status' => array( |
845 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete, |
|
846 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' ) |
|
845 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete, |
|
846 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence') |
|
847 | 847 | ), |
848 | 848 | 'retry_status' => array( |
849 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry, |
|
850 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' ) |
|
849 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry, |
|
850 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence') |
|
851 | 851 | ) |
852 | 852 | ); |
853 | - if ( EEM_Message::debug() ) { |
|
853 | + if (EEM_Message::debug()) { |
|
854 | 854 | $status_items['debug_only_status'] = array( |
855 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only, |
|
856 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' ) |
|
855 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only, |
|
856 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence') |
|
857 | 857 | ); |
858 | 858 | } |
859 | - return array_merge( $action_items, $status_items ); |
|
859 | + return array_merge($action_items, $status_items); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -866,9 +866,9 @@ discard block |
||
866 | 866 | |
867 | 867 | protected function _custom_mtps_preview() { |
868 | 868 | $this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso'); |
869 | - $this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />'; |
|
869 | + $this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />'; |
|
870 | 870 | $this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso. With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>'; |
871 | - $this->display_admin_caf_preview_page( 'custom_message_types', false ); |
|
871 | + $this->display_admin_caf_preview_page('custom_message_types', false); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
@@ -892,31 +892,31 @@ discard block |
||
892 | 892 | * |
893 | 893 | * @return array |
894 | 894 | */ |
895 | - public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) { |
|
895 | + public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) { |
|
896 | 896 | |
897 | 897 | $MTP = EEM_Message_Template_Group::instance(); |
898 | 898 | |
899 | 899 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby']; |
900 | 900 | $orderby = $this->_req_data['orderby']; |
901 | 901 | |
902 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC'; |
|
902 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
903 | 903 | |
904 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
905 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage; |
|
904 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
905 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage; |
|
906 | 906 | |
907 | - $offset = ($current_page-1)*$per_page; |
|
908 | - $limit = $all ? null : array( $offset, $per_page ); |
|
907 | + $offset = ($current_page - 1) * $per_page; |
|
908 | + $limit = $all ? null : array($offset, $per_page); |
|
909 | 909 | |
910 | 910 | |
911 | 911 | //options will match what is in the _views array property |
912 | - switch( $type ) { |
|
912 | + switch ($type) { |
|
913 | 913 | |
914 | 914 | case 'in_use': |
915 | - $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true ); |
|
915 | + $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true); |
|
916 | 916 | break; |
917 | 917 | |
918 | 918 | default: |
919 | - $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global ); |
|
919 | + $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global); |
|
920 | 920 | |
921 | 921 | } |
922 | 922 | |
@@ -935,8 +935,8 @@ discard block |
||
935 | 935 | $installed_message_types = $this->_message_resource_manager->installed_message_types(); |
936 | 936 | $installed = array(); |
937 | 937 | |
938 | - foreach ( $installed_message_types as $message_type ) { |
|
939 | - $installed[ $message_type->name ] = $message_type; |
|
938 | + foreach ($installed_message_types as $message_type) { |
|
939 | + $installed[$message_type->name] = $message_type; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | return $installed; |
@@ -955,24 +955,24 @@ discard block |
||
955 | 955 | * |
956 | 956 | * @throws EE_error |
957 | 957 | */ |
958 | - protected function _add_message_template( $message_type = '', $messenger='', $GRP_ID = '' ) { |
|
958 | + protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') { |
|
959 | 959 | //set values override any request data |
960 | - $message_type = !empty( $message_type ) ? $message_type : ''; |
|
961 | - $message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type; |
|
960 | + $message_type = ! empty($message_type) ? $message_type : ''; |
|
961 | + $message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type; |
|
962 | 962 | |
963 | - $messenger = !empty( $messenger ) ? $messenger : ''; |
|
964 | - $messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger; |
|
963 | + $messenger = ! empty($messenger) ? $messenger : ''; |
|
964 | + $messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger; |
|
965 | 965 | |
966 | - $GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : ''; |
|
967 | - $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
966 | + $GRP_ID = ! empty($GRP_ID) ? $GRP_ID : ''; |
|
967 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
968 | 968 | |
969 | 969 | //we need messenger and message type. They should be coming from the event editor. If not here then return error |
970 | - if ( empty( $message_type ) || empty( $messenger ) ) |
|
971 | - {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));} |
|
970 | + if (empty($message_type) || empty($messenger)) |
|
971 | + {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); } |
|
972 | 972 | |
973 | 973 | //we need the GRP_ID for the template being used as the base for the new template |
974 | - if ( empty( $GRP_ID ) ) |
|
975 | - {throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );} |
|
974 | + if (empty($GRP_ID)) |
|
975 | + {throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); } |
|
976 | 976 | |
977 | 977 | //let's just make sure the template gets generated! |
978 | 978 | |
@@ -993,8 +993,8 @@ discard block |
||
993 | 993 | * @param int $GRP_ID GRP_ID for the related message template group this new template will be based |
994 | 994 | * off of. |
995 | 995 | */ |
996 | - public function add_message_template( $message_type, $messenger, $GRP_ID ) { |
|
997 | - $this->_add_message_template( $message_type, $messenger, $GRP_ID ); |
|
996 | + public function add_message_template($message_type, $messenger, $GRP_ID) { |
|
997 | + $this->_add_message_template($message_type, $messenger, $GRP_ID); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | |
@@ -1005,14 +1005,14 @@ discard block |
||
1005 | 1005 | * @return void |
1006 | 1006 | */ |
1007 | 1007 | protected function _edit_message_template() { |
1008 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1008 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1009 | 1009 | $template_fields = ''; |
1010 | 1010 | $sidebar_fields = ''; |
1011 | 1011 | //we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates. |
1012 | - add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 ); |
|
1012 | + add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2); |
|
1013 | 1013 | |
1014 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) |
|
1015 | - ? absint( $this->_req_data['id'] ) |
|
1014 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) |
|
1015 | + ? absint($this->_req_data['id']) |
|
1016 | 1016 | : false; |
1017 | 1017 | |
1018 | 1018 | $this->_set_shortcodes(); //this also sets the _message_template property. |
@@ -1020,20 +1020,20 @@ discard block |
||
1020 | 1020 | $c_label = $message_template_group->context_label(); |
1021 | 1021 | $c_config = $message_template_group->contexts_config(); |
1022 | 1022 | |
1023 | - reset( $c_config ); |
|
1024 | - $context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) |
|
1023 | + reset($c_config); |
|
1024 | + $context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) |
|
1025 | 1025 | ? strtolower($this->_req_data['context']) |
1026 | 1026 | : key($c_config); |
1027 | 1027 | |
1028 | 1028 | |
1029 | - if ( empty($GRP_ID) ) { |
|
1029 | + if (empty($GRP_ID)) { |
|
1030 | 1030 | $action = 'insert_message_template'; |
1031 | 1031 | //$button_both = false; |
1032 | 1032 | //$button_text = array( __( 'Save','event_espresso') ); |
1033 | 1033 | //$button_actions = array('something_different'); |
1034 | 1034 | //$referrer = false; |
1035 | 1035 | $edit_message_template_form_url = add_query_arg( |
1036 | - array( 'action' => $action, 'noheader' => true ), |
|
1036 | + array('action' => $action, 'noheader' => true), |
|
1037 | 1037 | EE_MSG_ADMIN_URL |
1038 | 1038 | ); |
1039 | 1039 | } else { |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | //$button_actions = array(); |
1044 | 1044 | //$referrer = $this->_admin_base_url; |
1045 | 1045 | $edit_message_template_form_url = add_query_arg( |
1046 | - array( 'action' => $action, 'noheader' => true ), |
|
1046 | + array('action' => $action, 'noheader' => true), |
|
1047 | 1047 | EE_MSG_ADMIN_URL |
1048 | 1048 | ); |
1049 | 1049 | } |
@@ -1057,14 +1057,14 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | //Do we have any validation errors? |
1059 | 1059 | $validators = $this->_get_transient(); |
1060 | - $v_fields = !empty($validators) ? array_keys($validators) : array(); |
|
1060 | + $v_fields = ! empty($validators) ? array_keys($validators) : array(); |
|
1061 | 1061 | |
1062 | 1062 | |
1063 | 1063 | //we need to assemble the title from Various details |
1064 | 1064 | $context_label = sprintf( |
1065 | 1065 | __('(%s %s)', 'event_espresso'), |
1066 | 1066 | $c_config[$context]['label'], |
1067 | - ucwords($c_label['label'] ) |
|
1067 | + ucwords($c_label['label']) |
|
1068 | 1068 | ); |
1069 | 1069 | |
1070 | 1070 | $title = sprintf( |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | $message_template_group->message_type() |
1086 | 1086 | ); |
1087 | 1087 | |
1088 | - if ( !$template_field_structure ) { |
|
1088 | + if ( ! $template_field_structure) { |
|
1089 | 1089 | $template_field_structure = false; |
1090 | 1090 | $template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso'); |
1091 | 1091 | } |
@@ -1095,51 +1095,51 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | |
1097 | 1097 | //if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array. |
1098 | - if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) { |
|
1099 | - foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) { |
|
1100 | - unset( $template_field_structure[$context][$reference_field] ); |
|
1098 | + if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) { |
|
1099 | + foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) { |
|
1100 | + unset($template_field_structure[$context][$reference_field]); |
|
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | //let's loop through the template_field_structure and actually assemble the input fields! |
1105 | - if ( !empty($template_field_structure) ) { |
|
1106 | - foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) { |
|
1105 | + if ( ! empty($template_field_structure)) { |
|
1106 | + foreach ($template_field_structure[$context] as $template_field => $field_setup_array) { |
|
1107 | 1107 | //if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them. |
1108 | - if ( $template_field == 'extra' ) { |
|
1108 | + if ($template_field == 'extra') { |
|
1109 | 1109 | $this->_template_args['is_extra_fields'] = true; |
1110 | - foreach ( $field_setup_array as $reference_field => $new_fields_array ) { |
|
1111 | - $message_template = $message_templates[ $context ][ $reference_field ]; |
|
1110 | + foreach ($field_setup_array as $reference_field => $new_fields_array) { |
|
1111 | + $message_template = $message_templates[$context][$reference_field]; |
|
1112 | 1112 | $content = $message_template instanceof EE_Message_Template |
1113 | - ? $message_template->get( 'MTP_content' ) |
|
1113 | + ? $message_template->get('MTP_content') |
|
1114 | 1114 | : ''; |
1115 | - foreach ( $new_fields_array as $extra_field => $extra_array ) { |
|
1115 | + foreach ($new_fields_array as $extra_field => $extra_array) { |
|
1116 | 1116 | //let's verify if we need this extra field via the shortcodes parameter. |
1117 | 1117 | $continue = false; |
1118 | - if ( isset( $extra_array['shortcodes_required'] ) ) { |
|
1119 | - foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { |
|
1120 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) |
|
1121 | - {$continue = true;} |
|
1118 | + if (isset($extra_array['shortcodes_required'])) { |
|
1119 | + foreach ((array) $extra_array['shortcodes_required'] as $shortcode) { |
|
1120 | + if ( ! array_key_exists($shortcode, $this->_shortcodes)) |
|
1121 | + {$continue = true; } |
|
1122 | 1122 | } |
1123 | - if ( $continue ) {continue;} |
|
1123 | + if ($continue) {continue; } |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $field_id = $reference_field . '-' . $extra_field . '-content'; |
|
1126 | + $field_id = $reference_field.'-'.$extra_field.'-content'; |
|
1127 | 1127 | $template_form_fields[$field_id] = $extra_array; |
1128 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']'; |
|
1129 | - $css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : ''; |
|
1128 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']'; |
|
1129 | + $css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : ''; |
|
1130 | 1130 | |
1131 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1131 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1132 | 1132 | && in_array($extra_field, $v_fields) |
1133 | 1133 | && |
1134 | 1134 | ( |
1135 | - is_array($validators[$extra_field] ) |
|
1136 | - && isset( $validators[$extra_field]['msg'] ) |
|
1135 | + is_array($validators[$extra_field]) |
|
1136 | + && isset($validators[$extra_field]['msg']) |
|
1137 | 1137 | ) |
1138 | - ? 'validate-error ' . $css_class |
|
1138 | + ? 'validate-error '.$css_class |
|
1139 | 1139 | : $css_class; |
1140 | 1140 | |
1141 | - $template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) |
|
1142 | - ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) |
|
1141 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) |
|
1142 | + ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) |
|
1143 | 1143 | : ''; |
1144 | 1144 | |
1145 | 1145 | //do we have a validation error? if we do then let's use that value instead |
@@ -1155,32 +1155,32 @@ discard block |
||
1155 | 1155 | $field_id |
1156 | 1156 | ); |
1157 | 1157 | |
1158 | - if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) { |
|
1158 | + if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') { |
|
1159 | 1159 | //we want to decode the entities |
1160 | 1160 | $template_form_fields[$field_id]['value'] = stripslashes( |
1161 | - html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1161 | + html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1162 | 1162 | ); |
1163 | 1163 | |
1164 | 1164 | }/**/ |
1165 | 1165 | } |
1166 | - $templatefield_MTP_id = $reference_field . '-MTP_ID'; |
|
1167 | - $templatefield_templatename_id = $reference_field . '-name'; |
|
1166 | + $templatefield_MTP_id = $reference_field.'-MTP_ID'; |
|
1167 | + $templatefield_templatename_id = $reference_field.'-name'; |
|
1168 | 1168 | |
1169 | 1169 | $template_form_fields[$templatefield_MTP_id] = array( |
1170 | - 'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]', |
|
1170 | + 'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]', |
|
1171 | 1171 | 'label' => null, |
1172 | 1172 | 'input' => 'hidden', |
1173 | 1173 | 'type' => 'int', |
1174 | 1174 | 'required' => false, |
1175 | 1175 | 'validation' => false, |
1176 | - 'value' => !empty($message_templates) ? $message_template->ID() : '', |
|
1176 | + 'value' => ! empty($message_templates) ? $message_template->ID() : '', |
|
1177 | 1177 | 'css_class' => '', |
1178 | 1178 | 'format' => '%d', |
1179 | 1179 | 'db-col' => 'MTP_ID' |
1180 | 1180 | ); |
1181 | 1181 | |
1182 | 1182 | $template_form_fields[$templatefield_templatename_id] = array( |
1183 | - 'name' => 'MTP_template_fields[' . $reference_field . '][name]', |
|
1183 | + 'name' => 'MTP_template_fields['.$reference_field.'][name]', |
|
1184 | 1184 | 'label' => null, |
1185 | 1185 | 'input' => 'hidden', |
1186 | 1186 | 'type' => 'string', |
@@ -1194,14 +1194,14 @@ discard block |
||
1194 | 1194 | } |
1195 | 1195 | continue; //skip the next stuff, we got the necessary fields here for this dataset. |
1196 | 1196 | } else { |
1197 | - $field_id = $template_field . '-content'; |
|
1197 | + $field_id = $template_field.'-content'; |
|
1198 | 1198 | $template_form_fields[$field_id] = $field_setup_array; |
1199 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]'; |
|
1200 | - $message_template = isset( $message_templates[ $context ][ $template_field ] ) |
|
1201 | - ? $message_templates[ $context ][ $template_field ] |
|
1199 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]'; |
|
1200 | + $message_template = isset($message_templates[$context][$template_field]) |
|
1201 | + ? $message_templates[$context][$template_field] |
|
1202 | 1202 | : null; |
1203 | - $template_form_fields[$field_id]['value'] = ! empty( $message_templates ) |
|
1204 | - && is_array( $message_templates[$context] ) |
|
1203 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) |
|
1204 | + && is_array($message_templates[$context]) |
|
1205 | 1205 | && $message_template instanceof EE_Message_Template |
1206 | 1206 | ? $message_template->get('MTP_content') |
1207 | 1207 | : ''; |
@@ -1214,10 +1214,10 @@ discard block |
||
1214 | 1214 | |
1215 | 1215 | $template_form_fields[$field_id]['db-col'] = 'MTP_content'; |
1216 | 1216 | $css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : ''; |
1217 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1218 | - && in_array( $template_field, $v_fields ) |
|
1219 | - && isset( $validators[$template_field]['msg'] ) |
|
1220 | - ? 'validate-error ' . $css_class |
|
1217 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1218 | + && in_array($template_field, $v_fields) |
|
1219 | + && isset($validators[$template_field]['msg']) |
|
1220 | + ? 'validate-error '.$css_class |
|
1221 | 1221 | : $css_class; |
1222 | 1222 | |
1223 | 1223 | //shortcode selector |
@@ -1228,12 +1228,12 @@ discard block |
||
1228 | 1228 | |
1229 | 1229 | //k took care of content field(s) now let's take care of others. |
1230 | 1230 | |
1231 | - $templatefield_MTP_id = $template_field . '-MTP_ID'; |
|
1232 | - $templatefield_field_templatename_id = $template_field . '-name'; |
|
1231 | + $templatefield_MTP_id = $template_field.'-MTP_ID'; |
|
1232 | + $templatefield_field_templatename_id = $template_field.'-name'; |
|
1233 | 1233 | |
1234 | 1234 | //foreach template field there are actually two form fields created |
1235 | 1235 | $template_form_fields[$templatefield_MTP_id] = array( |
1236 | - 'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]', |
|
1236 | + 'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]', |
|
1237 | 1237 | 'label' => null, |
1238 | 1238 | 'input' => 'hidden', |
1239 | 1239 | 'type' => 'int', |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | ); |
1247 | 1247 | |
1248 | 1248 | $template_form_fields[$templatefield_field_templatename_id] = array( |
1249 | - 'name' => 'MTP_template_fields[' . $template_field . '][name]', |
|
1249 | + 'name' => 'MTP_template_fields['.$template_field.'][name]', |
|
1250 | 1250 | 'label' => null, |
1251 | 1251 | 'input' => 'hidden', |
1252 | 1252 | 'type' => 'string', |
@@ -1390,13 +1390,13 @@ discard block |
||
1390 | 1390 | 'value' => $GRP_ID |
1391 | 1391 | ); |
1392 | 1392 | $sidebar_form_fields['ee-msg-evt-nonce'] = array( |
1393 | - 'name' => $action . '_nonce', |
|
1393 | + 'name' => $action.'_nonce', |
|
1394 | 1394 | 'input' => 'hidden', |
1395 | 1395 | 'type' => 'string', |
1396 | - 'value' => wp_create_nonce( $action . '_nonce') |
|
1396 | + 'value' => wp_create_nonce($action.'_nonce') |
|
1397 | 1397 | ); |
1398 | 1398 | |
1399 | - if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) { |
|
1399 | + if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) { |
|
1400 | 1400 | $sidebar_form_fields['ee-msg-template-switch'] = array( |
1401 | 1401 | 'name' => 'template_switch', |
1402 | 1402 | 'input' => 'hidden', |
@@ -1406,8 +1406,8 @@ discard block |
||
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | |
1409 | - $template_fields = $this->_generate_admin_form_fields( $template_form_fields ); |
|
1410 | - $sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields ); |
|
1409 | + $template_fields = $this->_generate_admin_form_fields($template_form_fields); |
|
1410 | + $sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields); |
|
1411 | 1411 | |
1412 | 1412 | |
1413 | 1413 | } //end if ( !empty($template_field_structure) ) |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | $GRP_ID, |
1420 | 1420 | false, |
1421 | 1421 | add_query_arg( |
1422 | - array( 'action' => 'global_mtps' ), |
|
1422 | + array('action' => 'global_mtps'), |
|
1423 | 1423 | $this->_admin_base_url |
1424 | 1424 | ) |
1425 | 1425 | ); |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | ), |
1436 | 1436 | $this->_admin_base_url |
1437 | 1437 | ); |
1438 | - $preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>'; |
|
1438 | + $preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>'; |
|
1439 | 1439 | |
1440 | 1440 | |
1441 | 1441 | //setup context switcher |
@@ -1463,17 +1463,17 @@ discard block |
||
1463 | 1463 | $this->_template_args['after_admin_page_content'] = $this->_add_form_element_after(); |
1464 | 1464 | |
1465 | 1465 | $this->_template_path = $this->_template_args['GRP_ID'] |
1466 | - ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' |
|
1467 | - : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php'; |
|
1466 | + ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' |
|
1467 | + : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php'; |
|
1468 | 1468 | |
1469 | 1469 | //send along EE_Message_Template_Group object for further template use. |
1470 | 1470 | $this->_template_args['MTP'] = $message_template_group; |
1471 | 1471 | |
1472 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true ); |
|
1472 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true); |
|
1473 | 1473 | |
1474 | 1474 | |
1475 | 1475 | //finally, let's set the admin_page title |
1476 | - $this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title ); |
|
1476 | + $this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title); |
|
1477 | 1477 | |
1478 | 1478 | |
1479 | 1479 | //we need to take care of setting the shortcodes property for use elsewhere. |
@@ -1486,7 +1486,7 @@ discard block |
||
1486 | 1486 | } |
1487 | 1487 | |
1488 | 1488 | |
1489 | - public function filter_tinymce_init( $mceInit, $editor_id ) { |
|
1489 | + public function filter_tinymce_init($mceInit, $editor_id) { |
|
1490 | 1490 | return $mceInit; |
1491 | 1491 | } |
1492 | 1492 | |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | } |
1498 | 1498 | |
1499 | 1499 | public function _add_form_element_before() { |
1500 | - return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">'; |
|
1500 | + return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">'; |
|
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | public function _add_form_element_after() { |
@@ -1514,25 +1514,25 @@ discard block |
||
1514 | 1514 | * |
1515 | 1515 | */ |
1516 | 1516 | public function switch_template_pack() { |
1517 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1518 | - $template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : ''; |
|
1517 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1518 | + $template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : ''; |
|
1519 | 1519 | |
1520 | 1520 | //verify we have needed values. |
1521 | - if ( empty( $GRP_ID ) || empty( $template_pack ) ) { |
|
1521 | + if (empty($GRP_ID) || empty($template_pack)) { |
|
1522 | 1522 | $this->_template_args['error'] = true; |
1523 | - EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1523 | + EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1524 | 1524 | } else { |
1525 | 1525 | //get template, set the new template_pack and then reset to default |
1526 | 1526 | /** @type EE_Message_Template_Group $message_template_group */ |
1527 | - $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
1527 | + $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
1528 | 1528 | |
1529 | - $message_template_group->set_template_pack_name( $template_pack ); |
|
1529 | + $message_template_group->set_template_pack_name($template_pack); |
|
1530 | 1530 | $this->_req_data['msgr'] = $message_template_group->messenger(); |
1531 | 1531 | $this->_req_data['mt'] = $message_template_group->message_type(); |
1532 | 1532 | |
1533 | 1533 | $query_args = $this->_reset_to_default_template(); |
1534 | 1534 | |
1535 | - if ( empty( $query_args['id'] ) ) { |
|
1535 | + if (empty($query_args['id'])) { |
|
1536 | 1536 | EE_Error::add_error( |
1537 | 1537 | __( |
1538 | 1538 | 'Something went wrong with switching the template pack. Please try again or contact EE support', |
@@ -1542,7 +1542,7 @@ discard block |
||
1542 | 1542 | ); |
1543 | 1543 | $this->_template_args['error'] = true; |
1544 | 1544 | } else { |
1545 | - $template_label =$message_template_group->get_template_pack()->label; |
|
1545 | + $template_label = $message_template_group->get_template_pack()->label; |
|
1546 | 1546 | $template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels(); |
1547 | 1547 | EE_Error::add_success( |
1548 | 1548 | sprintf( |
@@ -1555,7 +1555,7 @@ discard block |
||
1555 | 1555 | ) |
1556 | 1556 | ); |
1557 | 1557 | //generate the redirect url for js. |
1558 | - $url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1558 | + $url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1559 | 1559 | $this->_template_args['data']['redirect_url'] = $url; |
1560 | 1560 | $this->_template_args['success'] = true; |
1561 | 1561 | } |
@@ -1577,9 +1577,9 @@ discard block |
||
1577 | 1577 | protected function _reset_to_default_template() { |
1578 | 1578 | |
1579 | 1579 | $templates = array(); |
1580 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1580 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1581 | 1581 | //we need to make sure we've got the info we need. |
1582 | - if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) { |
|
1582 | + if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) { |
|
1583 | 1583 | EE_Error::add_error( |
1584 | 1584 | __( |
1585 | 1585 | 'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset. At least one of these is missing.', |
@@ -1591,9 +1591,9 @@ discard block |
||
1591 | 1591 | |
1592 | 1592 | // all templates will be reset to whatever the defaults are |
1593 | 1593 | // for the global template matching the messenger and message type. |
1594 | - $success = !empty( $GRP_ID ) ? true : false; |
|
1594 | + $success = ! empty($GRP_ID) ? true : false; |
|
1595 | 1595 | |
1596 | - if ( $success ) { |
|
1596 | + if ($success) { |
|
1597 | 1597 | |
1598 | 1598 | //let's first determine if the incoming template is a global template, |
1599 | 1599 | // if it isn't then we need to get the global template matching messenger and message type. |
@@ -1601,9 +1601,9 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | |
1603 | 1603 | //note this is ONLY deleting the template fields (Message Template rows) NOT the message template group. |
1604 | - $success = $this->_delete_mtp_permanently( $GRP_ID, false ); |
|
1604 | + $success = $this->_delete_mtp_permanently($GRP_ID, false); |
|
1605 | 1605 | |
1606 | - if ( $success ) { |
|
1606 | + if ($success) { |
|
1607 | 1607 | // if successfully deleted, lets generate the new ones. |
1608 | 1608 | // Note. We set GLOBAL to true, because resets on ANY template |
1609 | 1609 | // will use the related global template defaults for regeneration. |
@@ -1621,32 +1621,32 @@ discard block |
||
1621 | 1621 | } |
1622 | 1622 | |
1623 | 1623 | //any error messages? |
1624 | - if ( !$success ) { |
|
1624 | + if ( ! $success) { |
|
1625 | 1625 | EE_Error::add_error( |
1626 | - __( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ), |
|
1626 | + __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), |
|
1627 | 1627 | __FILE__, __FUNCTION__, __LINE__ |
1628 | 1628 | ); |
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | //all good, let's add a success message! |
1632 | - if ( $success && ! empty( $templates ) ) { |
|
1632 | + if ($success && ! empty($templates)) { |
|
1633 | 1633 | $templates = $templates[0]; //the info for the template we generated is the first element in the returned array. |
1634 | 1634 | EE_Error::overwrite_success(); |
1635 | - EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') ); |
|
1635 | + EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso')); |
|
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | |
1639 | 1639 | $query_args = array( |
1640 | - 'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null, |
|
1641 | - 'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null, |
|
1642 | - 'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps' |
|
1640 | + 'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null, |
|
1641 | + 'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null, |
|
1642 | + 'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps' |
|
1643 | 1643 | ); |
1644 | 1644 | |
1645 | 1645 | //if called via ajax then we return query args otherwise redirect |
1646 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
1646 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1647 | 1647 | return $query_args; |
1648 | 1648 | } else { |
1649 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
1649 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1650 | 1650 | return null; |
1651 | 1651 | } |
1652 | 1652 | } |
@@ -1659,7 +1659,7 @@ discard block |
||
1659 | 1659 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview. |
1660 | 1660 | * @return string |
1661 | 1661 | */ |
1662 | - public function _preview_message( $send = false ) { |
|
1662 | + public function _preview_message($send = false) { |
|
1663 | 1663 | //first make sure we've got the necessary parameters |
1664 | 1664 | if ( |
1665 | 1665 | ! isset( |
@@ -1675,13 +1675,13 @@ discard block |
||
1675 | 1675 | ); |
1676 | 1676 | } |
1677 | 1677 | |
1678 | - EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] ); |
|
1678 | + EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']); |
|
1679 | 1679 | |
1680 | 1680 | |
1681 | 1681 | //get the preview! |
1682 | - $preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send ); |
|
1682 | + $preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send); |
|
1683 | 1683 | |
1684 | - if ( $send ) { |
|
1684 | + if ($send) { |
|
1685 | 1685 | return $preview; |
1686 | 1686 | } |
1687 | 1687 | |
@@ -1691,22 +1691,22 @@ discard block |
||
1691 | 1691 | 'context' => $this->_req_data['context'], |
1692 | 1692 | 'action' => 'edit_message_template' |
1693 | 1693 | ); |
1694 | - $go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1695 | - $preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>'; |
|
1694 | + $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1695 | + $preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>'; |
|
1696 | 1696 | $message_types = $this->get_installed_message_types(); |
1697 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
1697 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
1698 | 1698 | $active_messenger_label = $active_messenger instanceof EE_messenger |
1699 | - ? ucwords( $active_messenger->label['singular'] ) |
|
1700 | - : esc_html__( 'Unknown Messenger', 'event_espresso' ); |
|
1699 | + ? ucwords($active_messenger->label['singular']) |
|
1700 | + : esc_html__('Unknown Messenger', 'event_espresso'); |
|
1701 | 1701 | //let's provide a helpful title for context |
1702 | 1702 | $preview_title = sprintf( |
1703 | - __( 'Viewing Preview for %s %s Message Template', 'event_espresso' ), |
|
1703 | + __('Viewing Preview for %s %s Message Template', 'event_espresso'), |
|
1704 | 1704 | $active_messenger_label, |
1705 | - ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] ) |
|
1705 | + ucwords($message_types[$this->_req_data['message_type']]->label['singular']) |
|
1706 | 1706 | ); |
1707 | 1707 | //setup display of preview. |
1708 | 1708 | $this->_admin_page_title = $preview_title; |
1709 | - $this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview); |
|
1709 | + $this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview); |
|
1710 | 1710 | $this->_template_args['data']['force_json'] = true; |
1711 | 1711 | return ''; |
1712 | 1712 | } |
@@ -1736,9 +1736,9 @@ discard block |
||
1736 | 1736 | * @return void |
1737 | 1737 | */ |
1738 | 1738 | protected function _register_edit_meta_boxes() { |
1739 | - add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' ); |
|
1740 | - add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1741 | - add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1739 | + add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default'); |
|
1740 | + add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1741 | + add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | |
@@ -1757,14 +1757,14 @@ discard block |
||
1757 | 1757 | |
1758 | 1758 | $tp_select_values = array(); |
1759 | 1759 | |
1760 | - foreach ( $tp_collection as $tp ) { |
|
1760 | + foreach ($tp_collection as $tp) { |
|
1761 | 1761 | //only include template packs that support this messenger and message type! |
1762 | 1762 | $supports = $tp->get_supports(); |
1763 | 1763 | if ( |
1764 | - ! isset( $supports[ $this->_message_template_group->messenger() ] ) |
|
1764 | + ! isset($supports[$this->_message_template_group->messenger()]) |
|
1765 | 1765 | || ! in_array( |
1766 | 1766 | $this->_message_template_group->message_type(), |
1767 | - $supports[ $this->_message_template_group->messenger() ] |
|
1767 | + $supports[$this->_message_template_group->messenger()] |
|
1768 | 1768 | ) |
1769 | 1769 | ) { |
1770 | 1770 | //not supported |
@@ -1778,7 +1778,7 @@ discard block |
||
1778 | 1778 | } |
1779 | 1779 | |
1780 | 1780 | //if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack. This still allows for the odd template pack to override. |
1781 | - if ( empty( $tp_select_values ) ) { |
|
1781 | + if (empty($tp_select_values)) { |
|
1782 | 1782 | $tp_select_values[] = array( |
1783 | 1783 | 'text' => __('Default', 'event_espresso'), |
1784 | 1784 | 'id' => 'default' |
@@ -1791,14 +1791,14 @@ discard block |
||
1791 | 1791 | $this->_message_template_group->message_type() |
1792 | 1792 | ); |
1793 | 1793 | $variations_select_values = array(); |
1794 | - foreach ( $variations as $variation => $label ) { |
|
1794 | + foreach ($variations as $variation => $label) { |
|
1795 | 1795 | $variations_select_values[] = array( |
1796 | 1796 | 'text' => $label, |
1797 | 1797 | 'id' => $variation |
1798 | 1798 | ); |
1799 | 1799 | } |
1800 | 1800 | |
1801 | - $template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1801 | + $template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1802 | 1802 | |
1803 | 1803 | $template_args['template_packs_selector'] = EEH_Form_Fields::select_input( |
1804 | 1804 | 'MTP_template_pack', |
@@ -1815,9 +1815,9 @@ discard block |
||
1815 | 1815 | $template_args['template_pack_description'] = $template_pack_labels->template_pack_description; |
1816 | 1816 | $template_args['template_variation_description'] = $template_pack_labels->template_variation_description; |
1817 | 1817 | |
1818 | - $template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php'; |
|
1818 | + $template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php'; |
|
1819 | 1819 | |
1820 | - EEH_Template::display_template( $template, $template_args ); |
|
1820 | + EEH_Template::display_template($template, $template_args); |
|
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | |
@@ -1848,47 +1848,47 @@ discard block |
||
1848 | 1848 | //first we need to see if there are any fields |
1849 | 1849 | $fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields(); |
1850 | 1850 | |
1851 | - if ( !empty( $fields ) ) { |
|
1851 | + if ( ! empty($fields)) { |
|
1852 | 1852 | //yup there be fields |
1853 | - foreach ( $fields as $field => $config ) { |
|
1854 | - $field_id = $this->_message_template_group->messenger() . '_' . $field; |
|
1853 | + foreach ($fields as $field => $config) { |
|
1854 | + $field_id = $this->_message_template_group->messenger().'_'.$field; |
|
1855 | 1855 | $existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings(); |
1856 | - $default = isset( $config['default'] ) ? $config['default'] : ''; |
|
1857 | - $default = isset( $config['value'] ) ? $config['value'] : $default; |
|
1856 | + $default = isset($config['default']) ? $config['default'] : ''; |
|
1857 | + $default = isset($config['value']) ? $config['value'] : $default; |
|
1858 | 1858 | |
1859 | 1859 | //if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults |
1860 | 1860 | $fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : ''; |
1861 | - $existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix; |
|
1861 | + $existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix; |
|
1862 | 1862 | |
1863 | 1863 | $template_form_fields[$field_id] = array( |
1864 | - 'name' => 'test_settings_fld[' . $field . ']', |
|
1864 | + 'name' => 'test_settings_fld['.$field.']', |
|
1865 | 1865 | 'label' => $config['label'], |
1866 | 1866 | 'input' => $config['input'], |
1867 | 1867 | 'type' => $config['type'], |
1868 | 1868 | 'required' => $config['required'], |
1869 | 1869 | 'validation' => $config['validation'], |
1870 | - 'value' => isset( $existing[$field] ) ? $existing[$field] : $default, |
|
1870 | + 'value' => isset($existing[$field]) ? $existing[$field] : $default, |
|
1871 | 1871 | 'css_class' => $config['css_class'], |
1872 | - 'options' => isset( $config['options'] ) ? $config['options'] : array(), |
|
1872 | + 'options' => isset($config['options']) ? $config['options'] : array(), |
|
1873 | 1873 | 'default' => $default, |
1874 | 1874 | 'format' => $config['format'] |
1875 | 1875 | ); |
1876 | 1876 | } |
1877 | 1877 | } |
1878 | 1878 | |
1879 | - $test_settings_fields = !empty( $template_form_fields) |
|
1880 | - ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) |
|
1879 | + $test_settings_fields = ! empty($template_form_fields) |
|
1880 | + ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') |
|
1881 | 1881 | : ''; |
1882 | 1882 | |
1883 | 1883 | $test_settings_html = ''; |
1884 | 1884 | //print out $test_settings_fields |
1885 | - if ( !empty( $test_settings_fields ) ) { |
|
1885 | + if ( ! empty($test_settings_fields)) { |
|
1886 | 1886 | echo $test_settings_fields; |
1887 | - $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>'; |
|
1887 | + $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>'; |
|
1888 | 1888 | } |
1889 | 1889 | |
1890 | 1890 | //and button |
1891 | - echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>'; |
|
1891 | + echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>'; |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | |
@@ -1903,13 +1903,13 @@ discard block |
||
1903 | 1903 | * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
1904 | 1904 | * @return string |
1905 | 1905 | */ |
1906 | - protected function _get_shortcode_selector( $field, $linked_input_id ) { |
|
1906 | + protected function _get_shortcode_selector($field, $linked_input_id) { |
|
1907 | 1907 | $template_args = array( |
1908 | - 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
|
1908 | + 'shortcodes' => $this->_get_shortcodes(array($field), true), |
|
1909 | 1909 | 'fieldname' => $field, |
1910 | 1910 | 'linked_input_id' => $linked_input_id |
1911 | 1911 | ); |
1912 | - return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true ); |
|
1912 | + return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1924,13 +1924,13 @@ discard block |
||
1924 | 1924 | $shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set |
1925 | 1925 | //$messenger = $this->_message_template_group->messenger_obj(); |
1926 | 1926 | //now let's set the content depending on the status of the shortcodes array |
1927 | - if ( empty( $shortcodes ) ) { |
|
1928 | - $content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>'; |
|
1927 | + if (empty($shortcodes)) { |
|
1928 | + $content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>'; |
|
1929 | 1929 | echo $content; |
1930 | 1930 | } else { |
1931 | 1931 | //$alt = 0; |
1932 | 1932 | ?> |
1933 | - <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p> |
|
1933 | + <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p> |
|
1934 | 1934 | <?php |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | protected function _set_shortcodes() { |
1948 | 1948 | |
1949 | 1949 | //no need to run this if the property is already set |
1950 | - if ( !empty($this->_shortcodes ) ) {return;} |
|
1950 | + if ( ! empty($this->_shortcodes)) {return; } |
|
1951 | 1951 | |
1952 | 1952 | $this->_shortcodes = $this->_get_shortcodes(); |
1953 | 1953 | } |
@@ -1969,14 +1969,14 @@ discard block |
||
1969 | 1969 | * @return array Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true |
1970 | 1970 | * just an array of shortcode/label pairs. |
1971 | 1971 | */ |
1972 | - protected function _get_shortcodes( $fields = array(), $merged = true ) { |
|
1972 | + protected function _get_shortcodes($fields = array(), $merged = true) { |
|
1973 | 1973 | $this->_set_message_template_group(); |
1974 | 1974 | |
1975 | 1975 | //we need the messenger and message template to retrieve the valid shortcodes array. |
1976 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false; |
|
1977 | - $context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() ); |
|
1976 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false; |
|
1977 | + $context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config()); |
|
1978 | 1978 | |
1979 | - return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array(); |
|
1979 | + return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array(); |
|
1980 | 1980 | } |
1981 | 1981 | |
1982 | 1982 | |
@@ -1989,19 +1989,19 @@ discard block |
||
1989 | 1989 | */ |
1990 | 1990 | protected function _set_message_template_group() { |
1991 | 1991 | |
1992 | - if ( !empty( $this->_message_template_group ) ) |
|
1993 | - {return;} //get out if this is already set. |
|
1992 | + if ( ! empty($this->_message_template_group)) |
|
1993 | + {return; } //get out if this is already set. |
|
1994 | 1994 | |
1995 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false; |
|
1996 | - $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID; |
|
1995 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false; |
|
1996 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID; |
|
1997 | 1997 | |
1998 | 1998 | //let's get the message templates |
1999 | 1999 | $MTP = EEM_Message_Template_Group::instance(); |
2000 | 2000 | |
2001 | - if ( empty($GRP_ID) ) |
|
2002 | - {$this->_message_template_group = $MTP->create_default_object();} |
|
2001 | + if (empty($GRP_ID)) |
|
2002 | + {$this->_message_template_group = $MTP->create_default_object(); } |
|
2003 | 2003 | else |
2004 | - {$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );} |
|
2004 | + {$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); } |
|
2005 | 2005 | |
2006 | 2006 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
2007 | 2007 | $this->_variation = $this->_message_template_group->get_template_pack_variation(); |
@@ -2020,7 +2020,7 @@ discard block |
||
2020 | 2020 | * @param array $args various things the context switcher needs. |
2021 | 2021 | * |
2022 | 2022 | */ |
2023 | - protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) { |
|
2023 | + protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) { |
|
2024 | 2024 | $context_details = $template_group_object->contexts_config(); |
2025 | 2025 | $context_label = $template_group_object->context_label(); |
2026 | 2026 | ob_start(); |
@@ -2028,20 +2028,20 @@ discard block |
||
2028 | 2028 | <div class="ee-msg-switcher-container"> |
2029 | 2029 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm"> |
2030 | 2030 | <?php |
2031 | - foreach ( $args as $name => $value ) { |
|
2032 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;} |
|
2031 | + foreach ($args as $name => $value) { |
|
2032 | + if ($name == 'context' || empty($value) || $name == 'extra') {continue; } |
|
2033 | 2033 | ?> |
2034 | 2034 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" /> |
2035 | 2035 | <?php |
2036 | 2036 | } |
2037 | 2037 | //setup nonce_url |
2038 | - wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false); |
|
2038 | + wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false); |
|
2039 | 2039 | ?> |
2040 | 2040 | <select name="context"> |
2041 | 2041 | <?php |
2042 | 2042 | $context_templates = $template_group_object->context_templates(); |
2043 | - if ( is_array($context_templates) ) : |
|
2044 | - foreach ( $context_templates as $context => $template_fields ) : |
|
2043 | + if (is_array($context_templates)) : |
|
2044 | + foreach ($context_templates as $context => $template_fields) : |
|
2045 | 2045 | $checked = ($context == $args['context']) ? 'selected="selected"' : ''; |
2046 | 2046 | ?> |
2047 | 2047 | <option value="<?php echo $context; ?>" <?php echo $checked; ?>> |
@@ -2049,7 +2049,7 @@ discard block |
||
2049 | 2049 | </option> |
2050 | 2050 | <?php endforeach; endif; ?> |
2051 | 2051 | </select> |
2052 | - <?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?> |
|
2052 | + <?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?> |
|
2053 | 2053 | <input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>"> |
2054 | 2054 | </form> |
2055 | 2055 | <?php echo $args['extra']; ?> |
@@ -2076,8 +2076,8 @@ discard block |
||
2076 | 2076 | * @return array |
2077 | 2077 | */ |
2078 | 2078 | protected function _set_message_template_column_values($index) { |
2079 | - if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) { |
|
2080 | - foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) { |
|
2079 | + if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) { |
|
2080 | + foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) { |
|
2081 | 2081 | $this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value; |
2082 | 2082 | } |
2083 | 2083 | } /*else { |
@@ -2086,22 +2086,22 @@ discard block |
||
2086 | 2086 | |
2087 | 2087 | |
2088 | 2088 | $set_column_values = array( |
2089 | - 'MTP_ID' => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ), |
|
2090 | - 'GRP_ID' => absint( $this->_req_data[ 'GRP_ID' ] ), |
|
2091 | - 'MTP_user_id' => absint( $this->_req_data[ 'MTP_user_id' ] ), |
|
2092 | - 'MTP_messenger' => strtolower( $this->_req_data[ 'MTP_messenger' ] ), |
|
2093 | - 'MTP_message_type' => strtolower( $this->_req_data[ 'MTP_message_type' ] ), |
|
2094 | - 'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ), |
|
2095 | - 'MTP_context' => strtolower( $this->_req_data[ 'MTP_context' ] ), |
|
2096 | - 'MTP_content' => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ], |
|
2097 | - 'MTP_is_global' => isset( $this->_req_data[ 'MTP_is_global' ] ) |
|
2098 | - ? absint( $this->_req_data[ 'MTP_is_global' ] ) |
|
2089 | + 'MTP_ID' => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']), |
|
2090 | + 'GRP_ID' => absint($this->_req_data['GRP_ID']), |
|
2091 | + 'MTP_user_id' => absint($this->_req_data['MTP_user_id']), |
|
2092 | + 'MTP_messenger' => strtolower($this->_req_data['MTP_messenger']), |
|
2093 | + 'MTP_message_type' => strtolower($this->_req_data['MTP_message_type']), |
|
2094 | + 'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']), |
|
2095 | + 'MTP_context' => strtolower($this->_req_data['MTP_context']), |
|
2096 | + 'MTP_content' => $this->_req_data['MTP_template_fields'][$index]['content'], |
|
2097 | + 'MTP_is_global' => isset($this->_req_data['MTP_is_global']) |
|
2098 | + ? absint($this->_req_data['MTP_is_global']) |
|
2099 | 2099 | : 0, |
2100 | - 'MTP_is_override' => isset( $this->_req_data[ 'MTP_is_override' ] ) |
|
2101 | - ? absint( $this->_req_data[ 'MTP_is_override' ] ) |
|
2100 | + 'MTP_is_override' => isset($this->_req_data['MTP_is_override']) |
|
2101 | + ? absint($this->_req_data['MTP_is_override']) |
|
2102 | 2102 | : 0, |
2103 | - 'MTP_deleted' => absint( $this->_req_data[ 'MTP_deleted' ] ), |
|
2104 | - 'MTP_is_active' => absint( $this->_req_data[ 'MTP_is_active' ] ) |
|
2103 | + 'MTP_deleted' => absint($this->_req_data['MTP_deleted']), |
|
2104 | + 'MTP_is_active' => absint($this->_req_data['MTP_is_active']) |
|
2105 | 2105 | ); |
2106 | 2106 | |
2107 | 2107 | |
@@ -2113,36 +2113,36 @@ discard block |
||
2113 | 2113 | |
2114 | 2114 | |
2115 | 2115 | |
2116 | - protected function _insert_or_update_message_template($new = false ) { |
|
2116 | + protected function _insert_or_update_message_template($new = false) { |
|
2117 | 2117 | |
2118 | - do_action ( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2118 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2119 | 2119 | $success = 0; |
2120 | 2120 | $override = false; |
2121 | 2121 | |
2122 | 2122 | //setup notices description |
2123 | - $messenger = ! empty( $this->_req_data['MTP_messenger'] ) |
|
2124 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_messenger'] ) ) |
|
2123 | + $messenger = ! empty($this->_req_data['MTP_messenger']) |
|
2124 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) |
|
2125 | 2125 | : false; |
2126 | 2126 | |
2127 | - $message_type = ! empty( $this->_req_data['MTP_message_type'] ) |
|
2128 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_message_type'] ) ) |
|
2127 | + $message_type = ! empty($this->_req_data['MTP_message_type']) |
|
2128 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) |
|
2129 | 2129 | : false; |
2130 | 2130 | |
2131 | - $context = ! empty( $this->_req_data['MTP_context'] ) |
|
2132 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_context'] ) ) |
|
2131 | + $context = ! empty($this->_req_data['MTP_context']) |
|
2132 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) |
|
2133 | 2133 | : false; |
2134 | 2134 | |
2135 | - $item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : ''; |
|
2135 | + $item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : ''; |
|
2136 | 2136 | $item_desc .= 'Message Template'; |
2137 | 2137 | $query_args = array(); |
2138 | 2138 | $edit_array = array(); |
2139 | 2139 | $action_desc = ''; |
2140 | 2140 | |
2141 | 2141 | //if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit. |
2142 | - if ( $new ) { |
|
2143 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
2144 | - if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) { |
|
2145 | - if ( empty($edit_array) ) { |
|
2142 | + if ($new) { |
|
2143 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
2144 | + if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) { |
|
2145 | + if (empty($edit_array)) { |
|
2146 | 2146 | $success = 0; |
2147 | 2147 | } else { |
2148 | 2148 | $success = 1; |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | |
2162 | 2162 | |
2163 | 2163 | //run update for each template field in displayed context |
2164 | - if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) { |
|
2164 | + if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) { |
|
2165 | 2165 | EE_Error::add_error( |
2166 | 2166 | __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), |
2167 | 2167 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2170,25 +2170,25 @@ discard block |
||
2170 | 2170 | |
2171 | 2171 | } else { |
2172 | 2172 | //first validate all fields! |
2173 | - $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2173 | + $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2174 | 2174 | |
2175 | 2175 | //if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array. WE need to make sure there is no actual error messages in validates. |
2176 | - if ( is_array($validates) && !empty($validates) ) { |
|
2176 | + if (is_array($validates) && ! empty($validates)) { |
|
2177 | 2177 | //add the transient so when the form loads we know which fields to highlight |
2178 | - $this->_add_transient( 'edit_message_template', $validates ); |
|
2178 | + $this->_add_transient('edit_message_template', $validates); |
|
2179 | 2179 | |
2180 | 2180 | $success = 0; |
2181 | 2181 | |
2182 | 2182 | //setup notices |
2183 | - foreach ( $validates as $field => $error ) { |
|
2184 | - if ( isset($error['msg'] ) ) { |
|
2185 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ ); |
|
2183 | + foreach ($validates as $field => $error) { |
|
2184 | + if (isset($error['msg'])) { |
|
2185 | + EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__); |
|
2186 | 2186 | } |
2187 | 2187 | } |
2188 | 2188 | |
2189 | 2189 | } else { |
2190 | 2190 | $set_column_values = array(); |
2191 | - foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) { |
|
2191 | + foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) { |
|
2192 | 2192 | $set_column_values = $this->_set_message_template_column_values($template_field); |
2193 | 2193 | |
2194 | 2194 | $where_cols_n_values = array( |
@@ -2201,11 +2201,11 @@ discard block |
||
2201 | 2201 | 'MTP_context' => $set_column_values['MTP_context'], |
2202 | 2202 | 'MTP_content' => $set_column_values['MTP_content'] |
2203 | 2203 | ); |
2204 | - if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) { |
|
2205 | - if ( $updated === false ) { |
|
2204 | + if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) { |
|
2205 | + if ($updated === false) { |
|
2206 | 2206 | EE_Error::add_error( |
2207 | 2207 | sprintf( |
2208 | - __( '%s field was NOT updated for some reason', 'event_espresso' ), |
|
2208 | + __('%s field was NOT updated for some reason', 'event_espresso'), |
|
2209 | 2209 | $template_field |
2210 | 2210 | ), |
2211 | 2211 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2219,46 +2219,46 @@ discard block |
||
2219 | 2219 | |
2220 | 2220 | //we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs) |
2221 | 2221 | $mtpg_fields = array( |
2222 | - 'MTP_user_id' => $set_column_values[ 'MTP_user_id' ], |
|
2223 | - 'MTP_messenger' => $set_column_values[ 'MTP_messenger' ], |
|
2224 | - 'MTP_message_type' => $set_column_values[ 'MTP_message_type' ], |
|
2225 | - 'MTP_is_global' => $set_column_values[ 'MTP_is_global' ], |
|
2226 | - 'MTP_is_override' => $set_column_values[ 'MTP_is_override' ], |
|
2227 | - 'MTP_deleted' => $set_column_values[ 'MTP_deleted' ], |
|
2228 | - 'MTP_is_active' => $set_column_values[ 'MTP_is_active' ], |
|
2229 | - 'MTP_name' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] ) |
|
2230 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] |
|
2222 | + 'MTP_user_id' => $set_column_values['MTP_user_id'], |
|
2223 | + 'MTP_messenger' => $set_column_values['MTP_messenger'], |
|
2224 | + 'MTP_message_type' => $set_column_values['MTP_message_type'], |
|
2225 | + 'MTP_is_global' => $set_column_values['MTP_is_global'], |
|
2226 | + 'MTP_is_override' => $set_column_values['MTP_is_override'], |
|
2227 | + 'MTP_deleted' => $set_column_values['MTP_deleted'], |
|
2228 | + 'MTP_is_active' => $set_column_values['MTP_is_active'], |
|
2229 | + 'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) |
|
2230 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] |
|
2231 | 2231 | : '', |
2232 | - 'MTP_description' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] ) |
|
2233 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] |
|
2232 | + 'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) |
|
2233 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] |
|
2234 | 2234 | : '' |
2235 | 2235 | ); |
2236 | 2236 | |
2237 | - $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] ); |
|
2238 | - $updated = $MTPG->update( $mtpg_fields, array($mtpg_where) ); |
|
2237 | + $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']); |
|
2238 | + $updated = $MTPG->update($mtpg_fields, array($mtpg_where)); |
|
2239 | 2239 | |
2240 | - if ( $updated === false ) { |
|
2240 | + if ($updated === false) { |
|
2241 | 2241 | EE_Error::add_error( |
2242 | 2242 | sprintf( |
2243 | - __( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ), |
|
2244 | - $set_column_values[ 'GRP_ID' ] |
|
2243 | + __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), |
|
2244 | + $set_column_values['GRP_ID'] |
|
2245 | 2245 | ), |
2246 | 2246 | __FILE__, __FUNCTION__, __LINE__ |
2247 | 2247 | ); |
2248 | 2248 | } else { |
2249 | 2249 | //k now we need to ensure the template_pack and template_variation fields are set. |
2250 | - $template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) |
|
2250 | + $template_pack = ! empty($this->_req_data['MTP_template_pack']) |
|
2251 | 2251 | ? $this->_req_data['MTP_template_pack'] |
2252 | 2252 | : 'default'; |
2253 | 2253 | |
2254 | - $template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) |
|
2254 | + $template_variation = ! empty($this->_req_data['MTP_template_variation']) |
|
2255 | 2255 | ? $this->_req_data['MTP_template_variation'] |
2256 | 2256 | : 'default'; |
2257 | 2257 | |
2258 | - $mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] ); |
|
2259 | - if ( $mtpg_obj instanceof EE_Message_Template_Group ) { |
|
2260 | - $mtpg_obj->set_template_pack_name( $template_pack ); |
|
2261 | - $mtpg_obj->set_template_pack_variation( $template_variation ); |
|
2258 | + $mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']); |
|
2259 | + if ($mtpg_obj instanceof EE_Message_Template_Group) { |
|
2260 | + $mtpg_obj->set_template_pack_name($template_pack); |
|
2261 | + $mtpg_obj->set_template_pack_variation($template_variation); |
|
2262 | 2262 | } |
2263 | 2263 | $success = 1; |
2264 | 2264 | } |
@@ -2268,7 +2268,7 @@ discard block |
||
2268 | 2268 | } |
2269 | 2269 | |
2270 | 2270 | //we return things differently if doing ajax |
2271 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2271 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2272 | 2272 | $this->_template_args['success'] = $success; |
2273 | 2273 | $this->_template_args['error'] = ! $success ? true : false; |
2274 | 2274 | $this->_template_args['content'] = ''; |
@@ -2276,9 +2276,9 @@ discard block |
||
2276 | 2276 | 'grpID' => $edit_array['GRP_ID'], |
2277 | 2277 | 'templateName' => $edit_array['template_name'] |
2278 | 2278 | ); |
2279 | - if ( $success ) { |
|
2279 | + if ($success) { |
|
2280 | 2280 | EE_Error::overwrite_success(); |
2281 | - EE_Error::add_success( __('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso') ); |
|
2281 | + EE_Error::add_success(__('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso')); |
|
2282 | 2282 | } |
2283 | 2283 | |
2284 | 2284 | $this->_return_json(); |
@@ -2286,13 +2286,13 @@ discard block |
||
2286 | 2286 | |
2287 | 2287 | |
2288 | 2288 | //was a test send triggered? |
2289 | - if ( isset( $this->_req_data['test_button'] ) ) { |
|
2289 | + if (isset($this->_req_data['test_button'])) { |
|
2290 | 2290 | EE_Error::overwrite_success(); |
2291 | - $this->_do_test_send( $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] ); |
|
2291 | + $this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2292 | 2292 | $override = true; |
2293 | 2293 | } |
2294 | 2294 | |
2295 | - if ( empty( $query_args ) ) { |
|
2295 | + if (empty($query_args)) { |
|
2296 | 2296 | $query_args = array( |
2297 | 2297 | 'id' => $this->_req_data['GRP_ID'], |
2298 | 2298 | 'context' => $this->_req_data['MTP_context'], |
@@ -2300,7 +2300,7 @@ discard block |
||
2300 | 2300 | ); |
2301 | 2301 | } |
2302 | 2302 | |
2303 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override ); |
|
2303 | + $this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override); |
|
2304 | 2304 | } |
2305 | 2305 | |
2306 | 2306 | |
@@ -2314,28 +2314,28 @@ discard block |
||
2314 | 2314 | * @param string $message_type message type being tested |
2315 | 2315 | * |
2316 | 2316 | */ |
2317 | - protected function _do_test_send( $context, $messenger, $message_type ) { |
|
2317 | + protected function _do_test_send($context, $messenger, $message_type) { |
|
2318 | 2318 | //set things up for preview |
2319 | 2319 | $this->_req_data['messenger'] = $messenger; |
2320 | 2320 | $this->_req_data['message_type'] = $message_type; |
2321 | 2321 | $this->_req_data['context'] = $context; |
2322 | - $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : ''; |
|
2323 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
2322 | + $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : ''; |
|
2323 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($messenger); |
|
2324 | 2324 | |
2325 | 2325 | //let's save any existing fields that might be required by the messenger |
2326 | 2326 | if ( |
2327 | - isset( $this->_req_data['test_settings_fld'] ) |
|
2327 | + isset($this->_req_data['test_settings_fld']) |
|
2328 | 2328 | && $active_messenger instanceof EE_messenger |
2329 | 2329 | ) { |
2330 | - $active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] ); |
|
2330 | + $active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']); |
|
2331 | 2331 | } |
2332 | 2332 | |
2333 | 2333 | $success = $this->_preview_message(true); |
2334 | 2334 | |
2335 | - if ( $success ) { |
|
2336 | - EE_Error::add_success( __('Test message sent', 'event_espresso') ); |
|
2335 | + if ($success) { |
|
2336 | + EE_Error::add_success(__('Test message sent', 'event_espresso')); |
|
2337 | 2337 | } else { |
2338 | - EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
2338 | + EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2339 | 2339 | } |
2340 | 2340 | } |
2341 | 2341 | |
@@ -2361,11 +2361,11 @@ discard block |
||
2361 | 2361 | protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) { |
2362 | 2362 | |
2363 | 2363 | //if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates. |
2364 | - if ( empty( $message_types ) ) { |
|
2364 | + if (empty($message_types)) { |
|
2365 | 2365 | return true; |
2366 | 2366 | } |
2367 | 2367 | |
2368 | - return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global ); |
|
2368 | + return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global); |
|
2369 | 2369 | } |
2370 | 2370 | |
2371 | 2371 | |
@@ -2381,33 +2381,33 @@ discard block |
||
2381 | 2381 | * |
2382 | 2382 | * @return void |
2383 | 2383 | */ |
2384 | - protected function _trash_or_restore_message_template($trash = true, $all = false ) { |
|
2385 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2384 | + protected function _trash_or_restore_message_template($trash = true, $all = false) { |
|
2385 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2386 | 2386 | $MTP = EEM_Message_Template_Group::instance(); |
2387 | 2387 | |
2388 | 2388 | $success = 1; |
2389 | 2389 | |
2390 | 2390 | //incoming GRP_IDs |
2391 | - if ( $all ) { |
|
2391 | + if ($all) { |
|
2392 | 2392 | //Checkboxes |
2393 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) { |
|
2393 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2394 | 2394 | //if array has more than one element then success message should be plural. |
2395 | 2395 | //todo: what about nonce? |
2396 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2396 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2397 | 2397 | |
2398 | 2398 | //cycle through checkboxes |
2399 | - while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) { |
|
2400 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2401 | - if ( ! $trashed_or_restored ) { |
|
2399 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2400 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2401 | + if ( ! $trashed_or_restored) { |
|
2402 | 2402 | $success = 0; |
2403 | 2403 | } |
2404 | 2404 | } |
2405 | 2405 | } else { |
2406 | 2406 | //grab single GRP_ID and handle |
2407 | - $GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
2408 | - if ( ! empty( $GRP_ID ) ) { |
|
2409 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2410 | - if ( ! $trashed_or_restored ) { |
|
2407 | + $GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
2408 | + if ( ! empty($GRP_ID)) { |
|
2409 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2410 | + if ( ! $trashed_or_restored) { |
|
2411 | 2411 | $success = 0; |
2412 | 2412 | } |
2413 | 2413 | } else { |
@@ -2419,13 +2419,13 @@ discard block |
||
2419 | 2419 | |
2420 | 2420 | $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
2421 | 2421 | |
2422 | - $action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc; |
|
2422 | + $action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc; |
|
2423 | 2423 | |
2424 | 2424 | $item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso'); |
2425 | 2425 | |
2426 | - $item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2426 | + $item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2427 | 2427 | |
2428 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, array() ); |
|
2428 | + $this->_redirect_after_action($success, $item_desc, $action_desc, array()); |
|
2429 | 2429 | |
2430 | 2430 | } |
2431 | 2431 | |
@@ -2441,24 +2441,24 @@ discard block |
||
2441 | 2441 | * @return void |
2442 | 2442 | */ |
2443 | 2443 | protected function _delete_message_template() { |
2444 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2444 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2445 | 2445 | |
2446 | 2446 | //checkboxes |
2447 | - if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) { |
|
2447 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2448 | 2448 | //if array has more than one element then success message should be plural |
2449 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2449 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2450 | 2450 | |
2451 | 2451 | //cycle through bulk action checkboxes |
2452 | - while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) { |
|
2453 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2452 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2453 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2454 | 2454 | } |
2455 | 2455 | } else { |
2456 | 2456 | //grab single grp_id and delete |
2457 | - $GRP_ID = absint($this->_req_data['id'] ); |
|
2458 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2457 | + $GRP_ID = absint($this->_req_data['id']); |
|
2458 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2459 | 2459 | } |
2460 | 2460 | |
2461 | - $this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() ); |
|
2461 | + $this->_redirect_after_action($success, 'Message Templates', 'deleted', array()); |
|
2462 | 2462 | |
2463 | 2463 | } |
2464 | 2464 | |
@@ -2473,20 +2473,20 @@ discard block |
||
2473 | 2473 | * |
2474 | 2474 | * @return bool boolean to indicate the success of the deletes or not. |
2475 | 2475 | */ |
2476 | - private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) { |
|
2476 | + private function _delete_mtp_permanently($GRP_ID, $include_group = true) { |
|
2477 | 2477 | $success = 1; |
2478 | 2478 | $MTPG = EEM_Message_Template_Group::instance(); |
2479 | 2479 | //first let's GET this group |
2480 | - $MTG = $MTPG->get_one_by_ID( $GRP_ID ); |
|
2480 | + $MTG = $MTPG->get_one_by_ID($GRP_ID); |
|
2481 | 2481 | //then delete permanently all the related Message Templates |
2482 | - $deleted = $MTG->delete_related_permanently( 'Message_Template' ); |
|
2482 | + $deleted = $MTG->delete_related_permanently('Message_Template'); |
|
2483 | 2483 | |
2484 | - if ( $deleted === 0 ) |
|
2485 | - {$success = 0;} |
|
2484 | + if ($deleted === 0) |
|
2485 | + {$success = 0; } |
|
2486 | 2486 | |
2487 | 2487 | //now delete permanently this particular group |
2488 | 2488 | |
2489 | - if ( $include_group && ! $MTG->delete_permanently() ) { |
|
2489 | + if ($include_group && ! $MTG->delete_permanently()) { |
|
2490 | 2490 | $success = 0; |
2491 | 2491 | } |
2492 | 2492 | return $success; |
@@ -2504,7 +2504,7 @@ discard block |
||
2504 | 2504 | * @return string |
2505 | 2505 | */ |
2506 | 2506 | protected function _learn_more_about_message_templates_link() { |
2507 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
|
2507 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>'; |
|
2508 | 2508 | } |
2509 | 2509 | |
2510 | 2510 | |
@@ -2522,10 +2522,10 @@ discard block |
||
2522 | 2522 | |
2523 | 2523 | $this->_set_m_mt_settings(); |
2524 | 2524 | |
2525 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2525 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2526 | 2526 | |
2527 | 2527 | //let's setup the messenger tabs |
2528 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger ); |
|
2528 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger); |
|
2529 | 2529 | $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">'; |
2530 | 2530 | $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->'; |
2531 | 2531 | |
@@ -2544,7 +2544,7 @@ discard block |
||
2544 | 2544 | */ |
2545 | 2545 | protected function _set_m_mt_settings() { |
2546 | 2546 | //first if this is already set then lets get out no need to regenerate data. |
2547 | - if ( !empty($this->_m_mt_settings) ) { |
|
2547 | + if ( ! empty($this->_m_mt_settings)) { |
|
2548 | 2548 | return; |
2549 | 2549 | } |
2550 | 2550 | |
@@ -2559,10 +2559,10 @@ discard block |
||
2559 | 2559 | |
2560 | 2560 | //assemble the array for the _tab_text_links helper |
2561 | 2561 | |
2562 | - foreach ( $messengers as $messenger ) { |
|
2562 | + foreach ($messengers as $messenger) { |
|
2563 | 2563 | $this->_m_mt_settings['messenger_tabs'][$messenger->name] = array( |
2564 | 2564 | 'label' => ucwords($messenger->label['singular']), |
2565 | - 'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '', |
|
2565 | + 'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '', |
|
2566 | 2566 | 'href' => $messenger->name, |
2567 | 2567 | 'title' => __('Modify this Messenger', 'event_espresso'), |
2568 | 2568 | 'slug' => $messenger->name, |
@@ -2572,26 +2572,26 @@ discard block |
||
2572 | 2572 | |
2573 | 2573 | $message_types_for_messenger = $messenger->get_valid_message_types(); |
2574 | 2574 | |
2575 | - foreach ( $message_types as $message_type ) { |
|
2575 | + foreach ($message_types as $message_type) { |
|
2576 | 2576 | //first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox. |
2577 | - if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) { |
|
2577 | + if ( ! in_array($message_type->name, $message_types_for_messenger)) { |
|
2578 | 2578 | continue; |
2579 | 2579 | } |
2580 | 2580 | |
2581 | - $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive'; |
|
2581 | + $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive'; |
|
2582 | 2582 | |
2583 | 2583 | $this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array( |
2584 | - 'label' => ucwords( $message_type->label[ 'singular' ] ), |
|
2585 | - 'class' => 'message-type-' . $a_or_i, |
|
2586 | - 'slug_id' => $message_type->name . '-messagetype-' . $messenger->name, |
|
2587 | - 'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ), |
|
2588 | - 'href' => 'espresso_' . $message_type->name . '_message_type_settings', |
|
2584 | + 'label' => ucwords($message_type->label['singular']), |
|
2585 | + 'class' => 'message-type-'.$a_or_i, |
|
2586 | + 'slug_id' => $message_type->name.'-messagetype-'.$messenger->name, |
|
2587 | + 'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'), |
|
2588 | + 'href' => 'espresso_'.$message_type->name.'_message_type_settings', |
|
2589 | 2589 | 'title' => $a_or_i == 'active' |
2590 | - ? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' ) |
|
2591 | - : __( 'Drag this message type to the messenger to activate', 'event_espresso' ), |
|
2590 | + ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') |
|
2591 | + : __('Drag this message type to the messenger to activate', 'event_espresso'), |
|
2592 | 2592 | 'content' => $a_or_i == 'active' |
2593 | - ? $this->_message_type_settings_content( $message_type, $messenger, true ) |
|
2594 | - : $this->_message_type_settings_content( $message_type, $messenger ), |
|
2593 | + ? $this->_message_type_settings_content($message_type, $messenger, true) |
|
2594 | + : $this->_message_type_settings_content($message_type, $messenger), |
|
2595 | 2595 | 'slug' => $message_type->name, |
2596 | 2596 | 'active' => $a_or_i == 'active' ? true : false, |
2597 | 2597 | 'obj' => $message_type |
@@ -2610,34 +2610,34 @@ discard block |
||
2610 | 2610 | * |
2611 | 2611 | * @return string html output for the content |
2612 | 2612 | */ |
2613 | - protected function _message_type_settings_content( $message_type, $messenger, $active = false ) { |
|
2613 | + protected function _message_type_settings_content($message_type, $messenger, $active = false) { |
|
2614 | 2614 | //get message type fields |
2615 | 2615 | $fields = $message_type->get_admin_settings_fields(); |
2616 | - $settings_template_args['template_form_fields']= ''; |
|
2616 | + $settings_template_args['template_form_fields'] = ''; |
|
2617 | 2617 | |
2618 | - if ( !empty( $fields ) && $active ) { |
|
2618 | + if ( ! empty($fields) && $active) { |
|
2619 | 2619 | |
2620 | - $existing_settings = $message_type->get_existing_admin_settings( $messenger->name ); |
|
2620 | + $existing_settings = $message_type->get_existing_admin_settings($messenger->name); |
|
2621 | 2621 | |
2622 | - foreach( $fields as $fldname => $fldprops ) { |
|
2623 | - $field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname; |
|
2622 | + foreach ($fields as $fldname => $fldprops) { |
|
2623 | + $field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname; |
|
2624 | 2624 | $template_form_field[$field_id] = array( |
2625 | - 'name' => 'message_type_settings[' . $fldname . ']', |
|
2625 | + 'name' => 'message_type_settings['.$fldname.']', |
|
2626 | 2626 | 'label' => $fldprops['label'], |
2627 | 2627 | 'input' => $fldprops['field_type'], |
2628 | 2628 | 'type' => $fldprops['value_type'], |
2629 | 2629 | 'required' => $fldprops['required'], |
2630 | 2630 | 'validation' => $fldprops['validation'], |
2631 | - 'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2632 | - 'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(), |
|
2633 | - 'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2631 | + 'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2632 | + 'options' => isset($fldprops['options']) ? $fldprops['options'] : array(), |
|
2633 | + 'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2634 | 2634 | 'css_class' => 'no-drag', |
2635 | 2635 | 'format' => $fldprops['format'] |
2636 | 2636 | ); |
2637 | 2637 | } |
2638 | 2638 | |
2639 | 2639 | |
2640 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : ''; |
|
2640 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : ''; |
|
2641 | 2641 | } |
2642 | 2642 | |
2643 | 2643 | $settings_template_args['description'] = $message_type->description; |
@@ -2657,13 +2657,13 @@ discard block |
||
2657 | 2657 | ) |
2658 | 2658 | ); |
2659 | 2659 | |
2660 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' ); |
|
2661 | - $settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : ''; |
|
2660 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array'); |
|
2661 | + $settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : ''; |
|
2662 | 2662 | |
2663 | 2663 | |
2664 | 2664 | |
2665 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php'; |
|
2666 | - $content = EEH_Template::display_template( $template, $settings_template_args, true ); |
|
2665 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php'; |
|
2666 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2667 | 2667 | return $content; |
2668 | 2668 | } |
2669 | 2669 | |
@@ -2680,27 +2680,27 @@ discard block |
||
2680 | 2680 | $m_boxes = $mt_boxes = array(); |
2681 | 2681 | $m_template_args = $mt_template_args = array(); |
2682 | 2682 | |
2683 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2683 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2684 | 2684 | |
2685 | - if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) { |
|
2686 | - foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) { |
|
2687 | - $hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden'; |
|
2688 | - $hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : ''; |
|
2685 | + if (isset($this->_m_mt_settings['messenger_tabs'])) { |
|
2686 | + foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) { |
|
2687 | + $hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden'; |
|
2688 | + $hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : ''; |
|
2689 | 2689 | //messenger meta boxes |
2690 | 2690 | $active = $selected_messenger == $messenger ? true : false; |
2691 | - $active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] ) |
|
2692 | - ? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] |
|
2691 | + $active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) |
|
2692 | + ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] |
|
2693 | 2693 | : ''; |
2694 | - $m_boxes[ $messenger . '_a_box' ] = sprintf( |
|
2695 | - __( '%s Settings', 'event_espresso' ), |
|
2696 | - $tab_array[ 'label' ] |
|
2694 | + $m_boxes[$messenger.'_a_box'] = sprintf( |
|
2695 | + __('%s Settings', 'event_espresso'), |
|
2696 | + $tab_array['label'] |
|
2697 | 2697 | ); |
2698 | - $m_template_args[ $messenger . '_a_box' ] = array( |
|
2699 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2700 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2701 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2698 | + $m_template_args[$messenger.'_a_box'] = array( |
|
2699 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2700 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2701 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2702 | 2702 | : '', |
2703 | - 'content' => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ), |
|
2703 | + 'content' => $this->_get_messenger_box_content($tab_array['obj']), |
|
2704 | 2704 | 'hidden' => $active ? '' : ' hidden', |
2705 | 2705 | 'hide_on_message' => $hide_on_message, |
2706 | 2706 | 'messenger' => $messenger, |
@@ -2709,11 +2709,11 @@ discard block |
||
2709 | 2709 | // message type meta boxes |
2710 | 2710 | // (which is really just the inactive container for each messenger |
2711 | 2711 | // showing inactive message types for that messenger) |
2712 | - $mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' ); |
|
2713 | - $mt_template_args[ $messenger . '_i_box' ] = array( |
|
2714 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2715 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2716 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2712 | + $mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso'); |
|
2713 | + $mt_template_args[$messenger.'_i_box'] = array( |
|
2714 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2715 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2716 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2717 | 2717 | : '', |
2718 | 2718 | 'hidden' => $active ? '' : ' hidden', |
2719 | 2719 | 'hide_on_message' => $hide_on_message, |
@@ -2726,15 +2726,15 @@ discard block |
||
2726 | 2726 | |
2727 | 2727 | |
2728 | 2728 | //register messenger metaboxes |
2729 | - $m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2730 | - foreach ( $m_boxes as $box => $label ) { |
|
2731 | - $callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] ); |
|
2732 | - $msgr = str_replace( '_a_box', '', $box ); |
|
2729 | + $m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2730 | + foreach ($m_boxes as $box => $label) { |
|
2731 | + $callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]); |
|
2732 | + $msgr = str_replace('_a_box', '', $box); |
|
2733 | 2733 | add_meta_box( |
2734 | - 'espresso_' . $msgr . '_settings', |
|
2734 | + 'espresso_'.$msgr.'_settings', |
|
2735 | 2735 | $label, |
2736 | - function( $post, $metabox ) { |
|
2737 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2736 | + function($post, $metabox) { |
|
2737 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2738 | 2738 | }, |
2739 | 2739 | $this->_current_screen->id, |
2740 | 2740 | 'normal', |
@@ -2744,17 +2744,17 @@ discard block |
||
2744 | 2744 | } |
2745 | 2745 | |
2746 | 2746 | //register message type metaboxes |
2747 | - $mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php'; |
|
2748 | - foreach ( $mt_boxes as $box => $label ) { |
|
2747 | + $mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php'; |
|
2748 | + foreach ($mt_boxes as $box => $label) { |
|
2749 | 2749 | $callback_args = array( |
2750 | - 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ] |
|
2750 | + 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] |
|
2751 | 2751 | ); |
2752 | - $mt = str_replace( '_i_box', '', $box ); |
|
2752 | + $mt = str_replace('_i_box', '', $box); |
|
2753 | 2753 | add_meta_box( |
2754 | - 'espresso_' . $mt . '_inactive_mts', |
|
2754 | + 'espresso_'.$mt.'_inactive_mts', |
|
2755 | 2755 | $label, |
2756 | - function( $post, $metabox ) { |
|
2757 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2756 | + function($post, $metabox) { |
|
2757 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2758 | 2758 | }, |
2759 | 2759 | $this->_current_screen->id, |
2760 | 2760 | 'side', |
@@ -2765,11 +2765,11 @@ discard block |
||
2765 | 2765 | |
2766 | 2766 | //register metabox for global messages settings but only when on the main site. On single site installs this will |
2767 | 2767 | //always result in the metabox showing, on multisite installs the metabox will only show on the main site. |
2768 | - if ( is_main_site() ) { |
|
2768 | + if (is_main_site()) { |
|
2769 | 2769 | add_meta_box( |
2770 | 2770 | 'espresso_global_message_settings', |
2771 | - __( 'Global Message Settings', 'event_espresso' ), |
|
2772 | - array( $this, 'global_messages_settings_metabox_content' ), |
|
2771 | + __('Global Message Settings', 'event_espresso'), |
|
2772 | + array($this, 'global_messages_settings_metabox_content'), |
|
2773 | 2773 | $this->_current_screen->id, |
2774 | 2774 | 'normal', |
2775 | 2775 | 'low', |
@@ -2789,7 +2789,7 @@ discard block |
||
2789 | 2789 | public function global_messages_settings_metabox_content() { |
2790 | 2790 | $form = $this->_generate_global_settings_form(); |
2791 | 2791 | echo $form->form_open( |
2792 | - $this->add_query_args_and_nonce( array( 'action' => 'update_global_settings' ), EE_MSG_ADMIN_URL ), |
|
2792 | + $this->add_query_args_and_nonce(array('action' => 'update_global_settings'), EE_MSG_ADMIN_URL), |
|
2793 | 2793 | 'POST' |
2794 | 2794 | ) |
2795 | 2795 | . $form->get_html() |
@@ -2802,7 +2802,7 @@ discard block |
||
2802 | 2802 | * @return EE_Form_Section_Proper |
2803 | 2803 | */ |
2804 | 2804 | protected function _generate_global_settings_form() { |
2805 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
2805 | + EE_Registry::instance()->load_helper('HTML'); |
|
2806 | 2806 | /** @var EE_Network_Core_Config $network_config */ |
2807 | 2807 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2808 | 2808 | return new EE_Form_Section_Proper( |
@@ -2821,13 +2821,13 @@ discard block |
||
2821 | 2821 | ), |
2822 | 2822 | array( |
2823 | 2823 | 'default' => $network_config->do_messages_on_same_request, |
2824 | - 'html_label_text' => __( 'Generate and send all messages:', 'event_espresso' ), |
|
2825 | - 'html_help_text' => __( 'By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso' ), |
|
2824 | + 'html_label_text' => __('Generate and send all messages:', 'event_espresso'), |
|
2825 | + 'html_help_text' => __('By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso'), |
|
2826 | 2826 | ) |
2827 | 2827 | ), |
2828 | 2828 | 'update_settings' => new EE_Submit_Input( |
2829 | 2829 | array( |
2830 | - 'default' => __( 'Update', 'event_espresso' ), |
|
2830 | + 'default' => __('Update', 'event_espresso'), |
|
2831 | 2831 | 'html_label_text' => ' ' |
2832 | 2832 | ) |
2833 | 2833 | ) |
@@ -2846,28 +2846,28 @@ discard block |
||
2846 | 2846 | /** @var EE_Network_Core_Config $network_config */ |
2847 | 2847 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2848 | 2848 | $form = $this->_generate_global_settings_form(); |
2849 | - if ( $form->was_submitted() ) { |
|
2849 | + if ($form->was_submitted()) { |
|
2850 | 2850 | $form->receive_form_submission(); |
2851 | - if ( $form->is_valid() ) { |
|
2851 | + if ($form->is_valid()) { |
|
2852 | 2852 | $valid_data = $form->valid_data(); |
2853 | - foreach( $valid_data as $property => $value ) { |
|
2854 | - $setter = 'set_' . $property; |
|
2855 | - if ( method_exists( $network_config, $setter ) ) { |
|
2856 | - $network_config->{$setter}( $value ); |
|
2853 | + foreach ($valid_data as $property => $value) { |
|
2854 | + $setter = 'set_'.$property; |
|
2855 | + if (method_exists($network_config, $setter)) { |
|
2856 | + $network_config->{$setter}($value); |
|
2857 | 2857 | } else if ( |
2858 | - property_exists( $network_config, $property ) |
|
2858 | + property_exists($network_config, $property) |
|
2859 | 2859 | && $network_config->{$property} !== $value |
2860 | 2860 | ) { |
2861 | 2861 | $network_config->{$property} = $value; |
2862 | 2862 | } |
2863 | 2863 | } |
2864 | 2864 | //only update if the form submission was valid! |
2865 | - EE_Registry::instance()->NET_CFG->update_config( true, false ); |
|
2865 | + EE_Registry::instance()->NET_CFG->update_config(true, false); |
|
2866 | 2866 | EE_Error::overwrite_success(); |
2867 | - EE_Error::add_success( __( 'Global message settings were updated', 'event_espresso' ) ); |
|
2867 | + EE_Error::add_success(__('Global message settings were updated', 'event_espresso')); |
|
2868 | 2868 | } |
2869 | 2869 | } |
2870 | - $this->_redirect_after_action( 0, '', '', array( 'action' => 'settings' ), true ); |
|
2870 | + $this->_redirect_after_action(0, '', '', array('action' => 'settings'), true); |
|
2871 | 2871 | } |
2872 | 2872 | |
2873 | 2873 | |
@@ -2878,13 +2878,13 @@ discard block |
||
2878 | 2878 | * |
2879 | 2879 | * @return string html formatted tabs |
2880 | 2880 | */ |
2881 | - protected function _get_mt_tabs( $tab_array ) { |
|
2881 | + protected function _get_mt_tabs($tab_array) { |
|
2882 | 2882 | $tab_array = (array) $tab_array; |
2883 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2883 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2884 | 2884 | $tabs = ''; |
2885 | 2885 | |
2886 | - foreach ( $tab_array as $tab ) { |
|
2887 | - $tabs .= EEH_Template::display_template( $template, $tab, true ); |
|
2886 | + foreach ($tab_array as $tab) { |
|
2887 | + $tabs .= EEH_Template::display_template($template, $tab, true); |
|
2888 | 2888 | } |
2889 | 2889 | |
2890 | 2890 | return $tabs; |
@@ -2900,29 +2900,29 @@ discard block |
||
2900 | 2900 | * |
2901 | 2901 | * @return string html formatted content |
2902 | 2902 | */ |
2903 | - protected function _get_messenger_box_content( EE_messenger $messenger ) { |
|
2903 | + protected function _get_messenger_box_content(EE_messenger $messenger) { |
|
2904 | 2904 | |
2905 | 2905 | $fields = $messenger->get_admin_settings_fields(); |
2906 | 2906 | $settings_template_args['template_form_fields'] = ''; |
2907 | 2907 | |
2908 | 2908 | //is $messenger active? |
2909 | - $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
2909 | + $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
2910 | 2910 | |
2911 | 2911 | |
2912 | - if ( ! empty( $fields ) ) { |
|
2912 | + if ( ! empty($fields)) { |
|
2913 | 2913 | |
2914 | 2914 | $existing_settings = $messenger->get_existing_admin_settings(); |
2915 | 2915 | |
2916 | - foreach( $fields as $fldname => $fldprops ) { |
|
2917 | - $field_id = $messenger->name . '-' . $fldname; |
|
2916 | + foreach ($fields as $fldname => $fldprops) { |
|
2917 | + $field_id = $messenger->name.'-'.$fldname; |
|
2918 | 2918 | $template_form_field[$field_id] = array( |
2919 | - 'name' => 'messenger_settings[' . $field_id . ']', |
|
2919 | + 'name' => 'messenger_settings['.$field_id.']', |
|
2920 | 2920 | 'label' => $fldprops['label'], |
2921 | 2921 | 'input' => $fldprops['field_type'], |
2922 | 2922 | 'type' => $fldprops['value_type'], |
2923 | 2923 | 'required' => $fldprops['required'], |
2924 | 2924 | 'validation' => $fldprops['validation'], |
2925 | - 'value' => isset( $existing_settings[$field_id]) |
|
2925 | + 'value' => isset($existing_settings[$field_id]) |
|
2926 | 2926 | ? $existing_settings[$field_id] |
2927 | 2927 | : $fldprops['default'], |
2928 | 2928 | 'css_class' => '', |
@@ -2931,8 +2931,8 @@ discard block |
||
2931 | 2931 | } |
2932 | 2932 | |
2933 | 2933 | |
2934 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) |
|
2935 | - ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) |
|
2934 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) |
|
2935 | + ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') |
|
2936 | 2936 | : ''; |
2937 | 2937 | } |
2938 | 2938 | |
@@ -2949,39 +2949,39 @@ discard block |
||
2949 | 2949 | ); |
2950 | 2950 | |
2951 | 2951 | //make sure any active message types that are existing are included in the hidden fields |
2952 | - if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) { |
|
2953 | - foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) { |
|
2952 | + if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) { |
|
2953 | + foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) { |
|
2954 | 2954 | $settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array( |
2955 | 2955 | 'type' => 'hidden', |
2956 | 2956 | 'value' => $mt |
2957 | 2957 | ); |
2958 | 2958 | } |
2959 | 2959 | } |
2960 | - $settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields( |
|
2961 | - $settings_template_args[ 'hidden_fields' ], |
|
2960 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( |
|
2961 | + $settings_template_args['hidden_fields'], |
|
2962 | 2962 | 'array' |
2963 | 2963 | ); |
2964 | - $active = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
2964 | + $active = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
2965 | 2965 | |
2966 | 2966 | $settings_template_args['messenger'] = $messenger->name; |
2967 | 2967 | $settings_template_args['description'] = $messenger->description; |
2968 | 2968 | $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden'; |
2969 | 2969 | |
2970 | 2970 | |
2971 | - $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ) |
|
2971 | + $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name) |
|
2972 | 2972 | ? $settings_template_args['show_hide_edit_form'] |
2973 | 2973 | : ' hidden'; |
2974 | 2974 | |
2975 | - $settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) |
|
2975 | + $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) |
|
2976 | 2976 | ? ' hidden' |
2977 | 2977 | : $settings_template_args['show_hide_edit_form']; |
2978 | 2978 | |
2979 | 2979 | |
2980 | 2980 | $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on'; |
2981 | - $settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce'); |
|
2981 | + $settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce'); |
|
2982 | 2982 | $settings_template_args['on_off_status'] = $active ? true : false; |
2983 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php'; |
|
2984 | - $content = EEH_Template::display_template( $template, $settings_template_args, true); |
|
2983 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php'; |
|
2984 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2985 | 2985 | return $content; |
2986 | 2986 | } |
2987 | 2987 | |
@@ -2995,9 +2995,9 @@ discard block |
||
2995 | 2995 | $success = true; |
2996 | 2996 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
2997 | 2997 | //let's check that we have required data |
2998 | - if ( !isset( $this->_req_data[ 'messenger' ] ) ) { |
|
2998 | + if ( ! isset($this->_req_data['messenger'])) { |
|
2999 | 2999 | EE_Error::add_error( |
3000 | - __( 'Messenger name needed to toggle activation. None given', 'event_espresso' ), |
|
3000 | + __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
|
3001 | 3001 | __FILE__, |
3002 | 3002 | __FUNCTION__, |
3003 | 3003 | __LINE__ |
@@ -3006,14 +3006,14 @@ discard block |
||
3006 | 3006 | } |
3007 | 3007 | |
3008 | 3008 | //do a nonce check here since we're not arriving via a normal route |
3009 | - $nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : ''; |
|
3010 | - $nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce'; |
|
3009 | + $nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : ''; |
|
3010 | + $nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce'; |
|
3011 | 3011 | |
3012 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3012 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3013 | 3013 | |
3014 | 3014 | |
3015 | 3015 | |
3016 | - if ( !isset( $this->_req_data[ 'status' ])) { |
|
3016 | + if ( ! isset($this->_req_data['status'])) { |
|
3017 | 3017 | EE_Error::add_error( |
3018 | 3018 | __( |
3019 | 3019 | 'Messenger status needed to know whether activation or deactivation is happening. No status is given', |
@@ -3029,11 +3029,11 @@ discard block |
||
3029 | 3029 | //do check to verify we have a valid status. |
3030 | 3030 | $status = $this->_req_data['status']; |
3031 | 3031 | |
3032 | - if ( $status != 'off' && $status != 'on' ) { |
|
3032 | + if ($status != 'off' && $status != 'on') { |
|
3033 | 3033 | EE_Error::add_error( |
3034 | 3034 | sprintf( |
3035 | - __( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ), |
|
3036 | - $this->_req_data[ 'status' ] |
|
3035 | + __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), |
|
3036 | + $this->_req_data['status'] |
|
3037 | 3037 | ), |
3038 | 3038 | __FILE__, |
3039 | 3039 | __FUNCTION__, |
@@ -3042,11 +3042,11 @@ discard block |
||
3042 | 3042 | $success = false; |
3043 | 3043 | } |
3044 | 3044 | |
3045 | - if ( $success ) { |
|
3045 | + if ($success) { |
|
3046 | 3046 | //made it here? Stop dawdling then!! |
3047 | 3047 | $success = $status == 'off' |
3048 | - ? $this->_deactivate_messenger( $this->_req_data['messenger'] ) |
|
3049 | - : $this->_activate_messenger( $this->_req_data['messenger'] ); |
|
3048 | + ? $this->_deactivate_messenger($this->_req_data['messenger']) |
|
3049 | + : $this->_activate_messenger($this->_req_data['messenger']); |
|
3050 | 3050 | } |
3051 | 3051 | |
3052 | 3052 | $this->_template_args['success'] = $success; |
@@ -3069,7 +3069,7 @@ discard block |
||
3069 | 3069 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
3070 | 3070 | |
3071 | 3071 | //let's make sure we have the necessary data |
3072 | - if ( ! isset( $this->_req_data[ 'message_type' ] ) ) { |
|
3072 | + if ( ! isset($this->_req_data['message_type'])) { |
|
3073 | 3073 | EE_Error::add_error( |
3074 | 3074 | __('Message Type name needed to toggle activation. None given', 'event_espresso'), |
3075 | 3075 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3077,7 +3077,7 @@ discard block |
||
3077 | 3077 | $success = false; |
3078 | 3078 | } |
3079 | 3079 | |
3080 | - if ( ! isset( $this->_req_data[ 'messenger' ] ) ) { |
|
3080 | + if ( ! isset($this->_req_data['messenger'])) { |
|
3081 | 3081 | EE_Error::add_error( |
3082 | 3082 | __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
3083 | 3083 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3085,7 +3085,7 @@ discard block |
||
3085 | 3085 | $success = false; |
3086 | 3086 | } |
3087 | 3087 | |
3088 | - if ( ! isset( $this->_req_data[ 'status' ])) { |
|
3088 | + if ( ! isset($this->_req_data['status'])) { |
|
3089 | 3089 | EE_Error::add_error( |
3090 | 3090 | __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), |
3091 | 3091 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3097,7 +3097,7 @@ discard block |
||
3097 | 3097 | //do check to verify we have a valid status. |
3098 | 3098 | $status = $this->_req_data['status']; |
3099 | 3099 | |
3100 | - if ( $status != 'activate' && $status != 'deactivate' ) { |
|
3100 | + if ($status != 'activate' && $status != 'deactivate') { |
|
3101 | 3101 | EE_Error::add_error( |
3102 | 3102 | sprintf( |
3103 | 3103 | __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), |
@@ -3110,16 +3110,16 @@ discard block |
||
3110 | 3110 | |
3111 | 3111 | |
3112 | 3112 | //do a nonce check here since we're not arriving via a normal route |
3113 | - $nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : ''; |
|
3114 | - $nonce_ref = $this->_req_data['message_type'] . '_nonce'; |
|
3113 | + $nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : ''; |
|
3114 | + $nonce_ref = $this->_req_data['message_type'].'_nonce'; |
|
3115 | 3115 | |
3116 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3116 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3117 | 3117 | |
3118 | - if ( $success ) { |
|
3118 | + if ($success) { |
|
3119 | 3119 | //made it here? um, what are you waiting for then? |
3120 | 3120 | $success = $status == 'deactivate' |
3121 | - ? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ) |
|
3122 | - : $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ); |
|
3121 | + ? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']) |
|
3122 | + : $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']); |
|
3123 | 3123 | } |
3124 | 3124 | |
3125 | 3125 | $this->_template_args['success'] = $success; |
@@ -3133,30 +3133,30 @@ discard block |
||
3133 | 3133 | * @param string $messenger_name The name of the messenger being activated |
3134 | 3134 | * @return bool |
3135 | 3135 | */ |
3136 | - protected function _activate_messenger( $messenger_name ) { |
|
3136 | + protected function _activate_messenger($messenger_name) { |
|
3137 | 3137 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3138 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3138 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3139 | 3139 | $message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array(); |
3140 | 3140 | |
3141 | 3141 | //ensure is active |
3142 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate ); |
|
3142 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate); |
|
3143 | 3143 | |
3144 | 3144 | //set response_data for reload |
3145 | - foreach( $message_types_to_activate as $message_type_name ) { |
|
3145 | + foreach ($message_types_to_activate as $message_type_name) { |
|
3146 | 3146 | /** @var EE_message_type $message_type */ |
3147 | - $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3148 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
|
3147 | + $message_type = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3148 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name) |
|
3149 | 3149 | && $message_type instanceof EE_message_type |
3150 | 3150 | ) { |
3151 | 3151 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3152 | - if ( $message_type->get_admin_settings_fields() ) { |
|
3152 | + if ($message_type->get_admin_settings_fields()) { |
|
3153 | 3153 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3154 | 3154 | } |
3155 | 3155 | } |
3156 | 3156 | } |
3157 | 3157 | |
3158 | 3158 | //add success message for activating messenger |
3159 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger ); |
|
3159 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger); |
|
3160 | 3160 | |
3161 | 3161 | } |
3162 | 3162 | |
@@ -3167,11 +3167,11 @@ discard block |
||
3167 | 3167 | * @param string $messenger_name The name of the messenger being activated |
3168 | 3168 | * @return bool |
3169 | 3169 | */ |
3170 | - protected function _deactivate_messenger( $messenger_name ) { |
|
3170 | + protected function _deactivate_messenger($messenger_name) { |
|
3171 | 3171 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3172 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3173 | - $this->_message_resource_manager->deactivate_messenger( $messenger_name ); |
|
3174 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger ); |
|
3172 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3173 | + $this->_message_resource_manager->deactivate_messenger($messenger_name); |
|
3174 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger); |
|
3175 | 3175 | } |
3176 | 3176 | |
3177 | 3177 | |
@@ -3182,23 +3182,23 @@ discard block |
||
3182 | 3182 | * @param string $message_type_name The name of the message type being activated for the messenger |
3183 | 3183 | * @return bool |
3184 | 3184 | */ |
3185 | - protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3185 | + protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3186 | 3186 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3187 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3187 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3188 | 3188 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3189 | - $message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3189 | + $message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3190 | 3190 | |
3191 | 3191 | //ensure is active |
3192 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name ); |
|
3192 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name); |
|
3193 | 3193 | |
3194 | 3194 | //set response for load |
3195 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
3195 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
3196 | 3196 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3197 | - if ( $message_type_to_activate->get_admin_settings_fields() ) { |
|
3197 | + if ($message_type_to_activate->get_admin_settings_fields()) { |
|
3198 | 3198 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3199 | 3199 | } |
3200 | 3200 | } |
3201 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate ); |
|
3201 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate); |
|
3202 | 3202 | } |
3203 | 3203 | |
3204 | 3204 | |
@@ -3210,13 +3210,13 @@ discard block |
||
3210 | 3210 | * @param string $message_type_name The name of the message type being deactivated for the messenger |
3211 | 3211 | * @return bool |
3212 | 3212 | */ |
3213 | - protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3213 | + protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3214 | 3214 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3215 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3215 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3216 | 3216 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3217 | - $message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3218 | - $this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name ); |
|
3219 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate ); |
|
3217 | + $message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3218 | + $this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name); |
|
3219 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate); |
|
3220 | 3220 | } |
3221 | 3221 | |
3222 | 3222 | |
@@ -3247,9 +3247,9 @@ discard block |
||
3247 | 3247 | EE_Message_Type $message_type = null |
3248 | 3248 | ) { |
3249 | 3249 | //if $messenger isn't a valid messenger object then get out. |
3250 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3250 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3251 | 3251 | EE_Error::add_error( |
3252 | - __( 'The messenger being activated is not a valid messenger', 'event_espresso' ), |
|
3252 | + __('The messenger being activated is not a valid messenger', 'event_espresso'), |
|
3253 | 3253 | __FILE__, |
3254 | 3254 | __FUNCTION__, |
3255 | 3255 | __LINE__ |
@@ -3257,32 +3257,32 @@ discard block |
||
3257 | 3257 | return false; |
3258 | 3258 | } |
3259 | 3259 | //activated |
3260 | - if ( $this->_template_args['data']['active_mts'] ) { |
|
3260 | + if ($this->_template_args['data']['active_mts']) { |
|
3261 | 3261 | EE_Error::overwrite_success(); |
3262 | 3262 | //activated a message type with the messenger |
3263 | - if ( $message_type instanceof EE_message_type ) { |
|
3263 | + if ($message_type instanceof EE_message_type) { |
|
3264 | 3264 | EE_Error::add_success( |
3265 | 3265 | sprintf( |
3266 | 3266 | __('%s message type has been successfully activated with the %s messenger', 'event_espresso'), |
3267 | - ucwords( $message_type->label['singular'] ), |
|
3268 | - ucwords( $messenger->label['singular'] ) |
|
3267 | + ucwords($message_type->label['singular']), |
|
3268 | + ucwords($messenger->label['singular']) |
|
3269 | 3269 | ) |
3270 | 3270 | ); |
3271 | 3271 | |
3272 | 3272 | //if message type was invoice then let's make sure we activate the invoice payment method. |
3273 | - if ( $message_type->name == 'invoice' ) { |
|
3274 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3275 | - $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
3276 | - if ( $pm instanceof EE_Payment_Method ) { |
|
3277 | - EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) ); |
|
3273 | + if ($message_type->name == 'invoice') { |
|
3274 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3275 | + $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
3276 | + if ($pm instanceof EE_Payment_Method) { |
|
3277 | + EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso')); |
|
3278 | 3278 | } |
3279 | 3279 | } |
3280 | 3280 | //just toggles the entire messenger |
3281 | 3281 | } else { |
3282 | 3282 | EE_Error::add_success( |
3283 | 3283 | sprintf( |
3284 | - __( '%s messenger has been successfully activated', 'event_espresso' ), |
|
3285 | - ucwords( $messenger->label[ 'singular' ] ) |
|
3284 | + __('%s messenger has been successfully activated', 'event_espresso'), |
|
3285 | + ucwords($messenger->label['singular']) |
|
3286 | 3286 | ) |
3287 | 3287 | ); |
3288 | 3288 | } |
@@ -3292,12 +3292,12 @@ discard block |
||
3292 | 3292 | //message types after the activation process. However its possible some messengers don't HAVE any default_message_types |
3293 | 3293 | //in which case we just give a success message for the messenger being successfully activated. |
3294 | 3294 | } else { |
3295 | - if ( ! $messenger->get_default_message_types() ) { |
|
3295 | + if ( ! $messenger->get_default_message_types()) { |
|
3296 | 3296 | //messenger doesn't have any default message types so still a success. |
3297 | 3297 | EE_Error::add_success( |
3298 | 3298 | sprintf( |
3299 | - __('%s messenger was successfully activated.', 'event_espresso' ), |
|
3300 | - ucwords( $messenger->label['singular'] ) |
|
3299 | + __('%s messenger was successfully activated.', 'event_espresso'), |
|
3300 | + ucwords($messenger->label['singular']) |
|
3301 | 3301 | ) |
3302 | 3302 | ); |
3303 | 3303 | return true; |
@@ -3305,13 +3305,13 @@ discard block |
||
3305 | 3305 | EE_Error::add_error( |
3306 | 3306 | $message_type instanceof EE_message_type |
3307 | 3307 | ? sprintf( |
3308 | - __( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ), |
|
3309 | - ucwords( $message_type->label['singular'] ), |
|
3310 | - ucwords( $messenger->label['singular'] ) |
|
3308 | + __('%s message type was not successfully activated with the %s messenger', 'event_espresso'), |
|
3309 | + ucwords($message_type->label['singular']), |
|
3310 | + ucwords($messenger->label['singular']) |
|
3311 | 3311 | ) |
3312 | 3312 | : sprintf( |
3313 | - __( '%s messenger was not successfully activated', 'event_espresso' ), |
|
3314 | - ucwords( $messenger->label['singular'] ) |
|
3313 | + __('%s messenger was not successfully activated', 'event_espresso'), |
|
3314 | + ucwords($messenger->label['singular']) |
|
3315 | 3315 | ), |
3316 | 3316 | __FILE__, |
3317 | 3317 | __FUNCTION__, |
@@ -3339,9 +3339,9 @@ discard block |
||
3339 | 3339 | EE_Error::overwrite_success(); |
3340 | 3340 | |
3341 | 3341 | //if $messenger isn't a valid messenger object then get out. |
3342 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3342 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3343 | 3343 | EE_Error::add_error( |
3344 | - __( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ), |
|
3344 | + __('The messenger being deactivated is not a valid messenger', 'event_espresso'), |
|
3345 | 3345 | __FILE__, |
3346 | 3346 | __FUNCTION__, |
3347 | 3347 | __LINE__ |
@@ -3349,13 +3349,13 @@ discard block |
||
3349 | 3349 | return false; |
3350 | 3350 | } |
3351 | 3351 | |
3352 | - if ( $message_type instanceof EE_message_type ) { |
|
3352 | + if ($message_type instanceof EE_message_type) { |
|
3353 | 3353 | $message_type_name = $message_type->name; |
3354 | 3354 | EE_Error::add_success( |
3355 | 3355 | sprintf( |
3356 | 3356 | __('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'), |
3357 | - ucwords( $message_type->label['singular'] ), |
|
3358 | - ucwords ( $messenger->label['singular'] ) |
|
3357 | + ucwords($message_type->label['singular']), |
|
3358 | + ucwords($messenger->label['singular']) |
|
3359 | 3359 | ) |
3360 | 3360 | ); |
3361 | 3361 | } else { |
@@ -3363,20 +3363,20 @@ discard block |
||
3363 | 3363 | EE_Error::add_success( |
3364 | 3364 | sprintf( |
3365 | 3365 | __('%s messenger has been successfully deactivated.', 'event_espresso'), |
3366 | - ucwords( $messenger->label['singular'] ) |
|
3366 | + ucwords($messenger->label['singular']) |
|
3367 | 3367 | ) |
3368 | 3368 | ); |
3369 | 3369 | } |
3370 | 3370 | |
3371 | 3371 | //if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method. |
3372 | - if ( $messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3373 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3374 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' ); |
|
3375 | - if ( $count_updated > 0 ) { |
|
3372 | + if ($messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3373 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3374 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice'); |
|
3375 | + if ($count_updated > 0) { |
|
3376 | 3376 | $msg = $message_type_name == 'invoice' |
3377 | - ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) |
|
3378 | - : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ); |
|
3379 | - EE_Error::add_attention( $msg ); |
|
3377 | + ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') |
|
3378 | + : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso'); |
|
3379 | + EE_Error::add_attention($msg); |
|
3380 | 3380 | } |
3381 | 3381 | } |
3382 | 3382 | return true; |
@@ -3387,17 +3387,17 @@ discard block |
||
3387 | 3387 | * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax) |
3388 | 3388 | */ |
3389 | 3389 | public function update_mt_form() { |
3390 | - if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) { |
|
3391 | - EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3390 | + if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) { |
|
3391 | + EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__); |
|
3392 | 3392 | $this->_return_json(); |
3393 | 3393 | } |
3394 | 3394 | |
3395 | 3395 | $message_types = $this->get_installed_message_types(); |
3396 | 3396 | |
3397 | - $message_type = $message_types[ $this->_req_data['message_type'] ]; |
|
3398 | - $messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
3397 | + $message_type = $message_types[$this->_req_data['message_type']]; |
|
3398 | + $messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
3399 | 3399 | |
3400 | - $content = $this->_message_type_settings_content ( $message_type, $messenger, true ); |
|
3400 | + $content = $this->_message_type_settings_content($message_type, $messenger, true); |
|
3401 | 3401 | $this->_template_args['success'] = true; |
3402 | 3402 | $this->_template_args['content'] = $content; |
3403 | 3403 | $this->_return_json(); |
@@ -3411,45 +3411,45 @@ discard block |
||
3411 | 3411 | * |
3412 | 3412 | */ |
3413 | 3413 | public function save_settings() { |
3414 | - if ( !isset( $this->_req_data['type'] ) ) { |
|
3415 | - EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3414 | + if ( ! isset($this->_req_data['type'])) { |
|
3415 | + EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3416 | 3416 | $this->_template_args['error'] = true; |
3417 | 3417 | $this->_return_json(); |
3418 | 3418 | } |
3419 | 3419 | |
3420 | 3420 | |
3421 | - if ( $this->_req_data['type'] == 'messenger' ) { |
|
3421 | + if ($this->_req_data['type'] == 'messenger') { |
|
3422 | 3422 | $settings = $this->_req_data['messenger_settings']; //this should be an array. |
3423 | 3423 | $messenger = $settings['messenger']; |
3424 | 3424 | //let's setup the settings data |
3425 | - foreach ( $settings as $key => $value ) { |
|
3426 | - switch ( $key ) { |
|
3425 | + foreach ($settings as $key => $value) { |
|
3426 | + switch ($key) { |
|
3427 | 3427 | case 'messenger' : |
3428 | - unset( $settings['messenger'] ); |
|
3428 | + unset($settings['messenger']); |
|
3429 | 3429 | break; |
3430 | 3430 | case 'message_types' : |
3431 | - unset( $settings['message_types'] ); |
|
3431 | + unset($settings['message_types']); |
|
3432 | 3432 | break; |
3433 | 3433 | default : |
3434 | 3434 | $settings[$key] = $value; |
3435 | 3435 | break; |
3436 | 3436 | } |
3437 | 3437 | } |
3438 | - $this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings ); |
|
3438 | + $this->_message_resource_manager->add_settings_for_messenger($messenger, $settings); |
|
3439 | 3439 | } |
3440 | 3440 | |
3441 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3441 | + else if ($this->_req_data['type'] == 'message_type') { |
|
3442 | 3442 | $settings = $this->_req_data['message_type_settings']; |
3443 | 3443 | $messenger = $settings['messenger']; |
3444 | 3444 | $message_type = $settings['message_type']; |
3445 | 3445 | |
3446 | - foreach ( $settings as $key => $value ) { |
|
3447 | - switch ( $key ) { |
|
3446 | + foreach ($settings as $key => $value) { |
|
3447 | + switch ($key) { |
|
3448 | 3448 | case 'messenger' : |
3449 | - unset( $settings['messenger'] ); |
|
3449 | + unset($settings['messenger']); |
|
3450 | 3450 | break; |
3451 | 3451 | case 'message_type' : |
3452 | - unset( $settings['message_type'] ); |
|
3452 | + unset($settings['message_type']); |
|
3453 | 3453 | break; |
3454 | 3454 | default : |
3455 | 3455 | $settings[$key] = $value; |
@@ -3457,16 +3457,16 @@ discard block |
||
3457 | 3457 | } |
3458 | 3458 | } |
3459 | 3459 | |
3460 | - $this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings ); |
|
3460 | + $this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings); |
|
3461 | 3461 | } |
3462 | 3462 | |
3463 | 3463 | //okay we should have the data all setup. Now we just update! |
3464 | 3464 | $success = $this->_message_resource_manager->update_active_messengers_option(); |
3465 | 3465 | |
3466 | - if ( $success ) { |
|
3467 | - EE_Error::add_success( __('Settings updated', 'event_espresso') ); |
|
3466 | + if ($success) { |
|
3467 | + EE_Error::add_success(__('Settings updated', 'event_espresso')); |
|
3468 | 3468 | } else { |
3469 | - EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3469 | + EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3470 | 3470 | } |
3471 | 3471 | |
3472 | 3472 | $this->_template_args['success'] = $success; |
@@ -3488,8 +3488,8 @@ discard block |
||
3488 | 3488 | */ |
3489 | 3489 | protected function _generate_now() { |
3490 | 3490 | $msg_ids = $this->_get_msg_ids_from_request(); |
3491 | - EED_Messages::generate_now( $msg_ids ); |
|
3492 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3491 | + EED_Messages::generate_now($msg_ids); |
|
3492 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3493 | 3493 | } |
3494 | 3494 | |
3495 | 3495 | |
@@ -3504,7 +3504,7 @@ discard block |
||
3504 | 3504 | protected function _generate_and_send_now() { |
3505 | 3505 | $this->_generate_now(); |
3506 | 3506 | $this->_send_now(); |
3507 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3507 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3508 | 3508 | } |
3509 | 3509 | |
3510 | 3510 | |
@@ -3518,8 +3518,8 @@ discard block |
||
3518 | 3518 | */ |
3519 | 3519 | protected function _queue_for_resending() { |
3520 | 3520 | $msg_ids = $this->_get_msg_ids_from_request(); |
3521 | - EED_Messages::queue_for_resending( $msg_ids ); |
|
3522 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3521 | + EED_Messages::queue_for_resending($msg_ids); |
|
3522 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3523 | 3523 | } |
3524 | 3524 | |
3525 | 3525 | |
@@ -3532,8 +3532,8 @@ discard block |
||
3532 | 3532 | */ |
3533 | 3533 | protected function _send_now() { |
3534 | 3534 | $msg_ids = $this->_get_msg_ids_from_request(); |
3535 | - EED_Messages::send_now( $msg_ids ); |
|
3536 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3535 | + EED_Messages::send_now($msg_ids); |
|
3536 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3537 | 3537 | } |
3538 | 3538 | |
3539 | 3539 | |
@@ -3547,23 +3547,23 @@ discard block |
||
3547 | 3547 | protected function _delete_ee_messages() { |
3548 | 3548 | $msg_ids = $this->_get_msg_ids_from_request(); |
3549 | 3549 | $deleted_count = 0; |
3550 | - foreach ( $msg_ids as $msg_id ) { |
|
3551 | - if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) { |
|
3550 | + foreach ($msg_ids as $msg_id) { |
|
3551 | + if (EEM_Message::instance()->delete_by_ID($msg_id)) { |
|
3552 | 3552 | $deleted_count++; |
3553 | 3553 | } |
3554 | 3554 | } |
3555 | - if ( $deleted_count ) { |
|
3555 | + if ($deleted_count) { |
|
3556 | 3556 | $this->_redirect_after_action( |
3557 | 3557 | true, |
3558 | - _n( 'message', 'messages', $deleted_count, 'event_espresso' ), |
|
3558 | + _n('message', 'messages', $deleted_count, 'event_espresso'), |
|
3559 | 3559 | __('deleted', 'event_espresso') |
3560 | 3560 | ); |
3561 | 3561 | } else { |
3562 | 3562 | EE_Error::add_error( |
3563 | - _n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ), |
|
3563 | + _n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'), |
|
3564 | 3564 | __FILE__, __FUNCTION__, __LINE__ |
3565 | 3565 | ); |
3566 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3566 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3567 | 3567 | } |
3568 | 3568 | } |
3569 | 3569 | |
@@ -3576,10 +3576,10 @@ discard block |
||
3576 | 3576 | * @return array |
3577 | 3577 | */ |
3578 | 3578 | protected function _get_msg_ids_from_request() { |
3579 | - if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
|
3579 | + if ( ! isset($this->_req_data['MSG_ID'])) { |
|
3580 | 3580 | return array(); |
3581 | 3581 | } |
3582 | - return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] ); |
|
3582 | + return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']); |
|
3583 | 3583 | } |
3584 | 3584 | |
3585 | 3585 |
@@ -1999,8 +1999,7 @@ discard block |
||
1999 | 1999 | $MTP = EEM_Message_Template_Group::instance(); |
2000 | 2000 | |
2001 | 2001 | if ( empty($GRP_ID) ) |
2002 | - {$this->_message_template_group = $MTP->create_default_object();} |
|
2003 | - else |
|
2002 | + {$this->_message_template_group = $MTP->create_default_object();} else |
|
2004 | 2003 | {$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );} |
2005 | 2004 | |
2006 | 2005 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
@@ -3436,9 +3435,7 @@ discard block |
||
3436 | 3435 | } |
3437 | 3436 | } |
3438 | 3437 | $this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings ); |
3439 | - } |
|
3440 | - |
|
3441 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3438 | + } else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3442 | 3439 | $settings = $this->_req_data['message_type_settings']; |
3443 | 3440 | $messenger = $settings['messenger']; |
3444 | 3441 | $message_type = $settings['message_type']; |
@@ -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 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param EE_Admin_Page $admin_page |
45 | 45 | */ |
46 | - public function __construct( $admin_page ) { |
|
46 | + public function __construct($admin_page) { |
|
47 | 47 | parent::__construct($admin_page); |
48 | - require_once( EE_HELPERS . 'EEH_DTT_Helper.helper.php' ); |
|
48 | + require_once(EE_HELPERS.'EEH_DTT_Helper.helper.php'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function _setup_data() { |
56 | 56 | $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
57 | - $this->_all_data_count = $this->_admin_page->get_events(0,0, TRUE); |
|
57 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, TRUE); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | $this->_sortable_columns = array( |
88 | - 'id' => array( 'EVT_ID' => true ), |
|
89 | - 'name' => array( 'EVT_name' => false ), |
|
90 | - 'author' => array( 'EVT_wp_user' => false ), |
|
91 | - 'venue' => array( 'Venue.VNU_name' => false ), |
|
88 | + 'id' => array('EVT_ID' => true), |
|
89 | + 'name' => array('EVT_name' => false), |
|
90 | + 'author' => array('EVT_wp_user' => false), |
|
91 | + 'venue' => array('Venue.VNU_name' => false), |
|
92 | 92 | 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
93 | 93 | 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
94 | 94 | ); |
95 | 95 | |
96 | 96 | $this->_primary_column = 'id'; |
97 | 97 | |
98 | - $this->_hidden_columns = array( 'author' ); |
|
98 | + $this->_hidden_columns = array('author'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | protected function _add_view_counts() { |
114 | 114 | $this->_views['all']['count'] = $this->_admin_page->total_events(); |
115 | 115 | $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
116 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
116 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
117 | 117 | $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
118 | 118 | } |
119 | 119 | } |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return string |
126 | 126 | */ |
127 | - protected function _get_row_class( $item ) { |
|
128 | - $class = parent::_get_row_class( $item ); |
|
127 | + protected function _get_row_class($item) { |
|
128 | + $class = parent::_get_row_class($item); |
|
129 | 129 | //add status class |
130 | - $class .= $item instanceof EE_Event ? ' ee-status-strip event-status-' . $item->get_active_status() : ''; |
|
131 | - if ( $this->_has_checkbox_column ) { |
|
130 | + $class .= $item instanceof EE_Event ? ' ee-status-strip event-status-'.$item->get_active_status() : ''; |
|
131 | + if ($this->_has_checkbox_column) { |
|
132 | 132 | $class .= ' has-checkbox-column'; |
133 | 133 | } |
134 | 134 | return $class; |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return string |
142 | 142 | */ |
143 | - public function column_status( EE_Event $item ) { |
|
144 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' . $item->get_active_status() . '"></span>'; |
|
143 | + public function column_status(EE_Event $item) { |
|
144 | + return '<span class="ee-status-strip ee-status-strip-td event-status-'.$item->get_active_status().'"></span>'; |
|
145 | 145 | }/**/ |
146 | 146 | |
147 | 147 | |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function column_cb( $item ) { |
|
154 | - if ( ! $item instanceof EE_Event ) { |
|
153 | + public function column_cb($item) { |
|
154 | + if ( ! $item instanceof EE_Event) { |
|
155 | 155 | return ''; |
156 | 156 | } |
157 | 157 | $this->_dtt = $item->primary_datetime(); //set this for use in other columns |
158 | 158 | |
159 | 159 | //does event have any attached registrations? |
160 | - $regs = $item->count_related( 'Registration' ); |
|
160 | + $regs = $item->count_related('Registration'); |
|
161 | 161 | return $regs > 0 && $this->_view == 'trash' ? '<span class="ee-lock-icon"></span>' : sprintf( |
162 | 162 | '<input type="checkbox" name="EVT_IDs[]" value="%s" />', $item->ID() |
163 | 163 | ); |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return mixed|string |
171 | 171 | */ |
172 | - public function column_id( EE_Event $item ) { |
|
172 | + public function column_id(EE_Event $item) { |
|
173 | 173 | $content = $item->ID(); |
174 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
174 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
175 | 175 | return $content; |
176 | 176 | } |
177 | 177 | |
@@ -181,16 +181,16 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - public function column_name( EE_Event $item ) { |
|
184 | + public function column_name(EE_Event $item) { |
|
185 | 185 | $edit_query_args = array( |
186 | 186 | 'action' => 'edit', |
187 | 187 | 'post' => $item->ID() |
188 | 188 | ); |
189 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
190 | - $actions = $this->_column_name_action_setup( $item ); |
|
189 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
190 | + $actions = $this->_column_name_action_setup($item); |
|
191 | 191 | $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
192 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' . $status; |
|
193 | - $content .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->get_active_status(), false, 'sentence' ) . '</span>'; |
|
192 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>'.$status; |
|
193 | + $content .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->get_active_status(), false, 'sentence').'</span>'; |
|
194 | 194 | $content .= $this->row_actions($actions); |
195 | 195 | return $content; |
196 | 196 | |
@@ -207,72 +207,72 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return array array of actions |
209 | 209 | */ |
210 | - protected function _column_name_action_setup( EE_Event $item ) { |
|
210 | + protected function _column_name_action_setup(EE_Event $item) { |
|
211 | 211 | //todo: remove when attendees is active |
212 | - if ( !defined('REG_ADMIN_URL') ) |
|
212 | + if ( ! defined('REG_ADMIN_URL')) |
|
213 | 213 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
214 | 214 | |
215 | 215 | $actions = array(); |
216 | 216 | |
217 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
217 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
218 | 218 | $edit_query_args = array( |
219 | 219 | 'action' => 'edit', |
220 | 220 | 'post' => $item->ID() |
221 | 221 | ); |
222 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
223 | - $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'; |
|
222 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
223 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
227 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
228 | 228 | $attendees_query_args = array( |
229 | 229 | 'action' => 'default', |
230 | 230 | 'event_id' => $item->ID() |
231 | 231 | ); |
232 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
233 | - $actions['attendees'] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrations', 'event_espresso') . '">' . __('Registrations', 'event_espresso') . '</a>'; |
|
232 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
233 | + $actions['attendees'] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrations', 'event_espresso').'">'.__('Registrations', 'event_espresso').'</a>'; |
|
234 | 234 | } |
235 | 235 | |
236 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
236 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
237 | 237 | $trash_event_query_args = array( |
238 | 238 | 'action' => 'trash_event', |
239 | 239 | 'EVT_ID' => $item->ID() |
240 | 240 | ); |
241 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_args, EVENTS_ADMIN_URL ); |
|
241 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_args, EVENTS_ADMIN_URL); |
|
242 | 242 | } |
243 | 243 | |
244 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
244 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
245 | 245 | $restore_event_query_args = array( |
246 | 246 | 'action' => 'restore_event', |
247 | 247 | 'EVT_ID' => $item->ID() |
248 | 248 | ); |
249 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( $restore_event_query_args, EVENTS_ADMIN_URL ); |
|
249 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce($restore_event_query_args, EVENTS_ADMIN_URL); |
|
250 | 250 | } |
251 | 251 | |
252 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
252 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
253 | 253 | $delete_event_query_args = array( |
254 | 254 | 'action' => 'delete_event', |
255 | 255 | 'EVT_ID' => $item->ID() |
256 | 256 | ); |
257 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( $delete_event_query_args, EVENTS_ADMIN_URL ); |
|
257 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce($delete_event_query_args, EVENTS_ADMIN_URL); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | $view_link = get_permalink($item->ID()); |
261 | 261 | |
262 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; |
|
262 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
263 | 263 | |
264 | - switch ( $item->get( 'status' ) ) { |
|
264 | + switch ($item->get('status')) { |
|
265 | 265 | case 'trash' : |
266 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
267 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>'; |
|
266 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
267 | + $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>'; |
|
268 | 268 | } |
269 | - if ( $item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
270 | - $actions['delete'] = '<a href="' . $delete_event_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
269 | + if ($item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
270 | + $actions['delete'] = '<a href="'.$delete_event_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
271 | 271 | } |
272 | 272 | break; |
273 | 273 | default : |
274 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
275 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
274 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
275 | + $actions['move to trash'] = '<a href="'.$trash_event_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | return $actions; |
@@ -284,17 +284,17 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return string |
286 | 286 | */ |
287 | - public function column_author( EE_Event $item ) { |
|
287 | + public function column_author(EE_Event $item) { |
|
288 | 288 | //user author info |
289 | - $event_author = get_userdata( $item->wp_user() ); |
|
290 | - $gravatar = get_avatar( $item->wp_user(), '15' ); |
|
289 | + $event_author = get_userdata($item->wp_user()); |
|
290 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
291 | 291 | //filter link |
292 | 292 | $query_args = array( |
293 | 293 | 'action' => 'default', |
294 | 294 | 'EVT_wp_user' => $item->wp_user() |
295 | 295 | ); |
296 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, EVENTS_ADMIN_URL ); |
|
297 | - return $gravatar . ' <a href="' . $filter_url . '" title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' . $event_author->display_name . '</a>'; |
|
296 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
297 | + return $gravatar.' <a href="'.$filter_url.'" title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'.$event_author->display_name.'</a>'; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @return string |
305 | 305 | */ |
306 | - public function column_venue( EE_Event $item ) { |
|
307 | - $venue = $item->get_first_related( 'Venue' ); |
|
308 | - return !empty( $venue ) ? $venue->name() : ''; |
|
306 | + public function column_venue(EE_Event $item) { |
|
307 | + $venue = $item->get_first_related('Venue'); |
|
308 | + return ! empty($venue) ? $venue->name() : ''; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @throws EE_Error |
316 | 316 | */ |
317 | - public function column_start_date_time( EE_Event $item ) { |
|
318 | - echo !empty( $this->_dtt ) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
317 | + public function column_start_date_time(EE_Event $item) { |
|
318 | + echo ! empty($this->_dtt) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
319 | 319 | //display in user's timezone? |
320 | - echo !empty( $this->_dtt ) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ' ) : ''; |
|
320 | + echo ! empty($this->_dtt) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ') : ''; |
|
321 | 321 | |
322 | 322 | } |
323 | 323 | |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @throws EE_Error |
329 | 329 | */ |
330 | - public function column_reg_begins( EE_Event $item ) { |
|
330 | + public function column_reg_begins(EE_Event $item) { |
|
331 | 331 | $reg_start = $item->get_ticket_with_earliest_start_time(); |
332 | - echo !empty( $reg_start ) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
332 | + echo ! empty($reg_start) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
333 | 333 | //display in user's timezone? |
334 | - echo !empty( $reg_start ) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';/**/ |
|
334 | + echo ! empty($reg_start) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ') : ''; /**/ |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -340,14 +340,14 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @return int|string |
342 | 342 | */ |
343 | - public function column_attendees( EE_Event $item ) { |
|
343 | + public function column_attendees(EE_Event $item) { |
|
344 | 344 | $attendees_query_args = array( |
345 | 345 | 'action' => 'default', |
346 | 346 | 'event_id' => $item->ID() |
347 | 347 | ); |
348 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
349 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count( $item->ID() ); |
|
350 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' : $registered_attendees; |
|
348 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
349 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
350 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' : $registered_attendees; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @return float |
358 | 358 | */ |
359 | - public function column_tkts_sold( EE_Event $item ) { |
|
360 | - return EEM_Ticket::instance()->sum(array( array('Datetime.EVT_ID' => $item->ID() )), 'TKT_sold' ); |
|
359 | + public function column_tkts_sold(EE_Event $item) { |
|
360 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -366,38 +366,38 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @return string |
368 | 368 | */ |
369 | - public function column_actions( EE_Event $item ) { |
|
369 | + public function column_actions(EE_Event $item) { |
|
370 | 370 | //todo: remove when attendees is active |
371 | - if ( !defined('REG_ADMIN_URL') ) |
|
371 | + if ( ! defined('REG_ADMIN_URL')) |
|
372 | 372 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
373 | 373 | $actionlinks = array(); |
374 | 374 | |
375 | 375 | $view_link = get_permalink($item->ID()); |
376 | 376 | |
377 | - $actionlinks[] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
377 | + $actionlinks[] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">'; |
|
378 | 378 | $actionlinks[] = '<div class="dashicons dashicons-search"></div></a>'; |
379 | 379 | |
380 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
380 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
381 | 381 | $edit_query_args = array( |
382 | 382 | 'action' => 'edit', |
383 | 383 | 'post' => $item->ID() |
384 | 384 | ); |
385 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
386 | - $actionlinks[] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
385 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
386 | + $actionlinks[] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
387 | 387 | } |
388 | 388 | |
389 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
389 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
390 | 390 | $attendees_query_args = array( |
391 | 391 | 'action' => 'default', |
392 | 392 | 'event_id' => $item->ID() |
393 | 393 | ); |
394 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
395 | - $actionlinks[] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>'; |
|
394 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
395 | + $actionlinks[] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrants', 'event_espresso').'"><div class="dashicons dashicons-groups"></div></a>'; |
|
396 | 396 | } |
397 | 397 | |
398 | - $actionlinks = apply_filters( 'FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item ); |
|
398 | + $actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item); |
|
399 | 399 | |
400 | - return $this->_action_string( implode( "\n\t", $actionlinks ), $item, 'div' ); |
|
400 | + return $this->_action_string(implode("\n\t", $actionlinks), $item, 'div'); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 |
@@ -167,7 +167,7 @@ |
||
167 | 167 | /** |
168 | 168 | * @param EE_Event $item |
169 | 169 | * |
170 | - * @return mixed|string |
|
170 | + * @return string |
|
171 | 171 | */ |
172 | 172 | public function column_id( EE_Event $item ) { |
173 | 173 | $content = $item->ID(); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -209,8 +210,9 @@ discard block |
||
209 | 210 | */ |
210 | 211 | protected function _column_name_action_setup( EE_Event $item ) { |
211 | 212 | //todo: remove when attendees is active |
212 | - if ( !defined('REG_ADMIN_URL') ) |
|
213 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
213 | + if ( !defined('REG_ADMIN_URL') ) { |
|
214 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
215 | + } |
|
214 | 216 | |
215 | 217 | $actions = array(); |
216 | 218 | |
@@ -368,8 +370,9 @@ discard block |
||
368 | 370 | */ |
369 | 371 | public function column_actions( EE_Event $item ) { |
370 | 372 | //todo: remove when attendees is active |
371 | - if ( !defined('REG_ADMIN_URL') ) |
|
372 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
373 | + if ( !defined('REG_ADMIN_URL') ) { |
|
374 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
375 | + } |
|
373 | 376 | $actionlinks = array(); |
374 | 377 | |
375 | 378 | $view_link = get_permalink($item->ID()); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | - protected function _parser( $shortcode ) { |
|
50 | + protected function _parser($shortcode) { |
|
51 | 51 | |
52 | 52 | |
53 | - switch ( $shortcode ) { |
|
53 | + switch ($shortcode) { |
|
54 | 54 | case '[QUESTION_LIST]' : |
55 | 55 | return $this->_get_question_list(); |
56 | 56 | break; |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | $this->_validate_list_requirements(); |
65 | 65 | |
66 | 66 | //for when [QUESTION_LIST] is used in the [attendee_list] field. |
67 | - if ( $this->_data['data'] instanceof EE_Registration ) { |
|
67 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
68 | 68 | return $this->_get_question_answer_list_for_attendee(); |
69 | 69 | } |
70 | 70 | //for when [QUESTION_LIST] is used in the main content field. |
71 | - else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) { |
|
72 | - return $this->_get_question_answer_list_for_attendee( $this->_data['data']->reg_obj ); |
|
71 | + else if ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
72 | + return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
73 | 73 | } else { |
74 | 74 | return ''; |
75 | 75 | } |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of answers for that attendee since that is what we really need (we can derive the questions from the answers); |
82 | 82 | * @return string parsed template. |
83 | 83 | */ |
84 | - private function _get_question_answer_list_for_attendee( $reg_obj = null ) { |
|
84 | + private function _get_question_answer_list_for_attendee($reg_obj = null) { |
|
85 | 85 | $valid_shortcodes = array('question'); |
86 | 86 | $reg_obj = $reg_obj instanceof EE_Registration ? $reg_obj : $this->_data['data']; |
87 | - $template = is_array( $this->_data['template'] ) && isset( $this->_data['template']['question_list'] ) ? $this->_data['template']['question_list'] : ''; |
|
88 | - $template = empty( $template ) && isset( $this->_extra_data['template']['question_list'] ) ? $this->_extra_data['template']['question_list'] : $template; |
|
87 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) ? $this->_data['template']['question_list'] : ''; |
|
88 | + $template = empty($template) && isset($this->_extra_data['template']['question_list']) ? $this->_extra_data['template']['question_list'] : $template; |
|
89 | 89 | $ans_result = ''; |
90 | 90 | $answers = ! empty($this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs']) ? $this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs'] : array(); |
91 | - foreach ( $answers as $answer ) { |
|
91 | + foreach ($answers as $answer) { |
|
92 | 92 | $question = $answer->question(); |
93 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
93 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | - $ans_result .= $this->_shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $this->_extra_data); |
|
96 | + $ans_result .= $this->_shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $this->_extra_data); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $ans_result; |
@@ -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 |