@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
222 | - * retrieve ALL registrations for a particular Attendee from db |
|
223 | - * @access public |
|
224 | - * @param int $ATT_ID |
|
225 | - * @return EE_Registration[] |
|
226 | - */ |
|
222 | + * retrieve ALL registrations for a particular Attendee from db |
|
223 | + * @access public |
|
224 | + * @param int $ATT_ID |
|
225 | + * @return EE_Registration[] |
|
226 | + */ |
|
227 | 227 | public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
228 | 228 | if ( ! $ATT_ID ) { |
229 | 229 | return FALSE; |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | |
251 | 251 | |
252 | 252 | /** |
253 | - * retrieve registration for a specific transaction attendee from db |
|
254 | - * |
|
255 | - * @access public |
|
256 | - * @param int $TXN_ID |
|
257 | - * @param int $ATT_ID |
|
258 | - * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | - * @return mixed array on success, FALSE on fail |
|
260 | - */ |
|
253 | + * retrieve registration for a specific transaction attendee from db |
|
254 | + * |
|
255 | + * @access public |
|
256 | + * @param int $TXN_ID |
|
257 | + * @param int $ATT_ID |
|
258 | + * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | + * @return mixed array on success, FALSE on fail |
|
260 | + */ |
|
261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
262 | 262 | return $this->get_one(array( |
263 | 263 | array( |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | |
271 | 271 | |
272 | 272 | /** |
273 | - * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
273 | + * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
274 | 274 | * (doesn't utilize models because it's a fairly specialized query) |
275 | - * @access public |
|
275 | + * @access public |
|
276 | 276 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
277 | 277 | * @return stdClass[] with properties regDate and total |
278 | - */ |
|
278 | + */ |
|
279 | 279 | public function get_registrations_per_day_report( $period = '-1 month' ) { |
280 | 280 | |
281 | 281 | $sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | |
305 | 305 | |
306 | 306 | /** |
307 | - * get the number of registrations per event for the Registration Admin page Reports Tab |
|
308 | - * @access public |
|
307 | + * get the number of registrations per event for the Registration Admin page Reports Tab |
|
308 | + * @access public |
|
309 | 309 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
310 | 310 | * @return stdClass[] each with properties event_name, reg_limit, and total |
311 | - */ |
|
311 | + */ |
|
312 | 312 | public function get_registrations_per_event_report( $period = '-1 month' ) { |
313 | 313 | |
314 | 314 | $date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
3 | -require_once ( EE_CLASSES . 'EE_Registration.class.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
3 | +require_once (EE_CLASSES.'EE_Registration.class.php'); |
|
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * Registration Model |
@@ -92,31 +92,31 @@ discard block |
||
92 | 92 | * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
93 | 93 | * @return \EEM_Registration |
94 | 94 | */ |
95 | - protected function __construct( $timezone ) { |
|
96 | - $this->singular_item = __('Registration','event_espresso'); |
|
97 | - $this->plural_item = __('Registrations','event_espresso'); |
|
95 | + protected function __construct($timezone) { |
|
96 | + $this->singular_item = __('Registration', 'event_espresso'); |
|
97 | + $this->plural_item = __('Registrations', 'event_espresso'); |
|
98 | 98 | |
99 | 99 | $this->_tables = array( |
100 | - 'Registration'=>new EE_Primary_Table('esp_registration','REG_ID') |
|
100 | + 'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID') |
|
101 | 101 | ); |
102 | 102 | $this->_fields = array( |
103 | 103 | 'Registration'=>array( |
104 | - 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')), |
|
105 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
106 | - 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'), |
|
107 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
108 | - 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'), |
|
109 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | - 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, time(), $timezone ), |
|
111 | - 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0), |
|
112 | - 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0), |
|
113 | - 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''), |
|
114 | - 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''), |
|
115 | - 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''), |
|
116 | - 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1), |
|
117 | - 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1), |
|
118 | - 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false), |
|
119 | - 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false ) |
|
104 | + 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')), |
|
105 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
106 | + 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'), |
|
107 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
108 | + 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'), |
|
109 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | + 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, time(), $timezone), |
|
111 | + 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0), |
|
112 | + 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0), |
|
113 | + 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''), |
|
114 | + 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''), |
|
115 | + 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''), |
|
116 | + 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1), |
|
117 | + 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1), |
|
118 | + 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false), |
|
119 | + 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false) |
|
120 | 120 | ) |
121 | 121 | ); |
122 | 122 | $this->_model_relations = array( |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | 'Answer'=>new EE_Has_Many_Relation(), |
129 | 129 | 'Checkin'=>new EE_Has_Many_Relation(), |
130 | 130 | 'Registration_Payment' => new EE_Has_Many_Relation(), |
131 | - 'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ), |
|
131 | + 'Payment'=>new EE_HABTM_Relation('Registration_Payment'), |
|
132 | 132 | ); |
133 | 133 | $this->_model_chain_to_wp_user = 'Event'; |
134 | 134 | |
135 | - parent::__construct( $timezone ); |
|
135 | + parent::__construct($timezone); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param bool $translated If true will return the values as singular localized strings |
166 | 166 | * @return array |
167 | 167 | */ |
168 | - public static function reg_status_array( $exclude = array(), $translated = FALSE ) { |
|
169 | - EEM_Registration::instance()->_get_registration_status_array( $exclude ); |
|
170 | - return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
168 | + public static function reg_status_array($exclude = array(), $translated = FALSE) { |
|
169 | + EEM_Registration::instance()->_get_registration_status_array($exclude); |
|
170 | + return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -178,18 +178,18 @@ discard block |
||
178 | 178 | * @param array $exclude |
179 | 179 | * @return array |
180 | 180 | */ |
181 | - private function _get_registration_status_array( $exclude = array() ) { |
|
181 | + private function _get_registration_status_array($exclude = array()) { |
|
182 | 182 | //in the very rare circumstance that we are deleting a model's table's data |
183 | 183 | //and the table hasn't actually been created, this could have an error |
184 | 184 | /** @type WPDB $wpdb */ |
185 | 185 | global $wpdb; |
186 | - if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){ |
|
187 | - $SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"'; |
|
188 | - $results = $wpdb->get_results( $SQL ); |
|
186 | + if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) { |
|
187 | + $SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"'; |
|
188 | + $results = $wpdb->get_results($SQL); |
|
189 | 189 | self::$_reg_status = array(); |
190 | - foreach ( $results as $status ) { |
|
191 | - if ( ! in_array( $status->STS_ID, $exclude )) { |
|
192 | - self::$_reg_status[ $status->STS_ID ] = $status->STS_code; |
|
190 | + foreach ($results as $status) { |
|
191 | + if ( ! in_array($status->STS_ID, $exclude)) { |
|
192 | + self::$_reg_status[$status->STS_ID] = $status->STS_code; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | } |
@@ -204,15 +204,15 @@ discard block |
||
204 | 204 | * @param array $where_params Array of query_params as described in the comments for EEM_Base::get_all() |
205 | 205 | * @return wpdb results array |
206 | 206 | */ |
207 | - public function get_reg_months_and_years( $where_params ) { |
|
207 | + public function get_reg_months_and_years($where_params) { |
|
208 | 208 | $query_params[0] = $where_params; |
209 | 209 | $query_params['group_by'] = array('reg_year', 'reg_month'); |
210 | - $query_params['order_by'] = array( 'REG_date' => 'DESC' ); |
|
210 | + $query_params['order_by'] = array('REG_date' => 'DESC'); |
|
211 | 211 | $columns_to_select = array( |
212 | 212 | 'reg_year' => array('YEAR(REG_date)', '%s'), |
213 | 213 | 'reg_month' => array('MONTHNAME(REG_date)', '%s') |
214 | 214 | ); |
215 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
215 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | * @param int $ATT_ID |
225 | 225 | * @return EE_Registration[] |
226 | 226 | */ |
227 | - public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
|
228 | - if ( ! $ATT_ID ) { |
|
227 | + public function get_all_registrations_for_attendee($ATT_ID = 0) { |
|
228 | + if ( ! $ATT_ID) { |
|
229 | 229 | return FALSE; |
230 | 230 | } |
231 | - return $this->get_all( array( array( 'ATT_ID' => $ATT_ID ))); |
|
231 | + return $this->get_all(array(array('ATT_ID' => $ATT_ID))); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * @param string $REG_url_link |
240 | 240 | * @return EE_Registration |
241 | 241 | */ |
242 | - public function get_registration_for_reg_url_link($REG_url_link){ |
|
243 | - if(!$REG_url_link){ |
|
242 | + public function get_registration_for_reg_url_link($REG_url_link) { |
|
243 | + if ( ! $REG_url_link) { |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | return $this->get_one(array(array('REG_url_link'=>$REG_url_link))); |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
259 | 259 | * @return mixed array on success, FALSE on fail |
260 | 260 | */ |
261 | - public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
|
261 | + public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) { |
|
262 | 262 | return $this->get_one(array( |
263 | 263 | array( |
264 | 264 | 'TXN_ID'=>$TXN_ID, |
265 | 265 | 'ATT_ID'=>$ATT_ID |
266 | 266 | ), |
267 | - 'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 ) |
|
267 | + 'limit'=>array(min(($att_nmbr - 1), 0), 1) |
|
268 | 268 | )); |
269 | 269 | } |
270 | 270 | |
@@ -276,16 +276,16 @@ discard block |
||
276 | 276 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
277 | 277 | * @return stdClass[] with properties regDate and total |
278 | 278 | */ |
279 | - public function get_registrations_per_day_report( $period = '-1 month' ) { |
|
279 | + public function get_registrations_per_day_report($period = '-1 month') { |
|
280 | 280 | |
281 | - $sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
|
282 | - $where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
281 | + $sql_date = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
282 | + $where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
283 | 283 | |
284 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) { |
|
284 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) { |
|
285 | 285 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
286 | 286 | } |
287 | 287 | |
288 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' ); |
|
288 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date'); |
|
289 | 289 | |
290 | 290 | $results = $this->_get_all_wpdb_results( |
291 | 291 | array( |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | ), |
296 | 296 | OBJECT, |
297 | 297 | array( |
298 | - 'regDate'=>array( 'DATE(' . $query_interval . ')','%s'), |
|
299 | - 'total'=>array('count(REG_ID)','%d') |
|
298 | + 'regDate'=>array('DATE('.$query_interval.')', '%s'), |
|
299 | + 'total'=>array('count(REG_ID)', '%d') |
|
300 | 300 | )); |
301 | 301 | return $results; |
302 | 302 | } |
@@ -311,22 +311,22 @@ discard block |
||
311 | 311 | * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID |
312 | 312 | * (i.e. RAP) |
313 | 313 | */ |
314 | - public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) { |
|
314 | + public function get_registrations_per_day_and_per_status_report($period = '-1 month') { |
|
315 | 315 | global $wpdb; |
316 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
316 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
317 | 317 | $event_table = $wpdb->posts; |
318 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
318 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
319 | 319 | |
320 | 320 | //prepare the query interval for displaying offset |
321 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' ); |
|
321 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date'); |
|
322 | 322 | |
323 | 323 | //inner date query |
324 | 324 | $inner_date_query = "SELECT DISTINCT REG_date from $registration_table "; |
325 | 325 | $inner_where = " WHERE"; |
326 | 326 | //exclude events not authored by user if permissions in effect |
327 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
327 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
328 | 328 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
329 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
329 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
330 | 330 | } |
331 | 331 | $inner_where .= " REG_date >= '$sql_date'"; |
332 | 332 | $inner_date_query .= $inner_where; |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | $select_parts = array(); |
339 | 339 | |
340 | 340 | //loop through registration stati to do parts for each status. |
341 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
342 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
341 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
342 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -347,14 +347,14 @@ discard block |
||
347 | 347 | } |
348 | 348 | |
349 | 349 | //setup the selects |
350 | - $select .= implode(', ', $select_parts ); |
|
350 | + $select .= implode(', ', $select_parts); |
|
351 | 351 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN "; |
352 | 352 | |
353 | 353 | //setup the joins |
354 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
354 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
355 | 355 | |
356 | 356 | //now let's put it all together |
357 | - $query = $select . $join . ' GROUP BY Registration_REG_date'; |
|
357 | + $query = $select.$join.' GROUP BY Registration_REG_date'; |
|
358 | 358 | |
359 | 359 | //and execute it |
360 | 360 | $results = $wpdb->get_results( |
@@ -375,23 +375,23 @@ discard block |
||
375 | 375 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
376 | 376 | * @return stdClass[] each with properties event_name, reg_limit, and total |
377 | 377 | */ |
378 | - public function get_registrations_per_event_report( $period = '-1 month' ) { |
|
378 | + public function get_registrations_per_event_report($period = '-1 month') { |
|
379 | 379 | |
380 | - $date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' ); |
|
381 | - $where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
380 | + $date_sql = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
381 | + $where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
382 | 382 | |
383 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
383 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
384 | 384 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
385 | 385 | } |
386 | 386 | $results = $this->_get_all_wpdb_results(array( |
387 | 387 | $where, |
388 | 388 | 'group_by'=>'Event.EVT_name', |
389 | 389 | 'order_by'=>'Event.EVT_name', |
390 | - 'limit'=>array(0,24)), |
|
390 | + 'limit'=>array(0, 24)), |
|
391 | 391 | OBJECT, |
392 | 392 | array( |
393 | - 'event_name'=>array('Event_CPT.post_title','%s'), |
|
394 | - 'total'=>array('COUNT(REG_ID)','%s') |
|
393 | + 'event_name'=>array('Event_CPT.post_title', '%s'), |
|
394 | + 'total'=>array('COUNT(REG_ID)', '%s') |
|
395 | 395 | ) |
396 | 396 | ); |
397 | 397 | |
@@ -409,19 +409,19 @@ discard block |
||
409 | 409 | * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID |
410 | 410 | * (i.e. RAP) |
411 | 411 | */ |
412 | - public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) { |
|
412 | + public function get_registrations_per_event_and_per_status_report($period = '-1 month') { |
|
413 | 413 | global $wpdb; |
414 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
414 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
415 | 415 | $event_table = $wpdb->posts; |
416 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
416 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
417 | 417 | |
418 | 418 | //inner date query |
419 | 419 | $inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table "; |
420 | 420 | $inner_where = " WHERE"; |
421 | 421 | //exclude events not authored by user if permissions in effect |
422 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
422 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
423 | 423 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
424 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
424 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
425 | 425 | } |
426 | 426 | $inner_where .= " REG_date >= '$sql_date'"; |
427 | 427 | $inner_date_query .= $inner_where; |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | $select_parts = array(); |
434 | 434 | |
435 | 435 | //loop through registration stati to do parts for each status. |
436 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
437 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
436 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
437 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
438 | 438 | continue; |
439 | 439 | } |
440 | 440 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -442,14 +442,14 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | //setup the selects |
445 | - $select .= implode( ', ', $select_parts ); |
|
445 | + $select .= implode(', ', $select_parts); |
|
446 | 446 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN "; |
447 | 447 | |
448 | 448 | //setup remaining joins |
449 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
449 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
450 | 450 | |
451 | 451 | //now put it all together |
452 | - $query = $select . $join . ' GROUP BY Registration_Event'; |
|
452 | + $query = $select.$join.' GROUP BY Registration_Event'; |
|
453 | 453 | |
454 | 454 | //and execute |
455 | 455 | $results = $wpdb->get_results( |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | * @param int $TXN_ID |
466 | 466 | * @return EE_Registration |
467 | 467 | */ |
468 | - public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){ |
|
469 | - if( ! $TXN_ID ){ |
|
468 | + public function get_primary_registration_for_transaction_ID($TXN_ID = 0) { |
|
469 | + if ( ! $TXN_ID) { |
|
470 | 470 | return false; |
471 | 471 | } |
472 | - return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
472 | + return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -481,11 +481,11 @@ discard block |
||
481 | 481 | * @param boolean $for_incomplete_payments |
482 | 482 | * @return int |
483 | 483 | */ |
484 | - public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) { |
|
484 | + public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) { |
|
485 | 485 | // we only count approved registrations towards registration limits |
486 | - $query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) ); |
|
487 | - if( $for_incomplete_payments ){ |
|
488 | - $query_params[0]['Transaction.STS_ID']=array('!=', EEM_Transaction::complete_status_code); |
|
486 | + $query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved)); |
|
487 | + if ($for_incomplete_payments) { |
|
488 | + $query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | return $this->count($query_params); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | /** @type WPDB $wpdb */ |
502 | 502 | global $wpdb; |
503 | 503 | return $wpdb->query( |
504 | - 'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
504 | + 'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /** |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
512 | 512 | * @return int |
513 | 513 | */ |
514 | - public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) { |
|
514 | + public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) { |
|
515 | 515 | return $this->count( |
516 | 516 | array( |
517 | 517 | array( |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
530 | 530 | * @return int |
531 | 531 | */ |
532 | - public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) { |
|
532 | + public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) { |
|
533 | 533 | return $this->count( |
534 | 534 | array( |
535 | 535 | array( |
@@ -552,15 +552,15 @@ discard block |
||
552 | 552 | * @param array $attendee_ids |
553 | 553 | * @return EE_Registration[] |
554 | 554 | */ |
555 | - public function get_latest_registration_for_each_of_given_contacts( $attendee_ids = array() ) { |
|
555 | + public function get_latest_registration_for_each_of_given_contacts($attendee_ids = array()) { |
|
556 | 556 | //first do a native wp_query to get the latest REG_ID's matching these attendees. |
557 | 557 | global $wpdb; |
558 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
558 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
559 | 559 | $attendee_table = $wpdb->posts; |
560 | - $attendee_ids = is_array( $attendee_ids ) |
|
561 | - ? array_map( 'absint', $attendee_ids ) |
|
562 | - : array( (int) $attendee_ids ); |
|
563 | - $attendee_ids = implode( ',', $attendee_ids ); |
|
560 | + $attendee_ids = is_array($attendee_ids) |
|
561 | + ? array_map('absint', $attendee_ids) |
|
562 | + : array((int) $attendee_ids); |
|
563 | + $attendee_ids = implode(',', $attendee_ids); |
|
564 | 564 | |
565 | 565 | |
566 | 566 | //first we do a query to get the registration ids |
@@ -585,24 +585,24 @@ discard block |
||
585 | 585 | ARRAY_A |
586 | 586 | ); |
587 | 587 | |
588 | - if ( empty( $registration_ids ) ) { |
|
588 | + if (empty($registration_ids)) { |
|
589 | 589 | return array(); |
590 | 590 | } |
591 | 591 | |
592 | 592 | $ids_for_model_query = array(); |
593 | 593 | //let's flatten the ids so they can be used in the model query. |
594 | - foreach ( $registration_ids as $registration_id ) { |
|
595 | - if ( isset( $registration_id['registration_id'] ) ) { |
|
594 | + foreach ($registration_ids as $registration_id) { |
|
595 | + if (isset($registration_id['registration_id'])) { |
|
596 | 596 | $ids_for_model_query[] = $registration_id['registration_id']; |
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | 600 | //construct query |
601 | 601 | $_where = array( |
602 | - 'REG_ID' => array( 'IN', $ids_for_model_query ) |
|
602 | + 'REG_ID' => array('IN', $ids_for_model_query) |
|
603 | 603 | ); |
604 | 604 | |
605 | - return $this->get_all( array( $_where ) ); |
|
605 | + return $this->get_all(array($_where)); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_Template_Layout |
|
4 | - * |
|
5 | - * For very customized layouts, where you provide this class with the location of |
|
6 | - * a template file to use for laying out the form section. Inherits from EE_Div_per_Section |
|
7 | - * in case you call layout_input() or layout_subsection(), or get_html_for_label(), |
|
8 | - * get_html_for_input(), or get_html_for_errors() on one if the form section's inputs. |
|
9 | - * When would you want to use this instead of just laying out the form's subsections manually |
|
10 | - * in a template file? When you want a very customized layout, but that layout is essential |
|
11 | - * to the form; so that if you were to use the same form on two different pages (eg a contact form, |
|
12 | - * one on the website's frontend for contacting the site admin, and then again on the backend for |
|
13 | - * contacting the plugin's developer), you would still use this exact same template layout strategy. |
|
14 | - * (Eg, if you wanted to add a button to that same form for automatically adding "@gmail.com" or "@yahoo.com" |
|
15 | - * onto the 'from' input. The input is important to the form section on either page, but isn't an input so it's best |
|
16 | - * added as a part of the template layout.) |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage |
|
20 | - * @author Mike Nelson |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * EE_Template_Layout |
|
4 | + * |
|
5 | + * For very customized layouts, where you provide this class with the location of |
|
6 | + * a template file to use for laying out the form section. Inherits from EE_Div_per_Section |
|
7 | + * in case you call layout_input() or layout_subsection(), or get_html_for_label(), |
|
8 | + * get_html_for_input(), or get_html_for_errors() on one if the form section's inputs. |
|
9 | + * When would you want to use this instead of just laying out the form's subsections manually |
|
10 | + * in a template file? When you want a very customized layout, but that layout is essential |
|
11 | + * to the form; so that if you were to use the same form on two different pages (eg a contact form, |
|
12 | + * one on the website's frontend for contacting the site admin, and then again on the backend for |
|
13 | + * contacting the plugin's developer), you would still use this exact same template layout strategy. |
|
14 | + * (Eg, if you wanted to add a button to that same form for automatically adding "@gmail.com" or "@yahoo.com" |
|
15 | + * onto the 'from' input. The input is important to the form section on either page, but isn't an input so it's best |
|
16 | + * added as a part of the template layout.) |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage |
|
20 | + * @author Mike Nelson |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EE_Template_Layout extends EE_Div_Per_Section_Layout{ |
25 | 25 | |
26 | 26 | protected $_layout_template_file = NULL; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -class EE_Template_Layout extends EE_Div_Per_Section_Layout{ |
|
24 | +class EE_Template_Layout extends EE_Div_Per_Section_Layout { |
|
25 | 25 | |
26 | 26 | protected $_layout_template_file = NULL; |
27 | 27 | protected $_layout_begin_template_file = NULL; |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * @type array $_template_args |
43 | 43 | * } |
44 | 44 | */ |
45 | - public function __construct( $template_options = array() ) { |
|
45 | + public function __construct($template_options = array()) { |
|
46 | 46 | // loop thru incoming options |
47 | - foreach( $template_options as $key => $value ) { |
|
47 | + foreach ($template_options as $key => $value) { |
|
48 | 48 | // add underscore to $key to match property names |
49 | - $_key = '_' . $key; |
|
50 | - if ( property_exists( $this, $_key )) { |
|
49 | + $_key = '_'.$key; |
|
50 | + if (property_exists($this, $_key)) { |
|
51 | 51 | $this->{$_key} = $value; |
52 | 52 | } |
53 | 53 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @return string |
66 | 66 | */ |
67 | 67 | public function layout_form() { |
68 | - if ( $this->_layout_template_file ) { |
|
69 | - return EEH_Template::locate_template( $this->_layout_template_file, $this->template_args(), TRUE, TRUE ); |
|
68 | + if ($this->_layout_template_file) { |
|
69 | + return EEH_Template::locate_template($this->_layout_template_file, $this->template_args(), TRUE, TRUE); |
|
70 | 70 | } else { |
71 | 71 | return parent::layout_form(); |
72 | 72 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function layout_form_begin() { |
82 | - if($this->_layout_begin_template_file){ |
|
83 | - return EEH_Template::locate_template( $this->_layout_begin_template_file, $this->template_args(), TRUE, TRUE ); |
|
84 | - }else{ |
|
82 | + if ($this->_layout_begin_template_file) { |
|
83 | + return EEH_Template::locate_template($this->_layout_begin_template_file, $this->template_args(), TRUE, TRUE); |
|
84 | + } else { |
|
85 | 85 | return parent::layout_form_begin(); |
86 | 86 | } |
87 | 87 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @param EE_Form_Input_Base $input |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function layout_input( $input ) { |
|
98 | - if($this->_input_template_file){ |
|
99 | - return EEH_Template::locate_template( $this->_input_template_file, array( 'input' => $input ), TRUE, TRUE ); |
|
97 | + public function layout_input($input) { |
|
98 | + if ($this->_input_template_file) { |
|
99 | + return EEH_Template::locate_template($this->_input_template_file, array('input' => $input), TRUE, TRUE); |
|
100 | 100 | } |
101 | 101 | return parent::layout_input($input); |
102 | 102 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * @param EE_Form_Section_Proper $form_section |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function layout_subsection( $form_section ) { |
|
113 | - if($this->_subsection_template_file){ |
|
114 | - return EEH_Template::locate_template( $this->_subsection_template_file, $this->template_args(), TRUE, TRUE ); |
|
112 | + public function layout_subsection($form_section) { |
|
113 | + if ($this->_subsection_template_file) { |
|
114 | + return EEH_Template::locate_template($this->_subsection_template_file, $this->template_args(), TRUE, TRUE); |
|
115 | 115 | } |
116 | - return parent::layout_subsection( $form_section ); |
|
116 | + return parent::layout_subsection($form_section); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | * @return string |
124 | 124 | */ |
125 | 125 | public function layout_form_end() { |
126 | - if($this->_layout_end_template_file){ |
|
127 | - return EEH_Template::locate_template( $this->_layout_end_template_file, $this->template_args(), TRUE, TRUE); |
|
128 | - }else{ |
|
126 | + if ($this->_layout_end_template_file) { |
|
127 | + return EEH_Template::locate_template($this->_layout_end_template_file, $this->template_args(), TRUE, TRUE); |
|
128 | + } else { |
|
129 | 129 | return parent::layout_form_end(); |
130 | 130 | } |
131 | 131 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | /** |
136 | 136 | * @param array $template_args |
137 | 137 | */ |
138 | - public function set_template_args( $template_args = array() ) { |
|
138 | + public function set_template_args($template_args = array()) { |
|
139 | 139 | $this->_template_args = $template_args; |
140 | 140 | } |
141 | 141 | |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | /** |
145 | 145 | * @param array $template_args |
146 | 146 | */ |
147 | - public function add_template_args( $template_args = array() ) { |
|
148 | - $this->_template_args = array_merge_recursive( $this->_template_args, $template_args ); |
|
147 | + public function add_template_args($template_args = array()) { |
|
148 | + $this->_template_args = array_merge_recursive($this->_template_args, $template_args); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | * @return array |
155 | 155 | */ |
156 | 156 | public function template_args() { |
157 | - foreach ( $this->form_section()->subsections() as $subsection_name => $subsection ) { |
|
158 | - $subsection_name = self::prep_form_subsection_key_name( $subsection_name ); |
|
159 | - if ( strpos( $subsection_name, '[' ) !== FALSE ) { |
|
160 | - $sub_name = explode( '[', $subsection_name ); |
|
161 | - $this->_template_args[ $sub_name[0] ][ rtrim( $sub_name[1], ']' ) ] = $this->layout_subsection( $subsection ); |
|
157 | + foreach ($this->form_section()->subsections() as $subsection_name => $subsection) { |
|
158 | + $subsection_name = self::prep_form_subsection_key_name($subsection_name); |
|
159 | + if (strpos($subsection_name, '[') !== FALSE) { |
|
160 | + $sub_name = explode('[', $subsection_name); |
|
161 | + $this->_template_args[$sub_name[0]][rtrim($sub_name[1], ']')] = $this->layout_subsection($subsection); |
|
162 | 162 | } else { |
163 | - $this->_template_args[ $subsection_name ] = $this->layout_subsection( $subsection ); |
|
163 | + $this->_template_args[$subsection_name] = $this->layout_subsection($subsection); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | // d( $this->_template_args ); |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | * @param string $subsection_name |
177 | 177 | * @return string |
178 | 178 | */ |
179 | - public static function prep_form_subsection_key_name( $subsection_name = '' ) { |
|
180 | - $subsection_name = str_replace( array( '-', ' ' ), array( '', '_' ), $subsection_name ); |
|
181 | - return is_numeric( substr( $subsection_name, 0, 1 )) ? 'form_' . $subsection_name : $subsection_name; |
|
179 | + public static function prep_form_subsection_key_name($subsection_name = '') { |
|
180 | + $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name); |
|
181 | + return is_numeric(substr($subsection_name, 0, 1)) ? 'form_'.$subsection_name : $subsection_name; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * @param string $subsection_name |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public static function get_subform_name( $subsection_name = '' ) { |
|
194 | - return EE_Template_Layout::prep_form_subsection_key_name( $subsection_name ); |
|
193 | + public static function get_subform_name($subsection_name = '') { |
|
194 | + return EE_Template_Layout::prep_form_subsection_key_name($subsection_name); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 |
@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | - * @ link {@link http://www.eventespresso.com} |
|
12 | - * @ since 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | + * @ link {@link http://www.eventespresso.com} |
|
12 | + * @ since 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + */ |
|
16 | 16 | |
17 | 17 | |
18 | 18 | |
@@ -1301,8 +1301,8 @@ discard block |
||
1301 | 1301 | * verifies user access for this admin page |
1302 | 1302 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1303 | 1303 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1304 | - * @return BOOL|wp_die() |
|
1305 | - */ |
|
1304 | + * @return BOOL|wp_die() |
|
1305 | + */ |
|
1306 | 1306 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1307 | 1307 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1308 | 1308 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1703,11 +1703,11 @@ discard block |
||
1703 | 1703 | |
1704 | 1704 | |
1705 | 1705 | /** |
1706 | - * admin_footer_scripts_eei18n_js_strings |
|
1707 | - * |
|
1708 | - * @access public |
|
1709 | - * @return void |
|
1710 | - */ |
|
1706 | + * admin_footer_scripts_eei18n_js_strings |
|
1707 | + * |
|
1708 | + * @access public |
|
1709 | + * @return void |
|
1710 | + */ |
|
1711 | 1711 | public function admin_footer_scripts_eei18n_js_strings() { |
1712 | 1712 | |
1713 | 1713 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1763,11 +1763,11 @@ discard block |
||
1763 | 1763 | |
1764 | 1764 | |
1765 | 1765 | /** |
1766 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1767 | - * |
|
1768 | - * @access public |
|
1769 | - * @return void |
|
1770 | - */ |
|
1766 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1767 | + * |
|
1768 | + * @access public |
|
1769 | + * @return void |
|
1770 | + */ |
|
1771 | 1771 | public function add_xdebug_style() { |
1772 | 1772 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1773 | 1773 | } |
@@ -1824,9 +1824,9 @@ discard block |
||
1824 | 1824 | |
1825 | 1825 | /** |
1826 | 1826 | * set current view for List Table |
1827 | - * @access public |
|
1828 | - * @return array |
|
1829 | - */ |
|
1827 | + * @access public |
|
1828 | + * @return array |
|
1829 | + */ |
|
1830 | 1830 | protected function _set_list_table_view() { |
1831 | 1831 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1832 | 1832 | |
@@ -1903,7 +1903,7 @@ discard block |
||
1903 | 1903 | * @access protected |
1904 | 1904 | * @param int $max_entries total number of rows in the table |
1905 | 1905 | * @return string |
1906 | - */ |
|
1906 | + */ |
|
1907 | 1907 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1908 | 1908 | |
1909 | 1909 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1948,9 +1948,9 @@ discard block |
||
1948 | 1948 | |
1949 | 1949 | /** |
1950 | 1950 | * _set_search_attributes |
1951 | - * @access protected |
|
1952 | - * @return void |
|
1953 | - */ |
|
1951 | + * @access protected |
|
1952 | + * @return void |
|
1953 | + */ |
|
1954 | 1954 | public function _set_search_attributes() { |
1955 | 1955 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1956 | 1956 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1970,7 +1970,7 @@ discard block |
||
1970 | 1970 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1971 | 1971 | * @access private |
1972 | 1972 | * @return void |
1973 | - */ |
|
1973 | + */ |
|
1974 | 1974 | private function _add_registered_meta_boxes() { |
1975 | 1975 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1976 | 1976 | |
@@ -2230,9 +2230,9 @@ discard block |
||
2230 | 2230 | |
2231 | 2231 | /** |
2232 | 2232 | * displays an error message to ppl who have javascript disabled |
2233 | - * @access private |
|
2234 | - * @return string |
|
2235 | - */ |
|
2233 | + * @access private |
|
2234 | + * @return string |
|
2235 | + */ |
|
2236 | 2236 | private function _display_no_javascript_warning() { |
2237 | 2237 | ?> |
2238 | 2238 | <noscript> |
@@ -2255,9 +2255,9 @@ discard block |
||
2255 | 2255 | |
2256 | 2256 | /** |
2257 | 2257 | * displays espresso success and/or error notices |
2258 | - * @access private |
|
2259 | - * @return string |
|
2260 | - */ |
|
2258 | + * @access private |
|
2259 | + * @return string |
|
2260 | + */ |
|
2261 | 2261 | private function _display_espresso_notices() { |
2262 | 2262 | $notices = $this->_get_transient( TRUE ); |
2263 | 2263 | echo stripslashes($notices); |
@@ -2269,10 +2269,10 @@ discard block |
||
2269 | 2269 | |
2270 | 2270 | |
2271 | 2271 | /** |
2272 | - * spinny things pacify the masses |
|
2273 | - * @access private |
|
2274 | - * @return string |
|
2275 | - */ |
|
2272 | + * spinny things pacify the masses |
|
2273 | + * @access private |
|
2274 | + * @return string |
|
2275 | + */ |
|
2276 | 2276 | protected function _add_admin_page_ajax_loading_img() { |
2277 | 2277 | ?> |
2278 | 2278 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2286,10 +2286,10 @@ discard block |
||
2286 | 2286 | |
2287 | 2287 | |
2288 | 2288 | /** |
2289 | - * add admin page overlay for modal boxes |
|
2290 | - * @access private |
|
2291 | - * @return string |
|
2292 | - */ |
|
2289 | + * add admin page overlay for modal boxes |
|
2290 | + * @access private |
|
2291 | + * @return string |
|
2292 | + */ |
|
2293 | 2293 | protected function _add_admin_page_overlay() { |
2294 | 2294 | ?> |
2295 | 2295 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2351,10 +2351,10 @@ discard block |
||
2351 | 2351 | |
2352 | 2352 | |
2353 | 2353 | /** |
2354 | - * generates HTML wrapper for an admin details page |
|
2355 | - * @access public |
|
2356 | - * @return void |
|
2357 | - */ |
|
2354 | + * generates HTML wrapper for an admin details page |
|
2355 | + * @access public |
|
2356 | + * @return void |
|
2357 | + */ |
|
2358 | 2358 | public function display_admin_page_with_sidebar() { |
2359 | 2359 | |
2360 | 2360 | $this->_display_admin_page(TRUE); |
@@ -2364,10 +2364,10 @@ discard block |
||
2364 | 2364 | |
2365 | 2365 | |
2366 | 2366 | /** |
2367 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2368 | - * @access public |
|
2369 | - * @return void |
|
2370 | - */ |
|
2367 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2368 | + * @access public |
|
2369 | + * @return void |
|
2370 | + */ |
|
2371 | 2371 | public function display_admin_page_with_no_sidebar() { |
2372 | 2372 | $this->_display_admin_page(); |
2373 | 2373 | } |
@@ -2591,11 +2591,11 @@ discard block |
||
2591 | 2591 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2592 | 2592 | if ( NULL === error_get_last() || ! headers_sent() ) |
2593 | 2593 | header('Content-Type: application/json; charset=UTF-8'); |
2594 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2595 | - echo wp_json_encode( $json ); |
|
2596 | - } else { |
|
2597 | - echo json_encode( $json ); |
|
2598 | - } |
|
2594 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2595 | + echo wp_json_encode( $json ); |
|
2596 | + } else { |
|
2597 | + echo json_encode( $json ); |
|
2598 | + } |
|
2599 | 2599 | exit(); |
2600 | 2600 | } |
2601 | 2601 | |
@@ -2634,11 +2634,11 @@ discard block |
||
2634 | 2634 | |
2635 | 2635 | |
2636 | 2636 | /** |
2637 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2638 | - * @access public |
|
2639 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2640 | - * @return void |
|
2641 | - */ |
|
2637 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2638 | + * @access public |
|
2639 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2640 | + * @return void |
|
2641 | + */ |
|
2642 | 2642 | public function admin_page_wrapper($about = FALSE) { |
2643 | 2643 | |
2644 | 2644 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2692,15 +2692,15 @@ discard block |
||
2692 | 2692 | |
2693 | 2693 | |
2694 | 2694 | /** |
2695 | - * sort nav tabs |
|
2696 | - * @access public |
|
2697 | - * @return void |
|
2698 | - */ |
|
2695 | + * sort nav tabs |
|
2696 | + * @access public |
|
2697 | + * @return void |
|
2698 | + */ |
|
2699 | 2699 | private function _sort_nav_tabs( $a, $b ) { |
2700 | 2700 | if ($a['order'] == $b['order']) { |
2701 | - return 0; |
|
2702 | - } |
|
2703 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2701 | + return 0; |
|
2702 | + } |
|
2703 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2704 | 2704 | } |
2705 | 2705 | |
2706 | 2706 |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
148 | 148 | * @access public |
149 | 149 | */ |
150 | - public function __construct( $routing = TRUE ) { |
|
150 | + public function __construct($routing = TRUE) { |
|
151 | 151 | |
152 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
152 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
153 | 153 | $this->_is_caf = TRUE; |
154 | 154 | |
155 | 155 | $this->_yes_no_values = array( |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | |
162 | 162 | //set the _req_data property. |
163 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
163 | + $this->_req_data = array_merge($_GET, $_POST); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | //routing enabled? |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->_do_other_page_hooks(); |
182 | 182 | |
183 | 183 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
184 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
184 | + if (method_exists($this, '_before_page_setup')) |
|
185 | 185 | $this->_before_page_setup(); |
186 | 186 | |
187 | 187 | //set up page dependencies |
@@ -451,16 +451,16 @@ discard block |
||
451 | 451 | */ |
452 | 452 | protected function _global_ajax_hooks() { |
453 | 453 | //for lazy loading of metabox content |
454 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
454 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
458 | 458 | |
459 | 459 | public function ajax_metabox_content() { |
460 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
461 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
460 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
461 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
462 | 462 | |
463 | - self::cached_rss_display( $contentid, $url ); |
|
463 | + self::cached_rss_display($contentid, $url); |
|
464 | 464 | wp_die(); |
465 | 465 | } |
466 | 466 | |
@@ -479,87 +479,87 @@ discard block |
||
479 | 479 | //requires? |
480 | 480 | |
481 | 481 | //admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can. But keep in mind, not everything is available from the EE_Admin Page object at this point. |
482 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
482 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
483 | 483 | |
484 | 484 | |
485 | 485 | //next verify if we need to load anything... |
486 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE; |
|
487 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
486 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE; |
|
487 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
488 | 488 | |
489 | 489 | global $ee_menu_slugs; |
490 | 490 | $ee_menu_slugs = (array) $ee_menu_slugs; |
491 | 491 | |
492 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
492 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
493 | 493 | |
494 | 494 | |
495 | 495 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
496 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
497 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
496 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
497 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
498 | 498 | } |
499 | 499 | // then set blank or -1 action values to 'default' |
500 | - $this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default'; |
|
500 | + $this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default'; |
|
501 | 501 | |
502 | 502 | //if action is 'default' after the above BUT we have 'route' var set, then let's use the route as the action. This covers cases where we're coming in from a list table that isn't on the default route. |
503 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
503 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
504 | 504 | |
505 | 505 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
506 | 506 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
507 | 507 | |
508 | 508 | $this->_current_view = $this->_req_action; |
509 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
509 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
510 | 510 | $this->_define_page_props(); |
511 | 511 | |
512 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
512 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
513 | 513 | |
514 | 514 | //default things |
515 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
515 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
516 | 516 | |
517 | 517 | //set page configs |
518 | 518 | $this->_set_page_routes(); |
519 | 519 | $this->_set_page_config(); |
520 | 520 | |
521 | 521 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
522 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
522 | + if (isset($this->_req_data['wp_referer'])) { |
|
523 | 523 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
524 | 524 | } |
525 | 525 | |
526 | 526 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
527 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
527 | + if (method_exists($this, '_extend_page_config')) |
|
528 | 528 | $this->_extend_page_config(); |
529 | 529 | |
530 | 530 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
531 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
531 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
532 | 532 | $this->_extend_page_config_for_cpt(); |
533 | 533 | |
534 | 534 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
535 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
536 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
535 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
536 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
537 | 537 | |
538 | 538 | |
539 | 539 | //if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action |
540 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
541 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
540 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
541 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
545 | 545 | //next route only if routing enabled |
546 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
546 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
547 | 547 | |
548 | 548 | $this->_verify_routes(); |
549 | 549 | |
550 | 550 | //next let's just check user_access and kill if no access |
551 | 551 | $this->check_user_access(); |
552 | 552 | |
553 | - if ( $this->_is_UI_request ) { |
|
553 | + if ($this->_is_UI_request) { |
|
554 | 554 | //admin_init stuff - global, all views for this page class, specific view |
555 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
556 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
557 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
555 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
556 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
557 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | } else { |
561 | 561 | //hijack regular WP loading and route admin request immediately |
562 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
562 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
563 | 563 | $this->route_admin_request(); |
564 | 564 | } |
565 | 565 | } |
@@ -576,18 +576,18 @@ discard block |
||
576 | 576 | * @return void |
577 | 577 | */ |
578 | 578 | private function _do_other_page_hooks() { |
579 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
579 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
580 | 580 | |
581 | - foreach ( $registered_pages as $page ) { |
|
581 | + foreach ($registered_pages as $page) { |
|
582 | 582 | |
583 | 583 | //now let's setup the file name and class that should be present |
584 | 584 | $classname = str_replace('.class.php', '', $page); |
585 | 585 | |
586 | 586 | //autoloaders should take care of loading file |
587 | - if ( !class_exists( $classname ) ) { |
|
588 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
589 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname ); |
|
590 | - throw new EE_Error( implode( '||', $error_msg )); |
|
587 | + if ( ! class_exists($classname)) { |
|
588 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
589 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname); |
|
590 | + throw new EE_Error(implode('||', $error_msg)); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | $a = new ReflectionClass($classname); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | public function load_page_dependencies() { |
603 | 603 | try { |
604 | 604 | $this->_load_page_dependencies(); |
605 | - } catch ( EE_Error $e ) { |
|
605 | + } catch (EE_Error $e) { |
|
606 | 606 | $e->get_error(); |
607 | 607 | } |
608 | 608 | } |
@@ -620,16 +620,16 @@ discard block |
||
620 | 620 | $this->_current_screen = get_current_screen(); |
621 | 621 | |
622 | 622 | //load admin_notices - global, page class, and view specific |
623 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
624 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
625 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
626 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
623 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
624 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
625 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
626 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | //load network admin_notices - global, page class, and view specific |
630 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
631 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
632 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
630 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
631 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
632 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | //this will save any per_page screen options if they are present |
@@ -645,8 +645,8 @@ discard block |
||
645 | 645 | //add screen options - global, page child class, and view specific |
646 | 646 | $this->_add_global_screen_options(); |
647 | 647 | $this->_add_screen_options(); |
648 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
649 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
648 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
649 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
650 | 650 | |
651 | 651 | |
652 | 652 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -657,33 +657,33 @@ discard block |
||
657 | 657 | //add feature_pointers - global, page child class, and view specific |
658 | 658 | $this->_add_feature_pointers(); |
659 | 659 | $this->_add_global_feature_pointers(); |
660 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
661 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
660 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
661 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
662 | 662 | |
663 | 663 | //enqueue scripts/styles - global, page class, and view specific |
664 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
665 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
666 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
667 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
664 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
665 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
666 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
667 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
668 | 668 | |
669 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
669 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
670 | 670 | |
671 | 671 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
672 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
673 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
674 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
675 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
672 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
673 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
674 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
675 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
676 | 676 | |
677 | 677 | //admin footer scripts |
678 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
679 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
680 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
681 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
678 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
679 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
680 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
681 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
682 | 682 | |
683 | 683 | |
684 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
684 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
685 | 685 | //targeted hook |
686 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
686 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
687 | 687 | |
688 | 688 | } |
689 | 689 | |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | private function _set_defaults() { |
699 | 699 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
700 | 700 | |
701 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
701 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
702 | 702 | |
703 | 703 | $this->default_nav_tab_name = 'overview'; |
704 | 704 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | public function route_admin_request() { |
726 | 726 | try { |
727 | 727 | $this->_route_admin_request(); |
728 | - } catch ( EE_Error $e ) { |
|
728 | + } catch (EE_Error $e) { |
|
729 | 729 | $e->get_error(); |
730 | 730 | } |
731 | 731 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $this->_wp_page_slug = $wp_page_slug; |
737 | 737 | |
738 | 738 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
739 | - if ( is_network_admin() ) { |
|
739 | + if (is_network_admin()) { |
|
740 | 740 | $this->_wp_page_slug .= '-network'; |
741 | 741 | } |
742 | 742 | } |
@@ -749,53 +749,53 @@ discard block |
||
749 | 749 | * @return void |
750 | 750 | */ |
751 | 751 | protected function _verify_routes() { |
752 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
752 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
753 | 753 | |
754 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
754 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
755 | 755 | |
756 | 756 | $this->_route = FALSE; |
757 | 757 | $func = FALSE; |
758 | 758 | $args = array(); |
759 | 759 | |
760 | 760 | // check that the page_routes array is not empty |
761 | - if ( empty( $this->_page_routes )) { |
|
761 | + if (empty($this->_page_routes)) { |
|
762 | 762 | // user error msg |
763 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
763 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
764 | 764 | // developer error msg |
765 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
766 | - throw new EE_Error( $error_msg ); |
|
765 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
766 | + throw new EE_Error($error_msg); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | // and that the requested page route exists |
770 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
771 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
770 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
771 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
772 | 772 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
773 | 773 | } else { |
774 | 774 | // user error msg |
775 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
775 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
776 | 776 | // developer error msg |
777 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action ); |
|
778 | - throw new EE_Error( $error_msg ); |
|
777 | + $error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action); |
|
778 | + throw new EE_Error($error_msg); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | // and that a default route exists |
782 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
782 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
783 | 783 | // user error msg |
784 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
784 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
785 | 785 | // developer error msg |
786 | - $error_msg .= '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' ); |
|
787 | - throw new EE_Error( $error_msg ); |
|
786 | + $error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso'); |
|
787 | + throw new EE_Error($error_msg); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | |
791 | 791 | //first lets' catch if the UI request has EVER been set. |
792 | - if ( $this->_is_UI_request === NULL ) { |
|
792 | + if ($this->_is_UI_request === NULL) { |
|
793 | 793 | //lets set if this is a UI request or not. |
794 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
794 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
795 | 795 | |
796 | 796 | |
797 | 797 | //wait a minute... we might have a noheader in the route array |
798 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
798 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | $this->_set_current_labels(); |
@@ -810,15 +810,15 @@ discard block |
||
810 | 810 | * @param string $route the route name we're verifying |
811 | 811 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
812 | 812 | */ |
813 | - protected function _verify_route( $route ) { |
|
814 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
813 | + protected function _verify_route($route) { |
|
814 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
815 | 815 | return true; |
816 | 816 | } else { |
817 | 817 | // user error msg |
818 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
818 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
819 | 819 | // developer error msg |
820 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route ); |
|
821 | - throw new EE_Error( $error_msg ); |
|
820 | + $error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route); |
|
821 | + throw new EE_Error($error_msg); |
|
822 | 822 | } |
823 | 823 | } |
824 | 824 | |
@@ -832,18 +832,18 @@ discard block |
||
832 | 832 | * @param string $nonce_ref The nonce reference string (name0) |
833 | 833 | * @return mixed (bool|die) |
834 | 834 | */ |
835 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
835 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
836 | 836 | // verify nonce against expected value |
837 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
837 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
838 | 838 | // these are not the droids you are looking for !!! |
839 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
840 | - if ( WP_DEBUG ) { |
|
841 | - $msg .= "\n " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__ ); |
|
839 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
840 | + if (WP_DEBUG) { |
|
841 | + $msg .= "\n ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__); |
|
842 | 842 | } |
843 | - if ( ! defined( 'DOING_AJAX' )) { |
|
844 | - wp_die( $msg ); |
|
843 | + if ( ! defined('DOING_AJAX')) { |
|
844 | + wp_die($msg); |
|
845 | 845 | } else { |
846 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
846 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
847 | 847 | $this->_return_json(); |
848 | 848 | } |
849 | 849 | } |
@@ -861,63 +861,63 @@ discard block |
||
861 | 861 | * @return void |
862 | 862 | */ |
863 | 863 | protected function _route_admin_request() { |
864 | - if ( ! $this->_is_UI_request ) |
|
864 | + if ( ! $this->_is_UI_request) |
|
865 | 865 | $this->_verify_routes(); |
866 | 866 | |
867 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
867 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
868 | 868 | |
869 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
869 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
870 | 870 | // set nonce from post data |
871 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
872 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
871 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
872 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
873 | 873 | } |
874 | 874 | //set the nav_tabs array but ONLY if this is UI_request |
875 | - if ( $this->_is_UI_request ) |
|
875 | + if ($this->_is_UI_request) |
|
876 | 876 | $this->_set_nav_tabs(); |
877 | 877 | |
878 | 878 | // grab callback function |
879 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
879 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
880 | 880 | |
881 | 881 | // check if callback has args |
882 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
882 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
883 | 883 | |
884 | 884 | $error_msg = ''; |
885 | 885 | |
886 | 886 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
887 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
888 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
887 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
888 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | //right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
892 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
892 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
893 | 893 | |
894 | - if ( ! empty( $func )) { |
|
894 | + if ( ! empty($func)) { |
|
895 | 895 | $base_call = $addon_call = FALSE; |
896 | 896 | //try to access page route via this class |
897 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
897 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
898 | 898 | // user error msg |
899 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
899 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
900 | 900 | // developer error msg |
901 | - $error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func ); |
|
901 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func); |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | //for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method) |
905 | 905 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
906 | 906 | |
907 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
908 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
909 | - $error_msg .= '||' . sprintf( __('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func ); |
|
907 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
908 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
909 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func); |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | |
913 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
914 | - throw new EE_Error( $error_msg ); |
|
913 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
914 | + throw new EE_Error($error_msg); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
918 | 918 | //now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent. |
919 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
920 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
919 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
920 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | * @param string $new_route New (non header) route to redirect to. |
934 | 934 | * @return void |
935 | 935 | */ |
936 | - protected function _reset_routing_properties( $new_route ) { |
|
936 | + protected function _reset_routing_properties($new_route) { |
|
937 | 937 | $this->_is_UI_request = TRUE; |
938 | 938 | //now we set the current route to whatever the headers_sent_route is set at |
939 | 939 | $this->_req_data['action'] = $new_route; |
@@ -979,23 +979,23 @@ discard block |
||
979 | 979 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
980 | 980 | * @return string |
981 | 981 | */ |
982 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
982 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
983 | 983 | |
984 | 984 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
985 | - if ( $sticky ) { |
|
985 | + if ($sticky) { |
|
986 | 986 | $request = $_REQUEST; |
987 | - unset( $request['_wp_http_referer'] ); |
|
988 | - unset( $request['wp_referer'] ); |
|
989 | - foreach ( $request as $key => $value ) { |
|
987 | + unset($request['_wp_http_referer']); |
|
988 | + unset($request['wp_referer']); |
|
989 | + foreach ($request as $key => $value) { |
|
990 | 990 | //do not add nonces |
991 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
991 | + if (strpos($key, 'nonce') !== false) { |
|
992 | 992 | continue; |
993 | 993 | } |
994 | - $args['wp_referer[' . $key . ']'] = $value; |
|
994 | + $args['wp_referer['.$key.']'] = $value; |
|
995 | 995 | } |
996 | 996 | } |
997 | 997 | |
998 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
998 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
@@ -1011,8 +1011,8 @@ discard block |
||
1011 | 1011 | * @uses EEH_Template::get_help_tab_link() |
1012 | 1012 | * @return string generated link |
1013 | 1013 | */ |
1014 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1015 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1014 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1015 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1029,30 +1029,30 @@ discard block |
||
1029 | 1029 | */ |
1030 | 1030 | protected function _add_help_tabs() { |
1031 | 1031 | $tour_buttons = ''; |
1032 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1032 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1033 | 1033 | $config = $this->_page_config[$this->_req_action]; |
1034 | 1034 | |
1035 | 1035 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1036 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1036 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1037 | 1037 | $tb = array(); |
1038 | 1038 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1039 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1039 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1040 | 1040 | //if this is the end tour then we don't need to setup a button |
1041 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1041 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1042 | 1042 | continue; |
1043 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1043 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1044 | 1044 | } |
1045 | 1045 | $tour_buttons .= implode('<br />', $tb); |
1046 | 1046 | $tour_buttons .= '</div></div>'; |
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1050 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1050 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1051 | 1051 | //check that the callback given is valid |
1052 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1053 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1052 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1053 | + throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this))); |
|
1054 | 1054 | |
1055 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1055 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1056 | 1056 | |
1057 | 1057 | $content .= $tour_buttons; //add help tour buttons. |
1058 | 1058 | |
@@ -1061,49 +1061,49 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1064 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1064 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1065 | 1065 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1069 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1069 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1070 | 1070 | $_ht['id'] = $this->page_slug; |
1071 | 1071 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1072 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1072 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1073 | 1073 | $this->_current_screen->add_help_tab($_ht); |
1074 | 1074 | }/**/ |
1075 | 1075 | |
1076 | 1076 | |
1077 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1077 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1078 | 1078 | |
1079 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1079 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1080 | 1080 | //we're here so there ARE help tabs! |
1081 | 1081 | |
1082 | 1082 | //make sure we've got what we need |
1083 | - if ( !isset( $cfg['title'] ) ) |
|
1084 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1083 | + if ( ! isset($cfg['title'])) |
|
1084 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1085 | 1085 | |
1086 | 1086 | |
1087 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1088 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1087 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1088 | + throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso')); |
|
1089 | 1089 | |
1090 | 1090 | |
1091 | 1091 | |
1092 | 1092 | //first priority goes to content. |
1093 | - if ( !empty($cfg['content'] ) ) { |
|
1094 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1093 | + if ( ! empty($cfg['content'])) { |
|
1094 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1095 | 1095 | |
1096 | 1096 | //second priority goes to filename |
1097 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1098 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1097 | + } else if ( ! empty($cfg['filename'])) { |
|
1098 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1099 | 1099 | |
1100 | 1100 | |
1101 | 1101 | //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too) |
1102 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1102 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1103 | 1103 | |
1104 | 1104 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1105 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1106 | - EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1105 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1106 | + EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__); |
|
1107 | 1107 | return; |
1108 | 1108 | } |
1109 | 1109 | $template_args['admin_page_obj'] = $this; |
@@ -1114,21 +1114,21 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | |
1116 | 1116 | //check if callback is valid |
1117 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1118 | - EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1117 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1118 | + EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__); |
|
1119 | 1119 | return; |
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | //setup config array for help tab method |
1123 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1123 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1124 | 1124 | $_ht = array( |
1125 | 1125 | 'id' => $id, |
1126 | 1126 | 'title' => $cfg['title'], |
1127 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1127 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1128 | 1128 | 'content' => $content |
1129 | 1129 | ); |
1130 | 1130 | |
1131 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1131 | + $this->_current_screen->add_help_tab($_ht); |
|
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | } |
@@ -1148,49 +1148,49 @@ discard block |
||
1148 | 1148 | $this->_help_tour = array(); |
1149 | 1149 | |
1150 | 1150 | //exit early if help tours are turned off globally |
1151 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1151 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1152 | 1152 | return; |
1153 | 1153 | |
1154 | 1154 | //loop through _page_config to find any help_tour defined |
1155 | - foreach ( $this->_page_config as $route => $config ) { |
|
1155 | + foreach ($this->_page_config as $route => $config) { |
|
1156 | 1156 | //we're only going to set things up for this route |
1157 | - if ( $route !== $this->_req_action ) |
|
1157 | + if ($route !== $this->_req_action) |
|
1158 | 1158 | continue; |
1159 | 1159 | |
1160 | - if ( isset( $config['help_tour'] ) ) { |
|
1160 | + if (isset($config['help_tour'])) { |
|
1161 | 1161 | |
1162 | - foreach( $config['help_tour'] as $tour ) { |
|
1163 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1162 | + foreach ($config['help_tour'] as $tour) { |
|
1163 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1164 | 1164 | //let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent |
1165 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1165 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1166 | 1166 | |
1167 | 1167 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1168 | - if ( !is_readable($file_path) ) { |
|
1169 | - EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1168 | + if ( ! is_readable($file_path)) { |
|
1169 | + EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__); |
|
1170 | 1170 | return; |
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | require_once $file_path; |
1174 | - if ( !class_exists( $tour ) ) { |
|
1175 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1176 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) ); |
|
1177 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1174 | + if ( ! class_exists($tour)) { |
|
1175 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1176 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this)); |
|
1177 | + throw new EE_Error(implode('||', $error_msg)); |
|
1178 | 1178 | } |
1179 | 1179 | $a = new ReflectionClass($tour); |
1180 | 1180 | $tour_obj = $a->newInstance($this->_is_caf); |
1181 | 1181 | |
1182 | 1182 | $tours[] = $tour_obj; |
1183 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1183 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1187 | 1187 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1188 | 1188 | $tours[] = $end_stop_tour; |
1189 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1189 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1190 | 1190 | } |
1191 | 1191 | } |
1192 | 1192 | |
1193 | - if ( !empty( $tours ) ) |
|
1193 | + if ( ! empty($tours)) |
|
1194 | 1194 | $this->_help_tour['tours'] = $tours; |
1195 | 1195 | |
1196 | 1196 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1206,12 +1206,12 @@ discard block |
||
1206 | 1206 | * @return void |
1207 | 1207 | */ |
1208 | 1208 | protected function _add_qtips() { |
1209 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1209 | + if (isset($this->_route_config['qtips'])) { |
|
1210 | 1210 | $qtips = (array) $this->_route_config['qtips']; |
1211 | 1211 | //load qtip loader |
1212 | 1212 | $path = array( |
1213 | - $this->_get_dir() . '/qtips/', |
|
1214 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1213 | + $this->_get_dir().'/qtips/', |
|
1214 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1215 | 1215 | ); |
1216 | 1216 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1217 | 1217 | } |
@@ -1228,41 +1228,41 @@ discard block |
||
1228 | 1228 | * @return void |
1229 | 1229 | */ |
1230 | 1230 | protected function _set_nav_tabs() { |
1231 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1231 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1232 | 1232 | $i = 0; |
1233 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1234 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1233 | + foreach ($this->_page_config as $slug => $config) { |
|
1234 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1235 | 1235 | continue; //no nav tab for this config |
1236 | 1236 | |
1237 | 1237 | //check for persistent flag |
1238 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1238 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1239 | 1239 | continue; //nav tab is only to appear when route requested. |
1240 | 1240 | |
1241 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1241 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1242 | 1242 | continue; //no nav tab becasue current user does not have access. |
1243 | 1243 | |
1244 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1244 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1245 | 1245 | $this->_nav_tabs[$slug] = array( |
1246 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1247 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1248 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1249 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1246 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1247 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1248 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1249 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1250 | 1250 | ); |
1251 | 1251 | $i++; |
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | //if $this->_nav_tabs is empty then lets set the default |
1255 | - if ( empty( $this->_nav_tabs ) ) { |
|
1255 | + if (empty($this->_nav_tabs)) { |
|
1256 | 1256 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1257 | 1257 | 'url' => $this->admin_base_url, |
1258 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1258 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1259 | 1259 | 'css_class' => 'nav-tab-active', |
1260 | 1260 | 'order' => 10 |
1261 | 1261 | ); |
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | //now let's sort the tabs according to order |
1265 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1265 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1266 | 1266 | |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1278,10 +1278,10 @@ discard block |
||
1278 | 1278 | * @return void |
1279 | 1279 | */ |
1280 | 1280 | private function _set_current_labels() { |
1281 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1282 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1283 | - if ( is_array($text) ) { |
|
1284 | - foreach ( $text as $sublabel => $subtext ) { |
|
1281 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1282 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1283 | + if (is_array($text)) { |
|
1284 | + foreach ($text as $sublabel => $subtext) { |
|
1285 | 1285 | $this->_labels[$label][$sublabel] = $subtext; |
1286 | 1286 | } |
1287 | 1287 | } else { |
@@ -1302,24 +1302,24 @@ discard block |
||
1302 | 1302 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1303 | 1303 | * @return BOOL|wp_die() |
1304 | 1304 | */ |
1305 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1306 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1307 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1308 | - $capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1305 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1306 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1307 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1308 | + $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1309 | 1309 | |
1310 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1311 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1310 | + if (empty($capability) && empty($route_to_check)) { |
|
1311 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1312 | 1312 | } else { |
1313 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1313 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1314 | 1314 | } |
1315 | 1315 | |
1316 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1316 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1317 | 1317 | |
1318 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1319 | - if ( $verify_only ) { |
|
1318 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1319 | + if ($verify_only) { |
|
1320 | 1320 | return FALSE; |
1321 | 1321 | } else { |
1322 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1322 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1323 | 1323 | } |
1324 | 1324 | } |
1325 | 1325 | return TRUE; |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | $this->_add_admin_page_overlay(); |
1397 | 1397 | |
1398 | 1398 | //if metaboxes are present we need to add the nonce field |
1399 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1399 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1400 | 1400 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1401 | 1401 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1402 | 1402 | } |
@@ -1415,19 +1415,19 @@ discard block |
||
1415 | 1415 | */ |
1416 | 1416 | public function admin_footer_global() { |
1417 | 1417 | //dialog container for dialog helper |
1418 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1418 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1419 | 1419 | $d_cont .= '<div class="ee-notices"></div>'; |
1420 | 1420 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1421 | 1421 | $d_cont .= '</div>'; |
1422 | 1422 | echo $d_cont; |
1423 | 1423 | |
1424 | 1424 | //help tour stuff? |
1425 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1425 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1426 | 1426 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | //current set timezone for timezone js |
1430 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1430 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1451,18 +1451,18 @@ discard block |
||
1451 | 1451 | * @access protected |
1452 | 1452 | * @return string content |
1453 | 1453 | */ |
1454 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1454 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1455 | 1455 | $content = ''; |
1456 | 1456 | |
1457 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1458 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1457 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1458 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1459 | 1459 | |
1460 | 1460 | |
1461 | 1461 | //loop through the array and setup content |
1462 | - foreach ( $help_array as $trigger => $help ) { |
|
1462 | + foreach ($help_array as $trigger => $help) { |
|
1463 | 1463 | //make sure the array is setup properly |
1464 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1465 | - throw new EE_Error( __('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') ); |
|
1464 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1465 | + throw new EE_Error(__('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso')); |
|
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1472,10 +1472,10 @@ discard block |
||
1472 | 1472 | 'help_popup_content' => $help['content'] |
1473 | 1473 | ); |
1474 | 1474 | |
1475 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1475 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | - if ( $display ) |
|
1478 | + if ($display) |
|
1479 | 1479 | echo $content; |
1480 | 1480 | else |
1481 | 1481 | return $content; |
@@ -1492,18 +1492,18 @@ discard block |
||
1492 | 1492 | */ |
1493 | 1493 | private function _get_help_content() { |
1494 | 1494 | //what is the method we're looking for? |
1495 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1495 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1496 | 1496 | |
1497 | 1497 | //if method doesn't exist let's get out. |
1498 | - if ( !method_exists( $this, $method_name ) ) |
|
1498 | + if ( ! method_exists($this, $method_name)) |
|
1499 | 1499 | return array(); |
1500 | 1500 | |
1501 | 1501 | //k we're good to go let's retrieve the help array |
1502 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1502 | + $help_array = call_user_func(array($this, $method_name)); |
|
1503 | 1503 | |
1504 | 1504 | //make sure we've got an array! |
1505 | - if ( !is_array($help_array) ) { |
|
1506 | - throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) ); |
|
1505 | + if ( ! is_array($help_array)) { |
|
1506 | + throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso')); |
|
1507 | 1507 | } |
1508 | 1508 | |
1509 | 1509 | return $help_array; |
@@ -1525,27 +1525,27 @@ discard block |
||
1525 | 1525 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1526 | 1526 | * @return string |
1527 | 1527 | */ |
1528 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1528 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1529 | 1529 | |
1530 | - if ( defined('DOING_AJAX') ) return; |
|
1530 | + if (defined('DOING_AJAX')) return; |
|
1531 | 1531 | |
1532 | 1532 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1533 | 1533 | $help_array = $this->_get_help_content(); |
1534 | 1534 | $help_content = ''; |
1535 | 1535 | |
1536 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1536 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1537 | 1537 | $help_array[$trigger_id] = array( |
1538 | 1538 | 'title' => __('Missing Content', 'event_espresso'), |
1539 | 1539 | 'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso') |
1540 | 1540 | ); |
1541 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1541 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1542 | 1542 | } |
1543 | 1543 | |
1544 | 1544 | //let's setup the trigger |
1545 | - $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1546 | - $content = $content . $help_content; |
|
1545 | + $content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1546 | + $content = $content.$help_content; |
|
1547 | 1547 | |
1548 | - if ( $display ) |
|
1548 | + if ($display) |
|
1549 | 1549 | echo $content; |
1550 | 1550 | else |
1551 | 1551 | return $content; |
@@ -1602,15 +1602,15 @@ discard block |
||
1602 | 1602 | public function load_global_scripts_styles() { |
1603 | 1603 | /** STYLES **/ |
1604 | 1604 | // add debugging styles |
1605 | - if ( WP_DEBUG ) { |
|
1606 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1605 | + if (WP_DEBUG) { |
|
1606 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | //register all styles |
1610 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION ); |
|
1611 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1610 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1611 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1612 | 1612 | //helpers styles |
1613 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1613 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1614 | 1614 | //enqueue global styles |
1615 | 1615 | wp_enqueue_style('ee-admin-css'); |
1616 | 1616 | |
@@ -1618,66 +1618,66 @@ discard block |
||
1618 | 1618 | /** SCRIPTS **/ |
1619 | 1619 | |
1620 | 1620 | //register all scripts |
1621 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1622 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1623 | - wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true ); |
|
1621 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1622 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1623 | + wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1624 | 1624 | |
1625 | - wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true ); |
|
1625 | + wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true); |
|
1626 | 1626 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1627 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1627 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1628 | 1628 | add_filter('FHEE_load_joyride', '__return_true'); |
1629 | 1629 | |
1630 | 1630 | //script for sorting tables |
1631 | - wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1631 | + wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1632 | 1632 | //script for parsing uri's |
1633 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | 1634 | //and parsing associative serialized form elements |
1635 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1635 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1636 | 1636 | //helpers scripts |
1637 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1638 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1639 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1640 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1637 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1638 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1639 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1640 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1641 | 1641 | |
1642 | 1642 | //google charts |
1643 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1643 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1644 | 1644 | |
1645 | 1645 | //enqueue global scripts |
1646 | 1646 | |
1647 | 1647 | //taking care of metaboxes |
1648 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1648 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1649 | 1649 | wp_enqueue_script('dashboard'); |
1650 | 1650 | } |
1651 | 1651 | |
1652 | 1652 | //enqueue thickbox for ee help popups. default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups |
1653 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1653 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1654 | 1654 | wp_enqueue_script('ee_admin_js'); |
1655 | 1655 | wp_enqueue_style('ee-admin-css'); |
1656 | 1656 | } |
1657 | 1657 | |
1658 | 1658 | |
1659 | 1659 | //localize script for ajax lazy loading |
1660 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1661 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1660 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1661 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1662 | 1662 | |
1663 | 1663 | |
1664 | 1664 | /** |
1665 | 1665 | * help tour stuff |
1666 | 1666 | */ |
1667 | - if ( !empty( $this->_help_tour ) ) { |
|
1667 | + if ( ! empty($this->_help_tour)) { |
|
1668 | 1668 | |
1669 | 1669 | //register the js for kicking things off |
1670 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1670 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1671 | 1671 | |
1672 | 1672 | //setup tours for the js tour object |
1673 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1673 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1674 | 1674 | $tours[] = array( |
1675 | 1675 | 'id' => $tour->get_slug(), |
1676 | 1676 | 'options' => $tour->get_options() |
1677 | 1677 | ); |
1678 | 1678 | } |
1679 | 1679 | |
1680 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1680 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1681 | 1681 | |
1682 | 1682 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1683 | 1683 | } |
@@ -1695,52 +1695,52 @@ discard block |
||
1695 | 1695 | public function admin_footer_scripts_eei18n_js_strings() { |
1696 | 1696 | |
1697 | 1697 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1698 | - EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' ); |
|
1699 | - |
|
1700 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1701 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1702 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1703 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1704 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1705 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1706 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1707 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1708 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1709 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1710 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1711 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1724 | - |
|
1725 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1735 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1736 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1698 | + EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso'); |
|
1699 | + |
|
1700 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1701 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1702 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1703 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1704 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1705 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1706 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1707 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1708 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1709 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1710 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1711 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1724 | + |
|
1725 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1735 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1736 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1739 | 1739 | |
1740 | 1740 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1741 | 1741 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1742 | 1742 | //espresso_core is listed as a dependency of ee_admin_js. |
1743 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1743 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1744 | 1744 | |
1745 | 1745 | } |
1746 | 1746 | |
@@ -1774,23 +1774,23 @@ discard block |
||
1774 | 1774 | protected function _set_list_table() { |
1775 | 1775 | |
1776 | 1776 | //first is this a list_table view? |
1777 | - if ( !isset($this->_route_config['list_table']) ) |
|
1777 | + if ( ! isset($this->_route_config['list_table'])) |
|
1778 | 1778 | return; //not a list_table view so get out. |
1779 | 1779 | |
1780 | 1780 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1781 | 1781 | |
1782 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1782 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1783 | 1783 | //user error msg |
1784 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1784 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1785 | 1785 | //developer error msg |
1786 | - $error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action ); |
|
1787 | - throw new EE_Error( $error_msg ); |
|
1786 | + $error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action); |
|
1787 | + throw new EE_Error($error_msg); |
|
1788 | 1788 | } |
1789 | 1789 | |
1790 | 1790 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1791 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1792 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1793 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1791 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1792 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1793 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1794 | 1794 | |
1795 | 1795 | $this->_set_list_table_view(); |
1796 | 1796 | $this->_set_list_table_object(); |
@@ -1812,14 +1812,14 @@ discard block |
||
1812 | 1812 | * @return array |
1813 | 1813 | */ |
1814 | 1814 | protected function _set_list_table_view() { |
1815 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1815 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1816 | 1816 | |
1817 | 1817 | |
1818 | 1818 | // looking at active items or dumpster diving ? |
1819 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1820 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1819 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1820 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1821 | 1821 | } else { |
1822 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1822 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1823 | 1823 | } |
1824 | 1824 | } |
1825 | 1825 | |
@@ -1830,9 +1830,9 @@ discard block |
||
1830 | 1830 | * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of. |
1831 | 1831 | */ |
1832 | 1832 | protected function _set_list_table_object() { |
1833 | - if ( isset($this->_route_config['list_table'] ) ) { |
|
1834 | - if ( !class_exists( $this->_route_config['list_table'] ) ) |
|
1835 | - throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) ); |
|
1833 | + if (isset($this->_route_config['list_table'])) { |
|
1834 | + if ( ! class_exists($this->_route_config['list_table'])) |
|
1835 | + throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this))); |
|
1836 | 1836 | $a = new ReflectionClass($this->_route_config['list_table']); |
1837 | 1837 | $this->_list_table_object = $a->newInstance($this); |
1838 | 1838 | } |
@@ -1851,27 +1851,27 @@ discard block |
||
1851 | 1851 | * |
1852 | 1852 | * @return array |
1853 | 1853 | */ |
1854 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1854 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1855 | 1855 | |
1856 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1856 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1857 | 1857 | |
1858 | - if ( empty( $this->_views )) { |
|
1858 | + if (empty($this->_views)) { |
|
1859 | 1859 | $this->_views = array(); |
1860 | 1860 | } |
1861 | 1861 | |
1862 | 1862 | // cycle thru views |
1863 | - foreach ( $this->_views as $key => $view ) { |
|
1863 | + foreach ($this->_views as $key => $view) { |
|
1864 | 1864 | $query_args = array(); |
1865 | 1865 | // check for current view |
1866 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1866 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1867 | 1867 | $query_args['action'] = $this->_req_action; |
1868 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1868 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1869 | 1869 | $query_args['status'] = $view['slug']; |
1870 | 1870 | //merge any other arguments sent in. |
1871 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1872 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1871 | + if (isset($extra_query_args[$view['slug']])) { |
|
1872 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1873 | 1873 | } |
1874 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1874 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1875 | 1875 | } |
1876 | 1876 | |
1877 | 1877 | return $this->_views; |
@@ -1888,15 +1888,15 @@ discard block |
||
1888 | 1888 | * @param int $max_entries total number of rows in the table |
1889 | 1889 | * @return string |
1890 | 1890 | */ |
1891 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1891 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1892 | 1892 | |
1893 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1894 | - $values = array( 10, 25, 50, 100 ); |
|
1895 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1893 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1894 | + $values = array(10, 25, 50, 100); |
|
1895 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1896 | 1896 | |
1897 | - if ( $max_entries ) { |
|
1897 | + if ($max_entries) { |
|
1898 | 1898 | $values[] = $max_entries; |
1899 | - sort( $values ); |
|
1899 | + sort($values); |
|
1900 | 1900 | } |
1901 | 1901 | |
1902 | 1902 | $entries_per_page_dropdown = ' |
@@ -1905,15 +1905,15 @@ discard block |
||
1905 | 1905 | Show |
1906 | 1906 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1907 | 1907 | |
1908 | - foreach ( $values as $value ) { |
|
1909 | - if ( $value < $max_entries ) { |
|
1910 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1908 | + foreach ($values as $value) { |
|
1909 | + if ($value < $max_entries) { |
|
1910 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1911 | 1911 | $entries_per_page_dropdown .= ' |
1912 | 1912 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1913 | 1913 | } |
1914 | 1914 | } |
1915 | 1915 | |
1916 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1916 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1917 | 1917 | $entries_per_page_dropdown .= ' |
1918 | 1918 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1919 | 1919 | |
@@ -1936,8 +1936,8 @@ discard block |
||
1936 | 1936 | * @return void |
1937 | 1937 | */ |
1938 | 1938 | public function _set_search_attributes() { |
1939 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1940 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1939 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1940 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1941 | 1941 | } |
1942 | 1942 | |
1943 | 1943 | /*** END LIST TABLE METHODS **/ |
@@ -1956,20 +1956,20 @@ discard block |
||
1956 | 1956 | * @return void |
1957 | 1957 | */ |
1958 | 1958 | private function _add_registered_meta_boxes() { |
1959 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1959 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1960 | 1960 | |
1961 | 1961 | //we only add meta boxes if the page_route calls for it |
1962 | - if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) { |
|
1962 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) { |
|
1963 | 1963 | |
1964 | 1964 | |
1965 | 1965 | //this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader. |
1966 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1967 | - if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) { |
|
1966 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1967 | + if (call_user_func(array($this, &$metabox_callback)) === FALSE) { |
|
1968 | 1968 | // user error msg |
1969 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
1969 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
1970 | 1970 | // developer error msg |
1971 | - $error_msg .= '||' . sprintf( __( 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso' ), $metabox_callback ); |
|
1972 | - throw new EE_Error( $error_msg ); |
|
1971 | + $error_msg .= '||'.sprintf(__('The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso'), $metabox_callback); |
|
1972 | + throw new EE_Error($error_msg); |
|
1973 | 1973 | } |
1974 | 1974 | } |
1975 | 1975 | } |
@@ -1986,17 +1986,17 @@ discard block |
||
1986 | 1986 | * @return void |
1987 | 1987 | */ |
1988 | 1988 | private function _add_screen_columns() { |
1989 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
1989 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
1990 | 1990 | |
1991 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
1991 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
1992 | 1992 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
1993 | 1993 | $screen_id = $this->_current_screen->id; |
1994 | 1994 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
1995 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
1996 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
1995 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
1996 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
1997 | 1997 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
1998 | 1998 | $this->_template_args['screen'] = $this->_current_screen; |
1999 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
1999 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2000 | 2000 | |
2001 | 2001 | //finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded. |
2002 | 2002 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2013,11 +2013,11 @@ discard block |
||
2013 | 2013 | */ |
2014 | 2014 | |
2015 | 2015 | private function _espresso_news_post_box() { |
2016 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2017 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2016 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2017 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2018 | 2018 | $this, |
2019 | 2019 | 'espresso_news_post_box' |
2020 | - ), $this->_wp_page_slug, 'side' ); |
|
2020 | + ), $this->_wp_page_slug, 'side'); |
|
2021 | 2021 | } |
2022 | 2022 | |
2023 | 2023 | |
@@ -2025,14 +2025,14 @@ discard block |
||
2025 | 2025 | * Code for setting up espresso ratings request metabox. |
2026 | 2026 | */ |
2027 | 2027 | protected function _espresso_ratings_request() { |
2028 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2028 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2029 | 2029 | return ''; |
2030 | 2030 | } |
2031 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2032 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2031 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2032 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2033 | 2033 | $this, |
2034 | 2034 | 'espresso_ratings_request' |
2035 | - ), $this->_wp_page_slug, 'side' ); |
|
2035 | + ), $this->_wp_page_slug, 'side'); |
|
2036 | 2036 | } |
2037 | 2037 | |
2038 | 2038 | |
@@ -2040,34 +2040,34 @@ discard block |
||
2040 | 2040 | * Code for setting up espresso ratings request metabox content. |
2041 | 2041 | */ |
2042 | 2042 | public function espresso_ratings_request() { |
2043 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2044 | - EEH_Template::display_template( $template_path, array() ); |
|
2043 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2044 | + EEH_Template::display_template($template_path, array()); |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | |
2048 | 2048 | |
2049 | 2049 | |
2050 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2051 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2052 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2053 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2054 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2055 | - $post = '</div>' . "\n"; |
|
2050 | + public static function cached_rss_display($rss_id, $url) { |
|
2051 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2052 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2053 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2054 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2055 | + $post = '</div>'."\n"; |
|
2056 | 2056 | |
2057 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2058 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2059 | - echo $pre . $output . $post; |
|
2057 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2058 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2059 | + echo $pre.$output.$post; |
|
2060 | 2060 | return TRUE; |
2061 | 2061 | } |
2062 | 2062 | |
2063 | - if ( ! $doing_ajax ) { |
|
2064 | - echo $pre . $loading . $post; |
|
2063 | + if ( ! $doing_ajax) { |
|
2064 | + echo $pre.$loading.$post; |
|
2065 | 2065 | return FALSE; |
2066 | 2066 | } |
2067 | 2067 | |
2068 | 2068 | ob_start(); |
2069 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2070 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2069 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2070 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2071 | 2071 | return TRUE; |
2072 | 2072 | |
2073 | 2073 | } |
@@ -2079,13 +2079,13 @@ discard block |
||
2079 | 2079 | <div id="espresso_news_post_box_content" class="infolinks"> |
2080 | 2080 | <?php |
2081 | 2081 | // Get RSS Feed(s) |
2082 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2082 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2083 | 2083 | $url = urlencode($feed_url); |
2084 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2084 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2085 | 2085 | |
2086 | 2086 | ?> |
2087 | 2087 | </div> |
2088 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2088 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2089 | 2089 | </div> |
2090 | 2090 | <?php |
2091 | 2091 | } |
@@ -2106,32 +2106,32 @@ discard block |
||
2106 | 2106 | |
2107 | 2107 | protected function _espresso_sponsors_post_box() { |
2108 | 2108 | |
2109 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2110 | - if ( $show_sponsors ) |
|
2111 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2109 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2110 | + if ($show_sponsors) |
|
2111 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2112 | 2112 | } |
2113 | 2113 | |
2114 | 2114 | |
2115 | 2115 | public function espresso_sponsors_post_box() { |
2116 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2117 | - EEH_Template::display_template( $templatepath ); |
|
2116 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2117 | + EEH_Template::display_template($templatepath); |
|
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | |
2121 | 2121 | |
2122 | 2122 | private function _publish_post_box() { |
2123 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2123 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2124 | 2124 | |
2125 | 2125 | //if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label. Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes) |
2126 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2127 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2126 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2127 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2128 | 2128 | } else { |
2129 | 2129 | $box_label = __('Publish', 'event_espresso'); |
2130 | 2130 | } |
2131 | 2131 | |
2132 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2132 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2133 | 2133 | |
2134 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2134 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2135 | 2135 | |
2136 | 2136 | } |
2137 | 2137 | |
@@ -2139,9 +2139,9 @@ discard block |
||
2139 | 2139 | |
2140 | 2140 | public function editor_overview() { |
2141 | 2141 | //if we have extra content set let's add it in if not make sure its empty |
2142 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2143 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2144 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2142 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2143 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2144 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2145 | 2145 | } |
2146 | 2146 | |
2147 | 2147 | |
@@ -2157,8 +2157,8 @@ discard block |
||
2157 | 2157 | * @see $this->_set_publish_post_box_vars for param details |
2158 | 2158 | * @since 4.6.0 |
2159 | 2159 | */ |
2160 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2161 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2160 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2161 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2162 | 2162 | } |
2163 | 2163 | |
2164 | 2164 | |
@@ -2177,24 +2177,24 @@ discard block |
||
2177 | 2177 | * @param string $post_save_redirect_URL custom URL to redirect to after Save & Close has been completed |
2178 | 2178 | * @param boolean $both_btns whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button |
2179 | 2179 | */ |
2180 | - protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) { |
|
2180 | + protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) { |
|
2181 | 2181 | |
2182 | 2182 | // if Save & Close, use a custom redirect URL or default to the main page? |
2183 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2183 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2184 | 2184 | // create the Save & Close and Save buttons |
2185 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2185 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2186 | 2186 | //if we have extra content set let's add it in if not make sure its empty |
2187 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2187 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2188 | 2188 | |
2189 | 2189 | |
2190 | - if ( $delete && ! empty( $id ) ) { |
|
2190 | + if ($delete && ! empty($id)) { |
|
2191 | 2191 | $delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent. |
2192 | - $delete_link_args = array( $name => $id ); |
|
2193 | - $delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2192 | + $delete_link_args = array($name => $id); |
|
2193 | + $delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2194 | 2194 | } |
2195 | 2195 | |
2196 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2197 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2196 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2197 | + if ( ! empty($name) && ! empty($id)) { |
|
2198 | 2198 | $hidden_field_arr[$name] = array( |
2199 | 2199 | 'type' => 'hidden', |
2200 | 2200 | 'value' => $id |
@@ -2204,7 +2204,7 @@ discard block |
||
2204 | 2204 | $hf = ''; |
2205 | 2205 | } |
2206 | 2206 | // add hidden field |
2207 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2207 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2208 | 2208 | |
2209 | 2209 | } |
2210 | 2210 | |
@@ -2221,8 +2221,8 @@ discard block |
||
2221 | 2221 | <noscript> |
2222 | 2222 | <div id="no-js-message" class="error"> |
2223 | 2223 | <p style="font-size:1.3em;"> |
2224 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2225 | - <?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?> |
|
2224 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2225 | + <?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?> |
|
2226 | 2226 | </p> |
2227 | 2227 | </div> |
2228 | 2228 | </noscript> |
@@ -2242,7 +2242,7 @@ discard block |
||
2242 | 2242 | * @return string |
2243 | 2243 | */ |
2244 | 2244 | private function _display_espresso_notices() { |
2245 | - $notices = $this->_get_transient( TRUE ); |
|
2245 | + $notices = $this->_get_transient(TRUE); |
|
2246 | 2246 | echo stripslashes($notices); |
2247 | 2247 | } |
2248 | 2248 | |
@@ -2294,11 +2294,11 @@ discard block |
||
2294 | 2294 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2295 | 2295 | * @param boolean $create_func default is true. Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box. |
2296 | 2296 | */ |
2297 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2298 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2297 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2298 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2299 | 2299 | |
2300 | 2300 | //if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated. |
2301 | - if ( empty( $callback_args ) && $create_func ) { |
|
2301 | + if (empty($callback_args) && $create_func) { |
|
2302 | 2302 | $callback_args = array( |
2303 | 2303 | 'template_path' => $this->_template_path, |
2304 | 2304 | 'template_args' => $this->_template_args, |
@@ -2308,7 +2308,7 @@ discard block |
||
2308 | 2308 | //if $create_func is true (default) then we automatically create the function for displaying the actual meta box. If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish) |
2309 | 2309 | $call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback; |
2310 | 2310 | |
2311 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2311 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2312 | 2312 | } |
2313 | 2313 | |
2314 | 2314 | |
@@ -2321,7 +2321,7 @@ discard block |
||
2321 | 2321 | */ |
2322 | 2322 | public function display_admin_page_with_metabox_columns() { |
2323 | 2323 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2324 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2324 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2325 | 2325 | |
2326 | 2326 | //the final wrapper |
2327 | 2327 | $this->admin_page_wrapper(); |
@@ -2364,7 +2364,7 @@ discard block |
||
2364 | 2364 | * @return void |
2365 | 2365 | */ |
2366 | 2366 | public function display_about_admin_page() { |
2367 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2367 | + $this->_display_admin_page(FALSE, TRUE); |
|
2368 | 2368 | } |
2369 | 2369 | |
2370 | 2370 | |
@@ -2380,26 +2380,26 @@ discard block |
||
2380 | 2380 | * @return html admin_page |
2381 | 2381 | */ |
2382 | 2382 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2383 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2383 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2384 | 2384 | |
2385 | 2385 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2386 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2386 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2387 | 2387 | |
2388 | 2388 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2389 | 2389 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2390 | 2390 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2391 | 2391 | |
2392 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2392 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2393 | 2393 | |
2394 | - if ( defined('DOING_AJAX' ) ) |
|
2395 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2394 | + if (defined('DOING_AJAX')) |
|
2395 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2396 | 2396 | |
2397 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2397 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2398 | 2398 | |
2399 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2399 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2400 | 2400 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2401 | 2401 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2402 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2402 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2403 | 2403 | |
2404 | 2404 | |
2405 | 2405 | // the final template wrapper |
@@ -2419,7 +2419,7 @@ discard block |
||
2419 | 2419 | * @param bool $display_sidebar whether to use the sidebar template or the full template for the page. TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar. |
2420 | 2420 | * @return void |
2421 | 2421 | */ |
2422 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2422 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2423 | 2423 | //let's generate a default preview action button if there isn't one already present. |
2424 | 2424 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2425 | 2425 | $buy_now_url = add_query_arg( |
@@ -2432,10 +2432,10 @@ discard block |
||
2432 | 2432 | ), |
2433 | 2433 | 'http://eventespresso.com/pricing/' |
2434 | 2434 | ); |
2435 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button']; |
|
2436 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2437 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2438 | - $this->_display_admin_page( $display_sidebar ); |
|
2435 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button']; |
|
2436 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2437 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2438 | + $this->_display_admin_page($display_sidebar); |
|
2439 | 2439 | } |
2440 | 2440 | |
2441 | 2441 | |
@@ -2469,41 +2469,41 @@ discard block |
||
2469 | 2469 | * @param boolean $sidebar whether to display with sidebar or not. |
2470 | 2470 | * @return html |
2471 | 2471 | */ |
2472 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2472 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2473 | 2473 | //setup search attributes |
2474 | 2474 | $this->_set_search_attributes(); |
2475 | 2475 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2476 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2476 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2477 | 2477 | |
2478 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2478 | + $this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2479 | 2479 | $this->_template_args['list_table'] = $this->_list_table_object; |
2480 | 2480 | $this->_template_args['current_route'] = $this->_req_action; |
2481 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2481 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2482 | 2482 | |
2483 | 2483 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2484 | - if( ! empty( $ajax_sorting_callback )) { |
|
2485 | - $sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE ); |
|
2484 | + if ( ! empty($ajax_sorting_callback)) { |
|
2485 | + $sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE); |
|
2486 | 2486 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2487 | 2487 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2488 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2489 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2488 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2489 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2490 | 2490 | } else { |
2491 | 2491 | $sortable_list_table_form_fields = ''; |
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2495 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2496 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2497 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2495 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2496 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2497 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2498 | 2498 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2499 | 2499 | |
2500 | 2500 | //display message about search results? |
2501 | - $this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action ); |
|
2501 | + $this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action); |
|
2502 | 2502 | |
2503 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2503 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2504 | 2504 | |
2505 | 2505 | // the final template wrapper |
2506 | - if ( $sidebar ) |
|
2506 | + if ($sidebar) |
|
2507 | 2507 | $this->display_admin_page_with_sidebar(); |
2508 | 2508 | else |
2509 | 2509 | $this->display_admin_page_with_no_sidebar(); |
@@ -2526,9 +2526,9 @@ discard block |
||
2526 | 2526 | * @param array $items see above for format of array |
2527 | 2527 | * @return string html string of legend |
2528 | 2528 | */ |
2529 | - protected function _display_legend( $items ) { |
|
2530 | - $template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2531 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2529 | + protected function _display_legend($items) { |
|
2530 | + $template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2531 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2532 | 2532 | return EEH_Template::display_template($legend_template, $template_args, TRUE); |
2533 | 2533 | } |
2534 | 2534 | |
@@ -2553,31 +2553,31 @@ discard block |
||
2553 | 2553 | * |
2554 | 2554 | * @return json object |
2555 | 2555 | */ |
2556 | - protected function _return_json( $sticky_notices = FALSE ) { |
|
2556 | + protected function _return_json($sticky_notices = FALSE) { |
|
2557 | 2557 | |
2558 | 2558 | //make sure any EE_Error notices have been handled. |
2559 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2559 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2560 | 2560 | |
2561 | 2561 | |
2562 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2562 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2563 | 2563 | unset($this->_template_args['data']); |
2564 | 2564 | $json = array( |
2565 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : FALSE, |
|
2566 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : FALSE, |
|
2565 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : FALSE, |
|
2566 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : FALSE, |
|
2567 | 2567 | 'notices' => EE_Error::get_notices(), |
2568 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2569 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2568 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2569 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2570 | 2570 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2571 | 2571 | ); |
2572 | 2572 | |
2573 | 2573 | |
2574 | 2574 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2575 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2575 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2576 | 2576 | header('Content-Type: application/json; charset=UTF-8'); |
2577 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2578 | - echo wp_json_encode( $json ); |
|
2577 | + if (function_exists('wp_json_encode')) { |
|
2578 | + echo wp_json_encode($json); |
|
2579 | 2579 | } else { |
2580 | - echo json_encode( $json ); |
|
2580 | + echo json_encode($json); |
|
2581 | 2581 | } |
2582 | 2582 | exit(); |
2583 | 2583 | } |
@@ -2589,11 +2589,11 @@ discard block |
||
2589 | 2589 | * @return json_obj|EE_Error |
2590 | 2590 | */ |
2591 | 2591 | public function return_json() { |
2592 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2592 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2593 | 2593 | $this->_return_json(); |
2594 | 2594 | |
2595 | 2595 | else { |
2596 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2596 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2597 | 2597 | } |
2598 | 2598 | } |
2599 | 2599 | |
@@ -2608,7 +2608,7 @@ discard block |
||
2608 | 2608 | * @access public |
2609 | 2609 | * @return void |
2610 | 2610 | */ |
2611 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2611 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2612 | 2612 | $this->_hook_obj = $hook_obj; |
2613 | 2613 | } |
2614 | 2614 | |
@@ -2624,33 +2624,33 @@ discard block |
||
2624 | 2624 | */ |
2625 | 2625 | public function admin_page_wrapper($about = FALSE) { |
2626 | 2626 | |
2627 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2627 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2628 | 2628 | |
2629 | 2629 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2630 | 2630 | |
2631 | 2631 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2632 | 2632 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2633 | 2633 | |
2634 | - $this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2635 | - $this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2634 | + $this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2635 | + $this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2636 | 2636 | |
2637 | 2637 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2638 | 2638 | |
2639 | 2639 | |
2640 | 2640 | |
2641 | 2641 | // load settings page wrapper template |
2642 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2642 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2643 | 2643 | |
2644 | 2644 | //about page? |
2645 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2645 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2646 | 2646 | |
2647 | 2647 | |
2648 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2649 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2648 | + if (defined('DOING_AJAX')) { |
|
2649 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2650 | 2650 | |
2651 | 2651 | $this->_return_json(); |
2652 | 2652 | } else { |
2653 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2653 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2654 | 2654 | } |
2655 | 2655 | |
2656 | 2656 | } |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | * @access public |
2679 | 2679 | * @return void |
2680 | 2680 | */ |
2681 | - private function _sort_nav_tabs( $a, $b ) { |
|
2681 | + private function _sort_nav_tabs($a, $b) { |
|
2682 | 2682 | if ($a['order'] == $b['order']) { |
2683 | 2683 | return 0; |
2684 | 2684 | } |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2700 | 2700 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2701 | 2701 | */ |
2702 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2702 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2703 | 2703 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2704 | 2704 | return $content; |
2705 | 2705 | } |
@@ -2721,25 +2721,25 @@ discard block |
||
2721 | 2721 | * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button). We can also use this to just dump default actions by submitting some other value. |
2722 | 2722 | * @param bool|string|null $referrer if false then we just do the default action on save and close. Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling). |
2723 | 2723 | */ |
2724 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2724 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2725 | 2725 | //make sure $text and $actions are in an array |
2726 | 2726 | $text = (array) $text; |
2727 | 2727 | $actions = (array) $actions; |
2728 | 2728 | $referrer_url = empty($referrer) ? '' : $referrer; |
2729 | - $referrer_url = !$referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />'; |
|
2729 | + $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />'; |
|
2730 | 2730 | |
2731 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2732 | - $default_names = array( 'save', 'save_and_close' ); |
|
2731 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2732 | + $default_names = array('save', 'save_and_close'); |
|
2733 | 2733 | |
2734 | 2734 | //add in a hidden index for the current page (so save and close redirects properly) |
2735 | 2735 | $this->_template_args['save_buttons'] = $referrer_url; |
2736 | 2736 | |
2737 | - foreach ( $button_text as $key => $button ) { |
|
2737 | + foreach ($button_text as $key => $button) { |
|
2738 | 2738 | $ref = $default_names[$key]; |
2739 | - $id = $this->_current_view . '_' . $ref; |
|
2740 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2741 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2742 | - if ( !$both ) break; |
|
2739 | + $id = $this->_current_view.'_'.$ref; |
|
2740 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2741 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2742 | + if ( ! $both) break; |
|
2743 | 2743 | } |
2744 | 2744 | |
2745 | 2745 | } |
@@ -2752,8 +2752,8 @@ discard block |
||
2752 | 2752 | * @since 4.6.0 |
2753 | 2753 | * |
2754 | 2754 | */ |
2755 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2756 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2755 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2756 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2757 | 2757 | } |
2758 | 2758 | |
2759 | 2759 | |
@@ -2766,30 +2766,30 @@ discard block |
||
2766 | 2766 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2767 | 2767 | * @return void |
2768 | 2768 | */ |
2769 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2769 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2770 | 2770 | |
2771 | - if ( empty( $route )) { |
|
2771 | + if (empty($route)) { |
|
2772 | 2772 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2773 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2774 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2773 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2774 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2775 | 2775 | } |
2776 | 2776 | // open form |
2777 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2777 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2778 | 2778 | // add nonce |
2779 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2779 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2780 | 2780 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2781 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2781 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2782 | 2782 | // add REQUIRED form action |
2783 | 2783 | $hidden_fields = array( |
2784 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2784 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2785 | 2785 | ); |
2786 | 2786 | // merge arrays |
2787 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2787 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2788 | 2788 | // generate form fields |
2789 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2789 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2790 | 2790 | // add fields to form |
2791 | - foreach ( $form_fields as $field_name => $form_field ) { |
|
2792 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2791 | + foreach ($form_fields as $field_name => $form_field) { |
|
2792 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2793 | 2793 | } |
2794 | 2794 | |
2795 | 2795 | // close form |
@@ -2806,8 +2806,8 @@ discard block |
||
2806 | 2806 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2807 | 2807 | * @since 4.5.0 |
2808 | 2808 | */ |
2809 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2810 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2809 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2810 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2811 | 2811 | } |
2812 | 2812 | |
2813 | 2813 | |
@@ -2823,32 +2823,32 @@ discard block |
||
2823 | 2823 | * @access protected |
2824 | 2824 | * @return void |
2825 | 2825 | */ |
2826 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2826 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2827 | 2827 | |
2828 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2828 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2829 | 2829 | |
2830 | 2830 | //class name for actions/filters. |
2831 | 2831 | $classname = get_class($this); |
2832 | 2832 | |
2833 | 2833 | //set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url |
2834 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2835 | - $notices = EE_Error::get_notices( FALSE ); |
|
2834 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2835 | + $notices = EE_Error::get_notices(FALSE); |
|
2836 | 2836 | |
2837 | 2837 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2838 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2838 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2839 | 2839 | EE_Error::overwrite_success(); |
2840 | 2840 | } |
2841 | 2841 | // how many records affected ? more than one record ? or just one ? |
2842 | - if ( $success > 1 && empty( $notices['errors'] )) { |
|
2842 | + if ($success > 1 && empty($notices['errors'])) { |
|
2843 | 2843 | // set plural msg |
2844 | - EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__); |
|
2845 | - } else if ( $success == 1 && empty( $notices['errors'] )) { |
|
2844 | + EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2845 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2846 | 2846 | // set singular msg |
2847 | - EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ ); |
|
2847 | + EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2848 | 2848 | } |
2849 | 2849 | |
2850 | 2850 | // check that $query_args isn't something crazy |
2851 | - if ( ! is_array( $query_args )) { |
|
2851 | + if ( ! is_array($query_args)) { |
|
2852 | 2852 | $query_args = array(); |
2853 | 2853 | } |
2854 | 2854 | |
@@ -2861,36 +2861,36 @@ discard block |
||
2861 | 2861 | * @param array $query_args The original query_args array coming into the |
2862 | 2862 | * method. |
2863 | 2863 | */ |
2864 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2864 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2865 | 2865 | |
2866 | 2866 | //calculate where we're going (if we have a "save and close" button pushed) |
2867 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2867 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2868 | 2868 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2869 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2869 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2870 | 2870 | // regenerate query args array from refferer URL |
2871 | - parse_str( $parsed_url['query'], $query_args ); |
|
2871 | + parse_str($parsed_url['query'], $query_args); |
|
2872 | 2872 | // correct page and action will be in the query args now |
2873 | - $redirect_url = admin_url( 'admin.php' ); |
|
2873 | + $redirect_url = admin_url('admin.php'); |
|
2874 | 2874 | } |
2875 | 2875 | |
2876 | 2876 | //merge any default query_args set in _default_route_query_args property |
2877 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2877 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2878 | 2878 | $args_to_merge = array(); |
2879 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2879 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2880 | 2880 | //is there a wp_referer array in our _default_route_query_args property? |
2881 | - if ( $query_param == 'wp_referer' ) { |
|
2881 | + if ($query_param == 'wp_referer') { |
|
2882 | 2882 | $query_value = (array) $query_value; |
2883 | - foreach ( $query_value as $reference => $value ) { |
|
2884 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2883 | + foreach ($query_value as $reference => $value) { |
|
2884 | + if (strpos($reference, 'nonce') !== false) { |
|
2885 | 2885 | continue; |
2886 | 2886 | } |
2887 | 2887 | |
2888 | 2888 | //finally we will override any arguments in the referer with |
2889 | 2889 | //what might be set on the _default_route_query_args array. |
2890 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2891 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2890 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2891 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2892 | 2892 | } else { |
2893 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2893 | + $args_to_merge[$reference] = urlencode($value); |
|
2894 | 2894 | } |
2895 | 2895 | } |
2896 | 2896 | continue; |
@@ -2901,7 +2901,7 @@ discard block |
||
2901 | 2901 | |
2902 | 2902 | //now let's merge these arguments but override with what was specifically sent in to the |
2903 | 2903 | //redirect. |
2904 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
2904 | + $query_args = array_merge($args_to_merge, $query_args); |
|
2905 | 2905 | } |
2906 | 2906 | |
2907 | 2907 | $this->_process_notices($query_args); |
@@ -2910,19 +2910,19 @@ discard block |
||
2910 | 2910 | // generate redirect url |
2911 | 2911 | |
2912 | 2912 | // if redirecting to anything other than the main page, add a nonce |
2913 | - if ( isset( $query_args['action'] )) { |
|
2913 | + if (isset($query_args['action'])) { |
|
2914 | 2914 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
2915 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
2915 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
2916 | 2916 | } |
2917 | 2917 | |
2918 | 2918 | //we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that). |
2919 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
2919 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
2920 | 2920 | |
2921 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
2921 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
2922 | 2922 | |
2923 | 2923 | |
2924 | 2924 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
2925 | - if ( defined('DOING_AJAX' ) ) { |
|
2925 | + if (defined('DOING_AJAX')) { |
|
2926 | 2926 | $default_data = array( |
2927 | 2927 | 'close' => TRUE, |
2928 | 2928 | 'redirect_url' => $redirect_url, |
@@ -2931,11 +2931,11 @@ discard block |
||
2931 | 2931 | ); |
2932 | 2932 | |
2933 | 2933 | $this->_template_args['success'] = $success; |
2934 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
2934 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
2935 | 2935 | $this->_return_json(); |
2936 | 2936 | } |
2937 | 2937 | |
2938 | - wp_safe_redirect( $redirect_url ); |
|
2938 | + wp_safe_redirect($redirect_url); |
|
2939 | 2939 | exit(); |
2940 | 2940 | } |
2941 | 2941 | |
@@ -2951,14 +2951,14 @@ discard block |
||
2951 | 2951 | * @param bool $sticky_notices This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice. |
2952 | 2952 | * @return void |
2953 | 2953 | */ |
2954 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
2954 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
2955 | 2955 | |
2956 | 2956 | $this->_template_args['notices'] = EE_Error::get_notices(); |
2957 | 2957 | |
2958 | 2958 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
2959 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
2960 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
2961 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
2959 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
2960 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
2961 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
2962 | 2962 | } |
2963 | 2963 | } |
2964 | 2964 | |
@@ -2980,32 +2980,32 @@ discard block |
||
2980 | 2980 | * |
2981 | 2981 | * @return string html for button |
2982 | 2982 | */ |
2983 | - public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) { |
|
2983 | + public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) { |
|
2984 | 2984 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
2985 | - if ( !isset($this->_page_routes[$action]) && !$base_url ) |
|
2986 | - throw new EE_Error( sprintf( __('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action) ); |
|
2985 | + if ( ! isset($this->_page_routes[$action]) && ! $base_url) |
|
2986 | + throw new EE_Error(sprintf(__('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action)); |
|
2987 | 2987 | |
2988 | - if ( !isset( $this->_labels['buttons'][$type] ) ) |
|
2989 | - throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) ); |
|
2988 | + if ( ! isset($this->_labels['buttons'][$type])) |
|
2989 | + throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type)); |
|
2990 | 2990 | |
2991 | 2991 | //finally check user access for this button. |
2992 | - $has_access = $this->check_user_access( $action, TRUE ); |
|
2993 | - if ( ! $has_access ) { |
|
2992 | + $has_access = $this->check_user_access($action, TRUE); |
|
2993 | + if ( ! $has_access) { |
|
2994 | 2994 | return ''; |
2995 | 2995 | } |
2996 | 2996 | |
2997 | - $_base_url = !$base_url ? $this->_admin_base_url : $base_url; |
|
2997 | + $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
|
2998 | 2998 | |
2999 | 2999 | $query_args = array( |
3000 | 3000 | 'action' => $action ); |
3001 | 3001 | |
3002 | 3002 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3003 | - if ( !empty($extra_request) ) |
|
3004 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3003 | + if ( ! empty($extra_request)) |
|
3004 | + $query_args = array_merge($extra_request, $query_args); |
|
3005 | 3005 | |
3006 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3006 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3007 | 3007 | |
3008 | - $button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class ); |
|
3008 | + $button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3009 | 3009 | |
3010 | 3010 | return $button; |
3011 | 3011 | } |
@@ -3025,11 +3025,11 @@ discard block |
||
3025 | 3025 | $args = array( |
3026 | 3026 | 'label' => $this->_admin_page_title, |
3027 | 3027 | 'default' => 10, |
3028 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3028 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3029 | 3029 | ); |
3030 | 3030 | //ONLY add the screen option if the user has access to it. |
3031 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3032 | - add_screen_option( $option, $args ); |
|
3031 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3032 | + add_screen_option($option, $args); |
|
3033 | 3033 | } |
3034 | 3034 | } |
3035 | 3035 | |
@@ -3045,36 +3045,36 @@ discard block |
||
3045 | 3045 | * @return void |
3046 | 3046 | */ |
3047 | 3047 | private function _set_per_page_screen_options() { |
3048 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3049 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3048 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3049 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3050 | 3050 | |
3051 | - if ( !$user = wp_get_current_user() ) |
|
3051 | + if ( ! $user = wp_get_current_user()) |
|
3052 | 3052 | return; |
3053 | 3053 | $option = $_POST['wp_screen_options']['option']; |
3054 | 3054 | $value = $_POST['wp_screen_options']['value']; |
3055 | 3055 | |
3056 | - if ( $option != sanitize_key( $option ) ) |
|
3056 | + if ($option != sanitize_key($option)) |
|
3057 | 3057 | return; |
3058 | 3058 | |
3059 | 3059 | $map_option = $option; |
3060 | 3060 | |
3061 | 3061 | $option = str_replace('-', '_', $option); |
3062 | 3062 | |
3063 | - switch ( $map_option ) { |
|
3064 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3063 | + switch ($map_option) { |
|
3064 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3065 | 3065 | $value = (int) $value; |
3066 | - if ( $value < 1 || $value > 999 ) |
|
3066 | + if ($value < 1 || $value > 999) |
|
3067 | 3067 | return; |
3068 | 3068 | break; |
3069 | 3069 | default: |
3070 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3071 | - if ( false === $value ) |
|
3070 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3071 | + if (false === $value) |
|
3072 | 3072 | return; |
3073 | 3073 | break; |
3074 | 3074 | } |
3075 | 3075 | |
3076 | 3076 | update_user_meta($user->ID, $option, $value); |
3077 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3077 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3078 | 3078 | exit; |
3079 | 3079 | } |
3080 | 3080 | } |
@@ -3085,8 +3085,8 @@ discard block |
||
3085 | 3085 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3086 | 3086 | * @param array $data array that will be assigned to template args. |
3087 | 3087 | */ |
3088 | - public function set_template_args( $data ) { |
|
3089 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3088 | + public function set_template_args($data) { |
|
3089 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3090 | 3090 | } |
3091 | 3091 | |
3092 | 3092 | |
@@ -3102,26 +3102,26 @@ discard block |
||
3102 | 3102 | * @param bool $skip_route_verify Used to indicate we want to skip route verification. This is usually ONLY used when we are adding a transient before page_routes have been defined. |
3103 | 3103 | * @return void |
3104 | 3104 | */ |
3105 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3105 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3106 | 3106 | $user_id = get_current_user_id(); |
3107 | 3107 | |
3108 | - if ( !$skip_route_verify ) |
|
3108 | + if ( ! $skip_route_verify) |
|
3109 | 3109 | $this->_verify_route($route); |
3110 | 3110 | |
3111 | 3111 | |
3112 | 3112 | //now let's set the string for what kind of transient we're setting |
3113 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3114 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3113 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3114 | + $data = $notices ? array('notices' => $data) : $data; |
|
3115 | 3115 | //is there already a transient for this route? If there is then let's ADD to that transient |
3116 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3117 | - if ( $existing ) { |
|
3118 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3116 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3117 | + if ($existing) { |
|
3118 | + $data = array_merge((array) $data, (array) $existing); |
|
3119 | 3119 | } |
3120 | 3120 | |
3121 | - if ( is_multisite() && is_network_admin() ) { |
|
3122 | - set_site_transient( $transient, $data, 8 ); |
|
3121 | + if (is_multisite() && is_network_admin()) { |
|
3122 | + set_site_transient($transient, $data, 8); |
|
3123 | 3123 | } else { |
3124 | - set_transient( $transient, $data, 8 ); |
|
3124 | + set_transient($transient, $data, 8); |
|
3125 | 3125 | } |
3126 | 3126 | } |
3127 | 3127 | |
@@ -3133,18 +3133,18 @@ discard block |
||
3133 | 3133 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3134 | 3134 | * @return mixed data |
3135 | 3135 | */ |
3136 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3136 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3137 | 3137 | $user_id = get_current_user_id(); |
3138 | - $route = !$route ? $this->_req_action : $route; |
|
3139 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3140 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3138 | + $route = ! $route ? $this->_req_action : $route; |
|
3139 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3140 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3141 | 3141 | //delete transient after retrieval (just in case it hasn't expired); |
3142 | - if ( is_multisite() && is_network_admin() ) { |
|
3143 | - delete_site_transient( $transient ); |
|
3142 | + if (is_multisite() && is_network_admin()) { |
|
3143 | + delete_site_transient($transient); |
|
3144 | 3144 | } else { |
3145 | - delete_transient( $transient ); |
|
3145 | + delete_transient($transient); |
|
3146 | 3146 | } |
3147 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3147 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3148 | 3148 | } |
3149 | 3149 | |
3150 | 3150 | |
@@ -3161,12 +3161,12 @@ discard block |
||
3161 | 3161 | |
3162 | 3162 | //retrieve all existing transients |
3163 | 3163 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3164 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3165 | - foreach ( $results as $result ) { |
|
3166 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3167 | - get_transient( $transient ); |
|
3168 | - if ( is_multisite() && is_network_admin() ) { |
|
3169 | - get_site_transient( $transient ); |
|
3164 | + if ($results = $wpdb->get_results($query)) { |
|
3165 | + foreach ($results as $result) { |
|
3166 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3167 | + get_transient($transient); |
|
3168 | + if (is_multisite() && is_network_admin()) { |
|
3169 | + get_site_transient($transient); |
|
3170 | 3170 | } |
3171 | 3171 | } |
3172 | 3172 | } |
@@ -3290,23 +3290,23 @@ discard block |
||
3290 | 3290 | * @param string $line line no where error occurred |
3291 | 3291 | * @return boolean |
3292 | 3292 | */ |
3293 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3293 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3294 | 3294 | |
3295 | 3295 | //remove any options that are NOT going to be saved with the config settings. |
3296 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3296 | + if (isset($config->core->ee_ueip_optin)) { |
|
3297 | 3297 | $config->core->ee_ueip_has_notified = TRUE; |
3298 | 3298 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3299 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3300 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3299 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3300 | + update_option('ee_ueip_has_notified', TRUE); |
|
3301 | 3301 | } |
3302 | 3302 | // and save it (note we're also doing the network save here) |
3303 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3304 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3305 | - if ( $config_saved && $net_saved ) { |
|
3306 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3303 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3304 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3305 | + if ($config_saved && $net_saved) { |
|
3306 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3307 | 3307 | return TRUE; |
3308 | 3308 | } else { |
3309 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3309 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3310 | 3310 | return FALSE; |
3311 | 3311 | } |
3312 | 3312 | } |
@@ -3319,7 +3319,7 @@ discard block |
||
3319 | 3319 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3320 | 3320 | * @return array |
3321 | 3321 | */ |
3322 | - public function get_yes_no_values(){ |
|
3322 | + public function get_yes_no_values() { |
|
3323 | 3323 | return $this->_yes_no_values; |
3324 | 3324 | } |
3325 | 3325 | |
@@ -3341,8 +3341,8 @@ discard block |
||
3341 | 3341 | * |
3342 | 3342 | * @return string |
3343 | 3343 | */ |
3344 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3345 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3344 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3345 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3346 | 3346 | } |
3347 | 3347 | |
3348 | 3348 | |
@@ -3356,8 +3356,8 @@ discard block |
||
3356 | 3356 | * |
3357 | 3357 | * @return string |
3358 | 3358 | */ |
3359 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3360 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3359 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3360 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3361 | 3361 | } |
3362 | 3362 | |
3363 | 3363 | |
@@ -3376,8 +3376,8 @@ discard block |
||
3376 | 3376 | * @return bool success/fail |
3377 | 3377 | */ |
3378 | 3378 | protected function _process_resend_registration() { |
3379 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3380 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3379 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3380 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3381 | 3381 | return $this->_template_args['success']; |
3382 | 3382 | } |
3383 | 3383 | |
@@ -3390,9 +3390,9 @@ discard block |
||
3390 | 3390 | * @param \EE_Payment $payment |
3391 | 3391 | * @return bool success/fail |
3392 | 3392 | */ |
3393 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3394 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3395 | - $success = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment ); |
|
3393 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3394 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3395 | + $success = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment); |
|
3396 | 3396 | $this->_template_args['success'] = $success; |
3397 | 3397 | return $success; |
3398 | 3398 | } |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | final class EE_Registry { |
12 | 12 | |
13 | 13 | /** |
14 | - * EE_Registry Object |
|
15 | - * @var EE_Registry $_instance |
|
16 | - * @access private |
|
17 | - */ |
|
14 | + * EE_Registry Object |
|
15 | + * @var EE_Registry $_instance |
|
16 | + * @access private |
|
17 | + */ |
|
18 | 18 | private static $_instance = NULL; |
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
22 | - * EE_Cart Object |
|
23 | - * @access public |
|
24 | - * @var EE_Cart $CART |
|
25 | - */ |
|
22 | + * EE_Cart Object |
|
23 | + * @access public |
|
24 | + * @var EE_Cart $CART |
|
25 | + */ |
|
26 | 26 | public $CART = NULL; |
27 | 27 | |
28 | 28 | /** |
29 | - * EE_Config Object |
|
30 | - * @access public |
|
31 | - * @var EE_Config $CFG |
|
32 | - */ |
|
29 | + * EE_Config Object |
|
30 | + * @access public |
|
31 | + * @var EE_Config $CFG |
|
32 | + */ |
|
33 | 33 | public $CFG = NULL; |
34 | 34 | |
35 | 35 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | /** |
47 | - * StdClass object for storing library classes in |
|
48 | - * @public LIB |
|
49 | - */ |
|
47 | + * StdClass object for storing library classes in |
|
48 | + * @public LIB |
|
49 | + */ |
|
50 | 50 | public $LIB = NULL; |
51 | 51 | |
52 | 52 | /** |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public $REQ = NULL; |
58 | 58 | |
59 | 59 | /** |
60 | - * EE_Session Object |
|
61 | - * @access public |
|
62 | - * @var EE_Session $SSN |
|
63 | - */ |
|
60 | + * EE_Session Object |
|
61 | + * @access public |
|
62 | + * @var EE_Session $SSN |
|
63 | + */ |
|
64 | 64 | public $SSN = NULL; |
65 | 65 | |
66 | 66 | |
@@ -127,21 +127,21 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | /** |
130 | - * $i18n_js_strings - internationalization for JS strings |
|
131 | - * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | - * in js file: var translatedString = eei18n.string_key; |
|
133 | - * |
|
134 | - * @access public |
|
135 | - * @var array |
|
136 | - */ |
|
130 | + * $i18n_js_strings - internationalization for JS strings |
|
131 | + * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | + * in js file: var translatedString = eei18n.string_key; |
|
133 | + * |
|
134 | + * @access public |
|
135 | + * @var array |
|
136 | + */ |
|
137 | 137 | public static $i18n_js_strings = array(); |
138 | 138 | |
139 | 139 | /** |
140 | - * $main_file - path to espresso.php |
|
141 | - * |
|
142 | - * @access public |
|
143 | - * @var array |
|
144 | - */ |
|
140 | + * $main_file - path to espresso.php |
|
141 | + * |
|
142 | + * @access public |
|
143 | + * @var array |
|
144 | + */ |
|
145 | 145 | public $main_file; |
146 | 146 | |
147 | 147 |
@@ -219,6 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | /** |
221 | 221 | * @param mixed string | EED_Module $module |
222 | + * @param string $module |
|
222 | 223 | */ |
223 | 224 | public function add_module( $module ) { |
224 | 225 | if ( $module instanceof EED_Module ) { |
@@ -250,7 +251,7 @@ discard block |
||
250 | 251 | * @param string $class_name - simple class name ie: session |
251 | 252 | * @param mixed $arguments |
252 | 253 | * @param bool $load_only |
253 | - * @return mixed |
|
254 | + * @return boolean |
|
254 | 255 | */ |
255 | 256 | public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
256 | 257 | $core_paths = apply_filters( |
@@ -274,7 +275,7 @@ discard block |
||
274 | 275 | * @access public |
275 | 276 | * @param string $class_name - class name for the DMS ie: EE_DMS_Core_4_2_0 |
276 | 277 | * @param mixed $arguments |
277 | - * @return EE_Data_Migration_Script_Base |
|
278 | + * @return boolean |
|
278 | 279 | */ |
279 | 280 | public function load_dms ( $class_name, $arguments = array() ) { |
280 | 281 | // retrieve instantiated class |
@@ -291,7 +292,7 @@ discard block |
||
291 | 292 | * @param bool $from_db - some classes are instantiated from the db and thus call a different method to instantiate |
292 | 293 | * @param bool $cache if you don't want the class to be stored in the internal cache (non-persistent) then set this to FALSE (ie. when instantiating model objects from client in a loop) |
293 | 294 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
294 | - * @return EE_Base_Class |
|
295 | + * @return boolean |
|
295 | 296 | */ |
296 | 297 | public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
297 | 298 | $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
@@ -312,7 +313,7 @@ discard block |
||
312 | 313 | * @param string $class_name - simple class name ie: price |
313 | 314 | * @param mixed $arguments |
314 | 315 | * @param bool $load_only |
315 | - * @return EEH_Base |
|
316 | + * @return boolean |
|
316 | 317 | */ |
317 | 318 | public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
318 | 319 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
@@ -330,7 +331,7 @@ discard block |
||
330 | 331 | * @param string $class_name - simple class name ie: session |
331 | 332 | * @param mixed $arguments |
332 | 333 | * @param bool $load_only |
333 | - * @return mixed |
|
334 | + * @return boolean |
|
334 | 335 | */ |
335 | 336 | public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
336 | 337 | $paths = array( |
@@ -352,7 +353,7 @@ discard block |
||
352 | 353 | * @param string $class_name - simple class name ie: price |
353 | 354 | * @param mixed $arguments |
354 | 355 | * @param bool $load_only |
355 | - * @return EEM_Base |
|
356 | + * @return boolean |
|
356 | 357 | */ |
357 | 358 | public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
358 | 359 | $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
@@ -371,7 +372,7 @@ discard block |
||
371 | 372 | * @param string $class_name - simple class name ie: price |
372 | 373 | * @param mixed $arguments |
373 | 374 | * @param bool $load_only |
374 | - * @return mixed |
|
375 | + * @return boolean |
|
375 | 376 | */ |
376 | 377 | public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
377 | 378 | $paths = array( |
@@ -407,7 +408,7 @@ discard block |
||
407 | 408 | * @param string $type - file type - core? class? helper? model? |
408 | 409 | * @param mixed $arguments |
409 | 410 | * @param bool $load_only |
410 | - * @return mixed |
|
411 | + * @return boolean |
|
411 | 412 | */ |
412 | 413 | public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
413 | 414 | // retrieve instantiated class |
@@ -424,7 +425,7 @@ discard block |
||
424 | 425 | * @param string $type - file type - core? class? helper? model? |
425 | 426 | * @param mixed $arguments |
426 | 427 | * @param bool $load_only |
427 | - * @return EE_Addon |
|
428 | + * @return boolean |
|
428 | 429 | */ |
429 | 430 | public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
430 | 431 | // retrieve instantiated class |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function instance() { |
158 | 158 | // check if class object is instantiated |
159 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) { |
|
159 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) { |
|
160 | 160 | self::$_instance = new self(); |
161 | 161 | } |
162 | 162 | return self::$_instance; |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | * @return EE_Registry |
172 | 172 | */ |
173 | 173 | private function __construct() { |
174 | - $this->load_core( 'Base' ); |
|
174 | + $this->load_core('Base'); |
|
175 | 175 | // class library |
176 | 176 | $this->LIB = new StdClass(); |
177 | 177 | $this->addons = new StdClass(); |
178 | 178 | $this->modules = new StdClass(); |
179 | 179 | $this->shortcodes = new StdClass(); |
180 | 180 | $this->widgets = new StdClass(); |
181 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' )); |
|
181 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function init() { |
193 | 193 | // Get current page protocol |
194 | - $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
|
194 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
195 | 195 | // Output admin-ajax.php URL with same protocol as current page |
196 | - self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol ); |
|
197 | - self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE; |
|
196 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
197 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @return string |
206 | 206 | */ |
207 | 207 | public static function localize_i18n_js_strings() { |
208 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
209 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
210 | - if ( is_scalar( $value ) ) { |
|
211 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
208 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
209 | + foreach ($i18n_js_strings as $key => $value) { |
|
210 | + if (is_scalar($value)) { |
|
211 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
215 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param mixed string | EED_Module $module |
222 | 222 | */ |
223 | - public function add_module( $module ) { |
|
224 | - if ( $module instanceof EED_Module ) { |
|
225 | - $module_class = get_class( $module ); |
|
223 | + public function add_module($module) { |
|
224 | + if ($module instanceof EED_Module) { |
|
225 | + $module_class = get_class($module); |
|
226 | 226 | $this->modules->{$module_class} = $module; |
227 | 227 | } else { |
228 | - if ( ! class_exists( 'EE_Module_Request_Router' )) { |
|
229 | - $this->load_core( 'Module_Request_Router' ); |
|
228 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
229 | + $this->load_core('Module_Request_Router'); |
|
230 | 230 | } |
231 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
231 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @param string $module_name |
239 | 239 | * @return mixed EED_Module | NULL |
240 | 240 | */ |
241 | - public function get_module( $module_name = '' ) { |
|
242 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
241 | + public function get_module($module_name = '') { |
|
242 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -252,18 +252,18 @@ discard block |
||
252 | 252 | * @param bool $load_only |
253 | 253 | * @return mixed |
254 | 254 | */ |
255 | - public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
255 | + public function load_core($class_name, $arguments = array(), $load_only = FALSE) { |
|
256 | 256 | $core_paths = apply_filters( |
257 | 257 | 'FHEE__EE_Registry__load_core__core_paths', |
258 | 258 | array( |
259 | 259 | EE_CORE, |
260 | 260 | EE_ADMIN, |
261 | 261 | EE_CPTS, |
262 | - EE_CORE . 'data_migration_scripts' . DS |
|
262 | + EE_CORE.'data_migration_scripts'.DS |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | // retrieve instantiated class |
266 | - return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only ); |
|
266 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param mixed $arguments |
277 | 277 | * @return EE_Data_Migration_Script_Base |
278 | 278 | */ |
279 | - public function load_dms ( $class_name, $arguments = array() ) { |
|
279 | + public function load_dms($class_name, $arguments = array()) { |
|
280 | 280 | // retrieve instantiated class |
281 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE ); |
|
281 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
294 | 294 | * @return EE_Base_Class |
295 | 295 | */ |
296 | - public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
297 | - $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
|
296 | + public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
297 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
298 | 298 | EE_CORE, |
299 | 299 | EE_CLASSES, |
300 | 300 | EE_BUSINESS |
301 | 301 | )); |
302 | 302 | // retrieve instantiated class |
303 | - return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
303 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * @param bool $load_only |
315 | 315 | * @return EEH_Base |
316 | 316 | */ |
317 | - public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
317 | + public function load_helper($class_name, $arguments = array(), $load_only = TRUE) { |
|
318 | 318 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
319 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) ); |
|
319 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
320 | 320 | // retrieve instantiated class |
321 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only ); |
|
321 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | * @param bool $load_only |
333 | 333 | * @return mixed |
334 | 334 | */ |
335 | - public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
335 | + public function load_lib($class_name, $arguments = array(), $load_only = FALSE) { |
|
336 | 336 | $paths = array( |
337 | 337 | EE_LIBRARIES, |
338 | - EE_LIBRARIES . 'messages' . DS, |
|
339 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
340 | - EE_LIBRARIES . 'qtips' . DS, |
|
341 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
338 | + EE_LIBRARIES.'messages'.DS, |
|
339 | + EE_LIBRARIES.'shortcodes'.DS, |
|
340 | + EE_LIBRARIES.'qtips'.DS, |
|
341 | + EE_LIBRARIES.'payment_methods'.DS, |
|
342 | 342 | ); |
343 | 343 | // retrieve instantiated class |
344 | - return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only ); |
|
344 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | * @param bool $load_only |
355 | 355 | * @return EEM_Base |
356 | 356 | */ |
357 | - public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
358 | - $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
|
357 | + public function load_model($class_name, $arguments = array(), $load_only = FALSE) { |
|
358 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
359 | 359 | EE_MODELS, |
360 | 360 | EE_CORE |
361 | 361 | )); |
362 | 362 | // retrieve instantiated class |
363 | - return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only ); |
|
363 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | * @param bool $load_only |
374 | 374 | * @return mixed |
375 | 375 | */ |
376 | - public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
376 | + public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) { |
|
377 | 377 | $paths = array( |
378 | - EE_MODELS . 'fields' . DS, |
|
379 | - EE_MODELS . 'helpers' . DS, |
|
380 | - EE_MODELS . 'relations' . DS, |
|
381 | - EE_MODELS . 'strategies' . DS |
|
378 | + EE_MODELS.'fields'.DS, |
|
379 | + EE_MODELS.'helpers'.DS, |
|
380 | + EE_MODELS.'relations'.DS, |
|
381 | + EE_MODELS.'strategies'.DS |
|
382 | 382 | ); |
383 | 383 | // retrieve instantiated class |
384 | - return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only ); |
|
384 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
394 | 394 | * @return boolean |
395 | 395 | */ |
396 | - public function is_model_name( $model_name ){ |
|
397 | - return isset( $this->models[ $model_name ] ) ? TRUE : FALSE; |
|
396 | + public function is_model_name($model_name) { |
|
397 | + return isset($this->models[$model_name]) ? TRUE : FALSE; |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * @param bool $load_only |
410 | 410 | * @return mixed |
411 | 411 | */ |
412 | - public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
|
412 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) { |
|
413 | 413 | // retrieve instantiated class |
414 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
414 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | * @param bool $load_only |
427 | 427 | * @return EE_Addon |
428 | 428 | */ |
429 | - public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
|
429 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) { |
|
430 | 430 | // retrieve instantiated class |
431 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
431 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
@@ -446,15 +446,15 @@ discard block |
||
446 | 446 | * @internal param string $file_path - file path including file name |
447 | 447 | * @return bool | object |
448 | 448 | */ |
449 | - private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
449 | + private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
450 | 450 | // strip php file extension |
451 | - $class_name = str_replace( '.php', '', trim( $class_name )); |
|
451 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
452 | 452 | // does the class have a prefix ? |
453 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
453 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
454 | 454 | // make sure $class_prefix is uppercase |
455 | - $class_prefix = strtoupper( trim( $class_prefix )); |
|
455 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
456 | 456 | // add class prefix ONCE!!! |
457 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
457 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | $class_abbreviations = array( |
@@ -466,61 +466,61 @@ discard block |
||
466 | 466 | 'EE_Capabilities' => 'CAP' |
467 | 467 | ); |
468 | 468 | |
469 | - $class_abbreviation = isset( $class_abbreviations[ $class_name ] ) |
|
470 | - ? $class_abbreviations[ $class_name ] |
|
469 | + $class_abbreviation = isset($class_abbreviations[$class_name]) |
|
470 | + ? $class_abbreviations[$class_name] |
|
471 | 471 | : ''; |
472 | 472 | // check if class has already been loaded, and return it if it has been |
473 | - if ( $class_abbreviation !== '' && ! is_null( $this->{$class_abbreviation} ) |
|
473 | + if ($class_abbreviation !== '' && ! is_null($this->{$class_abbreviation} ) |
|
474 | 474 | ) { |
475 | 475 | return $this->{$class_abbreviation}; |
476 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
476 | + } else if (isset ($this->{$class_name} )) { |
|
477 | 477 | return $this->{$class_name}; |
478 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
478 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
479 | 479 | return $this->LIB->{$class_name}; |
480 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
480 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
481 | 481 | return $this->addons->{$class_name}; |
482 | 482 | } |
483 | 483 | |
484 | 484 | // assume all paths lead nowhere |
485 | 485 | $path = FALSE; |
486 | 486 | // make sure $file_paths is an array |
487 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
487 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
488 | 488 | // cycle thru paths |
489 | - foreach ( $file_paths as $key => $file_path ) { |
|
489 | + foreach ($file_paths as $key => $file_path) { |
|
490 | 490 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
491 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
491 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
492 | 492 | // prep file type |
493 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
493 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
494 | 494 | // build full file path |
495 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
495 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
496 | 496 | //does the file exist and can be read ? |
497 | - if ( is_readable( $file_paths[ $key ] )) { |
|
498 | - $path = $file_paths[ $key ]; |
|
497 | + if (is_readable($file_paths[$key])) { |
|
498 | + $path = $file_paths[$key]; |
|
499 | 499 | break; |
500 | 500 | } |
501 | 501 | } |
502 | 502 | // don't give up! you gotta... |
503 | 503 | try { |
504 | 504 | //does the file exist and can it be read ? |
505 | - if ( ! $path ) { |
|
505 | + if ( ! $path) { |
|
506 | 506 | // so sorry, can't find the file |
507 | - throw new EE_Error ( |
|
508 | - sprintf ( |
|
509 | - __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s','event_espresso'), |
|
510 | - trim( $type, '.' ), |
|
507 | + throw new EE_Error( |
|
508 | + sprintf( |
|
509 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
510 | + trim($type, '.'), |
|
511 | 511 | $class_name, |
512 | - '<br />' . implode( ',<br />', $file_paths ) |
|
512 | + '<br />'.implode(',<br />', $file_paths) |
|
513 | 513 | ) |
514 | 514 | ); |
515 | 515 | } |
516 | 516 | // get the file |
517 | - require_once( $path ); |
|
517 | + require_once($path); |
|
518 | 518 | // if the class isn't already declared somewhere |
519 | - if ( class_exists( $class_name, FALSE ) === FALSE ) { |
|
519 | + if (class_exists($class_name, FALSE) === FALSE) { |
|
520 | 520 | // so sorry, not a class |
521 | 521 | throw new EE_Error( |
522 | 522 | sprintf( |
523 | - __('The %s file %s does not appear to contain the %s Class.','event_espresso'), |
|
523 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
524 | 524 | $type, |
525 | 525 | $path, |
526 | 526 | $class_name |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | ); |
529 | 529 | } |
530 | 530 | |
531 | - } catch ( EE_Error $e ) { |
|
531 | + } catch (EE_Error $e) { |
|
532 | 532 | $e->get_error(); |
533 | 533 | } |
534 | 534 | |
@@ -536,38 +536,38 @@ discard block |
||
536 | 536 | // don't give up! you gotta... |
537 | 537 | try { |
538 | 538 | // create reflection |
539 | - $reflector = new ReflectionClass( $class_name ); |
|
539 | + $reflector = new ReflectionClass($class_name); |
|
540 | 540 | // instantiate the class and add to the LIB array for tracking |
541 | 541 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
542 | - if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) { |
|
542 | + if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) { |
|
543 | 543 | // $instantiation_mode = 0; |
544 | 544 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
545 | 545 | return TRUE; |
546 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
546 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
547 | 547 | // $instantiation_mode = 1; |
548 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
549 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
548 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
549 | + } else if (method_exists($class_name, 'new_instance')) { |
|
550 | 550 | // $instantiation_mode = 2; |
551 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
552 | - } else if ( method_exists( $class_name, 'instance' )) { |
|
551 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
552 | + } else if (method_exists($class_name, 'instance')) { |
|
553 | 553 | // $instantiation_mode = 3; |
554 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
555 | - } else if ( $reflector->isInstantiable() ) { |
|
554 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
555 | + } else if ($reflector->isInstantiable()) { |
|
556 | 556 | // $instantiation_mode = 4; |
557 | - $class_obj = $reflector->newInstance( $arguments ); |
|
558 | - } else if ( ! $load_only ) { |
|
557 | + $class_obj = $reflector->newInstance($arguments); |
|
558 | + } else if ( ! $load_only) { |
|
559 | 559 | // heh ? something's not right ! |
560 | 560 | // $instantiation_mode = 5; |
561 | 561 | throw new EE_Error( |
562 | 562 | sprintf( |
563 | - __('The %s file %s could not be instantiated.','event_espresso'), |
|
563 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
564 | 564 | $type, |
565 | 565 | $class_name |
566 | 566 | ) |
567 | 567 | ); |
568 | 568 | } |
569 | 569 | |
570 | - } catch ( EE_Error $e ) { |
|
570 | + } catch (EE_Error $e) { |
|
571 | 571 | $e->get_error(); |
572 | 572 | } |
573 | 573 | |
@@ -579,15 +579,15 @@ discard block |
||
579 | 579 | // EEH_Debug_Tools::printr( $class_obj, '$class_obj <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
580 | 580 | |
581 | 581 | |
582 | - if ( isset( $class_obj )) { |
|
582 | + if (isset($class_obj)) { |
|
583 | 583 | // return newly instantiated class |
584 | - if ( $class_abbreviation !== '' ) { |
|
584 | + if ($class_abbreviation !== '') { |
|
585 | 585 | $this->{$class_abbreviation} = $class_obj; |
586 | - } else if ( EEH_Class_Tools::has_property( $this, $class_name )) { |
|
586 | + } else if (EEH_Class_Tools::has_property($this, $class_name)) { |
|
587 | 587 | $this->{$class_name} = $class_obj; |
588 | - } else if ( $class_prefix == 'addon' && $cache ) { |
|
588 | + } else if ($class_prefix == 'addon' && $cache) { |
|
589 | 589 | $this->addons->{$class_name} = $class_obj; |
590 | - } else if ( !$from_db && $cache ) { |
|
590 | + } else if ( ! $from_db && $cache) { |
|
591 | 591 | $this->LIB->{$class_name} = $class_obj; |
592 | 592 | } |
593 | 593 | return $class_obj; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param $a |
612 | 612 | * @param $b |
613 | 613 | */ |
614 | - final function __call($a,$b) {} |
|
614 | + final function __call($a, $b) {} |
|
615 | 615 | |
616 | 616 | |
617 | 617 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @param $a |
627 | 627 | * @param $b |
628 | 628 | */ |
629 | - final function __set($a,$b) {} |
|
629 | + final function __set($a, $b) {} |
|
630 | 630 | |
631 | 631 | |
632 | 632 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | * @param $a |
667 | 667 | * @param $b |
668 | 668 | */ |
669 | - final static function __callStatic($a,$b) {} |
|
669 | + final static function __callStatic($a, $b) {} |
|
670 | 670 | |
671 | 671 | /** |
672 | 672 | * Gets the addon by its name/slug (not classname. For that, just |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | * @param string $name |
675 | 675 | * @return EE_Addon |
676 | 676 | */ |
677 | - public function get_addon_by_name( $name ){ |
|
678 | - foreach($this->addons as $addon){ |
|
679 | - if( $addon->name() == $name){ |
|
677 | + public function get_addon_by_name($name) { |
|
678 | + foreach ($this->addons as $addon) { |
|
679 | + if ($addon->name() == $name) { |
|
680 | 680 | return $addon; |
681 | 681 | } |
682 | 682 | } |
@@ -687,10 +687,10 @@ discard block |
||
687 | 687 | * |
688 | 688 | * @return EE_Addon[] where the KEYS are the addon's name() |
689 | 689 | */ |
690 | - public function get_addons_by_name(){ |
|
690 | + public function get_addons_by_name() { |
|
691 | 691 | $addons = array(); |
692 | - foreach($this->addons as $addon){ |
|
693 | - $addons[ $addon->name() ] = $addon; |
|
692 | + foreach ($this->addons as $addon) { |
|
693 | + $addons[$addon->name()] = $addon; |
|
694 | 694 | } |
695 | 695 | return $addons; |
696 | 696 | } |
@@ -705,14 +705,14 @@ discard block |
||
705 | 705 | * @return EEM_Base |
706 | 706 | * @throws EE_Error |
707 | 707 | */ |
708 | - public function reset_model( $model_name ){ |
|
709 | - $model = $this->load_model( $model_name ); |
|
710 | - $model_class_name = get_class( $model ); |
|
708 | + public function reset_model($model_name) { |
|
709 | + $model = $this->load_model($model_name); |
|
710 | + $model_class_name = get_class($model); |
|
711 | 711 | //get that model reset it and make sure we nuke the old reference to it |
712 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
712 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
713 | 713 | $this->LIB->{$model_class_name} = $model::reset(); |
714 | - }else{ |
|
715 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
714 | + } else { |
|
715 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
716 | 716 | } |
717 | 717 | return $this->LIB->{$model_class_name}; |
718 | 718 | } |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | * currently reinstantiate the singletons at the moment) |
729 | 729 | * @return EE_Registry |
730 | 730 | */ |
731 | - public static function reset( $hard = FALSE, $reinstantiate = TRUE ){ |
|
731 | + public static function reset($hard = FALSE, $reinstantiate = TRUE) { |
|
732 | 732 | $instance = self::instance(); |
733 | 733 | EEH_Activation::reset(); |
734 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
734 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
735 | 735 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
736 | 736 | $instance->LIB = new stdClass(); |
737 | - foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){ |
|
738 | - $instance->reset_model( $model_name ); |
|
737 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
738 | + $instance->reset_model($model_name); |
|
739 | 739 | } |
740 | 740 | return $instance; |
741 | 741 | } |
@@ -746,9 +746,9 @@ discard block |
||
746 | 746 | */ |
747 | 747 | public function cpt_models() { |
748 | 748 | $cpt_models = array(); |
749 | - foreach( $this->non_abstract_db_models as $shortname => $classname ) { |
|
750 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
751 | - $cpt_models[ $shortname ] = $classname; |
|
749 | + foreach ($this->non_abstract_db_models as $shortname => $classname) { |
|
750 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
751 | + $cpt_models[$shortname] = $classname; |
|
752 | 752 | } |
753 | 753 | } |
754 | 754 | return $cpt_models; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function column_TXN_ID( EE_Transaction $item ){ |
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | 144 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
145 | 145 | |
146 | 146 | //txn timestamp |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | * @param \EE_Transaction $item |
284 | 284 | * @return string|void |
285 | 285 | */ |
286 | - function column_event_name( EE_Transaction $item ){ |
|
287 | - $actions = array(); |
|
286 | + function column_event_name( EE_Transaction $item ){ |
|
287 | + $actions = array(); |
|
288 | 288 | $event = $item->primary_registration()->get_first_related('Event'); |
289 | 289 | if ( !empty( $event ) ) { |
290 | 290 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | * @param \EE_Transaction $item |
309 | 309 | * @return string |
310 | 310 | */ |
311 | - function column_actions( EE_Transaction $item ){ |
|
311 | + function column_actions( EE_Transaction $item ){ |
|
312 | 312 | |
313 | - $registration = $item->primary_registration(); |
|
314 | - $attendee = $registration->attendee(); |
|
313 | + $registration = $item->primary_registration(); |
|
314 | + $attendee = $registration->attendee(); |
|
315 | 315 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
316 | 316 | |
317 | - //Build row actions |
|
317 | + //Build row actions |
|
318 | 318 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
319 | 319 | $dl_invoice_lnk_url = $registration->invoice_url(); |
320 | 320 | $dl_receipt_lnk_url = $registration->receipt_url(); |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | $dl_receipt_lnk = ''; |
355 | 355 | } |
356 | 356 | |
357 | - //only show payment reminder link if the message type is active. |
|
358 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
357 | + //only show payment reminder link if the message type is active. |
|
358 | + if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
359 | 359 | $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
360 | 360 | <li> |
361 | 361 | <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | </li>' : ''; |
376 | 376 | |
377 | 377 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | 380 | |
381 | 381 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param \EE_Admin_Page $admin_page |
34 | 34 | * @return EE_Admin_Transactions_List_Table |
35 | 35 | */ |
36 | - function __construct( EE_Admin_Page $admin_page ){ |
|
37 | - parent::__construct( $admin_page ); |
|
36 | + function __construct(EE_Admin_Page $admin_page) { |
|
37 | + parent::__construct($admin_page); |
|
38 | 38 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
39 | 39 | |
40 | 40 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | protected function _setup_data() { |
47 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
48 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
49 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
47 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
48 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
49 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_columns = array( |
68 | - 'TXN_ID' => __( 'ID', 'event_espresso' ), |
|
69 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
70 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
71 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
72 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
73 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
74 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_ID' => __('ID', 'event_espresso'), |
|
69 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
70 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
71 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
72 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
73 | + 'event_name' => __('Event', 'event_espresso'), |
|
74 | + 'actions' => __('Actions', 'event_espresso') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | $this->_sortable_columns = array( |
78 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
79 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
80 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
81 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
78 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
79 | + 'event_name' => array('event_name'=> FALSE), |
|
80 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
81 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | $this->_primary_column = 'TXN_ID'; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | - protected function _get_row_class( $item ) { |
|
92 | - $class = parent::_get_row_class( $item ); |
|
91 | + protected function _get_row_class($item) { |
|
92 | + $class = parent::_get_row_class($item); |
|
93 | 93 | //add status class |
94 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
95 | - if ( $this->_has_checkbox_column ) { |
|
94 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
95 | + if ($this->_has_checkbox_column) { |
|
96 | 96 | $class .= ' has-checkbox-column'; |
97 | 97 | } |
98 | 98 | return $class; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function _get_table_filters() { |
111 | 111 | $filters = array(); |
112 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
113 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
112 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
113 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
114 | 114 | ob_start(); |
115 | 115 | ?> |
116 | 116 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | |
130 | 130 | protected function _add_view_counts() { |
131 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
132 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
133 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
131 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
132 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
133 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | * @param \EE_Transaction $item |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - function column_TXN_ID( EE_Transaction $item ){ |
|
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
142 | + function column_TXN_ID(EE_Transaction $item) { |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
144 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
145 | 145 | |
146 | 146 | //txn timestamp |
147 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
147 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
148 | 148 | return $content; |
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
153 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
154 | 154 | //txn timestamp |
155 | 155 | // is TXN less than 2 hours old ? |
156 | 156 | if ( |
157 | - ( ( time() - EE_Registry::instance()->SSN->lifespan() ) |
|
158 | - < $item->datetime( false, true ) |
|
157 | + ((time() - EE_Registry::instance()->SSN->lifespan()) |
|
158 | + < $item->datetime(false, true) |
|
159 | 159 | ) |
160 | - && ( $item->failed() || $item->is_abandoned() ) |
|
160 | + && ($item->failed() || $item->is_abandoned()) |
|
161 | 161 | ) { |
162 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
162 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
163 | 163 | } else { |
164 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
164 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
165 | 165 | } |
166 | 166 | return $timestamp; |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param \EE_Transaction $item |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - function column_cb($item ){ |
|
177 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
176 | + function column_cb($item) { |
|
177 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param \EE_Transaction $item |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - function column_TXN_timestamp( EE_Transaction $item ){ |
|
189 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
190 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
188 | + function column_TXN_timestamp(EE_Transaction $item) { |
|
189 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
190 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
191 | 191 | //status |
192 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
192 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
193 | 193 | return $txn_date; |
194 | 194 | } |
195 | 195 | |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @param \EE_Transaction $item |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - function column_TXN_total( EE_Transaction $item ){ |
|
203 | - if ( $item->get('TXN_total') > 0 ) { |
|
204 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
202 | + function column_TXN_total(EE_Transaction $item) { |
|
203 | + if ($item->get('TXN_total') > 0) { |
|
204 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
205 | 205 | } else { |
206 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
206 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | * @param \EE_Transaction $item |
214 | 214 | * @return mixed|string |
215 | 215 | */ |
216 | - function column_TXN_paid( EE_Transaction $item ){ |
|
216 | + function column_TXN_paid(EE_Transaction $item) { |
|
217 | 217 | $transaction_total = $item->get('TXN_total'); |
218 | 218 | $transaction_paid = $item->get('TXN_paid'); |
219 | 219 | |
220 | - if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) { |
|
220 | + if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) { |
|
221 | 221 | // paid in full |
222 | 222 | $span_class = 'txn-overview-full-payment-spn'; |
223 | 223 | |
224 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) { |
|
224 | + } elseif (($transaction_total > 0) && ($transaction_paid > 0)) { |
|
225 | 225 | // monies owing |
226 | 226 | $span_class = 'txn-overview-part-payment-spn'; |
227 | 227 | |
228 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) { |
|
228 | + } elseif (($transaction_total > 0) && ($transaction_paid == 0)) { |
|
229 | 229 | // no payments made |
230 | 230 | $span_class = 'txn-overview-no-payment-spn'; |
231 | 231 | |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | $payment_method = $item->payment_method(); |
238 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
238 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
239 | 239 | |
240 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
241 | - if ( $transaction_paid > 0 ) { |
|
242 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
240 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
241 | + if ($transaction_paid > 0) { |
|
242 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
243 | 243 | } |
244 | 244 | return $content; |
245 | 245 | } |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | * @param \EE_Transaction $item |
251 | 251 | * @return string|void |
252 | 252 | */ |
253 | - function column_ATT_fname( EE_Transaction $item ){ |
|
253 | + function column_ATT_fname(EE_Transaction $item) { |
|
254 | 254 | $primary_reg = $item->primary_registration(); |
255 | 255 | $attendee = $primary_reg->get_first_related('Attendee'); |
256 | - if ( $attendee instanceof EE_Attendee ) { |
|
257 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
258 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
259 | - $content .= '<br>' . $attendee->email(); |
|
256 | + if ($attendee instanceof EE_Attendee) { |
|
257 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
258 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
259 | + $content .= '<br>'.$attendee->email(); |
|
260 | 260 | return $content; |
261 | 261 | } |
262 | 262 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * @param \EE_Transaction $item |
269 | 269 | * @return string|void |
270 | 270 | */ |
271 | - function column_ATT_email( EE_Transaction $item ){ |
|
271 | + function column_ATT_email(EE_Transaction $item) { |
|
272 | 272 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
273 | - if ( !empty( $attendee ) ) |
|
274 | - return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
273 | + if ( ! empty($attendee)) |
|
274 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
275 | 275 | else |
276 | 276 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
277 | 277 | ; |
@@ -283,20 +283,20 @@ discard block |
||
283 | 283 | * @param \EE_Transaction $item |
284 | 284 | * @return string|void |
285 | 285 | */ |
286 | - function column_event_name( EE_Transaction $item ){ |
|
286 | + function column_event_name(EE_Transaction $item) { |
|
287 | 287 | $actions = array(); |
288 | 288 | $event = $item->primary_registration()->get_first_related('Event'); |
289 | - if ( !empty( $event ) ) { |
|
290 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
289 | + if ( ! empty($event)) { |
|
290 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
291 | 291 | $event_name = $event->get('EVT_name'); |
292 | 292 | |
293 | 293 | //filter this view by transactions for this event |
294 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
295 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
296 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
294 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
295 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
296 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
297 | 297 | } |
298 | 298 | |
299 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
299 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
300 | 300 | } else { |
301 | 301 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
302 | 302 | } |
@@ -308,32 +308,32 @@ discard block |
||
308 | 308 | * @param \EE_Transaction $item |
309 | 309 | * @return string |
310 | 310 | */ |
311 | - function column_actions( EE_Transaction $item ){ |
|
311 | + function column_actions(EE_Transaction $item) { |
|
312 | 312 | |
313 | 313 | $registration = $item->primary_registration(); |
314 | 314 | $attendee = $registration->attendee(); |
315 | 315 | |
316 | 316 | //Build row actions |
317 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
317 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
318 | 318 | $dl_invoice_lnk_url = $registration->invoice_url(); |
319 | 319 | $dl_receipt_lnk_url = $registration->receipt_url(); |
320 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
321 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
320 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
321 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
322 | 322 | |
323 | 323 | //Build row actions |
324 | 324 | $view_lnk = ' |
325 | 325 | <li> |
326 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
326 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
327 | 327 | <span class="dashicons dashicons-cart"></span> |
328 | 328 | </a> |
329 | 329 | </li>'; |
330 | 330 | |
331 | 331 | |
332 | 332 | //only show invoice link if message type is active. |
333 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
333 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
334 | 334 | $dl_invoice_lnk = ' |
335 | 335 | <li> |
336 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
336 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
337 | 337 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
338 | 338 | </a> |
339 | 339 | </li>'; |
@@ -342,10 +342,10 @@ discard block |
||
342 | 342 | } |
343 | 343 | |
344 | 344 | //only show receipt link if message type is active. |
345 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
345 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
346 | 346 | $dl_receipt_lnk = ' |
347 | 347 | <li> |
348 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
348 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
349 | 349 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
350 | 350 | </a> |
351 | 351 | </li>'; |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | } |
355 | 355 | |
356 | 356 | //only show payment reminder link if the message type is active. |
357 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
358 | - $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
|
357 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
358 | + $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? ' |
|
359 | 359 | <li> |
360 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
360 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
361 | 361 | <span class="dashicons dashicons-email-alt"></span> |
362 | 362 | </a> |
363 | 363 | </li>' : ''; |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | $send_pay_lnk = ''; |
367 | 367 | } |
368 | 368 | |
369 | - $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
369 | + $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
370 | 370 | <li> |
371 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
371 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
372 | 372 | <span class="dashicons dashicons-clipboard"></span> |
373 | 373 | </a> |
374 | 374 | </li>' : ''; |
375 | 375 | |
376 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
376 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Event List |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /modules/feeds/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Event List |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /modules/feeds/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EED_Feeds extends EED_Module { |
25 | 25 | |
26 | 26 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Feeds |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 ); |
|
45 | - add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1 ); |
|
46 | - add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 ); |
|
47 | - add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 ); |
|
44 | + add_action('parse_request', array('EED_Feeds', 'parse_request'), 10); |
|
45 | + add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1); |
|
46 | + add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2); |
|
47 | + add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access public |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param type rss2, atom, rss, rdf, rssjs |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public static function default_feed( $type = 'rss2' ) { |
|
79 | + public static function default_feed($type = 'rss2') { |
|
80 | 80 | //rss2, atom, rss, rdf, rssjs |
81 | 81 | $type = 'rss2'; |
82 | 82 | return $type; |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | public static function parse_request() { |
95 | - if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) { |
|
95 | + if (EE_Registry::instance()->REQ->is_set('post_type')) { |
|
96 | 96 | // define path to templates |
97 | - define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
97 | + define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
98 | 98 | // what kinda post_type are we dealing with ? |
99 | - switch( EE_Registry::instance()->REQ->get( 'post_type' )) { |
|
99 | + switch (EE_Registry::instance()->REQ->get('post_type')) { |
|
100 | 100 | case 'espresso_events' : |
101 | 101 | // for rss2, atom, rss, rdf |
102 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
103 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
102 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
103 | + add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
104 | 104 | // for json ( also uses the above filter ) |
105 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 ); |
|
105 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1); |
|
106 | 106 | break; |
107 | 107 | case 'espresso_venues' : |
108 | 108 | // for rss2, atom, rss, rdf |
109 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
110 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
109 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
110 | + add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
111 | 111 | // for json ( also uses the above filter ) |
112 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 ); |
|
112 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1); |
|
113 | 113 | break; |
114 | 114 | } |
115 | 115 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public static function comment_feed_join( $SQL ) { |
|
130 | + public static function comment_feed_join($SQL) { |
|
131 | 131 | global $wpdb; |
132 | 132 | // check for wp_posts table in JOIN clause |
133 | - if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) { |
|
134 | - add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' ); |
|
133 | + if (strpos($SQL, $wpdb->posts) !== FALSE) { |
|
134 | + add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true'); |
|
135 | 135 | } |
136 | 136 | return $SQL; |
137 | 137 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public static function comment_feed_where( $SQL ) { |
|
151 | + public static function comment_feed_where($SQL) { |
|
152 | 152 | global $wp_query, $wpdb; |
153 | - if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) { |
|
153 | + if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) { |
|
154 | 154 | $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'"; |
155 | 155 | } |
156 | 156 | return $SQL; |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | * @param string $content |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function the_event_feed( $content ) { |
|
170 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
|
169 | + public static function the_event_feed($content) { |
|
170 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) { |
|
171 | 171 | global $post; |
172 | 172 | $template_args = array( |
173 | 173 | 'EVT_ID' => $post->ID, |
174 | 174 | 'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
175 | 175 | ); |
176 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE ); |
|
176 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE); |
|
177 | 177 | } |
178 | 178 | return $content; |
179 | 179 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | * @param object $item |
189 | 189 | * @return void |
190 | 190 | */ |
191 | - public static function the_event_rssjs_feed( $item ) { |
|
192 | - if ( is_feed() && isset( $item->description )) { |
|
193 | - $item->description = EED_Feeds::the_event_feed( $item->description ); |
|
191 | + public static function the_event_rssjs_feed($item) { |
|
192 | + if (is_feed() && isset($item->description)) { |
|
193 | + $item->description = EED_Feeds::the_event_feed($item->description); |
|
194 | 194 | } |
195 | 195 | return $item; |
196 | 196 | } |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @param string $content |
206 | 206 | * @return void |
207 | 207 | */ |
208 | - public static function the_venue_feed( $content ) { |
|
209 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
|
208 | + public static function the_venue_feed($content) { |
|
209 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) { |
|
210 | 210 | global $post; |
211 | 211 | $template_args = array( |
212 | 212 | 'VNU_ID' => $post->ID, |
213 | 213 | 'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
214 | 214 | ); |
215 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE ); |
|
215 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE); |
|
216 | 216 | } |
217 | 217 | return $content; |
218 | 218 | } |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * @param object $item |
228 | 228 | * @return void |
229 | 229 | */ |
230 | - public static function the_venue_rssjs_feed( $item ) { |
|
231 | - if ( is_feed() && isset( $item->description )) { |
|
232 | - $item->description = EED_Feeds::the_venue_feed( $item->description ); |
|
230 | + public static function the_venue_rssjs_feed($item) { |
|
231 | + if (is_feed() && isset($item->description)) { |
|
232 | + $item->description = EED_Feeds::the_venue_feed($item->description); |
|
233 | 233 | } |
234 | 234 | return $item; |
235 | 235 | } |
@@ -1,29 +1,29 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + */ |
|
16 | 16 | /** |
17 | - * ------------------------------------------------------------------------ |
|
18 | - * |
|
19 | - * Ticket Selector class |
|
20 | - * |
|
21 | - * @package Event Espresso |
|
22 | - * @subpackage includes/classes/EE_Ticket_Selector.class.php |
|
23 | - * @author Brent Christensen |
|
24 | - * |
|
25 | - * ------------------------------------------------------------------------ |
|
26 | - */ |
|
17 | + * ------------------------------------------------------------------------ |
|
18 | + * |
|
19 | + * Ticket Selector class |
|
20 | + * |
|
21 | + * @package Event Espresso |
|
22 | + * @subpackage includes/classes/EE_Ticket_Selector.class.php |
|
23 | + * @author Brent Christensen |
|
24 | + * |
|
25 | + * ------------------------------------------------------------------------ |
|
26 | + */ |
|
27 | 27 | class EED_Ticket_Selector extends EED_Module { |
28 | 28 | |
29 | 29 | /** |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | protected static $_event = NULL; |
36 | 36 | |
37 | 37 | /** |
38 | - * array of datetimes and the spaces available for them |
|
39 | - * |
|
40 | - * @access private |
|
41 | - * @var array |
|
42 | - */ |
|
38 | + * array of datetimes and the spaces available for them |
|
39 | + * |
|
40 | + * @access private |
|
41 | + * @var array |
|
42 | + */ |
|
43 | 43 | private static $_available_spaces = array(); |
44 | 44 | |
45 | 45 | |
@@ -900,11 +900,11 @@ discard block |
||
900 | 900 | |
901 | 901 | |
902 | 902 | /** |
903 | - * load js |
|
904 | - * |
|
905 | - * @access public |
|
906 | - * @return void |
|
907 | - */ |
|
903 | + * load js |
|
904 | + * |
|
905 | + * @access public |
|
906 | + * @return void |
|
907 | + */ |
|
908 | 908 | public static function load_tckt_slctr_assets() { |
909 | 909 | // add some style |
910 | 910 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return EED_Ticket_Selector |
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | - return parent::get_instance( __CLASS__ ); |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - protected function set_config(){ |
|
66 | - $this->set_config_section( 'template_settings' ); |
|
67 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
68 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
65 | + protected function set_config() { |
|
66 | + $this->set_config_section('template_settings'); |
|
67 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
68 | + $this->set_config_name('EED_Ticket_Selector'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function set_hooks() { |
82 | 82 | // routing |
83 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
84 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
85 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
83 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
84 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
85 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
86 | 86 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
87 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
87 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
88 | 88 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
89 | 89 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
90 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
90 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
102 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
103 | 103 | //add button for iframe code to event editor. |
104 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
105 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
104 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
105 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | public static function set_definitions() { |
117 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
118 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
117 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
119 | 119 | |
120 | 120 | //if config is not set, initialize |
121 | 121 | //If config is not set, set it. |
122 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
122 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
123 | 123 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
124 | 124 | } |
125 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
125 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param object $WP |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function run( $WP ) {} |
|
136 | + public function run($WP) {} |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | public function ticket_selector_iframe() { |
146 | 146 | self::$_in_iframe = true; |
147 | 147 | /** @type EEM_Event $EEM_Event */ |
148 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
148 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
149 | 149 | $event = $EEM_Event->get_one_by_ID( |
150 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
150 | + EE_Registry::instance()->REQ->get('event', 0) |
|
151 | 151 | ); |
152 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
153 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
152 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
153 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
154 | 154 | $template_args['css'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
156 | 156 | array( |
157 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
158 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
159 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
160 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
157 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
158 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
159 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
160 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
161 | 161 | ) |
162 | 162 | ); |
163 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
164 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
163 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
164 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
165 | 165 | $template_args['eei18n'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
167 | 167 | EE_Registry::localize_i18n_js_strings() |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | $template_args['js'] = apply_filters( |
170 | 170 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
171 | 171 | array( |
172 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
173 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
174 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
172 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
173 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
174 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
175 | 175 | ) |
176 | 176 | ); |
177 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
178 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
177 | + $template_args['notices'] = EEH_Template::display_template( |
|
178 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
179 | 179 | array(), |
180 | 180 | true |
181 | 181 | ); |
182 | 182 | EEH_Template::display_template( |
183 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
183 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
184 | 184 | $template_args |
185 | 185 | ); |
186 | 186 | exit; |
@@ -199,23 +199,23 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return string The new html string for the permalink area. |
201 | 201 | */ |
202 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
202 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
203 | 203 | //make sure this is ONLY when editing and the event id has been set. |
204 | - if ( ! empty( $id ) ) { |
|
205 | - $post = get_post( $id ); |
|
204 | + if ( ! empty($id)) { |
|
205 | + $post = get_post($id); |
|
206 | 206 | |
207 | 207 | //if NOT event then let's get out. |
208 | - if ( $post->post_type !== 'espresso_events' ) { |
|
208 | + if ($post->post_type !== 'espresso_events') { |
|
209 | 209 | return $permalink_string; |
210 | 210 | } |
211 | 211 | |
212 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
212 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
213 | 213 | |
214 | - $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' . __('Embed', 'event_espresso') . '</a> '; |
|
214 | + $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">'.__('Embed', 'event_espresso').'</a> '; |
|
215 | 215 | $permalink_string .= ' |
216 | 216 | <div id="js-ts-iframe" style="display:none"> |
217 | 217 | <div style="width:100%; height: 500px;"> |
218 | - <iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe> |
|
218 | + <iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe> |
|
219 | 219 | </div> |
220 | 220 | </div>'; |
221 | 221 | } |
@@ -234,22 +234,22 @@ discard block |
||
234 | 234 | * @param mixed $event |
235 | 235 | * @return bool |
236 | 236 | */ |
237 | - protected static function set_event( $event = null ) { |
|
238 | - if( $event === null ) { |
|
237 | + protected static function set_event($event = null) { |
|
238 | + if ($event === null) { |
|
239 | 239 | global $post; |
240 | 240 | $event = $post; |
241 | 241 | } |
242 | - if ( $event instanceof EE_Event ) { |
|
242 | + if ($event instanceof EE_Event) { |
|
243 | 243 | self::$_event = $event; |
244 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
244 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
245 | 245 | self::$_event = $event->EE_Event; |
246 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
247 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
246 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
247 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
248 | 248 | self::$_event = $event->EE_Event; |
249 | 249 | } else { |
250 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
251 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
252 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
250 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
251 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
252 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
253 | 253 | return false; |
254 | 254 | } |
255 | 255 | return true; |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | * @param bool $view_details |
269 | 269 | * @return string |
270 | 270 | */ |
271 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
271 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
272 | 272 | // reset filter for displaying submit button |
273 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
273 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
274 | 274 | // poke and prod incoming event till it tells us what it is |
275 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
275 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | && ( |
284 | 284 | ! self::$_event->display_ticket_selector() |
285 | 285 | || $view_details |
286 | - || post_password_required( $event_post ) |
|
286 | + || post_password_required($event_post) |
|
287 | 287 | || ( |
288 | 288 | $_event_active_status != EE_Datetime::active |
289 | 289 | && $_event_active_status != EE_Datetime::upcoming |
@@ -301,68 +301,68 @@ discard block |
||
301 | 301 | $template_args = array(); |
302 | 302 | $template_args['event_status'] = $_event_active_status; |
303 | 303 | |
304 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
305 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
304 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
305 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
306 | 306 | |
307 | 307 | $template_args['EVT_ID'] = self::$_event->ID(); |
308 | 308 | $template_args['event'] = self::$_event; |
309 | 309 | |
310 | 310 | // is the event expired ? |
311 | 311 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
312 | - if ( $template_args['event_is_expired'] ) { |
|
313 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
312 | + if ($template_args['event_is_expired']) { |
|
313 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | $ticket_query_args = array( |
317 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
318 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
317 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
318 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
319 | 319 | ); |
320 | 320 | |
321 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
321 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
322 | 322 | //use the correct applicable time query depending on what version of core is being run. |
323 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
324 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
323 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
324 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | // get all tickets for this event ordered by the datetime |
328 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
328 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
329 | 329 | |
330 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
331 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
330 | + if (count($template_args['tickets']) < 1) { |
|
331 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
335 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
336 | - if ( $template_args['max_atndz'] < 1 ) { |
|
337 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
338 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
339 | - $sales_closed_msg .= sprintf( |
|
340 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
335 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
336 | + if ($template_args['max_atndz'] < 1) { |
|
337 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
338 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
339 | + $sales_closed_msg .= sprintf( |
|
340 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
341 | 341 | '<div class="ee-attention" style="text-align: left;"><b>', |
342 | 342 | '</b><br />', |
343 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
343 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
344 | 344 | '</a></span></div>' |
345 | 345 | ); |
346 | 346 | } |
347 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
347 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
348 | 348 | } |
349 | 349 | |
350 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
351 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
350 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
351 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
352 | 352 | |
353 | 353 | // redirecting to another site for registration ?? |
354 | 354 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
355 | 355 | // set up the form (but not for the admin) |
356 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
356 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
357 | 357 | // if not redirecting to another site for registration |
358 | - if ( ! $external_url ) { |
|
358 | + if ( ! $external_url) { |
|
359 | 359 | // then display the ticket selector |
360 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
360 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
361 | 361 | } else { |
362 | 362 | // if not we still need to trigger the display of the submit button |
363 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
363 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
364 | 364 | //display notice to admin that registration is external |
365 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
365 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
366 | 366 | } |
367 | 367 | // submit button and form close tag |
368 | 368 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -382,25 +382,25 @@ discard block |
||
382 | 382 | * @param string $external_url |
383 | 383 | * @return string |
384 | 384 | */ |
385 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
385 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
386 | 386 | // if redirecting, we don't need any anything else |
387 | - if ( $external_url ) { |
|
388 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
389 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
390 | - foreach ( $query_args as $query_arg => $value ) { |
|
391 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
387 | + if ($external_url) { |
|
388 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
389 | + $query_args = EEH_URL::get_query_string($external_url); |
|
390 | + foreach ($query_args as $query_arg => $value) { |
|
391 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
392 | 392 | } |
393 | 393 | return $html; |
394 | 394 | } |
395 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
396 | - if ( ! $checkout_url ) { |
|
397 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
395 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
396 | + if ( ! $checkout_url) { |
|
397 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
398 | 398 | } |
399 | 399 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
400 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
401 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
400 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
401 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
402 | 402 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
403 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
403 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
404 | 404 | return $html; |
405 | 405 | } |
406 | 406 | |
@@ -415,23 +415,23 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | */ |
417 | 417 | public static function display_ticket_selector_submit() { |
418 | - if ( ! is_admin() ) { |
|
419 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
418 | + if ( ! is_admin()) { |
|
419 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
420 | 420 | $btn_text = apply_filters( |
421 | 421 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
422 | - __('Register Now', 'event_espresso' ), |
|
422 | + __('Register Now', 'event_espresso'), |
|
423 | 423 | self::$_event |
424 | 424 | ); |
425 | 425 | $external_url = self::$_event->external_url(); |
426 | - $html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"'; |
|
426 | + $html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"'; |
|
427 | 427 | $html .= ' class="ticket-selector-submit-btn '; |
428 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
429 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
430 | - $html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event ); |
|
428 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
429 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
430 | + $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event); |
|
431 | 431 | $html .= '<div class="clear"><br/></div></form>'; |
432 | 432 | return $html; |
433 | - } else if ( is_archive() ) { |
|
434 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
433 | + } else if (is_archive()) { |
|
434 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | return ''; |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | * @return string |
464 | 464 | */ |
465 | 465 | public static function display_view_details_btn() { |
466 | - if ( ! self::$_event->get_permalink() ) { |
|
467 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
466 | + if ( ! self::$_event->get_permalink()) { |
|
467 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
468 | 468 | } |
469 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
470 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
471 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
472 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
469 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
470 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
471 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
472 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
473 | 473 | $view_details_btn .= '<div class="clear"><br/></div>'; |
474 | 474 | $view_details_btn .= '</form>'; |
475 | 475 | return $view_details_btn; |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | * @return array or FALSE |
489 | 489 | */ |
490 | 490 | public function process_ticket_selections() { |
491 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
491 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
492 | 492 | // check nonce |
493 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
493 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
494 | 494 | EE_Error::add_error( |
495 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
495 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
496 | 496 | __FILE__, __FUNCTION__, __LINE__ |
497 | 497 | ); |
498 | 498 | return FALSE; |
@@ -506,16 +506,16 @@ discard block |
||
506 | 506 | |
507 | 507 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
508 | 508 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
509 | - EE_Registry::instance()->load_core( 'Session' ); |
|
509 | + EE_Registry::instance()->load_core('Session'); |
|
510 | 510 | // unless otherwise requested, clear the session |
511 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
512 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
511 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
512 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
513 | 513 | } |
514 | 514 | //d( EE_Registry::instance()->SSN ); |
515 | 515 | |
516 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
516 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
517 | 517 | // do we have an event id? |
518 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
518 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
519 | 519 | // validate/sanitize data |
520 | 520 | $valid = self::_validate_post_data(); |
521 | 521 | |
@@ -525,43 +525,43 @@ discard block |
||
525 | 525 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
526 | 526 | |
527 | 527 | //check total tickets ordered vs max number of attendees that can register |
528 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
528 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
529 | 529 | |
530 | 530 | // ordering too many tickets !!! |
531 | 531 | $singular = 'You have attempted to purchase %s ticket.'; |
532 | 532 | $plural = 'You have attempted to purchase %s tickets.'; |
533 | - $limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] ); |
|
533 | + $limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']); |
|
534 | 534 | // dev only message |
535 | 535 | $singular = 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
536 | 536 | $plural = 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
537 | - $limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] ); |
|
538 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
537 | + $limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']); |
|
538 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
539 | 539 | } else { |
540 | 540 | |
541 | 541 | // all data appears to be valid |
542 | 542 | $tckts_slctd = FALSE; |
543 | 543 | $success = TRUE; |
544 | 544 | // load cart |
545 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
545 | + EE_Registry::instance()->load_core('Cart'); |
|
546 | 546 | |
547 | 547 | // cycle thru the number of data rows sent from the event listing |
548 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
548 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
549 | 549 | // does this row actually contain a ticket quantity? |
550 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
550 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
551 | 551 | // YES we have a ticket quantity |
552 | 552 | $tckts_slctd = TRUE; |
553 | 553 | // d( $valid['ticket_obj'][$x] ); |
554 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
554 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
555 | 555 | // then add ticket to cart |
556 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
556 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
557 | 557 | $success = ! $ticket_added ? FALSE : $success; |
558 | - if ( EE_Error::has_error() ) { |
|
558 | + if (EE_Error::has_error()) { |
|
559 | 559 | break; |
560 | 560 | } |
561 | 561 | } else { |
562 | 562 | // nothing added to cart retrieved |
563 | 563 | EE_Error::add_error( |
564 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
564 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
565 | 565 | __FILE__, __FUNCTION__, __LINE__ |
566 | 566 | ); |
567 | 567 | } |
@@ -570,45 +570,45 @@ discard block |
||
570 | 570 | //d( EE_Registry::instance()->CART ); |
571 | 571 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
572 | 572 | |
573 | - if ( $tckts_slctd ) { |
|
574 | - if ( $success ) { |
|
575 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
573 | + if ($tckts_slctd) { |
|
574 | + if ($success) { |
|
575 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
576 | 576 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
577 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
577 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
578 | 578 | EE_Registry::instance()->SSN->update(); |
579 | 579 | //d( EE_Registry::instance()->CART ); |
580 | 580 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
581 | 581 | // just return TRUE for registrations being made from admin |
582 | - if ( is_admin() ) { |
|
582 | + if (is_admin()) { |
|
583 | 583 | return TRUE; |
584 | 584 | } |
585 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
585 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
586 | 586 | exit(); |
587 | 587 | |
588 | 588 | } else { |
589 | - if ( ! EE_Error::has_error() ) { |
|
589 | + if ( ! EE_Error::has_error()) { |
|
590 | 590 | // nothing added to cart |
591 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
591 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | 595 | } else { |
596 | 596 | // no ticket quantities were selected |
597 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
597 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
601 | 601 | // at this point, just return if registration is being made from admin |
602 | - if ( is_admin() ) { |
|
602 | + if (is_admin()) { |
|
603 | 603 | return FALSE; |
604 | 604 | } |
605 | - if ( $valid['return_url'] ) { |
|
606 | - EE_Error::get_notices( FALSE, TRUE ); |
|
607 | - wp_safe_redirect( $valid['return_url'] ); |
|
605 | + if ($valid['return_url']) { |
|
606 | + EE_Error::get_notices(FALSE, TRUE); |
|
607 | + wp_safe_redirect($valid['return_url']); |
|
608 | 608 | exit(); |
609 | - } elseif ( isset( $event_to_add['id'] )) { |
|
610 | - EE_Error::get_notices( FALSE, TRUE ); |
|
611 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
609 | + } elseif (isset($event_to_add['id'])) { |
|
610 | + EE_Error::get_notices(FALSE, TRUE); |
|
611 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
612 | 612 | exit(); |
613 | 613 | } else { |
614 | 614 | echo EE_Error::get_notices(); |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | } else { |
618 | 618 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
619 | 619 | EE_Error::add_error( |
620 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
620 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
621 | 621 | __FILE__, __FUNCTION__, __LINE__ |
622 | 622 | ); |
623 | 623 | } |
@@ -635,18 +635,18 @@ discard block |
||
635 | 635 | * @return array or FALSE |
636 | 636 | */ |
637 | 637 | private static function _validate_post_data() { |
638 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
638 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
639 | 639 | |
640 | 640 | // start with an empty array() |
641 | 641 | $valid_data = array(); |
642 | 642 | // d( $_POST ); |
643 | 643 | //if event id is valid |
644 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
645 | - if ( $id ) { |
|
644 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
645 | + if ($id) { |
|
646 | 646 | // grab valid id |
647 | 647 | $valid_data['id'] = $id; |
648 | 648 | // grab and sanitize return-url |
649 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
649 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
650 | 650 | // array of other form names |
651 | 651 | $inputs_to_clean = array( |
652 | 652 | 'event_id' => 'tkt-slctr-event-id', |
@@ -659,22 +659,22 @@ discard block |
||
659 | 659 | // let's track the total number of tickets ordered.' |
660 | 660 | $valid_data['total_tickets'] = 0; |
661 | 661 | // cycle through $inputs_to_clean array |
662 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
662 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
663 | 663 | // check for POST data |
664 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
664 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
665 | 665 | // grab value |
666 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
666 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
667 | 667 | switch ($what) { |
668 | 668 | |
669 | 669 | // integers |
670 | 670 | case 'event_id': |
671 | - $valid_data[$what] = absint( $input_value ); |
|
671 | + $valid_data[$what] = absint($input_value); |
|
672 | 672 | // get event via the event id we put in the form |
673 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
673 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
674 | 674 | break; |
675 | 675 | case 'rows': |
676 | 676 | case 'max_atndz': |
677 | - $valid_data[$what] = absint( $input_value ); |
|
677 | + $valid_data[$what] = absint($input_value); |
|
678 | 678 | break; |
679 | 679 | |
680 | 680 | // arrays of integers |
@@ -682,27 +682,27 @@ discard block |
||
682 | 682 | // d( $input_value ); |
683 | 683 | $row_qty = $input_value; |
684 | 684 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
685 | - if( ! is_array( $row_qty )) { |
|
685 | + if ( ! is_array($row_qty)) { |
|
686 | 686 | // get number of rows |
687 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
687 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
688 | 688 | // d( $rows ); |
689 | 689 | // explode ints by the dash |
690 | - $row_qty = explode( '-', $row_qty ); |
|
691 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
692 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
693 | - $row_qty = array( $row => $qty ); |
|
690 | + $row_qty = explode('-', $row_qty); |
|
691 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
692 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
693 | + $row_qty = array($row => $qty); |
|
694 | 694 | // d( $row_qty ); |
695 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
696 | - if ( ! isset( $row_qty[$x] )) { |
|
695 | + for ($x = 1; $x <= $rows; $x++) { |
|
696 | + if ( ! isset($row_qty[$x])) { |
|
697 | 697 | $row_qty[$x] = 0; |
698 | 698 | } |
699 | 699 | } |
700 | 700 | } |
701 | - ksort( $row_qty ); |
|
701 | + ksort($row_qty); |
|
702 | 702 | // d( $row_qty ); |
703 | 703 | // cycle thru values |
704 | - foreach ( $row_qty as $qty ) { |
|
705 | - $qty = absint( $qty ); |
|
704 | + foreach ($row_qty as $qty) { |
|
705 | + $qty = absint($qty); |
|
706 | 706 | // sanitize as integers |
707 | 707 | $valid_data[$what][] = $qty; |
708 | 708 | $valid_data['total_tickets'] += $qty; |
@@ -713,19 +713,19 @@ discard block |
||
713 | 713 | case 'ticket_id': |
714 | 714 | $value_array = array(); |
715 | 715 | // cycle thru values |
716 | - foreach ( $input_value as $key=>$value ) { |
|
716 | + foreach ($input_value as $key=>$value) { |
|
717 | 717 | // allow only numbers, letters, spaces, commas and dashes |
718 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
718 | + $value_array[$key] = wp_strip_all_tags($value); |
|
719 | 719 | // get ticket via the ticket id we put in the form |
720 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
721 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
720 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
721 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
722 | 722 | } |
723 | - $valid_data[ $what ] = $value_array; |
|
723 | + $valid_data[$what] = $value_array; |
|
724 | 724 | break; |
725 | 725 | |
726 | 726 | case 'return_url' : |
727 | 727 | // grab and sanitize return-url |
728 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
728 | + $valid_data[$what] = esc_url_raw($input_value); |
|
729 | 729 | break; |
730 | 730 | |
731 | 731 | } // end switch $what |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | } // end foreach $inputs_to_clean |
734 | 734 | |
735 | 735 | } else { |
736 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
736 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
737 | 737 | return FALSE; |
738 | 738 | } |
739 | 739 | |
@@ -751,28 +751,28 @@ discard block |
||
751 | 751 | * @param int $qty |
752 | 752 | * @return TRUE on success, FALSE on fail |
753 | 753 | */ |
754 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
755 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
754 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
755 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
756 | 756 | // get the number of spaces left for this datetime ticket |
757 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
757 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
758 | 758 | // compare available spaces against the number of tickets being purchased |
759 | - if ( $available_spaces >= $qty ) { |
|
759 | + if ($available_spaces >= $qty) { |
|
760 | 760 | // allow addons to prevent a ticket from being added to cart |
761 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
761 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
762 | 762 | return false; |
763 | 763 | } |
764 | 764 | // add event to cart |
765 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
766 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
765 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
766 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
767 | 767 | return true; |
768 | 768 | } else { |
769 | 769 | return false; |
770 | 770 | } |
771 | 771 | } else { |
772 | 772 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
773 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
773 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
774 | 774 | // greedy greedy greedy eh? |
775 | - if ( $available_spaces > 0 ) { |
|
775 | + if ($available_spaces > 0) { |
|
776 | 776 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
777 | 777 | EE_Error::add_error( |
778 | 778 | sprintf( |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | __FILE__, __FUNCTION__, __LINE__ |
789 | 789 | ); |
790 | 790 | } else { |
791 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
791 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
792 | 792 | } |
793 | 793 | return false; |
794 | 794 | } |
@@ -806,22 +806,22 @@ discard block |
||
806 | 806 | * @param bool $get_original_ticket_spaces |
807 | 807 | * @return int |
808 | 808 | */ |
809 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
809 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
810 | 810 | // if the $_available_spaces array has not been set up yet... |
811 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
812 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
811 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
812 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
813 | 813 | } |
814 | 814 | $available_spaces = $ticket->qty() - $ticket->sold(); |
815 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
815 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
816 | 816 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
817 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
817 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
818 | 818 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
819 | - if ( $get_original_ticket_spaces ) { |
|
819 | + if ($get_original_ticket_spaces) { |
|
820 | 820 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
821 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
821 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
822 | 822 | } else { |
823 | 823 | // we want the updated ticket availability as stored in the "datetimes" array |
824 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
824 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | } |
@@ -837,23 +837,23 @@ discard block |
||
837 | 837 | * @param EE_Ticket $ticket |
838 | 838 | * @return int |
839 | 839 | */ |
840 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
840 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
841 | 841 | // first, get all of the datetimes that are available to this ticket |
842 | 842 | $datetimes = $ticket->get_many_related( |
843 | 843 | 'Datetime', |
844 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
844 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
845 | 845 | ); |
846 | - if ( ! empty( $datetimes )) { |
|
846 | + if ( ! empty($datetimes)) { |
|
847 | 847 | // now loop thru all of the datetimes |
848 | - foreach ( $datetimes as $datetime ) { |
|
849 | - if ( $datetime instanceof EE_Datetime ) { |
|
848 | + foreach ($datetimes as $datetime) { |
|
849 | + if ($datetime instanceof EE_Datetime) { |
|
850 | 850 | // the number of spaces available for the datetime without considering individual ticket quantities |
851 | 851 | $spaces_remaining = $datetime->spaces_remaining(); |
852 | 852 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
853 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
853 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
854 | 854 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
855 | 855 | // else just take the datetime spaces remaining, and assign to the datetimes array |
856 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
856 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
857 | 857 | } |
858 | 858 | } |
859 | 859 | } |
@@ -869,12 +869,12 @@ discard block |
||
869 | 869 | * @param int $qty |
870 | 870 | * @return int |
871 | 871 | */ |
872 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
873 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
872 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
873 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
874 | 874 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
875 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
875 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
876 | 876 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
877 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
877 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | } |
@@ -891,8 +891,8 @@ discard block |
||
891 | 891 | */ |
892 | 892 | public static function load_tckt_slctr_assets() { |
893 | 893 | // add some style |
894 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
895 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
894 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
895 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
896 | 896 | wp_enqueue_style('ticket_selector'); |
897 | 897 | // make it dance |
898 | 898 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -906,9 +906,9 @@ discard block |
||
906 | 906 | |
907 | 907 | public static function load_tckt_slctr_assets_admin() { |
908 | 908 | //iframe button js on admin event editor page |
909 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
910 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
911 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
909 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
910 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
911 | + wp_enqueue_script('ticket_selector_embed'); |
|
912 | 912 | } |
913 | 913 | } |
914 | 914 |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * EE_Billing_Info_Form |
|
5 | - * Default form which can be used by payment method types for their billing info. |
|
6 | - * Has no default fields. Consider using EE_Billing_Attendee_Info_Form instead |
|
7 | - * if the billing info has billee name and address info. |
|
8 | - * |
|
9 | - * @package Event Espresso |
|
10 | - * @subpackage |
|
11 | - * @author Mike Nelson |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * EE_Billing_Info_Form |
|
5 | + * Default form which can be used by payment method types for their billing info. |
|
6 | + * Has no default fields. Consider using EE_Billing_Attendee_Info_Form instead |
|
7 | + * if the billing info has billee name and address info. |
|
8 | + * |
|
9 | + * @package Event Espresso |
|
10 | + * @subpackage |
|
11 | + * @author Mike Nelson |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Billing_Info_Form extends EE_Form_Section_Proper{ |
15 | 15 | |
16 | 16 | /** |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * EE_Billing_Info_Form |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Mike Nelson |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Billing_Info_Form extends EE_Form_Section_Proper{ |
|
14 | +class EE_Billing_Info_Form extends EE_Form_Section_Proper { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * The payment method this billing form is for |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * @param EE_Payment_Method $payment_method |
27 | 27 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
28 | 28 | */ |
29 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
29 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
30 | 30 | $this->_pm_instance = $payment_method; |
31 | 31 | $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
32 | - parent::__construct( $options_array ); |
|
32 | + parent::__construct($options_array); |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param EE_Payment_Method $payment_method |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public function set_payment_method( EE_Payment_Method $payment_method ){ |
|
43 | + public function set_payment_method(EE_Payment_Method $payment_method) { |
|
44 | 44 | $this->_pm_instance = $payment_method; |
45 | 45 | } |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Returns the instance of the payment method this billing form is for |
51 | 51 | * @return EE_Payment_Method |
52 | 52 | */ |
53 | - public function payment_method(){ |
|
53 | + public function payment_method() { |
|
54 | 54 | return $this->_pm_instance; |
55 | 55 | } |
56 | 56 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * payment_fields_autofilled_notice_html |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - public function payment_fields_autofilled_notice_html(){ |
|
63 | + public function payment_fields_autofilled_notice_html() { |
|
64 | 64 | return new EE_Form_Section_HTML( |
65 | 65 | EEH_HTML::p( |
66 | - apply_filters( 'FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __( 'Payment fields have been autofilled because you are in debug mode', 'event_espresso' )), |
|
66 | + apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), |
|
67 | 67 | '', |
68 | 68 | 'important-notice' |
69 | 69 | ) |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function html_class(){ |
|
79 | - return ! empty( $this->_html_class ) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
78 | + public function html_class() { |
|
79 | + return ! empty($this->_html_class) ? $this->_html_class.' ee-billing-form' : 'ee-billing-form'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This contains the class for the EE HTML messenger. |
|
4 | - * |
|
5 | - * @since 4.5.0 |
|
6 | - * @package Event Espresso |
|
7 | - * @subpackage messages |
|
8 | - */ |
|
3 | + * This contains the class for the EE HTML messenger. |
|
4 | + * |
|
5 | + * @since 4.5.0 |
|
6 | + * @package Event Espresso |
|
7 | + * @subpackage messages |
|
8 | + */ |
|
9 | 9 | if (!defined('EVENT_ESPRESSO_VERSION') ) |
10 | 10 | exit('NO direct script access allowed'); |
11 | 11 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | 11 | |
12 | 12 | /** |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @subpackage messages |
20 | 20 | * @author Darren Ethier |
21 | 21 | */ |
22 | -class EE_Html_messenger extends EE_messenger { |
|
22 | +class EE_Html_messenger extends EE_messenger { |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @see abstract declaration in EE_messenger for details. |
63 | 63 | */ |
64 | 64 | protected function _set_admin_pages() { |
65 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
65 | + $this->admin_registered_pages = array('events_edit' => true); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -82,29 +82,29 @@ discard block |
||
82 | 82 | protected function _set_validator_config() { |
83 | 83 | $this->_validator_config = array( |
84 | 84 | 'subject' => array( |
85 | - 'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction' ) |
|
85 | + 'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction') |
|
86 | 86 | ), |
87 | 87 | 'content' => array( |
88 | - 'shortcodes' => array( 'organization', 'primary_registration_list', 'primary_registration_details', 'email', 'transaction', 'event_list', 'payment_list', 'venue', 'line_item_list', 'messenger', 'ticket_list') |
|
88 | + 'shortcodes' => array('organization', 'primary_registration_list', 'primary_registration_details', 'email', 'transaction', 'event_list', 'payment_list', 'venue', 'line_item_list', 'messenger', 'ticket_list') |
|
89 | 89 | ), |
90 | 90 | 'event_list' => array( |
91 | - 'shortcodes' => array( 'event', 'ticket_list', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author' ), |
|
91 | + 'shortcodes' => array('event', 'ticket_list', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author'), |
|
92 | 92 | 'required' => array('[EVENT_LIST]') |
93 | 93 | ), |
94 | 94 | 'ticket_list' => array( |
95 | - 'shortcodes' => array( 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'line_item_list', 'venue'), |
|
95 | + 'shortcodes' => array('attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'line_item_list', 'venue'), |
|
96 | 96 | 'required' => array('[TICKET_LIST]') |
97 | 97 | ), |
98 | 98 | 'ticket_line_item_no_pms' => array( |
99 | - 'shortcodes' => array( 'line_item', 'ticket' ), |
|
99 | + 'shortcodes' => array('line_item', 'ticket'), |
|
100 | 100 | 'required' => array('[TICKET_LINE_ITEM_LIST]') |
101 | 101 | ), |
102 | 102 | 'ticket_line_item_pms' => array( |
103 | - 'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ), |
|
103 | + 'shortcodes' => array('line_item', 'ticket', 'line_item_list'), |
|
104 | 104 | 'required' => array('[TICKET_LINE_ITEM_LIST]'), |
105 | 105 | ), |
106 | 106 | 'price_modifier_line_item_list' => array( |
107 | - 'shortcodes' => array( 'line_item' ), |
|
107 | + 'shortcodes' => array('line_item'), |
|
108 | 108 | 'required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]') |
109 | 109 | ), |
110 | 110 | 'datetime_list' => array( |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | |
135 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
136 | - if ( $sending_messenger_name = 'pdf' ) { |
|
137 | - add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 ); |
|
135 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
136 | + if ($sending_messenger_name = 'pdf') { |
|
137 | + add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | |
142 | 142 | |
143 | - public function add_html_css( $variation_path, EE_Messages_Template_Pack $template_pack, $messenger_name, $message_type_name, $url, $type, $variation, $skip_filters ) { |
|
144 | - $variation = $template_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ); |
|
143 | + public function add_html_css($variation_path, EE_Messages_Template_Pack $template_pack, $messenger_name, $message_type_name, $url, $type, $variation, $skip_filters) { |
|
144 | + $variation = $template_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters); |
|
145 | 145 | return $variation; |
146 | 146 | } |
147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function enqueue_scripts_styles() { |
156 | 156 | parent::enqueue_scripts_styles(); |
157 | - do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles'); |
|
157 | + do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ), |
215 | 215 | 'ticket_line_item_no_pms' => array( |
216 | 216 | 'input' => 'textarea', |
217 | - 'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __('Ticket Line Item List with no Price Modifiers', 'event_espresso'), |
|
217 | + 'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__('Ticket Line Item List with no Price Modifiers', 'event_espresso'), |
|
218 | 218 | 'type' => 'string', |
219 | 219 | 'required' => FALSE, |
220 | 220 | 'validation' => TRUE, |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | ), |
226 | 226 | 'ticket_line_item_pms' => array( |
227 | 227 | 'input' => 'textarea', |
228 | - 'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __('Ticket Line Item List with Price Modifiers', 'event_espresso'), |
|
228 | + 'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__('Ticket Line Item List with Price Modifiers', 'event_espresso'), |
|
229 | 229 | 'type' => 'string', |
230 | 230 | 'required' => FALSE, |
231 | 231 | 'validation' => TRUE, |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * |
319 | 319 | */ |
320 | 320 | protected function _set_default_message_types() { |
321 | - $this->_default_message_types = array( 'receipt', 'invoice' ); |
|
321 | + $this->_default_message_types = array('receipt', 'invoice'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @since 4.5.0 |
330 | 330 | */ |
331 | 331 | protected function _set_valid_message_types() { |
332 | - $this->_valid_message_types = array( 'receipt', 'invoice' ); |
|
332 | + $this->_valid_message_types = array('receipt', 'invoice'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -344,15 +344,15 @@ discard block |
||
344 | 344 | */ |
345 | 345 | protected function _send_message() { |
346 | 346 | $this->_template_args = array( |
347 | - 'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8"), |
|
348 | - 'base_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation ), |
|
349 | - 'print_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation ), |
|
350 | - 'main_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation ), |
|
351 | - 'main_body' => apply_filters( 'FHEE__EE_Html_messenger___send_message__main_body', wpautop(stripslashes_deep( html_entity_decode($this->_content, ENT_QUOTES,"UTF-8" ) )), $this->_content ) |
|
347 | + 'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"), |
|
348 | + 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation), |
|
349 | + 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation), |
|
350 | + 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation), |
|
351 | + 'main_body' => apply_filters('FHEE__EE_Html_messenger___send_message__main_body', wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))), $this->_content) |
|
352 | 352 | ); |
353 | 353 | |
354 | 354 | $this->_deregister_wp_hooks(); |
355 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
355 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
356 | 356 | echo $this->_get_main_template(); |
357 | 357 | exit(); |
358 | 358 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | $wp_scripts = $wp_styles = array(); |
377 | 377 | |
378 | 378 | //just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
379 | - add_action( 'wp_footer', 'wp_print_footer_scripts' ); |
|
380 | - add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); |
|
379 | + add_action('wp_footer', 'wp_print_footer_scripts'); |
|
380 | + add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
381 | 381 | add_action('wp_head', 'wp_enqueue_scripts'); |
382 | 382 | } |
383 | 383 | |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - protected function _get_main_template( $preview = FALSE ) { |
|
395 | - $wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' ); |
|
394 | + protected function _get_main_template($preview = FALSE) { |
|
395 | + $wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main'); |
|
396 | 396 | |
397 | 397 | //include message type as a template arg |
398 | 398 | $this->_template_args['message_type'] = $this->_incoming_message_type; |
399 | 399 | |
400 | - return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE ); |
|
400 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 |