@@ -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,19 +178,19 @@ 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 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
187 | - if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){ |
|
188 | - $SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"'; |
|
189 | - $results = $wpdb->get_results( $SQL ); |
|
186 | + EE_Registry::instance()->load_helper('Activation'); |
|
187 | + if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) { |
|
188 | + $SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"'; |
|
189 | + $results = $wpdb->get_results($SQL); |
|
190 | 190 | self::$_reg_status = array(); |
191 | - foreach ( $results as $status ) { |
|
192 | - if ( ! in_array( $status->STS_ID, $exclude )) { |
|
193 | - self::$_reg_status[ $status->STS_ID ] = $status->STS_code; |
|
191 | + foreach ($results as $status) { |
|
192 | + if ( ! in_array($status->STS_ID, $exclude)) { |
|
193 | + self::$_reg_status[$status->STS_ID] = $status->STS_code; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | } |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | * @param array $where_params Array of query_params as described in the comments for EEM_Base::get_all() |
206 | 206 | * @return wpdb results array |
207 | 207 | */ |
208 | - public function get_reg_months_and_years( $where_params ) { |
|
208 | + public function get_reg_months_and_years($where_params) { |
|
209 | 209 | $query_params[0] = $where_params; |
210 | 210 | $query_params['group_by'] = array('reg_year', 'reg_month'); |
211 | - $query_params['order_by'] = array( 'REG_date' => 'DESC' ); |
|
211 | + $query_params['order_by'] = array('REG_date' => 'DESC'); |
|
212 | 212 | $columns_to_select = array( |
213 | 213 | 'reg_year' => array('YEAR(REG_date)', '%s'), |
214 | 214 | 'reg_month' => array('MONTHNAME(REG_date)', '%s') |
215 | 215 | ); |
216 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
216 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | * @param int $ATT_ID |
226 | 226 | * @return EE_Registration[] |
227 | 227 | */ |
228 | - public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
|
229 | - if ( ! $ATT_ID ) { |
|
228 | + public function get_all_registrations_for_attendee($ATT_ID = 0) { |
|
229 | + if ( ! $ATT_ID) { |
|
230 | 230 | return FALSE; |
231 | 231 | } |
232 | - return $this->get_all( array( array( 'ATT_ID' => $ATT_ID ))); |
|
232 | + return $this->get_all(array(array('ATT_ID' => $ATT_ID))); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | * @param string $REG_url_link |
241 | 241 | * @return EE_Registration |
242 | 242 | */ |
243 | - public function get_registration_for_reg_url_link($REG_url_link){ |
|
244 | - if(!$REG_url_link){ |
|
243 | + public function get_registration_for_reg_url_link($REG_url_link) { |
|
244 | + if ( ! $REG_url_link) { |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | return $this->get_one(array(array('REG_url_link'=>$REG_url_link))); |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
260 | 260 | * @return mixed array on success, FALSE on fail |
261 | 261 | */ |
262 | - public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
|
262 | + public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) { |
|
263 | 263 | return $this->get_one(array( |
264 | 264 | array( |
265 | 265 | 'TXN_ID'=>$TXN_ID, |
266 | 266 | 'ATT_ID'=>$ATT_ID |
267 | 267 | ), |
268 | - 'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 ) |
|
268 | + 'limit'=>array(min(($att_nmbr - 1), 0), 1) |
|
269 | 269 | )); |
270 | 270 | } |
271 | 271 | |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
278 | 278 | * @return stdClass[] with properties regDate and total |
279 | 279 | */ |
280 | - public function get_registrations_per_day_report( $period = '-1 month' ) { |
|
280 | + public function get_registrations_per_day_report($period = '-1 month') { |
|
281 | 281 | |
282 | - $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' ); |
|
283 | - $where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
282 | + $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'); |
|
283 | + $where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
284 | 284 | |
285 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) { |
|
285 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) { |
|
286 | 286 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
287 | 287 | } |
288 | 288 | |
289 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
290 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' ); |
|
289 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
290 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date'); |
|
291 | 291 | |
292 | 292 | $results = $this->_get_all_wpdb_results( |
293 | 293 | array( |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | ), |
298 | 298 | OBJECT, |
299 | 299 | array( |
300 | - 'regDate'=>array( 'DATE(' . $query_interval . ')','%s'), |
|
301 | - 'total'=>array('count(REG_ID)','%d') |
|
300 | + 'regDate'=>array('DATE('.$query_interval.')', '%s'), |
|
301 | + 'total'=>array('count(REG_ID)', '%d') |
|
302 | 302 | )); |
303 | 303 | return $results; |
304 | 304 | } |
@@ -313,23 +313,23 @@ discard block |
||
313 | 313 | * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID |
314 | 314 | * (i.e. RAP) |
315 | 315 | */ |
316 | - public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) { |
|
316 | + public function get_registrations_per_day_and_per_status_report($period = '-1 month') { |
|
317 | 317 | global $wpdb; |
318 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
318 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
319 | 319 | $event_table = $wpdb->posts; |
320 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
320 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
321 | 321 | |
322 | 322 | //prepare the query interval for displaying offset |
323 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
324 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' ); |
|
323 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
324 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date'); |
|
325 | 325 | |
326 | 326 | //inner date query |
327 | 327 | $inner_date_query = "SELECT DISTINCT REG_date from $registration_table "; |
328 | 328 | $inner_where = " WHERE"; |
329 | 329 | //exclude events not authored by user if permissions in effect |
330 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
330 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
331 | 331 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
332 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
332 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
333 | 333 | } |
334 | 334 | $inner_where .= " REG_date >= '$sql_date'"; |
335 | 335 | $inner_date_query .= $inner_where; |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | $select_parts = array(); |
342 | 342 | |
343 | 343 | //loop through registration stati to do parts for each status. |
344 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
345 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
344 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
345 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
346 | 346 | continue; |
347 | 347 | } |
348 | 348 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | //setup the selects |
353 | - $select .= implode(', ', $select_parts ); |
|
353 | + $select .= implode(', ', $select_parts); |
|
354 | 354 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN "; |
355 | 355 | |
356 | 356 | //setup the joins |
357 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
357 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
358 | 358 | |
359 | 359 | //now let's put it all together |
360 | - $query = $select . $join . ' GROUP BY Registration_REG_date'; |
|
360 | + $query = $select.$join.' GROUP BY Registration_REG_date'; |
|
361 | 361 | |
362 | 362 | //and execute it |
363 | 363 | $results = $wpdb->get_results( |
@@ -378,23 +378,23 @@ discard block |
||
378 | 378 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
379 | 379 | * @return stdClass[] each with properties event_name, reg_limit, and total |
380 | 380 | */ |
381 | - public function get_registrations_per_event_report( $period = '-1 month' ) { |
|
381 | + public function get_registrations_per_event_report($period = '-1 month') { |
|
382 | 382 | |
383 | - $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' ); |
|
384 | - $where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
383 | + $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'); |
|
384 | + $where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
385 | 385 | |
386 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
386 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
387 | 387 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
388 | 388 | } |
389 | 389 | $results = $this->_get_all_wpdb_results(array( |
390 | 390 | $where, |
391 | 391 | 'group_by'=>'Event.EVT_name', |
392 | 392 | 'order_by'=>'Event.EVT_name', |
393 | - 'limit'=>array(0,24)), |
|
393 | + 'limit'=>array(0, 24)), |
|
394 | 394 | OBJECT, |
395 | 395 | array( |
396 | - 'event_name'=>array('Event_CPT.post_title','%s'), |
|
397 | - 'total'=>array('COUNT(REG_ID)','%s') |
|
396 | + 'event_name'=>array('Event_CPT.post_title', '%s'), |
|
397 | + 'total'=>array('COUNT(REG_ID)', '%s') |
|
398 | 398 | ) |
399 | 399 | ); |
400 | 400 | |
@@ -412,19 +412,19 @@ discard block |
||
412 | 412 | * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID |
413 | 413 | * (i.e. RAP) |
414 | 414 | */ |
415 | - public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) { |
|
415 | + public function get_registrations_per_event_and_per_status_report($period = '-1 month') { |
|
416 | 416 | global $wpdb; |
417 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
417 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
418 | 418 | $event_table = $wpdb->posts; |
419 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
419 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
420 | 420 | |
421 | 421 | //inner date query |
422 | 422 | $inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table "; |
423 | 423 | $inner_where = " WHERE"; |
424 | 424 | //exclude events not authored by user if permissions in effect |
425 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
425 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
426 | 426 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
427 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
427 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
428 | 428 | } |
429 | 429 | $inner_where .= " REG_date >= '$sql_date'"; |
430 | 430 | $inner_date_query .= $inner_where; |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | $select_parts = array(); |
437 | 437 | |
438 | 438 | //loop through registration stati to do parts for each status. |
439 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
440 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
439 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
440 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
441 | 441 | continue; |
442 | 442 | } |
443 | 443 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -445,14 +445,14 @@ discard block |
||
445 | 445 | } |
446 | 446 | |
447 | 447 | //setup the selects |
448 | - $select .= implode( ', ', $select_parts ); |
|
448 | + $select .= implode(', ', $select_parts); |
|
449 | 449 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN "; |
450 | 450 | |
451 | 451 | //setup remaining joins |
452 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
452 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
453 | 453 | |
454 | 454 | //now put it all together |
455 | - $query = $select . $join . ' GROUP BY Registration_Event'; |
|
455 | + $query = $select.$join.' GROUP BY Registration_Event'; |
|
456 | 456 | |
457 | 457 | //and execute |
458 | 458 | $results = $wpdb->get_results( |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | * @param int $TXN_ID |
469 | 469 | * @return EE_Registration |
470 | 470 | */ |
471 | - public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){ |
|
472 | - if( ! $TXN_ID ){ |
|
471 | + public function get_primary_registration_for_transaction_ID($TXN_ID = 0) { |
|
472 | + if ( ! $TXN_ID) { |
|
473 | 473 | return false; |
474 | 474 | } |
475 | - return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
475 | + return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | * @param boolean $for_incomplete_payments |
485 | 485 | * @return int |
486 | 486 | */ |
487 | - public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) { |
|
487 | + public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) { |
|
488 | 488 | // we only count approved registrations towards registration limits |
489 | - $query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) ); |
|
490 | - if( $for_incomplete_payments ){ |
|
491 | - $query_params[0]['Transaction.STS_ID']=array('!=', EEM_Transaction::complete_status_code); |
|
489 | + $query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved)); |
|
490 | + if ($for_incomplete_payments) { |
|
491 | + $query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | return $this->count($query_params); |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | /** @type WPDB $wpdb */ |
505 | 505 | global $wpdb; |
506 | 506 | return $wpdb->query( |
507 | - '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' ); |
|
507 | + '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' ); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | /** |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
515 | 515 | * @return int |
516 | 516 | */ |
517 | - public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) { |
|
517 | + public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) { |
|
518 | 518 | return $this->count( |
519 | 519 | array( |
520 | 520 | array( |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
533 | 533 | * @return int |
534 | 534 | */ |
535 | - public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) { |
|
535 | + public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) { |
|
536 | 536 | return $this->count( |
537 | 537 | array( |
538 | 538 | array( |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_Form_Input_Base |
|
4 | - * For representing a single form input. Extends EE_Form_Section_Base because |
|
5 | - * it is a part of a form and shares a surprisingly large amount of functionality |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage |
|
9 | - * @author Mike Nelson |
|
10 | - */ |
|
3 | + * EE_Form_Input_Base |
|
4 | + * For representing a single form input. Extends EE_Form_Section_Base because |
|
5 | + * it is a part of a form and shares a surprisingly large amount of functionality |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage |
|
9 | + * @author Mike Nelson |
|
10 | + */ |
|
11 | 11 | abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
12 | 12 | |
13 | 13 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{ |
|
11 | +abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * the input's name attribute |
@@ -141,66 +141,66 @@ discard block |
||
141 | 141 | * @type EE_Validation_Strategy_Base[] $validation_strategies |
142 | 142 | * } |
143 | 143 | */ |
144 | - public function __construct( $input_args = array() ){ |
|
145 | - $input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this ); |
|
144 | + public function __construct($input_args = array()) { |
|
145 | + $input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this); |
|
146 | 146 | // the following properties must be cast as arrays |
147 | 147 | $set_as_array = array( |
148 | 148 | 'validation_strategies' => true |
149 | 149 | ); |
150 | 150 | // loop thru incoming options |
151 | - foreach( $input_args as $key => $value ) { |
|
151 | + foreach ($input_args as $key => $value) { |
|
152 | 152 | // add underscore to $key to match property names |
153 | - $_key = '_' . $key; |
|
154 | - if ( property_exists( $this, $_key )) { |
|
153 | + $_key = '_'.$key; |
|
154 | + if (property_exists($this, $_key)) { |
|
155 | 155 | // first check if this property needs to be set as an array |
156 | - if ( isset( $set_as_array[ $key ] )) { |
|
156 | + if (isset($set_as_array[$key])) { |
|
157 | 157 | // ensure value is an array |
158 | - $value = is_array( $value ) ? $value : array( get_class( $value ), $value ); |
|
158 | + $value = is_array($value) ? $value : array(get_class($value), $value); |
|
159 | 159 | // and merge with existing values |
160 | - $this->{$_key} = array_merge( $this->{$_key}, $value ); |
|
160 | + $this->{$_key} = array_merge($this->{$_key}, $value); |
|
161 | 161 | } else { |
162 | 162 | $this->{$_key} = $value; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
166 | 166 | // ensure that "required" is set correctly |
167 | - $this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL ); |
|
167 | + $this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL); |
|
168 | 168 | |
169 | 169 | //$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE; |
170 | 170 | |
171 | 171 | $this->_display_strategy->_construct_finalize($this); |
172 | - if ( $this->_validation_strategies ){ |
|
173 | - foreach( $this->_validation_strategies as $validation_strategy ){ |
|
172 | + if ($this->_validation_strategies) { |
|
173 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
174 | 174 | $validation_strategy->_construct_finalize($this); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | - if( ! $this->_normalization_strategy){ |
|
178 | + if ( ! $this->_normalization_strategy) { |
|
179 | 179 | $this->_normalization_strategy = new EE_Text_Normalization(); |
180 | 180 | } |
181 | 181 | $this->_normalization_strategy->_construct_finalize($this); |
182 | 182 | |
183 | 183 | //at least we can use the normalization strategy to populate the default |
184 | - if( isset( $input_args[ 'default' ] ) ) { |
|
185 | - $this->set_default( $input_args[ 'default' ] ); |
|
184 | + if (isset($input_args['default'])) { |
|
185 | + $this->set_default($input_args['default']); |
|
186 | 186 | } |
187 | 187 | |
188 | - if( ! $this->_sensitive_data_removal_strategy){ |
|
188 | + if ( ! $this->_sensitive_data_removal_strategy) { |
|
189 | 189 | $this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal(); |
190 | 190 | } |
191 | 191 | $this->_sensitive_data_removal_strategy->_construct_finalize($this); |
192 | - parent::__construct( $input_args ); |
|
192 | + parent::__construct($input_args); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
196 | 196 | * Sets the html_name to its default value, if none was specified in teh constructor. |
197 | 197 | * Calculation involves using the name and the parent's html_name |
198 | 198 | */ |
199 | - protected function _set_default_html_name_if_empty(){ |
|
200 | - if( ! $this->_html_name){ |
|
201 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){ |
|
202 | - $this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]"; |
|
203 | - }else{ |
|
199 | + protected function _set_default_html_name_if_empty() { |
|
200 | + if ( ! $this->_html_name) { |
|
201 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
202 | + $this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]"; |
|
203 | + } else { |
|
204 | 204 | $this->_html_name = $this->name(); |
205 | 205 | } |
206 | 206 | } |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | function _construct_finalize($parent_form_section, $name) { |
216 | 216 | parent::_construct_finalize($parent_form_section, $name); |
217 | 217 | $this->_set_default_html_name_if_empty(); |
218 | - if( ! $this->_html_label ){ |
|
219 | - if( ! $this->_html_label_text){ |
|
220 | - $this->_html_label_text = ucwords( str_replace("_"," ",$name)); |
|
218 | + if ( ! $this->_html_label) { |
|
219 | + if ( ! $this->_html_label_text) { |
|
220 | + $this->_html_label_text = ucwords(str_replace("_", " ", $name)); |
|
221 | 221 | } |
222 | 222 | } |
223 | - do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name ); |
|
223 | + do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | * @return EE_Display_Strategy_Base |
229 | 229 | * @throws EE_Error |
230 | 230 | */ |
231 | - protected function _get_display_strategy(){ |
|
232 | - if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){ |
|
233 | - throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id())); |
|
234 | - }else{ |
|
231 | + protected function _get_display_strategy() { |
|
232 | + if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) { |
|
233 | + throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id())); |
|
234 | + } else { |
|
235 | 235 | return $this->_display_strategy; |
236 | 236 | } |
237 | 237 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * Sets the display strategy. |
240 | 240 | * @param EE_Display_Strategy_Base $strategy |
241 | 241 | */ |
242 | - protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){ |
|
242 | + protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) { |
|
243 | 243 | $this->_display_strategy = $strategy; |
244 | 244 | } |
245 | 245 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * Sets the sanitization strategy |
248 | 248 | * @param EE_Normalization_Strategy_Base $strategy |
249 | 249 | */ |
250 | - protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){ |
|
250 | + protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) { |
|
251 | 251 | $this->_normalization_strategy = $strategy; |
252 | 252 | } |
253 | 253 | |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | * Gets the display strategy for this input |
274 | 274 | * @return EE_Display_Strategy_Base |
275 | 275 | */ |
276 | - public function get_display_strategy(){ |
|
276 | + public function get_display_strategy() { |
|
277 | 277 | return $this->_display_strategy; |
278 | 278 | } |
279 | 279 | /** |
280 | 280 | * Overwrites the display strategy |
281 | 281 | * @param EE_Display_Strategy_Base $display_strategy |
282 | 282 | */ |
283 | - public function set_display_strategy($display_strategy){ |
|
283 | + public function set_display_strategy($display_strategy) { |
|
284 | 284 | $this->_display_strategy = $display_strategy; |
285 | 285 | $this->_display_strategy->_construct_finalize($this); |
286 | 286 | } |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | * Gets the normalization strategy set on this input |
289 | 289 | * @return EE_Normalization_Strategy_Base |
290 | 290 | */ |
291 | - public function get_normalization_strategy(){ |
|
291 | + public function get_normalization_strategy() { |
|
292 | 292 | return $this->_normalization_strategy; |
293 | 293 | } |
294 | 294 | /** |
295 | 295 | * Overwrites the normalization strategy |
296 | 296 | * @param EE_Normalization_Strategy_Base $normalization_strategy |
297 | 297 | */ |
298 | - public function set_normalization_strategy($normalization_strategy){ |
|
298 | + public function set_normalization_strategy($normalization_strategy) { |
|
299 | 299 | $this->_normalization_strategy = $normalization_strategy; |
300 | 300 | $this->_normalization_strategy->_construct_finalize($this); |
301 | 301 | } |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | * Returns all teh validation strategies which apply to this field, numerically indexed |
305 | 305 | * @return EE_Validation_Strategy_Base[] |
306 | 306 | */ |
307 | - public function get_validation_strategies(){ |
|
308 | - if(is_array($this->_validation_strategies)){ |
|
307 | + public function get_validation_strategies() { |
|
308 | + if (is_array($this->_validation_strategies)) { |
|
309 | 309 | return $this->_validation_strategies; |
310 | - }else{ |
|
310 | + } else { |
|
311 | 311 | return array(); |
312 | 312 | } |
313 | 313 | |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | * @param EE_Validation_Strategy_Base $validation_strategy |
318 | 318 | * @return void |
319 | 319 | */ |
320 | - protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){ |
|
321 | - $validation_strategy->_construct_finalize( $this ); |
|
322 | - $this->_validation_strategies[ get_class($validation_strategy) ] = $validation_strategy; |
|
320 | + protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
321 | + $validation_strategy->_construct_finalize($this); |
|
322 | + $this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -327,18 +327,18 @@ discard block |
||
327 | 327 | * @param EE_Validation_Strategy_Base $validation_strategy |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) { |
|
331 | - $this->_add_validation_strategy( $validation_strategy ); |
|
330 | + public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) { |
|
331 | + $this->_add_validation_strategy($validation_strategy); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
335 | 335 | * The classname of the validation strategy to remove |
336 | 336 | * @param string $validation_strategy_classname |
337 | 337 | */ |
338 | - public function remove_validation_strategy( $validation_strategy_classname ) { |
|
339 | - foreach( $this->_validation_strategies as $key => $validation_strategy ){ |
|
340 | - if( is_subclass_of( $validation_strategy, $validation_strategy_classname ) ){ |
|
341 | - unset( $this->_validation_strategies[ $key ] ); |
|
338 | + public function remove_validation_strategy($validation_strategy_classname) { |
|
339 | + foreach ($this->_validation_strategies as $key => $validation_strategy) { |
|
340 | + if (is_subclass_of($validation_strategy, $validation_strategy_classname)) { |
|
341 | + unset($this->_validation_strategies[$key]); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * to the parent form's layout strategy |
348 | 348 | * @return string |
349 | 349 | */ |
350 | - public function get_html_and_js(){ |
|
350 | + public function get_html_and_js() { |
|
351 | 351 | return $this->_parent_section->get_html_for_input($this); |
352 | 352 | } |
353 | 353 | /** |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * Makes sure the JS and CSS are enqueued for it |
357 | 357 | * @return string |
358 | 358 | */ |
359 | - public function get_html_for_input(){ |
|
359 | + public function get_html_for_input() { |
|
360 | 360 | return $this->_get_display_strategy()->display(); |
361 | 361 | } |
362 | 362 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @return string |
367 | 367 | */ |
368 | 368 | public function html_other_attributes() { |
369 | - return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : ''; |
|
369 | + return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : ''; |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | /** |
375 | 375 | * @param string $html_other_attributes |
376 | 376 | */ |
377 | - public function set_html_other_attributes( $html_other_attributes ) { |
|
377 | + public function set_html_other_attributes($html_other_attributes) { |
|
378 | 378 | $this->_html_other_attributes = $html_other_attributes; |
379 | 379 | } |
380 | 380 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * according to the form section's layout strategy |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - public function get_html_for_label(){ |
|
386 | + public function get_html_for_label() { |
|
387 | 387 | return $this->_parent_section->get_layout_strategy()->display_label($this); |
388 | 388 | } |
389 | 389 | /** |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * according to the form section's layout strategy |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - public function get_html_for_errors(){ |
|
394 | + public function get_html_for_errors() { |
|
395 | 395 | return $this->_parent_section->get_layout_strategy()->display_errors($this); |
396 | 396 | } |
397 | 397 | /** |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * according to the form section's layout strategy |
400 | 400 | * @return string |
401 | 401 | */ |
402 | - public function get_html_for_help(){ |
|
402 | + public function get_html_for_help() { |
|
403 | 403 | return $this->_parent_section->get_layout_strategy()->display_help_text($this); |
404 | 404 | } |
405 | 405 | /** |
@@ -408,20 +408,20 @@ discard block |
||
408 | 408 | * @return boolean |
409 | 409 | */ |
410 | 410 | protected function _validate() { |
411 | - if(is_array($this->_validation_strategies)){ |
|
412 | - foreach($this->_validation_strategies as $validation_strategy){ |
|
413 | - if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) { |
|
414 | - try{ |
|
411 | + if (is_array($this->_validation_strategies)) { |
|
412 | + foreach ($this->_validation_strategies as $validation_strategy) { |
|
413 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
414 | + try { |
|
415 | 415 | $validation_strategy->validate($this->normalized_value()); |
416 | - }catch(EE_Validation_Error $e){ |
|
416 | + } catch (EE_Validation_Error $e) { |
|
417 | 417 | $this->add_validation_error($e); |
418 | 418 | } |
419 | 419 | } |
420 | 420 | } |
421 | 421 | } |
422 | - if( $this->get_validation_errors()){ |
|
422 | + if ($this->get_validation_errors()) { |
|
423 | 423 | return false; |
424 | - }else{ |
|
424 | + } else { |
|
425 | 425 | return true; |
426 | 426 | } |
427 | 427 | } |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | * @param string $value |
435 | 435 | * @return null|string |
436 | 436 | */ |
437 | - private function _sanitize($value){ |
|
438 | - return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field |
|
437 | + private function _sanitize($value) { |
|
438 | + return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -447,24 +447,24 @@ discard block |
||
447 | 447 | * @param array $req_data like $_POST |
448 | 448 | * @return boolean whether or not there was an error |
449 | 449 | */ |
450 | - protected function _normalize( $req_data ) { |
|
450 | + protected function _normalize($req_data) { |
|
451 | 451 | //any existing validation errors don't apply so clear them |
452 | 452 | $this->_validation_errors = array(); |
453 | 453 | try { |
454 | - $raw_input = $this->find_form_data_for_this_section( $req_data ); |
|
454 | + $raw_input = $this->find_form_data_for_this_section($req_data); |
|
455 | 455 | //super simple sanitization for now |
456 | - if ( is_array( $raw_input )) { |
|
456 | + if (is_array($raw_input)) { |
|
457 | 457 | $this->_raw_value = array(); |
458 | - foreach( $raw_input as $key => $value ) { |
|
459 | - $this->_raw_value[ $key ] = $this->_sanitize( $value ); |
|
458 | + foreach ($raw_input as $key => $value) { |
|
459 | + $this->_raw_value[$key] = $this->_sanitize($value); |
|
460 | 460 | } |
461 | 461 | } else { |
462 | - $this->_raw_value = $this->_sanitize( $raw_input ); |
|
462 | + $this->_raw_value = $this->_sanitize($raw_input); |
|
463 | 463 | } |
464 | 464 | //we want ot mostly leave the input alone in case we need to re-display it to the user |
465 | - $this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() ); |
|
466 | - } catch ( EE_Validation_Error $e ) { |
|
467 | - $this->add_validation_error( $e ); |
|
465 | + $this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value()); |
|
466 | + } catch (EE_Validation_Error $e) { |
|
467 | + $this->add_validation_error($e); |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | /** |
474 | 474 | * @return string |
475 | 475 | */ |
476 | - public function html_name(){ |
|
476 | + public function html_name() { |
|
477 | 477 | return $this->_html_name; |
478 | 478 | } |
479 | 479 | |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | /** |
483 | 483 | * @return string |
484 | 484 | */ |
485 | - function html_label_id(){ |
|
486 | - return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl'; |
|
485 | + function html_label_id() { |
|
486 | + return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl'; |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | /** |
492 | 492 | * @return string |
493 | 493 | */ |
494 | - function html_label_class(){ |
|
494 | + function html_label_class() { |
|
495 | 495 | return $this->_html_label_class; |
496 | 496 | } |
497 | 497 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | /** |
501 | 501 | * @return string |
502 | 502 | */ |
503 | - function html_label_style(){ |
|
503 | + function html_label_style() { |
|
504 | 504 | return $this->_html_label_style; |
505 | 505 | } |
506 | 506 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | /** |
510 | 510 | * @return string |
511 | 511 | */ |
512 | - function html_label_text(){ |
|
512 | + function html_label_text() { |
|
513 | 513 | return $this->_html_label_text; |
514 | 514 | } |
515 | 515 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | /** |
519 | 519 | * @return string |
520 | 520 | */ |
521 | - function html_help_text(){ |
|
521 | + function html_help_text() { |
|
522 | 522 | return $this->_html_help_text; |
523 | 523 | } |
524 | 524 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | /** |
528 | 528 | * @return string |
529 | 529 | */ |
530 | - function html_help_class(){ |
|
530 | + function html_help_class() { |
|
531 | 531 | return $this->_html_help_class; |
532 | 532 | } |
533 | 533 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | /** |
537 | 537 | * @return string |
538 | 538 | */ |
539 | - function html_help_style(){ |
|
539 | + function html_help_style() { |
|
540 | 540 | return $this->_html_style; |
541 | 541 | } |
542 | 542 | /** |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * in which case, we would have stored the malicious content to our database. |
550 | 550 | * @return string |
551 | 551 | */ |
552 | - function raw_value(){ |
|
552 | + function raw_value() { |
|
553 | 553 | return $this->_raw_value; |
554 | 554 | } |
555 | 555 | /** |
@@ -557,15 +557,15 @@ discard block |
||
557 | 557 | * it escapes all html entities |
558 | 558 | * @return string |
559 | 559 | */ |
560 | - function raw_value_in_form(){ |
|
561 | - return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8'); |
|
560 | + function raw_value_in_form() { |
|
561 | + return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8'); |
|
562 | 562 | } |
563 | 563 | /** |
564 | 564 | * returns the value after it's been sanitized, and then converted into it's proper type |
565 | 565 | * in PHP. Eg, a string, an int, an array, |
566 | 566 | * @return mixed |
567 | 567 | */ |
568 | - function normalized_value(){ |
|
568 | + function normalized_value() { |
|
569 | 569 | return $this->_normalized_value; |
570 | 570 | } |
571 | 571 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * the best thing to display |
576 | 576 | * @return string |
577 | 577 | */ |
578 | - function pretty_value(){ |
|
578 | + function pretty_value() { |
|
579 | 579 | return $this->_normalized_value; |
580 | 580 | } |
581 | 581 | /** |
@@ -594,19 +594,19 @@ discard block |
||
594 | 594 | }</code> |
595 | 595 | * @return array |
596 | 596 | */ |
597 | - function get_jquery_validation_rules(){ |
|
597 | + function get_jquery_validation_rules() { |
|
598 | 598 | |
599 | 599 | $jquery_validation_rules = array(); |
600 | - foreach($this->get_validation_strategies() as $validation_strategy){ |
|
600 | + foreach ($this->get_validation_strategies() as $validation_strategy) { |
|
601 | 601 | $jquery_validation_rules = array_replace_recursive( |
602 | 602 | $jquery_validation_rules, |
603 | 603 | $validation_strategy->get_jquery_validation_rule_array() |
604 | 604 | ); |
605 | 605 | } |
606 | 606 | |
607 | - if(! empty($jquery_validation_rules)){ |
|
608 | - $jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules; |
|
609 | - }else{ |
|
607 | + if ( ! empty($jquery_validation_rules)) { |
|
608 | + $jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules; |
|
609 | + } else { |
|
610 | 610 | return array(); |
611 | 611 | } |
612 | 612 | return $jquery_validation_js; |
@@ -618,9 +618,9 @@ discard block |
||
618 | 618 | * @param mixed $value |
619 | 619 | * @return void |
620 | 620 | */ |
621 | - function set_default($value){ |
|
621 | + function set_default($value) { |
|
622 | 622 | $this->_normalized_value = $value; |
623 | - $this->_raw_value = $this->_normalization_strategy->unnormalize( $value ); |
|
623 | + $this->_raw_value = $this->_normalization_strategy->unnormalize($value); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * @param string $label |
629 | 629 | * @return void |
630 | 630 | */ |
631 | - function set_html_label_text($label){ |
|
631 | + function set_html_label_text($label) { |
|
632 | 632 | $this->_html_label_text = $label; |
633 | 633 | } |
634 | 634 | |
@@ -640,12 +640,12 @@ discard block |
||
640 | 640 | * @param boolean $required |
641 | 641 | * @param null $required_text |
642 | 642 | */ |
643 | - function set_required($required = true, $required_text = NULL ){ |
|
644 | - $required = filter_var( $required, FILTER_VALIDATE_BOOLEAN ); |
|
645 | - if ( $required ) { |
|
646 | - $this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) ); |
|
643 | + function set_required($required = true, $required_text = NULL) { |
|
644 | + $required = filter_var($required, FILTER_VALIDATE_BOOLEAN); |
|
645 | + if ($required) { |
|
646 | + $this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text)); |
|
647 | 647 | } else { |
648 | - unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] ); |
|
648 | + unset($this->_validation_strategies['EE_Required_Validation_Strategy']); |
|
649 | 649 | } |
650 | 650 | $this->_required = $required; |
651 | 651 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * Returns whether or not this field is required |
654 | 654 | * @return boolean |
655 | 655 | */ |
656 | - public function required(){ |
|
656 | + public function required() { |
|
657 | 657 | return $this->_required; |
658 | 658 | } |
659 | 659 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | /** |
663 | 663 | * @param string $required_css_class |
664 | 664 | */ |
665 | - public function set_required_css_class( $required_css_class ) { |
|
665 | + public function set_required_css_class($required_css_class) { |
|
666 | 666 | $this->_required_css_class = $required_css_class; |
667 | 667 | } |
668 | 668 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * Sets the help text, in case |
682 | 682 | * @param string $text |
683 | 683 | */ |
684 | - public function set_html_help_text($text){ |
|
684 | + public function set_html_help_text($text) { |
|
685 | 685 | $this->_html_help_text = $text; |
686 | 686 | } |
687 | 687 | /** |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | public function clean_sensitive_data() { |
694 | 694 | //if we do ANY kind of sensitive data removal on this, then just clear out the raw value |
695 | 695 | //if we need more logic than this we'll make a strategy for it |
696 | - if( $this->_sensitive_data_removal_strategy && |
|
697 | - ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){ |
|
696 | + if ($this->_sensitive_data_removal_strategy && |
|
697 | + ! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) { |
|
698 | 698 | $this->_raw_value = NULL; |
699 | 699 | } |
700 | 700 | //and clean the normalized value according to the appropriate strategy |
@@ -708,10 +708,10 @@ discard block |
||
708 | 708 | * @param string $button_size |
709 | 709 | * @param string $other_attributes |
710 | 710 | */ |
711 | - public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) { |
|
711 | + public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') { |
|
712 | 712 | $button_css_attributes = 'button'; |
713 | 713 | $button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary'; |
714 | - switch ( $button_size ) { |
|
714 | + switch ($button_size) { |
|
715 | 715 | case 'xs' : |
716 | 716 | case 'extra-small' : |
717 | 717 | $button_css_attributes .= ' button-xs'; |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | default : |
733 | 733 | $button_css_attributes .= ''; |
734 | 734 | } |
735 | - $this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes; |
|
735 | + $this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes; |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | * @return string |
742 | 742 | */ |
743 | 743 | public function button_css_attributes() { |
744 | - if ( empty( $this->_button_css_attributes )) { |
|
744 | + if (empty($this->_button_css_attributes)) { |
|
745 | 745 | $this->set_button_css_attributes(); |
746 | 746 | } |
747 | 747 | return $this->_button_css_attributes; |
@@ -761,27 +761,27 @@ discard block |
||
761 | 761 | * @param array $req_data |
762 | 762 | * @return mixed whatever the raw value of this form section is in the request data |
763 | 763 | */ |
764 | - public function find_form_data_for_this_section( $req_data ){ |
|
764 | + public function find_form_data_for_this_section($req_data) { |
|
765 | 765 | // break up the html name by "[]" |
766 | - if ( strpos( $this->html_name(), '[' ) !== FALSE ) { |
|
767 | - $before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') ); |
|
766 | + if (strpos($this->html_name(), '[') !== FALSE) { |
|
767 | + $before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '[')); |
|
768 | 768 | } else { |
769 | 769 | $before_any_brackets = $this->html_name(); |
770 | 770 | } |
771 | 771 | // grab all of the segments |
772 | - preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches); |
|
773 | - if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){ |
|
774 | - $name_parts = $matches[ 1 ]; |
|
772 | + preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches); |
|
773 | + if (isset($matches[1]) && is_array($matches[1])) { |
|
774 | + $name_parts = $matches[1]; |
|
775 | 775 | array_unshift($name_parts, $before_any_brackets); |
776 | - }else{ |
|
777 | - $name_parts = array( $before_any_brackets ); |
|
776 | + } else { |
|
777 | + $name_parts = array($before_any_brackets); |
|
778 | 778 | } |
779 | 779 | // now get the value for the input |
780 | 780 | $value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data); |
781 | - if( $value === NULL ){ |
|
781 | + if ($value === NULL) { |
|
782 | 782 | //check if this thing's name is at the TOP level of the request data |
783 | - if( isset( $req_data[ $this->name() ] ) ){ |
|
784 | - $value = $req_data[ $this->name() ]; |
|
783 | + if (isset($req_data[$this->name()])) { |
|
784 | + $value = $req_data[$this->name()]; |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | return $value; |
@@ -795,15 +795,15 @@ discard block |
||
795 | 795 | * @param array $req_data |
796 | 796 | * @return array | NULL |
797 | 797 | */ |
798 | - public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){ |
|
799 | - $first_part_to_consider = array_shift( $html_name_parts ); |
|
800 | - if( isset( $req_data[ $first_part_to_consider ] ) ){ |
|
801 | - if( empty($html_name_parts ) ){ |
|
802 | - return $req_data[ $first_part_to_consider ]; |
|
803 | - }else{ |
|
804 | - return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] ); |
|
798 | + public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) { |
|
799 | + $first_part_to_consider = array_shift($html_name_parts); |
|
800 | + if (isset($req_data[$first_part_to_consider])) { |
|
801 | + if (empty($html_name_parts)) { |
|
802 | + return $req_data[$first_part_to_consider]; |
|
803 | + } else { |
|
804 | + return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]); |
|
805 | 805 | } |
806 | - }else{ |
|
806 | + } else { |
|
807 | 807 | return NULL; |
808 | 808 | } |
809 | 809 | } |
@@ -815,14 +815,14 @@ discard block |
||
815 | 815 | * @param array $req_data like $_POST |
816 | 816 | * @return boolean |
817 | 817 | */ |
818 | - public function form_data_present_in($req_data = NULL){ |
|
819 | - if( $req_data === NULL ){ |
|
818 | + public function form_data_present_in($req_data = NULL) { |
|
819 | + if ($req_data === NULL) { |
|
820 | 820 | $req_data = $_POST; |
821 | 821 | } |
822 | - $checked_value = $this->find_form_data_for_this_section( $req_data ); |
|
823 | - if( $checked_value !== null ){ |
|
822 | + $checked_value = $this->find_form_data_for_this_section($req_data); |
|
823 | + if ($checked_value !== null) { |
|
824 | 824 | return TRUE; |
825 | - }else{ |
|
825 | + } else { |
|
826 | 826 | return FALSE; |
827 | 827 | } |
828 | 828 | } |
@@ -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 |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | * @access public |
145 | 145 | * @return void |
146 | 146 | */ |
147 | - public function __construct( $routing = TRUE ) { |
|
147 | + public function __construct($routing = TRUE) { |
|
148 | 148 | |
149 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
149 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
150 | 150 | $this->_is_caf = TRUE; |
151 | 151 | |
152 | 152 | $this->_yes_no_values = array( |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | //set the _req_data property. |
160 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
160 | + $this->_req_data = array_merge($_GET, $_POST); |
|
161 | 161 | |
162 | 162 | |
163 | 163 | //routing enabled? |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $this->_do_other_page_hooks(); |
179 | 179 | |
180 | 180 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
181 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
181 | + if (method_exists($this, '_before_page_setup')) |
|
182 | 182 | $this->_before_page_setup(); |
183 | 183 | |
184 | 184 | //set up page dependencies |
@@ -448,16 +448,16 @@ discard block |
||
448 | 448 | */ |
449 | 449 | protected function _global_ajax_hooks() { |
450 | 450 | //for lazy loading of metabox content |
451 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
451 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | |
455 | 455 | |
456 | 456 | public function ajax_metabox_content() { |
457 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
458 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
457 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
458 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
459 | 459 | |
460 | - self::cached_rss_display( $contentid, $url ); |
|
460 | + self::cached_rss_display($contentid, $url); |
|
461 | 461 | wp_die(); |
462 | 462 | } |
463 | 463 | |
@@ -478,87 +478,87 @@ discard block |
||
478 | 478 | |
479 | 479 | |
480 | 480 | //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. |
481 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
481 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
482 | 482 | |
483 | 483 | |
484 | 484 | //next verify if we need to load anything... |
485 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE; |
|
486 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
485 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE; |
|
486 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
487 | 487 | |
488 | 488 | global $ee_menu_slugs; |
489 | 489 | $ee_menu_slugs = (array) $ee_menu_slugs; |
490 | 490 | |
491 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
491 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
492 | 492 | |
493 | 493 | |
494 | 494 | // 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 |
495 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
496 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
495 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
496 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
497 | 497 | } |
498 | 498 | // then set blank or -1 action values to 'default' |
499 | - $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'; |
|
499 | + $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 | 500 | |
501 | 501 | //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. |
502 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
502 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
503 | 503 | |
504 | 504 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
505 | 505 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
506 | 506 | |
507 | 507 | $this->_current_view = $this->_req_action; |
508 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
508 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
509 | 509 | $this->_define_page_props(); |
510 | 510 | |
511 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
511 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
512 | 512 | |
513 | 513 | //default things |
514 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
514 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
515 | 515 | |
516 | 516 | //set page configs |
517 | 517 | $this->_set_page_routes(); |
518 | 518 | $this->_set_page_config(); |
519 | 519 | |
520 | 520 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
521 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
521 | + if (isset($this->_req_data['wp_referer'])) { |
|
522 | 522 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
523 | 523 | } |
524 | 524 | |
525 | 525 | //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 |
526 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
526 | + if (method_exists($this, '_extend_page_config')) |
|
527 | 527 | $this->_extend_page_config(); |
528 | 528 | |
529 | 529 | //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. |
530 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
530 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
531 | 531 | $this->_extend_page_config_for_cpt(); |
532 | 532 | |
533 | 533 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
534 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
535 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
534 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
535 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
536 | 536 | |
537 | 537 | |
538 | 538 | //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 |
539 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
540 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
539 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
540 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
544 | 544 | //next route only if routing enabled |
545 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
545 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
546 | 546 | |
547 | 547 | $this->_verify_routes(); |
548 | 548 | |
549 | 549 | //next let's just check user_access and kill if no access |
550 | 550 | $this->check_user_access(); |
551 | 551 | |
552 | - if ( $this->_is_UI_request ) { |
|
552 | + if ($this->_is_UI_request) { |
|
553 | 553 | //admin_init stuff - global, all views for this page class, specific view |
554 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
555 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
556 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
554 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
555 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
556 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | } else { |
560 | 560 | //hijack regular WP loading and route admin request immediately |
561 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
561 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
562 | 562 | $this->route_admin_request(); |
563 | 563 | } |
564 | 564 | } |
@@ -575,18 +575,18 @@ discard block |
||
575 | 575 | * @return void |
576 | 576 | */ |
577 | 577 | private function _do_other_page_hooks() { |
578 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
578 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
579 | 579 | |
580 | - foreach ( $registered_pages as $page ) { |
|
580 | + foreach ($registered_pages as $page) { |
|
581 | 581 | |
582 | 582 | //now let's setup the file name and class that should be present |
583 | 583 | $classname = str_replace('.class.php', '', $page); |
584 | 584 | |
585 | 585 | //autoloaders should take care of loading file |
586 | - if ( !class_exists( $classname ) ) { |
|
587 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
588 | - $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 ); |
|
589 | - throw new EE_Error( implode( '||', $error_msg )); |
|
586 | + if ( ! class_exists($classname)) { |
|
587 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
588 | + $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); |
|
589 | + throw new EE_Error(implode('||', $error_msg)); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | $a = new ReflectionClass($classname); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | public function load_page_dependencies() { |
602 | 602 | try { |
603 | 603 | $this->_load_page_dependencies(); |
604 | - } catch ( EE_Error $e ) { |
|
604 | + } catch (EE_Error $e) { |
|
605 | 605 | $e->get_error(); |
606 | 606 | } |
607 | 607 | } |
@@ -619,16 +619,16 @@ discard block |
||
619 | 619 | $this->_current_screen = get_current_screen(); |
620 | 620 | |
621 | 621 | //load admin_notices - global, page class, and view specific |
622 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
623 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
624 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
625 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
622 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
623 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
624 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
625 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | //load network admin_notices - global, page class, and view specific |
629 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
630 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
631 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
629 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
630 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
631 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | //this will save any per_page screen options if they are present |
@@ -644,8 +644,8 @@ discard block |
||
644 | 644 | //add screen options - global, page child class, and view specific |
645 | 645 | $this->_add_global_screen_options(); |
646 | 646 | $this->_add_screen_options(); |
647 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
648 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
647 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
648 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
649 | 649 | |
650 | 650 | |
651 | 651 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -656,33 +656,33 @@ discard block |
||
656 | 656 | //add feature_pointers - global, page child class, and view specific |
657 | 657 | $this->_add_feature_pointers(); |
658 | 658 | $this->_add_global_feature_pointers(); |
659 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | //enqueue scripts/styles - global, page class, and view specific |
663 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
664 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
665 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
666 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
663 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
664 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
665 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
666 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
667 | 667 | |
668 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
668 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
669 | 669 | |
670 | 670 | //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 |
671 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
672 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
673 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
674 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
671 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
672 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
673 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
674 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
675 | 675 | |
676 | 676 | //admin footer scripts |
677 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
678 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
679 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
680 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
677 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
678 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
679 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
680 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
681 | 681 | |
682 | 682 | |
683 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
683 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
684 | 684 | //targeted hook |
685 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
685 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
686 | 686 | |
687 | 687 | } |
688 | 688 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | private function _set_defaults() { |
698 | 698 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
699 | 699 | |
700 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
700 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
701 | 701 | |
702 | 702 | $this->default_nav_tab_name = 'overview'; |
703 | 703 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | public function route_admin_request() { |
725 | 725 | try { |
726 | 726 | $this->_route_admin_request(); |
727 | - } catch ( EE_Error $e ) { |
|
727 | + } catch (EE_Error $e) { |
|
728 | 728 | $e->get_error(); |
729 | 729 | } |
730 | 730 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $this->_wp_page_slug = $wp_page_slug; |
736 | 736 | |
737 | 737 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
738 | - if ( is_network_admin() ) { |
|
738 | + if (is_network_admin()) { |
|
739 | 739 | $this->_wp_page_slug .= '-network'; |
740 | 740 | } |
741 | 741 | } |
@@ -748,53 +748,53 @@ discard block |
||
748 | 748 | * @return void |
749 | 749 | */ |
750 | 750 | protected function _verify_routes() { |
751 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
751 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
752 | 752 | |
753 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
753 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
754 | 754 | |
755 | 755 | $this->_route = FALSE; |
756 | 756 | $func = FALSE; |
757 | 757 | $args = array(); |
758 | 758 | |
759 | 759 | // check that the page_routes array is not empty |
760 | - if ( empty( $this->_page_routes )) { |
|
760 | + if (empty($this->_page_routes)) { |
|
761 | 761 | // user error msg |
762 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
762 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
763 | 763 | // developer error msg |
764 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
765 | - throw new EE_Error( $error_msg ); |
|
764 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
765 | + throw new EE_Error($error_msg); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | // and that the requested page route exists |
769 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
770 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
769 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
770 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
771 | 771 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
772 | 772 | } else { |
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $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 ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $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); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that a default route exists |
781 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
781 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
782 | 782 | // user error msg |
783 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
783 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
784 | 784 | // developer error msg |
785 | - $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' ); |
|
786 | - throw new EE_Error( $error_msg ); |
|
785 | + $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'); |
|
786 | + throw new EE_Error($error_msg); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | |
790 | 790 | //first lets' catch if the UI request has EVER been set. |
791 | - if ( $this->_is_UI_request === NULL ) { |
|
791 | + if ($this->_is_UI_request === NULL) { |
|
792 | 792 | //lets set if this is a UI request or not. |
793 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
793 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
794 | 794 | |
795 | 795 | |
796 | 796 | //wait a minute... we might have a noheader in the route array |
797 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
797 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | $this->_set_current_labels(); |
@@ -809,15 +809,15 @@ discard block |
||
809 | 809 | * @param string $route the route name we're verifying |
810 | 810 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
811 | 811 | */ |
812 | - protected function _verify_route( $route ) { |
|
813 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
812 | + protected function _verify_route($route) { |
|
813 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
814 | 814 | return true; |
815 | 815 | } else { |
816 | 816 | // user error msg |
817 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
817 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
818 | 818 | // developer error msg |
819 | - $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 ); |
|
820 | - throw new EE_Error( $error_msg ); |
|
819 | + $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); |
|
820 | + throw new EE_Error($error_msg); |
|
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
@@ -831,18 +831,18 @@ discard block |
||
831 | 831 | * @param string $nonce_ref The nonce reference string (name0) |
832 | 832 | * @return mixed (bool|die) |
833 | 833 | */ |
834 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
834 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
835 | 835 | // verify nonce against expected value |
836 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
836 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
837 | 837 | // these are not the droids you are looking for !!! |
838 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
839 | - if ( WP_DEBUG ) { |
|
840 | - $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__ ); |
|
838 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
839 | + if (WP_DEBUG) { |
|
840 | + $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__); |
|
841 | 841 | } |
842 | - if ( ! defined( 'DOING_AJAX' )) { |
|
843 | - wp_die( $msg ); |
|
842 | + if ( ! defined('DOING_AJAX')) { |
|
843 | + wp_die($msg); |
|
844 | 844 | } else { |
845 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
845 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
846 | 846 | $this->_return_json(); |
847 | 847 | } |
848 | 848 | } |
@@ -860,63 +860,63 @@ discard block |
||
860 | 860 | * @return void |
861 | 861 | */ |
862 | 862 | protected function _route_admin_request() { |
863 | - if ( ! $this->_is_UI_request ) |
|
863 | + if ( ! $this->_is_UI_request) |
|
864 | 864 | $this->_verify_routes(); |
865 | 865 | |
866 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
866 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
867 | 867 | |
868 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
868 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
869 | 869 | // set nonce from post data |
870 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
871 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
870 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
871 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
872 | 872 | } |
873 | 873 | //set the nav_tabs array but ONLY if this is UI_request |
874 | - if ( $this->_is_UI_request ) |
|
874 | + if ($this->_is_UI_request) |
|
875 | 875 | $this->_set_nav_tabs(); |
876 | 876 | |
877 | 877 | // grab callback function |
878 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
878 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
879 | 879 | |
880 | 880 | // check if callback has args |
881 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
881 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
882 | 882 | |
883 | 883 | $error_msg = ''; |
884 | 884 | |
885 | 885 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
886 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
887 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
886 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
887 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
888 | 888 | } |
889 | 889 | |
890 | 890 | //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). |
891 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
891 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
892 | 892 | |
893 | - if ( ! empty( $func )) { |
|
893 | + if ( ! empty($func)) { |
|
894 | 894 | $base_call = $addon_call = FALSE; |
895 | 895 | //try to access page route via this class |
896 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
896 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
897 | 897 | // user error msg |
898 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
898 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
899 | 899 | // developer error msg |
900 | - $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 ); |
|
900 | + $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 | 901 | } |
902 | 902 | |
903 | 903 | //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) |
904 | 904 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
905 | 905 | |
906 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
907 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
908 | - $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 ); |
|
906 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
907 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
908 | + $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); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | |
912 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
913 | - throw new EE_Error( $error_msg ); |
|
912 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
913 | + throw new EE_Error($error_msg); |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | //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. |
917 | 917 | //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. |
918 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
919 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
918 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
919 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | * @param string $new_route New (non header) route to redirect to. |
933 | 933 | * @return void |
934 | 934 | */ |
935 | - protected function _reset_routing_properties( $new_route ) { |
|
935 | + protected function _reset_routing_properties($new_route) { |
|
936 | 936 | $this->_is_UI_request = TRUE; |
937 | 937 | //now we set the current route to whatever the headers_sent_route is set at |
938 | 938 | $this->_req_data['action'] = $new_route; |
@@ -978,24 +978,24 @@ discard block |
||
978 | 978 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
979 | 979 | * @return string |
980 | 980 | */ |
981 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
981 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
982 | 982 | EE_Registry::instance()->load_helper('URL'); |
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,13 +1206,13 @@ 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 | EE_Registry::instance()->load_helper('Qtip_Loader', array(), TRUE); |
1213 | 1213 | $path = array( |
1214 | - $this->_get_dir() . '/qtips/', |
|
1215 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1214 | + $this->_get_dir().'/qtips/', |
|
1215 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1216 | 1216 | ); |
1217 | 1217 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1218 | 1218 | } |
@@ -1229,41 +1229,41 @@ discard block |
||
1229 | 1229 | * @return void |
1230 | 1230 | */ |
1231 | 1231 | protected function _set_nav_tabs() { |
1232 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1232 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1233 | 1233 | $i = 0; |
1234 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1235 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1234 | + foreach ($this->_page_config as $slug => $config) { |
|
1235 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1236 | 1236 | continue; //no nav tab for this config |
1237 | 1237 | |
1238 | 1238 | //check for persistent flag |
1239 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1239 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1240 | 1240 | continue; //nav tab is only to appear when route requested. |
1241 | 1241 | |
1242 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1242 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1243 | 1243 | continue; //no nav tab becasue current user does not have access. |
1244 | 1244 | |
1245 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1245 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1246 | 1246 | $this->_nav_tabs[$slug] = array( |
1247 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1248 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1249 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1250 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1247 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1248 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1249 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1250 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1251 | 1251 | ); |
1252 | 1252 | $i++; |
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | //if $this->_nav_tabs is empty then lets set the default |
1256 | - if ( empty( $this->_nav_tabs ) ) { |
|
1256 | + if (empty($this->_nav_tabs)) { |
|
1257 | 1257 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1258 | 1258 | 'url' => $this->admin_base_url, |
1259 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1259 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1260 | 1260 | 'css_class' => 'nav-tab-active', |
1261 | 1261 | 'order' => 10 |
1262 | 1262 | ); |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | //now let's sort the tabs according to order |
1266 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1266 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1267 | 1267 | |
1268 | 1268 | } |
1269 | 1269 | |
@@ -1279,10 +1279,10 @@ discard block |
||
1279 | 1279 | * @return void |
1280 | 1280 | */ |
1281 | 1281 | private function _set_current_labels() { |
1282 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1283 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1284 | - if ( is_array($text) ) { |
|
1285 | - foreach ( $text as $sublabel => $subtext ) { |
|
1282 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1283 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1284 | + if (is_array($text)) { |
|
1285 | + foreach ($text as $sublabel => $subtext) { |
|
1286 | 1286 | $this->_labels[$label][$sublabel] = $subtext; |
1287 | 1287 | } |
1288 | 1288 | } else { |
@@ -1303,24 +1303,24 @@ discard block |
||
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 | 1304 | * @return BOOL|wp_die() |
1305 | 1305 | */ |
1306 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1307 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1308 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1309 | - $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; |
|
1306 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1307 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1308 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1309 | + $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; |
|
1310 | 1310 | |
1311 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1312 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1311 | + if (empty($capability) && empty($route_to_check)) { |
|
1312 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1313 | 1313 | } else { |
1314 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1314 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1317 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1318 | 1318 | |
1319 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1320 | - if ( $verify_only ) { |
|
1319 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1320 | + if ($verify_only) { |
|
1321 | 1321 | return FALSE; |
1322 | 1322 | } else { |
1323 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1323 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 | return TRUE; |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | $this->_add_admin_page_overlay(); |
1398 | 1398 | |
1399 | 1399 | //if metaboxes are present we need to add the nonce field |
1400 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1400 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1401 | 1401 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1402 | 1402 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1403 | 1403 | } |
@@ -1416,20 +1416,20 @@ discard block |
||
1416 | 1416 | */ |
1417 | 1417 | public function admin_footer_global() { |
1418 | 1418 | //dialog container for dialog helper |
1419 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1419 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1420 | 1420 | $d_cont .= '<div class="ee-notices"></div>'; |
1421 | 1421 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1422 | 1422 | $d_cont .= '</div>'; |
1423 | 1423 | echo $d_cont; |
1424 | 1424 | |
1425 | 1425 | //help tour stuff? |
1426 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1426 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1427 | 1427 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | //current set timezone for timezone js |
1431 | 1431 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1432 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1432 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1433 | 1433 | } |
1434 | 1434 | |
1435 | 1435 | |
@@ -1453,18 +1453,18 @@ discard block |
||
1453 | 1453 | * @access protected |
1454 | 1454 | * @return string content |
1455 | 1455 | */ |
1456 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1456 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1457 | 1457 | $content = ''; |
1458 | 1458 | |
1459 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1460 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1459 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1460 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1461 | 1461 | |
1462 | 1462 | |
1463 | 1463 | //loop through the array and setup content |
1464 | - foreach ( $help_array as $trigger => $help ) { |
|
1464 | + foreach ($help_array as $trigger => $help) { |
|
1465 | 1465 | //make sure the array is setup properly |
1466 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1467 | - 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 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1467 | + 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')); |
|
1468 | 1468 | } |
1469 | 1469 | |
1470 | 1470 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1474,10 +1474,10 @@ discard block |
||
1474 | 1474 | 'help_popup_content' => $help['content'] |
1475 | 1475 | ); |
1476 | 1476 | |
1477 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1477 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1478 | 1478 | } |
1479 | 1479 | |
1480 | - if ( $display ) |
|
1480 | + if ($display) |
|
1481 | 1481 | echo $content; |
1482 | 1482 | else |
1483 | 1483 | return $content; |
@@ -1494,18 +1494,18 @@ discard block |
||
1494 | 1494 | */ |
1495 | 1495 | private function _get_help_content() { |
1496 | 1496 | //what is the method we're looking for? |
1497 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1497 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1498 | 1498 | |
1499 | 1499 | //if method doesn't exist let's get out. |
1500 | - if ( !method_exists( $this, $method_name ) ) |
|
1500 | + if ( ! method_exists($this, $method_name)) |
|
1501 | 1501 | return array(); |
1502 | 1502 | |
1503 | 1503 | //k we're good to go let's retrieve the help array |
1504 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1504 | + $help_array = call_user_func(array($this, $method_name)); |
|
1505 | 1505 | |
1506 | 1506 | //make sure we've got an array! |
1507 | - if ( !is_array($help_array) ) { |
|
1508 | - 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 | + if ( ! is_array($help_array)) { |
|
1508 | + 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')); |
|
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | return $help_array; |
@@ -1527,27 +1527,27 @@ discard block |
||
1527 | 1527 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1528 | 1528 | * @return string |
1529 | 1529 | */ |
1530 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1530 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1531 | 1531 | |
1532 | - if ( defined('DOING_AJAX') ) return; |
|
1532 | + if (defined('DOING_AJAX')) return; |
|
1533 | 1533 | |
1534 | 1534 | //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 |
1535 | 1535 | $help_array = $this->_get_help_content(); |
1536 | 1536 | $help_content = ''; |
1537 | 1537 | |
1538 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1538 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1539 | 1539 | $help_array[$trigger_id] = array( |
1540 | 1540 | 'title' => __('Missing Content', 'event_espresso'), |
1541 | 1541 | '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') |
1542 | 1542 | ); |
1543 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1543 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1544 | 1544 | } |
1545 | 1545 | |
1546 | 1546 | //let's setup the trigger |
1547 | - $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>'; |
|
1548 | - $content = $content . $help_content; |
|
1547 | + $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>'; |
|
1548 | + $content = $content.$help_content; |
|
1549 | 1549 | |
1550 | - if ( $display ) |
|
1550 | + if ($display) |
|
1551 | 1551 | echo $content; |
1552 | 1552 | else |
1553 | 1553 | return $content; |
@@ -1604,15 +1604,15 @@ discard block |
||
1604 | 1604 | public function load_global_scripts_styles() { |
1605 | 1605 | /** STYLES **/ |
1606 | 1606 | // add debugging styles |
1607 | - if ( WP_DEBUG ) { |
|
1608 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1607 | + if (WP_DEBUG) { |
|
1608 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | //register all styles |
1612 | - 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 ); |
|
1613 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1612 | + 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); |
|
1613 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1614 | 1614 | //helpers styles |
1615 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1615 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1616 | 1616 | //enqueue global styles |
1617 | 1617 | wp_enqueue_style('ee-admin-css'); |
1618 | 1618 | |
@@ -1620,66 +1620,66 @@ discard block |
||
1620 | 1620 | /** SCRIPTS **/ |
1621 | 1621 | |
1622 | 1622 | //register all scripts |
1623 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1624 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1625 | - 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 ); |
|
1623 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1624 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1625 | + 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); |
|
1626 | 1626 | |
1627 | - 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 ); |
|
1627 | + 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); |
|
1628 | 1628 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1629 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1629 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1630 | 1630 | add_filter('FHEE_load_joyride', '__return_true'); |
1631 | 1631 | |
1632 | 1632 | //script for sorting tables |
1633 | - 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); |
|
1633 | + 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); |
|
1634 | 1634 | //script for parsing uri's |
1635 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1635 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1636 | 1636 | //and parsing associative serialized form elements |
1637 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1637 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1638 | 1638 | //helpers scripts |
1639 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1640 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1641 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1642 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1639 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1640 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1641 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1642 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | |
1644 | 1644 | //google charts |
1645 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1645 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1646 | 1646 | |
1647 | 1647 | //enqueue global scripts |
1648 | 1648 | |
1649 | 1649 | //taking care of metaboxes |
1650 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1650 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1651 | 1651 | wp_enqueue_script('dashboard'); |
1652 | 1652 | } |
1653 | 1653 | |
1654 | 1654 | //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 |
1655 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1655 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1656 | 1656 | wp_enqueue_script('ee_admin_js'); |
1657 | 1657 | wp_enqueue_style('ee-admin-css'); |
1658 | 1658 | } |
1659 | 1659 | |
1660 | 1660 | |
1661 | 1661 | //localize script for ajax lazy loading |
1662 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1663 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1662 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1663 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1664 | 1664 | |
1665 | 1665 | |
1666 | 1666 | /** |
1667 | 1667 | * help tour stuff |
1668 | 1668 | */ |
1669 | - if ( !empty( $this->_help_tour ) ) { |
|
1669 | + if ( ! empty($this->_help_tour)) { |
|
1670 | 1670 | |
1671 | 1671 | //register the js for kicking things off |
1672 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1672 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1673 | 1673 | |
1674 | 1674 | //setup tours for the js tour object |
1675 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1675 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1676 | 1676 | $tours[] = array( |
1677 | 1677 | 'id' => $tour->get_slug(), |
1678 | 1678 | 'options' => $tour->get_options() |
1679 | 1679 | ); |
1680 | 1680 | } |
1681 | 1681 | |
1682 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1682 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1683 | 1683 | |
1684 | 1684 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1685 | 1685 | } |
@@ -1697,52 +1697,52 @@ discard block |
||
1697 | 1697 | public function admin_footer_scripts_eei18n_js_strings() { |
1698 | 1698 | |
1699 | 1699 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1700 | - 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' ); |
|
1701 | - |
|
1702 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1703 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1704 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1705 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1706 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1707 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1708 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1709 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1710 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1711 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1726 | - |
|
1727 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1735 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1736 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1700 | + 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'); |
|
1701 | + |
|
1702 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1703 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1704 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1705 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1706 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1707 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1708 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1709 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1710 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1711 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1726 | + |
|
1727 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1735 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1736 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1741 | 1741 | |
1742 | 1742 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1743 | 1743 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1744 | 1744 | //espresso_core is listed as a dependency of ee_admin_js. |
1745 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1745 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1746 | 1746 | |
1747 | 1747 | } |
1748 | 1748 | |
@@ -1776,23 +1776,23 @@ discard block |
||
1776 | 1776 | protected function _set_list_table() { |
1777 | 1777 | |
1778 | 1778 | //first is this a list_table view? |
1779 | - if ( !isset($this->_route_config['list_table']) ) |
|
1779 | + if ( ! isset($this->_route_config['list_table'])) |
|
1780 | 1780 | return; //not a list_table view so get out. |
1781 | 1781 | |
1782 | 1782 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1783 | 1783 | |
1784 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1784 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1785 | 1785 | //user error msg |
1786 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1786 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1787 | 1787 | //developer error msg |
1788 | - $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 ); |
|
1789 | - throw new EE_Error( $error_msg ); |
|
1788 | + $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); |
|
1789 | + throw new EE_Error($error_msg); |
|
1790 | 1790 | } |
1791 | 1791 | |
1792 | 1792 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1793 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1794 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1795 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1793 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1794 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1795 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1796 | 1796 | |
1797 | 1797 | $this->_set_list_table_view(); |
1798 | 1798 | $this->_set_list_table_object(); |
@@ -1814,14 +1814,14 @@ discard block |
||
1814 | 1814 | * @return array |
1815 | 1815 | */ |
1816 | 1816 | protected function _set_list_table_view() { |
1817 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1817 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1818 | 1818 | |
1819 | 1819 | |
1820 | 1820 | // looking at active items or dumpster diving ? |
1821 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1822 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1821 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1822 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1823 | 1823 | } else { |
1824 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1824 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1825 | 1825 | } |
1826 | 1826 | } |
1827 | 1827 | |
@@ -1832,9 +1832,9 @@ discard block |
||
1832 | 1832 | * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of. |
1833 | 1833 | */ |
1834 | 1834 | protected function _set_list_table_object() { |
1835 | - if ( isset($this->_route_config['list_table'] ) ) { |
|
1836 | - if ( !class_exists( $this->_route_config['list_table'] ) ) |
|
1837 | - 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) ) ); |
|
1835 | + if (isset($this->_route_config['list_table'])) { |
|
1836 | + if ( ! class_exists($this->_route_config['list_table'])) |
|
1837 | + 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))); |
|
1838 | 1838 | $a = new ReflectionClass($this->_route_config['list_table']); |
1839 | 1839 | $this->_list_table_object = $a->newInstance($this); |
1840 | 1840 | } |
@@ -1853,27 +1853,27 @@ discard block |
||
1853 | 1853 | * |
1854 | 1854 | * @return array |
1855 | 1855 | */ |
1856 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1856 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1857 | 1857 | |
1858 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1858 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1859 | 1859 | |
1860 | - if ( empty( $this->_views )) { |
|
1860 | + if (empty($this->_views)) { |
|
1861 | 1861 | $this->_views = array(); |
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | // cycle thru views |
1865 | - foreach ( $this->_views as $key => $view ) { |
|
1865 | + foreach ($this->_views as $key => $view) { |
|
1866 | 1866 | $query_args = array(); |
1867 | 1867 | // check for current view |
1868 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1868 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1869 | 1869 | $query_args['action'] = $this->_req_action; |
1870 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1870 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1871 | 1871 | $query_args['status'] = $view['slug']; |
1872 | 1872 | //merge any other arguments sent in. |
1873 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1874 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1873 | + if (isset($extra_query_args[$view['slug']])) { |
|
1874 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1875 | 1875 | } |
1876 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1876 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1877 | 1877 | } |
1878 | 1878 | |
1879 | 1879 | return $this->_views; |
@@ -1890,15 +1890,15 @@ discard block |
||
1890 | 1890 | * @param int $max_entries total number of rows in the table |
1891 | 1891 | * @return string |
1892 | 1892 | */ |
1893 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1893 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1894 | 1894 | |
1895 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1896 | - $values = array( 10, 25, 50, 100 ); |
|
1897 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1895 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1896 | + $values = array(10, 25, 50, 100); |
|
1897 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1898 | 1898 | |
1899 | - if ( $max_entries ) { |
|
1899 | + if ($max_entries) { |
|
1900 | 1900 | $values[] = $max_entries; |
1901 | - sort( $values ); |
|
1901 | + sort($values); |
|
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | $entries_per_page_dropdown = ' |
@@ -1907,15 +1907,15 @@ discard block |
||
1907 | 1907 | Show |
1908 | 1908 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1909 | 1909 | |
1910 | - foreach ( $values as $value ) { |
|
1911 | - if ( $value < $max_entries ) { |
|
1912 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1910 | + foreach ($values as $value) { |
|
1911 | + if ($value < $max_entries) { |
|
1912 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1913 | 1913 | $entries_per_page_dropdown .= ' |
1914 | 1914 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1915 | 1915 | } |
1916 | 1916 | } |
1917 | 1917 | |
1918 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1918 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1919 | 1919 | $entries_per_page_dropdown .= ' |
1920 | 1920 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1921 | 1921 | |
@@ -1938,8 +1938,8 @@ discard block |
||
1938 | 1938 | * @return void |
1939 | 1939 | */ |
1940 | 1940 | public function _set_search_attributes() { |
1941 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1942 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1941 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1942 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1943 | 1943 | } |
1944 | 1944 | |
1945 | 1945 | /*** END LIST TABLE METHODS **/ |
@@ -1958,20 +1958,20 @@ discard block |
||
1958 | 1958 | * @return void |
1959 | 1959 | */ |
1960 | 1960 | private function _add_registered_meta_boxes() { |
1961 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1961 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1962 | 1962 | |
1963 | 1963 | //we only add meta boxes if the page_route calls for it |
1964 | - if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) { |
|
1964 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) { |
|
1965 | 1965 | |
1966 | 1966 | |
1967 | 1967 | //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. |
1968 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1969 | - if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) { |
|
1968 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1969 | + if (call_user_func(array($this, &$metabox_callback)) === FALSE) { |
|
1970 | 1970 | // user error msg |
1971 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
1971 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
1972 | 1972 | // developer error msg |
1973 | - $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 ); |
|
1974 | - throw new EE_Error( $error_msg ); |
|
1973 | + $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); |
|
1974 | + throw new EE_Error($error_msg); |
|
1975 | 1975 | } |
1976 | 1976 | } |
1977 | 1977 | } |
@@ -1988,17 +1988,17 @@ discard block |
||
1988 | 1988 | * @return void |
1989 | 1989 | */ |
1990 | 1990 | private function _add_screen_columns() { |
1991 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
1991 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
1992 | 1992 | |
1993 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
1993 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
1994 | 1994 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
1995 | 1995 | $screen_id = $this->_current_screen->id; |
1996 | 1996 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
1997 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
1998 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
1997 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
1998 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
1999 | 1999 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2000 | 2000 | $this->_template_args['screen'] = $this->_current_screen; |
2001 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2001 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2002 | 2002 | |
2003 | 2003 | //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. |
2004 | 2004 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2015,11 +2015,11 @@ discard block |
||
2015 | 2015 | */ |
2016 | 2016 | |
2017 | 2017 | private function _espresso_news_post_box() { |
2018 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2019 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2018 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2019 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2020 | 2020 | $this, |
2021 | 2021 | 'espresso_news_post_box' |
2022 | - ), $this->_wp_page_slug, 'side' ); |
|
2022 | + ), $this->_wp_page_slug, 'side'); |
|
2023 | 2023 | } |
2024 | 2024 | |
2025 | 2025 | |
@@ -2027,14 +2027,14 @@ discard block |
||
2027 | 2027 | * Code for setting up espresso ratings request metabox. |
2028 | 2028 | */ |
2029 | 2029 | protected function _espresso_ratings_request() { |
2030 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2030 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2031 | 2031 | return ''; |
2032 | 2032 | } |
2033 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2034 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2033 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2034 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2035 | 2035 | $this, |
2036 | 2036 | 'espresso_ratings_request' |
2037 | - ), $this->_wp_page_slug, 'side' ); |
|
2037 | + ), $this->_wp_page_slug, 'side'); |
|
2038 | 2038 | } |
2039 | 2039 | |
2040 | 2040 | |
@@ -2042,35 +2042,35 @@ discard block |
||
2042 | 2042 | * Code for setting up espresso ratings request metabox content. |
2043 | 2043 | */ |
2044 | 2044 | public function espresso_ratings_request() { |
2045 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2046 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
2047 | - EEH_Template::display_template( $template_path, array() ); |
|
2045 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2046 | + EE_Registry::instance()->load_helper('Template'); |
|
2047 | + EEH_Template::display_template($template_path, array()); |
|
2048 | 2048 | } |
2049 | 2049 | |
2050 | 2050 | |
2051 | 2051 | |
2052 | 2052 | |
2053 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2054 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2055 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2056 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2057 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2058 | - $post = '</div>' . "\n"; |
|
2053 | + public static function cached_rss_display($rss_id, $url) { |
|
2054 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2055 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2056 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2057 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2058 | + $post = '</div>'."\n"; |
|
2059 | 2059 | |
2060 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2061 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2062 | - echo $pre . $output . $post; |
|
2060 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2061 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2062 | + echo $pre.$output.$post; |
|
2063 | 2063 | return TRUE; |
2064 | 2064 | } |
2065 | 2065 | |
2066 | - if ( ! $doing_ajax ) { |
|
2067 | - echo $pre . $loading . $post; |
|
2066 | + if ( ! $doing_ajax) { |
|
2067 | + echo $pre.$loading.$post; |
|
2068 | 2068 | return FALSE; |
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | ob_start(); |
2072 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2073 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2072 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2073 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2074 | 2074 | return TRUE; |
2075 | 2075 | |
2076 | 2076 | } |
@@ -2082,13 +2082,13 @@ discard block |
||
2082 | 2082 | <div id="espresso_news_post_box_content" class="infolinks"> |
2083 | 2083 | <?php |
2084 | 2084 | // Get RSS Feed(s) |
2085 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2085 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2086 | 2086 | $url = urlencode($feed_url); |
2087 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2087 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2088 | 2088 | |
2089 | 2089 | ?> |
2090 | 2090 | </div> |
2091 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2091 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2092 | 2092 | </div> |
2093 | 2093 | <?php |
2094 | 2094 | } |
@@ -2109,32 +2109,32 @@ discard block |
||
2109 | 2109 | |
2110 | 2110 | protected function _espresso_sponsors_post_box() { |
2111 | 2111 | |
2112 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2113 | - if ( $show_sponsors ) |
|
2114 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2112 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2113 | + if ($show_sponsors) |
|
2114 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | |
2118 | 2118 | public function espresso_sponsors_post_box() { |
2119 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2120 | - EEH_Template::display_template( $templatepath ); |
|
2119 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2120 | + EEH_Template::display_template($templatepath); |
|
2121 | 2121 | } |
2122 | 2122 | |
2123 | 2123 | |
2124 | 2124 | |
2125 | 2125 | private function _publish_post_box() { |
2126 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2126 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2127 | 2127 | |
2128 | 2128 | //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) |
2129 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2130 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2129 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2130 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2131 | 2131 | } else { |
2132 | 2132 | $box_label = __('Publish', 'event_espresso'); |
2133 | 2133 | } |
2134 | 2134 | |
2135 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2135 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2136 | 2136 | |
2137 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2137 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2138 | 2138 | |
2139 | 2139 | } |
2140 | 2140 | |
@@ -2142,9 +2142,9 @@ discard block |
||
2142 | 2142 | |
2143 | 2143 | public function editor_overview() { |
2144 | 2144 | //if we have extra content set let's add it in if not make sure its empty |
2145 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2146 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2147 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2145 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2146 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2147 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2148 | 2148 | } |
2149 | 2149 | |
2150 | 2150 | |
@@ -2160,8 +2160,8 @@ discard block |
||
2160 | 2160 | * @see $this->_set_publish_post_box_vars for param details |
2161 | 2161 | * @since 4.6.0 |
2162 | 2162 | */ |
2163 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2164 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2163 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2164 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2165 | 2165 | } |
2166 | 2166 | |
2167 | 2167 | |
@@ -2180,24 +2180,24 @@ discard block |
||
2180 | 2180 | * @param string $post_save_redirect_URL custom URL to redirect to after Save & Close has been completed |
2181 | 2181 | * @param boolean $both_btns whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button |
2182 | 2182 | */ |
2183 | - protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) { |
|
2183 | + protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) { |
|
2184 | 2184 | |
2185 | 2185 | // if Save & Close, use a custom redirect URL or default to the main page? |
2186 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2186 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2187 | 2187 | // create the Save & Close and Save buttons |
2188 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2188 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2189 | 2189 | //if we have extra content set let's add it in if not make sure its empty |
2190 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2190 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2191 | 2191 | |
2192 | 2192 | |
2193 | - if ( $delete && ! empty( $id ) ) { |
|
2193 | + if ($delete && ! empty($id)) { |
|
2194 | 2194 | $delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent. |
2195 | - $delete_link_args = array( $name => $id ); |
|
2196 | - $delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2195 | + $delete_link_args = array($name => $id); |
|
2196 | + $delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2197 | 2197 | } |
2198 | 2198 | |
2199 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2200 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2199 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2200 | + if ( ! empty($name) && ! empty($id)) { |
|
2201 | 2201 | $hidden_field_arr[$name] = array( |
2202 | 2202 | 'type' => 'hidden', |
2203 | 2203 | 'value' => $id |
@@ -2207,7 +2207,7 @@ discard block |
||
2207 | 2207 | $hf = ''; |
2208 | 2208 | } |
2209 | 2209 | // add hidden field |
2210 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2210 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2211 | 2211 | |
2212 | 2212 | } |
2213 | 2213 | |
@@ -2224,8 +2224,8 @@ discard block |
||
2224 | 2224 | <noscript> |
2225 | 2225 | <div id="no-js-message" class="error"> |
2226 | 2226 | <p style="font-size:1.3em;"> |
2227 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2228 | - <?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' ); ?> |
|
2227 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2228 | + <?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'); ?> |
|
2229 | 2229 | </p> |
2230 | 2230 | </div> |
2231 | 2231 | </noscript> |
@@ -2245,7 +2245,7 @@ discard block |
||
2245 | 2245 | * @return string |
2246 | 2246 | */ |
2247 | 2247 | private function _display_espresso_notices() { |
2248 | - $notices = $this->_get_transient( TRUE ); |
|
2248 | + $notices = $this->_get_transient(TRUE); |
|
2249 | 2249 | echo stripslashes($notices); |
2250 | 2250 | } |
2251 | 2251 | |
@@ -2297,11 +2297,11 @@ discard block |
||
2297 | 2297 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2298 | 2298 | * @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. |
2299 | 2299 | */ |
2300 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2301 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2300 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2301 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2302 | 2302 | |
2303 | 2303 | //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. |
2304 | - if ( empty( $callback_args ) && $create_func ) { |
|
2304 | + if (empty($callback_args) && $create_func) { |
|
2305 | 2305 | $callback_args = array( |
2306 | 2306 | 'template_path' => $this->_template_path, |
2307 | 2307 | 'template_args' => $this->_template_args, |
@@ -2311,7 +2311,7 @@ discard block |
||
2311 | 2311 | //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) |
2312 | 2312 | $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; |
2313 | 2313 | |
2314 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2314 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2315 | 2315 | } |
2316 | 2316 | |
2317 | 2317 | |
@@ -2324,7 +2324,7 @@ discard block |
||
2324 | 2324 | */ |
2325 | 2325 | public function display_admin_page_with_metabox_columns() { |
2326 | 2326 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2327 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2327 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2328 | 2328 | |
2329 | 2329 | //the final wrapper |
2330 | 2330 | $this->admin_page_wrapper(); |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | * @return void |
2368 | 2368 | */ |
2369 | 2369 | public function display_about_admin_page() { |
2370 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2370 | + $this->_display_admin_page(FALSE, TRUE); |
|
2371 | 2371 | } |
2372 | 2372 | |
2373 | 2373 | |
@@ -2383,26 +2383,26 @@ discard block |
||
2383 | 2383 | * @return html admin_page |
2384 | 2384 | */ |
2385 | 2385 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2386 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2386 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2387 | 2387 | |
2388 | 2388 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2389 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2389 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2390 | 2390 | |
2391 | 2391 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2392 | 2392 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2393 | 2393 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2394 | 2394 | |
2395 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2395 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2396 | 2396 | |
2397 | - if ( defined('DOING_AJAX' ) ) |
|
2398 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2397 | + if (defined('DOING_AJAX')) |
|
2398 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2399 | 2399 | |
2400 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2400 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2401 | 2401 | |
2402 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2402 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2403 | 2403 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2404 | 2404 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2405 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2405 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2406 | 2406 | |
2407 | 2407 | |
2408 | 2408 | // the final template wrapper |
@@ -2422,7 +2422,7 @@ discard block |
||
2422 | 2422 | * @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. |
2423 | 2423 | * @return void |
2424 | 2424 | */ |
2425 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2425 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2426 | 2426 | //let's generate a default preview action button if there isn't one already present. |
2427 | 2427 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2428 | 2428 | $buy_now_url = add_query_arg( |
@@ -2435,10 +2435,10 @@ discard block |
||
2435 | 2435 | ), |
2436 | 2436 | 'http://eventespresso.com/pricing/' |
2437 | 2437 | ); |
2438 | - $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']; |
|
2439 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2440 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2441 | - $this->_display_admin_page( $display_sidebar ); |
|
2438 | + $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']; |
|
2439 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2440 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2441 | + $this->_display_admin_page($display_sidebar); |
|
2442 | 2442 | } |
2443 | 2443 | |
2444 | 2444 | |
@@ -2472,41 +2472,41 @@ discard block |
||
2472 | 2472 | * @param boolean $sidebar whether to display with sidebar or not. |
2473 | 2473 | * @return html |
2474 | 2474 | */ |
2475 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2475 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2476 | 2476 | //setup search attributes |
2477 | 2477 | $this->_set_search_attributes(); |
2478 | 2478 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2479 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2479 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2480 | 2480 | |
2481 | - $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); |
|
2481 | + $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); |
|
2482 | 2482 | $this->_template_args['list_table'] = $this->_list_table_object; |
2483 | 2483 | $this->_template_args['current_route'] = $this->_req_action; |
2484 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2484 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2485 | 2485 | |
2486 | 2486 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2487 | - if( ! empty( $ajax_sorting_callback )) { |
|
2488 | - $sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE ); |
|
2487 | + if ( ! empty($ajax_sorting_callback)) { |
|
2488 | + $sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE); |
|
2489 | 2489 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2490 | 2490 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2491 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2492 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2491 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2492 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2493 | 2493 | } else { |
2494 | 2494 | $sortable_list_table_form_fields = ''; |
2495 | 2495 | } |
2496 | 2496 | |
2497 | 2497 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2498 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2499 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2500 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2498 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2499 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2500 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2501 | 2501 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2502 | 2502 | |
2503 | 2503 | //display message about search results? |
2504 | - $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 ); |
|
2504 | + $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); |
|
2505 | 2505 | |
2506 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2506 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2507 | 2507 | |
2508 | 2508 | // the final template wrapper |
2509 | - if ( $sidebar ) |
|
2509 | + if ($sidebar) |
|
2510 | 2510 | $this->display_admin_page_with_sidebar(); |
2511 | 2511 | else |
2512 | 2512 | $this->display_admin_page_with_no_sidebar(); |
@@ -2529,9 +2529,9 @@ discard block |
||
2529 | 2529 | * @param array $items see above for format of array |
2530 | 2530 | * @return string html string of legend |
2531 | 2531 | */ |
2532 | - protected function _display_legend( $items ) { |
|
2533 | - $template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2534 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2532 | + protected function _display_legend($items) { |
|
2533 | + $template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2534 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2535 | 2535 | return EEH_Template::display_template($legend_template, $template_args, TRUE); |
2536 | 2536 | } |
2537 | 2537 | |
@@ -2556,31 +2556,31 @@ discard block |
||
2556 | 2556 | * |
2557 | 2557 | * @return json object |
2558 | 2558 | */ |
2559 | - protected function _return_json( $sticky_notices = FALSE ) { |
|
2559 | + protected function _return_json($sticky_notices = FALSE) { |
|
2560 | 2560 | |
2561 | 2561 | //make sure any EE_Error notices have been handled. |
2562 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2562 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2563 | 2563 | |
2564 | 2564 | |
2565 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2565 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2566 | 2566 | unset($this->_template_args['data']); |
2567 | 2567 | $json = array( |
2568 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : FALSE, |
|
2569 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : FALSE, |
|
2568 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : FALSE, |
|
2569 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : FALSE, |
|
2570 | 2570 | 'notices' => EE_Error::get_notices(), |
2571 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2572 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2571 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2572 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2573 | 2573 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2574 | 2574 | ); |
2575 | 2575 | |
2576 | 2576 | |
2577 | 2577 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2578 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2578 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2579 | 2579 | header('Content-Type: application/json; charset=UTF-8'); |
2580 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2581 | - echo wp_json_encode( $json ); |
|
2580 | + if (function_exists('wp_json_encode')) { |
|
2581 | + echo wp_json_encode($json); |
|
2582 | 2582 | } else { |
2583 | - echo json_encode( $json ); |
|
2583 | + echo json_encode($json); |
|
2584 | 2584 | } |
2585 | 2585 | exit(); |
2586 | 2586 | } |
@@ -2592,11 +2592,11 @@ discard block |
||
2592 | 2592 | * @return json_obj|EE_Error |
2593 | 2593 | */ |
2594 | 2594 | public function return_json() { |
2595 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2595 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2596 | 2596 | $this->_return_json(); |
2597 | 2597 | |
2598 | 2598 | else { |
2599 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2599 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2600 | 2600 | } |
2601 | 2601 | } |
2602 | 2602 | |
@@ -2611,7 +2611,7 @@ discard block |
||
2611 | 2611 | * @access public |
2612 | 2612 | * @return void |
2613 | 2613 | */ |
2614 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2614 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2615 | 2615 | $this->_hook_obj = $hook_obj; |
2616 | 2616 | } |
2617 | 2617 | |
@@ -2627,33 +2627,33 @@ discard block |
||
2627 | 2627 | */ |
2628 | 2628 | public function admin_page_wrapper($about = FALSE) { |
2629 | 2629 | |
2630 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2630 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2631 | 2631 | |
2632 | 2632 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2633 | 2633 | |
2634 | 2634 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2635 | 2635 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2636 | 2636 | |
2637 | - $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'] : ''); |
|
2638 | - $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'] : ''); |
|
2637 | + $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'] : ''); |
|
2638 | + $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'] : ''); |
|
2639 | 2639 | |
2640 | 2640 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2641 | 2641 | |
2642 | 2642 | |
2643 | 2643 | |
2644 | 2644 | // load settings page wrapper template |
2645 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2645 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2646 | 2646 | |
2647 | 2647 | //about page? |
2648 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2648 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2649 | 2649 | |
2650 | 2650 | |
2651 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2652 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2651 | + if (defined('DOING_AJAX')) { |
|
2652 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2653 | 2653 | |
2654 | 2654 | $this->_return_json(); |
2655 | 2655 | } else { |
2656 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2656 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2657 | 2657 | } |
2658 | 2658 | |
2659 | 2659 | } |
@@ -2666,7 +2666,7 @@ discard block |
||
2666 | 2666 | */ |
2667 | 2667 | protected function _get_main_nav_tabs() { |
2668 | 2668 | //let's generate the html using the EEH_Tabbed_Content helper. We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute (rather than setting in the page_routes array) |
2669 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
2669 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
2670 | 2670 | return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs); |
2671 | 2671 | } |
2672 | 2672 | |
@@ -2682,7 +2682,7 @@ discard block |
||
2682 | 2682 | * @access public |
2683 | 2683 | * @return void |
2684 | 2684 | */ |
2685 | - private function _sort_nav_tabs( $a, $b ) { |
|
2685 | + private function _sort_nav_tabs($a, $b) { |
|
2686 | 2686 | if ($a['order'] == $b['order']) { |
2687 | 2687 | return 0; |
2688 | 2688 | } |
@@ -2703,8 +2703,8 @@ discard block |
||
2703 | 2703 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2704 | 2704 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2705 | 2705 | */ |
2706 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2707 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2706 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2707 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
2708 | 2708 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2709 | 2709 | return $content; |
2710 | 2710 | } |
@@ -2726,25 +2726,25 @@ discard block |
||
2726 | 2726 | * @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. |
2727 | 2727 | * @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). |
2728 | 2728 | */ |
2729 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2729 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2730 | 2730 | //make sure $text and $actions are in an array |
2731 | 2731 | $text = (array) $text; |
2732 | 2732 | $actions = (array) $actions; |
2733 | 2733 | $referrer_url = empty($referrer) ? '' : $referrer; |
2734 | - $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 .'" />'; |
|
2734 | + $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.'" />'; |
|
2735 | 2735 | |
2736 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2737 | - $default_names = array( 'save', 'save_and_close' ); |
|
2736 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2737 | + $default_names = array('save', 'save_and_close'); |
|
2738 | 2738 | |
2739 | 2739 | //add in a hidden index for the current page (so save and close redirects properly) |
2740 | 2740 | $this->_template_args['save_buttons'] = $referrer_url; |
2741 | 2741 | |
2742 | - foreach ( $button_text as $key => $button ) { |
|
2742 | + foreach ($button_text as $key => $button) { |
|
2743 | 2743 | $ref = $default_names[$key]; |
2744 | - $id = $this->_current_view . '_' . $ref; |
|
2745 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2746 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2747 | - if ( !$both ) break; |
|
2744 | + $id = $this->_current_view.'_'.$ref; |
|
2745 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2746 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2747 | + if ( ! $both) break; |
|
2748 | 2748 | } |
2749 | 2749 | |
2750 | 2750 | } |
@@ -2757,8 +2757,8 @@ discard block |
||
2757 | 2757 | * @since 4.6.0 |
2758 | 2758 | * |
2759 | 2759 | */ |
2760 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2761 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2760 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2761 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2762 | 2762 | } |
2763 | 2763 | |
2764 | 2764 | |
@@ -2771,30 +2771,30 @@ discard block |
||
2771 | 2771 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2772 | 2772 | * @return void |
2773 | 2773 | */ |
2774 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2774 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2775 | 2775 | |
2776 | - if ( empty( $route )) { |
|
2776 | + if (empty($route)) { |
|
2777 | 2777 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2778 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2779 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2778 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2779 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2780 | 2780 | } |
2781 | 2781 | // open form |
2782 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2782 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2783 | 2783 | // add nonce |
2784 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2784 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2785 | 2785 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2786 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2786 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2787 | 2787 | // add REQUIRED form action |
2788 | 2788 | $hidden_fields = array( |
2789 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2789 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2790 | 2790 | ); |
2791 | 2791 | // merge arrays |
2792 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2792 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2793 | 2793 | // generate form fields |
2794 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2794 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2795 | 2795 | // add fields to form |
2796 | - foreach ( $form_fields as $field_name => $form_field ) { |
|
2797 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2796 | + foreach ($form_fields as $field_name => $form_field) { |
|
2797 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2798 | 2798 | } |
2799 | 2799 | |
2800 | 2800 | // close form |
@@ -2811,8 +2811,8 @@ discard block |
||
2811 | 2811 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2812 | 2812 | * @since 4.5.0 |
2813 | 2813 | */ |
2814 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2815 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2814 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2815 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2816 | 2816 | } |
2817 | 2817 | |
2818 | 2818 | |
@@ -2827,32 +2827,32 @@ discard block |
||
2827 | 2827 | * @access protected |
2828 | 2828 | * @return void |
2829 | 2829 | */ |
2830 | - protected function _redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2830 | + protected function _redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2831 | 2831 | |
2832 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2832 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2833 | 2833 | |
2834 | 2834 | //class name for actions/filters. |
2835 | 2835 | $classname = get_class($this); |
2836 | 2836 | |
2837 | 2837 | //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 |
2838 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2839 | - $notices = EE_Error::get_notices( FALSE ); |
|
2838 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2839 | + $notices = EE_Error::get_notices(FALSE); |
|
2840 | 2840 | |
2841 | 2841 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2842 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2842 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2843 | 2843 | EE_Error::overwrite_success(); |
2844 | 2844 | } |
2845 | 2845 | // how many records affected ? more than one record ? or just one ? |
2846 | - if ( $success > 1 && empty( $notices['errors'] )) { |
|
2846 | + if ($success > 1 && empty($notices['errors'])) { |
|
2847 | 2847 | // set plural msg |
2848 | - EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__); |
|
2849 | - } else if ( $success == 1 && empty( $notices['errors'] )) { |
|
2848 | + EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2849 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2850 | 2850 | // set singular msg |
2851 | - EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ ); |
|
2851 | + EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2852 | 2852 | } |
2853 | 2853 | |
2854 | 2854 | // check that $query_args isn't something crazy |
2855 | - if ( ! is_array( $query_args )) { |
|
2855 | + if ( ! is_array($query_args)) { |
|
2856 | 2856 | $query_args = array(); |
2857 | 2857 | } |
2858 | 2858 | |
@@ -2865,36 +2865,36 @@ discard block |
||
2865 | 2865 | * @param array $query_args The original query_args array coming into the |
2866 | 2866 | * method. |
2867 | 2867 | */ |
2868 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2868 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2869 | 2869 | |
2870 | 2870 | //calculate where we're going (if we have a "save and close" button pushed) |
2871 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2871 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2872 | 2872 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2873 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2873 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2874 | 2874 | // regenerate query args array from refferer URL |
2875 | - parse_str( $parsed_url['query'], $query_args ); |
|
2875 | + parse_str($parsed_url['query'], $query_args); |
|
2876 | 2876 | // correct page and action will be in the query args now |
2877 | - $redirect_url = admin_url( 'admin.php' ); |
|
2877 | + $redirect_url = admin_url('admin.php'); |
|
2878 | 2878 | } |
2879 | 2879 | |
2880 | 2880 | //merge any default query_args set in _default_route_query_args property |
2881 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2881 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2882 | 2882 | $args_to_merge = array(); |
2883 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2883 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2884 | 2884 | //is there a wp_referer array in our _default_route_query_args property? |
2885 | - if ( $query_param == 'wp_referer' ) { |
|
2885 | + if ($query_param == 'wp_referer') { |
|
2886 | 2886 | $query_value = (array) $query_value; |
2887 | - foreach ( $query_value as $reference => $value ) { |
|
2888 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2887 | + foreach ($query_value as $reference => $value) { |
|
2888 | + if (strpos($reference, 'nonce') !== false) { |
|
2889 | 2889 | continue; |
2890 | 2890 | } |
2891 | 2891 | |
2892 | 2892 | //finally we will override any arguments in the referer with |
2893 | 2893 | //what might be set on the _default_route_query_args array. |
2894 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2895 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2894 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2895 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2896 | 2896 | } else { |
2897 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2897 | + $args_to_merge[$reference] = urlencode($value); |
|
2898 | 2898 | } |
2899 | 2899 | } |
2900 | 2900 | continue; |
@@ -2905,7 +2905,7 @@ discard block |
||
2905 | 2905 | |
2906 | 2906 | //now let's merge these arguments but override with what was specifically sent in to the |
2907 | 2907 | //redirect. |
2908 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
2908 | + $query_args = array_merge($args_to_merge, $query_args); |
|
2909 | 2909 | } |
2910 | 2910 | |
2911 | 2911 | $this->_process_notices($query_args); |
@@ -2914,19 +2914,19 @@ discard block |
||
2914 | 2914 | // generate redirect url |
2915 | 2915 | |
2916 | 2916 | // if redirecting to anything other than the main page, add a nonce |
2917 | - if ( isset( $query_args['action'] )) { |
|
2917 | + if (isset($query_args['action'])) { |
|
2918 | 2918 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
2919 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
2919 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
2920 | 2920 | } |
2921 | 2921 | |
2922 | 2922 | //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). |
2923 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
2923 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
2924 | 2924 | |
2925 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
2925 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
2926 | 2926 | |
2927 | 2927 | |
2928 | 2928 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
2929 | - if ( defined('DOING_AJAX' ) ) { |
|
2929 | + if (defined('DOING_AJAX')) { |
|
2930 | 2930 | $default_data = array( |
2931 | 2931 | 'close' => TRUE, |
2932 | 2932 | 'redirect_url' => $redirect_url, |
@@ -2935,11 +2935,11 @@ discard block |
||
2935 | 2935 | ); |
2936 | 2936 | |
2937 | 2937 | $this->_template_args['success'] = $success; |
2938 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
2938 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
2939 | 2939 | $this->_return_json(); |
2940 | 2940 | } |
2941 | 2941 | |
2942 | - wp_safe_redirect( $redirect_url ); |
|
2942 | + wp_safe_redirect($redirect_url); |
|
2943 | 2943 | exit(); |
2944 | 2944 | } |
2945 | 2945 | |
@@ -2955,14 +2955,14 @@ discard block |
||
2955 | 2955 | * @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. |
2956 | 2956 | * @return void |
2957 | 2957 | */ |
2958 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
2958 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
2959 | 2959 | |
2960 | 2960 | $this->_template_args['notices'] = EE_Error::get_notices(); |
2961 | 2961 | |
2962 | 2962 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
2963 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
2964 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
2965 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
2963 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
2964 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
2965 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
2966 | 2966 | } |
2967 | 2967 | } |
2968 | 2968 | |
@@ -2984,32 +2984,32 @@ discard block |
||
2984 | 2984 | * |
2985 | 2985 | * @return string html for button |
2986 | 2986 | */ |
2987 | - public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) { |
|
2987 | + public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) { |
|
2988 | 2988 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
2989 | - if ( !isset($this->_page_routes[$action]) && !$base_url ) |
|
2990 | - throw new EE_Error( sprintf( __('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action) ); |
|
2989 | + if ( ! isset($this->_page_routes[$action]) && ! $base_url) |
|
2990 | + throw new EE_Error(sprintf(__('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action)); |
|
2991 | 2991 | |
2992 | - if ( !isset( $this->_labels['buttons'][$type] ) ) |
|
2993 | - 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) ); |
|
2992 | + if ( ! isset($this->_labels['buttons'][$type])) |
|
2993 | + 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)); |
|
2994 | 2994 | |
2995 | 2995 | //finally check user access for this button. |
2996 | - $has_access = $this->check_user_access( $action, TRUE ); |
|
2997 | - if ( ! $has_access ) { |
|
2996 | + $has_access = $this->check_user_access($action, TRUE); |
|
2997 | + if ( ! $has_access) { |
|
2998 | 2998 | return ''; |
2999 | 2999 | } |
3000 | 3000 | |
3001 | - $_base_url = !$base_url ? $this->_admin_base_url : $base_url; |
|
3001 | + $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
|
3002 | 3002 | |
3003 | 3003 | $query_args = array( |
3004 | 3004 | 'action' => $action ); |
3005 | 3005 | |
3006 | 3006 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3007 | - if ( !empty($extra_request) ) |
|
3008 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3007 | + if ( ! empty($extra_request)) |
|
3008 | + $query_args = array_merge($extra_request, $query_args); |
|
3009 | 3009 | |
3010 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3010 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3011 | 3011 | |
3012 | - $button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class ); |
|
3012 | + $button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3013 | 3013 | |
3014 | 3014 | return $button; |
3015 | 3015 | } |
@@ -3029,11 +3029,11 @@ discard block |
||
3029 | 3029 | $args = array( |
3030 | 3030 | 'label' => $this->_admin_page_title, |
3031 | 3031 | 'default' => 10, |
3032 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3032 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3033 | 3033 | ); |
3034 | 3034 | //ONLY add the screen option if the user has access to it. |
3035 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3036 | - add_screen_option( $option, $args ); |
|
3035 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3036 | + add_screen_option($option, $args); |
|
3037 | 3037 | } |
3038 | 3038 | } |
3039 | 3039 | |
@@ -3049,36 +3049,36 @@ discard block |
||
3049 | 3049 | * @return void |
3050 | 3050 | */ |
3051 | 3051 | private function _set_per_page_screen_options() { |
3052 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3053 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3052 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3053 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3054 | 3054 | |
3055 | - if ( !$user = wp_get_current_user() ) |
|
3055 | + if ( ! $user = wp_get_current_user()) |
|
3056 | 3056 | return; |
3057 | 3057 | $option = $_POST['wp_screen_options']['option']; |
3058 | 3058 | $value = $_POST['wp_screen_options']['value']; |
3059 | 3059 | |
3060 | - if ( $option != sanitize_key( $option ) ) |
|
3060 | + if ($option != sanitize_key($option)) |
|
3061 | 3061 | return; |
3062 | 3062 | |
3063 | 3063 | $map_option = $option; |
3064 | 3064 | |
3065 | 3065 | $option = str_replace('-', '_', $option); |
3066 | 3066 | |
3067 | - switch ( $map_option ) { |
|
3068 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3067 | + switch ($map_option) { |
|
3068 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3069 | 3069 | $value = (int) $value; |
3070 | - if ( $value < 1 || $value > 999 ) |
|
3070 | + if ($value < 1 || $value > 999) |
|
3071 | 3071 | return; |
3072 | 3072 | break; |
3073 | 3073 | default: |
3074 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3075 | - if ( false === $value ) |
|
3074 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3075 | + if (false === $value) |
|
3076 | 3076 | return; |
3077 | 3077 | break; |
3078 | 3078 | } |
3079 | 3079 | |
3080 | 3080 | update_user_meta($user->ID, $option, $value); |
3081 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3081 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3082 | 3082 | exit; |
3083 | 3083 | } |
3084 | 3084 | } |
@@ -3089,8 +3089,8 @@ discard block |
||
3089 | 3089 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3090 | 3090 | * @param array $data array that will be assigned to template args. |
3091 | 3091 | */ |
3092 | - public function set_template_args( $data ) { |
|
3093 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3092 | + public function set_template_args($data) { |
|
3093 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3094 | 3094 | } |
3095 | 3095 | |
3096 | 3096 | |
@@ -3106,26 +3106,26 @@ discard block |
||
3106 | 3106 | * @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. |
3107 | 3107 | * @return void |
3108 | 3108 | */ |
3109 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3109 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3110 | 3110 | $user_id = get_current_user_id(); |
3111 | 3111 | |
3112 | - if ( !$skip_route_verify ) |
|
3112 | + if ( ! $skip_route_verify) |
|
3113 | 3113 | $this->_verify_route($route); |
3114 | 3114 | |
3115 | 3115 | |
3116 | 3116 | //now let's set the string for what kind of transient we're setting |
3117 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3118 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3117 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3118 | + $data = $notices ? array('notices' => $data) : $data; |
|
3119 | 3119 | //is there already a transient for this route? If there is then let's ADD to that transient |
3120 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3121 | - if ( $existing ) { |
|
3122 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3120 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3121 | + if ($existing) { |
|
3122 | + $data = array_merge((array) $data, (array) $existing); |
|
3123 | 3123 | } |
3124 | 3124 | |
3125 | - if ( is_multisite() && is_network_admin() ) { |
|
3126 | - set_site_transient( $transient, $data, 8 ); |
|
3125 | + if (is_multisite() && is_network_admin()) { |
|
3126 | + set_site_transient($transient, $data, 8); |
|
3127 | 3127 | } else { |
3128 | - set_transient( $transient, $data, 8 ); |
|
3128 | + set_transient($transient, $data, 8); |
|
3129 | 3129 | } |
3130 | 3130 | } |
3131 | 3131 | |
@@ -3137,18 +3137,18 @@ discard block |
||
3137 | 3137 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3138 | 3138 | * @return mixed data |
3139 | 3139 | */ |
3140 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3140 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3141 | 3141 | $user_id = get_current_user_id(); |
3142 | - $route = !$route ? $this->_req_action : $route; |
|
3143 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3144 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3142 | + $route = ! $route ? $this->_req_action : $route; |
|
3143 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3144 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3145 | 3145 | //delete transient after retrieval (just in case it hasn't expired); |
3146 | - if ( is_multisite() && is_network_admin() ) { |
|
3147 | - delete_site_transient( $transient ); |
|
3146 | + if (is_multisite() && is_network_admin()) { |
|
3147 | + delete_site_transient($transient); |
|
3148 | 3148 | } else { |
3149 | - delete_transient( $transient ); |
|
3149 | + delete_transient($transient); |
|
3150 | 3150 | } |
3151 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3151 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3152 | 3152 | } |
3153 | 3153 | |
3154 | 3154 | |
@@ -3165,12 +3165,12 @@ discard block |
||
3165 | 3165 | |
3166 | 3166 | //retrieve all existing transients |
3167 | 3167 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3168 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3169 | - foreach ( $results as $result ) { |
|
3170 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3171 | - get_transient( $transient ); |
|
3172 | - if ( is_multisite() && is_network_admin() ) { |
|
3173 | - get_site_transient( $transient ); |
|
3168 | + if ($results = $wpdb->get_results($query)) { |
|
3169 | + foreach ($results as $result) { |
|
3170 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3171 | + get_transient($transient); |
|
3172 | + if (is_multisite() && is_network_admin()) { |
|
3173 | + get_site_transient($transient); |
|
3174 | 3174 | } |
3175 | 3175 | } |
3176 | 3176 | } |
@@ -3294,23 +3294,23 @@ discard block |
||
3294 | 3294 | * @param string $line line no where error occurred |
3295 | 3295 | * @return boolean |
3296 | 3296 | */ |
3297 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3297 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3298 | 3298 | |
3299 | 3299 | //remove any options that are NOT going to be saved with the config settings. |
3300 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3300 | + if (isset($config->core->ee_ueip_optin)) { |
|
3301 | 3301 | $config->core->ee_ueip_has_notified = TRUE; |
3302 | 3302 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3303 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3304 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3303 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3304 | + update_option('ee_ueip_has_notified', TRUE); |
|
3305 | 3305 | } |
3306 | 3306 | // and save it (note we're also doing the network save here) |
3307 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3308 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3309 | - if ( $config_saved && $net_saved ) { |
|
3310 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3307 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3308 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3309 | + if ($config_saved && $net_saved) { |
|
3310 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3311 | 3311 | return TRUE; |
3312 | 3312 | } else { |
3313 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3313 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3314 | 3314 | return FALSE; |
3315 | 3315 | } |
3316 | 3316 | } |
@@ -3323,7 +3323,7 @@ discard block |
||
3323 | 3323 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3324 | 3324 | * @return array |
3325 | 3325 | */ |
3326 | - public function get_yes_no_values(){ |
|
3326 | + public function get_yes_no_values() { |
|
3327 | 3327 | return $this->_yes_no_values; |
3328 | 3328 | } |
3329 | 3329 | |
@@ -3345,8 +3345,8 @@ discard block |
||
3345 | 3345 | * |
3346 | 3346 | * @return string |
3347 | 3347 | */ |
3348 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3349 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3348 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3349 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3350 | 3350 | } |
3351 | 3351 | |
3352 | 3352 | |
@@ -3360,8 +3360,8 @@ discard block |
||
3360 | 3360 | * |
3361 | 3361 | * @return string |
3362 | 3362 | */ |
3363 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3364 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3363 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3364 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3365 | 3365 | } |
3366 | 3366 | |
3367 | 3367 | |
@@ -3380,8 +3380,8 @@ discard block |
||
3380 | 3380 | * @return bool success/fail |
3381 | 3381 | */ |
3382 | 3382 | protected function _process_resend_registration() { |
3383 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3384 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3383 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3384 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3385 | 3385 | return $this->_template_args['success']; |
3386 | 3386 | } |
3387 | 3387 | |
@@ -3394,9 +3394,9 @@ discard block |
||
3394 | 3394 | * @param \EE_Payment $payment |
3395 | 3395 | * @return bool success/fail |
3396 | 3396 | */ |
3397 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3398 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3399 | - $success = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment ); |
|
3397 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3398 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3399 | + $success = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment); |
|
3400 | 3400 | $this->_template_args['success'] = $success; |
3401 | 3401 | return $success; |
3402 | 3402 | } |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This template will display The Loop that displays your venues |
|
4 | - * |
|
5 | - * @ package Event Espresso |
|
6 | - * @ author Seth Shoultes |
|
7 | - * @ copyright (c) 2008-2013 Event Espresso All Rights Reserved. |
|
8 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | - * @ link http://www.eventespresso.com |
|
10 | - * @ version 4+ |
|
11 | - */ |
|
3 | + * This template will display The Loop that displays your venues |
|
4 | + * |
|
5 | + * @ package Event Espresso |
|
6 | + * @ author Seth Shoultes |
|
7 | + * @ copyright (c) 2008-2013 Event Espresso All Rights Reserved. |
|
8 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | + * @ link http://www.eventespresso.com |
|
10 | + * @ version 4+ |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | if ( have_posts() ) : ?> |
14 | 14 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Single Page Checkout (SPCO) |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage /modules/single_page_checkout/ |
|
7 | - * @author Brent Christensen |
|
8 | - * |
|
9 | - */ |
|
3 | + * Single Page Checkout (SPCO) |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage /modules/single_page_checkout/ |
|
7 | + * @author Brent Christensen |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | class EED_Single_Page_Checkout extends EED_Module { |
11 | 11 | |
12 | 12 |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,21 +176,21 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
187 | - EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf( |
|
188 | - __( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | + EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
|
188 | + __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
189 | 189 | '<h4 class="important-notice">', |
190 | 190 | '</h4>', |
191 | 191 | '<br />', |
192 | 192 | '<p>', |
193 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
193 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
194 | 194 | '">', |
195 | 195 | '</a>', |
196 | 196 | '</p>' |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function load_reg_steps() { |
211 | 211 | static $reg_steps_loaded = FALSE; |
212 | - if ( $reg_steps_loaded ) { |
|
212 | + if ($reg_steps_loaded) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | // filter list of reg_steps |
@@ -218,24 +218,24 @@ discard block |
||
218 | 218 | EED_Single_Page_Checkout::get_reg_steps() |
219 | 219 | ); |
220 | 220 | // sort by key (order) |
221 | - ksort( $reg_steps_to_load ); |
|
221 | + ksort($reg_steps_to_load); |
|
222 | 222 | // loop through folders |
223 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
223 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
224 | 224 | // we need a |
225 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
225 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
226 | 226 | // copy over to the reg_steps_array |
227 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
227 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
228 | 228 | // register custom key route for each reg step |
229 | 229 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
230 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
230 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
231 | 231 | // add AJAX or other hooks |
232 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
232 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
233 | 233 | // setup autoloaders if necessary |
234 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
235 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
234 | + if ( ! class_exists($reg_step['class_name'])) { |
|
235 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
236 | 236 | } |
237 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
238 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
237 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
238 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |
@@ -254,28 +254,28 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function get_reg_steps() { |
256 | 256 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
257 | - if ( empty( $reg_steps )) { |
|
257 | + if (empty($reg_steps)) { |
|
258 | 258 | $reg_steps = array( |
259 | 259 | 10 => array( |
260 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
260 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
261 | 261 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
262 | 262 | 'slug' => 'attendee_information', |
263 | 263 | 'has_hooks' => FALSE |
264 | 264 | ), |
265 | 265 | 20 => array( |
266 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
266 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
267 | 267 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
268 | 268 | 'slug' => 'registration_confirmation', |
269 | 269 | 'has_hooks' => FALSE |
270 | 270 | ), |
271 | 271 | 30 => array( |
272 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
272 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
273 | 273 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
274 | 274 | 'slug' => 'payment_options', |
275 | 275 | 'has_hooks' => TRUE |
276 | 276 | ), |
277 | 277 | 999 => array( |
278 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
278 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
279 | 279 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
280 | 280 | 'slug' => 'finalize_registration', |
281 | 281 | 'has_hooks' => FALSE |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public static function registration_checkout_for_admin() { |
297 | 297 | EED_Single_Page_Checkout::load_reg_steps(); |
298 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
299 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
300 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
298 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
299 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
300 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
301 | 301 | EED_Single_Page_Checkout::instance()->_initialize(); |
302 | 302 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
303 | 303 | return EE_Registry::instance()->REQ->get_output(); |
@@ -313,15 +313,15 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public static function process_registration_from_admin() { |
315 | 315 | EED_Single_Page_Checkout::load_reg_steps(); |
316 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
317 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
318 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
316 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
317 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
318 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
319 | 319 | EED_Single_Page_Checkout::instance()->_initialize(); |
320 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
321 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
322 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
323 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
324 | - if ( $final_reg_step->process_reg_step() ) { |
|
320 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
321 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
322 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
323 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
324 | + if ($final_reg_step->process_reg_step()) { |
|
325 | 325 | $final_reg_step->set_completed(); |
326 | 326 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
327 | 327 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | * @param WP_Query $WP_Query |
341 | 341 | * @return void |
342 | 342 | */ |
343 | - public function run( $WP_Query ) { |
|
343 | + public function run($WP_Query) { |
|
344 | 344 | if ( |
345 | 345 | $WP_Query instanceof WP_Query |
346 | 346 | && $WP_Query->is_main_query() |
347 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
347 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
348 | 348 | ) { |
349 | 349 | $this->_initialize(); |
350 | 350 | } |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @param WP_Query $WP_Query |
361 | 361 | * @return void |
362 | 362 | */ |
363 | - public static function init( $WP_Query ) { |
|
364 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
363 | + public static function init($WP_Query) { |
|
364 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -375,29 +375,29 @@ discard block |
||
375 | 375 | */ |
376 | 376 | private function _initialize() { |
377 | 377 | // ensure SPCO doesn't run twice |
378 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
378 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
379 | 379 | return; |
380 | 380 | } |
381 | 381 | $this->_verify_session(); |
382 | 382 | // setup the EE_Checkout object |
383 | 383 | $this->checkout = $this->_initialize_checkout(); |
384 | 384 | // filter checkout |
385 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
385 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
386 | 386 | // get the $_GET |
387 | 387 | $this->_get_request_vars(); |
388 | 388 | // filter continue_reg |
389 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
389 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
390 | 390 | // load the reg steps array |
391 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
391 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
392 | 392 | EED_Single_Page_Checkout::$_initialized = true; |
393 | 393 | return; |
394 | 394 | } |
395 | 395 | // set the current step |
396 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
396 | + $this->checkout->set_current_step($this->checkout->step); |
|
397 | 397 | // and the next step |
398 | 398 | $this->checkout->set_next_step(); |
399 | 399 | // verify that everything has been setup correctly |
400 | - if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) { |
|
400 | + if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) { |
|
401 | 401 | EED_Single_Page_Checkout::$_initialized = true; |
402 | 402 | return; |
403 | 403 | } |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | // set no cache headers and constants |
423 | 423 | EE_System::do_not_cache(); |
424 | 424 | // add anchor |
425 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
425 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
426 | 426 | // remove transaction lock |
427 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
427 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | |
@@ -437,16 +437,16 @@ discard block |
||
437 | 437 | * @throws EE_Error |
438 | 438 | */ |
439 | 439 | private function _verify_session() { |
440 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
441 | - throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) ); |
|
440 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
441 | + throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso')); |
|
442 | 442 | } |
443 | 443 | // is session still valid ? |
444 | - if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) { |
|
444 | + if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') { |
|
445 | 445 | $this->checkout = new EE_Checkout(); |
446 | 446 | EE_Registry::instance()->SSN->reset_cart(); |
447 | 447 | EE_Registry::instance()->SSN->reset_checkout(); |
448 | 448 | EE_Registry::instance()->SSN->reset_transaction(); |
449 | - EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ ); |
|
449 | + EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__); |
|
450 | 450 | EE_Registry::instance()->SSN->reset_expired(); |
451 | 451 | } |
452 | 452 | } |
@@ -466,20 +466,20 @@ discard block |
||
466 | 466 | /** @type EE_Checkout $checkout */ |
467 | 467 | $checkout = EE_Registry::instance()->SSN->checkout(); |
468 | 468 | // verify |
469 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
469 | + if ( ! $checkout instanceof EE_Checkout) { |
|
470 | 470 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
471 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
471 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
472 | 472 | // verify again |
473 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
474 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
473 | + if ( ! $checkout instanceof EE_Checkout) { |
|
474 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
475 | 475 | } |
476 | 476 | } else { |
477 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
478 | - wp_safe_redirect( $checkout->redirect_url ); |
|
477 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
478 | + wp_safe_redirect($checkout->redirect_url); |
|
479 | 479 | exit(); |
480 | 480 | } |
481 | 481 | } |
482 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
482 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
483 | 483 | // reset anything that needs a clean slate for each request |
484 | 484 | $checkout->reset_for_current_request(); |
485 | 485 | return $checkout; |
@@ -497,24 +497,24 @@ discard block |
||
497 | 497 | // load classes |
498 | 498 | EED_Single_Page_Checkout::load_request_handler(); |
499 | 499 | //make sure this request is marked as belonging to EE |
500 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
500 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
501 | 501 | // which step is being requested ? |
502 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
502 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
503 | 503 | // which step is being edited ? |
504 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
504 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
505 | 505 | // and what we're doing on the current step |
506 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
506 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
507 | 507 | // returning to edit ? |
508 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
508 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
509 | 509 | // or some other kind of revisit ? |
510 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
510 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
511 | 511 | // and whether or not to generate a reg form for this request |
512 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
512 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
513 | 513 | // and whether or not to process a reg form submission for this request |
514 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
514 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
515 | 515 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
516 | 516 | ? $this->checkout->process_form_submission |
517 | - : FALSE; // TRUE FALSE |
|
517 | + : FALSE; // TRUE FALSE |
|
518 | 518 | //$this->_display_request_vars(); |
519 | 519 | } |
520 | 520 | |
@@ -527,17 +527,17 @@ discard block |
||
527 | 527 | * @return void |
528 | 528 | */ |
529 | 529 | protected function _display_request_vars() { |
530 | - if ( ! WP_DEBUG ) { |
|
530 | + if ( ! WP_DEBUG) { |
|
531 | 531 | return; |
532 | 532 | } |
533 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
534 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
535 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
536 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
537 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
538 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
539 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
540 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
533 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
534 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
535 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
536 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
537 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
538 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
539 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
540 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | * @return array |
552 | 552 | */ |
553 | 553 | private function _get_first_step() { |
554 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
555 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
554 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
555 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | |
@@ -568,27 +568,27 @@ discard block |
||
568 | 568 | private function _load_and_instantiate_reg_steps() { |
569 | 569 | // have reg_steps already been instantiated ? |
570 | 570 | if ( |
571 | - empty( $this->checkout->reg_steps ) || |
|
572 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
571 | + empty($this->checkout->reg_steps) || |
|
572 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
573 | 573 | ) { |
574 | 574 | // if not, then loop through raw reg steps array |
575 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
576 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
575 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
576 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
577 | 577 | return false; |
578 | 578 | } |
579 | 579 | } |
580 | 580 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
581 | 581 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
582 | 582 | // skip the registration_confirmation page ? |
583 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
583 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
584 | 584 | // just remove it from the reg steps array |
585 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
585 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
586 | 586 | } else if ( |
587 | 587 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
588 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
588 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
589 | 589 | ) { |
590 | 590 | // set the order to something big like 100 |
591 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
591 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
592 | 592 | } |
593 | 593 | // filter the array for good luck |
594 | 594 | $this->checkout->reg_steps = apply_filters( |
@@ -598,13 +598,13 @@ discard block |
||
598 | 598 | // finally re-sort based on the reg step class order properties |
599 | 599 | $this->checkout->sort_reg_steps(); |
600 | 600 | } else { |
601 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
601 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
602 | 602 | // set all current step stati to FALSE |
603 | - $reg_step->set_is_current_step( FALSE ); |
|
603 | + $reg_step->set_is_current_step(FALSE); |
|
604 | 604 | } |
605 | 605 | } |
606 | - if ( empty( $this->checkout->reg_steps )) { |
|
607 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
606 | + if (empty($this->checkout->reg_steps)) { |
|
607 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
608 | 608 | return false; |
609 | 609 | } |
610 | 610 | // make reg step details available to JS |
@@ -622,10 +622,10 @@ discard block |
||
622 | 622 | * @param int $order |
623 | 623 | * @return bool |
624 | 624 | */ |
625 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
625 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
626 | 626 | |
627 | 627 | // we need a file_path, class_name, and slug to add a reg step |
628 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
628 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
629 | 629 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
630 | 630 | if ( |
631 | 631 | $this->checkout->reg_url_link |
@@ -643,26 +643,26 @@ discard block |
||
643 | 643 | FALSE |
644 | 644 | ); |
645 | 645 | // did we gets the goods ? |
646 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
646 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
647 | 647 | // set reg step order based on config |
648 | - $reg_step_obj->set_order( $order ); |
|
648 | + $reg_step_obj->set_order($order); |
|
649 | 649 | // add instantiated reg step object to the master reg steps array |
650 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
650 | + $this->checkout->add_reg_step($reg_step_obj); |
|
651 | 651 | } else { |
652 | 652 | EE_Error::add_error( |
653 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
653 | + __('The current step could not be set.', 'event_espresso'), |
|
654 | 654 | __FILE__, __FUNCTION__, __LINE__ |
655 | 655 | ); |
656 | 656 | return false; |
657 | 657 | } |
658 | 658 | } else { |
659 | - if ( WP_DEBUG ) { |
|
659 | + if (WP_DEBUG) { |
|
660 | 660 | EE_Error::add_error( |
661 | 661 | sprintf( |
662 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
663 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
664 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
665 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
662 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
663 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
664 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
665 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
666 | 666 | '<ul>', |
667 | 667 | '<li>', |
668 | 668 | '</li>', |
@@ -686,15 +686,15 @@ discard block |
||
686 | 686 | */ |
687 | 687 | private function _verify_transaction_and_get_registrations() { |
688 | 688 | // was there already a valid transaction in the checkout from the session ? |
689 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
689 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
690 | 690 | // get transaction from db or session |
691 | 691 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
692 | 692 | ? $this->_get_transaction_and_cart_for_previous_visit() |
693 | 693 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
694 | 694 | |
695 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
695 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
696 | 696 | EE_Error::add_error( |
697 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
697 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
698 | 698 | __FILE__, __FUNCTION__, __LINE__ |
699 | 699 | ); |
700 | 700 | $this->checkout->transaction = EE_Transaction::new_instance(); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | return false; |
705 | 705 | } |
706 | 706 | // and the registrations for the transaction |
707 | - $this->_get_registrations( $this->checkout->transaction ); |
|
707 | + $this->_get_registrations($this->checkout->transaction); |
|
708 | 708 | } |
709 | 709 | return true; |
710 | 710 | } |
@@ -719,16 +719,16 @@ discard block |
||
719 | 719 | */ |
720 | 720 | private function _get_transaction_and_cart_for_previous_visit() { |
721 | 721 | /** @var $TXN_model EEM_Transaction */ |
722 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
722 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
723 | 723 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
724 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
724 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
725 | 725 | // verify transaction |
726 | - if ( $transaction instanceof EE_Transaction ) { |
|
726 | + if ($transaction instanceof EE_Transaction) { |
|
727 | 727 | // and get the cart that was used for that transaction |
728 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
728 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
729 | 729 | return $transaction; |
730 | 730 | } else { |
731 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
731 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
732 | 732 | return NULL; |
733 | 733 | } |
734 | 734 | } |
@@ -742,11 +742,11 @@ discard block |
||
742 | 742 | * @param EE_Transaction $transaction |
743 | 743 | * @return EE_Cart |
744 | 744 | */ |
745 | - private function _get_cart_for_transaction( $transaction ) { |
|
746 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
745 | + private function _get_cart_for_transaction($transaction) { |
|
746 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
747 | 747 | // verify cart |
748 | - if ( ! $cart instanceof EE_Cart ) { |
|
749 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
748 | + if ( ! $cart instanceof EE_Cart) { |
|
749 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
750 | 750 | } |
751 | 751 | return $cart; |
752 | 752 | } |
@@ -761,8 +761,8 @@ discard block |
||
761 | 761 | * @param EE_Transaction $transaction |
762 | 762 | * @return EE_Cart |
763 | 763 | */ |
764 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
765 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
764 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
765 | + return EE_Cart::get_cart_from_txn($transaction); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | |
@@ -777,15 +777,15 @@ discard block |
||
777 | 777 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
778 | 778 | // if there's no transaction, then this is the FIRST visit to SPCO |
779 | 779 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
780 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
780 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
781 | 781 | // and then create a new transaction |
782 | 782 | $transaction = $this->_initialize_transaction(); |
783 | 783 | // verify transaction |
784 | - if ( $transaction instanceof EE_Transaction ) { |
|
784 | + if ($transaction instanceof EE_Transaction) { |
|
785 | 785 | // and save TXN data to the cart |
786 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
786 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
787 | 787 | } else { |
788 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
788 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
789 | 789 | } |
790 | 790 | return $transaction; |
791 | 791 | } |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | // grab the cart grand total |
806 | 806 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
807 | 807 | // create new TXN |
808 | - $transaction = EE_Transaction::new_instance( array( |
|
808 | + $transaction = EE_Transaction::new_instance(array( |
|
809 | 809 | 'TXN_timestamp' => time(), |
810 | 810 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
811 | 811 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
@@ -820,8 +820,8 @@ discard block |
||
820 | 820 | $transaction->ID() |
821 | 821 | ); |
822 | 822 | return $transaction; |
823 | - } catch( Exception $e ) { |
|
824 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
823 | + } catch (Exception $e) { |
|
824 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
825 | 825 | } |
826 | 826 | return NULL; |
827 | 827 | } |
@@ -835,34 +835,34 @@ discard block |
||
835 | 835 | * @param EE_Transaction $transaction |
836 | 836 | * @return EE_Cart |
837 | 837 | */ |
838 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
838 | + private function _get_registrations(EE_Transaction $transaction) { |
|
839 | 839 | // first step: grab the registrants { : o |
840 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
840 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
841 | 841 | // verify registrations have been set |
842 | - if ( empty( $registrations )) { |
|
842 | + if (empty($registrations)) { |
|
843 | 843 | // if no cached registrations, then check the db |
844 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
844 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
845 | 845 | // still nothing ? well as long as this isn't a revisit |
846 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
846 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
847 | 847 | // generate new registrations from scratch |
848 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
848 | + $registrations = $this->_initialize_registrations($transaction); |
|
849 | 849 | } |
850 | 850 | } |
851 | 851 | // sort by their original registration order |
852 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
852 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
853 | 853 | // then loop thru the array |
854 | - foreach ( $registrations as $registration ) { |
|
854 | + foreach ($registrations as $registration) { |
|
855 | 855 | // verify each registration |
856 | - if ( $registration instanceof EE_Registration ) { |
|
856 | + if ($registration instanceof EE_Registration) { |
|
857 | 857 | // we display all attendee info for the primary registrant |
858 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
858 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
859 | 859 | $this->checkout->primary_revisit = TRUE; |
860 | 860 | break; |
861 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
861 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
862 | 862 | // but hide info if it doesn't belong to you |
863 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
863 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
864 | 864 | } |
865 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
865 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | } |
@@ -876,17 +876,17 @@ discard block |
||
876 | 876 | * @param EE_Transaction $transaction |
877 | 877 | * @return array |
878 | 878 | */ |
879 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
879 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
880 | 880 | $att_nmbr = 0; |
881 | 881 | $registrations = array(); |
882 | - if ( $transaction instanceof EE_Transaction ) { |
|
882 | + if ($transaction instanceof EE_Transaction) { |
|
883 | 883 | /** @type EE_Registration_Processor $registration_processor */ |
884 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
884 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
885 | 885 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
886 | 886 | // now let's add the cart items to the $transaction |
887 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
887 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
888 | 888 | //do the following for each ticket of this type they selected |
889 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
889 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
890 | 890 | $att_nmbr++; |
891 | 891 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
892 | 892 | $line_item, |
@@ -894,12 +894,12 @@ discard block |
||
894 | 894 | $att_nmbr, |
895 | 895 | $this->checkout->total_ticket_count |
896 | 896 | ); |
897 | - if ( $registration instanceof EE_Registration ) { |
|
898 | - $registrations[ $registration->ID() ] = $registration; |
|
897 | + if ($registration instanceof EE_Registration) { |
|
898 | + $registrations[$registration->ID()] = $registration; |
|
899 | 899 | } |
900 | 900 | } |
901 | 901 | } |
902 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
902 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
903 | 903 | } |
904 | 904 | return $registrations; |
905 | 905 | } |
@@ -914,12 +914,12 @@ discard block |
||
914 | 914 | * @param EE_Registration $reg_B |
915 | 915 | * @return array() |
916 | 916 | */ |
917 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
917 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
918 | 918 | // this shouldn't ever happen within the same TXN, but oh well |
919 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
919 | + if ($reg_A->count() == $reg_B->count()) { |
|
920 | 920 | return 0; |
921 | 921 | } |
922 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
922 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
@@ -934,35 +934,35 @@ discard block |
||
934 | 934 | */ |
935 | 935 | private function _final_verifications() { |
936 | 936 | // filter checkout |
937 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
937 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
938 | 938 | //verify that current step is still set correctly |
939 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
940 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
939 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
940 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
941 | 941 | return false; |
942 | 942 | } |
943 | 943 | // if returning to SPCO, then verify that primary registrant is set |
944 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
944 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
945 | 945 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
946 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
947 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
946 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
947 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
948 | 948 | return false; |
949 | 949 | } |
950 | 950 | $valid_registrant = null; |
951 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
952 | - if ( $registration instanceof EE_Registration ) { |
|
953 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
951 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
952 | + if ($registration instanceof EE_Registration) { |
|
953 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
954 | 954 | $valid_registrant = $registration; |
955 | 955 | } |
956 | 956 | } |
957 | 957 | } |
958 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
959 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
958 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
959 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
960 | 960 | return false; |
961 | 961 | } |
962 | 962 | } |
963 | 963 | // now that things have been kinda sufficiently verified, |
964 | 964 | // let's add the checkout to the session so that's available other systems |
965 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
965 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
966 | 966 | return true; |
967 | 967 | } |
968 | 968 | |
@@ -978,28 +978,28 @@ discard block |
||
978 | 978 | * @access private |
979 | 979 | * @param bool $reinitializing |
980 | 980 | */ |
981 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
982 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
981 | + private function _initialize_reg_steps($reinitializing = false) { |
|
982 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
983 | 983 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
984 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
985 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
984 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
985 | + if ( ! $reg_step->initialize_reg_step()) { |
|
986 | 986 | // if not initialized then maybe this step is being removed... |
987 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
987 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
988 | 988 | // if it was the current step, then we need to start over here |
989 | - $this->_initialize_reg_steps( true ); |
|
989 | + $this->_initialize_reg_steps(true); |
|
990 | 990 | return; |
991 | 991 | } |
992 | 992 | continue; |
993 | 993 | } |
994 | 994 | // i18n |
995 | 995 | $reg_step->translate_js_strings(); |
996 | - if ( $reg_step->is_current_step() ) { |
|
996 | + if ($reg_step->is_current_step()) { |
|
997 | 997 | // the text that appears on the reg step form submit button |
998 | 998 | $reg_step->set_submit_button_text(); |
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
1002 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
1002 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | |
@@ -1012,39 +1012,39 @@ discard block |
||
1012 | 1012 | */ |
1013 | 1013 | private function _check_form_submission() { |
1014 | 1014 | //does this request require the reg form to be generated ? |
1015 | - if ( $this->checkout->generate_reg_form ) { |
|
1015 | + if ($this->checkout->generate_reg_form) { |
|
1016 | 1016 | // ever heard that song by Blue Rodeo ? |
1017 | 1017 | try { |
1018 | 1018 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1019 | 1019 | // if not displaying a form, then check for form submission |
1020 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1020 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1021 | 1021 | // clear out any old data in case this step is being run again |
1022 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1022 | + $this->checkout->current_step->set_valid_data(array()); |
|
1023 | 1023 | // capture submitted form data |
1024 | 1024 | $this->checkout->current_step->reg_form->receive_form_submission( |
1025 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1025 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1026 | 1026 | ); |
1027 | 1027 | // validate submitted form data |
1028 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
1028 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
1029 | 1029 | // thou shall not pass !!! |
1030 | 1030 | $this->checkout->continue_reg = FALSE; |
1031 | 1031 | // any form validation errors? |
1032 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
1032 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
1033 | 1033 | $submission_error_messages = array(); |
1034 | 1034 | // bad, bad, bad registrant |
1035 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1036 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1037 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
1035 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1036 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1037 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
1038 | 1038 | } |
1039 | 1039 | } |
1040 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1040 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1041 | 1041 | } |
1042 | 1042 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1043 | 1043 | $this->go_to_next_step(); |
1044 | 1044 | return; |
1045 | 1045 | } |
1046 | 1046 | } |
1047 | - } catch( EE_Error $e ) { |
|
1047 | + } catch (EE_Error $e) { |
|
1048 | 1048 | $e->get_error(); |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -1060,38 +1060,38 @@ discard block |
||
1060 | 1060 | */ |
1061 | 1061 | private function _process_form_action() { |
1062 | 1062 | // what cha wanna do? |
1063 | - switch( $this->checkout->action ) { |
|
1063 | + switch ($this->checkout->action) { |
|
1064 | 1064 | // AJAX next step reg form |
1065 | 1065 | case 'display_spco_reg_step' : |
1066 | 1066 | $this->checkout->redirect = FALSE; |
1067 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1068 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1067 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1068 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1069 | 1069 | } |
1070 | 1070 | break; |
1071 | 1071 | |
1072 | 1072 | default : |
1073 | 1073 | // meh... do one of those other steps first |
1074 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1074 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1075 | 1075 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1076 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1076 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1077 | 1077 | // call action on current step |
1078 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1078 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1079 | 1079 | // good registrant, you get to proceed |
1080 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1081 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1082 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1080 | + if ($this->checkout->current_step->success_message() != '') { |
|
1081 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1082 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1083 | 1083 | } |
1084 | 1084 | } |
1085 | 1085 | // pack it up, pack it in... |
1086 | 1086 | $this->_setup_redirect(); |
1087 | 1087 | } |
1088 | 1088 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1089 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1089 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1090 | 1090 | |
1091 | 1091 | } else { |
1092 | 1092 | EE_Error::add_error( |
1093 | 1093 | sprintf( |
1094 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1094 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1095 | 1095 | $this->checkout->action, |
1096 | 1096 | $this->checkout->current_step->name() |
1097 | 1097 | ), |
@@ -1117,10 +1117,10 @@ discard block |
||
1117 | 1117 | public function add_styles_and_scripts() { |
1118 | 1118 | // i18n |
1119 | 1119 | $this->translate_js_strings(); |
1120 | - if ( $this->checkout->admin_request ) { |
|
1121 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1120 | + if ($this->checkout->admin_request) { |
|
1121 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1122 | 1122 | } else { |
1123 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1123 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1124 | 1124 | } |
1125 | 1125 | } |
1126 | 1126 | |
@@ -1136,50 +1136,50 @@ discard block |
||
1136 | 1136 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1137 | 1137 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1138 | 1138 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1139 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1140 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1141 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1139 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1140 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1141 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1142 | 1142 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1143 | 1143 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1144 | 1144 | EE_Registry::$i18n_js_strings['process_registration'] = sprintf( |
1145 | - __( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ), |
|
1145 | + __('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'), |
|
1146 | 1146 | '<br/>' |
1147 | 1147 | ); |
1148 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1148 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1149 | 1149 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1150 | 1150 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1151 | 1151 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1152 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1153 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1154 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1155 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1156 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1157 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1158 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1159 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1160 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1161 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1162 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1163 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1164 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1165 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1152 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1153 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1154 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1155 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1156 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1157 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1158 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1159 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1160 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1161 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1162 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1163 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1164 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1165 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1166 | 1166 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1167 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1167 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1168 | 1168 | '<h4 class="important-notice">', |
1169 | 1169 | '</h4>', |
1170 | 1170 | '<br />', |
1171 | 1171 | '<p>', |
1172 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1172 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1173 | 1173 | '">', |
1174 | 1174 | '</a>', |
1175 | 1175 | '</p>' |
1176 | 1176 | ); |
1177 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1178 | - EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint( |
|
1179 | - apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS ) |
|
1177 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1178 | + EE_Registry::$i18n_js_strings['session_extension'] = absint( |
|
1179 | + apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS) |
|
1180 | 1180 | ); |
1181 | - EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate( |
|
1182 | - 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) |
|
1181 | + EE_Registry::$i18n_js_strings['session_expiration'] = gmdate( |
|
1182 | + 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1183 | 1183 | ); |
1184 | 1184 | |
1185 | 1185 | |
@@ -1195,31 +1195,31 @@ discard block |
||
1195 | 1195 | */ |
1196 | 1196 | public function enqueue_styles_and_scripts() { |
1197 | 1197 | // load css |
1198 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1199 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1198 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1199 | + wp_enqueue_style('single_page_checkout'); |
|
1200 | 1200 | // load JS |
1201 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1202 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1201 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1202 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1203 | 1203 | wp_register_script( |
1204 | 1204 | 'single_page_checkout', |
1205 | - SPCO_JS_URL . 'single_page_checkout.js', |
|
1206 | - array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), |
|
1205 | + SPCO_JS_URL.'single_page_checkout.js', |
|
1206 | + array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), |
|
1207 | 1207 | EVENT_ESPRESSO_VERSION, |
1208 | 1208 | TRUE |
1209 | 1209 | ); |
1210 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1210 | + wp_enqueue_script('single_page_checkout'); |
|
1211 | 1211 | |
1212 | 1212 | /** |
1213 | 1213 | * global action hook for enqueueing styles and scripts with |
1214 | 1214 | * spco calls. |
1215 | 1215 | */ |
1216 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1216 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1217 | 1217 | |
1218 | 1218 | /** |
1219 | 1219 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1220 | 1220 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1221 | 1221 | */ |
1222 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1222 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1223 | 1223 | |
1224 | 1224 | // add css and JS for current step |
1225 | 1225 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1235,21 +1235,21 @@ discard block |
||
1235 | 1235 | */ |
1236 | 1236 | private function _display_spco_reg_form() { |
1237 | 1237 | // if registering via the admin, just display the reg form for the current step |
1238 | - if ( $this->checkout->admin_request ) { |
|
1239 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1238 | + if ($this->checkout->admin_request) { |
|
1239 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1240 | 1240 | } else { |
1241 | 1241 | // add powered by EE msg |
1242 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1242 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1243 | 1243 | |
1244 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1245 | - EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart; |
|
1244 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1245 | + EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart; |
|
1246 | 1246 | $cookies_not_set_msg = ''; |
1247 | - if ( $empty_cart ) { |
|
1248 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1247 | + if ($empty_cart) { |
|
1248 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1249 | 1249 | $cookies_not_set_msg = apply_filters( |
1250 | 1250 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1251 | 1251 | sprintf( |
1252 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1252 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1253 | 1253 | '<div class="ee-attention">', |
1254 | 1254 | '</div>', |
1255 | 1255 | '<h6 class="important-notice">', |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | 'layout_strategy' => |
1271 | 1271 | new EE_Template_Layout( |
1272 | 1272 | array( |
1273 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1273 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1274 | 1274 | 'template_args' => array( |
1275 | 1275 | 'empty_cart' => $empty_cart, |
1276 | 1276 | 'revisit' => $this->checkout->revisit, |
@@ -1279,8 +1279,8 @@ discard block |
||
1279 | 1279 | 'empty_msg' => apply_filters( |
1280 | 1280 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1281 | 1281 | sprintf( |
1282 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1283 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1282 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1283 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1284 | 1284 | '">', |
1285 | 1285 | '</a>' |
1286 | 1286 | ) |
@@ -1298,7 +1298,7 @@ discard block |
||
1298 | 1298 | ) |
1299 | 1299 | ); |
1300 | 1300 | // load template and add to output sent that gets filtered into the_content() |
1301 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1301 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1302 | 1302 | } |
1303 | 1303 | } |
1304 | 1304 | |
@@ -1312,8 +1312,8 @@ discard block |
||
1312 | 1312 | * @internal param string $label |
1313 | 1313 | * @return string |
1314 | 1314 | */ |
1315 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1316 | - if ( $next_step == 'finalize_registration' ) { |
|
1315 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1316 | + if ($next_step == 'finalize_registration') { |
|
1317 | 1317 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1318 | 1318 | } |
1319 | 1319 | } |
@@ -1327,18 +1327,18 @@ discard block |
||
1327 | 1327 | * @return string |
1328 | 1328 | */ |
1329 | 1329 | public static function display_registration_footer() { |
1330 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1331 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1332 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1333 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1330 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1331 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1332 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1333 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1334 | 1334 | echo apply_filters( |
1335 | 1335 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1336 | 1336 | sprintf( |
1337 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1338 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1337 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1338 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1339 | 1339 | '" target="_blank">', |
1340 | 1340 | '</a>', |
1341 | - '<a href="' . $url . '" title="', |
|
1341 | + '<a href="'.$url.'" title="', |
|
1342 | 1342 | '" target="_blank">', |
1343 | 1343 | '</a></div>' |
1344 | 1344 | ) |
@@ -1369,12 +1369,12 @@ discard block |
||
1369 | 1369 | * @return array |
1370 | 1370 | */ |
1371 | 1371 | private function _setup_redirect() { |
1372 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1372 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1373 | 1373 | $this->checkout->redirect = TRUE; |
1374 | - if ( empty( $this->checkout->redirect_url )) { |
|
1374 | + if (empty($this->checkout->redirect_url)) { |
|
1375 | 1375 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1376 | 1376 | } |
1377 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1377 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1378 | 1378 | } |
1379 | 1379 | } |
1380 | 1380 | |
@@ -1387,12 +1387,12 @@ discard block |
||
1387 | 1387 | * @return void |
1388 | 1388 | */ |
1389 | 1389 | public function go_to_next_step() { |
1390 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1390 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1391 | 1391 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1392 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1392 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1393 | 1393 | } |
1394 | 1394 | // just return for these conditions |
1395 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1395 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1396 | 1396 | return; |
1397 | 1397 | } |
1398 | 1398 | // AJAX response |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | */ |
1414 | 1414 | protected function _handle_json_response() { |
1415 | 1415 | // if this is an ajax request |
1416 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1416 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1417 | 1417 | // DEBUG LOG |
1418 | 1418 | //$this->checkout->log( |
1419 | 1419 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1423,10 +1423,10 @@ discard block |
||
1423 | 1423 | // 'continue_reg' => $this->checkout->continue_reg, |
1424 | 1424 | // ) |
1425 | 1425 | //); |
1426 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1427 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1426 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1427 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1428 | 1428 | // just send the ajax ( |
1429 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1429 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1430 | 1430 | $this->unlock_transaction(); |
1431 | 1431 | echo $json_response; |
1432 | 1432 | exit(); |
@@ -1443,9 +1443,9 @@ discard block |
||
1443 | 1443 | */ |
1444 | 1444 | protected function _handle_html_redirects() { |
1445 | 1445 | // going somewhere ? |
1446 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1446 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1447 | 1447 | // store notices in a transient |
1448 | - EE_Error::get_notices( false, true, true ); |
|
1448 | + EE_Error::get_notices(false, true, true); |
|
1449 | 1449 | $this->unlock_transaction(); |
1450 | 1450 | // DEBUG LOG |
1451 | 1451 | //$this->checkout->log( |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | // 'headers_list' => headers_list(), |
1457 | 1457 | // ) |
1458 | 1458 | //); |
1459 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1459 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1460 | 1460 | exit(); |
1461 | 1461 | } |
1462 | 1462 | } |
@@ -503,7 +503,7 @@ |
||
503 | 503 | /** |
504 | 504 | * @param $message_types |
505 | 505 | * @param array $extra |
506 | - * @return mixed|string |
|
506 | + * @return string |
|
507 | 507 | */ |
508 | 508 | protected function _get_admin_content_events_edit( $message_types, $extra ) { |
509 | 509 | //defaults |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param EE_Admin_Page $admin_page |
45 | 45 | */ |
46 | - public function __construct( $admin_page ) { |
|
46 | + public function __construct($admin_page) { |
|
47 | 47 | parent::__construct($admin_page); |
48 | - require_once( EE_HELPERS . 'EEH_DTT_Helper.helper.php' ); |
|
48 | + require_once(EE_HELPERS.'EEH_DTT_Helper.helper.php'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function _setup_data() { |
56 | 56 | $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
57 | - $this->_all_data_count = $this->_admin_page->get_events(0,0, TRUE); |
|
57 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, TRUE); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | $this->_sortable_columns = array( |
88 | - 'id' => array( 'EVT_ID' => true ), |
|
89 | - 'name' => array( 'EVT_name' => false ), |
|
90 | - 'author' => array( 'EVT_wp_user' => false ), |
|
91 | - 'venue' => array( 'Venue.VNU_name' => false ), |
|
88 | + 'id' => array('EVT_ID' => true), |
|
89 | + 'name' => array('EVT_name' => false), |
|
90 | + 'author' => array('EVT_wp_user' => false), |
|
91 | + 'venue' => array('Venue.VNU_name' => false), |
|
92 | 92 | 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
93 | 93 | 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
94 | 94 | ); |
95 | 95 | |
96 | 96 | $this->_primary_column = 'id'; |
97 | 97 | |
98 | - $this->_hidden_columns = array( 'author' ); |
|
98 | + $this->_hidden_columns = array('author'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | protected function _add_view_counts() { |
114 | 114 | $this->_views['all']['count'] = $this->_admin_page->total_events(); |
115 | 115 | $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
116 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
116 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
117 | 117 | $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
118 | 118 | } |
119 | 119 | } |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return string |
126 | 126 | */ |
127 | - protected function _get_row_class( $item ) { |
|
128 | - $class = parent::_get_row_class( $item ); |
|
127 | + protected function _get_row_class($item) { |
|
128 | + $class = parent::_get_row_class($item); |
|
129 | 129 | //add status class |
130 | - $class .= $item instanceof EE_Event ? ' ee-status-strip event-status-' . $item->get_active_status() : ''; |
|
131 | - if ( $this->_has_checkbox_column ) { |
|
130 | + $class .= $item instanceof EE_Event ? ' ee-status-strip event-status-'.$item->get_active_status() : ''; |
|
131 | + if ($this->_has_checkbox_column) { |
|
132 | 132 | $class .= ' has-checkbox-column'; |
133 | 133 | } |
134 | 134 | return $class; |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return string |
142 | 142 | */ |
143 | - public function column_status( EE_Event $item ) { |
|
144 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' . $item->get_active_status() . '"></span>'; |
|
143 | + public function column_status(EE_Event $item) { |
|
144 | + return '<span class="ee-status-strip ee-status-strip-td event-status-'.$item->get_active_status().'"></span>'; |
|
145 | 145 | }/**/ |
146 | 146 | |
147 | 147 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function column_cb( $item ) { |
|
153 | + public function column_cb($item) { |
|
154 | 154 | $this->_dtt = $item->primary_datetime(); //set this for use in other columns |
155 | 155 | |
156 | 156 | //does event have any attached registrations? |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return mixed|string |
168 | 168 | */ |
169 | - public function column_id( EE_Event $item ) { |
|
169 | + public function column_id(EE_Event $item) { |
|
170 | 170 | $content = $item->ID(); |
171 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
171 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
172 | 172 | return $content; |
173 | 173 | } |
174 | 174 | |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string |
180 | 180 | */ |
181 | - public function column_name( EE_Event $item ) { |
|
181 | + public function column_name(EE_Event $item) { |
|
182 | 182 | $edit_query_args = array( |
183 | 183 | 'action' => 'edit', |
184 | 184 | 'post' => $item->ID() |
185 | 185 | ); |
186 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
187 | - $actions = $this->_column_name_action_setup( $item ); |
|
186 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
187 | + $actions = $this->_column_name_action_setup($item); |
|
188 | 188 | $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
189 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' . $status; |
|
190 | - $content .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->get_active_status(), false, 'sentence' ) . '</span>'; |
|
189 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>'.$status; |
|
190 | + $content .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->get_active_status(), false, 'sentence').'</span>'; |
|
191 | 191 | $content .= $this->row_actions($actions); |
192 | 192 | return $content; |
193 | 193 | |
@@ -204,72 +204,72 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return array array of actions |
206 | 206 | */ |
207 | - protected function _column_name_action_setup( EE_Event $item ) { |
|
207 | + protected function _column_name_action_setup(EE_Event $item) { |
|
208 | 208 | //todo: remove when attendees is active |
209 | - if ( !defined('REG_ADMIN_URL') ) |
|
209 | + if ( ! defined('REG_ADMIN_URL')) |
|
210 | 210 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
211 | 211 | |
212 | 212 | $actions = array(); |
213 | 213 | |
214 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
214 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
215 | 215 | $edit_query_args = array( |
216 | 216 | 'action' => 'edit', |
217 | 217 | 'post' => $item->ID() |
218 | 218 | ); |
219 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
220 | - $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'; |
|
219 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
220 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
221 | 221 | |
222 | 222 | } |
223 | 223 | |
224 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
224 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
225 | 225 | $attendees_query_args = array( |
226 | 226 | 'action' => 'default', |
227 | 227 | 'event_id' => $item->ID() |
228 | 228 | ); |
229 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
230 | - $actions['attendees'] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrations', 'event_espresso') . '">' . __('Registrations', 'event_espresso') . '</a>'; |
|
229 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
230 | + $actions['attendees'] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrations', 'event_espresso').'">'.__('Registrations', 'event_espresso').'</a>'; |
|
231 | 231 | } |
232 | 232 | |
233 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
233 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
234 | 234 | $trash_event_query_args = array( |
235 | 235 | 'action' => 'trash_event', |
236 | 236 | 'EVT_ID' => $item->ID() |
237 | 237 | ); |
238 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_args, EVENTS_ADMIN_URL ); |
|
238 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_args, EVENTS_ADMIN_URL); |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
241 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
242 | 242 | $restore_event_query_args = array( |
243 | 243 | 'action' => 'restore_event', |
244 | 244 | 'EVT_ID' => $item->ID() |
245 | 245 | ); |
246 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( $restore_event_query_args, EVENTS_ADMIN_URL ); |
|
246 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce($restore_event_query_args, EVENTS_ADMIN_URL); |
|
247 | 247 | } |
248 | 248 | |
249 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
249 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
250 | 250 | $delete_event_query_args = array( |
251 | 251 | 'action' => 'delete_event', |
252 | 252 | 'EVT_ID' => $item->ID() |
253 | 253 | ); |
254 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( $delete_event_query_args, EVENTS_ADMIN_URL ); |
|
254 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce($delete_event_query_args, EVENTS_ADMIN_URL); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | $view_link = get_permalink($item->ID()); |
258 | 258 | |
259 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; |
|
259 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
260 | 260 | |
261 | - switch ( $item->get( 'status' ) ) { |
|
261 | + switch ($item->get('status')) { |
|
262 | 262 | case 'trash' : |
263 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
264 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>'; |
|
263 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
264 | + $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>'; |
|
265 | 265 | } |
266 | - if ( $item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
267 | - $actions['delete'] = '<a href="' . $delete_event_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
266 | + if ($item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
267 | + $actions['delete'] = '<a href="'.$delete_event_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
268 | 268 | } |
269 | 269 | break; |
270 | 270 | default : |
271 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
272 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
271 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
272 | + $actions['move to trash'] = '<a href="'.$trash_event_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | return $actions; |
@@ -281,17 +281,17 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - public function column_author( EE_Event $item ) { |
|
284 | + public function column_author(EE_Event $item) { |
|
285 | 285 | //user author info |
286 | - $event_author = get_userdata( $item->wp_user() ); |
|
287 | - $gravatar = get_avatar( $item->wp_user(), '15' ); |
|
286 | + $event_author = get_userdata($item->wp_user()); |
|
287 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
288 | 288 | //filter link |
289 | 289 | $query_args = array( |
290 | 290 | 'action' => 'default', |
291 | 291 | 'EVT_wp_user' => $item->wp_user() |
292 | 292 | ); |
293 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, EVENTS_ADMIN_URL ); |
|
294 | - return $gravatar . ' <a href="' . $filter_url . '" title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' . $event_author->display_name . '</a>'; |
|
293 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
294 | + return $gravatar.' <a href="'.$filter_url.'" title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'.$event_author->display_name.'</a>'; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - public function column_venue( EE_Event $item ) { |
|
304 | - $venue = $item->get_first_related( 'Venue' ); |
|
305 | - return !empty( $venue ) ? $venue->name() : ''; |
|
303 | + public function column_venue(EE_Event $item) { |
|
304 | + $venue = $item->get_first_related('Venue'); |
|
305 | + return ! empty($venue) ? $venue->name() : ''; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @throws EE_Error |
313 | 313 | */ |
314 | - public function column_start_date_time( EE_Event $item ) { |
|
315 | - echo !empty( $this->_dtt ) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
314 | + public function column_start_date_time(EE_Event $item) { |
|
315 | + echo ! empty($this->_dtt) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
316 | 316 | //display in user's timezone? |
317 | - echo !empty( $this->_dtt ) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ' ) : ''; |
|
317 | + echo ! empty($this->_dtt) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ') : ''; |
|
318 | 318 | |
319 | 319 | } |
320 | 320 | |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @throws EE_Error |
326 | 326 | */ |
327 | - public function column_reg_begins( EE_Event $item ) { |
|
327 | + public function column_reg_begins(EE_Event $item) { |
|
328 | 328 | $reg_start = $item->get_ticket_with_earliest_start_time(); |
329 | - echo !empty( $reg_start ) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
329 | + echo ! empty($reg_start) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
330 | 330 | //display in user's timezone? |
331 | - echo !empty( $reg_start ) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';/**/ |
|
331 | + echo ! empty($reg_start) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ') : ''; /**/ |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @return int|string |
339 | 339 | */ |
340 | - public function column_attendees( EE_Event $item ) { |
|
340 | + public function column_attendees(EE_Event $item) { |
|
341 | 341 | $attendees_query_args = array( |
342 | 342 | 'action' => 'default', |
343 | 343 | 'event_id' => $item->ID() |
344 | 344 | ); |
345 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
346 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count( $item->ID() ); |
|
347 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' : $registered_attendees; |
|
345 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
346 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
347 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' : $registered_attendees; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return float |
355 | 355 | */ |
356 | - public function column_tkts_sold( EE_Event $item ) { |
|
357 | - return EEM_Ticket::instance()->sum(array( array('Datetime.EVT_ID' => $item->ID() )), 'TKT_sold' ); |
|
356 | + public function column_tkts_sold(EE_Event $item) { |
|
357 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -363,38 +363,38 @@ discard block |
||
363 | 363 | * |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - public function column_actions( EE_Event $item ) { |
|
366 | + public function column_actions(EE_Event $item) { |
|
367 | 367 | //todo: remove when attendees is active |
368 | - if ( !defined('REG_ADMIN_URL') ) |
|
368 | + if ( ! defined('REG_ADMIN_URL')) |
|
369 | 369 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
370 | 370 | $actionlinks = array(); |
371 | 371 | |
372 | 372 | $view_link = get_permalink($item->ID()); |
373 | 373 | |
374 | - $actionlinks[] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
374 | + $actionlinks[] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">'; |
|
375 | 375 | $actionlinks[] = '<div class="dashicons dashicons-search"></div></a>'; |
376 | 376 | |
377 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
377 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
378 | 378 | $edit_query_args = array( |
379 | 379 | 'action' => 'edit', |
380 | 380 | 'post' => $item->ID() |
381 | 381 | ); |
382 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
383 | - $actionlinks[] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
382 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
383 | + $actionlinks[] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
384 | 384 | } |
385 | 385 | |
386 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
386 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
387 | 387 | $attendees_query_args = array( |
388 | 388 | 'action' => 'default', |
389 | 389 | 'event_id' => $item->ID() |
390 | 390 | ); |
391 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
392 | - $actionlinks[] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>'; |
|
391 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
392 | + $actionlinks[] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrants', 'event_espresso').'"><div class="dashicons dashicons-groups"></div></a>'; |
|
393 | 393 | } |
394 | 394 | |
395 | - $actionlinks = apply_filters( 'FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item ); |
|
395 | + $actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item); |
|
396 | 396 | |
397 | - return $this->_action_string( implode( "\n\t", $actionlinks ), $item, 'div' ); |
|
397 | + return $this->_action_string(implode("\n\t", $actionlinks), $item, 'div'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | * @param EE_Transaction $transaction |
1456 | 1456 | * @param \EE_Payment $payment |
1457 | 1457 | * @param array $REG_IDs |
1458 | - * @return bool |
|
1458 | + * @return boolean|null |
|
1459 | 1459 | */ |
1460 | 1460 | protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
1461 | 1461 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
@@ -1647,6 +1647,7 @@ discard block |
||
1647 | 1647 | * |
1648 | 1648 | * @access protected |
1649 | 1649 | * @param \EE_Payment | null $payment |
1650 | + * @param EE_Payment $payment |
|
1650 | 1651 | */ |
1651 | 1652 | protected function _maybe_send_notifications( $payment = null ) { |
1652 | 1653 | switch ( $payment instanceof EE_Payment ) { |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Transactions_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _ajax_hooks() { |
83 | - add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds')); |
|
84 | - add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds')); |
|
85 | - add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment')); |
|
83 | + add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds')); |
|
84 | + add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds')); |
|
85 | + add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'buttons' => array( |
98 | 98 | 'add' => __('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => __('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => __('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => __('Delete Transaction', 'event_espresso'), |
|
101 | 101 | ) |
102 | 102 | ); |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
115 | 115 | |
116 | - $txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0; |
|
116 | + $txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0; |
|
117 | 117 | |
118 | 118 | $this->_page_routes = array( |
119 | 119 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'filename' => 'transactions_overview_views_filters_search' |
186 | 186 | ), |
187 | 187 | ), |
188 | - 'help_tour' => array( 'Transactions_Overview_Help_Tour' ), |
|
188 | + 'help_tour' => array('Transactions_Overview_Help_Tour'), |
|
189 | 189 | /** |
190 | 190 | * commented out because currently we are not displaying tips for transaction list table status but this |
191 | 191 | * may change in a later iteration so want to keep the code for then. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'nav' => array( |
198 | 198 | 'label' => __('View Transaction', 'event_espresso'), |
199 | 199 | 'order' => 5, |
200 | - 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
200 | + 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
201 | 201 | 'persistent' => FALSE |
202 | 202 | ), |
203 | 203 | 'help_tabs' => array( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | 'filename' => 'transactions_view_transaction_primary_registrant_billing_information' |
219 | 219 | ), |
220 | 220 | ), |
221 | - 'qtips' => array( 'Transaction_Details_Tips' ), |
|
222 | - 'help_tour' => array( 'Transaction_Details_Help_Tour' ), |
|
221 | + 'qtips' => array('Transaction_Details_Tips'), |
|
222 | + 'help_tour' => array('Transaction_Details_Help_Tour'), |
|
223 | 223 | 'metaboxes' => array('_transaction_details_metaboxes'), |
224 | 224 | |
225 | 225 | 'require_nonce' => FALSE |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | // IF a registration was JUST added via the admin... |
238 | 238 | if ( |
239 | 239 | isset( |
240 | - $this->_req_data[ 'redirect_from' ], |
|
241 | - $this->_req_data[ 'EVT_ID' ], |
|
242 | - $this->_req_data[ 'event_name' ] |
|
240 | + $this->_req_data['redirect_from'], |
|
241 | + $this->_req_data['EVT_ID'], |
|
242 | + $this->_req_data['event_name'] |
|
243 | 243 | ) |
244 | 244 | ) { |
245 | 245 | // then set a cookie so that we can block any attempts to use |
246 | 246 | // the back button as a way to enter another registration. |
247 | - setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' ); |
|
247 | + setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/'); |
|
248 | 248 | // and update the global |
249 | - $_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ]; |
|
249 | + $_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID']; |
|
250 | 250 | } |
251 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
252 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
253 | - EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status; |
|
254 | - EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status; |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
252 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
253 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; |
|
254 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; |
|
255 | 255 | } |
256 | 256 | public function admin_notices() {} |
257 | 257 | public function admin_footer_scripts() {} |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function load_scripts_styles() { |
320 | 320 | //enqueue style |
321 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
321 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
322 | 322 | wp_enqueue_style('espresso_txn'); |
323 | 323 | |
324 | 324 | //scripts |
325 | 325 | add_filter('FHEE_load_accounting_js', '__return_true'); |
326 | 326 | |
327 | 327 | //scripts |
328 | - wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
328 | + wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
329 | 329 | wp_enqueue_script('espresso_txn'); |
330 | 330 | |
331 | 331 | } |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @return void |
366 | 366 | */ |
367 | 367 | protected function _set_list_table_views_default() { |
368 | - $this->_views = array ( |
|
369 | - 'all' => array ( |
|
368 | + $this->_views = array( |
|
369 | + 'all' => array( |
|
370 | 370 | 'slug' => 'all', |
371 | 371 | 'label' => __('View All Transactions', 'event_espresso'), |
372 | 372 | 'count' => 0 |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | * @return void |
395 | 395 | */ |
396 | 396 | private function _set_transaction_object() { |
397 | - if ( is_object( $this->_transaction) ) |
|
397 | + if (is_object($this->_transaction)) |
|
398 | 398 | return; //get out we've already set the object |
399 | 399 | |
400 | 400 | $TXN = EEM_Transaction::instance(); |
401 | 401 | |
402 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
402 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
403 | 403 | |
404 | 404 | //get transaction object |
405 | 405 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
406 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
406 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
407 | 407 | |
408 | - if ( empty( $this->_transaction ) ) { |
|
409 | - $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
410 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
408 | + if (empty($this->_transaction)) { |
|
409 | + $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso'); |
|
410 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | ), |
434 | 434 | 'view_receipt' => array( |
435 | 435 | 'class' => 'dashicons dashicons-media-default', |
436 | - 'desc' => __('View Transaction Receipt', 'event_espresso' ) |
|
436 | + 'desc' => __('View Transaction Receipt', 'event_espresso') |
|
437 | 437 | ), |
438 | 438 | 'view_registration' => array( |
439 | 439 | 'class' => 'dashicons dashicons-clipboard', |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | ) |
443 | 443 | ); |
444 | 444 | |
445 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
445 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
446 | 446 | |
447 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
448 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
447 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
448 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
449 | 449 | $items['send_payment_reminder'] = array( |
450 | 450 | 'class' => 'dashicons dashicons-email-alt', |
451 | 451 | 'desc' => __('Send Payment Reminder', 'event_espresso') |
@@ -466,29 +466,29 @@ discard block |
||
466 | 466 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
467 | 467 | array( |
468 | 468 | 'overpaid' => array( |
469 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
470 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
469 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
470 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
471 | 471 | ), |
472 | 472 | 'complete' => array( |
473 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
474 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
473 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
474 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
475 | 475 | ), |
476 | 476 | 'incomplete' => array( |
477 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
478 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
477 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
478 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
479 | 479 | ), |
480 | 480 | 'abandoned' => array( |
481 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
482 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
481 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
482 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
483 | 483 | ), |
484 | 484 | 'failed' => array( |
485 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
486 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
485 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
486 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
487 | 487 | ) |
488 | 488 | ) |
489 | 489 | ); |
490 | 490 | |
491 | - return array_merge( $items, $more_items); |
|
491 | + return array_merge($items, $more_items); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | |
@@ -501,9 +501,9 @@ discard block |
||
501 | 501 | */ |
502 | 502 | protected function _transactions_overview_list_table() { |
503 | 503 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
504 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
505 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : ''; |
|
506 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
504 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
505 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : ''; |
|
506 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
507 | 507 | $this->display_admin_list_table_page_with_no_sidebar(); |
508 | 508 | } |
509 | 509 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * @return void |
518 | 518 | */ |
519 | 519 | protected function _transaction_details() { |
520 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
521 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
520 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
521 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
522 | 522 | |
523 | 523 | $this->_set_transaction_status_array(); |
524 | 524 | |
@@ -531,14 +531,14 @@ discard block |
||
531 | 531 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
532 | 532 | |
533 | 533 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
534 | - $this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' ); |
|
534 | + $this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso'); |
|
535 | 535 | |
536 | - $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a' ); |
|
537 | - $this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
536 | + $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a'); |
|
537 | + $this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso'); |
|
538 | 538 | |
539 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
540 | - $this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' ); |
|
541 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
539 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
540 | + $this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso'); |
|
541 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
542 | 542 | |
543 | 543 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
544 | 544 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | 'espresso_transactions_send_payment_reminder' |
551 | 551 | ) |
552 | 552 | ) { |
553 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
553 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
554 | 554 | $this->_template_args['send_payment_reminder_button'] = |
555 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
555 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
556 | 556 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
557 | 557 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
558 | 558 | ? EEH_Template::get_button_or_link( |
@@ -574,40 +574,40 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
577 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
578 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
579 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
577 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
578 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
579 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
580 | 580 | } else { |
581 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
581 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
582 | 582 | } |
583 | - $this->_template_args['amount_due_class'] = ''; |
|
583 | + $this->_template_args['amount_due_class'] = ''; |
|
584 | 584 | |
585 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
585 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
586 | 586 | // paid in full |
587 | - $this->_template_args['amount_due'] = FALSE; |
|
588 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
587 | + $this->_template_args['amount_due'] = FALSE; |
|
588 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
589 | 589 | // overpaid |
590 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
591 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
590 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
591 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
592 | 592 | // monies owing |
593 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
594 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
593 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
594 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
595 | 595 | // no payments made yet |
596 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
597 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
596 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
597 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
598 | 598 | // free event |
599 | - $this->_template_args['amount_due'] = FALSE; |
|
599 | + $this->_template_args['amount_due'] = FALSE; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | $payment_method = $this->_transaction->payment_method(); |
603 | 603 | |
604 | 604 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
605 | 605 | ? $payment_method->admin_name() |
606 | - : __( 'Unknown', 'event_espresso' ); |
|
606 | + : __('Unknown', 'event_espresso'); |
|
607 | 607 | |
608 | 608 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
609 | 609 | // link back to overview |
610 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
610 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
611 | 611 | ? $_SERVER['HTTP_REFERER'] |
612 | 612 | : TXN_ADMIN_URL; |
613 | 613 | |
@@ -615,13 +615,13 @@ discard block |
||
615 | 615 | // next link |
616 | 616 | $next_txn = $this->_transaction->next( |
617 | 617 | null, |
618 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
618 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
619 | 619 | 'TXN_ID' |
620 | 620 | ); |
621 | 621 | $this->_template_args['next_transaction'] = $next_txn |
622 | 622 | ? $this->_next_link( |
623 | 623 | EE_Admin_Page::add_query_args_and_nonce( |
624 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
624 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
625 | 625 | TXN_ADMIN_URL |
626 | 626 | ), |
627 | 627 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -630,13 +630,13 @@ discard block |
||
630 | 630 | // previous link |
631 | 631 | $previous_txn = $this->_transaction->previous( |
632 | 632 | null, |
633 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
633 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
634 | 634 | 'TXN_ID' |
635 | 635 | ); |
636 | 636 | $this->_template_args['previous_transaction'] = $previous_txn |
637 | 637 | ? $this->_previous_link( |
638 | 638 | EE_Admin_Page::add_query_args_and_nonce( |
639 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
639 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
640 | 640 | TXN_ADMIN_URL |
641 | 641 | ), |
642 | 642 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -646,16 +646,16 @@ discard block |
||
646 | 646 | // were we just redirected here after adding a new registration ??? |
647 | 647 | if ( |
648 | 648 | isset( |
649 | - $this->_req_data[ 'redirect_from' ], |
|
650 | - $this->_req_data[ 'EVT_ID' ], |
|
651 | - $this->_req_data[ 'event_name' ] |
|
649 | + $this->_req_data['redirect_from'], |
|
650 | + $this->_req_data['EVT_ID'], |
|
651 | + $this->_req_data['event_name'] |
|
652 | 652 | ) |
653 | 653 | ) { |
654 | 654 | if ( |
655 | 655 | EE_Registry::instance()->CAP->current_user_can( |
656 | 656 | 'ee_edit_registrations', |
657 | 657 | 'espresso_registrations_new_registration', |
658 | - $this->_req_data[ 'EVT_ID' ] |
|
658 | + $this->_req_data['EVT_ID'] |
|
659 | 659 | ) |
660 | 660 | ) { |
661 | 661 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | 'action' => 'new_registration', |
666 | 666 | 'return' => 'default', |
667 | 667 | 'TXN_ID' => $this->_transaction->ID(), |
668 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
668 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
669 | 669 | ), |
670 | 670 | REG_ADMIN_URL |
671 | 671 | ); |
@@ -673,17 +673,17 @@ discard block |
||
673 | 673 | |
674 | 674 | $this->_admin_page_title .= sprintf( |
675 | 675 | __('Add Another New Registration to Event: "%1$s" ?'), |
676 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
676 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
677 | 677 | ); |
678 | 678 | $this->_admin_page_title .= '</a>'; |
679 | 679 | } |
680 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
680 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
681 | 681 | } |
682 | 682 | // grab messages at the last second |
683 | 683 | $this->_template_args['notices'] = EE_Error::get_notices(); |
684 | 684 | // path to template |
685 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
686 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
685 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
686 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
687 | 687 | |
688 | 688 | // the details template wrapper |
689 | 689 | $this->display_admin_page_with_sidebar(); |
@@ -702,18 +702,18 @@ discard block |
||
702 | 702 | |
703 | 703 | $this->_set_transaction_object(); |
704 | 704 | |
705 | - add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
705 | + add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
706 | 706 | add_meta_box( |
707 | 707 | 'edit-txn-attendees-mbox', |
708 | - __( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
709 | - array( $this, 'txn_attendees_meta_box' ), |
|
708 | + __('Attendees Registered in this Transaction', 'event_espresso'), |
|
709 | + array($this, 'txn_attendees_meta_box'), |
|
710 | 710 | $this->_wp_page_slug, |
711 | 711 | 'normal', |
712 | 712 | 'high', |
713 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
713 | + array('TXN_ID' => $this->_transaction->ID()) |
|
714 | 714 | ); |
715 | - add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
716 | - add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
715 | + add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
716 | + add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
717 | 717 | |
718 | 718 | } |
719 | 719 | |
@@ -734,15 +734,15 @@ discard block |
||
734 | 734 | |
735 | 735 | //get line table |
736 | 736 | EEH_Autoloader::register_line_item_display_autoloaders(); |
737 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
738 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
737 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
738 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
739 | 739 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
740 | 740 | |
741 | 741 | // process taxes |
742 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
743 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
742 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
743 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
744 | 744 | |
745 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
745 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
746 | 746 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
747 | 747 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
748 | 748 | |
@@ -750,63 +750,63 @@ discard block |
||
750 | 750 | |
751 | 751 | // process payment details |
752 | 752 | $payments = $this->_transaction->get_many_related('Payment'); |
753 | - if( ! empty( $payments ) ) { |
|
754 | - $this->_template_args[ 'payments' ] = $payments; |
|
755 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
753 | + if ( ! empty($payments)) { |
|
754 | + $this->_template_args['payments'] = $payments; |
|
755 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
756 | 756 | } else { |
757 | - $this->_template_args[ 'payments' ] = false; |
|
758 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
757 | + $this->_template_args['payments'] = false; |
|
758 | + $this->_template_args['existing_reg_payments'] = array(); |
|
759 | 759 | } |
760 | 760 | |
761 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
762 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
761 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
762 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
763 | 763 | |
764 | - if ( isset( $txn_details['invoice_number'] )) { |
|
764 | + if (isset($txn_details['invoice_number'])) { |
|
765 | 765 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
766 | - $this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' ); |
|
766 | + $this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso'); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
770 | - $this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
770 | + $this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
771 | 771 | |
772 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
773 | - $this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' ); |
|
772 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
773 | + $this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso'); |
|
774 | 774 | |
775 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
776 | - $this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
775 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
776 | + $this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
777 | 777 | |
778 | 778 | $reg_steps = '<ul>'; |
779 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
780 | - if ( $reg_step_status === true ) { |
|
781 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
782 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
783 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
784 | - __( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
785 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
786 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
787 | - ) . '</li>'; |
|
779 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
780 | + if ($reg_step_status === true) { |
|
781 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
782 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
783 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
784 | + __('%1$s : Initiated %2$s', 'event_espresso'), |
|
785 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
786 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
787 | + ).'</li>'; |
|
788 | 788 | } else { |
789 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
789 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | $reg_steps .= '</ul>'; |
793 | 793 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
794 | - $this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' ); |
|
794 | + $this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso'); |
|
795 | 795 | |
796 | 796 | |
797 | 797 | $this->_get_registrations_to_apply_payment_to(); |
798 | - $this->_get_payment_methods( $payments ); |
|
798 | + $this->_get_payment_methods($payments); |
|
799 | 799 | $this->_get_payment_status_array(); |
800 | 800 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
801 | 801 | |
802 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
803 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
804 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
802 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
803 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
804 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
805 | 805 | |
806 | 806 | // 'espresso_delete_payment_nonce' |
807 | 807 | |
808 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
809 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
808 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
809 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
810 | 810 | |
811 | 811 | } |
812 | 812 | |
@@ -821,27 +821,27 @@ discard block |
||
821 | 821 | * @param EE_Payment[] $payments |
822 | 822 | * @return array |
823 | 823 | */ |
824 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
824 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
825 | 825 | $existing_reg_payments = array(); |
826 | 826 | // get all reg payments for these payments |
827 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
827 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
828 | 828 | array( |
829 | 829 | 'PAY_ID' => array( |
830 | 830 | 'IN', |
831 | - array_keys( $payments ) |
|
831 | + array_keys($payments) |
|
832 | 832 | ) |
833 | 833 | ) |
834 | - ) ); |
|
835 | - if ( ! empty( $reg_payments ) ) { |
|
836 | - foreach ( $payments as $payment ) { |
|
837 | - if ( ! $payment instanceof EE_Payment ) { |
|
834 | + )); |
|
835 | + if ( ! empty($reg_payments)) { |
|
836 | + foreach ($payments as $payment) { |
|
837 | + if ( ! $payment instanceof EE_Payment) { |
|
838 | 838 | continue; |
839 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
840 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
839 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
840 | + $existing_reg_payments[$payment->ID()] = array(); |
|
841 | 841 | } |
842 | - foreach ( $reg_payments as $reg_payment ) { |
|
843 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
844 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
842 | + foreach ($reg_payments as $reg_payment) { |
|
843 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
844 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
845 | 845 | } |
846 | 846 | } |
847 | 847 | } |
@@ -878,39 +878,39 @@ discard block |
||
878 | 878 | $registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">'; |
879 | 879 | $registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">'; |
880 | 880 | $registrations_to_apply_payment_to .= '<thead><tr>'; |
881 | - $registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>'; |
|
882 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>'; |
|
883 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>'; |
|
884 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>'; |
|
885 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>'; |
|
886 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>'; |
|
887 | - $registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>'; |
|
881 | + $registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>'; |
|
882 | + $registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>'; |
|
883 | + $registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>'; |
|
884 | + $registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>'; |
|
885 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>'; |
|
886 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>'; |
|
887 | + $registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>'; |
|
888 | 888 | $registrations_to_apply_payment_to .= '</tr></thead><tbody>'; |
889 | 889 | // get registrations for TXN |
890 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
891 | - foreach ( $registrations as $registration ) { |
|
892 | - if ( $registration instanceof EE_Registration ) { |
|
890 | + $registrations = $this->_transaction->registrations($query_params); |
|
891 | + foreach ($registrations as $registration) { |
|
892 | + if ($registration instanceof EE_Registration) { |
|
893 | 893 | $owing = $registration->final_price() - $registration->paid(); |
894 | - $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : ''; |
|
895 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : ''; |
|
896 | - $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">'; |
|
894 | + $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : ''; |
|
895 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : ''; |
|
896 | + $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">'; |
|
897 | 897 | // add html for checkbox input and label |
898 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>'; |
|
899 | - $registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>'; |
|
900 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>'; |
|
901 | - $registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>'; |
|
902 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>'; |
|
903 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>'; |
|
898 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>'; |
|
899 | + $registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>'; |
|
900 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>'; |
|
901 | + $registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>'; |
|
902 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>'; |
|
903 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>'; |
|
904 | 904 | $registrations_to_apply_payment_to .= '<td class="jst-cntr">'; |
905 | 905 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
906 | - $registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>'; |
|
906 | + $registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>'; |
|
907 | 907 | $registrations_to_apply_payment_to .= '</td>'; |
908 | 908 | $registrations_to_apply_payment_to .= '</tr>'; |
909 | 909 | } |
910 | 910 | } |
911 | 911 | $registrations_to_apply_payment_to .= '</tbody></table></div>'; |
912 | - $registrations_to_apply_payment_to .= '<p class="clear description">' . __( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>'; |
|
913 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
912 | + $registrations_to_apply_payment_to .= '<p class="clear description">'.__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>'; |
|
913 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | |
@@ -927,9 +927,9 @@ discard block |
||
927 | 927 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
928 | 928 | //let's add a "don't change" option. |
929 | 929 | $status_array['NAN'] = __('Leave the Same', 'event_espresso'); |
930 | - $status_array = array_merge( $status_array, $statuses ); |
|
931 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' ); |
|
932 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' ); |
|
930 | + $status_array = array_merge($status_array, $statuses); |
|
931 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status'); |
|
932 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status'); |
|
933 | 933 | |
934 | 934 | } |
935 | 935 | |
@@ -944,21 +944,21 @@ discard block |
||
944 | 944 | * @param EE_Payment[] to show on this page |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - private function _get_payment_methods( $payments = array() ) { |
|
947 | + private function _get_payment_methods($payments = array()) { |
|
948 | 948 | $payment_methods_of_payments = array(); |
949 | - foreach( $payments as $payment ){ |
|
950 | - if( $payment instanceof EE_Payment ){ |
|
951 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
949 | + foreach ($payments as $payment) { |
|
950 | + if ($payment instanceof EE_Payment) { |
|
951 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
952 | 952 | } |
953 | 953 | } |
954 | - if( $payment_methods_of_payments ){ |
|
955 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
956 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
957 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
958 | - }else{ |
|
959 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
954 | + if ($payment_methods_of_payments) { |
|
955 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
956 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
957 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
958 | + } else { |
|
959 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
960 | 960 | } |
961 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
961 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | |
@@ -972,46 +972,46 @@ discard block |
||
972 | 972 | * @param array $metabox |
973 | 973 | * @return void |
974 | 974 | */ |
975 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
975 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
976 | 976 | |
977 | - extract( $metabox['args'] ); |
|
977 | + extract($metabox['args']); |
|
978 | 978 | $this->_template_args['post'] = $post; |
979 | 979 | $this->_template_args['event_attendees'] = array(); |
980 | 980 | // process items in cart |
981 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
982 | - if ( ! empty( $line_items )) { |
|
983 | - foreach ( $line_items as $item ) { |
|
984 | - if ( $item instanceof EE_Line_Item ) { |
|
985 | - switch( $item->OBJ_type() ) { |
|
981 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
982 | + if ( ! empty($line_items)) { |
|
983 | + foreach ($line_items as $item) { |
|
984 | + if ($item instanceof EE_Line_Item) { |
|
985 | + switch ($item->OBJ_type()) { |
|
986 | 986 | |
987 | 987 | case 'Event' : |
988 | 988 | break; |
989 | 989 | |
990 | 990 | case 'Ticket' : |
991 | 991 | $ticket = $item->ticket(); |
992 | - if ( empty( $ticket )) { |
|
992 | + if (empty($ticket)) { |
|
993 | 993 | continue; //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
994 | 994 | } |
995 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' )); |
|
995 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
996 | 996 | $event = $ticket->get_first_related('Registration')->get_first_related('Event'); |
997 | - $event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : ''; |
|
997 | + $event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : ''; |
|
998 | 998 | |
999 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1000 | - foreach( $registrations as $registration ) { |
|
1001 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1002 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1003 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
999 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1000 | + foreach ($registrations as $registration) { |
|
1001 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1002 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1003 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1004 | 1004 | // attendee info |
1005 | 1005 | $attendee = $registration->get_first_related('Attendee'); |
1006 | - if ( $attendee instanceof EE_Attendee ) { |
|
1006 | + if ($attendee instanceof EE_Attendee) { |
|
1007 | 1007 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
1008 | 1008 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
1009 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1010 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array() ); |
|
1009 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1010 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array()); |
|
1011 | 1011 | } else { |
1012 | 1012 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1013 | 1013 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
1014 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1014 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1015 | 1015 | $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
1016 | 1016 | } |
1017 | 1017 | } |
@@ -1021,12 +1021,12 @@ discard block |
||
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | |
1024 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1025 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1024 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1025 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1026 | 1026 | |
1027 | 1027 | } else { |
1028 | 1028 | echo sprintf( |
1029 | - __( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1029 | + __('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1030 | 1030 | '<p class="important-notice">', |
1031 | 1031 | '</p>' |
1032 | 1032 | ); |
@@ -1045,20 +1045,20 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | public function txn_registrant_side_meta_box() { |
1047 | 1047 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1048 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1048 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1049 | 1049 | $this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1050 | 1050 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1051 | 1051 | } |
1052 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1052 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1053 | 1053 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1054 | 1054 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1055 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1055 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1056 | 1056 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1057 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID() ), REG_ADMIN_URL ); |
|
1057 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL); |
|
1058 | 1058 | // get formatted address for registrant |
1059 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1060 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1061 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1059 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1060 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1061 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | |
@@ -1074,12 +1074,12 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1076 | 1076 | $this->_template_args['billing_form_url'] = add_query_arg( |
1077 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1077 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1078 | 1078 | TXN_ADMIN_URL |
1079 | 1079 | ); |
1080 | 1080 | |
1081 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1082 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1081 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1082 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | |
@@ -1092,42 +1092,42 @@ discard block |
||
1092 | 1092 | * @return void |
1093 | 1093 | */ |
1094 | 1094 | public function apply_payments_or_refunds() { |
1095 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1095 | + $json_response_data = array('return_data' => FALSE); |
|
1096 | 1096 | $valid_data = $this->_validate_payment_request_data(); |
1097 | - if ( ! empty( $valid_data ) ) { |
|
1098 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1097 | + if ( ! empty($valid_data)) { |
|
1098 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1099 | 1099 | //save the new payment |
1100 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1100 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1101 | 1101 | // get the TXN for this payment |
1102 | 1102 | $transaction = $payment->transaction(); |
1103 | 1103 | // verify transaction |
1104 | - if ( $transaction instanceof EE_Transaction ) { |
|
1104 | + if ($transaction instanceof EE_Transaction) { |
|
1105 | 1105 | // calculate_total_payments_and_update_status |
1106 | - $this->_process_transaction_payments( $transaction ); |
|
1107 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1108 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1106 | + $this->_process_transaction_payments($transaction); |
|
1107 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1108 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1109 | 1109 | // apply payment to registrations (if applicable) |
1110 | - if ( ! empty( $REG_IDs ) ) { |
|
1111 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1110 | + if ( ! empty($REG_IDs)) { |
|
1111 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1112 | 1112 | $this->_maybe_send_notifications(); |
1113 | 1113 | // now process status changes for the same registrations |
1114 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1114 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1115 | 1115 | } |
1116 | - $this->_maybe_send_notifications( $payment ); |
|
1116 | + $this->_maybe_send_notifications($payment); |
|
1117 | 1117 | //prepare to render page |
1118 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1119 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1118 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1119 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1120 | 1120 | } else { |
1121 | 1121 | EE_Error::add_error( |
1122 | - __( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1122 | + __('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1123 | 1123 | __FILE__, __FUNCTION__, __LINE__ |
1124 | 1124 | ); |
1125 | 1125 | } |
1126 | 1126 | } else { |
1127 | - EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1127 | + EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1130 | + $notices = EE_Error::get_notices(false, false, false); |
|
1131 | 1131 | $this->_template_args = array( |
1132 | 1132 | 'data' => $json_response_data, |
1133 | 1133 | 'error' => $notices['errors'], |
@@ -1144,30 +1144,30 @@ discard block |
||
1144 | 1144 | * @return array |
1145 | 1145 | */ |
1146 | 1146 | protected function _validate_payment_request_data() { |
1147 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1147 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1148 | 1148 | return false; |
1149 | 1149 | } |
1150 | 1150 | $payment_form = $this->_generate_payment_form_section(); |
1151 | 1151 | try { |
1152 | - if ( $payment_form->was_submitted() ) { |
|
1152 | + if ($payment_form->was_submitted()) { |
|
1153 | 1153 | $payment_form->receive_form_submission(); |
1154 | - if ( ! $payment_form->is_valid() ) { |
|
1154 | + if ( ! $payment_form->is_valid()) { |
|
1155 | 1155 | $submission_error_messages = array(); |
1156 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1157 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1156 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1157 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1158 | 1158 | $submission_error_messages[] = sprintf( |
1159 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1159 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1160 | 1160 | $validation_error->get_form_section()->html_label_text(), |
1161 | 1161 | $validation_error->getMessage() |
1162 | 1162 | ); |
1163 | 1163 | } |
1164 | 1164 | } |
1165 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1165 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1166 | 1166 | return array(); |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | - } catch ( EE_Error $e ) { |
|
1170 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1169 | + } catch (EE_Error $e) { |
|
1170 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1171 | 1171 | return array(); |
1172 | 1172 | } |
1173 | 1173 | return $payment_form->valid_data(); |
@@ -1189,63 +1189,63 @@ discard block |
||
1189 | 1189 | array( |
1190 | 1190 | 'default' => 0, |
1191 | 1191 | 'required' => false, |
1192 | - 'html_label_text' => __( 'Payment ID', 'event_espresso' ), |
|
1193 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1192 | + 'html_label_text' => __('Payment ID', 'event_espresso'), |
|
1193 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1194 | 1194 | ) |
1195 | 1195 | ), |
1196 | 1196 | 'TXN_ID' => new EE_Text_Input( |
1197 | 1197 | array( |
1198 | 1198 | 'default' => 0, |
1199 | 1199 | 'required' => true, |
1200 | - 'html_label_text' => __( 'Transaction ID', 'event_espresso' ), |
|
1201 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1200 | + 'html_label_text' => __('Transaction ID', 'event_espresso'), |
|
1201 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1202 | 1202 | ) |
1203 | 1203 | ), |
1204 | 1204 | 'type' => new EE_Text_Input( |
1205 | 1205 | array( |
1206 | 1206 | 'default' => 1, |
1207 | 1207 | 'required' => true, |
1208 | - 'html_label_text' => __( 'Payment or Refund', 'event_espresso' ), |
|
1209 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1208 | + 'html_label_text' => __('Payment or Refund', 'event_espresso'), |
|
1209 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1210 | 1210 | ) |
1211 | 1211 | ), |
1212 | 1212 | 'amount' => new EE_Text_Input( |
1213 | 1213 | array( |
1214 | 1214 | 'default' => 0, |
1215 | 1215 | 'required' => true, |
1216 | - 'html_label_text' => __( 'Payment amount', 'event_espresso' ), |
|
1217 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1216 | + 'html_label_text' => __('Payment amount', 'event_espresso'), |
|
1217 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1218 | 1218 | ) |
1219 | 1219 | ), |
1220 | 1220 | 'status' => new EE_Text_Input( |
1221 | 1221 | array( |
1222 | 1222 | 'default' => EEM_Payment::status_id_approved, |
1223 | 1223 | 'required' => true, |
1224 | - 'html_label_text' => __( 'Payment status', 'event_espresso' ), |
|
1224 | + 'html_label_text' => __('Payment status', 'event_espresso'), |
|
1225 | 1225 | ) |
1226 | 1226 | ), |
1227 | 1227 | 'PMD_ID' => new EE_Text_Input( |
1228 | 1228 | array( |
1229 | 1229 | 'default' => 2, |
1230 | 1230 | 'required' => true, |
1231 | - 'html_label_text' => __( 'Payment Method', 'event_espresso' ), |
|
1232 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1231 | + 'html_label_text' => __('Payment Method', 'event_espresso'), |
|
1232 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1233 | 1233 | ) |
1234 | 1234 | ), |
1235 | 1235 | 'date' => new EE_Text_Input( |
1236 | 1236 | array( |
1237 | 1237 | 'default' => time(), |
1238 | 1238 | 'required' => true, |
1239 | - 'html_label_text' => __( 'Payment date', 'event_espresso' ), |
|
1239 | + 'html_label_text' => __('Payment date', 'event_espresso'), |
|
1240 | 1240 | ) |
1241 | 1241 | ), |
1242 | 1242 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1243 | 1243 | array( |
1244 | 1244 | 'default' => '', |
1245 | 1245 | 'required' => false, |
1246 | - 'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1246 | + 'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'), |
|
1247 | 1247 | 'validation_strategies' => array( |
1248 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1248 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1249 | 1249 | ) |
1250 | 1250 | ) |
1251 | 1251 | ), |
@@ -1253,9 +1253,9 @@ discard block |
||
1253 | 1253 | array( |
1254 | 1254 | 'default' => '', |
1255 | 1255 | 'required' => false, |
1256 | - 'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ), |
|
1256 | + 'html_label_text' => __('Purchase Order Number', 'event_espresso'), |
|
1257 | 1257 | 'validation_strategies' => array( |
1258 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1258 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1259 | 1259 | ) |
1260 | 1260 | ) |
1261 | 1261 | ), |
@@ -1263,9 +1263,9 @@ discard block |
||
1263 | 1263 | array( |
1264 | 1264 | 'default' => '', |
1265 | 1265 | 'required' => false, |
1266 | - 'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ), |
|
1266 | + 'html_label_text' => __('Extra Field for Accounting', 'event_espresso'), |
|
1267 | 1267 | 'validation_strategies' => array( |
1268 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1268 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1269 | 1269 | ) |
1270 | 1270 | ) |
1271 | 1271 | ), |
@@ -1282,37 +1282,37 @@ discard block |
||
1282 | 1282 | * @param array $valid_data |
1283 | 1283 | * @return EE_Payment |
1284 | 1284 | */ |
1285 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1286 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1285 | + protected function _create_payment_from_request_data($valid_data) { |
|
1286 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1287 | 1287 | // get payment amount |
1288 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1288 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1289 | 1289 | // payments have a type value of 1 and refunds have a type value of -1 |
1290 | 1290 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1291 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1291 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1292 | 1292 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1293 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1293 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1294 | 1294 | $payment = EE_Payment::new_instance( |
1295 | 1295 | array( |
1296 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1297 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1296 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1297 | + 'STS_ID' => $valid_data['status'], |
|
1298 | 1298 | 'PAY_timestamp' => $date, |
1299 | 1299 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1300 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1300 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1301 | 1301 | 'PAY_amount' => $amount, |
1302 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1303 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1304 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1302 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1303 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1304 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1305 | 1305 | 'PAY_details' => $valid_data, |
1306 | 1306 | 'PAY_ID' => $PAY_ID |
1307 | 1307 | ), |
1308 | 1308 | '', |
1309 | - array( 'Y-m-d', 'g:i a' ) |
|
1309 | + array('Y-m-d', 'g:i a') |
|
1310 | 1310 | ); |
1311 | 1311 | |
1312 | - if ( ! $payment->save() ) { |
|
1312 | + if ( ! $payment->save()) { |
|
1313 | 1313 | EE_Error::add_error( |
1314 | 1314 | sprintf( |
1315 | - __( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1315 | + __('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1316 | 1316 | $payment->ID() |
1317 | 1317 | ), |
1318 | 1318 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1329,15 +1329,15 @@ discard block |
||
1329 | 1329 | * @param \EE_Transaction $transaction |
1330 | 1330 | * @return array |
1331 | 1331 | */ |
1332 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1332 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1333 | 1333 | /** @type EE_Transaction_Payments $transaction_payments */ |
1334 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1334 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1335 | 1335 | //update the transaction with this payment |
1336 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1337 | - EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1337 | + EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1338 | 1338 | } else { |
1339 | 1339 | EE_Error::add_error( |
1340 | - __( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1340 | + __('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1341 | 1341 | , __FILE__, __FUNCTION__, __LINE__ |
1342 | 1342 | ); |
1343 | 1343 | } |
@@ -1353,19 +1353,19 @@ discard block |
||
1353 | 1353 | * @param \EE_Payment $payment |
1354 | 1354 | * @return array |
1355 | 1355 | */ |
1356 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1356 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1357 | 1357 | $REG_IDs = array(); |
1358 | 1358 | // grab array of IDs for specific registrations to apply changes to |
1359 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1360 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1359 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1360 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1361 | 1361 | } |
1362 | 1362 | //nothing specified ? then get all reg IDs |
1363 | - if ( empty( $REG_IDs ) ) { |
|
1363 | + if (empty($REG_IDs)) { |
|
1364 | 1364 | $registrations = $payment->transaction()->registrations(); |
1365 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1365 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1366 | 1366 | } |
1367 | 1367 | // ensure that REG_IDs are integers and NOT strings |
1368 | - return array_map( 'intval', $REG_IDs ); |
|
1368 | + return array_map('intval', $REG_IDs); |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | /** |
1383 | 1383 | * @param array $existing_reg_payment_REG_IDs |
1384 | 1384 | */ |
1385 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1385 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1386 | 1386 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1387 | 1387 | } |
1388 | 1388 | |
@@ -1397,13 +1397,13 @@ discard block |
||
1397 | 1397 | * @param \EE_Payment $payment |
1398 | 1398 | * @return array |
1399 | 1399 | */ |
1400 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1401 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1400 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1401 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1402 | 1402 | // let's get any existing reg payment records for this payment |
1403 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1403 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1404 | 1404 | // but we only want the REG IDs, so grab the array keys |
1405 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1406 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1405 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1406 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1407 | 1407 | } |
1408 | 1408 | return $this->existing_reg_payment_REG_IDs(); |
1409 | 1409 | } |
@@ -1422,23 +1422,23 @@ discard block |
||
1422 | 1422 | * @param int $PAY_ID |
1423 | 1423 | * @return bool; |
1424 | 1424 | */ |
1425 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1425 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1426 | 1426 | // newly created payments will have nothing recorded for $PAY_ID |
1427 | - if ( $PAY_ID == 0 ) { |
|
1427 | + if ($PAY_ID == 0) { |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1431 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1430 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1431 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1432 | 1432 | return false; |
1433 | 1433 | } |
1434 | 1434 | /** @type EE_Transaction_Payments $transaction_payments */ |
1435 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1435 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1436 | 1436 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1437 | 1437 | $payment, |
1438 | 1438 | array( |
1439 | 1439 | array( |
1440 | 1440 | 'PAY_ID' => $payment->ID(), |
1441 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1441 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1442 | 1442 | ) |
1443 | 1443 | ) |
1444 | 1444 | ); |
@@ -1457,25 +1457,25 @@ discard block |
||
1457 | 1457 | * @param array $REG_IDs |
1458 | 1458 | * @return bool |
1459 | 1459 | */ |
1460 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1460 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1461 | 1461 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1462 | 1462 | // so let's do that using our set of REG_IDs from the form |
1463 | 1463 | $registration_query_where_params = array( |
1464 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1464 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1465 | 1465 | ); |
1466 | 1466 | // but add in some conditions regarding payment, |
1467 | 1467 | // so that we don't apply payments to registrations that are free or have already been paid for |
1468 | 1468 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1469 | - if ( ! $payment->is_a_refund() ) { |
|
1470 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1471 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1469 | + if ( ! $payment->is_a_refund()) { |
|
1470 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1471 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1472 | 1472 | } |
1473 | 1473 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1474 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1475 | - if ( ! empty( $registrations ) ) { |
|
1474 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1475 | + if ( ! empty($registrations)) { |
|
1476 | 1476 | /** @type EE_Payment_Processor $payment_processor */ |
1477 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1478 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1477 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1478 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1479 | 1479 | } |
1480 | 1480 | } |
1481 | 1481 | |
@@ -1491,22 +1491,22 @@ discard block |
||
1491 | 1491 | * @param array $REG_IDs |
1492 | 1492 | * @return bool |
1493 | 1493 | */ |
1494 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1494 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1495 | 1495 | // first if there is no change in status then we get out. |
1496 | 1496 | if ( |
1497 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1497 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1498 | 1498 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1499 | 1499 | ) { |
1500 | 1500 | //no error message, no change requested, just nothing to do man. |
1501 | 1501 | return FALSE; |
1502 | 1502 | } |
1503 | 1503 | /** @type EE_Transaction_Processor $transaction_processor */ |
1504 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1504 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1505 | 1505 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1506 | 1506 | return $transaction_processor->manually_update_registration_statuses( |
1507 | 1507 | $transaction, |
1508 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1509 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1508 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1509 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1510 | 1510 | ); |
1511 | 1511 | } |
1512 | 1512 | |
@@ -1521,16 +1521,16 @@ discard block |
||
1521 | 1521 | * @param bool | null $delete_txn_reg_status_change |
1522 | 1522 | * @return array |
1523 | 1523 | */ |
1524 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1524 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1525 | 1525 | // was the payment deleted ? |
1526 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1526 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1527 | 1527 | return array( |
1528 | 1528 | 'PAY_ID' => $payment->ID(), |
1529 | 1529 | 'amount' => $payment->amount(), |
1530 | 1530 | 'total_paid' => $payment->transaction()->paid(), |
1531 | 1531 | 'txn_status' => $payment->transaction()->status_ID(), |
1532 | 1532 | 'pay_status' => $payment->STS_ID(), |
1533 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1533 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1534 | 1534 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1535 | 1535 | ); |
1536 | 1536 | } else { |
@@ -1542,16 +1542,16 @@ discard block |
||
1542 | 1542 | 'pay_status' => $payment->STS_ID(), |
1543 | 1543 | 'PAY_ID' => $payment->ID(), |
1544 | 1544 | 'STS_ID' => $payment->STS_ID(), |
1545 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1546 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1547 | - 'method' => strtoupper( $payment->source() ), |
|
1545 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1546 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1547 | + 'method' => strtoupper($payment->source()), |
|
1548 | 1548 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1549 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ), |
|
1549 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'), |
|
1550 | 1550 | 'gateway_response' => $payment->gateway_response(), |
1551 | 1551 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1552 | 1552 | 'po_number' => $payment->po_number(), |
1553 | 1553 | 'extra_accntng' => $payment->extra_accntng(), |
1554 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1554 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1555 | 1555 | ); |
1556 | 1556 | } |
1557 | 1557 | } |
@@ -1566,39 +1566,39 @@ discard block |
||
1566 | 1566 | * @return void |
1567 | 1567 | */ |
1568 | 1568 | public function delete_payment() { |
1569 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1570 | - $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
|
1571 | - if ( $PAY_ID ) { |
|
1572 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1573 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1574 | - if ( $payment instanceof EE_Payment ) { |
|
1575 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1569 | + $json_response_data = array('return_data' => FALSE); |
|
1570 | + $PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0; |
|
1571 | + if ($PAY_ID) { |
|
1572 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1573 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1574 | + if ($payment instanceof EE_Payment) { |
|
1575 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1576 | 1576 | /** @type EE_Transaction_Payments $transaction_payments */ |
1577 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1578 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1579 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1580 | - if ( $delete_txn_reg_status_change ) { |
|
1577 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1578 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1579 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1580 | + if ($delete_txn_reg_status_change) { |
|
1581 | 1581 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1582 | 1582 | //MAKE sure we also add the delete_txn_req_status_change to the |
1583 | 1583 | //$_REQUEST global because that's how messages will be looking for it. |
1584 | 1584 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1585 | 1585 | $this->_maybe_send_notifications(); |
1586 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1586 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1587 | 1587 | } |
1588 | 1588 | } |
1589 | 1589 | } else { |
1590 | 1590 | EE_Error::add_error( |
1591 | - __( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1591 | + __('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1592 | 1592 | __FILE__, __FUNCTION__, __LINE__ |
1593 | 1593 | ); |
1594 | 1594 | } |
1595 | 1595 | } else { |
1596 | 1596 | EE_Error::add_error( |
1597 | - __( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1597 | + __('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1598 | 1598 | __FILE__, __FUNCTION__, __LINE__ |
1599 | 1599 | ); |
1600 | 1600 | } |
1601 | - $notices = EE_Error::get_notices( false, false, false); |
|
1601 | + $notices = EE_Error::get_notices(false, false, false); |
|
1602 | 1602 | $this->_template_args = array( |
1603 | 1603 | 'data' => $json_response_data, |
1604 | 1604 | 'success' => $notices['success'], |
@@ -1618,17 +1618,17 @@ discard block |
||
1618 | 1618 | * @param array $REG_IDs |
1619 | 1619 | * @return array |
1620 | 1620 | */ |
1621 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1621 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1622 | 1622 | $registration_payment_data = array(); |
1623 | 1623 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1624 | - if ( ! empty( $REG_IDs ) ) { |
|
1625 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
1626 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1627 | - foreach ( $registrations as $registration ) { |
|
1628 | - if ( $registration instanceof EE_Registration ) { |
|
1629 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1624 | + if ( ! empty($REG_IDs)) { |
|
1625 | + EE_Registry::instance()->load_helper('Template'); |
|
1626 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1627 | + foreach ($registrations as $registration) { |
|
1628 | + if ($registration instanceof EE_Registration) { |
|
1629 | + $registration_payment_data[$registration->ID()] = array( |
|
1630 | 1630 | 'paid' => $registration->pretty_paid(), |
1631 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1631 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1632 | 1632 | ); |
1633 | 1633 | } |
1634 | 1634 | } |
@@ -1648,30 +1648,30 @@ discard block |
||
1648 | 1648 | * @access protected |
1649 | 1649 | * @param \EE_Payment | null $payment |
1650 | 1650 | */ |
1651 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1652 | - switch ( $payment instanceof EE_Payment ) { |
|
1651 | + protected function _maybe_send_notifications($payment = null) { |
|
1652 | + switch ($payment instanceof EE_Payment) { |
|
1653 | 1653 | // payment notifications |
1654 | 1654 | case true : |
1655 | 1655 | if ( |
1656 | 1656 | isset( |
1657 | - $this->_req_data[ 'txn_payments' ], |
|
1658 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1657 | + $this->_req_data['txn_payments'], |
|
1658 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1659 | 1659 | ) && |
1660 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1660 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1661 | 1661 | ) { |
1662 | - $this->_process_payment_notification( $payment ); |
|
1662 | + $this->_process_payment_notification($payment); |
|
1663 | 1663 | } |
1664 | 1664 | break; |
1665 | 1665 | // registration notifications |
1666 | 1666 | case false : |
1667 | 1667 | if ( |
1668 | 1668 | isset( |
1669 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1670 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1669 | + $this->_req_data['txn_reg_status_change'], |
|
1670 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1671 | 1671 | ) && |
1672 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1672 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1673 | 1673 | ) { |
1674 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1674 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1675 | 1675 | } |
1676 | 1676 | break; |
1677 | 1677 | } |
@@ -1687,11 +1687,11 @@ discard block |
||
1687 | 1687 | * @return void |
1688 | 1688 | */ |
1689 | 1689 | protected function _send_payment_reminder() { |
1690 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1691 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1692 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1693 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1694 | - $this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE ); |
|
1690 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1691 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1692 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1693 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1694 | + $this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE); |
|
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | |
@@ -1705,36 +1705,36 @@ discard block |
||
1705 | 1705 | * @param string $view |
1706 | 1706 | * @return mixed int = count || array of transaction objects |
1707 | 1707 | */ |
1708 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1708 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1709 | 1709 | |
1710 | 1710 | $TXN = EEM_Transaction::instance(); |
1711 | 1711 | |
1712 | - $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' )); |
|
1713 | - $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' ); |
|
1712 | + $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')); |
|
1713 | + $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'); |
|
1714 | 1714 | |
1715 | 1715 | //make sure our timestamps start and end right at the boundaries for each day |
1716 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1717 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1716 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1717 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1718 | 1718 | |
1719 | 1719 | |
1720 | 1720 | //convert to timestamps |
1721 | - $start_date = strtotime( $start_date ); |
|
1722 | - $end_date = strtotime( $end_date ); |
|
1721 | + $start_date = strtotime($start_date); |
|
1722 | + $end_date = strtotime($end_date); |
|
1723 | 1723 | |
1724 | 1724 | //makes sure start date is the lowest value and vice versa |
1725 | - $start_date = min( $start_date, $end_date ); |
|
1726 | - $end_date = max( $start_date, $end_date ); |
|
1725 | + $start_date = min($start_date, $end_date); |
|
1726 | + $end_date = max($start_date, $end_date); |
|
1727 | 1727 | |
1728 | 1728 | //convert to correct format for query |
1729 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
1730 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
1729 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
1730 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
1731 | 1731 | |
1732 | 1732 | |
1733 | 1733 | |
1734 | 1734 | //set orderby |
1735 | 1735 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1736 | 1736 | |
1737 | - switch ( $this->_req_data['orderby'] ) { |
|
1737 | + switch ($this->_req_data['orderby']) { |
|
1738 | 1738 | case 'TXN_ID': |
1739 | 1739 | $orderby = 'TXN_ID'; |
1740 | 1740 | break; |
@@ -1748,66 +1748,66 @@ discard block |
||
1748 | 1748 | $orderby = 'TXN_timestamp'; |
1749 | 1749 | } |
1750 | 1750 | |
1751 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1752 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1753 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1754 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1751 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1752 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1753 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1754 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1755 | 1755 | |
1756 | - $offset = ($current_page-1)*$per_page; |
|
1757 | - $limit = array( $offset, $per_page ); |
|
1756 | + $offset = ($current_page - 1) * $per_page; |
|
1757 | + $limit = array($offset, $per_page); |
|
1758 | 1758 | |
1759 | 1759 | $_where = array( |
1760 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1760 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1761 | 1761 | 'Registration.REG_count' => 1 |
1762 | 1762 | ); |
1763 | 1763 | |
1764 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1764 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1765 | 1765 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1766 | 1766 | } |
1767 | 1767 | |
1768 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1769 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1768 | + if (isset($this->_req_data['s'])) { |
|
1769 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1770 | 1770 | $_where['OR'] = array( |
1771 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1772 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1773 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1774 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1775 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1776 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1777 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1778 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1779 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1780 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1781 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1782 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1783 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1784 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1785 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1786 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1787 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1788 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1789 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1790 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1791 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1771 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1772 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1773 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1774 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1775 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1776 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1777 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1778 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1779 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1780 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1781 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1782 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1783 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1784 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1785 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1786 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1787 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1788 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1789 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1790 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1791 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1792 | 1792 | ); |
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | //failed transactions |
1796 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1797 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1796 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1797 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1798 | 1798 | |
1799 | - if ( $failed ) { |
|
1800 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1801 | - } else if ( $abandoned ) { |
|
1799 | + if ($failed) { |
|
1800 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1801 | + } else if ($abandoned) { |
|
1802 | 1802 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1803 | 1803 | } else { |
1804 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1805 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1804 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1805 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1806 | 1806 | } |
1807 | 1807 | |
1808 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1808 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1809 | 1809 | |
1810 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1810 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1811 | 1811 | |
1812 | 1812 | |
1813 | 1813 | return $transactions; |
@@ -1,26 +1,26 @@ 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 | - * |
|
16 | - * EE_Admin_Transactions class |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/core/admin/transactions/Transactions_Admin_Page.core.php |
|
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 {@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 | + * EE_Admin_Transactions class |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/core/admin/transactions/Transactions_Admin_Page.core.php |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class Transactions_Admin_Page extends EE_Admin_Page { |
25 | 25 | |
26 | 26 | /** |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | /** |
108 | 108 | * grab url requests and route them |
109 | - * @access private |
|
110 | - * @return void |
|
111 | - */ |
|
109 | + * @access private |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | public function _set_page_routes() { |
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | /** |
262 | 262 | * _set_transaction_status_array |
263 | 263 | * sets list of transaction statuses |
264 | - * |
|
264 | + * |
|
265 | 265 | * @access private |
266 | - * @return void |
|
267 | - */ |
|
266 | + * @return void |
|
267 | + */ |
|
268 | 268 | private function _set_transaction_status_array() { |
269 | 269 | self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE); |
270 | 270 | } |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | |
287 | 287 | /** |
288 | 288 | * get list of payment statuses |
289 | - * |
|
289 | + * |
|
290 | 290 | * @access private |
291 | - * @return void |
|
292 | - */ |
|
291 | + * @return void |
|
292 | + */ |
|
293 | 293 | private function _get_payment_status_array() { |
294 | 294 | self::$_pay_status = EEM_Payment::instance()->status_array(TRUE); |
295 | 295 | $this->_template_args['payment_status'] = self::$_pay_status; |
@@ -397,18 +397,18 @@ discard block |
||
397 | 397 | if ( is_object( $this->_transaction) ) |
398 | 398 | return; //get out we've already set the object |
399 | 399 | |
400 | - $TXN = EEM_Transaction::instance(); |
|
400 | + $TXN = EEM_Transaction::instance(); |
|
401 | 401 | |
402 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
402 | + $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
403 | 403 | |
404 | - //get transaction object |
|
405 | - $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
406 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
404 | + //get transaction object |
|
405 | + $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
406 | + $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
407 | 407 | |
408 | 408 | if ( empty( $this->_transaction ) ) { |
409 | - $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
409 | + $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
410 | 410 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
411 | - } |
|
411 | + } |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | |
511 | 511 | |
512 | 512 | /** |
513 | - * _transaction_details |
|
513 | + * _transaction_details |
|
514 | 514 | * generates HTML for the View Transaction Details Admin page |
515 | - * |
|
515 | + * |
|
516 | 516 | * @access protected |
517 | - * @return void |
|
518 | - */ |
|
517 | + * @return void |
|
518 | + */ |
|
519 | 519 | protected function _transaction_details() { |
520 | 520 | do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
521 | 521 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | 'button secondary-button right', |
569 | 569 | 'dashicons dashicons-email-alt' |
570 | 570 | ) |
571 | - : ''; |
|
571 | + : ''; |
|
572 | 572 | } else { |
573 | 573 | $this->_template_args['send_payment_reminder_button'] = ''; |
574 | 574 | } |
@@ -722,10 +722,10 @@ discard block |
||
722 | 722 | /** |
723 | 723 | * txn_details_meta_box |
724 | 724 | * generates HTML for the Transaction main meta box |
725 | - * |
|
725 | + * |
|
726 | 726 | * @access public |
727 | - * @return void |
|
728 | - */ |
|
727 | + * @return void |
|
728 | + */ |
|
729 | 729 | public function txn_details_meta_box() { |
730 | 730 | |
731 | 731 | $this->_set_transaction_object(); |
@@ -1066,10 +1066,10 @@ discard block |
||
1066 | 1066 | /** |
1067 | 1067 | * txn_billing_info_side_meta_box |
1068 | 1068 | * generates HTML for the Edit Transaction side meta box |
1069 | - * |
|
1069 | + * |
|
1070 | 1070 | * @access public |
1071 | - * @return void |
|
1072 | - */ |
|
1071 | + * @return void |
|
1072 | + */ |
|
1073 | 1073 | public function txn_billing_info_side_meta_box() { |
1074 | 1074 | |
1075 | 1075 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
@@ -1087,10 +1087,10 @@ discard block |
||
1087 | 1087 | /** |
1088 | 1088 | * apply_payments_or_refunds |
1089 | 1089 | * registers a payment or refund made towards a transaction |
1090 | - * |
|
1090 | + * |
|
1091 | 1091 | * @access public |
1092 | - * @return void |
|
1093 | - */ |
|
1092 | + * @return void |
|
1093 | + */ |
|
1094 | 1094 | public function apply_payments_or_refunds() { |
1095 | 1095 | $json_response_data = array( 'return_data' => FALSE ); |
1096 | 1096 | $valid_data = $this->_validate_payment_request_data(); |
@@ -1244,9 +1244,9 @@ discard block |
||
1244 | 1244 | 'default' => '', |
1245 | 1245 | 'required' => false, |
1246 | 1246 | 'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ), |
1247 | - 'validation_strategies' => array( |
|
1248 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1249 | - ) |
|
1247 | + 'validation_strategies' => array( |
|
1248 | + new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1249 | + ) |
|
1250 | 1250 | ) |
1251 | 1251 | ), |
1252 | 1252 | 'po_number' => new EE_Text_Input( |
@@ -1254,9 +1254,9 @@ discard block |
||
1254 | 1254 | 'default' => '', |
1255 | 1255 | 'required' => false, |
1256 | 1256 | 'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ), |
1257 | - 'validation_strategies' => array( |
|
1258 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1259 | - ) |
|
1257 | + 'validation_strategies' => array( |
|
1258 | + new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1259 | + ) |
|
1260 | 1260 | ) |
1261 | 1261 | ), |
1262 | 1262 | 'accounting' => new EE_Text_Input( |
@@ -1264,9 +1264,9 @@ discard block |
||
1264 | 1264 | 'default' => '', |
1265 | 1265 | 'required' => false, |
1266 | 1266 | 'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ), |
1267 | - 'validation_strategies' => array( |
|
1268 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1269 | - ) |
|
1267 | + 'validation_strategies' => array( |
|
1268 | + new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1269 | + ) |
|
1270 | 1270 | ) |
1271 | 1271 | ), |
1272 | 1272 | ) |
@@ -1561,10 +1561,10 @@ discard block |
||
1561 | 1561 | /** |
1562 | 1562 | * delete_payment |
1563 | 1563 | * delete a payment or refund made towards a transaction |
1564 | - * |
|
1564 | + * |
|
1565 | 1565 | * @access public |
1566 | - * @return void |
|
1567 | - */ |
|
1566 | + * @return void |
|
1567 | + */ |
|
1568 | 1568 | public function delete_payment() { |
1569 | 1569 | $json_response_data = array( 'return_data' => FALSE ); |
1570 | 1570 | $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
@@ -1682,12 +1682,12 @@ discard block |
||
1682 | 1682 | /** |
1683 | 1683 | * _send_payment_reminder |
1684 | 1684 | * generates HTML for the View Transaction Details Admin page |
1685 | - * |
|
1685 | + * |
|
1686 | 1686 | * @access protected |
1687 | - * @return void |
|
1688 | - */ |
|
1687 | + * @return void |
|
1688 | + */ |
|
1689 | 1689 | protected function _send_payment_reminder() { |
1690 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1690 | + $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1691 | 1691 | $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
1692 | 1692 | $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
1693 | 1693 | do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
@@ -1709,29 +1709,29 @@ discard block |
||
1709 | 1709 | |
1710 | 1710 | $TXN = EEM_Transaction::instance(); |
1711 | 1711 | |
1712 | - $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' )); |
|
1713 | - $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' ); |
|
1712 | + $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' )); |
|
1713 | + $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' ); |
|
1714 | 1714 | |
1715 | - //make sure our timestamps start and end right at the boundaries for each day |
|
1716 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1717 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1715 | + //make sure our timestamps start and end right at the boundaries for each day |
|
1716 | + $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1717 | + $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1718 | 1718 | |
1719 | 1719 | |
1720 | - //convert to timestamps |
|
1721 | - $start_date = strtotime( $start_date ); |
|
1722 | - $end_date = strtotime( $end_date ); |
|
1720 | + //convert to timestamps |
|
1721 | + $start_date = strtotime( $start_date ); |
|
1722 | + $end_date = strtotime( $end_date ); |
|
1723 | 1723 | |
1724 | - //makes sure start date is the lowest value and vice versa |
|
1725 | - $start_date = min( $start_date, $end_date ); |
|
1726 | - $end_date = max( $start_date, $end_date ); |
|
1724 | + //makes sure start date is the lowest value and vice versa |
|
1725 | + $start_date = min( $start_date, $end_date ); |
|
1726 | + $end_date = max( $start_date, $end_date ); |
|
1727 | 1727 | |
1728 | - //convert to correct format for query |
|
1728 | + //convert to correct format for query |
|
1729 | 1729 | $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
1730 | 1730 | $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
1731 | 1731 | |
1732 | 1732 | |
1733 | 1733 | |
1734 | - //set orderby |
|
1734 | + //set orderby |
|
1735 | 1735 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1736 | 1736 | |
1737 | 1737 | switch ( $this->_req_data['orderby'] ) { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @access protected |
513 | 513 | * @param string $fieldname the property item the corresponding value is for. |
514 | 514 | * @param mixed $value The value we are caching. |
515 | - * @param null $cache_type |
|
515 | + * @param string $cache_type |
|
516 | 516 | * @return void |
517 | 517 | */ |
518 | 518 | protected function _set_cached_property( $fieldname, $value, $cache_type = NULL ) { |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | * |
826 | 826 | * @param null $field_to_order_by What field is being used as the reference point. |
827 | 827 | * @param array $query_params Any additional conditions on the query. |
828 | - * @param null $columns_to_select If left null, then an array of EE_Base_Class objects is returned, otherwise |
|
828 | + * @param string $columns_to_select If left null, then an array of EE_Base_Class objects is returned, otherwise |
|
829 | 829 | * you can indicate just the columns you want returned |
830 | 830 | * |
831 | 831 | * @return array|EE_Base_Class |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @param null $field_to_order_by What field is being used as the reference point. |
852 | 852 | * @param array $query_params Any additional conditions on the query. |
853 | - * @param null $columns_to_select If left null, then an EE_Base_Class object is returned, otherwise |
|
853 | + * @param string $columns_to_select If left null, then an EE_Base_Class object is returned, otherwise |
|
854 | 854 | * you can indicate just the column you want returned |
855 | 855 | * |
856 | 856 | * @return array|EE_Base_Class |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | /** |
914 | 914 | * This method simply returns the RAW unprocessed value for the given property in this class |
915 | 915 | * @param string $field_name A valid fieldname |
916 | - * @return mixed Whatever the raw value stored on the property is. |
|
916 | + * @return integer|null Whatever the raw value stored on the property is. |
|
917 | 917 | * @throws EE_Error if fieldSettings is misconfigured or the field doesn't exist. |
918 | 918 | */ |
919 | 919 | public function get_raw($field_name) { |
@@ -987,11 +987,11 @@ discard block |
||
987 | 987 | * |
988 | 988 | * @access protected |
989 | 989 | * @param string $field_name Field on the instantiated EE_Base_Class child object |
990 | - * @param null $dt_frmt valid datetime format used for date (if '' then we just use the default on the field, if NULL we use the last-used format) |
|
991 | - * @param null $tm_frmt Same as above except this is for time format |
|
990 | + * @param string|null $dt_frmt valid datetime format used for date (if '' then we just use the default on the field, if NULL we use the last-used format) |
|
991 | + * @param null|string $tm_frmt Same as above except this is for time format |
|
992 | 992 | * @param string $date_or_time if NULL then both are returned, otherwise "D" = only date and "T" = only time. |
993 | 993 | * @param boolean $echo Whether the dtt is echoing using pretty echoing or just returned using vanilla get |
994 | - * @return void | string | bool | EE_Error string on success, FALSE on fail, or EE_Error Exception is thrown if field is not a valid dtt field, or void if echoing |
|
994 | + * @return string|boolean | string | bool | EE_Error string on success, FALSE on fail, or EE_Error Exception is thrown if field is not a valid dtt field, or void if echoing |
|
995 | 995 | */ |
996 | 996 | protected function _get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE ) { |
997 | 997 | |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | * sets the time on a datetime property |
1165 | 1165 | * |
1166 | 1166 | * @access protected |
1167 | - * @param string|Datetime $time a valid time string for php datetime functions (or DateTime object) |
|
1167 | + * @param string $time a valid time string for php datetime functions (or DateTime object) |
|
1168 | 1168 | * @param string $fieldname the name of the field the time is being set on (must match a EE_Datetime_Field) |
1169 | 1169 | */ |
1170 | 1170 | protected function _set_time_for( $time, $fieldname ) { |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | * sets the date on a datetime property |
1180 | 1180 | * |
1181 | 1181 | * @access protected |
1182 | - * @param string|DateTime $date a valid date string for php datetime functions ( or DateTime object) |
|
1182 | + * @param string $date a valid date string for php datetime functions ( or DateTime object) |
|
1183 | 1183 | * @param string $fieldname the name of the field the date is being set on (must match a EE_Datetime_Field) |
1184 | 1184 | */ |
1185 | 1185 | protected function _set_date_for( $date, $fieldname ) { |
@@ -1233,6 +1233,7 @@ discard block |
||
1233 | 1233 | * @param mixed (array|string) $args This is the arguments that will be passed to the callback. |
1234 | 1234 | * @param string $prepend You can include something to prepend on the timestamp |
1235 | 1235 | * @param string $append You can include something to append on the timestamp |
1236 | + * @param string $args |
|
1236 | 1237 | * @throws EE_Error |
1237 | 1238 | * @return string timestamp |
1238 | 1239 | */ |
@@ -1266,7 +1267,7 @@ discard block |
||
1266 | 1267 | * This calls the `EE_Base_Class::_delete` method. Child classes wishing to change default behaviour should override |
1267 | 1268 | * `EE_Base_Class::_delete` NOT this class. |
1268 | 1269 | * |
1269 | - * @return boolean | int |
|
1270 | + * @return integer | int |
|
1270 | 1271 | */ |
1271 | 1272 | public function delete(){ |
1272 | 1273 | /** |
@@ -1297,7 +1298,7 @@ discard block |
||
1297 | 1298 | * This method is called by the public `EE_Base_Class::delete` method. Any child classes desiring to override default |
1298 | 1299 | * functionality for "delete" (which is to call `permanently_delete`) should override this method NOT `EE_Base_Class::delete` |
1299 | 1300 | * |
1300 | - * @return bool|int |
|
1301 | + * @return boolean |
|
1301 | 1302 | */ |
1302 | 1303 | protected function _delete() { |
1303 | 1304 | $result = $this->delete_permanently(); |
@@ -1537,7 +1538,7 @@ discard block |
||
1537 | 1538 | |
1538 | 1539 | /** |
1539 | 1540 | * for getting a model while instantiated. |
1540 | - * @return \EEM_Base | \EEM_CPT_Base |
|
1541 | + * @return boolean | \EEM_CPT_Base |
|
1541 | 1542 | */ |
1542 | 1543 | public function get_model() { |
1543 | 1544 | $modelName = self::_get_model_classname( get_class($this) ); |
@@ -1568,7 +1569,7 @@ discard block |
||
1568 | 1569 | * If there is a key in the incoming array that matches the primary key for the model AND it is not null, then we check the db. If there's a an object we return it. If not we return false. |
1569 | 1570 | * @param array $props_n_values incoming array of properties and their values |
1570 | 1571 | * @param string $classname the classname of the child class |
1571 | - * @param null $timezone |
|
1572 | + * @param string|null $timezone |
|
1572 | 1573 | * @param array $date_formats incoming date_formats in an array where the first value is the |
1573 | 1574 | * date_format and the second value is the time format |
1574 | 1575 | * @return mixed (EE_Base_Class|bool) |
@@ -1617,7 +1618,7 @@ discard block |
||
1617 | 1618 | * @param $classname |
1618 | 1619 | * @param null $timezone |
1619 | 1620 | * @throws EE_Error |
1620 | - * @return EEM_Base |
|
1621 | + * @return boolean |
|
1621 | 1622 | */ |
1622 | 1623 | protected static function _get_model( $classname, $timezone = NULL ){ |
1623 | 1624 | //find model for this class |
@@ -1633,8 +1634,8 @@ discard block |
||
1633 | 1634 | /** |
1634 | 1635 | * Gets the model instance (eg instance of EEM_Attendee) given its classname (eg EE_Attendee) |
1635 | 1636 | * @param string $model_classname |
1636 | - * @param null $timezone |
|
1637 | - * @return EEM_Base |
|
1637 | + * @param string|null $timezone |
|
1638 | + * @return boolean |
|
1638 | 1639 | */ |
1639 | 1640 | protected static function _get_model_instance_with_name($model_classname, $timezone = NULL){ |
1640 | 1641 | $model_classname = str_replace( 'EEM_', '', $model_classname ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, ' FILE LOADED', '' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, ' FILE LOADED', ''); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Event Espresso |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * ------------------------------------------------------------------------ |
25 | 25 | */ |
26 | 26 | |
27 | -abstract class EE_Base_Class{ |
|
27 | +abstract class EE_Base_Class { |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * This is an array of the original properties and values provided during construction |
@@ -117,60 +117,60 @@ discard block |
||
117 | 117 | * @throws EE_Error |
118 | 118 | * @return \EE_Base_Class |
119 | 119 | */ |
120 | - protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '', $date_formats = array() ){ |
|
120 | + protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '', $date_formats = array()) { |
|
121 | 121 | |
122 | - $className=get_class($this); |
|
122 | + $className = get_class($this); |
|
123 | 123 | |
124 | - do_action("AHEE__{$className}__construct",$this,$fieldValues); |
|
125 | - $model=$this->get_model(); |
|
126 | - $model_fields = $model->field_settings( FALSE ); |
|
124 | + do_action("AHEE__{$className}__construct", $this, $fieldValues); |
|
125 | + $model = $this->get_model(); |
|
126 | + $model_fields = $model->field_settings(FALSE); |
|
127 | 127 | // ensure $fieldValues is an array |
128 | - $fieldValues = is_array( $fieldValues ) ? $fieldValues : array( $fieldValues ); |
|
128 | + $fieldValues = is_array($fieldValues) ? $fieldValues : array($fieldValues); |
|
129 | 129 | // EEH_Debug_Tools::printr( $fieldValues, '$fieldValues <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
130 | 130 | // verify client code has not passed any invalid field names |
131 | - foreach($fieldValues as $field_name=> $field_value){ |
|
132 | - if( ! isset( $model_fields[ $field_name] ) ){ |
|
133 | - throw new EE_Error(sprintf(__("Invalid field (%s) passed to constructor of %s. Allowed fields are :%s", "event_espresso"),$field_name,get_class($this),implode(", ",array_keys($model_fields)))); |
|
131 | + foreach ($fieldValues as $field_name=> $field_value) { |
|
132 | + if ( ! isset($model_fields[$field_name])) { |
|
133 | + throw new EE_Error(sprintf(__("Invalid field (%s) passed to constructor of %s. Allowed fields are :%s", "event_espresso"), $field_name, get_class($this), implode(", ", array_keys($model_fields)))); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | // EEH_Debug_Tools::printr( $model_fields, '$model_fields <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
137 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
138 | - $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string( $timezone ); |
|
137 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
138 | + $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string($timezone); |
|
139 | 139 | |
140 | - if ( ! empty( $date_formats ) && is_array( $date_formats ) ) { |
|
140 | + if ( ! empty($date_formats) && is_array($date_formats)) { |
|
141 | 141 | $this->_dt_frmt = $date_formats[0]; |
142 | 142 | $this->_tm_frmt = $date_formats[1]; |
143 | 143 | } else { |
144 | 144 | //set default formats for date and time |
145 | - $this->_dt_frmt = get_option( 'date_format' ); |
|
146 | - $this->_tm_frmt = get_option( 'time_format' ); |
|
145 | + $this->_dt_frmt = get_option('date_format'); |
|
146 | + $this->_tm_frmt = get_option('time_format'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | //if db model is instantiating |
150 | - if ( $bydb ){ |
|
150 | + if ($bydb) { |
|
151 | 151 | //client code has indicated these field values are from the database |
152 | - foreach( $model_fields as $fieldName => $field ){ |
|
153 | - $this->set_from_db( $fieldName, isset( $fieldValues[ $fieldName] ) ? $fieldValues[ $fieldName ] : null ); |
|
152 | + foreach ($model_fields as $fieldName => $field) { |
|
153 | + $this->set_from_db($fieldName, isset($fieldValues[$fieldName]) ? $fieldValues[$fieldName] : null); |
|
154 | 154 | } |
155 | 155 | } else { |
156 | 156 | //we're constructing a brand |
157 | 157 | //new instance of the model object. Generally, this means we'll need to do more field validation |
158 | - foreach( $model_fields as $fieldName => $field ){ |
|
159 | - $this->set( $fieldName, isset( $fieldValues[ $fieldName ] ) ? $fieldValues[ $fieldName ] : null, true ); |
|
158 | + foreach ($model_fields as $fieldName => $field) { |
|
159 | + $this->set($fieldName, isset($fieldValues[$fieldName]) ? $fieldValues[$fieldName] : null, true); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | //remember what values were passed to this constructor |
164 | 164 | $this->_props_n_values_provided_in_constructor = $fieldValues; |
165 | 165 | //remember in entity mapper |
166 | - if($model->has_primary_key_field() && $this->ID() && ! $bydb ){ |
|
166 | + if ($model->has_primary_key_field() && $this->ID() && ! $bydb) { |
|
167 | 167 | $model->add_to_entity_map($this); |
168 | 168 | } |
169 | 169 | //setup all the relations |
170 | - foreach($this->get_model()->relation_settings() as $relation_name=>$relation_obj){ |
|
171 | - if($relation_obj instanceof EE_Belongs_To_Relation){ |
|
170 | + foreach ($this->get_model()->relation_settings() as $relation_name=>$relation_obj) { |
|
171 | + if ($relation_obj instanceof EE_Belongs_To_Relation) { |
|
172 | 172 | $this->_model_relations[$relation_name] = NULL; |
173 | - }else{ |
|
173 | + } else { |
|
174 | 174 | $this->_model_relations[$relation_name] = array(); |
175 | 175 | } |
176 | 176 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * Action done at the end of each model object construction |
179 | 179 | * @param EE_Base_Class $this the model object just created |
180 | 180 | */ |
181 | - do_action( 'AHEE__EE_Base_Class__construct__finished', $this ); |
|
181 | + do_action('AHEE__EE_Base_Class__construct__finished', $this); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param boolean $allow_persist |
199 | 199 | * @return boolean |
200 | 200 | */ |
201 | - function set_allow_persist( $allow_persist ) { |
|
201 | + function set_allow_persist($allow_persist) { |
|
202 | 202 | return $this->_allow_persist = $allow_persist; |
203 | 203 | } |
204 | 204 | |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | * @param string $field_name |
212 | 212 | * @return mixed|null |
213 | 213 | */ |
214 | - public function get_original( $field_name ){ |
|
215 | - if( isset( $this->_props_n_values_provided_in_constructor[ $field_name ] ) && |
|
216 | - $field_settings = $this->get_Model()->field_settings_for( $field_name )){ |
|
217 | - return $field_settings->prepare_for_get( $this->_props_n_values_provided_in_constructor[ $field_name ] ); |
|
218 | - }else{ |
|
214 | + public function get_original($field_name) { |
|
215 | + if (isset($this->_props_n_values_provided_in_constructor[$field_name]) && |
|
216 | + $field_settings = $this->get_Model()->field_settings_for($field_name)) { |
|
217 | + return $field_settings->prepare_for_get($this->_props_n_values_provided_in_constructor[$field_name]); |
|
218 | + } else { |
|
219 | 219 | return NULL; |
220 | 220 | } |
221 | 221 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param EE_Base_Class $obj |
226 | 226 | * @return string |
227 | 227 | */ |
228 | - public function get_class($obj){ |
|
228 | + public function get_class($obj) { |
|
229 | 229 | return get_class($obj); |
230 | 230 | } |
231 | 231 | |
@@ -238,19 +238,19 @@ discard block |
||
238 | 238 | * @param mixed $field_value |
239 | 239 | * @param bool $use_default |
240 | 240 | */ |
241 | - public function set( $field_name, $field_value, $use_default = FALSE ){ |
|
242 | - $field_obj = $this->get_model()->field_settings_for( $field_name ); |
|
243 | - if ( $field_obj instanceof EE_Model_Field_Base ) { |
|
241 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
242 | + $field_obj = $this->get_model()->field_settings_for($field_name); |
|
243 | + if ($field_obj instanceof EE_Model_Field_Base) { |
|
244 | 244 | // if ( method_exists( $field_obj, 'set_timezone' )) { |
245 | - if ( $field_obj instanceof EE_Datetime_Field ) { |
|
246 | - $field_obj->set_timezone( $this->_timezone ); |
|
247 | - $field_obj->set_date_format( $this->_dt_frmt ); |
|
248 | - $field_obj->set_time_format( $this->_tm_frmt ); |
|
245 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
246 | + $field_obj->set_timezone($this->_timezone); |
|
247 | + $field_obj->set_date_format($this->_dt_frmt); |
|
248 | + $field_obj->set_time_format($this->_tm_frmt); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $holder_of_value = $field_obj->prepare_for_set($field_value); |
252 | 252 | //should the value be null? |
253 | - if( ($field_value === NULL || $holder_of_value === NULL || $holder_of_value ==='') && $use_default){ |
|
253 | + if (($field_value === NULL || $holder_of_value === NULL || $holder_of_value === '') && $use_default) { |
|
254 | 254 | $this->_fields[$field_name] = $field_obj->get_default_value(); |
255 | 255 | |
256 | 256 | /** |
@@ -260,19 +260,19 @@ discard block |
||
260 | 260 | * object. |
261 | 261 | * @since 4.6.10+ |
262 | 262 | */ |
263 | - if ( $field_obj instanceof EE_Datetime_Field && ! is_null( $this->_fields[$field_name] ) && ! $this->_fields[$field_name] instanceof DateTime ) { |
|
264 | - empty( $this->_fields[$field_name] ) ? $this->set( $field_name, time() ) : $this->set( $field_name, $this->_fields[$field_name] ); |
|
263 | + if ($field_obj instanceof EE_Datetime_Field && ! is_null($this->_fields[$field_name]) && ! $this->_fields[$field_name] instanceof DateTime) { |
|
264 | + empty($this->_fields[$field_name]) ? $this->set($field_name, time()) : $this->set($field_name, $this->_fields[$field_name]); |
|
265 | 265 | } |
266 | 266 | |
267 | - }else{ |
|
267 | + } else { |
|
268 | 268 | $this->_fields[$field_name] = $holder_of_value; |
269 | 269 | } |
270 | 270 | |
271 | 271 | //if we're not in the constructor... |
272 | 272 | //now check if what we set was a primary key |
273 | - if($this->_props_n_values_provided_in_constructor && //note: props_n_values_provided_in_constructor is only set at the END of the constructor |
|
273 | + if ($this->_props_n_values_provided_in_constructor && //note: props_n_values_provided_in_constructor is only set at the END of the constructor |
|
274 | 274 | $field_name == $this->_get_primary_key_name(get_class($this)) && |
275 | - $field_value){ |
|
275 | + $field_value) { |
|
276 | 276 | //if so, we want all this object's fields to be filled either with |
277 | 277 | //what we've explicitly set on this model |
278 | 278 | //or what we have in the db |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | $fields_on_model = $this->_get_model(get_class($this))->field_settings(); |
281 | 281 | |
282 | 282 | $obj_in_db = $this->_get_model(get_class($this))->get_one_by_ID($field_value); |
283 | - foreach($fields_on_model as $field_obj){ |
|
284 | - if( ! array_key_exists($field_obj->get_name(), $this->_props_n_values_provided_in_constructor) |
|
285 | - && $field_obj->get_name() != $field_name ){ |
|
283 | + foreach ($fields_on_model as $field_obj) { |
|
284 | + if ( ! array_key_exists($field_obj->get_name(), $this->_props_n_values_provided_in_constructor) |
|
285 | + && $field_obj->get_name() != $field_name) { |
|
286 | 286 | |
287 | - $this->set($field_obj->get_name(),$obj_in_db->get($field_obj->get_name())); |
|
287 | + $this->set($field_obj->get_name(), $obj_in_db->get($field_obj->get_name())); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | //oh this model object has an ID? well make sure its in the entity mapper |
291 | 291 | $this->get_model()->add_to_entity_map($this); |
292 | 292 | } |
293 | 293 | //let's unset any cache for this field_name from the $_cached_properties property. |
294 | - $this->_clear_cached_property( $field_name ); |
|
295 | - }else{ |
|
296 | - throw new EE_Error( sprintf( __( "A valid EE_Model_Field_Base could not be found for the given field name: %s", "event_espresso" ), $field_name ) ); |
|
294 | + $this->_clear_cached_property($field_name); |
|
295 | + } else { |
|
296 | + throw new EE_Error(sprintf(__("A valid EE_Model_Field_Base could not be found for the given field name: %s", "event_espresso"), $field_name)); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | } |
@@ -312,14 +312,14 @@ discard block |
||
312 | 312 | * @param mixed $field_value The value to set. |
313 | 313 | * @return int|bool @see EE_Base_Class::update_extra_meta() for return docs. |
314 | 314 | */ |
315 | - public function set_field_or_extra_meta( $field_name, $field_value ) { |
|
316 | - if ( $this->get_model()->has_field( $field_name ) ) { |
|
317 | - $this->set( $field_name, $field_value ); |
|
315 | + public function set_field_or_extra_meta($field_name, $field_value) { |
|
316 | + if ($this->get_model()->has_field($field_name)) { |
|
317 | + $this->set($field_name, $field_value); |
|
318 | 318 | return true; |
319 | 319 | } else { |
320 | 320 | //ensure this object is saved first so that extra meta can be properly related. |
321 | 321 | $this->save(); |
322 | - return $this->update_extra_meta( $field_name, $field_value ); |
|
322 | + return $this->update_extra_meta($field_name, $field_value); |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -343,12 +343,12 @@ discard block |
||
343 | 343 | * @param string $field_name expecting the fully qualified field name. |
344 | 344 | * @return mixed|null value for the field if found. null if not found. |
345 | 345 | */ |
346 | - public function get_field_or_extra_meta( $field_name ) { |
|
347 | - if ( $this->get_model()->has_field( $field_name ) ) { |
|
348 | - $column_value = $this->get( $field_name ); |
|
346 | + public function get_field_or_extra_meta($field_name) { |
|
347 | + if ($this->get_model()->has_field($field_name)) { |
|
348 | + $column_value = $this->get($field_name); |
|
349 | 349 | } else { |
350 | 350 | //This isn't a column in the main table, let's see if it is in the extra meta. |
351 | - $column_value = $this->get_extra_meta( $field_name, true, null ); |
|
351 | + $column_value = $this->get_extra_meta($field_name, true, null); |
|
352 | 352 | } |
353 | 353 | return $column_value; |
354 | 354 | } |
@@ -367,19 +367,19 @@ discard block |
||
367 | 367 | * @param string $timezone A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php |
368 | 368 | * @return void |
369 | 369 | */ |
370 | - public function set_timezone( $timezone = '' ) { |
|
370 | + public function set_timezone($timezone = '') { |
|
371 | 371 | EE_Registry::instance()->load_helper('DTT_Helper'); |
372 | - $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string( $timezone ); |
|
372 | + $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string($timezone); |
|
373 | 373 | //make sure we clear all cached properties because they won't be relevant now |
374 | 374 | $this->_clear_cached_properties(); |
375 | 375 | |
376 | 376 | //make sure we update field settings and the date for all EE_Datetime_Fields |
377 | - $model_fields = $this->get_model()->field_settings( false ); |
|
378 | - foreach ( $model_fields as $field_name => $field_obj ) { |
|
379 | - if ( $field_obj instanceof EE_Datetime_Field ) { |
|
380 | - $field_obj->set_timezone( $this->_timezone ); |
|
381 | - if ( isset( $this->_fields[$field_name] ) && $this->_fields[$field_name] instanceof DateTime ) { |
|
382 | - $this->_fields[$field_name]->setTimezone( new DateTimeZone( $this->_timezone ) ); |
|
377 | + $model_fields = $this->get_model()->field_settings(false); |
|
378 | + foreach ($model_fields as $field_name => $field_obj) { |
|
379 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
380 | + $field_obj->set_timezone($this->_timezone); |
|
381 | + if (isset($this->_fields[$field_name]) && $this->_fields[$field_name] instanceof DateTime) { |
|
382 | + $this->_fields[$field_name]->setTimezone(new DateTimeZone($this->_timezone)); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * |
409 | 409 | * @param string $format should be a format recognizable by PHP date() functions. |
410 | 410 | */ |
411 | - public function set_date_format( $format ) { |
|
411 | + public function set_date_format($format) { |
|
412 | 412 | $this->_dt_frmt = $format; |
413 | 413 | //clear cached_properties because they won't be relevant now. |
414 | 414 | $this->_clear_cached_properties(); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @since 4.6 |
425 | 425 | * @param string $format should be a format recognizable by PHP date() functions. |
426 | 426 | */ |
427 | - public function set_time_format( $format ) { |
|
427 | + public function set_time_format($format) { |
|
428 | 428 | $this->_tm_frmt = $format; |
429 | 429 | //clear cached_properties because they won't be relevant now. |
430 | 430 | $this->_clear_cached_properties(); |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @return mixed string|array |
443 | 443 | */ |
444 | - public function get_format( $full = true ) { |
|
445 | - return $full ? $this->_dt_frmt . ' ' . $this->_tm_frmt : array( $this->_dt_frmt, $this->_tm_frmt ); |
|
444 | + public function get_format($full = true) { |
|
445 | + return $full ? $this->_dt_frmt.' '.$this->_tm_frmt : array($this->_dt_frmt, $this->_tm_frmt); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -460,17 +460,17 @@ discard block |
||
460 | 460 | * @throws EE_Error |
461 | 461 | * @return mixed index into cache, or just TRUE if the relation is of type Belongs_To (because there's only one related thing, no array) |
462 | 462 | */ |
463 | - public function cache( $relationName = '', $object_to_cache = NULL, $cache_id = NULL ){ |
|
463 | + public function cache($relationName = '', $object_to_cache = NULL, $cache_id = NULL) { |
|
464 | 464 | // its entirely possible that there IS no related object yet in which case there is nothing to cache. |
465 | - if ( ! $object_to_cache instanceof EE_Base_Class ) { |
|
465 | + if ( ! $object_to_cache instanceof EE_Base_Class) { |
|
466 | 466 | return FALSE; |
467 | 467 | } |
468 | 468 | // also get "how" the object is related, or throw an error |
469 | - if( ! $relationship_to_model = $this->get_model()->related_settings_for( $relationName )) { |
|
470 | - throw new EE_Error( sprintf( __( 'There is no relationship to %s on a %s. Cannot cache it', 'event_espresso' ), $relationName, get_class( $this ))); |
|
469 | + if ( ! $relationship_to_model = $this->get_model()->related_settings_for($relationName)) { |
|
470 | + throw new EE_Error(sprintf(__('There is no relationship to %s on a %s. Cannot cache it', 'event_espresso'), $relationName, get_class($this))); |
|
471 | 471 | } |
472 | 472 | // how many things are related ? |
473 | - if( $relationship_to_model instanceof EE_Belongs_To_Relation ){ |
|
473 | + if ($relationship_to_model instanceof EE_Belongs_To_Relation) { |
|
474 | 474 | // if it's a "belongs to" relationship, then there's only one related model object eg, if this is a registration, there's only 1 attendee for it |
475 | 475 | // so for these model objects just set it to be cached |
476 | 476 | $this->_model_relations[$relationName] = $object_to_cache; |
@@ -478,26 +478,26 @@ discard block |
||
478 | 478 | } else { |
479 | 479 | // otherwise, this is the "many" side of a one to many relationship, so we'll add the object to the array of related objects for that type. |
480 | 480 | // eg: if this is an event, there are many registrations for that event, so we cache the registrations in an array |
481 | - if( ! is_array( $this->_model_relations[$relationName] )) { |
|
481 | + if ( ! is_array($this->_model_relations[$relationName])) { |
|
482 | 482 | // if for some reason, the cached item is a model object, then stick that in the array, otherwise start with an empty array |
483 | - $this->_model_relations[$relationName] = $this->_model_relations[$relationName] instanceof EE_Base_Class ? array( $this->_model_relations[$relationName] ) : array(); |
|
483 | + $this->_model_relations[$relationName] = $this->_model_relations[$relationName] instanceof EE_Base_Class ? array($this->_model_relations[$relationName]) : array(); |
|
484 | 484 | } |
485 | 485 | // first check for a cache_id which is normally empty |
486 | - if ( ! empty( $cache_id )) { |
|
486 | + if ( ! empty($cache_id)) { |
|
487 | 487 | // if the cache_id exists, then it means we are purposely trying to cache this with a known key that can then be used to retrieve the object later on |
488 | - $this->_model_relations[$relationName][ $cache_id ] = $object_to_cache; |
|
488 | + $this->_model_relations[$relationName][$cache_id] = $object_to_cache; |
|
489 | 489 | $return = $cache_id; |
490 | - } elseif ( $object_to_cache->ID() ) { |
|
490 | + } elseif ($object_to_cache->ID()) { |
|
491 | 491 | // OR the cached object originally came from the db, so let's just use it's PK for an ID |
492 | - $this->_model_relations[$relationName][ $object_to_cache->ID() ] = $object_to_cache; |
|
492 | + $this->_model_relations[$relationName][$object_to_cache->ID()] = $object_to_cache; |
|
493 | 493 | $return = $object_to_cache->ID(); |
494 | 494 | } else { |
495 | 495 | // OR it's a new object with no ID, so just throw it in the array with an auto-incremented ID |
496 | 496 | $this->_model_relations[$relationName][] = $object_to_cache; |
497 | 497 | // move the internal pointer to the end of the array |
498 | - end( $this->_model_relations[$relationName] ); |
|
498 | + end($this->_model_relations[$relationName]); |
|
499 | 499 | // and grab the key so that we can return it |
500 | - $return = key( $this->_model_relations[$relationName] ); |
|
500 | + $return = key($this->_model_relations[$relationName]); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | } |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | * @param null $cache_type |
516 | 516 | * @return void |
517 | 517 | */ |
518 | - protected function _set_cached_property( $fieldname, $value, $cache_type = NULL ) { |
|
518 | + protected function _set_cached_property($fieldname, $value, $cache_type = NULL) { |
|
519 | 519 | //first make sure this property exists |
520 | 520 | $this->get_model()->field_settings_for($fieldname); |
521 | 521 | |
522 | - $cache_type = empty( $cache_type ) ? 'standard' : $cache_type; |
|
522 | + $cache_type = empty($cache_type) ? 'standard' : $cache_type; |
|
523 | 523 | $this->_cached_properties[$fieldname][$cache_type] = $value; |
524 | 524 | } |
525 | 525 | |
@@ -534,34 +534,34 @@ discard block |
||
534 | 534 | * It can also accept certain pre-defined "schema" strings to define how to output the property. see the field's prepare_for_pretty_echoing for what strings can be used |
535 | 535 | * @return mixed whatever the value for the property is we're retrieving |
536 | 536 | */ |
537 | - protected function _get_cached_property( $fieldname, $pretty = FALSE, $extra_cache_ref = NULL ) { |
|
537 | + protected function _get_cached_property($fieldname, $pretty = FALSE, $extra_cache_ref = NULL) { |
|
538 | 538 | //verify the field exists |
539 | 539 | $this->get_model()->field_settings_for($fieldname); |
540 | 540 | |
541 | 541 | $cache_type = $pretty ? 'pretty' : 'standard'; |
542 | - $cache_type .= !empty( $extra_cache_ref ) ? '_' . $extra_cache_ref : ''; |
|
542 | + $cache_type .= ! empty($extra_cache_ref) ? '_'.$extra_cache_ref : ''; |
|
543 | 543 | |
544 | - if ( isset( $this->_cached_properties[$fieldname][$cache_type] ) ) { |
|
544 | + if (isset($this->_cached_properties[$fieldname][$cache_type])) { |
|
545 | 545 | return $this->_cached_properties[$fieldname][$cache_type]; |
546 | 546 | } |
547 | 547 | |
548 | 548 | $field_obj = $this->get_model()->field_settings_for($fieldname); |
549 | - if ( $field_obj instanceof EE_Model_Field_Base ) { |
|
549 | + if ($field_obj instanceof EE_Model_Field_Base) { |
|
550 | 550 | /** |
551 | 551 | * maybe this is EE_Datetime_Field. If so we need to make sure timezone and |
552 | 552 | * formats are correct. |
553 | 553 | */ |
554 | - if ( $field_obj instanceof EE_Datetime_Field ) { |
|
555 | - $field_obj->set_timezone( $this->_timezone ); |
|
556 | - $field_obj->set_date_format( $this->_dt_frmt, $pretty ); |
|
557 | - $field_obj->set_time_format( $this->_tm_frmt, $pretty ); |
|
554 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
555 | + $field_obj->set_timezone($this->_timezone); |
|
556 | + $field_obj->set_date_format($this->_dt_frmt, $pretty); |
|
557 | + $field_obj->set_time_format($this->_tm_frmt, $pretty); |
|
558 | 558 | } |
559 | 559 | |
560 | - if( ! isset($this->_fields[$fieldname])){ |
|
560 | + if ( ! isset($this->_fields[$fieldname])) { |
|
561 | 561 | $this->_fields[$fieldname] = NULL; |
562 | 562 | } |
563 | - $value = $pretty ? $field_obj->prepare_for_pretty_echoing($this->_fields[$fieldname], $extra_cache_ref) : $field_obj->prepare_for_get($this->_fields[$fieldname] ); |
|
564 | - $this->_set_cached_property( $fieldname, $value, $cache_type ); |
|
563 | + $value = $pretty ? $field_obj->prepare_for_pretty_echoing($this->_fields[$fieldname], $extra_cache_ref) : $field_obj->prepare_for_get($this->_fields[$fieldname]); |
|
564 | + $this->_set_cached_property($fieldname, $value, $cache_type); |
|
565 | 565 | return $value; |
566 | 566 | } |
567 | 567 | return FALSE; |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | * @param string $property_name the property to remove if it exists (from the _cached_properties array) |
588 | 588 | * @return void |
589 | 589 | */ |
590 | - protected function _clear_cached_property( $property_name ) { |
|
591 | - if ( isset( $this->_cached_properties[ $property_name ] ) ) |
|
592 | - unset( $this->_cached_properties[ $property_name ] ); |
|
590 | + protected function _clear_cached_property($property_name) { |
|
591 | + if (isset($this->_cached_properties[$property_name])) |
|
592 | + unset($this->_cached_properties[$property_name]); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * @param string $model_name name of the related thing, eg 'Attendee', |
601 | 601 | * @return EE_Base_Class |
602 | 602 | */ |
603 | - protected function ensure_related_thing_is_model_obj($object_or_id,$model_name){ |
|
603 | + protected function ensure_related_thing_is_model_obj($object_or_id, $model_name) { |
|
604 | 604 | $other_model_instance = self::_get_model_instance_with_name(self::_get_model_classname($model_name), $this->_timezone); |
605 | 605 | $model_obj = $other_model_instance->ensure_is_obj($object_or_id); |
606 | 606 | return $model_obj; |
@@ -620,55 +620,55 @@ discard block |
||
620 | 620 | * @throws EE_Error |
621 | 621 | * @return EE_Base_Class | boolean from which was cleared from the cache, or true if we requested to remove a relation from all |
622 | 622 | */ |
623 | - public function clear_cache($relationName, $object_to_remove_or_index_into_array = NULL, $clear_all = FALSE){ |
|
623 | + public function clear_cache($relationName, $object_to_remove_or_index_into_array = NULL, $clear_all = FALSE) { |
|
624 | 624 | $relationship_to_model = $this->get_model()->related_settings_for($relationName); |
625 | 625 | $index_in_cache = ''; |
626 | - if( ! $relationship_to_model){ |
|
627 | - throw new EE_Error(sprintf(__("There is no relationship to %s on a %s. Cannot clear that cache",'event_espresso'),$relationName,get_class($this))); |
|
626 | + if ( ! $relationship_to_model) { |
|
627 | + throw new EE_Error(sprintf(__("There is no relationship to %s on a %s. Cannot clear that cache", 'event_espresso'), $relationName, get_class($this))); |
|
628 | 628 | } |
629 | - if($clear_all){ |
|
629 | + if ($clear_all) { |
|
630 | 630 | $obj_removed = true; |
631 | 631 | $this->_model_relations[$relationName] = null; |
632 | - }elseif($relationship_to_model instanceof EE_Belongs_To_Relation){ |
|
632 | + }elseif ($relationship_to_model instanceof EE_Belongs_To_Relation) { |
|
633 | 633 | $obj_removed = $this->_model_relations[$relationName]; |
634 | 634 | $this->_model_relations[$relationName] = null; |
635 | - }else{ |
|
636 | - if($object_to_remove_or_index_into_array instanceof EE_Base_Class && $object_to_remove_or_index_into_array->ID()){ |
|
635 | + } else { |
|
636 | + if ($object_to_remove_or_index_into_array instanceof EE_Base_Class && $object_to_remove_or_index_into_array->ID()) { |
|
637 | 637 | $index_in_cache = $object_to_remove_or_index_into_array->ID(); |
638 | - if( is_array($this->_model_relations[$relationName]) && ! isset($this->_model_relations[$relationName][$index_in_cache])){ |
|
638 | + if (is_array($this->_model_relations[$relationName]) && ! isset($this->_model_relations[$relationName][$index_in_cache])) { |
|
639 | 639 | $index_found_at = NULL; |
640 | 640 | //find this object in the array even though it has a different key |
641 | - foreach($this->_model_relations[$relationName] as $index=>$obj){ |
|
642 | - if( $obj instanceof EE_Base_Class && ( $obj == $object_to_remove_or_index_into_array || $obj->ID() == $object_to_remove_or_index_into_array->ID() )) { |
|
641 | + foreach ($this->_model_relations[$relationName] as $index=>$obj) { |
|
642 | + if ($obj instanceof EE_Base_Class && ($obj == $object_to_remove_or_index_into_array || $obj->ID() == $object_to_remove_or_index_into_array->ID())) { |
|
643 | 643 | $index_found_at = $index; |
644 | 644 | break; |
645 | 645 | } |
646 | 646 | } |
647 | - if($index_found_at){ |
|
647 | + if ($index_found_at) { |
|
648 | 648 | $index_in_cache = $index_found_at; |
649 | - }else{ |
|
649 | + } else { |
|
650 | 650 | //it wasn't found. huh. well obviously it doesn't need to be removed from teh cache |
651 | 651 | //if it wasn't in it to begin with. So we're done |
652 | 652 | return $object_to_remove_or_index_into_array; |
653 | 653 | } |
654 | 654 | } |
655 | - }elseif($object_to_remove_or_index_into_array instanceof EE_Base_Class){ |
|
655 | + }elseif ($object_to_remove_or_index_into_array instanceof EE_Base_Class) { |
|
656 | 656 | //so they provided a model object, but it's not yet saved to the DB... so let's go hunting for it! |
657 | - foreach($this->get_all_from_cache($relationName) as $index => $potentially_obj_we_want){ |
|
658 | - if($potentially_obj_we_want == $object_to_remove_or_index_into_array){ |
|
657 | + foreach ($this->get_all_from_cache($relationName) as $index => $potentially_obj_we_want) { |
|
658 | + if ($potentially_obj_we_want == $object_to_remove_or_index_into_array) { |
|
659 | 659 | $index_in_cache = $index; |
660 | 660 | } |
661 | 661 | } |
662 | - }else{ |
|
662 | + } else { |
|
663 | 663 | $index_in_cache = $object_to_remove_or_index_into_array; |
664 | 664 | } |
665 | 665 | //supposedly we've found it. But it could just be that the client code |
666 | 666 | //provided a bad index/object |
667 | - if(isset( $this->_model_relations[$relationName]) && |
|
668 | - isset( $this->_model_relations[$relationName][$index_in_cache])){ |
|
667 | + if (isset($this->_model_relations[$relationName]) && |
|
668 | + isset($this->_model_relations[$relationName][$index_in_cache])) { |
|
669 | 669 | $obj_removed = $this->_model_relations[$relationName][$index_in_cache]; |
670 | 670 | unset($this->_model_relations[$relationName][$index_in_cache]); |
671 | - }else{ |
|
671 | + } else { |
|
672 | 672 | //that thing was never cached anyways. |
673 | 673 | $obj_removed = NULL; |
674 | 674 | } |
@@ -687,24 +687,24 @@ discard block |
||
687 | 687 | * @param string $current_cache_id - the ID that was used when originally caching the object |
688 | 688 | * @return boolean TRUE on success, FALSE on fail |
689 | 689 | */ |
690 | - public function update_cache_after_object_save( $relationName, EE_Base_Class $newly_saved_object, $current_cache_id = '') { |
|
690 | + public function update_cache_after_object_save($relationName, EE_Base_Class $newly_saved_object, $current_cache_id = '') { |
|
691 | 691 | // verify that incoming object is of the correct type |
692 | - $obj_class = 'EE_' . $relationName; |
|
693 | - if ( $newly_saved_object instanceof $obj_class ) { |
|
692 | + $obj_class = 'EE_'.$relationName; |
|
693 | + if ($newly_saved_object instanceof $obj_class) { |
|
694 | 694 | /* @type EE_Base_Class $newly_saved_object*/ |
695 | 695 | // now get the type of relation |
696 | - $relationship_to_model = $this->get_model()->related_settings_for( $relationName ); |
|
696 | + $relationship_to_model = $this->get_model()->related_settings_for($relationName); |
|
697 | 697 | // if this is a 1:1 relationship |
698 | - if( $relationship_to_model instanceof EE_Belongs_To_Relation ) { |
|
698 | + if ($relationship_to_model instanceof EE_Belongs_To_Relation) { |
|
699 | 699 | // then just replace the cached object with the newly saved object |
700 | 700 | $this->_model_relations[$relationName] = $newly_saved_object; |
701 | 701 | return TRUE; |
702 | 702 | // or if it's some kind of sordid feral polyamorous relationship... |
703 | - } elseif ( is_array( $this->_model_relations[$relationName] ) && isset( $this->_model_relations[$relationName][ $current_cache_id ] )) { |
|
703 | + } elseif (is_array($this->_model_relations[$relationName]) && isset($this->_model_relations[$relationName][$current_cache_id])) { |
|
704 | 704 | // then remove the current cached item |
705 | - unset( $this->_model_relations[$relationName][ $current_cache_id ] ); |
|
705 | + unset($this->_model_relations[$relationName][$current_cache_id]); |
|
706 | 706 | // and cache the newly saved object using it's new ID |
707 | - $this->_model_relations[$relationName][ $newly_saved_object->ID() ] = $newly_saved_object; |
|
707 | + $this->_model_relations[$relationName][$newly_saved_object->ID()] = $newly_saved_object; |
|
708 | 708 | return TRUE; |
709 | 709 | } |
710 | 710 | } |
@@ -720,11 +720,11 @@ discard block |
||
720 | 720 | * @param string $relationName |
721 | 721 | * @return EE_Base_Class |
722 | 722 | */ |
723 | - public function get_one_from_cache($relationName){ |
|
724 | - $cached_array_or_object = isset( $this->_model_relations[$relationName] ) ? $this->_model_relations[$relationName] : null; |
|
725 | - if(is_array($cached_array_or_object)){ |
|
723 | + public function get_one_from_cache($relationName) { |
|
724 | + $cached_array_or_object = isset($this->_model_relations[$relationName]) ? $this->_model_relations[$relationName] : null; |
|
725 | + if (is_array($cached_array_or_object)) { |
|
726 | 726 | return array_shift($cached_array_or_object); |
727 | - }else{ |
|
727 | + } else { |
|
728 | 728 | return $cached_array_or_object; |
729 | 729 | } |
730 | 730 | } |
@@ -739,14 +739,14 @@ discard block |
||
739 | 739 | * @throws \EE_Error |
740 | 740 | * @return EE_Base_Class[] NOT necessarily indexed by primary keys |
741 | 741 | */ |
742 | - public function get_all_from_cache($relationName){ |
|
743 | - $cached_array_or_object = isset( $this->_model_relations[$relationName] ) ? $this->_model_relations[$relationName] : array(); |
|
744 | - if(is_array($cached_array_or_object)){ |
|
742 | + public function get_all_from_cache($relationName) { |
|
743 | + $cached_array_or_object = isset($this->_model_relations[$relationName]) ? $this->_model_relations[$relationName] : array(); |
|
744 | + if (is_array($cached_array_or_object)) { |
|
745 | 745 | $objects = $cached_array_or_object; |
746 | - }elseif($cached_array_or_object){ |
|
746 | + }elseif ($cached_array_or_object) { |
|
747 | 747 | //if the result is not an array, but exists, make it an array |
748 | 748 | $objects = array($cached_array_or_object); |
749 | - }else{ |
|
749 | + } else { |
|
750 | 750 | //if nothing was found, return an empty array |
751 | 751 | $objects = array(); |
752 | 752 | } |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | //basically, if this model object was stored in the session, and these cached model objects |
755 | 755 | //already have IDs, let's make sure they're in their model's entity mapper |
756 | 756 | //otherwise we will have duplicates next time we call EE_Registry::instance()->load_model( $relationName )->get_one_by_ID( $result->ID() ); |
757 | - foreach( $objects as $model_object ){ |
|
758 | - $model = EE_Registry::instance()->load_model( $relationName ); |
|
759 | - if( $model instanceof EEM_Base && $model_object instanceof EE_Base_Class ){ |
|
757 | + foreach ($objects as $model_object) { |
|
758 | + $model = EE_Registry::instance()->load_model($relationName); |
|
759 | + if ($model instanceof EEM_Base && $model_object instanceof EE_Base_Class) { |
|
760 | 760 | //ensure its in the map if it has an ID; otherwise it will be added to the map when its saved |
761 | - if( $model_object->ID() ){ |
|
762 | - $model->add_to_entity_map( $model_object ); |
|
761 | + if ($model_object->ID()) { |
|
762 | + $model->add_to_entity_map($model_object); |
|
763 | 763 | } |
764 | - }else{ |
|
765 | - throw new EE_Error( sprintf( __( 'Error retrieving related model objects. Either $1%s is not a model or $2%s is not a model object', 'event_espresso' ), $relationName, gettype( $model_object ))); |
|
764 | + } else { |
|
765 | + throw new EE_Error(sprintf(__('Error retrieving related model objects. Either $1%s is not a model or $2%s is not a model object', 'event_espresso'), $relationName, gettype($model_object))); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | return $objects; |
@@ -781,13 +781,13 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return array|EE_Base_Class[] |
783 | 783 | */ |
784 | - public function next_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) { |
|
785 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
786 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
787 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
784 | + public function next_x($field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) { |
|
785 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
786 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
787 | + if (empty($field) || empty($current_value)) { |
|
788 | 788 | return array(); |
789 | 789 | } |
790 | - return $this->get_model()->next_x( $current_value, $field, $limit, $query_params, $columns_to_select ); |
|
790 | + return $this->get_model()->next_x($current_value, $field, $limit, $query_params, $columns_to_select); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | |
@@ -806,13 +806,13 @@ discard block |
||
806 | 806 | * |
807 | 807 | * @return array|EE_Base_Class[] |
808 | 808 | */ |
809 | - public function previous_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) { |
|
810 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
811 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
812 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
809 | + public function previous_x($field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) { |
|
810 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
811 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
812 | + if (empty($field) || empty($current_value)) { |
|
813 | 813 | return array(); |
814 | 814 | } |
815 | - return $this->get_model()->previous_x( $current_value, $field, $limit, $query_params, $columns_to_select ); |
|
815 | + return $this->get_model()->previous_x($current_value, $field, $limit, $query_params, $columns_to_select); |
|
816 | 816 | } |
817 | 817 | |
818 | 818 | |
@@ -830,13 +830,13 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return array|EE_Base_Class |
832 | 832 | */ |
833 | - public function next( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) { |
|
834 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
835 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
836 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
833 | + public function next($field_to_order_by = null, $query_params = array(), $columns_to_select = null) { |
|
834 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
835 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
836 | + if (empty($field) || empty($current_value)) { |
|
837 | 837 | return array(); |
838 | 838 | } |
839 | - return $this->get_model()->next( $current_value, $field, $query_params, $columns_to_select ); |
|
839 | + return $this->get_model()->next($current_value, $field, $query_params, $columns_to_select); |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | |
@@ -855,13 +855,13 @@ discard block |
||
855 | 855 | * |
856 | 856 | * @return array|EE_Base_Class |
857 | 857 | */ |
858 | - public function previous( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) { |
|
859 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
860 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
861 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
858 | + public function previous($field_to_order_by = null, $query_params = array(), $columns_to_select = null) { |
|
859 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
860 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
861 | + if (empty($field) || empty($current_value)) { |
|
862 | 862 | return array(); |
863 | 863 | } |
864 | - return $this->get_model()->previous( $current_value, $field, $query_params, $columns_to_select ); |
|
864 | + return $this->get_model()->previous($current_value, $field, $query_params, $columns_to_select); |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | |
@@ -875,25 +875,25 @@ discard block |
||
875 | 875 | * @param string $field_name |
876 | 876 | * @param mixed $field_value_from_db |
877 | 877 | */ |
878 | - public function set_from_db($field_name,$field_value_from_db){ |
|
878 | + public function set_from_db($field_name, $field_value_from_db) { |
|
879 | 879 | $field_obj = $this->get_model()->field_settings_for($field_name); |
880 | - if ( $field_obj instanceof EE_Model_Field_Base ) { |
|
880 | + if ($field_obj instanceof EE_Model_Field_Base) { |
|
881 | 881 | //you would think the DB has no NULLs for non-null label fields right? wrong! |
882 | 882 | //eg, a CPT model object could have an entry in the posts table, but no |
883 | 883 | //entry in the meta table. Meaning that all its columns in the meta table |
884 | 884 | //are null! yikes! so when we find one like that, use defaults for its meta columns |
885 | - if($field_value_from_db === NULL ){ |
|
886 | - if( $field_obj->is_nullable()){ |
|
885 | + if ($field_value_from_db === NULL) { |
|
886 | + if ($field_obj->is_nullable()) { |
|
887 | 887 | //if the field allows nulls, then let it be null |
888 | 888 | $field_value = NULL; |
889 | - }else{ |
|
889 | + } else { |
|
890 | 890 | $field_value = $field_obj->get_default_value(); |
891 | 891 | } |
892 | - }else{ |
|
893 | - $field_value = $field_obj->prepare_for_set_from_db( $field_value_from_db ); |
|
892 | + } else { |
|
893 | + $field_value = $field_obj->prepare_for_set_from_db($field_value_from_db); |
|
894 | 894 | } |
895 | 895 | $this->_fields[$field_name] = $field_value; |
896 | - $this->_clear_cached_property( $field_name ); |
|
896 | + $this->_clear_cached_property($field_name); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -905,8 +905,8 @@ discard block |
||
905 | 905 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
906 | 906 | * @return boolean |
907 | 907 | */ |
908 | - public function get($field_name, $extra_cache_ref = NULL ){ |
|
909 | - return $this->_get_cached_property( $field_name, FALSE, $extra_cache_ref ); |
|
908 | + public function get($field_name, $extra_cache_ref = NULL) { |
|
909 | + return $this->_get_cached_property($field_name, FALSE, $extra_cache_ref); |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | |
@@ -936,11 +936,11 @@ discard block |
||
936 | 936 | * just null is returned (because that indicates that likely |
937 | 937 | * this field is nullable). |
938 | 938 | */ |
939 | - public function get_DateTime_object( $field_name ) { |
|
940 | - $field_settings = $this->get_model()->field_settings_for( $field_name ); |
|
939 | + public function get_DateTime_object($field_name) { |
|
940 | + $field_settings = $this->get_model()->field_settings_for($field_name); |
|
941 | 941 | |
942 | - if ( ! $field_settings instanceof EE_Datetime_Field ) { |
|
943 | - EE_Error::add_error( sprintf( __('The field %s is not an EE_Datetime_Field field. There is no DateTime object stored on this field type.', 'event_espresso' ), $field_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
942 | + if ( ! $field_settings instanceof EE_Datetime_Field) { |
|
943 | + EE_Error::add_error(sprintf(__('The field %s is not an EE_Datetime_Field field. There is no DateTime object stored on this field type.', 'event_espresso'), $field_name), __FILE__, __FUNCTION__, __LINE__); |
|
944 | 944 | return false; |
945 | 945 | } |
946 | 946 | |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
957 | 957 | * @return void |
958 | 958 | */ |
959 | - public function e($field_name, $extra_cache_ref = NULL){ |
|
959 | + public function e($field_name, $extra_cache_ref = NULL) { |
|
960 | 960 | echo $this->get_pretty($field_name, $extra_cache_ref); |
961 | 961 | } |
962 | 962 | /** |
@@ -965,8 +965,8 @@ discard block |
||
965 | 965 | * @param string $field_name |
966 | 966 | * @return void |
967 | 967 | */ |
968 | - public function f($field_name){ |
|
969 | - $this->e($field_name,'form_input'); |
|
968 | + public function f($field_name) { |
|
969 | + $this->e($field_name, 'form_input'); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | /** |
@@ -975,8 +975,8 @@ discard block |
||
975 | 975 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
976 | 976 | * @return mixed |
977 | 977 | */ |
978 | - public function get_pretty($field_name, $extra_cache_ref = NULL){ |
|
979 | - return $this->_get_cached_property( $field_name, TRUE, $extra_cache_ref ); |
|
978 | + public function get_pretty($field_name, $extra_cache_ref = NULL) { |
|
979 | + return $this->_get_cached_property($field_name, TRUE, $extra_cache_ref); |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | |
@@ -993,37 +993,37 @@ discard block |
||
993 | 993 | * @param boolean $echo Whether the dtt is echoing using pretty echoing or just returned using vanilla get |
994 | 994 | * @return void | string | bool | EE_Error string on success, FALSE on fail, or EE_Error Exception is thrown if field is not a valid dtt field, or void if echoing |
995 | 995 | */ |
996 | - protected function _get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE ) { |
|
996 | + protected function _get_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE) { |
|
997 | 997 | |
998 | - $in_dt_frmt = empty($dt_frmt) ? $this->_dt_frmt : $dt_frmt; |
|
998 | + $in_dt_frmt = empty($dt_frmt) ? $this->_dt_frmt : $dt_frmt; |
|
999 | 999 | $in_tm_frmt = empty($tm_frmt) ? $this->_tm_frmt : $tm_frmt; |
1000 | 1000 | |
1001 | 1001 | //validate field for datetime and returns field settings if valid. |
1002 | - $field = $this->_get_dtt_field_settings( $field_name ); |
|
1002 | + $field = $this->_get_dtt_field_settings($field_name); |
|
1003 | 1003 | |
1004 | 1004 | //clear cached property if either formats are not null. |
1005 | - if( $dt_frmt !== null || $tm_frmt !== null ) { |
|
1006 | - $this->_clear_cached_property( $field_name ); |
|
1005 | + if ($dt_frmt !== null || $tm_frmt !== null) { |
|
1006 | + $this->_clear_cached_property($field_name); |
|
1007 | 1007 | //reset format properties because they are used in get() |
1008 | 1008 | $this->_dt_frmt = $in_dt_frmt; |
1009 | 1009 | $this->_tm_frmt = $in_tm_frmt; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | - if ( $echo ) |
|
1013 | - $field->set_pretty_date_format( $in_dt_frmt ); |
|
1012 | + if ($echo) |
|
1013 | + $field->set_pretty_date_format($in_dt_frmt); |
|
1014 | 1014 | else |
1015 | - $field->set_date_format( $in_dt_frmt ); |
|
1015 | + $field->set_date_format($in_dt_frmt); |
|
1016 | 1016 | |
1017 | - if ( $echo ) |
|
1018 | - $field->set_pretty_time_format( $in_tm_frmt ); |
|
1017 | + if ($echo) |
|
1018 | + $field->set_pretty_time_format($in_tm_frmt); |
|
1019 | 1019 | else |
1020 | - $field->set_time_format( $in_tm_frmt ); |
|
1020 | + $field->set_time_format($in_tm_frmt); |
|
1021 | 1021 | |
1022 | 1022 | //set timezone in field object |
1023 | - $field->set_timezone( $this->_timezone ); |
|
1023 | + $field->set_timezone($this->_timezone); |
|
1024 | 1024 | |
1025 | 1025 | //set the output returned |
1026 | - switch ( $date_or_time ) { |
|
1026 | + switch ($date_or_time) { |
|
1027 | 1027 | |
1028 | 1028 | case 'D' : |
1029 | 1029 | $field->set_date_time_output('date'); |
@@ -1038,11 +1038,11 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | |
1041 | - if ( $echo ) { |
|
1042 | - $this->e( $field_name, $date_or_time ); |
|
1041 | + if ($echo) { |
|
1042 | + $this->e($field_name, $date_or_time); |
|
1043 | 1043 | return ''; |
1044 | 1044 | } |
1045 | - return $this->get( $field_name, $date_or_time ); |
|
1045 | + return $this->get($field_name, $date_or_time); |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | |
@@ -1052,8 +1052,8 @@ discard block |
||
1052 | 1052 | * @param string $format format for the date returned (if NULL we use default in dt_frmt property) |
1053 | 1053 | * @return string datetime value formatted |
1054 | 1054 | */ |
1055 | - public function get_date( $field_name, $format = NULL ) { |
|
1056 | - return $this->_get_datetime( $field_name, $format, NULL, 'D' ); |
|
1055 | + public function get_date($field_name, $format = NULL) { |
|
1056 | + return $this->_get_datetime($field_name, $format, NULL, 'D'); |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | |
@@ -1062,8 +1062,8 @@ discard block |
||
1062 | 1062 | * @param $field_name |
1063 | 1063 | * @param null $format |
1064 | 1064 | */ |
1065 | - public function e_date( $field_name, $format = NULL ) { |
|
1066 | - $this->_get_datetime( $field_name, $format, NULL, 'D', TRUE ); |
|
1065 | + public function e_date($field_name, $format = NULL) { |
|
1066 | + $this->_get_datetime($field_name, $format, NULL, 'D', TRUE); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | |
@@ -1073,8 +1073,8 @@ discard block |
||
1073 | 1073 | * @param string $format format for the time returned ( if NULL we use default in tm_frmt property) |
1074 | 1074 | * @return string datetime value formatted |
1075 | 1075 | */ |
1076 | - public function get_time( $field_name, $format = NULL ) { |
|
1077 | - return $this->_get_datetime( $field_name, NULL, $format, 'T' ); |
|
1076 | + public function get_time($field_name, $format = NULL) { |
|
1077 | + return $this->_get_datetime($field_name, NULL, $format, 'T'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1083,8 +1083,8 @@ discard block |
||
1083 | 1083 | * @param $field_name |
1084 | 1084 | * @param null $format |
1085 | 1085 | */ |
1086 | - public function e_time( $field_name, $format = NULL ) { |
|
1087 | - $this->_get_datetime( $field_name, NULL, $format, 'T', TRUE ); |
|
1086 | + public function e_time($field_name, $format = NULL) { |
|
1087 | + $this->_get_datetime($field_name, NULL, $format, 'T', TRUE); |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | |
@@ -1097,8 +1097,8 @@ discard block |
||
1097 | 1097 | * @param string $tm_frmt format for the time returned (if NULL we use default in tm_frmt property) |
1098 | 1098 | * @return string datetime value formatted |
1099 | 1099 | */ |
1100 | - public function get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL ) { |
|
1101 | - return $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt ); |
|
1100 | + public function get_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL) { |
|
1101 | + return $this->_get_datetime($field_name, $dt_frmt, $tm_frmt); |
|
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | |
@@ -1108,8 +1108,8 @@ discard block |
||
1108 | 1108 | * @param null $dt_frmt |
1109 | 1109 | * @param null $tm_frmt |
1110 | 1110 | */ |
1111 | - public function e_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL ) { |
|
1112 | - $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, NULL, TRUE); |
|
1111 | + public function e_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL) { |
|
1112 | + $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, NULL, TRUE); |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | |
@@ -1124,10 +1124,10 @@ discard block |
||
1124 | 1124 | * @return string Date and time string in set locale or false if no field exists for the given |
1125 | 1125 | * field name. |
1126 | 1126 | */ |
1127 | - public function get_i18n_datetime( $field_name, $format = NULL ) { |
|
1128 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
1129 | - $format = empty( $format ) ? $this->_dt_frmt . ' ' . $this->_tm_frmt : $format; |
|
1130 | - return date_i18n( $format, EEH_DTT_Helper::get_timestamp_with_offset( $this->get_raw( $field_name ), $this->_timezone ) ); |
|
1127 | + public function get_i18n_datetime($field_name, $format = NULL) { |
|
1128 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
1129 | + $format = empty($format) ? $this->_dt_frmt.' '.$this->_tm_frmt : $format; |
|
1130 | + return date_i18n($format, EEH_DTT_Helper::get_timestamp_with_offset($this->get_raw($field_name), $this->_timezone)); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | |
@@ -1139,14 +1139,14 @@ discard block |
||
1139 | 1139 | * @throws EE_Error |
1140 | 1140 | * @return EE_Datetime_Field |
1141 | 1141 | */ |
1142 | - protected function _get_dtt_field_settings( $field_name ) { |
|
1142 | + protected function _get_dtt_field_settings($field_name) { |
|
1143 | 1143 | $field = $this->get_model()->field_settings_for($field_name); |
1144 | 1144 | |
1145 | 1145 | //check if field is dtt |
1146 | - if ( $field instanceof EE_Datetime_Field ) { |
|
1146 | + if ($field instanceof EE_Datetime_Field) { |
|
1147 | 1147 | return $field; |
1148 | 1148 | } else { |
1149 | - throw new EE_Error( sprintf( __('The field name "%s" has been requested for the EE_Base_Class datetime functions and it is not a valid EE_Datetime_Field. Please check the spelling of the field and make sure it has been setup as a EE_Datetime_Field in the %s model constructor', 'event_espresso'), $field_name, self::_get_model_classname( get_class($this) ) ) ); |
|
1149 | + throw new EE_Error(sprintf(__('The field name "%s" has been requested for the EE_Base_Class datetime functions and it is not a valid EE_Datetime_Field. Please check the spelling of the field and make sure it has been setup as a EE_Datetime_Field in the %s model constructor', 'event_espresso'), $field_name, self::_get_model_classname(get_class($this)))); |
|
1150 | 1150 | } |
1151 | 1151 | } |
1152 | 1152 | |
@@ -1167,8 +1167,8 @@ discard block |
||
1167 | 1167 | * @param string|Datetime $time a valid time string for php datetime functions (or DateTime object) |
1168 | 1168 | * @param string $fieldname the name of the field the time is being set on (must match a EE_Datetime_Field) |
1169 | 1169 | */ |
1170 | - protected function _set_time_for( $time, $fieldname ) { |
|
1171 | - $this->_set_date_time( 'T', $time, $fieldname ); |
|
1170 | + protected function _set_time_for($time, $fieldname) { |
|
1171 | + $this->_set_date_time('T', $time, $fieldname); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | |
@@ -1182,8 +1182,8 @@ discard block |
||
1182 | 1182 | * @param string|DateTime $date a valid date string for php datetime functions ( or DateTime object) |
1183 | 1183 | * @param string $fieldname the name of the field the date is being set on (must match a EE_Datetime_Field) |
1184 | 1184 | */ |
1185 | - protected function _set_date_for( $date, $fieldname ) { |
|
1186 | - $this->_set_date_time( 'D', $date, $fieldname ); |
|
1185 | + protected function _set_date_for($date, $fieldname) { |
|
1186 | + $this->_set_date_time('D', $date, $fieldname); |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | |
@@ -1199,21 +1199,21 @@ discard block |
||
1199 | 1199 | * @param string|DateTime $datetime_value A valid Date or Time string (or DateTime object) |
1200 | 1200 | * @param string $fieldname the name of the field the date OR time is being set on (must match a EE_Datetime_Field property) |
1201 | 1201 | */ |
1202 | - protected function _set_date_time( $what = 'T', $datetime_value, $fieldname ) { |
|
1203 | - $field = $this->_get_dtt_field_settings( $fieldname ); |
|
1204 | - $field->set_timezone( $this->_timezone ); |
|
1205 | - $field->set_date_format( $this->_dt_frmt ); |
|
1206 | - $field->set_time_format( $this->_tm_frmt ); |
|
1202 | + protected function _set_date_time($what = 'T', $datetime_value, $fieldname) { |
|
1203 | + $field = $this->_get_dtt_field_settings($fieldname); |
|
1204 | + $field->set_timezone($this->_timezone); |
|
1205 | + $field->set_date_format($this->_dt_frmt); |
|
1206 | + $field->set_time_format($this->_tm_frmt); |
|
1207 | 1207 | |
1208 | - switch ( $what ) { |
|
1208 | + switch ($what) { |
|
1209 | 1209 | case 'T' : |
1210 | - $this->_fields[$fieldname] = $field->prepare_for_set_with_new_time( $datetime_value, $this->_fields[$fieldname] ); |
|
1210 | + $this->_fields[$fieldname] = $field->prepare_for_set_with_new_time($datetime_value, $this->_fields[$fieldname]); |
|
1211 | 1211 | break; |
1212 | 1212 | case 'D' : |
1213 | - $this->_fields[$fieldname] = $field->prepare_for_set_with_new_date( $datetime_value, $this->_fields[$fieldname] ); |
|
1213 | + $this->_fields[$fieldname] = $field->prepare_for_set_with_new_date($datetime_value, $this->_fields[$fieldname]); |
|
1214 | 1214 | break; |
1215 | 1215 | case 'B' : |
1216 | - $this->_fields[$fieldname] = $field->prepare_for_set( $datetime_value ); |
|
1216 | + $this->_fields[$fieldname] = $field->prepare_for_set($datetime_value); |
|
1217 | 1217 | break; |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1236,25 +1236,25 @@ discard block |
||
1236 | 1236 | * @throws EE_Error |
1237 | 1237 | * @return string timestamp |
1238 | 1238 | */ |
1239 | - public function display_in_my_timezone( $field_name, $callback = 'get_datetime', $args = NULL, $prepend = '', $append = '' ) { |
|
1239 | + public function display_in_my_timezone($field_name, $callback = 'get_datetime', $args = NULL, $prepend = '', $append = '') { |
|
1240 | 1240 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1241 | 1241 | $timezone = EEH_DTT_Helper::get_timezone(); |
1242 | 1242 | |
1243 | - if ( $timezone == $this->_timezone ) |
|
1243 | + if ($timezone == $this->_timezone) |
|
1244 | 1244 | return ''; |
1245 | 1245 | |
1246 | 1246 | $original_timezone = $this->_timezone; |
1247 | - $this->set_timezone( $timezone ); |
|
1247 | + $this->set_timezone($timezone); |
|
1248 | 1248 | |
1249 | 1249 | $fn = (array) $field_name; |
1250 | - $args = array_merge( $fn, (array) $args ); |
|
1250 | + $args = array_merge($fn, (array) $args); |
|
1251 | 1251 | |
1252 | - if ( !method_exists( $this, $callback ) ) |
|
1253 | - throw new EE_Error(sprintf( __('The method named "%s" given as the callback param in "display_in_my_timezone" does not exist. Please check your spelling', 'event_espresso'), $callback ) ); |
|
1252 | + if ( ! method_exists($this, $callback)) |
|
1253 | + throw new EE_Error(sprintf(__('The method named "%s" given as the callback param in "display_in_my_timezone" does not exist. Please check your spelling', 'event_espresso'), $callback)); |
|
1254 | 1254 | $args = (array) $args; |
1255 | - $return = $prepend . call_user_func_array( array( $this, $callback ), $args ) . $append; |
|
1255 | + $return = $prepend.call_user_func_array(array($this, $callback), $args).$append; |
|
1256 | 1256 | |
1257 | - $this->set_timezone( $original_timezone ); |
|
1257 | + $this->set_timezone($original_timezone); |
|
1258 | 1258 | return $return; |
1259 | 1259 | } |
1260 | 1260 | |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | * |
1269 | 1269 | * @return boolean | int |
1270 | 1270 | */ |
1271 | - public function delete(){ |
|
1271 | + public function delete() { |
|
1272 | 1272 | /** |
1273 | 1273 | * Called just before the `EE_Base_Class::_delete` method call. |
1274 | 1274 | * Note: `EE_Base_Class::_delete` might be overridden by child classes so any client code hooking into these actions |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | * |
1278 | 1278 | * @param EE_Base_Class $model_object about to be 'deleted' |
1279 | 1279 | */ |
1280 | - do_action( 'AHEE__EE_Base_Class__delete__before', $this ); |
|
1280 | + do_action('AHEE__EE_Base_Class__delete__before', $this); |
|
1281 | 1281 | $result = $this->_delete(); |
1282 | 1282 | /** |
1283 | 1283 | * Called just after the `EE_Base_Class::_delete` method call. |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | * @param EE_Base_Class $model_object that was just 'deleted' |
1288 | 1288 | * @param boolean $result |
1289 | 1289 | */ |
1290 | - do_action( 'AHEE__EE_Base_Class__delete__end', $this, $result ); |
|
1290 | + do_action('AHEE__EE_Base_Class__delete__end', $this, $result); |
|
1291 | 1291 | return $result; |
1292 | 1292 | } |
1293 | 1293 | |
@@ -1310,22 +1310,22 @@ discard block |
||
1310 | 1310 | * Deletes this model object permanently from db (but keep in mind related models my block the delete and return an error) |
1311 | 1311 | * @return bool | int |
1312 | 1312 | */ |
1313 | - public function delete_permanently(){ |
|
1313 | + public function delete_permanently() { |
|
1314 | 1314 | /** |
1315 | 1315 | * Called just before HARD deleting a model object |
1316 | 1316 | * |
1317 | 1317 | * @param EE_Base_Class $model_object about to be 'deleted' |
1318 | 1318 | */ |
1319 | - do_action( 'AHEE__EE_Base_Class__delete_permanently__before', $this ); |
|
1320 | - $model=$this->get_model(); |
|
1321 | - $result=$model->delete_permanently_by_ID($this->ID()); |
|
1319 | + do_action('AHEE__EE_Base_Class__delete_permanently__before', $this); |
|
1320 | + $model = $this->get_model(); |
|
1321 | + $result = $model->delete_permanently_by_ID($this->ID()); |
|
1322 | 1322 | $this->refresh_cache_of_related_objects(); |
1323 | 1323 | /** |
1324 | 1324 | * Called just after HARD deleting a model object |
1325 | 1325 | * @param EE_Base_Class $model_object that was just 'deleted' |
1326 | 1326 | * @param boolean $result |
1327 | 1327 | */ |
1328 | - do_action( 'AHEE__EE_Base_Class__delete_permanently__end', $this, $result ); |
|
1328 | + do_action('AHEE__EE_Base_Class__delete_permanently__end', $this, $result); |
|
1329 | 1329 | return $result; |
1330 | 1330 | } |
1331 | 1331 | |
@@ -1334,18 +1334,18 @@ discard block |
||
1334 | 1334 | * related model objects |
1335 | 1335 | */ |
1336 | 1336 | public function refresh_cache_of_related_objects() { |
1337 | - foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ) { |
|
1338 | - if( ! empty( $this->_model_relations[ $relation_name ] ) ) { |
|
1339 | - $related_objects = $this->_model_relations[ $relation_name ]; |
|
1340 | - if( $relation_obj instanceof EE_Belongs_To_Relation ) { |
|
1337 | + foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) { |
|
1338 | + if ( ! empty($this->_model_relations[$relation_name])) { |
|
1339 | + $related_objects = $this->_model_relations[$relation_name]; |
|
1340 | + if ($relation_obj instanceof EE_Belongs_To_Relation) { |
|
1341 | 1341 | //this relation only stores a single model object, not an array |
1342 | 1342 | //but let's make it consistent |
1343 | - $related_objects = array( $related_objects ); |
|
1343 | + $related_objects = array($related_objects); |
|
1344 | 1344 | } |
1345 | - foreach( $related_objects as $related_object ) { |
|
1345 | + foreach ($related_objects as $related_object) { |
|
1346 | 1346 | //only refresh their cache if they're in memory |
1347 | - if( $related_object instanceof EE_Base_Class ) { |
|
1348 | - $related_object->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1347 | + if ($related_object instanceof EE_Base_Class) { |
|
1348 | + $related_object->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1349 | 1349 | } |
1350 | 1350 | } |
1351 | 1351 | } |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | * @return int , 1 on a successful update, the ID of the new entry on insert; 0 on failure or if the model object |
1366 | 1366 | * isn't allowed to persist (as determined by EE_Base_Class::allow_persist()) |
1367 | 1367 | */ |
1368 | - public function save($set_cols_n_values=array()) { |
|
1368 | + public function save($set_cols_n_values = array()) { |
|
1369 | 1369 | /** |
1370 | 1370 | * Filters the fields we're about to save on the model object |
1371 | 1371 | * |
1372 | 1372 | * @param array $set_cols_n_values |
1373 | 1373 | * @param EE_Base_Class $model_object |
1374 | 1374 | */ |
1375 | - $set_cols_n_values = apply_filters( 'FHEE__EE_Base_Class__save__set_cols_n_values', $set_cols_n_values, $this ); |
|
1375 | + $set_cols_n_values = apply_filters('FHEE__EE_Base_Class__save__set_cols_n_values', $set_cols_n_values, $this); |
|
1376 | 1376 | //set attributes as provided in $set_cols_n_values |
1377 | - foreach($set_cols_n_values as $column=>$value){ |
|
1378 | - $this->set($column,$value); |
|
1377 | + foreach ($set_cols_n_values as $column=>$value) { |
|
1378 | + $this->set($column, $value); |
|
1379 | 1379 | } |
1380 | 1380 | /** |
1381 | 1381 | * Saving a model object. |
@@ -1383,8 +1383,8 @@ discard block |
||
1383 | 1383 | * Before we perform a save, this action is fired. |
1384 | 1384 | * @param EE_Base_Class $model_object the model object about to be saved. |
1385 | 1385 | */ |
1386 | - do_action( 'AHEE__EE_Base_Class__save__begin', $this ); |
|
1387 | - if( ! $this->allow_persist() ) { |
|
1386 | + do_action('AHEE__EE_Base_Class__save__begin', $this); |
|
1387 | + if ( ! $this->allow_persist()) { |
|
1388 | 1388 | return 0; |
1389 | 1389 | } |
1390 | 1390 | //now get current attribute values |
@@ -1394,61 +1394,61 @@ discard block |
||
1394 | 1394 | $old_assumption_concerning_value_preparation = $this->get_model()->get_assumption_concerning_values_already_prepared_by_model_object(); |
1395 | 1395 | $this->get_model()->assume_values_already_prepared_by_model_object(true); |
1396 | 1396 | //does this model have an autoincrement PK? |
1397 | - if($this->get_model()->has_primary_key_field()){ |
|
1398 | - if($this->get_model()->get_primary_key_field()->is_auto_increment()){ |
|
1397 | + if ($this->get_model()->has_primary_key_field()) { |
|
1398 | + if ($this->get_model()->get_primary_key_field()->is_auto_increment()) { |
|
1399 | 1399 | //ok check if it's set, if so: update; if not, insert |
1400 | - if ( ! empty( $save_cols_n_values[self::_get_primary_key_name( get_class($this) )] ) ){ |
|
1401 | - $results = $this->get_model()->update_by_ID ( $save_cols_n_values, $this->ID() ); |
|
1400 | + if ( ! empty($save_cols_n_values[self::_get_primary_key_name(get_class($this))])) { |
|
1401 | + $results = $this->get_model()->update_by_ID($save_cols_n_values, $this->ID()); |
|
1402 | 1402 | } else { |
1403 | - unset($save_cols_n_values[self::_get_primary_key_name( get_class( $this) )]); |
|
1404 | - $results = $this->get_model()->insert( $save_cols_n_values, true); |
|
1405 | - if($results){ |
|
1403 | + unset($save_cols_n_values[self::_get_primary_key_name(get_class($this))]); |
|
1404 | + $results = $this->get_model()->insert($save_cols_n_values, true); |
|
1405 | + if ($results) { |
|
1406 | 1406 | //if successful, set the primary key |
1407 | 1407 | //but don't use the normal SET method, because it will check if |
1408 | 1408 | //an item with the same ID exists in the mapper & db, then |
1409 | 1409 | //will find it in the db (because we just added it) and THAT object |
1410 | 1410 | //will get added to the mapper before we can add this one! |
1411 | 1411 | //but if we just avoid using the SET method, all that headache can be avoided |
1412 | - $pk_field_name =self::_get_primary_key_name( get_class($this)); |
|
1412 | + $pk_field_name = self::_get_primary_key_name(get_class($this)); |
|
1413 | 1413 | $this->_fields[$pk_field_name] = $results; |
1414 | 1414 | $this->_clear_cached_property($pk_field_name); |
1415 | - $this->get_model()->add_to_entity_map( $this ); |
|
1415 | + $this->get_model()->add_to_entity_map($this); |
|
1416 | 1416 | $this->_update_cached_related_model_objs_fks(); |
1417 | 1417 | } |
1418 | 1418 | } |
1419 | - }else{//PK is NOT auto-increment |
|
1419 | + } else {//PK is NOT auto-increment |
|
1420 | 1420 | //so check if one like it already exists in the db |
1421 | - if( $this->get_model()->exists_by_ID( $this->ID() ) ){ |
|
1422 | - if( ! $this->in_entity_map() && WP_DEBUG ){ |
|
1421 | + if ($this->get_model()->exists_by_ID($this->ID())) { |
|
1422 | + if ( ! $this->in_entity_map() && WP_DEBUG) { |
|
1423 | 1423 | throw new EE_Error( |
1424 | 1424 | sprintf( |
1425 | - __( 'Using a model object %1$s that is NOT in the entity map, can lead to unexpected errors. You should either: %4$s 1. Put it in the entity mapper by calling %2$s %4$s 2. Discard this model object and use what is in the entity mapper %4$s 3. Fetch from the database using %3$s', 'event_espresso' ), |
|
1425 | + __('Using a model object %1$s that is NOT in the entity map, can lead to unexpected errors. You should either: %4$s 1. Put it in the entity mapper by calling %2$s %4$s 2. Discard this model object and use what is in the entity mapper %4$s 3. Fetch from the database using %3$s', 'event_espresso'), |
|
1426 | 1426 | get_class($this), |
1427 | - get_class( $this->get_model() ) . '::instance()->add_to_entity_map()', |
|
1428 | - get_class( $this->get_model() ) . '::instance()->get_one_by_ID()', |
|
1427 | + get_class($this->get_model()).'::instance()->add_to_entity_map()', |
|
1428 | + get_class($this->get_model()).'::instance()->get_one_by_ID()', |
|
1429 | 1429 | '<br />' |
1430 | 1430 | ) |
1431 | 1431 | ); |
1432 | 1432 | } |
1433 | 1433 | $results = $this->get_model()->update_by_ID($save_cols_n_values, $this->ID()); |
1434 | - }else{ |
|
1434 | + } else { |
|
1435 | 1435 | $results = $this->get_model()->insert($save_cols_n_values); |
1436 | 1436 | $this->_update_cached_related_model_objs_fks(); |
1437 | 1437 | } |
1438 | 1438 | } |
1439 | - }else{//there is NO primary key |
|
1439 | + } else {//there is NO primary key |
|
1440 | 1440 | $already_in_db = false; |
1441 | - foreach($this->get_model()->unique_indexes() as $index){ |
|
1441 | + foreach ($this->get_model()->unique_indexes() as $index) { |
|
1442 | 1442 | $uniqueness_where_params = array_intersect_key($save_cols_n_values, $index->fields()); |
1443 | - if($this->get_model()->exists(array($uniqueness_where_params))){ |
|
1443 | + if ($this->get_model()->exists(array($uniqueness_where_params))) { |
|
1444 | 1444 | $already_in_db = true; |
1445 | 1445 | } |
1446 | 1446 | } |
1447 | - if( $already_in_db ){ |
|
1448 | - $combined_pk_fields_n_values = array_intersect_key( $save_cols_n_values, $this->get_model()->get_combined_primary_key_fields() ); |
|
1449 | - $results = $this->get_model()->update( $save_cols_n_values,$combined_pk_fields_n_values ); |
|
1450 | - }else{ |
|
1451 | - $results = $this->get_model()->insert( $save_cols_n_values ); |
|
1447 | + if ($already_in_db) { |
|
1448 | + $combined_pk_fields_n_values = array_intersect_key($save_cols_n_values, $this->get_model()->get_combined_primary_key_fields()); |
|
1449 | + $results = $this->get_model()->update($save_cols_n_values, $combined_pk_fields_n_values); |
|
1450 | + } else { |
|
1451 | + $results = $this->get_model()->insert($save_cols_n_values); |
|
1452 | 1452 | } |
1453 | 1453 | } |
1454 | 1454 | //restore the old assumption about values being prepared by the model object |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | * @param boolean|int $results if it were updated, TRUE or FALSE; if it were newly inserted |
1462 | 1462 | * the new ID (or 0 if an error occurred and it wasn't updated) |
1463 | 1463 | */ |
1464 | - do_action( 'AHEE__EE_Base_Class__save__end', $this, $results ); |
|
1464 | + do_action('AHEE__EE_Base_Class__save__end', $this, $results); |
|
1465 | 1465 | return $results; |
1466 | 1466 | } |
1467 | 1467 | |
@@ -1473,13 +1473,13 @@ discard block |
||
1473 | 1473 | * and we want to let its cached relations with foreign keys to it know about that change. Eg: we've created a transaction but haven't saved it to the db. We also create a registration and don't save it to the DB, but we DO cache it on the transaction. Now, when we save the transaction, the registration's TXN_ID will be automatically updated, whether or not they exist in the DB (if they do, their DB records will be automatically updated) |
1474 | 1474 | * @return void |
1475 | 1475 | */ |
1476 | - protected function _update_cached_related_model_objs_fks(){ |
|
1477 | - foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ){ |
|
1478 | - if( $relation_obj instanceof EE_Has_Many_Relation ){ |
|
1479 | - foreach( $this->get_all_from_cache( $relation_name ) as $related_model_obj_in_cache) { |
|
1480 | - $fk_to_this = $related_model_obj_in_cache->get_model()->get_foreign_key_to( $this->get_model()->get_this_model_name() ); |
|
1481 | - $related_model_obj_in_cache->set($fk_to_this->get_name(), $this->ID() ); |
|
1482 | - if( $related_model_obj_in_cache->ID() ){ |
|
1476 | + protected function _update_cached_related_model_objs_fks() { |
|
1477 | + foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) { |
|
1478 | + if ($relation_obj instanceof EE_Has_Many_Relation) { |
|
1479 | + foreach ($this->get_all_from_cache($relation_name) as $related_model_obj_in_cache) { |
|
1480 | + $fk_to_this = $related_model_obj_in_cache->get_model()->get_foreign_key_to($this->get_model()->get_this_model_name()); |
|
1481 | + $related_model_obj_in_cache->set($fk_to_this->get_name(), $this->ID()); |
|
1482 | + if ($related_model_obj_in_cache->ID()) { |
|
1483 | 1483 | $related_model_obj_in_cache->save(); |
1484 | 1484 | } |
1485 | 1485 | } |
@@ -1495,21 +1495,21 @@ discard block |
||
1495 | 1495 | * and this object and properly setup |
1496 | 1496 | * @return int ID of new model object on save; 0 on failure+ |
1497 | 1497 | */ |
1498 | - public function save_new_cached_related_model_objs(){ |
|
1498 | + public function save_new_cached_related_model_objs() { |
|
1499 | 1499 | //make sure this has been saved |
1500 | - if( ! $this->ID()){ |
|
1500 | + if ( ! $this->ID()) { |
|
1501 | 1501 | $id = $this->save(); |
1502 | - }else{ |
|
1502 | + } else { |
|
1503 | 1503 | $id = $this->ID(); |
1504 | 1504 | } |
1505 | 1505 | //now save all the NEW cached model objects (ie they don't exist in the DB) |
1506 | - foreach($this->get_model()->relation_settings() as $relationName => $relationObj){ |
|
1506 | + foreach ($this->get_model()->relation_settings() as $relationName => $relationObj) { |
|
1507 | 1507 | |
1508 | 1508 | |
1509 | - if($this->_model_relations[$relationName]){ |
|
1509 | + if ($this->_model_relations[$relationName]) { |
|
1510 | 1510 | //is this a relation where we should expect just ONE related object (ie, EE_Belongs_To_relation) |
1511 | 1511 | //or MANY related objects (ie, EE_HABTM_Relation or EE_Has_Many_Relation)? |
1512 | - if($relationObj instanceof EE_Belongs_To_Relation){ |
|
1512 | + if ($relationObj instanceof EE_Belongs_To_Relation) { |
|
1513 | 1513 | //add a relation to that relation type (which saves the appropriate thing in the process) |
1514 | 1514 | //but ONLY if it DOES NOT exist in the DB |
1515 | 1515 | /* @var $related_model_obj EE_Base_Class */ |
@@ -1518,8 +1518,8 @@ discard block |
||
1518 | 1518 | $this->_add_relation_to($related_model_obj, $relationName); |
1519 | 1519 | $related_model_obj->save_new_cached_related_model_objs(); |
1520 | 1520 | // } |
1521 | - }else{ |
|
1522 | - foreach($this->_model_relations[$relationName] as $related_model_obj){ |
|
1521 | + } else { |
|
1522 | + foreach ($this->_model_relations[$relationName] as $related_model_obj) { |
|
1523 | 1523 | //add a relation to that relation type (which saves the appropriate thing in the process) |
1524 | 1524 | //but ONLY if it DOES NOT exist in the DB |
1525 | 1525 | // if( ! $related_model_obj->ID()){ |
@@ -1540,8 +1540,8 @@ discard block |
||
1540 | 1540 | * @return \EEM_Base | \EEM_CPT_Base |
1541 | 1541 | */ |
1542 | 1542 | public function get_model() { |
1543 | - $modelName = self::_get_model_classname( get_class($this) ); |
|
1544 | - return self::_get_model_instance_with_name($modelName, $this->_timezone ); |
|
1543 | + $modelName = self::_get_model_classname(get_class($this)); |
|
1544 | + return self::_get_model_instance_with_name($modelName, $this->_timezone); |
|
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | |
@@ -1551,10 +1551,10 @@ discard block |
||
1551 | 1551 | * @param $classname |
1552 | 1552 | * @return mixed bool|EE_Base_Class|EEM_CPT_Base |
1553 | 1553 | */ |
1554 | - protected static function _get_object_from_entity_mapper($props_n_values, $classname){ |
|
1554 | + protected static function _get_object_from_entity_mapper($props_n_values, $classname) { |
|
1555 | 1555 | //TODO: will not work for Term_Relationships because they have no PK! |
1556 | - $primary_id_ref = self::_get_primary_key_name( $classname ); |
|
1557 | - if ( array_key_exists( $primary_id_ref, $props_n_values ) && !empty( $props_n_values[$primary_id_ref] ) ) { |
|
1556 | + $primary_id_ref = self::_get_primary_key_name($classname); |
|
1557 | + if (array_key_exists($primary_id_ref, $props_n_values) && ! empty($props_n_values[$primary_id_ref])) { |
|
1558 | 1558 | $id = $props_n_values[$primary_id_ref]; |
1559 | 1559 | return self::_get_model($classname)->get_from_entity_map($id); |
1560 | 1560 | } |
@@ -1573,35 +1573,35 @@ discard block |
||
1573 | 1573 | * date_format and the second value is the time format |
1574 | 1574 | * @return mixed (EE_Base_Class|bool) |
1575 | 1575 | */ |
1576 | - protected static function _check_for_object( $props_n_values, $classname, $timezone = NULL, $date_formats = array() ) { |
|
1577 | - if( self::_get_model( $classname )->has_primary_key_field()){ |
|
1578 | - $primary_id_ref = self::_get_primary_key_name( $classname ); |
|
1576 | + protected static function _check_for_object($props_n_values, $classname, $timezone = NULL, $date_formats = array()) { |
|
1577 | + if (self::_get_model($classname)->has_primary_key_field()) { |
|
1578 | + $primary_id_ref = self::_get_primary_key_name($classname); |
|
1579 | 1579 | |
1580 | - if ( array_key_exists( $primary_id_ref, $props_n_values ) && !empty( $props_n_values[$primary_id_ref] ) ) { |
|
1581 | - $existing = self::_get_model( $classname, $timezone )->get_one_by_ID( $props_n_values[$primary_id_ref] ); |
|
1582 | - }else{ |
|
1580 | + if (array_key_exists($primary_id_ref, $props_n_values) && ! empty($props_n_values[$primary_id_ref])) { |
|
1581 | + $existing = self::_get_model($classname, $timezone)->get_one_by_ID($props_n_values[$primary_id_ref]); |
|
1582 | + } else { |
|
1583 | 1583 | $existing = null; |
1584 | 1584 | } |
1585 | - }elseif( self::_get_model( $classname, $timezone )->has_all_combined_primary_key_fields( $props_n_values ) ){ |
|
1585 | + }elseif (self::_get_model($classname, $timezone)->has_all_combined_primary_key_fields($props_n_values)) { |
|
1586 | 1586 | //no primary key on this model, but there's still a matching item in the DB |
1587 | - $existing = self::_get_model($classname, $timezone)->get_one_by_ID( self::_get_model($classname, $timezone)->get_index_primary_key_string( $props_n_values ) ); |
|
1588 | - }else{ |
|
1587 | + $existing = self::_get_model($classname, $timezone)->get_one_by_ID(self::_get_model($classname, $timezone)->get_index_primary_key_string($props_n_values)); |
|
1588 | + } else { |
|
1589 | 1589 | $existing = null; |
1590 | 1590 | } |
1591 | - if ( $existing ) { |
|
1591 | + if ($existing) { |
|
1592 | 1592 | |
1593 | 1593 | //set date formats if present before setting values |
1594 | - if ( ! empty( $date_formats ) && is_array( $date_formats ) ) { |
|
1595 | - $existing->set_date_format( $date_formats[0] ); |
|
1596 | - $existing->set_time_format( $date_formats[1] ); |
|
1594 | + if ( ! empty($date_formats) && is_array($date_formats)) { |
|
1595 | + $existing->set_date_format($date_formats[0]); |
|
1596 | + $existing->set_time_format($date_formats[1]); |
|
1597 | 1597 | } else { |
1598 | 1598 | //set default formats for date and time |
1599 | - $existing->set_date_format( get_option( 'date_format' ) ); |
|
1600 | - $existing->set_time_format( get_option( 'time_format' ) ); |
|
1599 | + $existing->set_date_format(get_option('date_format')); |
|
1600 | + $existing->set_time_format(get_option('time_format')); |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | - foreach ( $props_n_values as $property => $field_value ) { |
|
1604 | - $existing->set( $property, $field_value ); |
|
1603 | + foreach ($props_n_values as $property => $field_value) { |
|
1604 | + $existing->set($property, $field_value); |
|
1605 | 1605 | } |
1606 | 1606 | return $existing; |
1607 | 1607 | } else { |
@@ -1619,13 +1619,13 @@ discard block |
||
1619 | 1619 | * @throws EE_Error |
1620 | 1620 | * @return EEM_Base |
1621 | 1621 | */ |
1622 | - protected static function _get_model( $classname, $timezone = NULL ){ |
|
1622 | + protected static function _get_model($classname, $timezone = NULL) { |
|
1623 | 1623 | //find model for this class |
1624 | - if( ! $classname ){ |
|
1625 | - throw new EE_Error(sprintf(__("What were you thinking calling _get_model(%s)?? You need to specify the class name", "event_espresso"),$classname)); |
|
1624 | + if ( ! $classname) { |
|
1625 | + throw new EE_Error(sprintf(__("What were you thinking calling _get_model(%s)?? You need to specify the class name", "event_espresso"), $classname)); |
|
1626 | 1626 | } |
1627 | - $modelName=self::_get_model_classname($classname); |
|
1628 | - return self::_get_model_instance_with_name($modelName, $timezone ); |
|
1627 | + $modelName = self::_get_model_classname($classname); |
|
1628 | + return self::_get_model_instance_with_name($modelName, $timezone); |
|
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | |
@@ -1636,10 +1636,10 @@ discard block |
||
1636 | 1636 | * @param null $timezone |
1637 | 1637 | * @return EEM_Base |
1638 | 1638 | */ |
1639 | - protected static function _get_model_instance_with_name($model_classname, $timezone = NULL){ |
|
1640 | - $model_classname = str_replace( 'EEM_', '', $model_classname ); |
|
1641 | - $model = EE_Registry::instance()->load_model( $model_classname ); |
|
1642 | - $model->set_timezone( $timezone ); |
|
1639 | + protected static function _get_model_instance_with_name($model_classname, $timezone = NULL) { |
|
1640 | + $model_classname = str_replace('EEM_', '', $model_classname); |
|
1641 | + $model = EE_Registry::instance()->load_model($model_classname); |
|
1642 | + $model->set_timezone($timezone); |
|
1643 | 1643 | return $model; |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1651,10 +1651,10 @@ discard block |
||
1651 | 1651 | * @param null $model_name |
1652 | 1652 | * @return string like EEM_Attendee |
1653 | 1653 | */ |
1654 | - private static function _get_model_classname( $model_name = null){ |
|
1655 | - if(strpos($model_name,"EE_")===0){ |
|
1656 | - $model_classname=str_replace("EE_","EEM_",$model_name); |
|
1657 | - }else{ |
|
1654 | + private static function _get_model_classname($model_name = null) { |
|
1655 | + if (strpos($model_name, "EE_") === 0) { |
|
1656 | + $model_classname = str_replace("EE_", "EEM_", $model_name); |
|
1657 | + } else { |
|
1658 | 1658 | $model_classname = "EEM_".$model_name; |
1659 | 1659 | } |
1660 | 1660 | return $model_classname; |
@@ -1668,11 +1668,11 @@ discard block |
||
1668 | 1668 | * @throws EE_Error |
1669 | 1669 | * @return string |
1670 | 1670 | */ |
1671 | - protected static function _get_primary_key_name( $classname = NULL ){ |
|
1672 | - if( ! $classname){ |
|
1673 | - throw new EE_Error(sprintf(__("What were you thinking calling _get_primary_key_name(%s)", "event_espresso"),$classname)); |
|
1671 | + protected static function _get_primary_key_name($classname = NULL) { |
|
1672 | + if ( ! $classname) { |
|
1673 | + throw new EE_Error(sprintf(__("What were you thinking calling _get_primary_key_name(%s)", "event_espresso"), $classname)); |
|
1674 | 1674 | } |
1675 | - return self::_get_model( $classname )->get_primary_key_field()->get_name(); |
|
1675 | + return self::_get_model($classname)->get_primary_key_field()->get_name(); |
|
1676 | 1676 | } |
1677 | 1677 | |
1678 | 1678 | |
@@ -1684,12 +1684,12 @@ discard block |
||
1684 | 1684 | * Usually defaults for integer primary keys are 0; string primary keys are usually NULL). |
1685 | 1685 | * @return mixed, if the primary key is of type INT it'll be an int. Otherwise it could be a string |
1686 | 1686 | */ |
1687 | - public function ID(){ |
|
1687 | + public function ID() { |
|
1688 | 1688 | //now that we know the name of the variable, use a variable variable to get its value and return its |
1689 | - if( $this->get_model()->has_primary_key_field() ) { |
|
1690 | - return $this->_fields[self::_get_primary_key_name( get_class($this) )]; |
|
1691 | - }else{ |
|
1692 | - return $this->get_model()->get_index_primary_key_string( $this->_fields ); |
|
1689 | + if ($this->get_model()->has_primary_key_field()) { |
|
1690 | + return $this->_fields[self::_get_primary_key_name(get_class($this))]; |
|
1691 | + } else { |
|
1692 | + return $this->get_model()->get_index_primary_key_string($this->_fields); |
|
1693 | 1693 | } |
1694 | 1694 | } |
1695 | 1695 | |
@@ -1707,38 +1707,38 @@ discard block |
||
1707 | 1707 | * @throws EE_Error |
1708 | 1708 | * @return EE_Base_Class the object the relation was added to |
1709 | 1709 | */ |
1710 | - public function _add_relation_to( $otherObjectModelObjectOrID,$relationName, $extra_join_model_fields_n_values = array(), $cache_id = NULL ){ |
|
1710 | + public function _add_relation_to($otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values = array(), $cache_id = NULL) { |
|
1711 | 1711 | //if this thing exists in the DB, save the relation to the DB |
1712 | - if( $this->ID() ){ |
|
1713 | - $otherObject = $this->get_model()->add_relationship_to( $this, $otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values ); |
|
1712 | + if ($this->ID()) { |
|
1713 | + $otherObject = $this->get_model()->add_relationship_to($this, $otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values); |
|
1714 | 1714 | //clear cache so future get_many_related and get_first_related() return new results. |
1715 | - $this->clear_cache( $relationName, $otherObject, TRUE ); |
|
1716 | - if( $otherObject instanceof EE_Base_Class ) { |
|
1717 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1715 | + $this->clear_cache($relationName, $otherObject, TRUE); |
|
1716 | + if ($otherObject instanceof EE_Base_Class) { |
|
1717 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1718 | 1718 | } |
1719 | 1719 | } else { |
1720 | 1720 | //this thing doesn't exist in the DB, so just cache it |
1721 | - if( ! $otherObjectModelObjectOrID instanceof EE_Base_Class){ |
|
1722 | - throw new EE_Error( sprintf( |
|
1723 | - __( 'Before a model object is saved to the database, calls to _add_relation_to must be passed an actual object, not just an ID. You provided %s as the model object to a %s', 'event_espresso' ), |
|
1721 | + if ( ! $otherObjectModelObjectOrID instanceof EE_Base_Class) { |
|
1722 | + throw new EE_Error(sprintf( |
|
1723 | + __('Before a model object is saved to the database, calls to _add_relation_to must be passed an actual object, not just an ID. You provided %s as the model object to a %s', 'event_espresso'), |
|
1724 | 1724 | $otherObjectModelObjectOrID, |
1725 | - get_class( $this ) |
|
1725 | + get_class($this) |
|
1726 | 1726 | )); |
1727 | 1727 | } else { |
1728 | 1728 | $otherObject = $otherObjectModelObjectOrID; |
1729 | 1729 | } |
1730 | - $this->cache( $relationName, $otherObjectModelObjectOrID, $cache_id ); |
|
1730 | + $this->cache($relationName, $otherObjectModelObjectOrID, $cache_id); |
|
1731 | 1731 | } |
1732 | - if( $otherObject instanceof EE_Base_Class ) { |
|
1732 | + if ($otherObject instanceof EE_Base_Class) { |
|
1733 | 1733 | //fix the reciprocal relation too |
1734 | - if( $otherObject->ID() ) { |
|
1734 | + if ($otherObject->ID()) { |
|
1735 | 1735 | //its saved so assumed relations exist in the DB, so we can just |
1736 | 1736 | //clear the cache so future queries use the updated info in the DB |
1737 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), null, true ); |
|
1737 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), null, true); |
|
1738 | 1738 | } else { |
1739 | 1739 | |
1740 | 1740 | //it's not saved, so it caches relations like this |
1741 | - $otherObject->cache( $this->get_model()->get_this_model_name(), $this ); |
|
1741 | + $otherObject->cache($this->get_model()->get_this_model_name(), $this); |
|
1742 | 1742 | } |
1743 | 1743 | } |
1744 | 1744 | return $otherObject; |
@@ -1761,17 +1761,17 @@ discard block |
||
1761 | 1761 | * Also remember that if an exact match isn't found for these extra cols/val pairs, then a NEW row is created in the join table. |
1762 | 1762 | * @return EE_Base_Class the relation was removed from |
1763 | 1763 | */ |
1764 | - public function _remove_relation_to($otherObjectModelObjectOrID,$relationName, $where_query = array() ){ |
|
1765 | - if ( $this->ID() ) { |
|
1764 | + public function _remove_relation_to($otherObjectModelObjectOrID, $relationName, $where_query = array()) { |
|
1765 | + if ($this->ID()) { |
|
1766 | 1766 | //if this exists in the DB, save the relation change to the DB too |
1767 | - $otherObject = $this->get_model()->remove_relationship_to( $this, $otherObjectModelObjectOrID, $relationName, $where_query ); |
|
1768 | - $this->clear_cache( $relationName, $otherObject ); |
|
1767 | + $otherObject = $this->get_model()->remove_relationship_to($this, $otherObjectModelObjectOrID, $relationName, $where_query); |
|
1768 | + $this->clear_cache($relationName, $otherObject); |
|
1769 | 1769 | } else { |
1770 | 1770 | //this doesn't exist in the DB, just remove it from the cache |
1771 | - $otherObject = $this->clear_cache( $relationName, $otherObjectModelObjectOrID ); |
|
1771 | + $otherObject = $this->clear_cache($relationName, $otherObjectModelObjectOrID); |
|
1772 | 1772 | } |
1773 | - if( $otherObject instanceof EE_Base_Class ) { |
|
1774 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1773 | + if ($otherObject instanceof EE_Base_Class) { |
|
1774 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1775 | 1775 | } |
1776 | 1776 | return $otherObject; |
1777 | 1777 | } |
@@ -1782,18 +1782,18 @@ discard block |
||
1782 | 1782 | * @param array $where_query_params like EEM_Base::get_all's $query_params[0] (where conditions) |
1783 | 1783 | * @return EE_Base_Class |
1784 | 1784 | */ |
1785 | - public function _remove_relations($relationName,$where_query_params = array()){ |
|
1786 | - if ( $this->ID() ) { |
|
1785 | + public function _remove_relations($relationName, $where_query_params = array()) { |
|
1786 | + if ($this->ID()) { |
|
1787 | 1787 | //if this exists in the DB, save the relation change to the DB too |
1788 | - $otherObjects = $this->get_model()->remove_relations( $this, $relationName, $where_query_params ); |
|
1789 | - $this->clear_cache( $relationName, null, true ); |
|
1788 | + $otherObjects = $this->get_model()->remove_relations($this, $relationName, $where_query_params); |
|
1789 | + $this->clear_cache($relationName, null, true); |
|
1790 | 1790 | } else { |
1791 | 1791 | //this doesn't exist in the DB, just remove it from the cache |
1792 | - $otherObjects = $this->clear_cache( $relationName, null, true ); |
|
1792 | + $otherObjects = $this->clear_cache($relationName, null, true); |
|
1793 | 1793 | } |
1794 | - if( is_array( $otherObjects ) ) { |
|
1795 | - foreach ( $otherObjects as $otherObject ) { |
|
1796 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1794 | + if (is_array($otherObjects)) { |
|
1795 | + foreach ($otherObjects as $otherObject) { |
|
1796 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1797 | 1797 | } |
1798 | 1798 | } |
1799 | 1799 | return $otherObjects; |
@@ -1811,26 +1811,26 @@ discard block |
||
1811 | 1811 | * @return EE_Base_Class[] Results not necessarily indexed by IDs, because some results might not have primary keys |
1812 | 1812 | * or might not be saved yet. Consider using EEM_Base::get_IDs() on these results if you want IDs |
1813 | 1813 | */ |
1814 | - public function get_many_related($relationName,$query_params = array()){ |
|
1815 | - if($this->ID()){//this exists in the DB, so get the related things from either the cache or the DB |
|
1814 | + public function get_many_related($relationName, $query_params = array()) { |
|
1815 | + if ($this->ID()) {//this exists in the DB, so get the related things from either the cache or the DB |
|
1816 | 1816 | //if there are query parameters, forget about caching the related model objects. |
1817 | - if( $query_params ){ |
|
1817 | + if ($query_params) { |
|
1818 | 1818 | $related_model_objects = $this->get_model()->get_all_related($this, $relationName, $query_params); |
1819 | - }else{ |
|
1819 | + } else { |
|
1820 | 1820 | //did we already cache the result of this query? |
1821 | 1821 | $cached_results = $this->get_all_from_cache($relationName); |
1822 | - if ( ! $cached_results ){ |
|
1822 | + if ( ! $cached_results) { |
|
1823 | 1823 | $related_model_objects = $this->get_model()->get_all_related($this, $relationName, $query_params); |
1824 | 1824 | //if no query parameters were passed, then we got all the related model objects |
1825 | 1825 | //for that relation. We can cache them then. |
1826 | - foreach($related_model_objects as $related_model_object){ |
|
1826 | + foreach ($related_model_objects as $related_model_object) { |
|
1827 | 1827 | $this->cache($relationName, $related_model_object); |
1828 | 1828 | } |
1829 | - }else{ |
|
1829 | + } else { |
|
1830 | 1830 | $related_model_objects = $cached_results; |
1831 | 1831 | } |
1832 | 1832 | } |
1833 | - }else{//this doesn't exist itn eh DB, so just get the related things from the cache |
|
1833 | + } else {//this doesn't exist itn eh DB, so just get the related things from the cache |
|
1834 | 1834 | $related_model_objects = $this->get_all_from_cache($relationName); |
1835 | 1835 | } |
1836 | 1836 | return $related_model_objects; |
@@ -1847,8 +1847,8 @@ discard block |
||
1847 | 1847 | * @param bool $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE; |
1848 | 1848 | * @return int |
1849 | 1849 | */ |
1850 | - public function count_related($relation_name, $query_params =array(),$field_to_count = NULL, $distinct = FALSE){ |
|
1851 | - return $this->get_model()->count_related($this,$relation_name,$query_params,$field_to_count,$distinct); |
|
1850 | + public function count_related($relation_name, $query_params = array(), $field_to_count = NULL, $distinct = FALSE) { |
|
1851 | + return $this->get_model()->count_related($this, $relation_name, $query_params, $field_to_count, $distinct); |
|
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | * By default, uses primary key (which doesn't make much sense, so you should probably change it) |
1863 | 1863 | * @return int |
1864 | 1864 | */ |
1865 | - public function sum_related($relation_name, $query_params = array(), $field_to_sum = null){ |
|
1865 | + public function sum_related($relation_name, $query_params = array(), $field_to_sum = null) { |
|
1866 | 1866 | return $this->get_model()->sum_related($this, $relation_name, $query_params, $field_to_sum); |
1867 | 1867 | } |
1868 | 1868 | |
@@ -1874,34 +1874,34 @@ discard block |
||
1874 | 1874 | * @param array $query_params like EEM_Base::get_all |
1875 | 1875 | * @return EE_Base_Class (not an array, a single object) |
1876 | 1876 | */ |
1877 | - public function get_first_related($relationName,$query_params = array()){ |
|
1878 | - if($this->ID()){//this exists in the DB, get from the cache OR the DB |
|
1877 | + public function get_first_related($relationName, $query_params = array()) { |
|
1878 | + if ($this->ID()) {//this exists in the DB, get from the cache OR the DB |
|
1879 | 1879 | |
1880 | 1880 | //if they've provided some query parameters, don't bother trying to cache the result |
1881 | 1881 | //also make sure we're not caching the result of get_first_related |
1882 | 1882 | //on a relation which should have an array of objects (because the cache might have an array of objects) |
1883 | - if ($query_params || ! $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation){ |
|
1884 | - $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1885 | - }else{ |
|
1883 | + if ($query_params || ! $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation) { |
|
1884 | + $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1885 | + } else { |
|
1886 | 1886 | //first, check if we've already cached the result of this query |
1887 | 1887 | $cached_result = $this->get_one_from_cache($relationName); |
1888 | - if ( ! $cached_result ){ |
|
1888 | + if ( ! $cached_result) { |
|
1889 | 1889 | |
1890 | 1890 | $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
1891 | - $this->cache($relationName,$related_model_object); |
|
1892 | - }else{ |
|
1891 | + $this->cache($relationName, $related_model_object); |
|
1892 | + } else { |
|
1893 | 1893 | $related_model_object = $cached_result; |
1894 | 1894 | } |
1895 | 1895 | } |
1896 | - }else{ |
|
1896 | + } else { |
|
1897 | 1897 | //this doesn't exist in the Db, but maybe the relation is of type belongs to, and so the related thing might |
1898 | - if( $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation){ |
|
1899 | - $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1900 | - }else{ |
|
1898 | + if ($this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation) { |
|
1899 | + $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1900 | + } else { |
|
1901 | 1901 | $related_model_object = null; |
1902 | 1902 | } |
1903 | 1903 | //this doesn't exist in the DB and apparently the thing it belongs to doesn't either, just get what's cached on this object |
1904 | - if( ! $related_model_object){ |
|
1904 | + if ( ! $related_model_object) { |
|
1905 | 1905 | $related_model_object = $this->get_one_from_cache($relationName); |
1906 | 1906 | } |
1907 | 1907 | |
@@ -1920,12 +1920,12 @@ discard block |
||
1920 | 1920 | * @param array $query_params like EEM_Base::get_all's |
1921 | 1921 | * @return int how many deleted |
1922 | 1922 | */ |
1923 | - public function delete_related($relationName,$query_params = array()){ |
|
1924 | - if($this->ID()){ |
|
1925 | - $count = $this->get_model()->delete_related($this, $relationName, $query_params); |
|
1926 | - }else{ |
|
1923 | + public function delete_related($relationName, $query_params = array()) { |
|
1924 | + if ($this->ID()) { |
|
1925 | + $count = $this->get_model()->delete_related($this, $relationName, $query_params); |
|
1926 | + } else { |
|
1927 | 1927 | $count = count($this->get_all_from_cache($relationName)); |
1928 | - $this->clear_cache($relationName,NULL,TRUE); |
|
1928 | + $this->clear_cache($relationName, NULL, TRUE); |
|
1929 | 1929 | } |
1930 | 1930 | return $count; |
1931 | 1931 | } |
@@ -1940,13 +1940,13 @@ discard block |
||
1940 | 1940 | * @param array $query_params like EEM_Base::get_all's |
1941 | 1941 | * @return int how many deleted (including those soft deleted) |
1942 | 1942 | */ |
1943 | - public function delete_related_permanently($relationName,$query_params = array()){ |
|
1944 | - if($this->ID()){ |
|
1945 | - $count = $this->get_model()->delete_related_permanently($this, $relationName, $query_params); |
|
1946 | - }else{ |
|
1943 | + public function delete_related_permanently($relationName, $query_params = array()) { |
|
1944 | + if ($this->ID()) { |
|
1945 | + $count = $this->get_model()->delete_related_permanently($this, $relationName, $query_params); |
|
1946 | + } else { |
|
1947 | 1947 | $count = count($this->get_all_from_cache($relationName)); |
1948 | 1948 | } |
1949 | - $this->clear_cache($relationName,NULL,TRUE); |
|
1949 | + $this->clear_cache($relationName, NULL, TRUE); |
|
1950 | 1950 | return $count; |
1951 | 1951 | } |
1952 | 1952 | |
@@ -1962,7 +1962,7 @@ discard block |
||
1962 | 1962 | * @param string $field_name property to check |
1963 | 1963 | * @return bool TRUE if existing,FALSE if not. |
1964 | 1964 | */ |
1965 | - public function is_set( $field_name ) { |
|
1965 | + public function is_set($field_name) { |
|
1966 | 1966 | return isset($this->_fields[$field_name]); |
1967 | 1967 | } |
1968 | 1968 | |
@@ -1974,12 +1974,12 @@ discard block |
||
1974 | 1974 | * @throws EE_Error |
1975 | 1975 | * @return bool TRUE if existing, throw EE_Error if not. |
1976 | 1976 | */ |
1977 | - protected function _property_exists( $properties ) { |
|
1977 | + protected function _property_exists($properties) { |
|
1978 | 1978 | |
1979 | - foreach ( (array) $properties as $property_name ) { |
|
1979 | + foreach ((array) $properties as $property_name) { |
|
1980 | 1980 | //first make sure this property exists |
1981 | - if ( ! $this->_fields[ $property_name ] ) |
|
1982 | - throw new EE_Error( sprintf( __('Trying to retrieve a non-existent property (%s). Double check the spelling please', 'event_espresso'), $property_name ) ); |
|
1981 | + if ( ! $this->_fields[$property_name]) |
|
1982 | + throw new EE_Error(sprintf(__('Trying to retrieve a non-existent property (%s). Double check the spelling please', 'event_espresso'), $property_name)); |
|
1983 | 1983 | } |
1984 | 1984 | |
1985 | 1985 | return TRUE; |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | $fields = $this->get_model()->field_settings(FALSE); |
1997 | 1997 | $properties = array(); |
1998 | 1998 | //remove prepended underscore |
1999 | - foreach ( $fields as $field_name => $settings ) { |
|
1999 | + foreach ($fields as $field_name => $settings) { |
|
2000 | 2000 | $properties[$field_name] = $this->get($field_name); |
2001 | 2001 | } |
2002 | 2002 | return $properties; |
@@ -2026,14 +2026,14 @@ discard block |
||
2026 | 2026 | * @throws EE_Error |
2027 | 2027 | * @return mixed whatever the plugin which calls add_filter decides |
2028 | 2028 | */ |
2029 | - public function __call($methodName,$args){ |
|
2030 | - $className=get_class($this); |
|
2031 | - $tagName="FHEE__{$className}__{$methodName}"; |
|
2032 | - if(!has_filter($tagName)){ |
|
2033 | - throw new EE_Error(sprintf(__("Method %s on class %s does not exist! You can create one with the following code in functions.php or in a plugin: add_filter('%s','my_callback',10,3);function my_callback(\$previousReturnValue,EE_Base_Class \$object, \$argsArray){/*function body*/return \$whatever;}","event_espresso"), |
|
2034 | - $methodName,$className,$tagName)); |
|
2029 | + public function __call($methodName, $args) { |
|
2030 | + $className = get_class($this); |
|
2031 | + $tagName = "FHEE__{$className}__{$methodName}"; |
|
2032 | + if ( ! has_filter($tagName)) { |
|
2033 | + throw new EE_Error(sprintf(__("Method %s on class %s does not exist! You can create one with the following code in functions.php or in a plugin: add_filter('%s','my_callback',10,3);function my_callback(\$previousReturnValue,EE_Base_Class \$object, \$argsArray){/*function body*/return \$whatever;}", "event_espresso"), |
|
2034 | + $methodName, $className, $tagName)); |
|
2035 | 2035 | } |
2036 | - return apply_filters($tagName,null,$this,$args); |
|
2036 | + return apply_filters($tagName, null, $this, $args); |
|
2037 | 2037 | } |
2038 | 2038 | |
2039 | 2039 | |
@@ -2048,22 +2048,22 @@ discard block |
||
2048 | 2048 | * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row) |
2049 | 2049 | * NOTE: if the values haven't changed, returns 0 |
2050 | 2050 | */ |
2051 | - public function update_extra_meta($meta_key,$meta_value,$previous_value = NULL){ |
|
2052 | - $query_params = array(array( |
|
2051 | + public function update_extra_meta($meta_key, $meta_value, $previous_value = NULL) { |
|
2052 | + $query_params = array(array( |
|
2053 | 2053 | 'EXM_key'=>$meta_key, |
2054 | 2054 | 'OBJ_ID'=>$this->ID(), |
2055 | 2055 | 'EXM_type'=>$this->get_model()->get_this_model_name())); |
2056 | - if($previous_value !== NULL){ |
|
2056 | + if ($previous_value !== NULL) { |
|
2057 | 2057 | $query_params[0]['EXM_value'] = $meta_value; |
2058 | 2058 | } |
2059 | 2059 | $existing_rows_like_that = EEM_Extra_Meta::instance()->get_all($query_params); |
2060 | - if( ! $existing_rows_like_that){ |
|
2060 | + if ( ! $existing_rows_like_that) { |
|
2061 | 2061 | return $this->add_extra_meta($meta_key, $meta_value); |
2062 | - }else{ |
|
2063 | - foreach( $existing_rows_like_that as $existing_row){ |
|
2064 | - $existing_row->save( array( 'EXM_value' => $meta_value ) ); |
|
2062 | + } else { |
|
2063 | + foreach ($existing_rows_like_that as $existing_row) { |
|
2064 | + $existing_row->save(array('EXM_value' => $meta_value)); |
|
2065 | 2065 | } |
2066 | - return count( $existing_rows_like_that ); |
|
2066 | + return count($existing_rows_like_that); |
|
2067 | 2067 | } |
2068 | 2068 | } |
2069 | 2069 | |
@@ -2076,10 +2076,10 @@ discard block |
||
2076 | 2076 | * @param boolean $unique |
2077 | 2077 | * @return boolean |
2078 | 2078 | */ |
2079 | - public function add_extra_meta($meta_key,$meta_value,$unique = false){ |
|
2080 | - if($unique){ |
|
2081 | - $existing_extra_meta = EEM_Extra_Meta::instance()->get_one(array(array('EXM_key'=>$meta_key,'OBJ_ID'=>$this->ID(),'EXM_type'=>$this->_get_model_classname(get_class($this))))); |
|
2082 | - if($existing_extra_meta){ |
|
2079 | + public function add_extra_meta($meta_key, $meta_value, $unique = false) { |
|
2080 | + if ($unique) { |
|
2081 | + $existing_extra_meta = EEM_Extra_Meta::instance()->get_one(array(array('EXM_key'=>$meta_key, 'OBJ_ID'=>$this->ID(), 'EXM_type'=>$this->_get_model_classname(get_class($this))))); |
|
2082 | + if ($existing_extra_meta) { |
|
2083 | 2083 | return false; |
2084 | 2084 | } |
2085 | 2085 | } |
@@ -2099,12 +2099,12 @@ discard block |
||
2099 | 2099 | * @param string $meta_value |
2100 | 2100 | * @return int number of extra meta rows deleted |
2101 | 2101 | */ |
2102 | - public function delete_extra_meta($meta_key,$meta_value = NULL){ |
|
2103 | - $query_params = array(array( |
|
2102 | + public function delete_extra_meta($meta_key, $meta_value = NULL) { |
|
2103 | + $query_params = array(array( |
|
2104 | 2104 | 'EXM_key'=>$meta_key, |
2105 | 2105 | 'OBJ_ID'=>$this->ID(), |
2106 | 2106 | 'EXM_type'=>$this->get_model()->get_this_model_name())); |
2107 | - if($meta_value !== NULL){ |
|
2107 | + if ($meta_value !== NULL) { |
|
2108 | 2108 | $query_params[0]['EXM_value'] = $meta_value; |
2109 | 2109 | } |
2110 | 2110 | $count_deleted = EEM_Extra_Meta::instance()->delete($query_params); |
@@ -2120,25 +2120,25 @@ discard block |
||
2120 | 2120 | * @param mixed $default if we don't find anything, what should we return? |
2121 | 2121 | * @return mixed single value if $single; array if ! $single |
2122 | 2122 | */ |
2123 | - public function get_extra_meta($meta_key,$single = FALSE,$default = NULL){ |
|
2124 | - if($single){ |
|
2125 | - $result = $this->get_first_related('Extra_Meta',array(array('EXM_key'=>$meta_key))); |
|
2126 | - if ( $result instanceof EE_Extra_Meta ){ |
|
2123 | + public function get_extra_meta($meta_key, $single = FALSE, $default = NULL) { |
|
2124 | + if ($single) { |
|
2125 | + $result = $this->get_first_related('Extra_Meta', array(array('EXM_key'=>$meta_key))); |
|
2126 | + if ($result instanceof EE_Extra_Meta) { |
|
2127 | 2127 | return $result->value(); |
2128 | - }else{ |
|
2128 | + } else { |
|
2129 | 2129 | return $default; |
2130 | 2130 | } |
2131 | - }else{ |
|
2132 | - $results = $this->get_many_related('Extra_Meta',array(array('EXM_key'=>$meta_key))); |
|
2133 | - if($results){ |
|
2131 | + } else { |
|
2132 | + $results = $this->get_many_related('Extra_Meta', array(array('EXM_key'=>$meta_key))); |
|
2133 | + if ($results) { |
|
2134 | 2134 | $values = array(); |
2135 | - foreach($results as $result){ |
|
2136 | - if ( $result instanceof EE_Extra_Meta ){ |
|
2135 | + foreach ($results as $result) { |
|
2136 | + if ($result instanceof EE_Extra_Meta) { |
|
2137 | 2137 | $values[$result->ID()] = $result->value(); |
2138 | 2138 | } |
2139 | 2139 | } |
2140 | 2140 | return $values; |
2141 | - }else{ |
|
2141 | + } else { |
|
2142 | 2142 | return $default; |
2143 | 2143 | } |
2144 | 2144 | } |
@@ -2155,20 +2155,20 @@ discard block |
||
2155 | 2155 | * @param boolean $one_of_each_key |
2156 | 2156 | * @return array |
2157 | 2157 | */ |
2158 | - public function all_extra_meta_array($one_of_each_key = true){ |
|
2158 | + public function all_extra_meta_array($one_of_each_key = true) { |
|
2159 | 2159 | $return_array = array(); |
2160 | - if($one_of_each_key){ |
|
2160 | + if ($one_of_each_key) { |
|
2161 | 2161 | $extra_meta_objs = $this->get_many_related('Extra_Meta', array('group_by'=>'EXM_key')); |
2162 | - foreach($extra_meta_objs as $extra_meta_obj){ |
|
2163 | - if ( $extra_meta_obj instanceof EE_Extra_Meta ) { |
|
2162 | + foreach ($extra_meta_objs as $extra_meta_obj) { |
|
2163 | + if ($extra_meta_obj instanceof EE_Extra_Meta) { |
|
2164 | 2164 | $return_array[$extra_meta_obj->key()] = $extra_meta_obj->value(); |
2165 | 2165 | } |
2166 | 2166 | } |
2167 | - }else{ |
|
2167 | + } else { |
|
2168 | 2168 | $extra_meta_objs = $this->get_many_related('Extra_Meta'); |
2169 | - foreach($extra_meta_objs as $extra_meta_obj){ |
|
2170 | - if ( $extra_meta_obj instanceof EE_Extra_Meta ) { |
|
2171 | - if( ! isset($return_array[$extra_meta_obj->key()])){ |
|
2169 | + foreach ($extra_meta_objs as $extra_meta_obj) { |
|
2170 | + if ($extra_meta_obj instanceof EE_Extra_Meta) { |
|
2171 | + if ( ! isset($return_array[$extra_meta_obj->key()])) { |
|
2172 | 2172 | $return_array[$extra_meta_obj->key()] = array(); |
2173 | 2173 | } |
2174 | 2174 | $return_array[$extra_meta_obj->key()][$extra_meta_obj->ID()] = $extra_meta_obj->value(); |
@@ -2181,19 +2181,19 @@ discard block |
||
2181 | 2181 | * Gets a pretty nice displayable nice for this model object. Often overridden |
2182 | 2182 | * @return string |
2183 | 2183 | */ |
2184 | - public function name(){ |
|
2184 | + public function name() { |
|
2185 | 2185 | //find a field that's not a text field |
2186 | 2186 | $field_we_can_use = $this->get_model()->get_a_field_of_type('EE_Text_Field_Base'); |
2187 | - if($field_we_can_use){ |
|
2187 | + if ($field_we_can_use) { |
|
2188 | 2188 | return $this->get($field_we_can_use->get_name()); |
2189 | - }else{ |
|
2189 | + } else { |
|
2190 | 2190 | $first_few_properties = $this->model_field_array(); |
2191 | - $first_few_properties = array_slice($first_few_properties,0,3); |
|
2191 | + $first_few_properties = array_slice($first_few_properties, 0, 3); |
|
2192 | 2192 | $name_parts = array(); |
2193 | - foreach( $first_few_properties as $name=> $value ){ |
|
2193 | + foreach ($first_few_properties as $name=> $value) { |
|
2194 | 2194 | $name_parts[] = "$name:$value"; |
2195 | 2195 | } |
2196 | - return implode(",",$name_parts); |
|
2196 | + return implode(",", $name_parts); |
|
2197 | 2197 | } |
2198 | 2198 | } |
2199 | 2199 | |
@@ -2202,11 +2202,11 @@ discard block |
||
2202 | 2202 | * Checks if this model object has been proven to already be in the entity map |
2203 | 2203 | * @return boolean |
2204 | 2204 | */ |
2205 | - public function in_entity_map(){ |
|
2206 | - if( $this->ID() && $this->get_model()->get_from_entity_map( $this->ID() ) === $this ) { |
|
2205 | + public function in_entity_map() { |
|
2206 | + if ($this->ID() && $this->get_model()->get_from_entity_map($this->ID()) === $this) { |
|
2207 | 2207 | //well, if we looked, did we find it in the entity map? |
2208 | 2208 | return TRUE; |
2209 | - }else{ |
|
2209 | + } else { |
|
2210 | 2210 | return FALSE; |
2211 | 2211 | } |
2212 | 2212 | } |
@@ -2217,21 +2217,21 @@ discard block |
||
2217 | 2217 | * @throws EE_Error if this model object isn't in the entity mapper (because then you should |
2218 | 2218 | * just use what's in the entity mapper and refresh it) and WP_DEBUG is TRUE |
2219 | 2219 | */ |
2220 | - public function refresh_from_db(){ |
|
2221 | - if( $this->ID() && $this->in_entity_map() ){ |
|
2222 | - $this->get_model()->refresh_entity_map_from_db( $this->ID() ); |
|
2223 | - }else{ |
|
2220 | + public function refresh_from_db() { |
|
2221 | + if ($this->ID() && $this->in_entity_map()) { |
|
2222 | + $this->get_model()->refresh_entity_map_from_db($this->ID()); |
|
2223 | + } else { |
|
2224 | 2224 | //if it doesn't have ID, you shouldn't be asking to refresh it from teh database (because its not in the database) |
2225 | 2225 | //if it has an ID but it's not in the map, and you're asking me to refresh it |
2226 | 2226 | //that's kinda dangerous. You should just use what's in the entity map, or add this to the entity map if there's |
2227 | 2227 | //absolutely nothing in it for this ID |
2228 | - if( WP_DEBUG ) { |
|
2228 | + if (WP_DEBUG) { |
|
2229 | 2229 | throw new EE_Error( |
2230 | 2230 | sprintf( |
2231 | - __( 'Trying to refresh a model object with ID "%1$s" that\'s not in the entity map? First off: you should put it in the entity map by calling %2$s. Second off, if you want what\'s in the database right now, you should just call %3$s yourself and discard this model object.', 'event_espresso' ), |
|
2231 | + __('Trying to refresh a model object with ID "%1$s" that\'s not in the entity map? First off: you should put it in the entity map by calling %2$s. Second off, if you want what\'s in the database right now, you should just call %3$s yourself and discard this model object.', 'event_espresso'), |
|
2232 | 2232 | $this->ID(), |
2233 | - get_class( $this->get_model() ) . '::instance()->add_to_entity_map()', |
|
2234 | - get_class( $this->get_model() ) . '::instance()->refresh_entity_map()' |
|
2233 | + get_class($this->get_model()).'::instance()->add_to_entity_map()', |
|
2234 | + get_class($this->get_model()).'::instance()->refresh_entity_map()' |
|
2235 | 2235 | ) |
2236 | 2236 | ); |
2237 | 2237 | } |
@@ -2243,8 +2243,8 @@ discard block |
||
2243 | 2243 | * (probably a bad assumption they have made, oh well) |
2244 | 2244 | * @return string |
2245 | 2245 | */ |
2246 | - public function __toString(){ |
|
2247 | - return sprintf( '%s (%s)', $this->name(), $this->ID() ); |
|
2246 | + public function __toString() { |
|
2247 | + return sprintf('%s (%s)', $this->name(), $this->ID()); |
|
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | /** |
@@ -2276,16 +2276,16 @@ discard block |
||
2276 | 2276 | * @return array |
2277 | 2277 | */ |
2278 | 2278 | public function __sleep() { |
2279 | - foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ) { |
|
2280 | - if( $relation_obj instanceof EE_Belongs_To_Relation ) { |
|
2281 | - $classname = 'EE_' . $this->get_model()->get_this_model_name(); |
|
2282 | - if( $this->get_one_from_cache( $relation_name ) instanceof $classname && |
|
2283 | - $this->get_one_from_cache( $relation_name )->ID() ) { |
|
2284 | - $this->clear_cache( $relation_name, $this->get_one_from_cache( $relation_name )->ID() ); |
|
2279 | + foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) { |
|
2280 | + if ($relation_obj instanceof EE_Belongs_To_Relation) { |
|
2281 | + $classname = 'EE_'.$this->get_model()->get_this_model_name(); |
|
2282 | + if ($this->get_one_from_cache($relation_name) instanceof $classname && |
|
2283 | + $this->get_one_from_cache($relation_name)->ID()) { |
|
2284 | + $this->clear_cache($relation_name, $this->get_one_from_cache($relation_name)->ID()); |
|
2285 | 2285 | } |
2286 | 2286 | } |
2287 | 2287 | } |
2288 | - return array_keys( get_object_vars( $this ) ); |
|
2288 | + return array_keys(get_object_vars($this)); |
|
2289 | 2289 | } |
2290 | 2290 | |
2291 | 2291 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param array $props_n_values incoming values |
30 | 30 | * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
31 | 31 | * used.) |
32 | - * @param array $date_formats incoming date_formats in an array where the first value is the |
|
32 | + * @param string[] $date_formats incoming date_formats in an array where the first value is the |
|
33 | 33 | * date_format and the second value is the time format |
34 | 34 | * @return EE_Payment |
35 | 35 | */ |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * get Payment Amount |
292 | 292 | * @access public |
293 | - * @return float |
|
293 | + * @return boolean |
|
294 | 294 | */ |
295 | 295 | public function amount() { |
296 | 296 | return $this->get( 'PAY_amount' ); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | /** |
370 | 370 | * Gets redirect_url |
371 | - * @return string |
|
371 | + * @return boolean |
|
372 | 372 | */ |
373 | 373 | function redirect_url() { |
374 | 374 | return $this->get('PAY_redirect_url'); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Gets redirect_args |
381 | - * @return array |
|
381 | + * @return boolean |
|
382 | 382 | */ |
383 | 383 | function redirect_args() { |
384 | 384 | return $this->get('PAY_redirect_args'); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | /** |
516 | 516 | * Gets all the extra meta info on this payment |
517 | 517 | * @param array $query_params like EEM_Base::get_all |
518 | - * @return EE_Extra_Meta |
|
518 | + * @return EE_Base_Class[] |
|
519 | 519 | */ |
520 | 520 | public function extra_meta( $query_params = array() ) { |
521 | 521 | return $this->get_many_related( 'Extra_Meta', $query_params ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @subpackage includes/classes/EE_Payment.class.php |
23 | 23 | * @author Brent Christensen |
24 | 24 | */ |
25 | -class EE_Payment extends EE_Base_Class implements EEI_Payment{ |
|
25 | +class EE_Payment extends EE_Base_Class implements EEI_Payment { |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * date_format and the second value is the time format |
34 | 34 | * @return EE_Payment |
35 | 35 | */ |
36 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
37 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
38 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
36 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
37 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
38 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * the website will be used. |
47 | 47 | * @return EE_Payment |
48 | 48 | */ |
49 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
50 | - return new self( $props_n_values, TRUE, $timezone ); |
|
49 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
50 | + return new self($props_n_values, TRUE, $timezone); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param int $TXN_ID |
60 | 60 | */ |
61 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
62 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
61 | + public function set_transaction_id($TXN_ID = 0) { |
|
62 | + $this->set('TXN_ID', $TXN_ID); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return EE_Transaction |
70 | 70 | */ |
71 | 71 | public function transaction() { |
72 | - return $this->get_first_related( 'Transaction' ); |
|
72 | + return $this->get_first_related('Transaction'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @access public |
81 | 81 | * @param string $STS_ID |
82 | 82 | */ |
83 | - public function set_status( $STS_ID = '' ) { |
|
84 | - $this->set( 'STS_ID', $STS_ID ); |
|
83 | + public function set_status($STS_ID = '') { |
|
84 | + $this->set('STS_ID', $STS_ID); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | * @access public |
93 | 93 | * @param int $timestamp |
94 | 94 | */ |
95 | - public function set_timestamp( $timestamp = 0 ) { |
|
96 | - $this->set( 'PAY_timestamp', $timestamp ); |
|
95 | + public function set_timestamp($timestamp = 0) { |
|
96 | + $this->set('PAY_timestamp', $timestamp); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @access public |
105 | 105 | * @param string $PAY_source |
106 | 106 | */ |
107 | - public function set_source( $PAY_source = '' ) { |
|
108 | - $this->set('PAY_source',$PAY_source); |
|
107 | + public function set_source($PAY_source = '') { |
|
108 | + $this->set('PAY_source', $PAY_source); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @access public |
117 | 117 | * @param float $amount |
118 | 118 | */ |
119 | - public function set_amount( $amount = 0.00 ) { |
|
120 | - $this->set( 'PAY_amount', $amount ); |
|
119 | + public function set_amount($amount = 0.00) { |
|
120 | + $this->set('PAY_amount', $amount); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @access public |
129 | 129 | * @param string $gateway_response |
130 | 130 | */ |
131 | - public function set_gateway_response( $gateway_response = '' ) { |
|
132 | - $this->set( 'PAY_gateway_response', $gateway_response ); |
|
131 | + public function set_gateway_response($gateway_response = '') { |
|
132 | + $this->set('PAY_gateway_response', $gateway_response); |
|
133 | 133 | } |
134 | 134 | /** |
135 | 135 | * Returns the name of the paymetn method used on this payment (previously known merely as 'gateway') |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | * @deprecated |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function gateway(){ |
|
142 | - EE_Error::doing_it_wrong('EE_Payment::gateway', __( 'The method EE_Payment::gateway() has been deprecated. Consider instead using EE_Payment::payment_method()->name()', 'event_espresso' ), '4.6.0' ); |
|
143 | - if( $this->payment_method() ){ |
|
141 | + public function gateway() { |
|
142 | + EE_Error::doing_it_wrong('EE_Payment::gateway', __('The method EE_Payment::gateway() has been deprecated. Consider instead using EE_Payment::payment_method()->name()', 'event_espresso'), '4.6.0'); |
|
143 | + if ($this->payment_method()) { |
|
144 | 144 | return $this->payment_method()->name(); |
145 | - }else{ |
|
146 | - return __( 'Unknown', 'event_espresso' ); |
|
145 | + } else { |
|
146 | + return __('Unknown', 'event_espresso'); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @access public |
156 | 156 | * @param string $txn_id_chq_nmbr |
157 | 157 | */ |
158 | - public function set_txn_id_chq_nmbr( $txn_id_chq_nmbr = '' ) { |
|
159 | - $this->set( 'PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr ); |
|
158 | + public function set_txn_id_chq_nmbr($txn_id_chq_nmbr = '') { |
|
159 | + $this->set('PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @access public |
168 | 168 | * @param string $po_number |
169 | 169 | */ |
170 | - public function set_po_number( $po_number = '' ) { |
|
171 | - $this->set( 'PAY_po_number', $po_number ); |
|
170 | + public function set_po_number($po_number = '') { |
|
171 | + $this->set('PAY_po_number', $po_number); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @access public |
180 | 180 | * @param string $extra_accntng |
181 | 181 | */ |
182 | - public function set_extra_accntng( $extra_accntng = '' ) { |
|
183 | - $this->set( 'PAY_extra_accntng', $extra_accntng ); |
|
182 | + public function set_extra_accntng($extra_accntng = '') { |
|
183 | + $this->set('PAY_extra_accntng', $extra_accntng); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @access public |
192 | 192 | * @param bool $via_admin |
193 | 193 | */ |
194 | - public function set_payment_made_via_admin( $via_admin = FALSE ) { |
|
195 | - if($via_admin){ |
|
196 | - $this->set('PAY_source', EEM_Payment_Method::scope_admin); |
|
197 | - }else{ |
|
194 | + public function set_payment_made_via_admin($via_admin = FALSE) { |
|
195 | + if ($via_admin) { |
|
196 | + $this->set('PAY_source', EEM_Payment_Method::scope_admin); |
|
197 | + } else { |
|
198 | 198 | $this->set('PAY_source', EEM_Payment_Method::scope_cart); |
199 | 199 | } |
200 | 200 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | * @access public |
209 | 209 | * @param string $details |
210 | 210 | */ |
211 | - public function set_details( $details = '' ) { |
|
212 | - if ( is_array( $details ) ) { |
|
213 | - array_walk_recursive( $details, array( $this, '_strip_all_tags_within_array' )); |
|
211 | + public function set_details($details = '') { |
|
212 | + if (is_array($details)) { |
|
213 | + array_walk_recursive($details, array($this, '_strip_all_tags_within_array')); |
|
214 | 214 | } else { |
215 | - $details = wp_strip_all_tags( $details ); |
|
215 | + $details = wp_strip_all_tags($details); |
|
216 | 216 | } |
217 | - $this->set( 'PAY_details', $details ); |
|
217 | + $this->set('PAY_details', $details); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @access public |
241 | 241 | */ |
242 | 242 | public function TXN_ID() { |
243 | - return $this->get( 'TXN_ID' ); |
|
243 | + return $this->get('TXN_ID'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | * @param null $date_or_time |
272 | 272 | * @return string |
273 | 273 | */ |
274 | - public function timestamp( $dt_frmt = '', $tm_frmt = '', $date_or_time = NULL ) { |
|
275 | - return $this->get_datetime('PAY_timestamp', $dt_frmt, $tm_frmt, $date_or_time ); |
|
274 | + public function timestamp($dt_frmt = '', $tm_frmt = '', $date_or_time = NULL) { |
|
275 | + return $this->get_datetime('PAY_timestamp', $dt_frmt, $tm_frmt, $date_or_time); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @return float |
294 | 294 | */ |
295 | 295 | public function amount() { |
296 | - return $this->get( 'PAY_amount' ); |
|
296 | + return $this->get('PAY_amount'); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @return mixed |
303 | 303 | */ |
304 | 304 | public function amount_no_code() { |
305 | - return $this->get_pretty( 'PAY_amount', 'no_currency_code' ); |
|
305 | + return $this->get_pretty('PAY_amount', 'no_currency_code'); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @access public |
313 | 313 | */ |
314 | 314 | public function gateway_response() { |
315 | - return $this->get( 'PAY_gateway_response' ); |
|
315 | + return $this->get('PAY_gateway_response'); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @access public |
323 | 323 | */ |
324 | 324 | public function txn_id_chq_nmbr() { |
325 | - return $this->get( 'PAY_txn_id_chq_nmbr' ); |
|
325 | + return $this->get('PAY_txn_id_chq_nmbr'); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @access public |
333 | 333 | */ |
334 | 334 | public function po_number() { |
335 | - return $this->get( 'PAY_po_number' ); |
|
335 | + return $this->get('PAY_po_number'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @access public |
343 | 343 | */ |
344 | 344 | public function extra_accntng() { |
345 | - return $this->get( 'PAY_extra_accntng' ); |
|
345 | + return $this->get('PAY_extra_accntng'); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @access public |
363 | 363 | */ |
364 | 364 | public function details() { |
365 | - return $this->get( 'PAY_details' ); |
|
365 | + return $this->get('PAY_details'); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | * @param bool $show_icons |
392 | 392 | * @return void |
393 | 393 | */ |
394 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
395 | - echo $this->pretty_status( $show_icons ); |
|
394 | + public function e_pretty_status($show_icons = FALSE) { |
|
395 | + echo $this->pretty_status($show_icons); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | * @param bool $show_icons |
403 | 403 | * @return string |
404 | 404 | */ |
405 | - public function pretty_status( $show_icons = FALSE ) { |
|
406 | - $status = EEM_Status::instance()->localized_status( array( $this->STS_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
405 | + public function pretty_status($show_icons = FALSE) { |
|
406 | + $status = EEM_Status::instance()->localized_status(array($this->STS_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
407 | 407 | $icon = ''; |
408 | - switch ( $this->STS_ID() ) { |
|
408 | + switch ($this->STS_ID()) { |
|
409 | 409 | case EEM_Payment::status_id_approved: |
410 | 410 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
411 | 411 | break; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
420 | 420 | break; |
421 | 421 | } |
422 | - return $icon . $status[ $this->STS_ID() ]; |
|
422 | + return $icon.$status[$this->STS_ID()]; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @return boolean whether the payment is approved or not |
431 | 431 | */ |
432 | 432 | public function is_approved() { |
433 | - return $this->status_is( EEM_Payment::status_id_approved ); |
|
433 | + return $this->status_is(EEM_Payment::status_id_approved); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | * one of the status_id_* on the EEM_Payment model |
443 | 443 | * @return boolean whether the status of this payment equals the status id |
444 | 444 | */ |
445 | - protected function status_is( $STS_ID ) { |
|
446 | - if ( $STS_ID == $this->STS_ID() ) { |
|
445 | + protected function status_is($STS_ID) { |
|
446 | + if ($STS_ID == $this->STS_ID()) { |
|
447 | 447 | return TRUE; |
448 | 448 | } else { |
449 | 449 | return FALSE; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @return boolean whether the payment is pending or not |
458 | 458 | */ |
459 | 459 | public function is_pending() { |
460 | - return $this->status_is( EEM_Payment::status_id_pending ); |
|
460 | + return $this->status_is(EEM_Payment::status_id_pending); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @return boolean |
468 | 468 | */ |
469 | 469 | public function is_cancelled() { |
470 | - return $this->status_is( EEM_Payment::status_id_cancelled ); |
|
470 | + return $this->status_is(EEM_Payment::status_id_cancelled); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return boolean |
478 | 478 | */ |
479 | 479 | public function is_declined() { |
480 | - return $this->status_is( EEM_Payment::status_id_declined ); |
|
480 | + return $this->status_is(EEM_Payment::status_id_declined); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @return boolean |
488 | 488 | */ |
489 | 489 | public function is_failed() { |
490 | - return $this->status_is( EEM_Payment::status_id_failed ); |
|
490 | + return $this->status_is(EEM_Payment::status_id_failed); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | * @return EE_Status |
508 | 508 | */ |
509 | 509 | public function status_obj() { |
510 | - return $this->get_first_related( 'Status' ); |
|
510 | + return $this->get_first_related('Status'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * @param array $query_params like EEM_Base::get_all |
518 | 518 | * @return EE_Extra_Meta |
519 | 519 | */ |
520 | - public function extra_meta( $query_params = array() ) { |
|
521 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
520 | + public function extra_meta($query_params = array()) { |
|
521 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * offline ones, dont' create payments) |
530 | 530 | * @return EE_Payment_Method |
531 | 531 | */ |
532 | - function payment_method(){ |
|
532 | + function payment_method() { |
|
533 | 533 | return $this->get_first_related('Payment_Method'); |
534 | 534 | } |
535 | 535 | |
@@ -546,12 +546,12 @@ discard block |
||
546 | 546 | * @param string $inside_form_html |
547 | 547 | * @return string html |
548 | 548 | */ |
549 | - function redirect_form( $inside_form_html = NULL ) { |
|
549 | + function redirect_form($inside_form_html = NULL) { |
|
550 | 550 | $redirect_url = $this->redirect_url(); |
551 | - if ( ! empty( $redirect_url )) { |
|
551 | + if ( ! empty($redirect_url)) { |
|
552 | 552 | EE_Registry::instance()->load_helper('HTML'); |
553 | 553 | // what ? no inner form content? |
554 | - if( $inside_form_html === NULL ) { |
|
554 | + if ($inside_form_html === NULL) { |
|
555 | 555 | $inside_form_html = EEH_HTML::p( |
556 | 556 | sprintf( |
557 | 557 | __('If you are not automatically redirected to the payment website within 10 seconds... %1$s %2$s Click Here %3$s', 'event_espresso'), |
@@ -569,17 +569,17 @@ discard block |
||
569 | 569 | ); |
570 | 570 | //if it's a GET request, we need to remove all the GET params in the querystring |
571 | 571 | //and put them into the form instead |
572 | - if( $method == 'GET' ) { |
|
573 | - $querystring = parse_url( $redirect_url, PHP_URL_QUERY ); |
|
572 | + if ($method == 'GET') { |
|
573 | + $querystring = parse_url($redirect_url, PHP_URL_QUERY); |
|
574 | 574 | $get_params = null; |
575 | - parse_str( $querystring, $get_params ); |
|
576 | - $inside_form_html .= $this->_args_as_inputs( $get_params ); |
|
577 | - $redirect_url = str_replace( '?' . $querystring, '', $redirect_url ); |
|
575 | + parse_str($querystring, $get_params); |
|
576 | + $inside_form_html .= $this->_args_as_inputs($get_params); |
|
577 | + $redirect_url = str_replace('?'.$querystring, '', $redirect_url); |
|
578 | 578 | } |
579 | - $form = EEH_HTML::nl(1) . '<form method="' . $method . '" name="gateway_form" action="' . $redirect_url . '">'; |
|
580 | - $form .= EEH_HTML::nl(1) . $this->redirect_args_as_inputs(); |
|
579 | + $form = EEH_HTML::nl(1).'<form method="'.$method.'" name="gateway_form" action="'.$redirect_url.'">'; |
|
580 | + $form .= EEH_HTML::nl(1).$this->redirect_args_as_inputs(); |
|
581 | 581 | $form .= $inside_form_html; |
582 | - $form .= EEH_HTML::nl(-1) . '</form>' . EEH_HTML::nl(-1); |
|
582 | + $form .= EEH_HTML::nl(-1).'</form>'.EEH_HTML::nl(-1); |
|
583 | 583 | return $form; |
584 | 584 | } else { |
585 | 585 | return NULL; |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * and returns the html as a string |
595 | 595 | * @return string |
596 | 596 | */ |
597 | - function redirect_args_as_inputs(){ |
|
598 | - return $this->_args_as_inputs( $this->redirect_args() ); |
|
597 | + function redirect_args_as_inputs() { |
|
598 | + return $this->_args_as_inputs($this->redirect_args()); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
@@ -604,12 +604,12 @@ discard block |
||
604 | 604 | * @param array $args key-value pairs |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - protected function _args_as_inputs( $args ) { |
|
607 | + protected function _args_as_inputs($args) { |
|
608 | 608 | $html = ''; |
609 | - if( $args !== NULL && is_array( $args )) { |
|
609 | + if ($args !== NULL && is_array($args)) { |
|
610 | 610 | EE_Registry::instance()->load_helper('HTML'); |
611 | - foreach( $args as $name => $value){ |
|
612 | - $html .= EEH_HTML::nl(0) . '<input type="hidden" name="' . $name . '" value="' . esc_attr( $value ) . '"/>'; |
|
611 | + foreach ($args as $name => $value) { |
|
612 | + $html .= EEH_HTML::nl(0).'<input type="hidden" name="'.$name.'" value="'.esc_attr($value).'"/>'; |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | return $html; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * object itself) |
625 | 625 | * @return string for the currency code |
626 | 626 | */ |
627 | - public function currency_code(){ |
|
627 | + public function currency_code() { |
|
628 | 628 | return EE_Config::instance()->currency->code; |
629 | 629 | } |
630 | 630 | |
@@ -638,14 +638,14 @@ discard block |
||
638 | 638 | * @access private |
639 | 639 | * @param mixed $item |
640 | 640 | */ |
641 | - private function _strip_all_tags_within_array( &$item ) { |
|
642 | - if( is_object( $item ) ) { |
|
641 | + private function _strip_all_tags_within_array(&$item) { |
|
642 | + if (is_object($item)) { |
|
643 | 643 | $item = (array) $item; |
644 | 644 | } |
645 | - if( is_array( $item ) ){ |
|
646 | - array_walk_recursive( $item, array( $this, '_strip_all_tags_within_array' ) ); |
|
647 | - }else{ |
|
648 | - $item = wp_strip_all_tags( $item ); |
|
645 | + if (is_array($item)) { |
|
646 | + array_walk_recursive($item, array($this, '_strip_all_tags_within_array')); |
|
647 | + } else { |
|
648 | + $item = wp_strip_all_tags($item); |
|
649 | 649 | } |
650 | 650 | } |
651 | 651 | |
@@ -654,13 +654,13 @@ discard block |
||
654 | 654 | * is approved and was created during this request). False otherwise. |
655 | 655 | * @return boolean |
656 | 656 | */ |
657 | - public function just_approved(){ |
|
658 | - EE_Registry::instance()->load_helper( 'Array' ); |
|
659 | - $original_status =EEH_Array::is_set( $this->_props_n_values_provided_in_constructor, 'STS_ID', $this->get_model()->field_settings_for( 'STS_ID' )->get_default_value() ); |
|
657 | + public function just_approved() { |
|
658 | + EE_Registry::instance()->load_helper('Array'); |
|
659 | + $original_status = EEH_Array::is_set($this->_props_n_values_provided_in_constructor, 'STS_ID', $this->get_model()->field_settings_for('STS_ID')->get_default_value()); |
|
660 | 660 | $current_status = $this->status(); |
661 | - if( $original_status !== EEM_Payment::status_id_approved && $current_status === EEM_Payment::status_id_approved ){ |
|
661 | + if ($original_status !== EEM_Payment::status_id_approved && $current_status === EEM_Payment::status_id_approved) { |
|
662 | 662 | return TRUE; |
663 | - }else{ |
|
663 | + } else { |
|
664 | 664 | return FALSE; |
665 | 665 | } |
666 | 666 | } |
@@ -672,11 +672,11 @@ discard block |
||
672 | 672 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
673 | 673 | * @return mixed |
674 | 674 | */ |
675 | - public function get_pretty($field_name, $extra_cache_ref = NULL){ |
|
676 | - if( $field_name == 'PAY_gateway' ){ |
|
675 | + public function get_pretty($field_name, $extra_cache_ref = NULL) { |
|
676 | + if ($field_name == 'PAY_gateway') { |
|
677 | 677 | return $this->gateway(); |
678 | 678 | } |
679 | - return $this->_get_cached_property( $field_name, TRUE, $extra_cache_ref ); |
|
679 | + return $this->_get_cached_property($field_name, TRUE, $extra_cache_ref); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
@@ -686,8 +686,8 @@ discard block |
||
686 | 686 | * @param array $query_params like EEM_Base::get_all |
687 | 687 | * @return EE_Registration_Payment[] |
688 | 688 | */ |
689 | - public function registration_payments( $query_params = array() ) { |
|
690 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
689 | + public function registration_payments($query_params = array()) { |
|
690 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 |