@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEM_Change_Log extends EEM_Base{ |
|
28 | +class EEM_Change_Log extends EEM_Base { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * the related object was created log type |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | * @access protected |
69 | 69 | * @return EEM_Change_Log |
70 | 70 | */ |
71 | - protected function __construct( $timezone = null ){ |
|
71 | + protected function __construct($timezone = null) { |
|
72 | 72 | global $current_user; |
73 | - $this->singular_item = __('Log','event_espresso'); |
|
74 | - $this->plural_item = __('Logs','event_espresso'); |
|
73 | + $this->singular_item = __('Log', 'event_espresso'); |
|
74 | + $this->plural_item = __('Logs', 'event_espresso'); |
|
75 | 75 | $this->_tables = array( |
76 | 76 | 'Log'=> new EE_Primary_Table('esp_log', 'LOG_ID') |
77 | 77 | ); |
78 | 78 | $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models); |
79 | 79 | $this->_fields = array( |
80 | 80 | 'Log'=>array( |
81 | - 'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID','event_espresso')), |
|
82 | - 'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now ), |
|
83 | - 'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL,$models_this_can_attach_to), |
|
81 | + 'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID', 'event_espresso')), |
|
82 | + 'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now), |
|
83 | + 'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL, $models_this_can_attach_to), |
|
84 | 84 | 'OBJ_type'=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Object Type", 'event_espresso'), true, NULL, $models_this_can_attach_to), |
85 | 85 | 'LOG_type'=>new EE_Enum_Text_Field('LOG_type', __("Type of log entry", "event_espresso"), false, self::type_debug, |
86 | 86 | array( |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | self::type_gateway=> __("Gateway Interaction (IPN or Direct Payment)", 'event_espresso'), |
93 | 93 | )), |
94 | 94 | 'LOG_message'=>new EE_Maybe_Serialized_Text_Field('LOG_message', __("Log Message (body)", 'event_espresso'), true), |
95 | - 'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true ), |
|
95 | + 'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true), |
|
96 | 96 | |
97 | 97 | )); |
98 | 98 | $this->_model_relations = array(); |
99 | - foreach($models_this_can_attach_to as $model){ |
|
100 | - if( $model == 'WP_User' ){ |
|
101 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Relation(); |
|
102 | - }elseif( $model != 'Change_Log' ) { |
|
99 | + foreach ($models_this_can_attach_to as $model) { |
|
100 | + if ($model == 'WP_User') { |
|
101 | + $this->_model_relations[$model] = new EE_Belongs_To_Relation(); |
|
102 | + }elseif ($model != 'Change_Log') { |
|
103 | 103 | $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | //use completely custom caps for this |
107 | 107 | $this->_cap_restriction_generators = false; |
108 | 108 | //caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing |
109 | - foreach( $this->_cap_contexts_to_cap_action_map as $cap_context => $action ) { |
|
110 | - $this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] = new EE_Return_None_Where_Conditions(); |
|
109 | + foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) { |
|
110 | + $this->_cap_restrictions[$cap_context][EE_Restriction_Generator_Base::get_default_restrictions_cap()] = new EE_Return_None_Where_Conditions(); |
|
111 | 111 | } |
112 | - parent::__construct( $timezone ); |
|
112 | + parent::__construct($timezone); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | * @param EE_Base_Class $related_model_obj |
120 | 120 | * @return EE_Change_Log |
121 | 121 | */ |
122 | - public function log($log_type,$message,$related_model_obj){ |
|
123 | - if($related_model_obj instanceof EE_Base_Class){ |
|
122 | + public function log($log_type, $message, $related_model_obj) { |
|
123 | + if ($related_model_obj instanceof EE_Base_Class) { |
|
124 | 124 | $obj_id = $related_model_obj->ID(); |
125 | 125 | $obj_type = $related_model_obj->get_model()->get_this_model_name(); |
126 | - }else{ |
|
126 | + } else { |
|
127 | 127 | $obj_id = NULL; |
128 | 128 | $obj_type = NULL; |
129 | 129 | } |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @throws EE_Error |
148 | 148 | * @return EE_Change_Log |
149 | 149 | */ |
150 | - public function gateway_log( $message, $related_obj_id, $related_obj_type ){ |
|
151 | - if( ! EE_Registry::instance()->is_model_name($related_obj_type)){ |
|
152 | - throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"),$related_obj_type)); |
|
150 | + public function gateway_log($message, $related_obj_id, $related_obj_type) { |
|
151 | + if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) { |
|
152 | + throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type)); |
|
153 | 153 | } |
154 | 154 | $log = EE_Change_Log::new_instance(array( |
155 | 155 | 'LOG_type'=>EEM_Change_Log::type_gateway, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param array $query_params @see EEM_Base::get_all |
169 | 169 | * @return array of arrays |
170 | 170 | */ |
171 | - public function get_all_efficiently($query_params){ |
|
171 | + public function get_all_efficiently($query_params) { |
|
172 | 172 | return $this->_get_all_wpdb_results($query_params); |
173 | 173 | } |
174 | 174 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -21,60 +21,60 @@ discard block |
||
21 | 21 | * Please instead use the EEM_Attendee::system_question_* constants |
22 | 22 | * @deprecated |
23 | 23 | */ |
24 | - const fname_question_id=1; |
|
24 | + const fname_question_id = 1; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @deprecated |
28 | 28 | */ |
29 | - const lname_question_id=2; |
|
29 | + const lname_question_id = 2; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @deprecated |
34 | 34 | */ |
35 | - const email_question_id=3; |
|
35 | + const email_question_id = 3; |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @deprecated |
40 | 40 | */ |
41 | - const address_question_id=4; |
|
41 | + const address_question_id = 4; |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @deprecated |
46 | 46 | */ |
47 | - const address2_question_id=5; |
|
47 | + const address2_question_id = 5; |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @deprecated |
52 | 52 | */ |
53 | - const city_question_id=6; |
|
53 | + const city_question_id = 6; |
|
54 | 54 | |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @deprecated |
58 | 58 | */ |
59 | - const state_question_id=7; |
|
59 | + const state_question_id = 7; |
|
60 | 60 | |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @deprecated |
64 | 64 | */ |
65 | - const country_question_id=8; |
|
65 | + const country_question_id = 8; |
|
66 | 66 | |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @deprecated |
70 | 70 | */ |
71 | - const zip_question_id=9; |
|
71 | + const zip_question_id = 9; |
|
72 | 72 | |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @deprecated |
76 | 76 | */ |
77 | - const phone_question_id=10; |
|
77 | + const phone_question_id = 10; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * When looking for questions that correspond to attendee fields, |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * @access protected |
120 | 120 | * @param null $timezone |
121 | 121 | */ |
122 | - protected function __construct( $timezone = NULL ) { |
|
123 | - $this->singular_item = __('Attendee','event_espresso'); |
|
124 | - $this->plural_item = __('Attendees','event_espresso'); |
|
122 | + protected function __construct($timezone = NULL) { |
|
123 | + $this->singular_item = __('Attendee', 'event_espresso'); |
|
124 | + $this->plural_item = __('Attendees', 'event_espresso'); |
|
125 | 125 | $this->_tables = array( |
126 | 126 | 'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'), |
127 | 127 | 'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID') |
@@ -132,38 +132,38 @@ discard block |
||
132 | 132 | 'ATT_full_name'=>new EE_Plain_Text_Field('post_title', __("Attendee Full Name", "event_espresso"), false, __("Unknown", "event_espresso")), |
133 | 133 | 'ATT_bio'=>new EE_Post_Content_Field('post_content', __("Attendee Biography", "event_espresso"), false, __("No Biography Provided", "event_espresso")), |
134 | 134 | 'ATT_slug'=>new EE_Slug_Field('post_name', __("Attendee URL Slug", "event_espresso"), false), |
135 | - 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now ), |
|
135 | + 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now), |
|
136 | 136 | 'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")), |
137 | - 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now ), |
|
138 | - 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ), |
|
137 | + 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now), |
|
138 | + 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false), |
|
139 | 139 | 'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0), |
140 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
140 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
141 | 141 | 'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish') |
142 | 142 | ), |
143 | 143 | 'Attendee_Meta'=>array( |
144 | - 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false), |
|
144 | + 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false), |
|
145 | 145 | 'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false), |
146 | - 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''), |
|
147 | - 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''), |
|
148 | - 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''), |
|
149 | - 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''), |
|
150 | - 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''), |
|
151 | - 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'), |
|
152 | - 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'), |
|
153 | - 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''), |
|
154 | - 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''), |
|
155 | - 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '') |
|
146 | + 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''), |
|
147 | + 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''), |
|
148 | + 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''), |
|
149 | + 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''), |
|
150 | + 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''), |
|
151 | + 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'), |
|
152 | + 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'), |
|
153 | + 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''), |
|
154 | + 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''), |
|
155 | + 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '') |
|
156 | 156 | )); |
157 | 157 | $this->_model_relations = array( |
158 | 158 | 'Registration'=>new EE_Has_Many_Relation(), |
159 | 159 | 'State'=>new EE_Belongs_To_Relation(), |
160 | 160 | 'Country'=>new EE_Belongs_To_Relation(), |
161 | - 'Event'=>new EE_HABTM_Relation('Registration', FALSE ), |
|
161 | + 'Event'=>new EE_HABTM_Relation('Registration', FALSE), |
|
162 | 162 | 'WP_User' => new EE_Belongs_To_Relation(), |
163 | - 'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them. |
|
163 | + 'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them. |
|
164 | 164 | ); |
165 | 165 | $this->_caps_slug = 'contacts'; |
166 | - parent::__construct( $timezone ); |
|
166 | + parent::__construct($timezone); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param string $system_question_string |
174 | 174 | * @return string|null if not found |
175 | 175 | */ |
176 | - public function get_attendee_field_for_system_question( $system_question_string ) { |
|
177 | - return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null; |
|
176 | + public function get_attendee_field_for_system_question($system_question_string) { |
|
177 | + return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID |
186 | 186 | * @return EE_Attendee[] |
187 | 187 | */ |
188 | - public function get_attendees_for_transaction( $transaction_id_or_obj ){ |
|
189 | - return $this->get_all( array( array( |
|
188 | + public function get_attendees_for_transaction($transaction_id_or_obj) { |
|
189 | + return $this->get_all(array(array( |
|
190 | 190 | 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj |
191 | 191 | ))); |
192 | 192 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * @return mixed array on success, FALSE on fail |
202 | 202 | * @deprecated |
203 | 203 | */ |
204 | - public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
|
204 | + public function get_attendee_by_ID($ATT_ID = FALSE) { |
|
205 | 205 | // retrieve a particular EE_Attendee |
206 | - return $this->get_one_by_ID( $ATT_ID ); |
|
206 | + return $this->get_one_by_ID($ATT_ID); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | * @param array $where_cols_n_values |
217 | 217 | * @return mixed array on success, FALSE on fail |
218 | 218 | */ |
219 | - public function get_attendee( $where_cols_n_values = array() ) { |
|
219 | + public function get_attendee($where_cols_n_values = array()) { |
|
220 | 220 | |
221 | - if ( empty( $where_cols_n_values )) { |
|
221 | + if (empty($where_cols_n_values)) { |
|
222 | 222 | return FALSE; |
223 | 223 | } |
224 | - $attendee = $this->get_all( array($where_cols_n_values )); |
|
225 | - if ( ! empty( $attendee )) { |
|
226 | - return array_shift( $attendee ); |
|
224 | + $attendee = $this->get_all(array($where_cols_n_values)); |
|
225 | + if ( ! empty($attendee)) { |
|
226 | + return array_shift($attendee); |
|
227 | 227 | } else { |
228 | 228 | return FALSE; |
229 | 229 | } |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | * @param array $where_cols_n_values |
240 | 240 | * @return bool|mixed |
241 | 241 | */ |
242 | - public function find_existing_attendee( $where_cols_n_values = NULL ) { |
|
242 | + public function find_existing_attendee($where_cols_n_values = NULL) { |
|
243 | 243 | // search by combo of first and last names plus the email address |
244 | - $attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email ); |
|
244 | + $attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email); |
|
245 | 245 | // no search params means attendee object already exists. |
246 | - $where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys; |
|
246 | + $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys; |
|
247 | 247 | $valid_data = TRUE; |
248 | 248 | // check for required values |
249 | - $valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE; |
|
250 | - $valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE; |
|
251 | - $valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE; |
|
249 | + $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE; |
|
250 | + $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE; |
|
251 | + $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE; |
|
252 | 252 | |
253 | - if ( $valid_data ) { |
|
254 | - $attendee = $this->get_attendee( $where_cols_n_values ); |
|
255 | - if ( $attendee instanceof EE_Attendee ) { |
|
253 | + if ($valid_data) { |
|
254 | + $attendee = $this->get_attendee($where_cols_n_values); |
|
255 | + if ($attendee instanceof EE_Attendee) { |
|
256 | 256 | return $attendee; |
257 | 257 | } |
258 | 258 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | * @param array $ids array of EE_Registration ids |
271 | 271 | * @return EE_Attendee[] |
272 | 272 | */ |
273 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
273 | + public function get_array_of_contacts_from_reg_ids($ids) { |
|
274 | 274 | $ids = (array) $ids; |
275 | 275 | $_where = array( |
276 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
276 | + 'Registration.REG_ID' => array('in', $ids) |
|
277 | 277 | ); |
278 | - return $this->get_all( array( $_where ) ); |
|
278 | + return $this->get_all(array($_where)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * @param \EE_Registry $Registry |
89 | 89 | * @return \EE_System |
90 | 90 | */ |
91 | - public static function instance( EE_Registry $Registry = null ) { |
|
91 | + public static function instance(EE_Registry $Registry = null) { |
|
92 | 92 | // check if class object is instantiated |
93 | - if ( ! self::$_instance instanceof EE_System ) { |
|
94 | - self::$_instance = new self( $Registry ); |
|
93 | + if ( ! self::$_instance instanceof EE_System) { |
|
94 | + self::$_instance = new self($Registry); |
|
95 | 95 | } |
96 | 96 | return self::$_instance; |
97 | 97 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | * resets the instance and returns it |
102 | 102 | * @return EE_System |
103 | 103 | */ |
104 | - public static function reset(){ |
|
104 | + public static function reset() { |
|
105 | 105 | self::$_instance->_req_type = NULL; |
106 | 106 | |
107 | 107 | //make sure none of the old hooks are left hanging around |
108 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
108 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
109 | 109 | |
110 | 110 | //we need to reset the migration manager in order for it to detect DMSs properly |
111 | 111 | EE_Data_Migration_Manager::reset(); |
@@ -125,28 +125,28 @@ discard block |
||
125 | 125 | * @access private |
126 | 126 | * @param \EE_Registry $Registry |
127 | 127 | */ |
128 | - private function __construct( EE_Registry $Registry ) { |
|
128 | + private function __construct(EE_Registry $Registry) { |
|
129 | 129 | $this->registry = $Registry; |
130 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
130 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
131 | 131 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
132 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
132 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
133 | 133 | // when an ee addon is activated, we want to call the core hook(s) again |
134 | 134 | // because the newly-activated addon didn't get a chance to run at all |
135 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
135 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
136 | 136 | // detect whether install or upgrade |
137 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
137 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
138 | 138 | // load EE_Config, EE_Textdomain, etc |
139 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
139 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
140 | 140 | // load EE_Config, EE_Textdomain, etc |
141 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
141 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
142 | 142 | // you wanna get going? I wanna get going... let's get going! |
143 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
143 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
144 | 144 | //other housekeeping |
145 | 145 | //exclude EE critical pages from wp_list_pages |
146 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
146 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
147 | 147 | // ALL EE Addons should use the following hook point to attach their initial setup too |
148 | 148 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
149 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
149 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -166,30 +166,30 @@ discard block |
||
166 | 166 | public function load_espresso_addons() { |
167 | 167 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
168 | 168 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
169 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
169 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
170 | 170 | //load and setup EE_Capabilities |
171 | - $this->registry->load_core( 'Capabilities' ); |
|
171 | + $this->registry->load_core('Capabilities'); |
|
172 | 172 | //caps need to be initialized on every request so that capability maps are set. |
173 | 173 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
174 | 174 | $this->registry->CAP->init_caps(); |
175 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
175 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
176 | 176 | //if the WP API basic auth plugin isn't already loaded, load it now. |
177 | 177 | //We want it for mobile apps. Just include the entire plugin |
178 | 178 | //also, don't load the basic auth when a plugin is getting activated, because |
179 | 179 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
180 | 180 | //and causes a fatal error |
181 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
182 | - && ! function_exists( 'json_basic_auth_error' ) |
|
181 | + if ( ! function_exists('json_basic_auth_handler') |
|
182 | + && ! function_exists('json_basic_auth_error') |
|
183 | 183 | && ! ( |
184 | - isset( $_GET[ 'action'] ) |
|
185 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
184 | + isset($_GET['action']) |
|
185 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
186 | 186 | ) |
187 | 187 | && ! ( |
188 | - isset( $_GET['activate' ] ) |
|
189 | - && $_GET['activate' ] === 'true' |
|
188 | + isset($_GET['activate']) |
|
189 | + && $_GET['activate'] === 'true' |
|
190 | 190 | ) |
191 | 191 | ) { |
192 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
192 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @access public |
206 | 206 | * @return void |
207 | 207 | */ |
208 | - public function detect_activations_or_upgrades(){ |
|
208 | + public function detect_activations_or_upgrades() { |
|
209 | 209 | //first off: let's make sure to handle core |
210 | 210 | $this->detect_if_activation_or_upgrade(); |
211 | - foreach($this->registry->addons as $addon){ |
|
211 | + foreach ($this->registry->addons as $addon) { |
|
212 | 212 | //detect teh request type for that addon |
213 | 213 | $addon->detect_activation_or_upgrade(); |
214 | 214 | } |
@@ -229,41 +229,41 @@ discard block |
||
229 | 229 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
230 | 230 | |
231 | 231 | // load M-Mode class |
232 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
232 | + $this->registry->load_core('Maintenance_Mode'); |
|
233 | 233 | // check if db has been updated, or if its a brand-new installation |
234 | 234 | |
235 | 235 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
236 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
236 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
237 | 237 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
238 | 238 | |
239 | - switch($request_type){ |
|
239 | + switch ($request_type) { |
|
240 | 240 | case EE_System::req_type_new_activation: |
241 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
242 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
241 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
242 | + $this->_handle_core_version_change($espresso_db_update); |
|
243 | 243 | break; |
244 | 244 | case EE_System::req_type_reactivation: |
245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
246 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
246 | + $this->_handle_core_version_change($espresso_db_update); |
|
247 | 247 | break; |
248 | 248 | case EE_System::req_type_upgrade: |
249 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
249 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
250 | 250 | //migrations may be required now that we've upgraded |
251 | 251 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
252 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
252 | + $this->_handle_core_version_change($espresso_db_update); |
|
253 | 253 | // echo "done upgrade";die; |
254 | 254 | break; |
255 | 255 | case EE_System::req_type_downgrade: |
256 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
256 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
257 | 257 | //its possible migrations are no longer required |
258 | 258 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
259 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
259 | + $this->_handle_core_version_change($espresso_db_update); |
|
260 | 260 | break; |
261 | 261 | case EE_System::req_type_normal: |
262 | 262 | default: |
263 | 263 | // $this->_maybe_redirect_to_ee_about(); |
264 | 264 | break; |
265 | 265 | } |
266 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
266 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * initializing the database later during the request |
272 | 272 | * @param array $espresso_db_update |
273 | 273 | */ |
274 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
275 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
274 | + protected function _handle_core_version_change($espresso_db_update) { |
|
275 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
276 | 276 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
277 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
277 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -289,44 +289,44 @@ discard block |
||
289 | 289 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
290 | 290 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
291 | 291 | */ |
292 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
293 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
294 | - if( ! $espresso_db_update){ |
|
295 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
292 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
293 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
294 | + if ( ! $espresso_db_update) { |
|
295 | + $espresso_db_update = get_option('espresso_db_update'); |
|
296 | 296 | } |
297 | 297 | // check that option is an array |
298 | - if( ! is_array( $espresso_db_update )) { |
|
298 | + if ( ! is_array($espresso_db_update)) { |
|
299 | 299 | // if option is FALSE, then it never existed |
300 | - if ( $espresso_db_update === FALSE ) { |
|
300 | + if ($espresso_db_update === FALSE) { |
|
301 | 301 | // make $espresso_db_update an array and save option with autoload OFF |
302 | - $espresso_db_update = array(); |
|
303 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
302 | + $espresso_db_update = array(); |
|
303 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
304 | 304 | } else { |
305 | 305 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
306 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
307 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
306 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
307 | + update_option('espresso_db_update', $espresso_db_update); |
|
308 | 308 | } |
309 | - }else{ |
|
309 | + } else { |
|
310 | 310 | $corrected_db_update = array(); |
311 | 311 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
312 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
313 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
312 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
313 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
314 | 314 | //the key is an int, and the value IS NOT an array |
315 | 315 | //so it must be numerically-indexed, where values are versions installed... |
316 | 316 | //fix it! |
317 | 317 | $version_string = $should_be_array; |
318 | 318 | $corrected_db_update[$version_string] = array('unknown-date'); |
319 | - }else{ |
|
319 | + } else { |
|
320 | 320 | //ok it checks out |
321 | 321 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | $espresso_db_update = $corrected_db_update; |
325 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
325 | + update_option('espresso_db_update', $espresso_db_update); |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | |
329 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
329 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
330 | 330 | return $espresso_db_update; |
331 | 331 | } |
332 | 332 | |
@@ -346,34 +346,34 @@ discard block |
||
346 | 346 | * so we prefer to only do it when necessary |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
349 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
350 | 350 | $request_type = $this->detect_req_type(); |
351 | 351 | //only initialize system if we're not in maintenance mode. |
352 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
353 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
352 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
353 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
354 | 354 | |
355 | - if( $verify_schema ) { |
|
355 | + if ($verify_schema) { |
|
356 | 356 | EEH_Activation::initialize_db_and_folders(); |
357 | 357 | } |
358 | 358 | EEH_Activation::initialize_db_content(); |
359 | 359 | EEH_Activation::system_initialization(); |
360 | - if( $initialize_addons_too ) { |
|
360 | + if ($initialize_addons_too) { |
|
361 | 361 | $this->initialize_addons(); |
362 | 362 | } |
363 | - }else{ |
|
364 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
363 | + } else { |
|
364 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
365 | 365 | } |
366 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
367 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
366 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
367 | + add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Initializes the db for all registered addons |
373 | 373 | */ |
374 | - public function initialize_addons(){ |
|
374 | + public function initialize_addons() { |
|
375 | 375 | //foreach registered addon, make sure its db is up-to-date too |
376 | - foreach($this->registry->addons as $addon){ |
|
376 | + foreach ($this->registry->addons as $addon) { |
|
377 | 377 | $addon->initialize_db_if_no_migrations_required(); |
378 | 378 | } |
379 | 379 | } |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param string $current_version_to_add version to be added to the version history |
386 | 386 | * @return boolean success as to whether or not this option was changed |
387 | 387 | */ |
388 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
389 | - if( ! $version_history ) { |
|
388 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
389 | + if ( ! $version_history) { |
|
390 | 390 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
391 | 391 | } |
392 | - if( $current_version_to_add == NULL){ |
|
392 | + if ($current_version_to_add == NULL) { |
|
393 | 393 | $current_version_to_add = espresso_version(); |
394 | 394 | } |
395 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
395 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
396 | 396 | // re-save |
397 | - return update_option( 'espresso_db_update', $version_history ); |
|
397 | + return update_option('espresso_db_update', $version_history); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * but still know if this is a new install or not |
412 | 412 | * @return int one of the constants on EE_System::req_type_ |
413 | 413 | */ |
414 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
415 | - if ( $this->_req_type === NULL ){ |
|
416 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
414 | + public function detect_req_type($espresso_db_update = NULL) { |
|
415 | + if ($this->_req_type === NULL) { |
|
416 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
418 | 418 | } |
419 | 419 | return $this->_req_type; |
420 | 420 | } |
@@ -430,39 +430,39 @@ discard block |
||
430 | 430 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
431 | 431 | * @return int one of the constants on EE_System::req_type_* |
432 | 432 | */ |
433 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
434 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
435 | - if( $activation_history_for_addon ){ |
|
433 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
434 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
435 | + if ($activation_history_for_addon) { |
|
436 | 436 | //it exists, so this isn't a completely new install |
437 | 437 | //check if this version already in that list of previously installed versions |
438 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
438 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
439 | 439 | //it a version we haven't seen before |
440 | - if( $version_is_higher === 1 ){ |
|
440 | + if ($version_is_higher === 1) { |
|
441 | 441 | $req_type = EE_System::req_type_upgrade; |
442 | - }else{ |
|
442 | + } else { |
|
443 | 443 | $req_type = EE_System::req_type_downgrade; |
444 | 444 | } |
445 | - delete_option( $activation_indicator_option_name ); |
|
445 | + delete_option($activation_indicator_option_name); |
|
446 | 446 | } else { |
447 | 447 | // its not an update. maybe a reactivation? |
448 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
449 | - if ( $version_is_higher === -1 ){ |
|
448 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
449 | + if ($version_is_higher === -1) { |
|
450 | 450 | $req_type = EE_System::req_type_downgrade; |
451 | - }elseif( $version_is_higher === 0 ){ |
|
451 | + }elseif ($version_is_higher === 0) { |
|
452 | 452 | //we've seen this version before, but it's an activation. must be a reactivation |
453 | 453 | $req_type = EE_System::req_type_reactivation; |
454 | - }else{//$version_is_higher === 1 |
|
454 | + } else {//$version_is_higher === 1 |
|
455 | 455 | $req_type = EE_System::req_type_upgrade; |
456 | 456 | } |
457 | - delete_option( $activation_indicator_option_name ); |
|
457 | + delete_option($activation_indicator_option_name); |
|
458 | 458 | } else { |
459 | 459 | //we've seen this version before and the activation indicate doesn't show it was just activated |
460 | - if ( $version_is_higher === -1 ){ |
|
460 | + if ($version_is_higher === -1) { |
|
461 | 461 | $req_type = EE_System::req_type_downgrade; |
462 | - }elseif( $version_is_higher === 0 ){ |
|
462 | + }elseif ($version_is_higher === 0) { |
|
463 | 463 | //we've seen this version before and it's not an activation. its normal request |
464 | 464 | $req_type = EE_System::req_type_normal; |
465 | - }else{//$version_is_higher === 1 |
|
465 | + } else {//$version_is_higher === 1 |
|
466 | 466 | $req_type = EE_System::req_type_upgrade; |
467 | 467 | } |
468 | 468 | } |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | } else { |
471 | 471 | //brand new install |
472 | 472 | $req_type = EE_System::req_type_new_activation; |
473 | - delete_option( $activation_indicator_option_name ); |
|
473 | + delete_option($activation_indicator_option_name); |
|
474 | 474 | } |
475 | 475 | return $req_type; |
476 | 476 | } |
@@ -488,30 +488,30 @@ discard block |
||
488 | 488 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
489 | 489 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
490 | 490 | */ |
491 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
491 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
492 | 492 | //find the most recently-activated version |
493 | 493 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
494 | 494 | $most_recently_active_version = '0.0.0.dev.000'; |
495 | - if( is_array( $activation_history_for_addon ) ){ |
|
496 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
495 | + if (is_array($activation_history_for_addon)) { |
|
496 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
497 | 497 | //check there is a record of when this version was activated. Otherwise, |
498 | 498 | //mark it as unknown |
499 | - if( ! $times_activated ){ |
|
500 | - $times_activated = array( 'unknown-date'); |
|
499 | + if ( ! $times_activated) { |
|
500 | + $times_activated = array('unknown-date'); |
|
501 | 501 | } |
502 | - if( is_string( $times_activated ) ){ |
|
503 | - $times_activated = array( $times_activated ); |
|
502 | + if (is_string($times_activated)) { |
|
503 | + $times_activated = array($times_activated); |
|
504 | 504 | } |
505 | - foreach( $times_activated as $an_activation ){ |
|
506 | - if( $an_activation != 'unknown-date' && |
|
507 | - $an_activation > $most_recently_active_version_activation ){ |
|
505 | + foreach ($times_activated as $an_activation) { |
|
506 | + if ($an_activation != 'unknown-date' && |
|
507 | + $an_activation > $most_recently_active_version_activation) { |
|
508 | 508 | $most_recently_active_version = $version; |
509 | 509 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
514 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | |
@@ -521,24 +521,24 @@ discard block |
||
521 | 521 | * @return void |
522 | 522 | */ |
523 | 523 | public function redirect_to_about_ee() { |
524 | - $notices = EE_Error::get_notices( FALSE ); |
|
524 | + $notices = EE_Error::get_notices(FALSE); |
|
525 | 525 | //if current user is an admin and it's not an ajax request |
526 | 526 | if ( |
527 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
528 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
529 | - && ! isset( $notices[ 'errors' ] ) |
|
527 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
528 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
529 | + && ! isset($notices['errors']) |
|
530 | 530 | ) { |
531 | - $query_params = array( 'page' => 'espresso_about' ); |
|
531 | + $query_params = array('page' => 'espresso_about'); |
|
532 | 532 | |
533 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
533 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
534 | 534 | $query_params['new_activation'] = TRUE; |
535 | 535 | } |
536 | 536 | |
537 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
537 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
538 | 538 | $query_params['reactivation'] = TRUE; |
539 | 539 | } |
540 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
541 | - wp_safe_redirect( $url ); |
|
540 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
541 | + wp_safe_redirect($url); |
|
542 | 542 | exit(); |
543 | 543 | } |
544 | 544 | } |
@@ -552,31 +552,31 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @return void |
554 | 554 | */ |
555 | - public function load_core_configuration(){ |
|
556 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
557 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
555 | + public function load_core_configuration() { |
|
556 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
557 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
558 | 558 | //load textdomain |
559 | 559 | EE_Load_Textdomain::load_textdomain(); |
560 | 560 | // load and setup EE_Config and EE_Network_Config |
561 | - $this->registry->load_core( 'Config' ); |
|
562 | - $this->registry->load_core( 'Network_Config' ); |
|
561 | + $this->registry->load_core('Config'); |
|
562 | + $this->registry->load_core('Network_Config'); |
|
563 | 563 | // setup autoloaders |
564 | 564 | // enable logging? |
565 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
566 | - $this->registry->load_core( 'Log' ); |
|
565 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
566 | + $this->registry->load_core('Log'); |
|
567 | 567 | } |
568 | 568 | // check for activation errors |
569 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
570 | - if ( $activation_errors ) { |
|
571 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
572 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
569 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
570 | + if ($activation_errors) { |
|
571 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
572 | + update_option('ee_plugin_activation_errors', FALSE); |
|
573 | 573 | } |
574 | 574 | // get model names |
575 | 575 | $this->_parse_model_names(); |
576 | 576 | |
577 | 577 | //load caf stuff a chance to play during the activation process too. |
578 | 578 | $this->_maybe_brew_regular(); |
579 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
579 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -585,23 +585,23 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return void |
587 | 587 | */ |
588 | - private function _parse_model_names(){ |
|
588 | + private function _parse_model_names() { |
|
589 | 589 | //get all the files in the EE_MODELS folder that end in .model.php |
590 | - $models = glob( EE_MODELS.'*.model.php'); |
|
590 | + $models = glob(EE_MODELS.'*.model.php'); |
|
591 | 591 | $model_names = array(); |
592 | 592 | $non_abstract_db_models = array(); |
593 | - foreach( $models as $model ){ |
|
593 | + foreach ($models as $model) { |
|
594 | 594 | // get model classname |
595 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
596 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
595 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
596 | + $short_name = str_replace('EEM_', '', $classname); |
|
597 | 597 | $reflectionClass = new ReflectionClass($classname); |
598 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
599 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
598 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
599 | + $non_abstract_db_models[$short_name] = $classname; |
|
600 | 600 | } |
601 | - $model_names[ $short_name ] = $classname; |
|
601 | + $model_names[$short_name] = $classname; |
|
602 | 602 | } |
603 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
604 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
603 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
604 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -611,8 +611,8 @@ discard block |
||
611 | 611 | * @return void |
612 | 612 | */ |
613 | 613 | private function _maybe_brew_regular() { |
614 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
615 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
614 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
615 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
@@ -629,9 +629,9 @@ discard block |
||
629 | 629 | * @return void |
630 | 630 | */ |
631 | 631 | public function register_shortcodes_modules_and_widgets() { |
632 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
632 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
633 | 633 | // check for addons using old hookpoint |
634 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
634 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
635 | 635 | $this->_incompatible_addon_error(); |
636 | 636 | } |
637 | 637 | } |
@@ -645,19 +645,19 @@ discard block |
||
645 | 645 | */ |
646 | 646 | private function _incompatible_addon_error() { |
647 | 647 | // get array of classes hooking into here |
648 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
649 | - if ( ! empty( $class_names )) { |
|
650 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
648 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
649 | + if ( ! empty($class_names)) { |
|
650 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
651 | 651 | $msg .= '<ul>'; |
652 | - foreach ( $class_names as $class_name ) { |
|
653 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
652 | + foreach ($class_names as $class_name) { |
|
653 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
654 | 654 | } |
655 | 655 | $msg .= '</ul>'; |
656 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
656 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
657 | 657 | // save list of incompatible addons to wp-options for later use |
658 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
659 | - if ( is_admin() ) { |
|
660 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
658 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
659 | + if (is_admin()) { |
|
660 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | } |
@@ -674,26 +674,26 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function brew_espresso(){ |
|
678 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
677 | + public function brew_espresso() { |
|
678 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
679 | 679 | // load some final core systems |
680 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
681 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
682 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
683 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
684 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
685 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
686 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
687 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
688 | - add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
689 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
690 | - |
|
691 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
680 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
681 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
682 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
683 | + add_action('init', array($this, 'load_controllers'), 7); |
|
684 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
685 | + add_action('init', array($this, 'initialize'), 10); |
|
686 | + add_action('init', array($this, 'initialize_last'), 100); |
|
687 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
689 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
690 | + |
|
691 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
692 | 692 | // pew pew pew |
693 | - $this->registry->load_core( 'PUE' ); |
|
694 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
693 | + $this->registry->load_core('PUE'); |
|
694 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
695 | 695 | } |
696 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
696 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | public function set_hooks_for_core() { |
709 | 709 | $this->_deactivate_incompatible_addons(); |
710 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
710 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | * Using the information gathered in EE_System::_incompatible_addon_error, |
717 | 717 | * deactivates any addons considered incompatible with the current version of EE |
718 | 718 | */ |
719 | - private function _deactivate_incompatible_addons(){ |
|
720 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
721 | - if ( ! empty( $incompatible_addons )) { |
|
722 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
723 | - foreach ( $active_plugins as $active_plugin ) { |
|
724 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
725 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
726 | - unset( $_GET['activate'] ); |
|
727 | - espresso_deactivate_plugin( $active_plugin ); |
|
719 | + private function _deactivate_incompatible_addons() { |
|
720 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
721 | + if ( ! empty($incompatible_addons)) { |
|
722 | + $active_plugins = get_option('active_plugins', array()); |
|
723 | + foreach ($active_plugins as $active_plugin) { |
|
724 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
725 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
726 | + unset($_GET['activate']); |
|
727 | + espresso_deactivate_plugin($active_plugin); |
|
728 | 728 | } |
729 | 729 | } |
730 | 730 | } |
@@ -741,10 +741,10 @@ discard block |
||
741 | 741 | */ |
742 | 742 | public function perform_activations_upgrades_and_migrations() { |
743 | 743 | //first check if we had previously attempted to setup EE's directories but failed |
744 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
744 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
745 | 745 | EEH_Activation::create_upload_directories(); |
746 | 746 | } |
747 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
747 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | public function load_CPTs_and_session() { |
759 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
759 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
760 | 760 | // register Custom Post Types |
761 | - $this->registry->load_core( 'Register_CPTs' ); |
|
762 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
761 | + $this->registry->load_core('Register_CPTs'); |
|
762 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | |
@@ -774,16 +774,16 @@ discard block |
||
774 | 774 | * @return void |
775 | 775 | */ |
776 | 776 | public function load_controllers() { |
777 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
777 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
778 | 778 | // let's get it started |
779 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
780 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
781 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
782 | - } else if ( ! EE_FRONT_AJAX ) { |
|
783 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
784 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
779 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
780 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
781 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
782 | + } else if ( ! EE_FRONT_AJAX) { |
|
783 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
784 | + EE_Registry::instance()->load_core('Admin'); |
|
785 | 785 | } |
786 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
786 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | |
@@ -797,9 +797,9 @@ discard block |
||
797 | 797 | * @return void |
798 | 798 | */ |
799 | 799 | public function core_loaded_and_ready() { |
800 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
801 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
802 | - $this->registry->load_core( 'Session' ); |
|
800 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
801 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
802 | + $this->registry->load_core('Session'); |
|
803 | 803 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
804 | 804 | } |
805 | 805 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | * @return void |
815 | 815 | */ |
816 | 816 | public function initialize() { |
817 | - do_action( 'AHEE__EE_System__initialize' ); |
|
817 | + do_action('AHEE__EE_System__initialize'); |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | * @return void |
829 | 829 | */ |
830 | 830 | public function initialize_last() { |
831 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
831 | + do_action('AHEE__EE_System__initialize_last'); |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -860,21 +860,21 @@ discard block |
||
860 | 860 | */ |
861 | 861 | public static function do_not_cache() { |
862 | 862 | // set no cache constants |
863 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
864 | - define( 'DONOTCACHEPAGE', true ); |
|
863 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
864 | + define('DONOTCACHEPAGE', true); |
|
865 | 865 | } |
866 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
867 | - define( 'DONOTCACHCEOBJECT', true ); |
|
866 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
867 | + define('DONOTCACHCEOBJECT', true); |
|
868 | 868 | } |
869 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
870 | - define( 'DONOTCACHEDB', true ); |
|
869 | + if ( ! defined('DONOTCACHEDB')) { |
|
870 | + define('DONOTCACHEDB', true); |
|
871 | 871 | } |
872 | 872 | // add no cache headers |
873 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
873 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
874 | 874 | // plus a little extra for nginx and Google Chrome |
875 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
875 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
876 | 876 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
877 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
877 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @param $headers |
887 | 887 | * @return array |
888 | 888 | */ |
889 | - public static function extra_nocache_headers ( $headers ) { |
|
889 | + public static function extra_nocache_headers($headers) { |
|
890 | 890 | // for NGINX |
891 | 891 | $headers['X-Accel-Expires'] = 0; |
892 | 892 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -915,14 +915,14 @@ discard block |
||
915 | 915 | * @param WP_Admin_Bar $admin_bar |
916 | 916 | * @return void |
917 | 917 | */ |
918 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
918 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
919 | 919 | |
920 | 920 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
921 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
921 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | |
925 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
925 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
926 | 926 | $menu_class = 'espresso_menu_item_class'; |
927 | 927 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
928 | 928 | //because they're only defined in each of their respective constructors |
@@ -934,20 +934,20 @@ discard block |
||
934 | 934 | //Top Level |
935 | 935 | $admin_bar->add_menu(array( |
936 | 936 | 'id' => 'espresso-toolbar', |
937 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
937 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
938 | 938 | 'href' => $events_admin_url, |
939 | 939 | 'meta' => array( |
940 | 940 | 'title' => __('Event Espresso', 'event_espresso'), |
941 | - 'class' => $menu_class . 'first' |
|
941 | + 'class' => $menu_class.'first' |
|
942 | 942 | ), |
943 | 943 | )); |
944 | 944 | |
945 | 945 | //Events |
946 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
946 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
947 | 947 | $admin_bar->add_menu(array( |
948 | 948 | 'id' => 'espresso-toolbar-events', |
949 | 949 | 'parent' => 'espresso-toolbar', |
950 | - 'title' => __( 'Events', 'event_espresso' ), |
|
950 | + 'title' => __('Events', 'event_espresso'), |
|
951 | 951 | 'href' => $events_admin_url, |
952 | 952 | 'meta' => array( |
953 | 953 | 'title' => __('Events', 'event_espresso'), |
@@ -958,13 +958,13 @@ discard block |
||
958 | 958 | } |
959 | 959 | |
960 | 960 | |
961 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
961 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
962 | 962 | //Events Add New |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-new', |
965 | 965 | 'parent' => 'espresso-toolbar-events', |
966 | 966 | 'title' => __('Add New', 'event_espresso'), |
967 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
967 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
968 | 968 | 'meta' => array( |
969 | 969 | 'title' => __('Add New', 'event_espresso'), |
970 | 970 | 'target' => '', |
@@ -973,18 +973,18 @@ discard block |
||
973 | 973 | )); |
974 | 974 | } |
975 | 975 | |
976 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
976 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
977 | 977 | |
978 | 978 | //Current post |
979 | 979 | global $post; |
980 | 980 | |
981 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
981 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
982 | 982 | //Events Edit Current Event |
983 | 983 | $admin_bar->add_menu(array( |
984 | 984 | 'id' => 'espresso-toolbar-events-edit', |
985 | 985 | 'parent' => 'espresso-toolbar-events', |
986 | 986 | 'title' => __('Edit Event', 'event_espresso'), |
987 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
987 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
988 | 988 | 'meta' => array( |
989 | 989 | 'title' => __('Edit Event', 'event_espresso'), |
990 | 990 | 'target' => '', |
@@ -996,11 +996,11 @@ discard block |
||
996 | 996 | } |
997 | 997 | |
998 | 998 | //Events View |
999 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
999 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1000 | 1000 | $admin_bar->add_menu(array( |
1001 | 1001 | 'id' => 'espresso-toolbar-events-view', |
1002 | 1002 | 'parent' => 'espresso-toolbar-events', |
1003 | - 'title' => __( 'View', 'event_espresso' ), |
|
1003 | + 'title' => __('View', 'event_espresso'), |
|
1004 | 1004 | 'href' => $events_admin_url, |
1005 | 1005 | 'meta' => array( |
1006 | 1006 | 'title' => __('View', 'event_espresso'), |
@@ -1010,12 +1010,12 @@ discard block |
||
1010 | 1010 | )); |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1013 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1014 | 1014 | //Events View All |
1015 | 1015 | $admin_bar->add_menu(array( |
1016 | 1016 | 'id' => 'espresso-toolbar-events-all', |
1017 | 1017 | 'parent' => 'espresso-toolbar-events-view', |
1018 | - 'title' => __( 'All', 'event_espresso' ), |
|
1018 | + 'title' => __('All', 'event_espresso'), |
|
1019 | 1019 | 'href' => $events_admin_url, |
1020 | 1020 | 'meta' => array( |
1021 | 1021 | 'title' => __('All', 'event_espresso'), |
@@ -1026,13 +1026,13 @@ discard block |
||
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | |
1029 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1029 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1030 | 1030 | //Events View Today |
1031 | 1031 | $admin_bar->add_menu(array( |
1032 | 1032 | 'id' => 'espresso-toolbar-events-today', |
1033 | 1033 | 'parent' => 'espresso-toolbar-events-view', |
1034 | 1034 | 'title' => __('Today', 'event_espresso'), |
1035 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1035 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1036 | 1036 | 'meta' => array( |
1037 | 1037 | 'title' => __('Today', 'event_espresso'), |
1038 | 1038 | 'target' => '', |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | |
1045 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1045 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1046 | 1046 | //Events View This Month |
1047 | 1047 | $admin_bar->add_menu(array( |
1048 | 1048 | 'id' => 'espresso-toolbar-events-month', |
1049 | 1049 | 'parent' => 'espresso-toolbar-events-view', |
1050 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1051 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1050 | + 'title' => __('This Month', 'event_espresso'), |
|
1051 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1052 | 1052 | 'meta' => array( |
1053 | 1053 | 'title' => __('This Month', 'event_espresso'), |
1054 | 1054 | 'target' => '', |
@@ -1058,11 +1058,11 @@ discard block |
||
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | //Registration Overview |
1061 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1061 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1062 | 1062 | $admin_bar->add_menu(array( |
1063 | 1063 | 'id' => 'espresso-toolbar-registrations', |
1064 | 1064 | 'parent' => 'espresso-toolbar', |
1065 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1065 | + 'title' => __('Registrations', 'event_espresso'), |
|
1066 | 1066 | 'href' => $reg_admin_url, |
1067 | 1067 | 'meta' => array( |
1068 | 1068 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1073,12 +1073,12 @@ discard block |
||
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | //Registration Overview Today |
1076 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1076 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1077 | 1077 | $admin_bar->add_menu(array( |
1078 | 1078 | 'id' => 'espresso-toolbar-registrations-today', |
1079 | 1079 | 'parent' => 'espresso-toolbar-registrations', |
1080 | - 'title' => __( 'Today', 'event_espresso'), |
|
1081 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1080 | + 'title' => __('Today', 'event_espresso'), |
|
1081 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1082 | 1082 | 'meta' => array( |
1083 | 1083 | 'title' => __('Today', 'event_espresso'), |
1084 | 1084 | 'target' => '', |
@@ -1088,14 +1088,14 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | //Registration Overview Today Completed |
1091 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1091 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1092 | 1092 | $admin_bar->add_menu(array( |
1093 | 1093 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1094 | 1094 | 'parent' => 'espresso-toolbar-registrations-today', |
1095 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1096 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1095 | + 'title' => __('Approved', 'event_espresso'), |
|
1096 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1097 | 1097 | 'meta' => array( |
1098 | - 'title' => __('Approved', 'event_espresso' ), |
|
1098 | + 'title' => __('Approved', 'event_espresso'), |
|
1099 | 1099 | 'target' => '', |
1100 | 1100 | 'class' => $menu_class |
1101 | 1101 | ), |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | //Registration Overview Today Pending\ |
1106 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1106 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1107 | 1107 | $admin_bar->add_menu(array( |
1108 | 1108 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1109 | 1109 | 'parent' => 'espresso-toolbar-registrations-today', |
1110 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1111 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1110 | + 'title' => __('Pending', 'event_espresso'), |
|
1111 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1112 | 1112 | 'meta' => array( |
1113 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1113 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1114 | 1114 | 'target' => '', |
1115 | 1115 | 'class' => $menu_class |
1116 | 1116 | ), |
@@ -1118,14 +1118,14 @@ discard block |
||
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | //Registration Overview Today Incomplete |
1121 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1121 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1122 | 1122 | $admin_bar->add_menu(array( |
1123 | 1123 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1124 | 1124 | 'parent' => 'espresso-toolbar-registrations-today', |
1125 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1126 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1125 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1126 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1127 | 1127 | 'meta' => array( |
1128 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1128 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1129 | 1129 | 'target' => '', |
1130 | 1130 | 'class' => $menu_class |
1131 | 1131 | ), |
@@ -1133,12 +1133,12 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | //Registration Overview Today Incomplete |
1136 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1136 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1137 | 1137 | $admin_bar->add_menu(array( |
1138 | 1138 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1139 | 1139 | 'parent' => 'espresso-toolbar-registrations-today', |
1140 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1141 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1140 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1141 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1142 | 1142 | 'meta' => array( |
1143 | 1143 | 'title' => __('Cancelled', 'event_espresso'), |
1144 | 1144 | 'target' => '', |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | //Registration Overview This Month |
1151 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1151 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1152 | 1152 | $admin_bar->add_menu(array( |
1153 | 1153 | 'id' => 'espresso-toolbar-registrations-month', |
1154 | 1154 | 'parent' => 'espresso-toolbar-registrations', |
1155 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1156 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1155 | + 'title' => __('This Month', 'event_espresso'), |
|
1156 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1157 | 1157 | 'meta' => array( |
1158 | 1158 | 'title' => __('This Month', 'event_espresso'), |
1159 | 1159 | 'target' => '', |
@@ -1163,12 +1163,12 @@ discard block |
||
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | //Registration Overview This Month Approved |
1166 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1166 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1167 | 1167 | $admin_bar->add_menu(array( |
1168 | 1168 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1169 | 1169 | 'parent' => 'espresso-toolbar-registrations-month', |
1170 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1171 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1170 | + 'title' => __('Approved', 'event_espresso'), |
|
1171 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1172 | 1172 | 'meta' => array( |
1173 | 1173 | 'title' => __('Approved', 'event_espresso'), |
1174 | 1174 | 'target' => '', |
@@ -1178,12 +1178,12 @@ discard block |
||
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | //Registration Overview This Month Pending |
1181 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1181 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1182 | 1182 | $admin_bar->add_menu(array( |
1183 | 1183 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1184 | 1184 | 'parent' => 'espresso-toolbar-registrations-month', |
1185 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1186 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1185 | + 'title' => __('Pending', 'event_espresso'), |
|
1186 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1187 | 1187 | 'meta' => array( |
1188 | 1188 | 'title' => __('Pending', 'event_espresso'), |
1189 | 1189 | 'target' => '', |
@@ -1193,14 +1193,14 @@ discard block |
||
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | //Registration Overview This Month Not Approved |
1196 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1196 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1197 | 1197 | $admin_bar->add_menu(array( |
1198 | 1198 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1199 | 1199 | 'parent' => 'espresso-toolbar-registrations-month', |
1200 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1201 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1200 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1201 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1202 | 1202 | 'meta' => array( |
1203 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1203 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1204 | 1204 | 'target' => '', |
1205 | 1205 | 'class' => $menu_class |
1206 | 1206 | ), |
@@ -1209,12 +1209,12 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | //Registration Overview This Month Cancelled |
1212 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1212 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1213 | 1213 | $admin_bar->add_menu(array( |
1214 | 1214 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1215 | 1215 | 'parent' => 'espresso-toolbar-registrations-month', |
1216 | 1216 | 'title' => __('Cancelled', 'event_espresso'), |
1217 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1217 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1218 | 1218 | 'meta' => array( |
1219 | 1219 | 'title' => __('Cancelled', 'event_espresso'), |
1220 | 1220 | 'target' => '', |
@@ -1224,11 +1224,11 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | //Extensions & Services |
1227 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1227 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1228 | 1228 | $admin_bar->add_menu(array( |
1229 | 1229 | 'id' => 'espresso-toolbar-extensions-and-services', |
1230 | 1230 | 'parent' => 'espresso-toolbar', |
1231 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1231 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1232 | 1232 | 'href' => $extensions_admin_url, |
1233 | 1233 | 'meta' => array( |
1234 | 1234 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | * @param array $exclude_array any existing pages being excluded are in this array. |
1251 | 1251 | * @return array |
1252 | 1252 | */ |
1253 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1254 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
1253 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1254 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
@@ -1271,12 +1271,12 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | public function wp_enqueue_scripts() { |
1273 | 1273 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1274 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1274 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1275 | 1275 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1276 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1276 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1277 | 1277 | // register jQuery Validate and additional methods |
1278 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
1279 | - wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE ); |
|
1278 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
1279 | + wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE); |
|
1280 | 1280 | } |
1281 | 1281 | } |
1282 | 1282 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @since $VID:$ |
13 | 13 | * |
14 | 14 | */ |
15 | -class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy{ |
|
15 | +class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Arguments that will be passed into the select2 javascript constructor |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param array $select2_js_args pass in the EXACT array of JS arguments you want |
26 | 26 | * to pass into the select2 js/html input. See https://select2.github.io |
27 | 27 | */ |
28 | - public function __construct( $select2_js_args = array() ) { |
|
28 | + public function __construct($select2_js_args = array()) { |
|
29 | 29 | $this->_select2_js_args = $select2_js_args; |
30 | 30 | parent::__construct(); |
31 | 31 | } |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | public function enqueue_js() { |
38 | 38 | // need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough** |
39 | 39 | // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
40 | - wp_deregister_script( 'select2' ); |
|
41 | - wp_deregister_style( 'select2' ); |
|
42 | - wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true ); |
|
43 | - wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
44 | - wp_enqueue_script( 'form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true ); |
|
45 | - wp_enqueue_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
40 | + wp_deregister_script('select2'); |
|
41 | + wp_deregister_style('select2'); |
|
42 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
43 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
44 | + wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true); |
|
45 | + wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * Sets the exact js args which will be passed into the select2 js/html input |
58 | 58 | * @param array $js_args |
59 | 59 | */ |
60 | - public function set_js_args( $js_args ) { |
|
60 | + public function set_js_args($js_args) { |
|
61 | 61 | $this->_select2_js_args = $js_args; |
62 | 62 | } |
63 | 63 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @param array $other_js_data |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - public function get_other_js_data( $other_js_data = array() ) { |
|
70 | - $other_js_data = parent::get_other_js_data( $other_js_data ); |
|
71 | - if( ! isset( $other_js_data[ 'select2s' ] ) ) { |
|
69 | + public function get_other_js_data($other_js_data = array()) { |
|
70 | + $other_js_data = parent::get_other_js_data($other_js_data); |
|
71 | + if ( ! isset($other_js_data['select2s'])) { |
|
72 | 72 | $other_js_data['select2s'] = array(); |
73 | 73 | } |
74 | - $other_js_data[ 'select2s' ][ $this->_input->html_id() ] = $this->get_js_args(); |
|
74 | + $other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args(); |
|
75 | 75 | return $other_js_data; |
76 | 76 | } |
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\exceptions\UnexpectedEntityException; |
8 | 8 | |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -24,97 +24,97 @@ discard block |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @param \EE_Event $event |
|
29 | - * @param \EE_Transaction $transaction |
|
30 | - * @param \EE_Ticket $ticket |
|
31 | - * @param \EE_Line_Item $ticket_line_item |
|
32 | - * @param $reg_count |
|
33 | - * @param $reg_group_size |
|
34 | - * @return \EE_Registration |
|
35 | - * @throws \EE_Error |
|
36 | - * @throws UnexpectedEntityException |
|
37 | - */ |
|
38 | - public function create( |
|
39 | - \EE_Event $event, |
|
40 | - \EE_Transaction $transaction, |
|
41 | - \EE_Ticket $ticket, |
|
42 | - \EE_Line_Item $ticket_line_item, |
|
43 | - $reg_count, |
|
44 | - $reg_group_size |
|
45 | - ) { |
|
46 | - $registrations = $transaction->registrations(); |
|
47 | - $reg_count = $reg_count ? $reg_count : count($registrations) + 1; |
|
48 | - $reg_url_link = new RegUrlLink($reg_count, $ticket_line_item); |
|
49 | - $reg_code = new RegCode($reg_url_link, $transaction, $ticket); |
|
50 | - // generate new EE_Registration |
|
51 | - $registration = \EE_Registration::new_instance( |
|
52 | - array( |
|
53 | - 'EVT_ID' => $event->ID(), |
|
54 | - 'TXN_ID' => $transaction->ID(), |
|
55 | - 'TKT_ID' => $ticket->ID(), |
|
56 | - 'STS_ID' => \EEM_Registration::status_id_incomplete, |
|
57 | - 'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item), |
|
58 | - 'REG_session' => \EE_Registry::instance()->SSN->id(), |
|
59 | - 'REG_count' => $reg_count, |
|
60 | - 'REG_group_size' => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations), |
|
61 | - 'REG_url_link' => $reg_url_link, |
|
62 | - 'REG_code' => $reg_code, |
|
63 | - ) |
|
64 | - ); |
|
65 | - if ( ! $registration instanceof \EE_Registration) { |
|
66 | - throw new UnexpectedEntityException($registration, 'EE_Registration'); |
|
67 | - } |
|
68 | - $registration->save(); |
|
69 | - $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
70 | - $registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID()); |
|
71 | - $transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID()); |
|
72 | - $registration->save(); |
|
73 | - return $registration; |
|
74 | - } |
|
27 | + /** |
|
28 | + * @param \EE_Event $event |
|
29 | + * @param \EE_Transaction $transaction |
|
30 | + * @param \EE_Ticket $ticket |
|
31 | + * @param \EE_Line_Item $ticket_line_item |
|
32 | + * @param $reg_count |
|
33 | + * @param $reg_group_size |
|
34 | + * @return \EE_Registration |
|
35 | + * @throws \EE_Error |
|
36 | + * @throws UnexpectedEntityException |
|
37 | + */ |
|
38 | + public function create( |
|
39 | + \EE_Event $event, |
|
40 | + \EE_Transaction $transaction, |
|
41 | + \EE_Ticket $ticket, |
|
42 | + \EE_Line_Item $ticket_line_item, |
|
43 | + $reg_count, |
|
44 | + $reg_group_size |
|
45 | + ) { |
|
46 | + $registrations = $transaction->registrations(); |
|
47 | + $reg_count = $reg_count ? $reg_count : count($registrations) + 1; |
|
48 | + $reg_url_link = new RegUrlLink($reg_count, $ticket_line_item); |
|
49 | + $reg_code = new RegCode($reg_url_link, $transaction, $ticket); |
|
50 | + // generate new EE_Registration |
|
51 | + $registration = \EE_Registration::new_instance( |
|
52 | + array( |
|
53 | + 'EVT_ID' => $event->ID(), |
|
54 | + 'TXN_ID' => $transaction->ID(), |
|
55 | + 'TKT_ID' => $ticket->ID(), |
|
56 | + 'STS_ID' => \EEM_Registration::status_id_incomplete, |
|
57 | + 'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item), |
|
58 | + 'REG_session' => \EE_Registry::instance()->SSN->id(), |
|
59 | + 'REG_count' => $reg_count, |
|
60 | + 'REG_group_size' => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations), |
|
61 | + 'REG_url_link' => $reg_url_link, |
|
62 | + 'REG_code' => $reg_code, |
|
63 | + ) |
|
64 | + ); |
|
65 | + if ( ! $registration instanceof \EE_Registration) { |
|
66 | + throw new UnexpectedEntityException($registration, 'EE_Registration'); |
|
67 | + } |
|
68 | + $registration->save(); |
|
69 | + $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
70 | + $registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID()); |
|
71 | + $transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID()); |
|
72 | + $registration->save(); |
|
73 | + return $registration; |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @param \EE_Transaction $transaction |
|
80 | - * @param \EE_Ticket $ticket |
|
81 | - * @param \EE_Line_Item $ticket_line_item |
|
82 | - * @return float |
|
83 | - */ |
|
84 | - protected function resolveFinalPrice( |
|
85 | - \EE_Transaction $transaction, |
|
86 | - \EE_Ticket $ticket, |
|
87 | - \EE_Line_Item $ticket_line_item |
|
88 | - ) { |
|
89 | - $final_price = \EEH_Line_Item::calculate_final_price_for_ticket_line_item( |
|
90 | - $transaction->total_line_item(), |
|
91 | - $ticket_line_item |
|
92 | - ); |
|
93 | - $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes(); |
|
94 | - return (float)$final_price; |
|
95 | - } |
|
78 | + /** |
|
79 | + * @param \EE_Transaction $transaction |
|
80 | + * @param \EE_Ticket $ticket |
|
81 | + * @param \EE_Line_Item $ticket_line_item |
|
82 | + * @return float |
|
83 | + */ |
|
84 | + protected function resolveFinalPrice( |
|
85 | + \EE_Transaction $transaction, |
|
86 | + \EE_Ticket $ticket, |
|
87 | + \EE_Line_Item $ticket_line_item |
|
88 | + ) { |
|
89 | + $final_price = \EEH_Line_Item::calculate_final_price_for_ticket_line_item( |
|
90 | + $transaction->total_line_item(), |
|
91 | + $ticket_line_item |
|
92 | + ); |
|
93 | + $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes(); |
|
94 | + return (float)$final_price; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | |
98 | 98 | |
99 | - /** |
|
100 | - * @param \EE_Registration[] $registrations |
|
101 | - * @param boolean $update_existing_registrations |
|
102 | - * @return int |
|
103 | - * @throws \EE_Error |
|
104 | - */ |
|
105 | - protected function incrementRegCount(array $registrations, $update_existing_registrations = true) |
|
106 | - { |
|
107 | - $new_reg_count = count($registrations) + 1; |
|
108 | - if ($update_existing_registrations) { |
|
109 | - foreach ($registrations as $registration) { |
|
110 | - if ($registration instanceof \EE_Registration) { |
|
111 | - $registration->set_count($new_reg_count); |
|
112 | - $registration->save(); |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
116 | - return $new_reg_count; |
|
117 | - } |
|
99 | + /** |
|
100 | + * @param \EE_Registration[] $registrations |
|
101 | + * @param boolean $update_existing_registrations |
|
102 | + * @return int |
|
103 | + * @throws \EE_Error |
|
104 | + */ |
|
105 | + protected function incrementRegCount(array $registrations, $update_existing_registrations = true) |
|
106 | + { |
|
107 | + $new_reg_count = count($registrations) + 1; |
|
108 | + if ($update_existing_registrations) { |
|
109 | + foreach ($registrations as $registration) { |
|
110 | + if ($registration instanceof \EE_Registration) { |
|
111 | + $registration->set_count($new_reg_count); |
|
112 | + $registration->save(); |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | + return $new_reg_count; |
|
117 | + } |
|
118 | 118 | |
119 | 119 | |
120 | 120 | } |
@@ -822,12 +822,12 @@ discard block |
||
822 | 822 | if ( $registration instanceof EE_Registration ) { |
823 | 823 | // we display all attendee info for the primary registrant |
824 | 824 | if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
825 | - && $registration->is_primary_registrant() |
|
825 | + && $registration->is_primary_registrant() |
|
826 | 826 | ) { |
827 | 827 | $this->checkout->primary_revisit = true; |
828 | 828 | break; |
829 | 829 | } else if ( $this->checkout->revisit |
830 | - && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
830 | + && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
831 | 831 | ) { |
832 | 832 | // but hide info if it doesn't belong to you |
833 | 833 | $transaction->clear_cache( 'Registration', $registration->ID() ); |
@@ -859,23 +859,23 @@ discard block |
||
859 | 859 | //do the following for each ticket of this type they selected |
860 | 860 | for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
861 | 861 | $att_nmbr++; |
862 | - /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
863 | - $CreateRegistrationCommand = EE_Registry::instance() |
|
864 | - ->create( |
|
865 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
866 | - array( |
|
867 | - $transaction, |
|
868 | - $line_item, |
|
869 | - $att_nmbr, |
|
870 | - $this->checkout->total_ticket_count |
|
871 | - ) |
|
872 | - ); |
|
873 | - // override capabilities for frontend registrations |
|
874 | - if ( ! is_admin()) { |
|
875 | - $CreateRegistrationCommand->setCapCheck( |
|
876 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
877 | - ); |
|
878 | - } |
|
862 | + /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
863 | + $CreateRegistrationCommand = EE_Registry::instance() |
|
864 | + ->create( |
|
865 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
866 | + array( |
|
867 | + $transaction, |
|
868 | + $line_item, |
|
869 | + $att_nmbr, |
|
870 | + $this->checkout->total_ticket_count |
|
871 | + ) |
|
872 | + ); |
|
873 | + // override capabilities for frontend registrations |
|
874 | + if ( ! is_admin()) { |
|
875 | + $CreateRegistrationCommand->setCapCheck( |
|
876 | + new PublicCapabilities( '', 'create_new_registration' ) |
|
877 | + ); |
|
878 | + } |
|
879 | 879 | $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
880 | 880 | if ( ! $registration instanceof EE_Registration ) { |
881 | 881 | throw new InvalidEntityException( $registration, 'EE_Registration' ); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * _get_transaction_and_cart_for_previous_visit |
691 | 691 | * |
692 | 692 | * @access private |
693 | - * @return mixed EE_Transaction|NULL |
|
693 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
694 | 694 | */ |
695 | 695 | private function _get_transaction_and_cart_for_previous_visit() { |
696 | 696 | /** @var $TXN_model EEM_Transaction */ |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
769 | 769 | * |
770 | 770 | * @access private |
771 | - * @return mixed EE_Transaction|NULL |
|
771 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
772 | 772 | */ |
773 | 773 | private function _initialize_transaction() { |
774 | 774 | try { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\domain\services\capabilities\PublicCapabilities; |
2 | 2 | use EventEspresso\core\exceptions\InvalidEntityException; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
5 | 5 | /** |
6 | 6 | * Single Page Checkout (SPCO) |
7 | 7 | * |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @return EED_Single_Page_Checkout |
51 | 51 | */ |
52 | 52 | public static function instance() { |
53 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
54 | - return parent::get_instance( __CLASS__ ); |
|
53 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
54 | + return parent::get_instance(__CLASS__); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public static function set_hooks_admin() { |
98 | 98 | EED_Single_Page_Checkout::set_definitions(); |
99 | - if ( defined( 'DOING_AJAX' )) { |
|
99 | + if (defined('DOING_AJAX')) { |
|
100 | 100 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
101 | 101 | ob_start(); |
102 | 102 | EED_Single_Page_Checkout::load_request_handler(); |
103 | 103 | EED_Single_Page_Checkout::load_reg_steps(); |
104 | 104 | } else { |
105 | 105 | // 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 |
106 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
106 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
107 | 107 | } |
108 | 108 | // set ajax hooks |
109 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
110 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
111 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
112 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
113 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
114 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
109 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
110 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
111 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
112 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
113 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
114 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param string $ajax_action |
123 | 123 | * @throws \EE_Error |
124 | 124 | */ |
125 | - public static function process_ajax_request( $ajax_action ) { |
|
126 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
125 | + public static function process_ajax_request($ajax_action) { |
|
126 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
127 | 127 | EED_Single_Page_Checkout::instance()->_initialize(); |
128 | 128 | } |
129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @throws \EE_Error |
136 | 136 | */ |
137 | 137 | public static function display_reg_step() { |
138 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
138 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @throws \EE_Error |
147 | 147 | */ |
148 | 148 | public static function process_reg_step() { |
149 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
149 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @throws \EE_Error |
158 | 158 | */ |
159 | 159 | public static function update_reg_step() { |
160 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
160 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @throws \EE_Error |
171 | 171 | */ |
172 | 172 | public static function update_checkout() { |
173 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
173 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public static function load_request_handler() { |
185 | 185 | // load core Request_Handler class |
186 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
187 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
186 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
187 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * @throws \EE_Error |
199 | 199 | */ |
200 | 200 | public static function set_definitions() { |
201 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
202 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
203 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
204 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
205 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
206 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
207 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
208 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
201 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
202 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
203 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
204 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
205 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
206 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
207 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
208 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function load_reg_steps() { |
222 | 222 | static $reg_steps_loaded = FALSE; |
223 | - if ( $reg_steps_loaded ) { |
|
223 | + if ($reg_steps_loaded) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | // filter list of reg_steps |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | EED_Single_Page_Checkout::get_reg_steps() |
230 | 230 | ); |
231 | 231 | // sort by key (order) |
232 | - ksort( $reg_steps_to_load ); |
|
232 | + ksort($reg_steps_to_load); |
|
233 | 233 | // loop through folders |
234 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
234 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
235 | 235 | // we need a |
236 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
236 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
237 | 237 | // copy over to the reg_steps_array |
238 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
238 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
239 | 239 | // register custom key route for each reg step |
240 | 240 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
241 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
241 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
242 | 242 | // add AJAX or other hooks |
243 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
243 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
244 | 244 | // setup autoloaders if necessary |
245 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
246 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
245 | + if ( ! class_exists($reg_step['class_name'])) { |
|
246 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
247 | 247 | } |
248 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
249 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
248 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
249 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
@@ -265,28 +265,28 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public static function get_reg_steps() { |
267 | 267 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
268 | - if ( empty( $reg_steps )) { |
|
268 | + if (empty($reg_steps)) { |
|
269 | 269 | $reg_steps = array( |
270 | 270 | 10 => array( |
271 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
271 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
272 | 272 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
273 | 273 | 'slug' => 'attendee_information', |
274 | 274 | 'has_hooks' => FALSE |
275 | 275 | ), |
276 | 276 | 20 => array( |
277 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
277 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
278 | 278 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
279 | 279 | 'slug' => 'registration_confirmation', |
280 | 280 | 'has_hooks' => FALSE |
281 | 281 | ), |
282 | 282 | 30 => array( |
283 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
283 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
284 | 284 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
285 | 285 | 'slug' => 'payment_options', |
286 | 286 | 'has_hooks' => TRUE |
287 | 287 | ), |
288 | 288 | 999 => array( |
289 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
289 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
290 | 290 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
291 | 291 | 'slug' => 'finalize_registration', |
292 | 292 | 'has_hooks' => FALSE |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public static function registration_checkout_for_admin() { |
309 | 309 | EED_Single_Page_Checkout::load_reg_steps(); |
310 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
311 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
312 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
310 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
311 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
312 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
313 | 313 | EED_Single_Page_Checkout::instance()->_initialize(); |
314 | 314 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
315 | 315 | return EE_Registry::instance()->REQ->get_output(); |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public static function process_registration_from_admin() { |
328 | 328 | EED_Single_Page_Checkout::load_reg_steps(); |
329 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
330 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
331 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
329 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
330 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
331 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
332 | 332 | EED_Single_Page_Checkout::instance()->_initialize(); |
333 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
334 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
335 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
336 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
337 | - if ( $final_reg_step->process_reg_step() ) { |
|
333 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
334 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
335 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
336 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
337 | + if ($final_reg_step->process_reg_step()) { |
|
338 | 338 | $final_reg_step->set_completed(); |
339 | 339 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
340 | 340 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | * @return void |
355 | 355 | * @throws \EE_Error |
356 | 356 | */ |
357 | - public function run( $WP_Query ) { |
|
357 | + public function run($WP_Query) { |
|
358 | 358 | if ( |
359 | 359 | $WP_Query instanceof WP_Query |
360 | 360 | && $WP_Query->is_main_query() |
361 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
361 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
362 | 362 | ) { |
363 | 363 | $this->_initialize(); |
364 | 364 | } |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return void |
375 | 375 | * @throws \EE_Error |
376 | 376 | */ |
377 | - public static function init( $WP_Query ) { |
|
378 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
377 | + public static function init($WP_Query) { |
|
378 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -389,34 +389,34 @@ discard block |
||
389 | 389 | */ |
390 | 390 | private function _initialize() { |
391 | 391 | // ensure SPCO doesn't run twice |
392 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
392 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | try { |
396 | 396 | // setup the EE_Checkout object |
397 | 397 | $this->checkout = $this->_initialize_checkout(); |
398 | 398 | // filter checkout |
399 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
399 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
400 | 400 | // get the $_GET |
401 | 401 | $this->_get_request_vars(); |
402 | 402 | // filter continue_reg |
403 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
403 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
404 | 404 | // load the reg steps array |
405 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
405 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
406 | 406 | EED_Single_Page_Checkout::$_initialized = true; |
407 | 407 | return; |
408 | 408 | } |
409 | 409 | // set the current step |
410 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
410 | + $this->checkout->set_current_step($this->checkout->step); |
|
411 | 411 | // and the next step |
412 | 412 | $this->checkout->set_next_step(); |
413 | 413 | // was there already a valid transaction in the checkout from the session ? |
414 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
414 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
415 | 415 | // get transaction from db or session |
416 | 416 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
417 | 417 | ? $this->_get_transaction_and_cart_for_previous_visit() |
418 | 418 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
419 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
419 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
420 | 420 | // add some style and make it dance |
421 | 421 | $this->checkout->transaction = EE_Transaction::new_instance(); |
422 | 422 | $this->add_styles_and_scripts(); |
@@ -424,10 +424,10 @@ discard block |
||
424 | 424 | return; |
425 | 425 | } |
426 | 426 | // and the registrations for the transaction |
427 | - $this->_get_registrations( $this->checkout->transaction ); |
|
427 | + $this->_get_registrations($this->checkout->transaction); |
|
428 | 428 | } |
429 | 429 | // verify that everything has been setup correctly |
430 | - if ( ! $this->_final_verifications() ) { |
|
430 | + if ( ! $this->_final_verifications()) { |
|
431 | 431 | EED_Single_Page_Checkout::$_initialized = true; |
432 | 432 | return; |
433 | 433 | } |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | // set no cache headers and constants |
453 | 453 | EE_System::do_not_cache(); |
454 | 454 | // add anchor |
455 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
456 | - } catch ( Exception $e ) { |
|
457 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
455 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
456 | + } catch (Exception $e) { |
|
457 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
@@ -472,20 +472,20 @@ discard block |
||
472 | 472 | // look in session for existing checkout |
473 | 473 | $checkout = EE_Registry::instance()->SSN->checkout(); |
474 | 474 | // verify |
475 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
475 | + if ( ! $checkout instanceof EE_Checkout) { |
|
476 | 476 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
477 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
477 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
478 | 478 | } else { |
479 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
479 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
480 | 480 | $this->unlock_transaction(); |
481 | - wp_safe_redirect( $checkout->redirect_url ); |
|
481 | + wp_safe_redirect($checkout->redirect_url); |
|
482 | 482 | exit(); |
483 | 483 | } |
484 | 484 | } |
485 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
485 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
486 | 486 | // verify again |
487 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
488 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
487 | + if ( ! $checkout instanceof EE_Checkout) { |
|
488 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
489 | 489 | } |
490 | 490 | // reset anything that needs a clean slate for each request |
491 | 491 | $checkout->reset_for_current_request(); |
@@ -505,24 +505,24 @@ discard block |
||
505 | 505 | // load classes |
506 | 506 | EED_Single_Page_Checkout::load_request_handler(); |
507 | 507 | //make sure this request is marked as belonging to EE |
508 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
508 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
509 | 509 | // which step is being requested ? |
510 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
510 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
511 | 511 | // which step is being edited ? |
512 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
512 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
513 | 513 | // and what we're doing on the current step |
514 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
514 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
515 | 515 | // returning to edit ? |
516 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
516 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
517 | 517 | // or some other kind of revisit ? |
518 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
518 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
519 | 519 | // and whether or not to generate a reg form for this request |
520 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
520 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
521 | 521 | // and whether or not to process a reg form submission for this request |
522 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
522 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
523 | 523 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
524 | 524 | ? $this->checkout->process_form_submission |
525 | - : FALSE; // TRUE FALSE |
|
525 | + : FALSE; // TRUE FALSE |
|
526 | 526 | // $this->_display_request_vars(); |
527 | 527 | } |
528 | 528 | |
@@ -535,17 +535,17 @@ discard block |
||
535 | 535 | * @return void |
536 | 536 | */ |
537 | 537 | protected function _display_request_vars() { |
538 | - if ( ! WP_DEBUG ) { |
|
538 | + if ( ! WP_DEBUG) { |
|
539 | 539 | return; |
540 | 540 | } |
541 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
542 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
543 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
544 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
545 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
546 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
547 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
548 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
541 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
542 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
543 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
544 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
545 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
546 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
547 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
548 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @return array |
560 | 560 | */ |
561 | 561 | private function _get_first_step() { |
562 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
563 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
562 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
563 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -576,27 +576,27 @@ discard block |
||
576 | 576 | private function _load_and_instantiate_reg_steps() { |
577 | 577 | // have reg_steps already been instantiated ? |
578 | 578 | if ( |
579 | - empty( $this->checkout->reg_steps ) || |
|
580 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
579 | + empty($this->checkout->reg_steps) || |
|
580 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
581 | 581 | ) { |
582 | 582 | // if not, then loop through raw reg steps array |
583 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
584 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
583 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
584 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
585 | 585 | return false; |
586 | 586 | } |
587 | 587 | } |
588 | 588 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
589 | 589 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
590 | 590 | // skip the registration_confirmation page ? |
591 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
591 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
592 | 592 | // just remove it from the reg steps array |
593 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
593 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
594 | 594 | } else if ( |
595 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
595 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
596 | 596 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
597 | 597 | ) { |
598 | 598 | // set the order to something big like 100 |
599 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
599 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
600 | 600 | } |
601 | 601 | // filter the array for good luck |
602 | 602 | $this->checkout->reg_steps = apply_filters( |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | // finally re-sort based on the reg step class order properties |
607 | 607 | $this->checkout->sort_reg_steps(); |
608 | 608 | } else { |
609 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
609 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
610 | 610 | // set all current step stati to FALSE |
611 | - $reg_step->set_is_current_step( FALSE ); |
|
611 | + $reg_step->set_is_current_step(FALSE); |
|
612 | 612 | } |
613 | 613 | } |
614 | - if ( empty( $this->checkout->reg_steps )) { |
|
615 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
614 | + if (empty($this->checkout->reg_steps)) { |
|
615 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
616 | 616 | return false; |
617 | 617 | } |
618 | 618 | // make reg step details available to JS |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | * @param int $order |
631 | 631 | * @return bool |
632 | 632 | */ |
633 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
633 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
634 | 634 | |
635 | 635 | // we need a file_path, class_name, and slug to add a reg step |
636 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
636 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
637 | 637 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
638 | 638 | if ( |
639 | 639 | $this->checkout->reg_url_link |
@@ -651,26 +651,26 @@ discard block |
||
651 | 651 | FALSE |
652 | 652 | ); |
653 | 653 | // did we gets the goods ? |
654 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
654 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
655 | 655 | // set reg step order based on config |
656 | - $reg_step_obj->set_order( $order ); |
|
656 | + $reg_step_obj->set_order($order); |
|
657 | 657 | // add instantiated reg step object to the master reg steps array |
658 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
658 | + $this->checkout->add_reg_step($reg_step_obj); |
|
659 | 659 | } else { |
660 | 660 | EE_Error::add_error( |
661 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
661 | + __('The current step could not be set.', 'event_espresso'), |
|
662 | 662 | __FILE__, __FUNCTION__, __LINE__ |
663 | 663 | ); |
664 | 664 | return false; |
665 | 665 | } |
666 | 666 | } else { |
667 | - if ( WP_DEBUG ) { |
|
667 | + if (WP_DEBUG) { |
|
668 | 668 | EE_Error::add_error( |
669 | 669 | sprintf( |
670 | - __( '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' ), |
|
671 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
672 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
673 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
670 | + __('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'), |
|
671 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
672 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
673 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
674 | 674 | '<ul>', |
675 | 675 | '<li>', |
676 | 676 | '</li>', |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | */ |
695 | 695 | private function _get_transaction_and_cart_for_previous_visit() { |
696 | 696 | /** @var $TXN_model EEM_Transaction */ |
697 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
697 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
698 | 698 | // 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 |
699 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
699 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
700 | 700 | // verify transaction |
701 | - if ( $transaction instanceof EE_Transaction ) { |
|
701 | + if ($transaction instanceof EE_Transaction) { |
|
702 | 702 | // and get the cart that was used for that transaction |
703 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
703 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
704 | 704 | return $transaction; |
705 | 705 | } else { |
706 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
706 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
707 | 707 | return NULL; |
708 | 708 | } |
709 | 709 | } |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | * @param EE_Transaction $transaction |
718 | 718 | * @return EE_Cart |
719 | 719 | */ |
720 | - private function _get_cart_for_transaction( $transaction ) { |
|
721 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
720 | + private function _get_cart_for_transaction($transaction) { |
|
721 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | * @param EE_Transaction $transaction |
731 | 731 | * @return EE_Cart |
732 | 732 | */ |
733 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
734 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
733 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
734 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | |
@@ -747,17 +747,17 @@ discard block |
||
747 | 747 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
748 | 748 | // if there's no transaction, then this is the FIRST visit to SPCO |
749 | 749 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
750 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
750 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
751 | 751 | // and then create a new transaction |
752 | 752 | $transaction = $this->_initialize_transaction(); |
753 | 753 | // verify transaction |
754 | - if ( $transaction instanceof EE_Transaction ) { |
|
754 | + if ($transaction instanceof EE_Transaction) { |
|
755 | 755 | // save it so that we have an ID for other objects to use |
756 | 756 | $transaction->save(); |
757 | 757 | // and save TXN data to the cart |
758 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
758 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
759 | 759 | } else { |
760 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
760 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
761 | 761 | } |
762 | 762 | return $transaction; |
763 | 763 | } |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | 'STS_ID' => EEM_Transaction::failed_status_code, |
786 | 786 | ) |
787 | 787 | ); |
788 | - } catch( Exception $e ) { |
|
789 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
788 | + } catch (Exception $e) { |
|
789 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
790 | 790 | } |
791 | 791 | return NULL; |
792 | 792 | } |
@@ -801,38 +801,38 @@ discard block |
||
801 | 801 | * @return EE_Cart |
802 | 802 | * @throws \EE_Error |
803 | 803 | */ |
804 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
804 | + private function _get_registrations(EE_Transaction $transaction) { |
|
805 | 805 | // first step: grab the registrants { : o |
806 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
806 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
807 | 807 | // verify registrations have been set |
808 | - if ( empty( $registrations )) { |
|
808 | + if (empty($registrations)) { |
|
809 | 809 | // if no cached registrations, then check the db |
810 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
810 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
811 | 811 | // still nothing ? well as long as this isn't a revisit |
812 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
812 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
813 | 813 | // generate new registrations from scratch |
814 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
814 | + $registrations = $this->_initialize_registrations($transaction); |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | // sort by their original registration order |
818 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
818 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
819 | 819 | // then loop thru the array |
820 | - foreach ( $registrations as $registration ) { |
|
820 | + foreach ($registrations as $registration) { |
|
821 | 821 | // verify each registration |
822 | - if ( $registration instanceof EE_Registration ) { |
|
822 | + if ($registration instanceof EE_Registration) { |
|
823 | 823 | // we display all attendee info for the primary registrant |
824 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
824 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
825 | 825 | && $registration->is_primary_registrant() |
826 | 826 | ) { |
827 | 827 | $this->checkout->primary_revisit = true; |
828 | 828 | break; |
829 | - } else if ( $this->checkout->revisit |
|
829 | + } else if ($this->checkout->revisit |
|
830 | 830 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
831 | 831 | ) { |
832 | 832 | // but hide info if it doesn't belong to you |
833 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
833 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
834 | 834 | } |
835 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
835 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
@@ -847,17 +847,17 @@ discard block |
||
847 | 847 | * @return array |
848 | 848 | * @throws \EE_Error |
849 | 849 | */ |
850 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
850 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
851 | 851 | $att_nmbr = 0; |
852 | 852 | $registrations = array(); |
853 | - if ( $transaction instanceof EE_Transaction ) { |
|
853 | + if ($transaction instanceof EE_Transaction) { |
|
854 | 854 | /** @type EE_Registration_Processor $registration_processor */ |
855 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
855 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
856 | 856 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
857 | 857 | // now let's add the cart items to the $transaction |
858 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
858 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
859 | 859 | //do the following for each ticket of this type they selected |
860 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
860 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
861 | 861 | $att_nmbr++; |
862 | 862 | /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
863 | 863 | $CreateRegistrationCommand = EE_Registry::instance() |
@@ -873,17 +873,17 @@ discard block |
||
873 | 873 | // override capabilities for frontend registrations |
874 | 874 | if ( ! is_admin()) { |
875 | 875 | $CreateRegistrationCommand->setCapCheck( |
876 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
876 | + new PublicCapabilities('', 'create_new_registration') |
|
877 | 877 | ); |
878 | 878 | } |
879 | - $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
|
880 | - if ( ! $registration instanceof EE_Registration ) { |
|
881 | - throw new InvalidEntityException( $registration, 'EE_Registration' ); |
|
879 | + $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand); |
|
880 | + if ( ! $registration instanceof EE_Registration) { |
|
881 | + throw new InvalidEntityException($registration, 'EE_Registration'); |
|
882 | 882 | } |
883 | - $registrations[ $registration->ID() ] = $registration; |
|
883 | + $registrations[$registration->ID()] = $registration; |
|
884 | 884 | } |
885 | 885 | } |
886 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
886 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
887 | 887 | } |
888 | 888 | return $registrations; |
889 | 889 | } |
@@ -898,12 +898,12 @@ discard block |
||
898 | 898 | * @param EE_Registration $reg_B |
899 | 899 | * @return int |
900 | 900 | */ |
901 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
901 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
902 | 902 | // this shouldn't ever happen within the same TXN, but oh well |
903 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
903 | + if ($reg_A->count() === $reg_B->count()) { |
|
904 | 904 | return 0; |
905 | 905 | } |
906 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
906 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | |
@@ -918,21 +918,21 @@ discard block |
||
918 | 918 | */ |
919 | 919 | private function _final_verifications() { |
920 | 920 | // filter checkout |
921 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
921 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
922 | 922 | //verify that current step is still set correctly |
923 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
924 | - 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__ ); |
|
923 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
924 | + 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__); |
|
925 | 925 | return false; |
926 | 926 | } |
927 | 927 | // if returning to SPCO, then verify that primary registrant is set |
928 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
928 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
929 | 929 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
930 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
931 | - 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__ ); |
|
930 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
931 | + 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__); |
|
932 | 932 | return false; |
933 | 933 | } |
934 | 934 | $valid_registrant = null; |
935 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
935 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
936 | 936 | if ( |
937 | 937 | $registration instanceof EE_Registration |
938 | 938 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -940,9 +940,9 @@ discard block |
||
940 | 940 | $valid_registrant = $registration; |
941 | 941 | } |
942 | 942 | } |
943 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
943 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
944 | 944 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
945 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
945 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
946 | 946 | // clear the session, mark the checkout as unverified, and try again |
947 | 947 | EE_Registry::instance()->SSN->clear_session(); |
948 | 948 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -951,13 +951,13 @@ discard block |
||
951 | 951 | EE_Error::reset_notices(); |
952 | 952 | return false; |
953 | 953 | } |
954 | - 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__ ); |
|
954 | + 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__); |
|
955 | 955 | return false; |
956 | 956 | } |
957 | 957 | } |
958 | 958 | // now that things have been kinda sufficiently verified, |
959 | 959 | // let's add the checkout to the session so that's available other systems |
960 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
960 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
961 | 961 | return true; |
962 | 962 | } |
963 | 963 | |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | * @param bool $reinitializing |
973 | 973 | * @throws \EE_Error |
974 | 974 | */ |
975 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
976 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
975 | + private function _initialize_reg_steps($reinitializing = false) { |
|
976 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
977 | 977 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
978 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
979 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
978 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
979 | + if ( ! $reg_step->initialize_reg_step()) { |
|
980 | 980 | // if not initialized then maybe this step is being removed... |
981 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
981 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
982 | 982 | // if it was the current step, then we need to start over here |
983 | - $this->_initialize_reg_steps( true ); |
|
983 | + $this->_initialize_reg_steps(true); |
|
984 | 984 | return; |
985 | 985 | } |
986 | 986 | continue; |
@@ -989,13 +989,13 @@ discard block |
||
989 | 989 | $reg_step->enqueue_styles_and_scripts(); |
990 | 990 | // i18n |
991 | 991 | $reg_step->translate_js_strings(); |
992 | - if ( $reg_step->is_current_step() ) { |
|
992 | + if ($reg_step->is_current_step()) { |
|
993 | 993 | // the text that appears on the reg step form submit button |
994 | 994 | $reg_step->set_submit_button_text(); |
995 | 995 | } |
996 | 996 | } |
997 | 997 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
998 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
998 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
@@ -1008,43 +1008,43 @@ discard block |
||
1008 | 1008 | */ |
1009 | 1009 | private function _check_form_submission() { |
1010 | 1010 | //does this request require the reg form to be generated ? |
1011 | - if ( $this->checkout->generate_reg_form ) { |
|
1011 | + if ($this->checkout->generate_reg_form) { |
|
1012 | 1012 | // ever heard that song by Blue Rodeo ? |
1013 | 1013 | try { |
1014 | 1014 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1015 | 1015 | // if not displaying a form, then check for form submission |
1016 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1016 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1017 | 1017 | // clear out any old data in case this step is being run again |
1018 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1018 | + $this->checkout->current_step->set_valid_data(array()); |
|
1019 | 1019 | // capture submitted form data |
1020 | 1020 | $this->checkout->current_step->reg_form->receive_form_submission( |
1021 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1021 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1022 | 1022 | ); |
1023 | 1023 | // validate submitted form data |
1024 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1024 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1025 | 1025 | // thou shall not pass !!! |
1026 | 1026 | $this->checkout->continue_reg = FALSE; |
1027 | 1027 | // any form validation errors? |
1028 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1028 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1029 | 1029 | $submission_error_messages = array(); |
1030 | 1030 | // bad, bad, bad registrant |
1031 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1032 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1031 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1032 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1033 | 1033 | $submission_error_messages[] = sprintf( |
1034 | - __( '%s : %s', 'event_espresso' ), |
|
1034 | + __('%s : %s', 'event_espresso'), |
|
1035 | 1035 | $validation_error->get_form_section()->html_label_text(), |
1036 | 1036 | $validation_error->getMessage() |
1037 | 1037 | ); |
1038 | 1038 | } |
1039 | 1039 | } |
1040 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1040 | + EE_Error::add_error(implode('<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 | } |
@@ -1061,22 +1061,22 @@ discard block |
||
1061 | 1061 | */ |
1062 | 1062 | private function _process_form_action() { |
1063 | 1063 | // what cha wanna do? |
1064 | - switch( $this->checkout->action ) { |
|
1064 | + switch ($this->checkout->action) { |
|
1065 | 1065 | // AJAX next step reg form |
1066 | 1066 | case 'display_spco_reg_step' : |
1067 | 1067 | $this->checkout->redirect = FALSE; |
1068 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1069 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1068 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1069 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1070 | 1070 | } |
1071 | 1071 | break; |
1072 | 1072 | |
1073 | 1073 | default : |
1074 | 1074 | // meh... do one of those other steps first |
1075 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1075 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1076 | 1076 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1077 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1077 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1078 | 1078 | // call action on current step |
1079 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1079 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1080 | 1080 | // good registrant, you get to proceed |
1081 | 1081 | if ( |
1082 | 1082 | $this->checkout->current_step->success_message() !== '' |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | ) { |
1088 | 1088 | EE_Error::add_success( |
1089 | 1089 | $this->checkout->current_step->success_message() |
1090 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1090 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1091 | 1091 | ); |
1092 | 1092 | |
1093 | 1093 | } |
@@ -1095,12 +1095,12 @@ discard block |
||
1095 | 1095 | $this->_setup_redirect(); |
1096 | 1096 | } |
1097 | 1097 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1098 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1098 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1099 | 1099 | |
1100 | 1100 | } else { |
1101 | 1101 | EE_Error::add_error( |
1102 | 1102 | sprintf( |
1103 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1103 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1104 | 1104 | $this->checkout->action, |
1105 | 1105 | $this->checkout->current_step->name() |
1106 | 1106 | ), |
@@ -1126,10 +1126,10 @@ discard block |
||
1126 | 1126 | public function add_styles_and_scripts() { |
1127 | 1127 | // i18n |
1128 | 1128 | $this->translate_js_strings(); |
1129 | - if ( $this->checkout->admin_request ) { |
|
1130 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1129 | + if ($this->checkout->admin_request) { |
|
1130 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1131 | 1131 | } else { |
1132 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1132 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
@@ -1145,42 +1145,42 @@ discard block |
||
1145 | 1145 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1146 | 1146 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1147 | 1147 | 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'); |
1148 | - 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' ); |
|
1149 | - 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' ); |
|
1150 | - 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' ); |
|
1148 | + 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'); |
|
1149 | + 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'); |
|
1150 | + 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'); |
|
1151 | 1151 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1152 | 1152 | 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'); |
1153 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1154 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1153 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1154 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1155 | 1155 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1156 | 1156 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1157 | 1157 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1158 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1159 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1160 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1161 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1162 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1163 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1164 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1165 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1166 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1167 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1168 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1169 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1170 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1171 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1158 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1159 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1160 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1161 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1162 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1163 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1164 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1165 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1166 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1167 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1168 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1169 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1170 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1171 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1172 | 1172 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1173 | - __( '%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' ), |
|
1173 | + __('%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'), |
|
1174 | 1174 | '<h4 class="important-notice">', |
1175 | 1175 | '</h4>', |
1176 | 1176 | '<br />', |
1177 | 1177 | '<p>', |
1178 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1178 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1179 | 1179 | '">', |
1180 | 1180 | '</a>', |
1181 | 1181 | '</p>' |
1182 | 1182 | ); |
1183 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1183 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | |
@@ -1193,25 +1193,25 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | public function enqueue_styles_and_scripts() { |
1195 | 1195 | // load css |
1196 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1197 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1196 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1197 | + wp_enqueue_style('single_page_checkout'); |
|
1198 | 1198 | // load JS |
1199 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1200 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1201 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1202 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1199 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1200 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1201 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1202 | + wp_enqueue_script('single_page_checkout'); |
|
1203 | 1203 | |
1204 | 1204 | /** |
1205 | 1205 | * global action hook for enqueueing styles and scripts with |
1206 | 1206 | * spco calls. |
1207 | 1207 | */ |
1208 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1208 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1209 | 1209 | |
1210 | 1210 | /** |
1211 | 1211 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1212 | 1212 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1213 | 1213 | */ |
1214 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1214 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1215 | 1215 | |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1226,19 +1226,19 @@ discard block |
||
1226 | 1226 | */ |
1227 | 1227 | private function _display_spco_reg_form() { |
1228 | 1228 | // if registering via the admin, just display the reg form for the current step |
1229 | - if ( $this->checkout->admin_request ) { |
|
1230 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1229 | + if ($this->checkout->admin_request) { |
|
1230 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1231 | 1231 | } else { |
1232 | 1232 | // add powered by EE msg |
1233 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1233 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1234 | 1234 | |
1235 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1235 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1236 | 1236 | $cookies_not_set_msg = ''; |
1237 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1237 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1238 | 1238 | $cookies_not_set_msg = apply_filters( |
1239 | 1239 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1240 | 1240 | sprintf( |
1241 | - __( '%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' ), |
|
1241 | + __('%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'), |
|
1242 | 1242 | '<div class="ee-attention">', |
1243 | 1243 | '</div>', |
1244 | 1244 | '<h6 class="important-notice">', |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | 'layout_strategy' => |
1259 | 1259 | new EE_Template_Layout( |
1260 | 1260 | array( |
1261 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1261 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1262 | 1262 | 'template_args' => array( |
1263 | 1263 | 'empty_cart' => $empty_cart, |
1264 | 1264 | 'revisit' => $this->checkout->revisit, |
@@ -1267,8 +1267,8 @@ discard block |
||
1267 | 1267 | 'empty_msg' => apply_filters( |
1268 | 1268 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1269 | 1269 | sprintf( |
1270 | - __( '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' ), |
|
1271 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1270 | + __('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'), |
|
1271 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1272 | 1272 | '">', |
1273 | 1273 | '</a>' |
1274 | 1274 | ) |
@@ -1276,14 +1276,14 @@ discard block |
||
1276 | 1276 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1277 | 1277 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1278 | 1278 | 'session_expiration' => |
1279 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1279 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1280 | 1280 | ) |
1281 | 1281 | ) |
1282 | 1282 | ) |
1283 | 1283 | ) |
1284 | 1284 | ); |
1285 | 1285 | // load template and add to output sent that gets filtered into the_content() |
1286 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1286 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | |
@@ -1297,8 +1297,8 @@ discard block |
||
1297 | 1297 | * @internal param string $label |
1298 | 1298 | * @return string |
1299 | 1299 | */ |
1300 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1301 | - if ( $next_step === 'finalize_registration' ) { |
|
1300 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1301 | + if ($next_step === 'finalize_registration') { |
|
1302 | 1302 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1303 | 1303 | } |
1304 | 1304 | } |
@@ -1320,13 +1320,13 @@ discard block |
||
1320 | 1320 | ) { |
1321 | 1321 | add_filter( |
1322 | 1322 | 'FHEE__EEH_Template__powered_by_event_espresso__url', |
1323 | - function( $url) { |
|
1324 | - return apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1323 | + function($url) { |
|
1324 | + return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1325 | 1325 | } |
1326 | 1326 | ); |
1327 | 1327 | echo apply_filters( |
1328 | 1328 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1329 | - \EEH_Template::powered_by_event_espresso( '', 'espresso-registration-footer-dv' ) |
|
1329 | + \EEH_Template::powered_by_event_espresso('', 'espresso-registration-footer-dv') |
|
1330 | 1330 | ); |
1331 | 1331 | } |
1332 | 1332 | return ''; |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | * @throws \EE_Error |
1343 | 1343 | */ |
1344 | 1344 | public function unlock_transaction() { |
1345 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1345 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1346 | 1346 | $this->checkout->transaction->unlock(); |
1347 | 1347 | } |
1348 | 1348 | } |
@@ -1357,12 +1357,12 @@ discard block |
||
1357 | 1357 | * @return array |
1358 | 1358 | */ |
1359 | 1359 | private function _setup_redirect() { |
1360 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1360 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1361 | 1361 | $this->checkout->redirect = TRUE; |
1362 | - if ( empty( $this->checkout->redirect_url )) { |
|
1362 | + if (empty($this->checkout->redirect_url)) { |
|
1363 | 1363 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1364 | 1364 | } |
1365 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1365 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1366 | 1366 | } |
1367 | 1367 | } |
1368 | 1368 | |
@@ -1376,9 +1376,9 @@ discard block |
||
1376 | 1376 | * @throws \EE_Error |
1377 | 1377 | */ |
1378 | 1378 | public function go_to_next_step() { |
1379 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1379 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1380 | 1380 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1381 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1381 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1382 | 1382 | } |
1383 | 1383 | $this->unlock_transaction(); |
1384 | 1384 | // just return for these conditions |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | */ |
1408 | 1408 | protected function _handle_json_response() { |
1409 | 1409 | // if this is an ajax request |
1410 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1410 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1411 | 1411 | // DEBUG LOG |
1412 | 1412 | //$this->checkout->log( |
1413 | 1413 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | $this->checkout->json_response->set_registration_time_limit( |
1421 | 1421 | $this->checkout->get_registration_time_limit() |
1422 | 1422 | ); |
1423 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1423 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1424 | 1424 | // just send the ajax ( |
1425 | 1425 | $json_response = apply_filters( |
1426 | 1426 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1441,9 +1441,9 @@ discard block |
||
1441 | 1441 | */ |
1442 | 1442 | protected function _handle_html_redirects() { |
1443 | 1443 | // going somewhere ? |
1444 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1444 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1445 | 1445 | // store notices in a transient |
1446 | - EE_Error::get_notices( false, true, true ); |
|
1446 | + EE_Error::get_notices(false, true, true); |
|
1447 | 1447 | // DEBUG LOG |
1448 | 1448 | //$this->checkout->log( |
1449 | 1449 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | // 'headers_list' => headers_list(), |
1454 | 1454 | // ) |
1455 | 1455 | //); |
1456 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1456 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1457 | 1457 | exit(); |
1458 | 1458 | } |
1459 | 1459 | } |
@@ -105,41 +105,41 @@ discard block |
||
105 | 105 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). 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) |
106 | 106 | * @return \EEM_Line_Item |
107 | 107 | */ |
108 | - protected function __construct( $timezone ) { |
|
109 | - $this->singular_item = __('Line Item','event_espresso'); |
|
110 | - $this->plural_item = __('Line Items','event_espresso'); |
|
108 | + protected function __construct($timezone) { |
|
109 | + $this->singular_item = __('Line Item', 'event_espresso'); |
|
110 | + $this->plural_item = __('Line Items', 'event_espresso'); |
|
111 | 111 | |
112 | 112 | $this->_tables = array( |
113 | - 'Line_Item'=>new EE_Primary_Table('esp_line_item','LIN_ID') |
|
113 | + 'Line_Item'=>new EE_Primary_Table('esp_line_item', 'LIN_ID') |
|
114 | 114 | ); |
115 | - $line_items_can_be_for = apply_filters( 'FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket','Price', 'Event' ) ); |
|
115 | + $line_items_can_be_for = apply_filters('FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket', 'Price', 'Event')); |
|
116 | 116 | $this->_fields = array( |
117 | 117 | 'Line_Item' => array( |
118 | - 'LIN_ID' => new EE_Primary_Key_Int_Field( 'LIN_ID', __( "ID", "event_espresso" ) ), |
|
119 | - 'LIN_code' => new EE_Slug_Field( 'LIN_code', __( "Code for index into Cart", "event_espresso" ), TRUE ), |
|
120 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( "Transaction ID", "event_espresso" ), TRUE, NULL, 'Transaction' ), |
|
121 | - 'LIN_name' => new EE_Full_HTML_Field( 'LIN_name', __( "Line Item Name", "event_espresso" ), FALSE, '' ), |
|
122 | - 'LIN_desc' => new EE_Full_HTML_Field( 'LIN_desc', __( "Line Item Description", "event_espresso" ), TRUE ), |
|
123 | - 'LIN_unit_price' => new EE_Money_Field( 'LIN_unit_price', __( "Unit Price", "event_espresso" ), FALSE, 0 ), |
|
124 | - 'LIN_percent' => new EE_Float_Field( 'LIN_percent', __( "Percent", "event_espresso" ), FALSE, 0 ), |
|
125 | - 'LIN_is_taxable' => new EE_Boolean_Field( 'LIN_is_taxable', __( "Taxable", "event_espresso" ), FALSE, FALSE ), |
|
126 | - 'LIN_order' => new EE_Integer_Field( 'LIN_order', __( "Order of Application towards total of parent", "event_espresso" ), FALSE, 1 ), |
|
127 | - 'LIN_total' => new EE_Money_Field( 'LIN_total', __( "Total (unit price x quantity)", "event_espresso" ), FALSE, 0 ), |
|
128 | - 'LIN_quantity' => new EE_Integer_Field( 'LIN_quantity', __( "Quantity", "event_espresso" ), TRUE, 1 ), |
|
129 | - 'LIN_parent' => new EE_Integer_Field( 'LIN_parent', __( "Parent ID (this item goes towards that Line Item's total)", "event_espresso" ), TRUE, NULL ), |
|
130 | - 'LIN_type' => new EE_Enum_Text_Field( 'LIN_type', __( "Type", "event_espresso" ), FALSE, 'line-item', array( |
|
118 | + 'LIN_ID' => new EE_Primary_Key_Int_Field('LIN_ID', __("ID", "event_espresso")), |
|
119 | + 'LIN_code' => new EE_Slug_Field('LIN_code', __("Code for index into Cart", "event_espresso"), TRUE), |
|
120 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __("Transaction ID", "event_espresso"), TRUE, NULL, 'Transaction'), |
|
121 | + 'LIN_name' => new EE_Full_HTML_Field('LIN_name', __("Line Item Name", "event_espresso"), FALSE, ''), |
|
122 | + 'LIN_desc' => new EE_Full_HTML_Field('LIN_desc', __("Line Item Description", "event_espresso"), TRUE), |
|
123 | + 'LIN_unit_price' => new EE_Money_Field('LIN_unit_price', __("Unit Price", "event_espresso"), FALSE, 0), |
|
124 | + 'LIN_percent' => new EE_Float_Field('LIN_percent', __("Percent", "event_espresso"), FALSE, 0), |
|
125 | + 'LIN_is_taxable' => new EE_Boolean_Field('LIN_is_taxable', __("Taxable", "event_espresso"), FALSE, FALSE), |
|
126 | + 'LIN_order' => new EE_Integer_Field('LIN_order', __("Order of Application towards total of parent", "event_espresso"), FALSE, 1), |
|
127 | + 'LIN_total' => new EE_Money_Field('LIN_total', __("Total (unit price x quantity)", "event_espresso"), FALSE, 0), |
|
128 | + 'LIN_quantity' => new EE_Integer_Field('LIN_quantity', __("Quantity", "event_espresso"), TRUE, 1), |
|
129 | + 'LIN_parent' => new EE_Integer_Field('LIN_parent', __("Parent ID (this item goes towards that Line Item's total)", "event_espresso"), TRUE, NULL), |
|
130 | + 'LIN_type' => new EE_Enum_Text_Field('LIN_type', __("Type", "event_espresso"), FALSE, 'line-item', array( |
|
131 | 131 | self::type_line_item => __("Line Item", "event_espresso"), |
132 | 132 | self::type_sub_line_item => __("Sub-Item", "event_espresso"), |
133 | 133 | self::type_sub_total => __("Subtotal", "event_espresso"), |
134 | 134 | self::type_tax_sub_total => __("Tax Subtotal", "event_espresso"), |
135 | 135 | self::type_tax => __("Tax", "event_espresso"), |
136 | 136 | self::type_total => __("Total", "event_espresso"), |
137 | - self::type_cancellation => __( 'Cancellation', 'event_espresso' ) |
|
137 | + self::type_cancellation => __('Cancellation', 'event_espresso') |
|
138 | 138 | ) |
139 | 139 | ), |
140 | - 'OBJ_ID' => new EE_Foreign_Key_Int_Field( 'OBJ_ID', __( 'ID of Item purchased.', 'event_espresso' ), TRUE, NULL, $line_items_can_be_for ), |
|
141 | - 'OBJ_type' =>new EE_Any_Foreign_Model_Name_Field( 'OBJ_type', __( "Model Name this Line Item is for", "event_espresso" ), TRUE, NULL, $line_items_can_be_for ), |
|
142 | - 'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created','event_espresso'), false, EE_Datetime_Field::now, $timezone ), |
|
140 | + 'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', __('ID of Item purchased.', 'event_espresso'), TRUE, NULL, $line_items_can_be_for), |
|
141 | + 'OBJ_type' =>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Model Name this Line Item is for", "event_espresso"), TRUE, NULL, $line_items_can_be_for), |
|
142 | + 'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created', 'event_espresso'), false, EE_Datetime_Field::now, $timezone), |
|
143 | 143 | ) |
144 | 144 | ); |
145 | 145 | $this->_model_relations = array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | ); |
151 | 151 | $this->_model_chain_to_wp_user = 'Transaction.Registration.Event'; |
152 | 152 | $this->_caps_slug = 'transactions'; |
153 | - parent::__construct( $timezone ); |
|
153 | + parent::__construct($timezone); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | * @param EE_Transaction|int $transaction |
162 | 162 | * @return EE_Line_Item[] |
163 | 163 | */ |
164 | - public function get_all_of_type_for_transaction( $line_item_type, $transaction ){ |
|
165 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
166 | - return $this->get_all( array( array( |
|
164 | + public function get_all_of_type_for_transaction($line_item_type, $transaction) { |
|
165 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
166 | + return $this->get_all(array(array( |
|
167 | 167 | 'LIN_type' => $line_item_type, |
168 | 168 | 'TXN_ID' => $transaction |
169 | 169 | ))); |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | * @param EE_Transaction|int $transaction |
178 | 178 | * @return EE_Line_Item[] |
179 | 179 | */ |
180 | - public function get_all_non_ticket_line_items_for_transaction( $transaction ) { |
|
181 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
182 | - return $this->get_all( array( array( |
|
180 | + public function get_all_non_ticket_line_items_for_transaction($transaction) { |
|
181 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
182 | + return $this->get_all(array(array( |
|
183 | 183 | 'LIN_type' => self::type_line_item, |
184 | 184 | 'TXN_ID' => $transaction, |
185 | 185 | 'OR' => array( |
186 | - 'OBJ_type*notticket' => array( '!=', 'Ticket'), |
|
187 | - 'OBJ_type*null' => array( 'IS_NULL' )) |
|
186 | + 'OBJ_type*notticket' => array('!=', 'Ticket'), |
|
187 | + 'OBJ_type*null' => array('IS_NULL')) |
|
188 | 188 | ))); |
189 | 189 | } |
190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * because if there are spam bots afoot there will be LOTS of line items |
195 | 195 | * @return int count of how many deleted |
196 | 196 | */ |
197 | - public function delete_line_items_with_no_transaction(){ |
|
197 | + public function delete_line_items_with_no_transaction() { |
|
198 | 198 | /** @type WPDB $wpdb */ |
199 | 199 | global $wpdb; |
200 | 200 | $time_to_leave_alone = apply_filters( |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | ); |
203 | 203 | $query = $wpdb->prepare( |
204 | 204 | 'DELETE li |
205 | - FROM ' . $this->table() . ' li |
|
206 | - LEFT JOIN ' . EEM_Transaction::instance()->table(). ' t ON li.TXN_ID = t.TXN_ID |
|
205 | + FROM ' . $this->table().' li |
|
206 | + LEFT JOIN ' . EEM_Transaction::instance()->table().' t ON li.TXN_ID = t.TXN_ID |
|
207 | 207 | WHERE t.TXN_ID IS NULL AND li.LIN_timestamp < %s', |
208 | 208 | // use GMT time because that's what TXN_timestamps are in |
209 | - gmdate( 'Y-m-d H:i:s', time() - $time_to_leave_alone ) |
|
209 | + gmdate('Y-m-d H:i:s', time() - $time_to_leave_alone) |
|
210 | 210 | ); |
211 | - return $wpdb->query( $query ); |
|
211 | + return $wpdb->query($query); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * @param \EE_Base_Class $object |
222 | 222 | * @return EE_Line_Item[] |
223 | 223 | */ |
224 | - public function get_line_item_for_transaction_object( $TXN_ID, EE_Base_Class $object ){ |
|
225 | - return $this->get_all( array( array( |
|
224 | + public function get_line_item_for_transaction_object($TXN_ID, EE_Base_Class $object) { |
|
225 | + return $this->get_all(array(array( |
|
226 | 226 | 'TXN_ID' => $TXN_ID, |
227 | - 'OBJ_type' => str_replace( 'EE_', '', get_class( $object )), |
|
227 | + 'OBJ_type' => str_replace('EE_', '', get_class($object)), |
|
228 | 228 | 'OBJ_ID' => $object->ID() |
229 | 229 | ))); |
230 | 230 | } |
@@ -240,16 +240,16 @@ discard block |
||
240 | 240 | * @param array $OBJ_IDs |
241 | 241 | * @return EE_Line_Item[] |
242 | 242 | */ |
243 | - public function get_object_line_items_for_transaction( $TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array() ){ |
|
243 | + public function get_object_line_items_for_transaction($TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array()) { |
|
244 | 244 | $query_params = array( |
245 | 245 | 'OBJ_type' => $OBJ_type, |
246 | 246 | // if incoming $OBJ_IDs is an array, then make sure it is formatted correctly for the query |
247 | - 'OBJ_ID' => is_array( $OBJ_IDs ) && ! isset( $OBJ_IDs['IN'] ) ? array( 'IN', $OBJ_IDs ) : $OBJ_IDs |
|
247 | + 'OBJ_ID' => is_array($OBJ_IDs) && ! isset($OBJ_IDs['IN']) ? array('IN', $OBJ_IDs) : $OBJ_IDs |
|
248 | 248 | ); |
249 | - if ( $TXN_ID ) { |
|
249 | + if ($TXN_ID) { |
|
250 | 250 | $query_params['TXN_ID'] = $TXN_ID; |
251 | 251 | } |
252 | - return $this->get_all( array( $query_params )); |
|
252 | + return $this->get_all(array($query_params)); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * @param EE_Transaction $transaction |
261 | 261 | * @return EE_Line_Item[] |
262 | 262 | */ |
263 | - public function get_all_ticket_line_items_for_transaction( EE_Transaction $transaction ) { |
|
264 | - return $this->get_all( array( |
|
263 | + public function get_all_ticket_line_items_for_transaction(EE_Transaction $transaction) { |
|
264 | + return $this->get_all(array( |
|
265 | 265 | array( |
266 | 266 | 'TXN_ID' => $transaction->ID(), |
267 | 267 | 'OBJ_type' => 'Ticket', |
268 | 268 | ) |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | * @param int $TKT_ID |
279 | 279 | * @return \EE_Line_Item |
280 | 280 | */ |
281 | - public function get_ticket_line_item_for_transaction( $TXN_ID, $TKT_ID ) { |
|
282 | - return $this->get_one( array( |
|
281 | + public function get_ticket_line_item_for_transaction($TXN_ID, $TKT_ID) { |
|
282 | + return $this->get_one(array( |
|
283 | 283 | array( |
284 | - 'TXN_ID' => EEM_Transaction::instance()->ensure_is_ID( $TXN_ID ), |
|
284 | + 'TXN_ID' => EEM_Transaction::instance()->ensure_is_ID($TXN_ID), |
|
285 | 285 | 'OBJ_ID' => $TKT_ID, |
286 | 286 | 'OBJ_type' => 'Ticket', |
287 | 287 | ) |
288 | - ) ); |
|
288 | + )); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | * @param EE_Promotion $promotion |
301 | 301 | * @return EE_Line_Item |
302 | 302 | */ |
303 | - public function get_existing_promotion_line_item( EE_Line_Item $parent_line_item, EE_Promotion $promotion ) { |
|
304 | - return $this->get_one( array( |
|
303 | + public function get_existing_promotion_line_item(EE_Line_Item $parent_line_item, EE_Promotion $promotion) { |
|
304 | + return $this->get_one(array( |
|
305 | 305 | array( |
306 | 306 | 'TXN_ID' => $parent_line_item->TXN_ID(), |
307 | 307 | 'LIN_parent' => $parent_line_item->ID(), |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * @param EE_Line_Item $parent_line_item |
323 | 323 | * @return EE_Line_Item[] |
324 | 324 | */ |
325 | - public function get_all_promotion_line_items( EE_Line_Item $parent_line_item ) { |
|
326 | - return $this->get_all( array( |
|
325 | + public function get_all_promotion_line_items(EE_Line_Item $parent_line_item) { |
|
326 | + return $this->get_all(array( |
|
327 | 327 | array( |
328 | 328 | 'TXN_ID' => $parent_line_item->TXN_ID(), |
329 | 329 | 'LIN_parent' => $parent_line_item->ID(), |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * @param EE_Registration $registration |
341 | 341 | * @return EE_Line_ITem |
342 | 342 | */ |
343 | - public function get_line_item_for_registration( EE_Registration $registration ) { |
|
344 | - return $this->get_one( $this->line_item_for_registration_query_params( $registration )); |
|
343 | + public function get_line_item_for_registration(EE_Registration $registration) { |
|
344 | + return $this->get_one($this->line_item_for_registration_query_params($registration)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | * @param array $original_query_params any extra query params you'd like to be merged with |
351 | 351 | * @return array like EEM_Base::get_all()'s $query_params |
352 | 352 | */ |
353 | - public function line_item_for_registration_query_params( EE_Registration $registration, $original_query_params = array() ) { |
|
354 | - return array_replace_recursive( $original_query_params, array( |
|
353 | + public function line_item_for_registration_query_params(EE_Registration $registration, $original_query_params = array()) { |
|
354 | + return array_replace_recursive($original_query_params, array( |
|
355 | 355 | array( |
356 | 356 | 'OBJ_ID' => $registration->ticket_ID(), |
357 | 357 | 'OBJ_type' => 'Ticket', |
358 | 358 | 'TXN_ID' => $registration->transaction_ID() |
359 | 359 | ) |
360 | - ) ); |
|
360 | + )); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 |
@@ -1311,8 +1311,8 @@ discard block |
||
1311 | 1311 | * verifies user access for this admin page |
1312 | 1312 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | - * @return BOOL|wp_die() |
|
1315 | - */ |
|
1314 | + * @return BOOL|wp_die() |
|
1315 | + */ |
|
1316 | 1316 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1317 | 1317 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1318 | 1318 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1698,11 +1698,11 @@ discard block |
||
1698 | 1698 | |
1699 | 1699 | |
1700 | 1700 | /** |
1701 | - * admin_footer_scripts_eei18n_js_strings |
|
1702 | - * |
|
1703 | - * @access public |
|
1704 | - * @return void |
|
1705 | - */ |
|
1701 | + * admin_footer_scripts_eei18n_js_strings |
|
1702 | + * |
|
1703 | + * @access public |
|
1704 | + * @return void |
|
1705 | + */ |
|
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | |
1760 | 1760 | /** |
1761 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | - * |
|
1763 | - * @access public |
|
1764 | - * @return void |
|
1765 | - */ |
|
1761 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | + * |
|
1763 | + * @access public |
|
1764 | + * @return void |
|
1765 | + */ |
|
1766 | 1766 | public function add_xdebug_style() { |
1767 | 1767 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1768 | 1768 | } |
@@ -1819,9 +1819,9 @@ discard block |
||
1819 | 1819 | |
1820 | 1820 | /** |
1821 | 1821 | * set current view for List Table |
1822 | - * @access public |
|
1823 | - * @return array |
|
1824 | - */ |
|
1822 | + * @access public |
|
1823 | + * @return array |
|
1824 | + */ |
|
1825 | 1825 | protected function _set_list_table_view() { |
1826 | 1826 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1827 | 1827 | |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | * @access protected |
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | - */ |
|
1913 | + */ |
|
1914 | 1914 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1915 | 1915 | |
1916 | 1916 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1955,9 +1955,9 @@ discard block |
||
1955 | 1955 | |
1956 | 1956 | /** |
1957 | 1957 | * _set_search_attributes |
1958 | - * @access protected |
|
1959 | - * @return void |
|
1960 | - */ |
|
1958 | + * @access protected |
|
1959 | + * @return void |
|
1960 | + */ |
|
1961 | 1961 | public function _set_search_attributes() { |
1962 | 1962 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1963 | 1963 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1978 | 1978 | * @access private |
1979 | 1979 | * @return void |
1980 | - */ |
|
1980 | + */ |
|
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | 1982 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1983 | 1983 | |
@@ -2209,7 +2209,6 @@ discard block |
||
2209 | 2209 | * Note: currently there is no validation for this. However if you want the delete button, the |
2210 | 2210 | * save, and save and close buttons to work properly, then you will want to include a |
2211 | 2211 | * values for the name and id arguments. |
2212 | - |
|
2213 | 2212 | * |
2214 | 2213 | *@todo Add in validation for name/id arguments. |
2215 | 2214 | * @param string $name key used for the action ID (i.e. event_id) |
@@ -2268,9 +2267,9 @@ discard block |
||
2268 | 2267 | |
2269 | 2268 | /** |
2270 | 2269 | * displays an error message to ppl who have javascript disabled |
2271 | - * @access private |
|
2272 | - * @return string |
|
2273 | - */ |
|
2270 | + * @access private |
|
2271 | + * @return string |
|
2272 | + */ |
|
2274 | 2273 | private function _display_no_javascript_warning() { |
2275 | 2274 | ?> |
2276 | 2275 | <noscript> |
@@ -2293,9 +2292,9 @@ discard block |
||
2293 | 2292 | |
2294 | 2293 | /** |
2295 | 2294 | * displays espresso success and/or error notices |
2296 | - * @access private |
|
2297 | - * @return string |
|
2298 | - */ |
|
2295 | + * @access private |
|
2296 | + * @return string |
|
2297 | + */ |
|
2299 | 2298 | private function _display_espresso_notices() { |
2300 | 2299 | $notices = $this->_get_transient( TRUE ); |
2301 | 2300 | echo stripslashes($notices); |
@@ -2307,10 +2306,10 @@ discard block |
||
2307 | 2306 | |
2308 | 2307 | |
2309 | 2308 | /** |
2310 | - * spinny things pacify the masses |
|
2311 | - * @access private |
|
2312 | - * @return string |
|
2313 | - */ |
|
2309 | + * spinny things pacify the masses |
|
2310 | + * @access private |
|
2311 | + * @return string |
|
2312 | + */ |
|
2314 | 2313 | protected function _add_admin_page_ajax_loading_img() { |
2315 | 2314 | ?> |
2316 | 2315 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2324,10 +2323,10 @@ discard block |
||
2324 | 2323 | |
2325 | 2324 | |
2326 | 2325 | /** |
2327 | - * add admin page overlay for modal boxes |
|
2328 | - * @access private |
|
2329 | - * @return string |
|
2330 | - */ |
|
2326 | + * add admin page overlay for modal boxes |
|
2327 | + * @access private |
|
2328 | + * @return string |
|
2329 | + */ |
|
2331 | 2330 | protected function _add_admin_page_overlay() { |
2332 | 2331 | ?> |
2333 | 2332 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2389,10 +2388,10 @@ discard block |
||
2389 | 2388 | |
2390 | 2389 | |
2391 | 2390 | /** |
2392 | - * generates HTML wrapper for an admin details page |
|
2393 | - * @access public |
|
2394 | - * @return void |
|
2395 | - */ |
|
2391 | + * generates HTML wrapper for an admin details page |
|
2392 | + * @access public |
|
2393 | + * @return void |
|
2394 | + */ |
|
2396 | 2395 | public function display_admin_page_with_sidebar() { |
2397 | 2396 | |
2398 | 2397 | $this->_display_admin_page(TRUE); |
@@ -2402,10 +2401,10 @@ discard block |
||
2402 | 2401 | |
2403 | 2402 | |
2404 | 2403 | /** |
2405 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2406 | - * @access public |
|
2407 | - * @return void |
|
2408 | - */ |
|
2404 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2405 | + * @access public |
|
2406 | + * @return void |
|
2407 | + */ |
|
2409 | 2408 | public function display_admin_page_with_no_sidebar() { |
2410 | 2409 | $this->_display_admin_page(); |
2411 | 2410 | } |
@@ -2662,11 +2661,11 @@ discard block |
||
2662 | 2661 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2663 | 2662 | if ( NULL === error_get_last() || ! headers_sent() ) |
2664 | 2663 | header('Content-Type: application/json; charset=UTF-8'); |
2665 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2666 | - echo wp_json_encode( $json ); |
|
2667 | - } else { |
|
2668 | - echo json_encode( $json ); |
|
2669 | - } |
|
2664 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2665 | + echo wp_json_encode( $json ); |
|
2666 | + } else { |
|
2667 | + echo json_encode( $json ); |
|
2668 | + } |
|
2670 | 2669 | exit(); |
2671 | 2670 | } |
2672 | 2671 | |
@@ -2705,11 +2704,11 @@ discard block |
||
2705 | 2704 | |
2706 | 2705 | |
2707 | 2706 | /** |
2708 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2709 | - * @access public |
|
2710 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2711 | - * @return void |
|
2712 | - */ |
|
2707 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2708 | + * @access public |
|
2709 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2710 | + * @return void |
|
2711 | + */ |
|
2713 | 2712 | public function admin_page_wrapper($about = FALSE) { |
2714 | 2713 | |
2715 | 2714 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2766,9 +2765,9 @@ discard block |
||
2766 | 2765 | */ |
2767 | 2766 | private function _sort_nav_tabs( $a, $b ) { |
2768 | 2767 | if ($a['order'] == $b['order']) { |
2769 | - return 0; |
|
2770 | - } |
|
2771 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2768 | + return 0; |
|
2769 | + } |
|
2770 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2772 | 2771 | } |
2773 | 2772 | |
2774 | 2773 |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @final |
484 | 484 | * @access protected |
485 | - * @return void |
|
485 | + * @return false|null |
|
486 | 486 | */ |
487 | 487 | final protected function _page_setup() { |
488 | 488 | |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | /** |
818 | 818 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
819 | 819 | * @param string $route the route name we're verifying |
820 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
820 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
821 | 821 | */ |
822 | 822 | protected function _verify_route( $route ) { |
823 | 823 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -3417,7 +3417,7 @@ discard block |
||
3417 | 3417 | |
3418 | 3418 | |
3419 | 3419 | /** |
3420 | - * @return mixed |
|
3420 | + * @return string[] |
|
3421 | 3421 | */ |
3422 | 3422 | public function default_espresso_metaboxes() { |
3423 | 3423 | return $this->_default_espresso_metaboxes; |
@@ -3435,7 +3435,7 @@ discard block |
||
3435 | 3435 | |
3436 | 3436 | |
3437 | 3437 | /** |
3438 | - * @return mixed |
|
3438 | + * @return string |
|
3439 | 3439 | */ |
3440 | 3440 | public function wp_page_slug() { |
3441 | 3441 | return $this->_wp_page_slug; |
@@ -3448,7 +3448,6 @@ discard block |
||
3448 | 3448 | * |
3449 | 3449 | * @access protected |
3450 | 3450 | * @param string $tab |
3451 | - * @param array $data |
|
3452 | 3451 | * @param string $file file where error occurred |
3453 | 3452 | * @param string $func function where error occurred |
3454 | 3453 | * @param string $line line no where error occurred |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -160,8 +162,9 @@ discard block |
||
160 | 162 | */ |
161 | 163 | public function __construct( $routing = TRUE ) { |
162 | 164 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
164 | - $this->_is_caf = TRUE; |
|
165 | + if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) { |
|
166 | + $this->_is_caf = TRUE; |
|
167 | + } |
|
165 | 168 | |
166 | 169 | $this->_yes_no_values = array( |
167 | 170 | array('id' => TRUE, 'text' => __('Yes', 'event_espresso')), |
@@ -192,8 +195,9 @@ discard block |
||
192 | 195 | $this->_do_other_page_hooks(); |
193 | 196 | |
194 | 197 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
196 | - $this->_before_page_setup(); |
|
198 | + if ( method_exists( $this, '_before_page_setup' ) ) { |
|
199 | + $this->_before_page_setup(); |
|
200 | + } |
|
197 | 201 | |
198 | 202 | //set up page dependencies |
199 | 203 | $this->_page_setup(); |
@@ -499,7 +503,9 @@ discard block |
||
499 | 503 | global $ee_menu_slugs; |
500 | 504 | $ee_menu_slugs = (array) $ee_menu_slugs; |
501 | 505 | |
502 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
506 | + if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) { |
|
507 | + return FALSE; |
|
508 | + } |
|
503 | 509 | |
504 | 510 | |
505 | 511 | // 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 |
@@ -534,12 +540,14 @@ discard block |
||
534 | 540 | } |
535 | 541 | |
536 | 542 | //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 |
537 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | - $this->_extend_page_config(); |
|
543 | + if ( method_exists( $this, '_extend_page_config' ) ) { |
|
544 | + $this->_extend_page_config(); |
|
545 | + } |
|
539 | 546 | |
540 | 547 | //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. |
541 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | - $this->_extend_page_config_for_cpt(); |
|
548 | + if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) { |
|
549 | + $this->_extend_page_config_for_cpt(); |
|
550 | + } |
|
543 | 551 | |
544 | 552 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
545 | 553 | $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
@@ -655,8 +663,9 @@ discard block |
||
655 | 663 | //add screen options - global, page child class, and view specific |
656 | 664 | $this->_add_global_screen_options(); |
657 | 665 | $this->_add_screen_options(); |
658 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
659 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
666 | + if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) { |
|
667 | + call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
668 | + } |
|
660 | 669 | |
661 | 670 | |
662 | 671 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -667,28 +676,32 @@ discard block |
||
667 | 676 | //add feature_pointers - global, page child class, and view specific |
668 | 677 | $this->_add_feature_pointers(); |
669 | 678 | $this->_add_global_feature_pointers(); |
670 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
671 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
679 | + if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) { |
|
680 | + call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
681 | + } |
|
672 | 682 | |
673 | 683 | //enqueue scripts/styles - global, page class, and view specific |
674 | 684 | add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
675 | 685 | add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
676 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
677 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
686 | + if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) { |
|
687 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
688 | + } |
|
678 | 689 | |
679 | 690 | add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
680 | 691 | |
681 | 692 | //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 |
682 | 693 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
683 | 694 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
684 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
685 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
695 | + if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) { |
|
696 | + add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
697 | + } |
|
686 | 698 | |
687 | 699 | //admin footer scripts |
688 | 700 | add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
689 | 701 | add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
690 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
691 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
702 | + if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) { |
|
703 | + add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
704 | + } |
|
692 | 705 | |
693 | 706 | |
694 | 707 | do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
@@ -760,7 +773,9 @@ discard block |
||
760 | 773 | protected function _verify_routes() { |
761 | 774 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
762 | 775 | |
763 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return; |
|
776 | + if ( !$this->_current_page && !defined( 'DOING_AJAX')) { |
|
777 | + return; |
|
778 | + } |
|
764 | 779 | |
765 | 780 | $this->_route = FALSE; |
766 | 781 | $func = FALSE; |
@@ -870,8 +885,9 @@ discard block |
||
870 | 885 | * @return void |
871 | 886 | */ |
872 | 887 | protected function _route_admin_request() { |
873 | - if ( ! $this->_is_UI_request ) |
|
874 | - $this->_verify_routes(); |
|
888 | + if ( ! $this->_is_UI_request ) { |
|
889 | + $this->_verify_routes(); |
|
890 | + } |
|
875 | 891 | |
876 | 892 | $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
877 | 893 | |
@@ -881,8 +897,9 @@ discard block |
||
881 | 897 | $this->_verify_nonce( $nonce, $this->_req_nonce ); |
882 | 898 | } |
883 | 899 | //set the nav_tabs array but ONLY if this is UI_request |
884 | - if ( $this->_is_UI_request ) |
|
885 | - $this->_set_nav_tabs(); |
|
900 | + if ( $this->_is_UI_request ) { |
|
901 | + $this->_set_nav_tabs(); |
|
902 | + } |
|
886 | 903 | |
887 | 904 | // grab callback function |
888 | 905 | $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
@@ -919,8 +936,9 @@ discard block |
||
919 | 936 | } |
920 | 937 | |
921 | 938 | |
922 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
923 | - throw new EE_Error( $error_msg ); |
|
939 | + if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) { |
|
940 | + throw new EE_Error( $error_msg ); |
|
941 | + } |
|
924 | 942 | } |
925 | 943 | |
926 | 944 | //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. |
@@ -1047,8 +1065,9 @@ discard block |
||
1047 | 1065 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1048 | 1066 | foreach ( $this->_help_tour['tours'] as $tour ) { |
1049 | 1067 | //if this is the end tour then we don't need to setup a button |
1050 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1051 | - continue; |
|
1068 | + if ( $tour instanceof EE_Help_Tour_final_stop ) { |
|
1069 | + continue; |
|
1070 | + } |
|
1052 | 1071 | $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
1053 | 1072 | } |
1054 | 1073 | $tour_buttons .= implode('<br />', $tb); |
@@ -1058,8 +1077,9 @@ discard block |
||
1058 | 1077 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1059 | 1078 | if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
1060 | 1079 | //check that the callback given is valid |
1061 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1062 | - 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) ) ); |
|
1080 | + if ( !method_exists($this, $config['help_sidebar'] ) ) { |
|
1081 | + 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) ) ); |
|
1082 | + } |
|
1063 | 1083 | |
1064 | 1084 | $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
1065 | 1085 | |
@@ -1083,18 +1103,23 @@ discard block |
||
1083 | 1103 | }/**/ |
1084 | 1104 | |
1085 | 1105 | |
1086 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1106 | + if ( !isset( $config['help_tabs'] ) ) { |
|
1107 | + return; |
|
1108 | + } |
|
1109 | + //no help tabs for this route |
|
1087 | 1110 | |
1088 | 1111 | foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
1089 | 1112 | //we're here so there ARE help tabs! |
1090 | 1113 | |
1091 | 1114 | //make sure we've got what we need |
1092 | - if ( !isset( $cfg['title'] ) ) |
|
1093 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1115 | + if ( !isset( $cfg['title'] ) ) { |
|
1116 | + throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1117 | + } |
|
1094 | 1118 | |
1095 | 1119 | |
1096 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1097 | - 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') ); |
|
1120 | + if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) { |
|
1121 | + 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') ); |
|
1122 | + } |
|
1098 | 1123 | |
1099 | 1124 | |
1100 | 1125 | |
@@ -1157,14 +1182,16 @@ discard block |
||
1157 | 1182 | $this->_help_tour = array(); |
1158 | 1183 | |
1159 | 1184 | //exit early if help tours are turned off globally |
1160 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1161 | - return; |
|
1185 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) { |
|
1186 | + return; |
|
1187 | + } |
|
1162 | 1188 | |
1163 | 1189 | //loop through _page_config to find any help_tour defined |
1164 | 1190 | foreach ( $this->_page_config as $route => $config ) { |
1165 | 1191 | //we're only going to set things up for this route |
1166 | - if ( $route !== $this->_req_action ) |
|
1167 | - continue; |
|
1192 | + if ( $route !== $this->_req_action ) { |
|
1193 | + continue; |
|
1194 | + } |
|
1168 | 1195 | |
1169 | 1196 | if ( isset( $config['help_tour'] ) ) { |
1170 | 1197 | |
@@ -1199,8 +1226,9 @@ discard block |
||
1199 | 1226 | } |
1200 | 1227 | } |
1201 | 1228 | |
1202 | - if ( !empty( $tours ) ) |
|
1203 | - $this->_help_tour['tours'] = $tours; |
|
1229 | + if ( !empty( $tours ) ) { |
|
1230 | + $this->_help_tour['tours'] = $tours; |
|
1231 | + } |
|
1204 | 1232 | |
1205 | 1233 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
1206 | 1234 | } |
@@ -1240,15 +1268,21 @@ discard block |
||
1240 | 1268 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1241 | 1269 | $i = 0; |
1242 | 1270 | foreach ( $this->_page_config as $slug => $config ) { |
1243 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1244 | - continue; //no nav tab for this config |
|
1271 | + if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) { |
|
1272 | + continue; |
|
1273 | + } |
|
1274 | + //no nav tab for this config |
|
1245 | 1275 | |
1246 | 1276 | //check for persistent flag |
1247 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1248 | - continue; //nav tab is only to appear when route requested. |
|
1277 | + if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) { |
|
1278 | + continue; |
|
1279 | + } |
|
1280 | + //nav tab is only to appear when route requested. |
|
1249 | 1281 | |
1250 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1251 | - continue; //no nav tab becasue current user does not have access. |
|
1282 | + if ( ! $this->check_user_access( $slug, TRUE ) ) { |
|
1283 | + continue; |
|
1284 | + } |
|
1285 | + //no nav tab becasue current user does not have access. |
|
1252 | 1286 | |
1253 | 1287 | $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
1254 | 1288 | $this->_nav_tabs[$slug] = array( |
@@ -1484,10 +1518,11 @@ discard block |
||
1484 | 1518 | $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
1485 | 1519 | } |
1486 | 1520 | |
1487 | - if ( $display ) |
|
1488 | - echo $content; |
|
1489 | - else |
|
1490 | - return $content; |
|
1521 | + if ( $display ) { |
|
1522 | + echo $content; |
|
1523 | + } else { |
|
1524 | + return $content; |
|
1525 | + } |
|
1491 | 1526 | } |
1492 | 1527 | |
1493 | 1528 | |
@@ -1504,8 +1539,9 @@ discard block |
||
1504 | 1539 | $method_name = '_help_popup_content_' . $this->_req_action; |
1505 | 1540 | |
1506 | 1541 | //if method doesn't exist let's get out. |
1507 | - if ( !method_exists( $this, $method_name ) ) |
|
1508 | - return array(); |
|
1542 | + if ( !method_exists( $this, $method_name ) ) { |
|
1543 | + return array(); |
|
1544 | + } |
|
1509 | 1545 | |
1510 | 1546 | //k we're good to go let's retrieve the help array |
1511 | 1547 | $help_array = call_user_func( array( $this, $method_name ) ); |
@@ -1536,7 +1572,9 @@ discard block |
||
1536 | 1572 | */ |
1537 | 1573 | protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
1538 | 1574 | |
1539 | - if ( defined('DOING_AJAX') ) return; |
|
1575 | + if ( defined('DOING_AJAX') ) { |
|
1576 | + return; |
|
1577 | + } |
|
1540 | 1578 | |
1541 | 1579 | //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 |
1542 | 1580 | $help_array = $this->_get_help_content(); |
@@ -1554,10 +1592,11 @@ discard block |
||
1554 | 1592 | $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>'; |
1555 | 1593 | $content = $content . $help_content; |
1556 | 1594 | |
1557 | - if ( $display ) |
|
1558 | - echo $content; |
|
1559 | - else |
|
1560 | - return $content; |
|
1595 | + if ( $display ) { |
|
1596 | + echo $content; |
|
1597 | + } else { |
|
1598 | + return $content; |
|
1599 | + } |
|
1561 | 1600 | } |
1562 | 1601 | |
1563 | 1602 | |
@@ -1783,8 +1822,10 @@ discard block |
||
1783 | 1822 | protected function _set_list_table() { |
1784 | 1823 | |
1785 | 1824 | //first is this a list_table view? |
1786 | - if ( !isset($this->_route_config['list_table']) ) |
|
1787 | - return; //not a list_table view so get out. |
|
1825 | + if ( !isset($this->_route_config['list_table']) ) { |
|
1826 | + return; |
|
1827 | + } |
|
1828 | + //not a list_table view so get out. |
|
1788 | 1829 | |
1789 | 1830 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1790 | 1831 | |
@@ -2146,8 +2187,9 @@ discard block |
||
2146 | 2187 | protected function _espresso_sponsors_post_box() { |
2147 | 2188 | |
2148 | 2189 | $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
2149 | - if ( $show_sponsors ) |
|
2150 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2190 | + if ( $show_sponsors ) { |
|
2191 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2192 | + } |
|
2151 | 2193 | } |
2152 | 2194 | |
2153 | 2195 | |
@@ -2444,8 +2486,9 @@ discard block |
||
2444 | 2486 | |
2445 | 2487 | $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
2446 | 2488 | |
2447 | - if ( defined('DOING_AJAX' ) ) |
|
2448 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2489 | + if ( defined('DOING_AJAX' ) ) { |
|
2490 | + $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2491 | + } |
|
2449 | 2492 | |
2450 | 2493 | $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
2451 | 2494 | |
@@ -2587,10 +2630,11 @@ discard block |
||
2587 | 2630 | true |
2588 | 2631 | ); |
2589 | 2632 | // the final template wrapper |
2590 | - if ( $sidebar ) |
|
2591 | - $this->display_admin_page_with_sidebar(); |
|
2592 | - else |
|
2593 | - $this->display_admin_page_with_no_sidebar(); |
|
2633 | + if ( $sidebar ) { |
|
2634 | + $this->display_admin_page_with_sidebar(); |
|
2635 | + } else { |
|
2636 | + $this->display_admin_page_with_no_sidebar(); |
|
2637 | + } |
|
2594 | 2638 | } |
2595 | 2639 | |
2596 | 2640 | |
@@ -2658,8 +2702,9 @@ discard block |
||
2658 | 2702 | |
2659 | 2703 | |
2660 | 2704 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2661 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2662 | - header('Content-Type: application/json; charset=UTF-8'); |
|
2705 | + if ( NULL === error_get_last() || ! headers_sent() ) { |
|
2706 | + header('Content-Type: application/json; charset=UTF-8'); |
|
2707 | + } |
|
2663 | 2708 | if( function_exists( 'wp_json_encode' ) ) { |
2664 | 2709 | echo wp_json_encode( $json ); |
2665 | 2710 | } else { |
@@ -2677,10 +2722,9 @@ discard block |
||
2677 | 2722 | * @throws EE_Error |
2678 | 2723 | */ |
2679 | 2724 | public function return_json() { |
2680 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2681 | - $this->_return_json(); |
|
2682 | - |
|
2683 | - else { |
|
2725 | + if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2726 | + $this->_return_json(); |
|
2727 | + } else { |
|
2684 | 2728 | throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
2685 | 2729 | } |
2686 | 2730 | } |
@@ -2822,7 +2866,9 @@ discard block |
||
2822 | 2866 | $id = $this->_current_view . '_' . $ref; |
2823 | 2867 | $name = !empty($actions) ? $actions[$key] : $ref; |
2824 | 2868 | $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
2825 | - if ( !$both ) break; |
|
2869 | + if ( !$both ) { |
|
2870 | + break; |
|
2871 | + } |
|
2826 | 2872 | } |
2827 | 2873 | |
2828 | 2874 | } |
@@ -3178,13 +3224,15 @@ discard block |
||
3178 | 3224 | if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
3179 | 3225 | check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
3180 | 3226 | |
3181 | - if ( !$user = wp_get_current_user() ) |
|
3182 | - return; |
|
3227 | + if ( !$user = wp_get_current_user() ) { |
|
3228 | + return; |
|
3229 | + } |
|
3183 | 3230 | $option = $_POST['wp_screen_options']['option']; |
3184 | 3231 | $value = $_POST['wp_screen_options']['value']; |
3185 | 3232 | |
3186 | - if ( $option != sanitize_key( $option ) ) |
|
3187 | - return; |
|
3233 | + if ( $option != sanitize_key( $option ) ) { |
|
3234 | + return; |
|
3235 | + } |
|
3188 | 3236 | |
3189 | 3237 | $map_option = $option; |
3190 | 3238 | |
@@ -3193,13 +3241,15 @@ discard block |
||
3193 | 3241 | switch ( $map_option ) { |
3194 | 3242 | case $this->_current_page . '_' . $this->_current_view . '_per_page': |
3195 | 3243 | $value = (int) $value; |
3196 | - if ( $value < 1 || $value > 999 ) |
|
3197 | - return; |
|
3244 | + if ( $value < 1 || $value > 999 ) { |
|
3245 | + return; |
|
3246 | + } |
|
3198 | 3247 | break; |
3199 | 3248 | default: |
3200 | 3249 | $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
3201 | - if ( false === $value ) |
|
3202 | - return; |
|
3250 | + if ( false === $value ) { |
|
3251 | + return; |
|
3252 | + } |
|
3203 | 3253 | break; |
3204 | 3254 | } |
3205 | 3255 | |
@@ -3235,8 +3285,9 @@ discard block |
||
3235 | 3285 | protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
3236 | 3286 | $user_id = get_current_user_id(); |
3237 | 3287 | |
3238 | - if ( !$skip_route_verify ) |
|
3239 | - $this->_verify_route($route); |
|
3288 | + if ( !$skip_route_verify ) { |
|
3289 | + $this->_verify_route($route); |
|
3290 | + } |
|
3240 | 3291 | |
3241 | 3292 | |
3242 | 3293 | //now let's set the string for what kind of transient we're setting |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
159 | 159 | * @access public |
160 | 160 | */ |
161 | - public function __construct( $routing = TRUE ) { |
|
161 | + public function __construct($routing = TRUE) { |
|
162 | 162 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
163 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
164 | 164 | $this->_is_caf = TRUE; |
165 | 165 | |
166 | 166 | $this->_yes_no_values = array( |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | //set the _req_data property. |
174 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
174 | + $this->_req_data = array_merge($_GET, $_POST); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | //routing enabled? |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->_do_other_page_hooks(); |
193 | 193 | |
194 | 194 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
195 | + if (method_exists($this, '_before_page_setup')) |
|
196 | 196 | $this->_before_page_setup(); |
197 | 197 | |
198 | 198 | //set up page dependencies |
@@ -461,16 +461,16 @@ discard block |
||
461 | 461 | */ |
462 | 462 | protected function _global_ajax_hooks() { |
463 | 463 | //for lazy loading of metabox content |
464 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
464 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
468 | 468 | |
469 | 469 | public function ajax_metabox_content() { |
470 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
471 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
470 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
471 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
472 | 472 | |
473 | - self::cached_rss_display( $contentid, $url ); |
|
473 | + self::cached_rss_display($contentid, $url); |
|
474 | 474 | wp_die(); |
475 | 475 | } |
476 | 476 | |
@@ -489,87 +489,87 @@ discard block |
||
489 | 489 | //requires? |
490 | 490 | |
491 | 491 | //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. |
492 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
492 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
493 | 493 | |
494 | 494 | |
495 | 495 | //next verify if we need to load anything... |
496 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
497 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
496 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
497 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
498 | 498 | |
499 | 499 | global $ee_menu_slugs; |
500 | 500 | $ee_menu_slugs = (array) $ee_menu_slugs; |
501 | 501 | |
502 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
502 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
503 | 503 | |
504 | 504 | |
505 | 505 | // 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 |
506 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
507 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
506 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
507 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
508 | 508 | } |
509 | 509 | // then set blank or -1 action values to 'default' |
510 | - $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'; |
|
510 | + $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'; |
|
511 | 511 | |
512 | 512 | //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. |
513 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
513 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | 514 | |
515 | 515 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
516 | 516 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
517 | 517 | |
518 | 518 | $this->_current_view = $this->_req_action; |
519 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
519 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
520 | 520 | $this->_define_page_props(); |
521 | 521 | |
522 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
522 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
523 | 523 | |
524 | 524 | //default things |
525 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
525 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
526 | 526 | |
527 | 527 | //set page configs |
528 | 528 | $this->_set_page_routes(); |
529 | 529 | $this->_set_page_config(); |
530 | 530 | |
531 | 531 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
532 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
532 | + if (isset($this->_req_data['wp_referer'])) { |
|
533 | 533 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
534 | 534 | } |
535 | 535 | |
536 | 536 | //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 |
537 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
537 | + if (method_exists($this, '_extend_page_config')) |
|
538 | 538 | $this->_extend_page_config(); |
539 | 539 | |
540 | 540 | //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. |
541 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
541 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
542 | 542 | $this->_extend_page_config_for_cpt(); |
543 | 543 | |
544 | 544 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
545 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
546 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
545 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
546 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
547 | 547 | |
548 | 548 | |
549 | 549 | //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 |
550 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
551 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
550 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
551 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
555 | 555 | //next route only if routing enabled |
556 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
556 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
557 | 557 | |
558 | 558 | $this->_verify_routes(); |
559 | 559 | |
560 | 560 | //next let's just check user_access and kill if no access |
561 | 561 | $this->check_user_access(); |
562 | 562 | |
563 | - if ( $this->_is_UI_request ) { |
|
563 | + if ($this->_is_UI_request) { |
|
564 | 564 | //admin_init stuff - global, all views for this page class, specific view |
565 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
566 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
567 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
565 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
566 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
567 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | } else { |
571 | 571 | //hijack regular WP loading and route admin request immediately |
572 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
572 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
573 | 573 | $this->route_admin_request(); |
574 | 574 | } |
575 | 575 | } |
@@ -586,18 +586,18 @@ discard block |
||
586 | 586 | * @return void |
587 | 587 | */ |
588 | 588 | private function _do_other_page_hooks() { |
589 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
589 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
590 | 590 | |
591 | - foreach ( $registered_pages as $page ) { |
|
591 | + foreach ($registered_pages as $page) { |
|
592 | 592 | |
593 | 593 | //now let's setup the file name and class that should be present |
594 | 594 | $classname = str_replace('.class.php', '', $page); |
595 | 595 | |
596 | 596 | //autoloaders should take care of loading file |
597 | - if ( !class_exists( $classname ) ) { |
|
598 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
599 | - $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 ); |
|
600 | - throw new EE_Error( implode( '||', $error_msg )); |
|
597 | + if ( ! class_exists($classname)) { |
|
598 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
599 | + $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); |
|
600 | + throw new EE_Error(implode('||', $error_msg)); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | $a = new ReflectionClass($classname); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | public function load_page_dependencies() { |
613 | 613 | try { |
614 | 614 | $this->_load_page_dependencies(); |
615 | - } catch ( EE_Error $e ) { |
|
615 | + } catch (EE_Error $e) { |
|
616 | 616 | $e->get_error(); |
617 | 617 | } |
618 | 618 | } |
@@ -630,16 +630,16 @@ discard block |
||
630 | 630 | $this->_current_screen = get_current_screen(); |
631 | 631 | |
632 | 632 | //load admin_notices - global, page class, and view specific |
633 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
634 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
635 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
636 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
633 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
635 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
636 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | //load network admin_notices - global, page class, and view specific |
640 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
641 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
642 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
640 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
641 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
642 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | //this will save any per_page screen options if they are present |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | //add screen options - global, page child class, and view specific |
656 | 656 | $this->_add_global_screen_options(); |
657 | 657 | $this->_add_screen_options(); |
658 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
659 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
658 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
659 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
660 | 660 | |
661 | 661 | |
662 | 662 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -667,33 +667,33 @@ discard block |
||
667 | 667 | //add feature_pointers - global, page child class, and view specific |
668 | 668 | $this->_add_feature_pointers(); |
669 | 669 | $this->_add_global_feature_pointers(); |
670 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
671 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
670 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
671 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
672 | 672 | |
673 | 673 | //enqueue scripts/styles - global, page class, and view specific |
674 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
675 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
676 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
677 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
674 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
676 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
677 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
678 | 678 | |
679 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
679 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
680 | 680 | |
681 | 681 | //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 |
682 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
684 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
685 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
682 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
684 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
685 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
686 | 686 | |
687 | 687 | //admin footer scripts |
688 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
689 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
690 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
691 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
688 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
690 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
691 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
692 | 692 | |
693 | 693 | |
694 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
694 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
695 | 695 | //targeted hook |
696 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
696 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
697 | 697 | |
698 | 698 | } |
699 | 699 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | private function _set_defaults() { |
709 | 709 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
710 | 710 | |
711 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
711 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | 712 | |
713 | 713 | $this->default_nav_tab_name = 'overview'; |
714 | 714 | |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | public function route_admin_request() { |
736 | 736 | try { |
737 | 737 | $this->_route_admin_request(); |
738 | - } catch ( EE_Error $e ) { |
|
738 | + } catch (EE_Error $e) { |
|
739 | 739 | $e->get_error(); |
740 | 740 | } |
741 | 741 | } |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | $this->_wp_page_slug = $wp_page_slug; |
747 | 747 | |
748 | 748 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
749 | - if ( is_network_admin() ) { |
|
749 | + if (is_network_admin()) { |
|
750 | 750 | $this->_wp_page_slug .= '-network'; |
751 | 751 | } |
752 | 752 | } |
@@ -758,53 +758,53 @@ discard block |
||
758 | 758 | * @access protected |
759 | 759 | */ |
760 | 760 | protected function _verify_routes() { |
761 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
761 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
762 | 762 | |
763 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return; |
|
763 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return; |
|
764 | 764 | |
765 | 765 | $this->_route = FALSE; |
766 | 766 | $func = FALSE; |
767 | 767 | $args = array(); |
768 | 768 | |
769 | 769 | // check that the page_routes array is not empty |
770 | - if ( empty( $this->_page_routes )) { |
|
770 | + if (empty($this->_page_routes)) { |
|
771 | 771 | // user error msg |
772 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
772 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
773 | 773 | // developer error msg |
774 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
775 | - throw new EE_Error( $error_msg ); |
|
774 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
775 | + throw new EE_Error($error_msg); |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | // and that the requested page route exists |
779 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
780 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
779 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
780 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
781 | 781 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
782 | 782 | } else { |
783 | 783 | // user error msg |
784 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
784 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
785 | 785 | // developer error msg |
786 | - $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 ); |
|
787 | - throw new EE_Error( $error_msg ); |
|
786 | + $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); |
|
787 | + throw new EE_Error($error_msg); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | // and that a default route exists |
791 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
791 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
792 | 792 | // user error msg |
793 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
793 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
794 | 794 | // developer error msg |
795 | - $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' ); |
|
796 | - throw new EE_Error( $error_msg ); |
|
795 | + $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'); |
|
796 | + throw new EE_Error($error_msg); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | |
800 | 800 | //first lets' catch if the UI request has EVER been set. |
801 | - if ( $this->_is_UI_request === NULL ) { |
|
801 | + if ($this->_is_UI_request === NULL) { |
|
802 | 802 | //lets set if this is a UI request or not. |
803 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
803 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
804 | 804 | |
805 | 805 | |
806 | 806 | //wait a minute... we might have a noheader in the route array |
807 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
807 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | $this->_set_current_labels(); |
@@ -819,15 +819,15 @@ discard block |
||
819 | 819 | * @param string $route the route name we're verifying |
820 | 820 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
821 | 821 | */ |
822 | - protected function _verify_route( $route ) { |
|
823 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
822 | + protected function _verify_route($route) { |
|
823 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
824 | 824 | return true; |
825 | 825 | } else { |
826 | 826 | // user error msg |
827 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
827 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
828 | 828 | // developer error msg |
829 | - $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 ); |
|
830 | - throw new EE_Error( $error_msg ); |
|
829 | + $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); |
|
830 | + throw new EE_Error($error_msg); |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | |
@@ -841,18 +841,18 @@ discard block |
||
841 | 841 | * @param string $nonce_ref The nonce reference string (name0) |
842 | 842 | * @return mixed (bool|die) |
843 | 843 | */ |
844 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
844 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
845 | 845 | // verify nonce against expected value |
846 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
846 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
847 | 847 | // these are not the droids you are looking for !!! |
848 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
849 | - if ( WP_DEBUG ) { |
|
850 | - $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__ ); |
|
848 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
849 | + if (WP_DEBUG) { |
|
850 | + $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__); |
|
851 | 851 | } |
852 | - if ( ! defined( 'DOING_AJAX' )) { |
|
853 | - wp_die( $msg ); |
|
852 | + if ( ! defined('DOING_AJAX')) { |
|
853 | + wp_die($msg); |
|
854 | 854 | } else { |
855 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
855 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
856 | 856 | $this->_return_json(); |
857 | 857 | } |
858 | 858 | } |
@@ -870,63 +870,63 @@ discard block |
||
870 | 870 | * @return void |
871 | 871 | */ |
872 | 872 | protected function _route_admin_request() { |
873 | - if ( ! $this->_is_UI_request ) |
|
873 | + if ( ! $this->_is_UI_request) |
|
874 | 874 | $this->_verify_routes(); |
875 | 875 | |
876 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
876 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
877 | 877 | |
878 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
878 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
879 | 879 | // set nonce from post data |
880 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
881 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
880 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
881 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
882 | 882 | } |
883 | 883 | //set the nav_tabs array but ONLY if this is UI_request |
884 | - if ( $this->_is_UI_request ) |
|
884 | + if ($this->_is_UI_request) |
|
885 | 885 | $this->_set_nav_tabs(); |
886 | 886 | |
887 | 887 | // grab callback function |
888 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
888 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
889 | 889 | |
890 | 890 | // check if callback has args |
891 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
891 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
892 | 892 | |
893 | 893 | $error_msg = ''; |
894 | 894 | |
895 | 895 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
896 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
897 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
896 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
897 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | //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). |
901 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
901 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
902 | 902 | |
903 | - if ( ! empty( $func )) { |
|
903 | + if ( ! empty($func)) { |
|
904 | 904 | $base_call = $addon_call = FALSE; |
905 | 905 | //try to access page route via this class |
906 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
906 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
907 | 907 | // user error msg |
908 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
908 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
909 | 909 | // developer error msg |
910 | - $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 ); |
|
910 | + $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); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | //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) |
914 | 914 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
915 | 915 | |
916 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
917 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
918 | - $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 ); |
|
916 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
917 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
918 | + $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); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
922 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
923 | - throw new EE_Error( $error_msg ); |
|
922 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
923 | + throw new EE_Error($error_msg); |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | //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. |
927 | 927 | //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. |
928 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
929 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
928 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
929 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
930 | 930 | } |
931 | 931 | } |
932 | 932 | |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | * @param string $new_route New (non header) route to redirect to. |
943 | 943 | * @return void |
944 | 944 | */ |
945 | - protected function _reset_routing_properties( $new_route ) { |
|
945 | + protected function _reset_routing_properties($new_route) { |
|
946 | 946 | $this->_is_UI_request = TRUE; |
947 | 947 | //now we set the current route to whatever the headers_sent_route is set at |
948 | 948 | $this->_req_data['action'] = $new_route; |
@@ -988,23 +988,23 @@ discard block |
||
988 | 988 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
989 | 989 | * @return string |
990 | 990 | */ |
991 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
991 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
992 | 992 | |
993 | 993 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
994 | - if ( $sticky ) { |
|
994 | + if ($sticky) { |
|
995 | 995 | $request = $_REQUEST; |
996 | - unset( $request['_wp_http_referer'] ); |
|
997 | - unset( $request['wp_referer'] ); |
|
998 | - foreach ( $request as $key => $value ) { |
|
996 | + unset($request['_wp_http_referer']); |
|
997 | + unset($request['wp_referer']); |
|
998 | + foreach ($request as $key => $value) { |
|
999 | 999 | //do not add nonces |
1000 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1000 | + if (strpos($key, 'nonce') !== false) { |
|
1001 | 1001 | continue; |
1002 | 1002 | } |
1003 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1003 | + $args['wp_referer['.$key.']'] = $value; |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | |
1007 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1007 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | |
@@ -1020,8 +1020,8 @@ discard block |
||
1020 | 1020 | * @uses EEH_Template::get_help_tab_link() |
1021 | 1021 | * @return string generated link |
1022 | 1022 | */ |
1023 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1024 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1023 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1024 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
@@ -1038,30 +1038,30 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | protected function _add_help_tabs() { |
1040 | 1040 | $tour_buttons = ''; |
1041 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1041 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1042 | 1042 | $config = $this->_page_config[$this->_req_action]; |
1043 | 1043 | |
1044 | 1044 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1045 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1045 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1046 | 1046 | $tb = array(); |
1047 | 1047 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1048 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1048 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1049 | 1049 | //if this is the end tour then we don't need to setup a button |
1050 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1050 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1051 | 1051 | continue; |
1052 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1052 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1053 | 1053 | } |
1054 | 1054 | $tour_buttons .= implode('<br />', $tb); |
1055 | 1055 | $tour_buttons .= '</div></div>'; |
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1059 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1059 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1060 | 1060 | //check that the callback given is valid |
1061 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1062 | - 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) ) ); |
|
1061 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1062 | + 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))); |
|
1063 | 1063 | |
1064 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1064 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1065 | 1065 | |
1066 | 1066 | $content .= $tour_buttons; //add help tour buttons. |
1067 | 1067 | |
@@ -1070,49 +1070,49 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1073 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1073 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1074 | 1074 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1078 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1078 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1079 | 1079 | $_ht['id'] = $this->page_slug; |
1080 | 1080 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1081 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1081 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1082 | 1082 | $this->_current_screen->add_help_tab($_ht); |
1083 | 1083 | }/**/ |
1084 | 1084 | |
1085 | 1085 | |
1086 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1086 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1087 | 1087 | |
1088 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1088 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1089 | 1089 | //we're here so there ARE help tabs! |
1090 | 1090 | |
1091 | 1091 | //make sure we've got what we need |
1092 | - if ( !isset( $cfg['title'] ) ) |
|
1093 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1092 | + if ( ! isset($cfg['title'])) |
|
1093 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1094 | 1094 | |
1095 | 1095 | |
1096 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1097 | - 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') ); |
|
1096 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1097 | + 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')); |
|
1098 | 1098 | |
1099 | 1099 | |
1100 | 1100 | |
1101 | 1101 | //first priority goes to content. |
1102 | - if ( !empty($cfg['content'] ) ) { |
|
1103 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1102 | + if ( ! empty($cfg['content'])) { |
|
1103 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1104 | 1104 | |
1105 | 1105 | //second priority goes to filename |
1106 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1107 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1106 | + } else if ( ! empty($cfg['filename'])) { |
|
1107 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1108 | 1108 | |
1109 | 1109 | |
1110 | 1110 | //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) |
1111 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1111 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1112 | 1112 | |
1113 | 1113 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1114 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1115 | - 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__ ); |
|
1114 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1115 | + 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__); |
|
1116 | 1116 | return; |
1117 | 1117 | } |
1118 | 1118 | $template_args['admin_page_obj'] = $this; |
@@ -1123,21 +1123,21 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | |
1125 | 1125 | //check if callback is valid |
1126 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1127 | - 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__ ); |
|
1126 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1127 | + 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__); |
|
1128 | 1128 | return; |
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | //setup config array for help tab method |
1132 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1132 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1133 | 1133 | $_ht = array( |
1134 | 1134 | 'id' => $id, |
1135 | 1135 | 'title' => $cfg['title'], |
1136 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1136 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1137 | 1137 | 'content' => $content |
1138 | 1138 | ); |
1139 | 1139 | |
1140 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1140 | + $this->_current_screen->add_help_tab($_ht); |
|
1141 | 1141 | } |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1157,49 +1157,49 @@ discard block |
||
1157 | 1157 | $this->_help_tour = array(); |
1158 | 1158 | |
1159 | 1159 | //exit early if help tours are turned off globally |
1160 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1160 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1161 | 1161 | return; |
1162 | 1162 | |
1163 | 1163 | //loop through _page_config to find any help_tour defined |
1164 | - foreach ( $this->_page_config as $route => $config ) { |
|
1164 | + foreach ($this->_page_config as $route => $config) { |
|
1165 | 1165 | //we're only going to set things up for this route |
1166 | - if ( $route !== $this->_req_action ) |
|
1166 | + if ($route !== $this->_req_action) |
|
1167 | 1167 | continue; |
1168 | 1168 | |
1169 | - if ( isset( $config['help_tour'] ) ) { |
|
1169 | + if (isset($config['help_tour'])) { |
|
1170 | 1170 | |
1171 | - foreach( $config['help_tour'] as $tour ) { |
|
1172 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1171 | + foreach ($config['help_tour'] as $tour) { |
|
1172 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1173 | 1173 | //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 |
1174 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1174 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1175 | 1175 | |
1176 | 1176 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1177 | - if ( !is_readable($file_path) ) { |
|
1178 | - 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__ ); |
|
1177 | + if ( ! is_readable($file_path)) { |
|
1178 | + 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__); |
|
1179 | 1179 | return; |
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | require_once $file_path; |
1183 | - if ( !class_exists( $tour ) ) { |
|
1184 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1185 | - $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) ); |
|
1186 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1183 | + if ( ! class_exists($tour)) { |
|
1184 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1185 | + $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)); |
|
1186 | + throw new EE_Error(implode('||', $error_msg)); |
|
1187 | 1187 | } |
1188 | 1188 | $a = new ReflectionClass($tour); |
1189 | 1189 | $tour_obj = $a->newInstance($this->_is_caf); |
1190 | 1190 | |
1191 | 1191 | $tours[] = $tour_obj; |
1192 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1192 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1196 | 1196 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1197 | 1197 | $tours[] = $end_stop_tour; |
1198 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1198 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - if ( !empty( $tours ) ) |
|
1202 | + if ( ! empty($tours)) |
|
1203 | 1203 | $this->_help_tour['tours'] = $tours; |
1204 | 1204 | |
1205 | 1205 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1215,12 +1215,12 @@ discard block |
||
1215 | 1215 | * @return void |
1216 | 1216 | */ |
1217 | 1217 | protected function _add_qtips() { |
1218 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1218 | + if (isset($this->_route_config['qtips'])) { |
|
1219 | 1219 | $qtips = (array) $this->_route_config['qtips']; |
1220 | 1220 | //load qtip loader |
1221 | 1221 | $path = array( |
1222 | - $this->_get_dir() . '/qtips/', |
|
1223 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1222 | + $this->_get_dir().'/qtips/', |
|
1223 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1224 | 1224 | ); |
1225 | 1225 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1226 | 1226 | } |
@@ -1237,41 +1237,41 @@ discard block |
||
1237 | 1237 | * @return void |
1238 | 1238 | */ |
1239 | 1239 | protected function _set_nav_tabs() { |
1240 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1240 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1241 | 1241 | $i = 0; |
1242 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1243 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1242 | + foreach ($this->_page_config as $slug => $config) { |
|
1243 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1244 | 1244 | continue; //no nav tab for this config |
1245 | 1245 | |
1246 | 1246 | //check for persistent flag |
1247 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1247 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1248 | 1248 | continue; //nav tab is only to appear when route requested. |
1249 | 1249 | |
1250 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1250 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1251 | 1251 | continue; //no nav tab becasue current user does not have access. |
1252 | 1252 | |
1253 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1253 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1254 | 1254 | $this->_nav_tabs[$slug] = array( |
1255 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1256 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1257 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1258 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1255 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1256 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1257 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1258 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1259 | 1259 | ); |
1260 | 1260 | $i++; |
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | //if $this->_nav_tabs is empty then lets set the default |
1264 | - if ( empty( $this->_nav_tabs ) ) { |
|
1264 | + if (empty($this->_nav_tabs)) { |
|
1265 | 1265 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1266 | 1266 | 'url' => $this->admin_base_url, |
1267 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1267 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1268 | 1268 | 'css_class' => 'nav-tab-active', |
1269 | 1269 | 'order' => 10 |
1270 | 1270 | ); |
1271 | 1271 | } |
1272 | 1272 | |
1273 | 1273 | //now let's sort the tabs according to order |
1274 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1274 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1275 | 1275 | |
1276 | 1276 | } |
1277 | 1277 | |
@@ -1287,10 +1287,10 @@ discard block |
||
1287 | 1287 | * @return void |
1288 | 1288 | */ |
1289 | 1289 | private function _set_current_labels() { |
1290 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1291 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1292 | - if ( is_array($text) ) { |
|
1293 | - foreach ( $text as $sublabel => $subtext ) { |
|
1290 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1291 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1292 | + if (is_array($text)) { |
|
1293 | + foreach ($text as $sublabel => $subtext) { |
|
1294 | 1294 | $this->_labels[$label][$sublabel] = $subtext; |
1295 | 1295 | } |
1296 | 1296 | } else { |
@@ -1311,24 +1311,24 @@ discard block |
||
1311 | 1311 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1312 | 1312 | * @return BOOL|wp_die() |
1313 | 1313 | */ |
1314 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1315 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1316 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1317 | - $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; |
|
1314 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1315 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1316 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1317 | + $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; |
|
1318 | 1318 | |
1319 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1320 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1319 | + if (empty($capability) && empty($route_to_check)) { |
|
1320 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1321 | 1321 | } else { |
1322 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1322 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1325 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1326 | 1326 | |
1327 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1328 | - if ( $verify_only ) { |
|
1327 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1328 | + if ($verify_only) { |
|
1329 | 1329 | return FALSE; |
1330 | 1330 | } else { |
1331 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1331 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1332 | 1332 | } |
1333 | 1333 | } |
1334 | 1334 | return TRUE; |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | $this->_add_admin_page_overlay(); |
1406 | 1406 | |
1407 | 1407 | //if metaboxes are present we need to add the nonce field |
1408 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1408 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1409 | 1409 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1410 | 1410 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1411 | 1411 | } |
@@ -1424,19 +1424,19 @@ discard block |
||
1424 | 1424 | */ |
1425 | 1425 | public function admin_footer_global() { |
1426 | 1426 | //dialog container for dialog helper |
1427 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1427 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1428 | 1428 | $d_cont .= '<div class="ee-notices"></div>'; |
1429 | 1429 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1430 | 1430 | $d_cont .= '</div>'; |
1431 | 1431 | echo $d_cont; |
1432 | 1432 | |
1433 | 1433 | //help tour stuff? |
1434 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1434 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1435 | 1435 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | //current set timezone for timezone js |
1439 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1439 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | |
@@ -1460,18 +1460,18 @@ discard block |
||
1460 | 1460 | * @access protected |
1461 | 1461 | * @return string content |
1462 | 1462 | */ |
1463 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1463 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1464 | 1464 | $content = ''; |
1465 | 1465 | |
1466 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1467 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1466 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1467 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1468 | 1468 | |
1469 | 1469 | |
1470 | 1470 | //loop through the array and setup content |
1471 | - foreach ( $help_array as $trigger => $help ) { |
|
1471 | + foreach ($help_array as $trigger => $help) { |
|
1472 | 1472 | //make sure the array is setup properly |
1473 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1474 | - 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') ); |
|
1473 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1474 | + 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')); |
|
1475 | 1475 | } |
1476 | 1476 | |
1477 | 1477 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1481,10 +1481,10 @@ discard block |
||
1481 | 1481 | 'help_popup_content' => $help['content'] |
1482 | 1482 | ); |
1483 | 1483 | |
1484 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1484 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1485 | 1485 | } |
1486 | 1486 | |
1487 | - if ( $display ) |
|
1487 | + if ($display) |
|
1488 | 1488 | echo $content; |
1489 | 1489 | else |
1490 | 1490 | return $content; |
@@ -1501,18 +1501,18 @@ discard block |
||
1501 | 1501 | */ |
1502 | 1502 | private function _get_help_content() { |
1503 | 1503 | //what is the method we're looking for? |
1504 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1504 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1505 | 1505 | |
1506 | 1506 | //if method doesn't exist let's get out. |
1507 | - if ( !method_exists( $this, $method_name ) ) |
|
1507 | + if ( ! method_exists($this, $method_name)) |
|
1508 | 1508 | return array(); |
1509 | 1509 | |
1510 | 1510 | //k we're good to go let's retrieve the help array |
1511 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1511 | + $help_array = call_user_func(array($this, $method_name)); |
|
1512 | 1512 | |
1513 | 1513 | //make sure we've got an array! |
1514 | - if ( !is_array($help_array) ) { |
|
1515 | - 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' ) ); |
|
1514 | + if ( ! is_array($help_array)) { |
|
1515 | + 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')); |
|
1516 | 1516 | } |
1517 | 1517 | |
1518 | 1518 | return $help_array; |
@@ -1534,27 +1534,27 @@ discard block |
||
1534 | 1534 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1535 | 1535 | * @return string |
1536 | 1536 | */ |
1537 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1537 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1538 | 1538 | |
1539 | - if ( defined('DOING_AJAX') ) return; |
|
1539 | + if (defined('DOING_AJAX')) return; |
|
1540 | 1540 | |
1541 | 1541 | //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 |
1542 | 1542 | $help_array = $this->_get_help_content(); |
1543 | 1543 | $help_content = ''; |
1544 | 1544 | |
1545 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1545 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1546 | 1546 | $help_array[$trigger_id] = array( |
1547 | 1547 | 'title' => __('Missing Content', 'event_espresso'), |
1548 | 1548 | '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') |
1549 | 1549 | ); |
1550 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1550 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1551 | 1551 | } |
1552 | 1552 | |
1553 | 1553 | //let's setup the trigger |
1554 | - $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>'; |
|
1555 | - $content = $content . $help_content; |
|
1554 | + $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>'; |
|
1555 | + $content = $content.$help_content; |
|
1556 | 1556 | |
1557 | - if ( $display ) |
|
1557 | + if ($display) |
|
1558 | 1558 | echo $content; |
1559 | 1559 | else |
1560 | 1560 | return $content; |
@@ -1611,15 +1611,15 @@ discard block |
||
1611 | 1611 | public function load_global_scripts_styles() { |
1612 | 1612 | /** STYLES **/ |
1613 | 1613 | // add debugging styles |
1614 | - if ( WP_DEBUG ) { |
|
1615 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1614 | + if (WP_DEBUG) { |
|
1615 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1616 | 1616 | } |
1617 | 1617 | |
1618 | 1618 | //register all styles |
1619 | - 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 ); |
|
1620 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1619 | + 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); |
|
1620 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | 1621 | //helpers styles |
1622 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1622 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1623 | 1623 | //enqueue global styles |
1624 | 1624 | wp_enqueue_style('ee-admin-css'); |
1625 | 1625 | |
@@ -1627,66 +1627,66 @@ discard block |
||
1627 | 1627 | /** SCRIPTS **/ |
1628 | 1628 | |
1629 | 1629 | //register all scripts |
1630 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1631 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1632 | - 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 ); |
|
1630 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1631 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1632 | + 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); |
|
1633 | 1633 | |
1634 | - 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 ); |
|
1634 | + 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); |
|
1635 | 1635 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1636 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1636 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1637 | 1637 | add_filter('FHEE_load_joyride', '__return_true'); |
1638 | 1638 | |
1639 | 1639 | //script for sorting tables |
1640 | - 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); |
|
1640 | + 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); |
|
1641 | 1641 | //script for parsing uri's |
1642 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1642 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | //and parsing associative serialized form elements |
1644 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | 1645 | //helpers scripts |
1646 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1647 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1648 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1648 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1649 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | 1650 | |
1651 | 1651 | //google charts |
1652 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1652 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1653 | 1653 | |
1654 | 1654 | //enqueue global scripts |
1655 | 1655 | |
1656 | 1656 | //taking care of metaboxes |
1657 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1657 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1658 | 1658 | wp_enqueue_script('dashboard'); |
1659 | 1659 | } |
1660 | 1660 | |
1661 | 1661 | //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 |
1662 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1662 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1663 | 1663 | wp_enqueue_script('ee_admin_js'); |
1664 | 1664 | wp_enqueue_style('ee-admin-css'); |
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | |
1668 | 1668 | //localize script for ajax lazy loading |
1669 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1670 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1669 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1670 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1671 | 1671 | |
1672 | 1672 | |
1673 | 1673 | /** |
1674 | 1674 | * help tour stuff |
1675 | 1675 | */ |
1676 | - if ( !empty( $this->_help_tour ) ) { |
|
1676 | + if ( ! empty($this->_help_tour)) { |
|
1677 | 1677 | |
1678 | 1678 | //register the js for kicking things off |
1679 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1679 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1680 | 1680 | |
1681 | 1681 | //setup tours for the js tour object |
1682 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1682 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1683 | 1683 | $tours[] = array( |
1684 | 1684 | 'id' => $tour->get_slug(), |
1685 | 1685 | 'options' => $tour->get_options() |
1686 | 1686 | ); |
1687 | 1687 | } |
1688 | 1688 | |
1689 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1689 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1690 | 1690 | |
1691 | 1691 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1692 | 1692 | } |
@@ -1704,52 +1704,52 @@ discard block |
||
1704 | 1704 | public function admin_footer_scripts_eei18n_js_strings() { |
1705 | 1705 | |
1706 | 1706 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1707 | - 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' ); |
|
1708 | - |
|
1709 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1710 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1711 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1733 | - |
|
1734 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1735 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1736 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1707 | + 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'); |
|
1708 | + |
|
1709 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1710 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1711 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1733 | + |
|
1734 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1735 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1736 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1748 | 1748 | |
1749 | 1749 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1750 | 1750 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1751 | 1751 | //espresso_core is listed as a dependency of ee_admin_js. |
1752 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1752 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1753 | 1753 | |
1754 | 1754 | } |
1755 | 1755 | |
@@ -1783,23 +1783,23 @@ discard block |
||
1783 | 1783 | protected function _set_list_table() { |
1784 | 1784 | |
1785 | 1785 | //first is this a list_table view? |
1786 | - if ( !isset($this->_route_config['list_table']) ) |
|
1786 | + if ( ! isset($this->_route_config['list_table'])) |
|
1787 | 1787 | return; //not a list_table view so get out. |
1788 | 1788 | |
1789 | 1789 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1790 | 1790 | |
1791 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1791 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1792 | 1792 | //user error msg |
1793 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1793 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1794 | 1794 | //developer error msg |
1795 | - $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 ); |
|
1796 | - throw new EE_Error( $error_msg ); |
|
1795 | + $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); |
|
1796 | + throw new EE_Error($error_msg); |
|
1797 | 1797 | } |
1798 | 1798 | |
1799 | 1799 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1800 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1801 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1802 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1800 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1801 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1802 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1803 | 1803 | |
1804 | 1804 | $this->_set_list_table_view(); |
1805 | 1805 | $this->_set_list_table_object(); |
@@ -1821,14 +1821,14 @@ discard block |
||
1821 | 1821 | * @return array |
1822 | 1822 | */ |
1823 | 1823 | protected function _set_list_table_view() { |
1824 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1824 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1825 | 1825 | |
1826 | 1826 | |
1827 | 1827 | // looking at active items or dumpster diving ? |
1828 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1829 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1828 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1829 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1830 | 1830 | } else { |
1831 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1831 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1832 | 1832 | } |
1833 | 1833 | } |
1834 | 1834 | |
@@ -1841,8 +1841,8 @@ discard block |
||
1841 | 1841 | * @throws \EE_Error |
1842 | 1842 | */ |
1843 | 1843 | protected function _set_list_table_object() { |
1844 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1845 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1844 | + if (isset($this->_route_config['list_table'])) { |
|
1845 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1846 | 1846 | throw new EE_Error( |
1847 | 1847 | sprintf( |
1848 | 1848 | __( |
@@ -1850,12 +1850,12 @@ discard block |
||
1850 | 1850 | 'event_espresso' |
1851 | 1851 | ), |
1852 | 1852 | $this->_route_config['list_table'], |
1853 | - get_class( $this ) |
|
1853 | + get_class($this) |
|
1854 | 1854 | ) |
1855 | 1855 | ); |
1856 | 1856 | } |
1857 | 1857 | $list_table = $this->_route_config['list_table']; |
1858 | - $this->_list_table_object = new $list_table( $this ); |
|
1858 | + $this->_list_table_object = new $list_table($this); |
|
1859 | 1859 | } |
1860 | 1860 | } |
1861 | 1861 | |
@@ -1872,27 +1872,27 @@ discard block |
||
1872 | 1872 | * |
1873 | 1873 | * @return array |
1874 | 1874 | */ |
1875 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1875 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1876 | 1876 | |
1877 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1877 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1878 | 1878 | |
1879 | - if ( empty( $this->_views )) { |
|
1879 | + if (empty($this->_views)) { |
|
1880 | 1880 | $this->_views = array(); |
1881 | 1881 | } |
1882 | 1882 | |
1883 | 1883 | // cycle thru views |
1884 | - foreach ( $this->_views as $key => $view ) { |
|
1884 | + foreach ($this->_views as $key => $view) { |
|
1885 | 1885 | $query_args = array(); |
1886 | 1886 | // check for current view |
1887 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1887 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1888 | 1888 | $query_args['action'] = $this->_req_action; |
1889 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1889 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1890 | 1890 | $query_args['status'] = $view['slug']; |
1891 | 1891 | //merge any other arguments sent in. |
1892 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1893 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1892 | + if (isset($extra_query_args[$view['slug']])) { |
|
1893 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1894 | 1894 | } |
1895 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1895 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1896 | 1896 | } |
1897 | 1897 | |
1898 | 1898 | return $this->_views; |
@@ -1909,15 +1909,15 @@ discard block |
||
1909 | 1909 | * @param int $max_entries total number of rows in the table |
1910 | 1910 | * @return string |
1911 | 1911 | */ |
1912 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1912 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1913 | 1913 | |
1914 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1915 | - $values = array( 10, 25, 50, 100 ); |
|
1916 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1914 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1915 | + $values = array(10, 25, 50, 100); |
|
1916 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1917 | 1917 | |
1918 | - if ( $max_entries ) { |
|
1918 | + if ($max_entries) { |
|
1919 | 1919 | $values[] = $max_entries; |
1920 | - sort( $values ); |
|
1920 | + sort($values); |
|
1921 | 1921 | } |
1922 | 1922 | |
1923 | 1923 | $entries_per_page_dropdown = ' |
@@ -1926,15 +1926,15 @@ discard block |
||
1926 | 1926 | Show |
1927 | 1927 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1928 | 1928 | |
1929 | - foreach ( $values as $value ) { |
|
1930 | - if ( $value < $max_entries ) { |
|
1931 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1929 | + foreach ($values as $value) { |
|
1930 | + if ($value < $max_entries) { |
|
1931 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1932 | 1932 | $entries_per_page_dropdown .= ' |
1933 | 1933 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1934 | 1934 | } |
1935 | 1935 | } |
1936 | 1936 | |
1937 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1937 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1938 | 1938 | $entries_per_page_dropdown .= ' |
1939 | 1939 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1940 | 1940 | |
@@ -1957,8 +1957,8 @@ discard block |
||
1957 | 1957 | * @return void |
1958 | 1958 | */ |
1959 | 1959 | public function _set_search_attributes() { |
1960 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1961 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1960 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1961 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1962 | 1962 | } |
1963 | 1963 | |
1964 | 1964 | /*** END LIST TABLE METHODS **/ |
@@ -1977,10 +1977,10 @@ discard block |
||
1977 | 1977 | * @return void |
1978 | 1978 | */ |
1979 | 1979 | private function _add_registered_meta_boxes() { |
1980 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1980 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1981 | 1981 | |
1982 | 1982 | //we only add meta boxes if the page_route calls for it |
1983 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1983 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1984 | 1984 | && is_array( |
1985 | 1985 | $this->_route_config['metaboxes'] |
1986 | 1986 | ) |
@@ -1988,27 +1988,27 @@ discard block |
||
1988 | 1988 | // this simply loops through the callbacks provided |
1989 | 1989 | // and checks if there is a corresponding callback registered by the child |
1990 | 1990 | // if there is then we go ahead and process the metabox loader. |
1991 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1991 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1992 | 1992 | // first check for Closures |
1993 | - if ( $metabox_callback instanceof Closure ) { |
|
1993 | + if ($metabox_callback instanceof Closure) { |
|
1994 | 1994 | $result = $metabox_callback(); |
1995 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1996 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1995 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1996 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1997 | 1997 | } else { |
1998 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
1998 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
1999 | 1999 | } |
2000 | - if ( $result === FALSE ) { |
|
2000 | + if ($result === FALSE) { |
|
2001 | 2001 | // user error msg |
2002 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2002 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2003 | 2003 | // developer error msg |
2004 | - $error_msg .= '||' . sprintf( |
|
2004 | + $error_msg .= '||'.sprintf( |
|
2005 | 2005 | __( |
2006 | 2006 | '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.', |
2007 | 2007 | 'event_espresso' |
2008 | 2008 | ), |
2009 | 2009 | $metabox_callback |
2010 | 2010 | ); |
2011 | - throw new EE_Error( $error_msg ); |
|
2011 | + throw new EE_Error($error_msg); |
|
2012 | 2012 | } |
2013 | 2013 | } |
2014 | 2014 | } |
@@ -2025,17 +2025,17 @@ discard block |
||
2025 | 2025 | * @return void |
2026 | 2026 | */ |
2027 | 2027 | private function _add_screen_columns() { |
2028 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
2028 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
2029 | 2029 | |
2030 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2030 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2031 | 2031 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2032 | 2032 | $screen_id = $this->_current_screen->id; |
2033 | 2033 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2034 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2035 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2034 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2035 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2036 | 2036 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2037 | 2037 | $this->_template_args['screen'] = $this->_current_screen; |
2038 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2038 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2039 | 2039 | |
2040 | 2040 | //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. |
2041 | 2041 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2052,11 +2052,11 @@ discard block |
||
2052 | 2052 | */ |
2053 | 2053 | |
2054 | 2054 | private function _espresso_news_post_box() { |
2055 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2056 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2055 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2056 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2057 | 2057 | $this, |
2058 | 2058 | 'espresso_news_post_box' |
2059 | - ), $this->_wp_page_slug, 'side' ); |
|
2059 | + ), $this->_wp_page_slug, 'side'); |
|
2060 | 2060 | } |
2061 | 2061 | |
2062 | 2062 | |
@@ -2064,14 +2064,14 @@ discard block |
||
2064 | 2064 | * Code for setting up espresso ratings request metabox. |
2065 | 2065 | */ |
2066 | 2066 | protected function _espresso_ratings_request() { |
2067 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2067 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2068 | 2068 | return ''; |
2069 | 2069 | } |
2070 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2071 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2070 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2071 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2072 | 2072 | $this, |
2073 | 2073 | 'espresso_ratings_request' |
2074 | - ), $this->_wp_page_slug, 'side' ); |
|
2074 | + ), $this->_wp_page_slug, 'side'); |
|
2075 | 2075 | } |
2076 | 2076 | |
2077 | 2077 | |
@@ -2079,34 +2079,34 @@ discard block |
||
2079 | 2079 | * Code for setting up espresso ratings request metabox content. |
2080 | 2080 | */ |
2081 | 2081 | public function espresso_ratings_request() { |
2082 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2083 | - EEH_Template::display_template( $template_path, array() ); |
|
2082 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2083 | + EEH_Template::display_template($template_path, array()); |
|
2084 | 2084 | } |
2085 | 2085 | |
2086 | 2086 | |
2087 | 2087 | |
2088 | 2088 | |
2089 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2090 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2091 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2092 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2093 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2094 | - $post = '</div>' . "\n"; |
|
2089 | + public static function cached_rss_display($rss_id, $url) { |
|
2090 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2091 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2092 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2093 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2094 | + $post = '</div>'."\n"; |
|
2095 | 2095 | |
2096 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2097 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2098 | - echo $pre . $output . $post; |
|
2096 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2097 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2098 | + echo $pre.$output.$post; |
|
2099 | 2099 | return TRUE; |
2100 | 2100 | } |
2101 | 2101 | |
2102 | - if ( ! $doing_ajax ) { |
|
2103 | - echo $pre . $loading . $post; |
|
2102 | + if ( ! $doing_ajax) { |
|
2103 | + echo $pre.$loading.$post; |
|
2104 | 2104 | return FALSE; |
2105 | 2105 | } |
2106 | 2106 | |
2107 | 2107 | ob_start(); |
2108 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2109 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2108 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2109 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2110 | 2110 | return TRUE; |
2111 | 2111 | |
2112 | 2112 | } |
@@ -2118,13 +2118,13 @@ discard block |
||
2118 | 2118 | <div id="espresso_news_post_box_content" class="infolinks"> |
2119 | 2119 | <?php |
2120 | 2120 | // Get RSS Feed(s) |
2121 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2121 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2122 | 2122 | $url = urlencode($feed_url); |
2123 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2123 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2124 | 2124 | |
2125 | 2125 | ?> |
2126 | 2126 | </div> |
2127 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2127 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2128 | 2128 | </div> |
2129 | 2129 | <?php |
2130 | 2130 | } |
@@ -2145,32 +2145,32 @@ discard block |
||
2145 | 2145 | |
2146 | 2146 | protected function _espresso_sponsors_post_box() { |
2147 | 2147 | |
2148 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2149 | - if ( $show_sponsors ) |
|
2150 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2148 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2149 | + if ($show_sponsors) |
|
2150 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2151 | 2151 | } |
2152 | 2152 | |
2153 | 2153 | |
2154 | 2154 | public function espresso_sponsors_post_box() { |
2155 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2156 | - EEH_Template::display_template( $templatepath ); |
|
2155 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2156 | + EEH_Template::display_template($templatepath); |
|
2157 | 2157 | } |
2158 | 2158 | |
2159 | 2159 | |
2160 | 2160 | |
2161 | 2161 | private function _publish_post_box() { |
2162 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2162 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2163 | 2163 | |
2164 | 2164 | //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) |
2165 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2166 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2165 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2166 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2167 | 2167 | } else { |
2168 | 2168 | $box_label = __('Publish', 'event_espresso'); |
2169 | 2169 | } |
2170 | 2170 | |
2171 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2171 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2172 | 2172 | |
2173 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2173 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2174 | 2174 | |
2175 | 2175 | } |
2176 | 2176 | |
@@ -2178,9 +2178,9 @@ discard block |
||
2178 | 2178 | |
2179 | 2179 | public function editor_overview() { |
2180 | 2180 | //if we have extra content set let's add it in if not make sure its empty |
2181 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2182 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2183 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2181 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2182 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2183 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2184 | 2184 | } |
2185 | 2185 | |
2186 | 2186 | |
@@ -2196,8 +2196,8 @@ discard block |
||
2196 | 2196 | * @see $this->_set_publish_post_box_vars for param details |
2197 | 2197 | * @since 4.6.0 |
2198 | 2198 | */ |
2199 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2200 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2199 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2200 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2201 | 2201 | } |
2202 | 2202 | |
2203 | 2203 | |
@@ -2225,17 +2225,17 @@ discard block |
||
2225 | 2225 | $both_btns = true |
2226 | 2226 | ) { |
2227 | 2227 | // if Save & Close, use a custom redirect URL or default to the main page? |
2228 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2228 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2229 | 2229 | // create the Save & Close and Save buttons |
2230 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2230 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2231 | 2231 | //if we have extra content set let's add it in if not make sure its empty |
2232 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2232 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2233 | 2233 | |
2234 | 2234 | |
2235 | - if ( $delete && ! empty( $id ) ) { |
|
2235 | + if ($delete && ! empty($id)) { |
|
2236 | 2236 | //make sure we have a default if just true is sent. |
2237 | 2237 | $delete = ! empty($delete) ? $delete : 'delete'; |
2238 | - $delete_link_args = array( $name => $id ); |
|
2238 | + $delete_link_args = array($name => $id); |
|
2239 | 2239 | $delete = $this->get_action_link_or_button( |
2240 | 2240 | $delete, |
2241 | 2241 | $delete, |
@@ -2246,8 +2246,8 @@ discard block |
||
2246 | 2246 | ); |
2247 | 2247 | } |
2248 | 2248 | |
2249 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2250 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2249 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2250 | + if ( ! empty($name) && ! empty($id)) { |
|
2251 | 2251 | $hidden_field_arr[$name] = array( |
2252 | 2252 | 'type' => 'hidden', |
2253 | 2253 | 'value' => $id |
@@ -2257,7 +2257,7 @@ discard block |
||
2257 | 2257 | $hf = ''; |
2258 | 2258 | } |
2259 | 2259 | // add hidden field |
2260 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2260 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2261 | 2261 | |
2262 | 2262 | } |
2263 | 2263 | |
@@ -2274,8 +2274,8 @@ discard block |
||
2274 | 2274 | <noscript> |
2275 | 2275 | <div id="no-js-message" class="error"> |
2276 | 2276 | <p style="font-size:1.3em;"> |
2277 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2278 | - <?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' ); ?> |
|
2277 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2278 | + <?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'); ?> |
|
2279 | 2279 | </p> |
2280 | 2280 | </div> |
2281 | 2281 | </noscript> |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | * @return string |
2296 | 2296 | */ |
2297 | 2297 | private function _display_espresso_notices() { |
2298 | - $notices = $this->_get_transient( TRUE ); |
|
2298 | + $notices = $this->_get_transient(TRUE); |
|
2299 | 2299 | echo stripslashes($notices); |
2300 | 2300 | } |
2301 | 2301 | |
@@ -2347,11 +2347,11 @@ discard block |
||
2347 | 2347 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2348 | 2348 | * @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. |
2349 | 2349 | */ |
2350 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2351 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2350 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2351 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2352 | 2352 | |
2353 | 2353 | //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. |
2354 | - if ( empty( $callback_args ) && $create_func ) { |
|
2354 | + if (empty($callback_args) && $create_func) { |
|
2355 | 2355 | $callback_args = array( |
2356 | 2356 | 'template_path' => $this->_template_path, |
2357 | 2357 | 'template_args' => $this->_template_args, |
@@ -2361,7 +2361,7 @@ discard block |
||
2361 | 2361 | //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) |
2362 | 2362 | $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; |
2363 | 2363 | |
2364 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2364 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2365 | 2365 | } |
2366 | 2366 | |
2367 | 2367 | |
@@ -2374,7 +2374,7 @@ discard block |
||
2374 | 2374 | */ |
2375 | 2375 | public function display_admin_page_with_metabox_columns() { |
2376 | 2376 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2377 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2377 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2378 | 2378 | |
2379 | 2379 | //the final wrapper |
2380 | 2380 | $this->admin_page_wrapper(); |
@@ -2417,7 +2417,7 @@ discard block |
||
2417 | 2417 | * @return void |
2418 | 2418 | */ |
2419 | 2419 | public function display_about_admin_page() { |
2420 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2420 | + $this->_display_admin_page(FALSE, TRUE); |
|
2421 | 2421 | } |
2422 | 2422 | |
2423 | 2423 | |
@@ -2433,26 +2433,26 @@ discard block |
||
2433 | 2433 | * @return void |
2434 | 2434 | */ |
2435 | 2435 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2436 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2436 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2437 | 2437 | |
2438 | 2438 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2439 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2439 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2440 | 2440 | |
2441 | 2441 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2442 | 2442 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2443 | 2443 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2444 | 2444 | |
2445 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2445 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2446 | 2446 | |
2447 | - if ( defined('DOING_AJAX' ) ) |
|
2448 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2447 | + if (defined('DOING_AJAX')) |
|
2448 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2449 | 2449 | |
2450 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2450 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2451 | 2451 | |
2452 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2452 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2453 | 2453 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2454 | 2454 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2455 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2455 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2456 | 2456 | |
2457 | 2457 | |
2458 | 2458 | // the final template wrapper |
@@ -2470,7 +2470,7 @@ discard block |
||
2470 | 2470 | * @return void |
2471 | 2471 | * @throws \EE_Error |
2472 | 2472 | */ |
2473 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2473 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2474 | 2474 | //let's generate a default preview action button if there isn't one already present. |
2475 | 2475 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2476 | 2476 | $buy_now_url = add_query_arg( |
@@ -2483,7 +2483,7 @@ discard block |
||
2483 | 2483 | ), |
2484 | 2484 | 'http://eventespresso.com/pricing/' |
2485 | 2485 | ); |
2486 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2486 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2487 | 2487 | ? $this->get_action_link_or_button( |
2488 | 2488 | '', |
2489 | 2489 | 'buy_now', |
@@ -2493,13 +2493,13 @@ discard block |
||
2493 | 2493 | true |
2494 | 2494 | ) |
2495 | 2495 | : $this->_template_args['preview_action_button']; |
2496 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2496 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2497 | 2497 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2498 | 2498 | $template_path, |
2499 | 2499 | $this->_template_args, |
2500 | 2500 | true |
2501 | 2501 | ); |
2502 | - $this->_display_admin_page( $display_sidebar ); |
|
2502 | + $this->_display_admin_page($display_sidebar); |
|
2503 | 2503 | } |
2504 | 2504 | |
2505 | 2505 | |
@@ -2533,49 +2533,49 @@ discard block |
||
2533 | 2533 | * @param boolean $sidebar whether to display with sidebar or not. |
2534 | 2534 | * @return void |
2535 | 2535 | */ |
2536 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2536 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2537 | 2537 | //setup search attributes |
2538 | 2538 | $this->_set_search_attributes(); |
2539 | 2539 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2540 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2540 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2541 | 2541 | |
2542 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2543 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2544 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2542 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2543 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2544 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2545 | 2545 | $this->_template_args['list_table'] = $this->_list_table_object; |
2546 | 2546 | $this->_template_args['current_route'] = $this->_req_action; |
2547 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2547 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2548 | 2548 | |
2549 | 2549 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2550 | - if( ! empty( $ajax_sorting_callback )) { |
|
2550 | + if ( ! empty($ajax_sorting_callback)) { |
|
2551 | 2551 | $sortable_list_table_form_fields = wp_nonce_field( |
2552 | - $ajax_sorting_callback . '_nonce', |
|
2553 | - $ajax_sorting_callback . '_nonce', |
|
2552 | + $ajax_sorting_callback.'_nonce', |
|
2553 | + $ajax_sorting_callback.'_nonce', |
|
2554 | 2554 | FALSE, |
2555 | 2555 | FALSE |
2556 | 2556 | ); |
2557 | 2557 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2558 | 2558 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2559 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2560 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2559 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2560 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2561 | 2561 | } else { |
2562 | 2562 | $sortable_list_table_form_fields = ''; |
2563 | 2563 | } |
2564 | 2564 | |
2565 | 2565 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2566 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2567 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2568 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2566 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2567 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2568 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2569 | 2569 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2570 | 2570 | |
2571 | 2571 | //display message about search results? |
2572 | 2572 | $this->_template_args['before_list_table'] .= apply_filters( |
2573 | 2573 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2574 | - ! empty( $this->_req_data['s'] ) |
|
2575 | - ? '<p class="ee-search-results">' . sprintf( |
|
2576 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2577 | - trim( $this->_req_data['s'], '%' ) |
|
2578 | - ) . '</p>' |
|
2574 | + ! empty($this->_req_data['s']) |
|
2575 | + ? '<p class="ee-search-results">'.sprintf( |
|
2576 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2577 | + trim($this->_req_data['s'], '%') |
|
2578 | + ).'</p>' |
|
2579 | 2579 | : '', |
2580 | 2580 | $this->page_slug, |
2581 | 2581 | $this->_req_data, |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | true |
2588 | 2588 | ); |
2589 | 2589 | // the final template wrapper |
2590 | - if ( $sidebar ) |
|
2590 | + if ($sidebar) |
|
2591 | 2591 | $this->display_admin_page_with_sidebar(); |
2592 | 2592 | else |
2593 | 2593 | $this->display_admin_page_with_no_sidebar(); |
@@ -2610,9 +2610,9 @@ discard block |
||
2610 | 2610 | * @param array $items see above for format of array |
2611 | 2611 | * @return string html string of legend |
2612 | 2612 | */ |
2613 | - protected function _display_legend( $items ) { |
|
2614 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2615 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2613 | + protected function _display_legend($items) { |
|
2614 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2615 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2616 | 2616 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2617 | 2617 | } |
2618 | 2618 | |
@@ -2637,33 +2637,33 @@ discard block |
||
2637 | 2637 | * |
2638 | 2638 | * @return void |
2639 | 2639 | */ |
2640 | - protected function _return_json( $sticky_notices = false ) { |
|
2640 | + protected function _return_json($sticky_notices = false) { |
|
2641 | 2641 | |
2642 | 2642 | //make sure any EE_Error notices have been handled. |
2643 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2643 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2644 | 2644 | |
2645 | 2645 | |
2646 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2646 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2647 | 2647 | unset($this->_template_args['data']); |
2648 | 2648 | $json = array( |
2649 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2650 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2651 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2652 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2649 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2650 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2651 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2652 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2653 | 2653 | 'notices' => EE_Error::get_notices(), |
2654 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2655 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2654 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2655 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2656 | 2656 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2657 | 2657 | ); |
2658 | 2658 | |
2659 | 2659 | |
2660 | 2660 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2661 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2661 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2662 | 2662 | header('Content-Type: application/json; charset=UTF-8'); |
2663 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2664 | - echo wp_json_encode( $json ); |
|
2663 | + if (function_exists('wp_json_encode')) { |
|
2664 | + echo wp_json_encode($json); |
|
2665 | 2665 | } else { |
2666 | - echo json_encode( $json ); |
|
2666 | + echo json_encode($json); |
|
2667 | 2667 | } |
2668 | 2668 | exit(); |
2669 | 2669 | } |
@@ -2677,11 +2677,11 @@ discard block |
||
2677 | 2677 | * @throws EE_Error |
2678 | 2678 | */ |
2679 | 2679 | public function return_json() { |
2680 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2680 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2681 | 2681 | $this->_return_json(); |
2682 | 2682 | |
2683 | 2683 | else { |
2684 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2684 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2685 | 2685 | } |
2686 | 2686 | } |
2687 | 2687 | |
@@ -2694,7 +2694,7 @@ discard block |
||
2694 | 2694 | * |
2695 | 2695 | * @access public |
2696 | 2696 | */ |
2697 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2697 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2698 | 2698 | $this->_hook_obj = $hook_obj; |
2699 | 2699 | } |
2700 | 2700 | |
@@ -2710,33 +2710,33 @@ discard block |
||
2710 | 2710 | */ |
2711 | 2711 | public function admin_page_wrapper($about = FALSE) { |
2712 | 2712 | |
2713 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2713 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2714 | 2714 | |
2715 | 2715 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2716 | 2716 | |
2717 | 2717 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2718 | 2718 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2719 | 2719 | |
2720 | - $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'] : ''); |
|
2721 | - $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'] : ''); |
|
2720 | + $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'] : ''); |
|
2721 | + $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'] : ''); |
|
2722 | 2722 | |
2723 | 2723 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2724 | 2724 | |
2725 | 2725 | |
2726 | 2726 | |
2727 | 2727 | // load settings page wrapper template |
2728 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2728 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2729 | 2729 | |
2730 | 2730 | //about page? |
2731 | 2731 | $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
2732 | 2732 | |
2733 | 2733 | |
2734 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2735 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2734 | + if (defined('DOING_AJAX')) { |
|
2735 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2736 | 2736 | |
2737 | 2737 | $this->_return_json(); |
2738 | 2738 | } else { |
2739 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2739 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2740 | 2740 | } |
2741 | 2741 | |
2742 | 2742 | } |
@@ -2762,7 +2762,7 @@ discard block |
||
2762 | 2762 | * @param $b |
2763 | 2763 | * @return int |
2764 | 2764 | */ |
2765 | - private function _sort_nav_tabs( $a, $b ) { |
|
2765 | + private function _sort_nav_tabs($a, $b) { |
|
2766 | 2766 | if ($a['order'] == $b['order']) { |
2767 | 2767 | return 0; |
2768 | 2768 | } |
@@ -2782,7 +2782,7 @@ discard block |
||
2782 | 2782 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2783 | 2783 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2784 | 2784 | */ |
2785 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2785 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2786 | 2786 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2787 | 2787 | return $content; |
2788 | 2788 | } |
@@ -2804,25 +2804,25 @@ discard block |
||
2804 | 2804 | * @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. |
2805 | 2805 | * @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). |
2806 | 2806 | */ |
2807 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2807 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2808 | 2808 | //make sure $text and $actions are in an array |
2809 | 2809 | $text = (array) $text; |
2810 | 2810 | $actions = (array) $actions; |
2811 | 2811 | $referrer_url = empty($referrer) ? '' : $referrer; |
2812 | - $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 .'" />'; |
|
2812 | + $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.'" />'; |
|
2813 | 2813 | |
2814 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2815 | - $default_names = array( 'save', 'save_and_close' ); |
|
2814 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2815 | + $default_names = array('save', 'save_and_close'); |
|
2816 | 2816 | |
2817 | 2817 | //add in a hidden index for the current page (so save and close redirects properly) |
2818 | 2818 | $this->_template_args['save_buttons'] = $referrer_url; |
2819 | 2819 | |
2820 | - foreach ( $button_text as $key => $button ) { |
|
2820 | + foreach ($button_text as $key => $button) { |
|
2821 | 2821 | $ref = $default_names[$key]; |
2822 | - $id = $this->_current_view . '_' . $ref; |
|
2823 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2824 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2825 | - if ( !$both ) break; |
|
2822 | + $id = $this->_current_view.'_'.$ref; |
|
2823 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2824 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2825 | + if ( ! $both) break; |
|
2826 | 2826 | } |
2827 | 2827 | |
2828 | 2828 | } |
@@ -2837,8 +2837,8 @@ discard block |
||
2837 | 2837 | * @param string $route |
2838 | 2838 | * @param array $additional_hidden_fields |
2839 | 2839 | */ |
2840 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2841 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2840 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2841 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2842 | 2842 | } |
2843 | 2843 | |
2844 | 2844 | |
@@ -2851,30 +2851,30 @@ discard block |
||
2851 | 2851 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2852 | 2852 | * @return void |
2853 | 2853 | */ |
2854 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2854 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2855 | 2855 | |
2856 | - if ( empty( $route )) { |
|
2856 | + if (empty($route)) { |
|
2857 | 2857 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2858 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2859 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2858 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2859 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2860 | 2860 | } |
2861 | 2861 | // open form |
2862 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2862 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2863 | 2863 | // add nonce |
2864 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2864 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2865 | 2865 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2866 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2866 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2867 | 2867 | // add REQUIRED form action |
2868 | 2868 | $hidden_fields = array( |
2869 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2869 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2870 | 2870 | ); |
2871 | 2871 | // merge arrays |
2872 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2872 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2873 | 2873 | // generate form fields |
2874 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2874 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2875 | 2875 | // add fields to form |
2876 | - foreach ( (array)$form_fields as $field_name => $form_field ) { |
|
2877 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2876 | + foreach ((array) $form_fields as $field_name => $form_field) { |
|
2877 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2878 | 2878 | } |
2879 | 2879 | |
2880 | 2880 | // close form |
@@ -2891,8 +2891,8 @@ discard block |
||
2891 | 2891 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2892 | 2892 | * @since 4.5.0 |
2893 | 2893 | */ |
2894 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2895 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2894 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2895 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2896 | 2896 | } |
2897 | 2897 | |
2898 | 2898 | |
@@ -2908,38 +2908,38 @@ discard block |
||
2908 | 2908 | * @access protected |
2909 | 2909 | * @return void |
2910 | 2910 | */ |
2911 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2911 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2912 | 2912 | |
2913 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2913 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2914 | 2914 | |
2915 | 2915 | //class name for actions/filters. |
2916 | 2916 | $classname = get_class($this); |
2917 | 2917 | |
2918 | 2918 | //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 |
2919 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2920 | - $notices = EE_Error::get_notices( FALSE ); |
|
2919 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2920 | + $notices = EE_Error::get_notices(FALSE); |
|
2921 | 2921 | |
2922 | 2922 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2923 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2923 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2924 | 2924 | EE_Error::overwrite_success(); |
2925 | 2925 | } |
2926 | - if ( ! empty( $what ) && ! empty( $action_desc ) ) { |
|
2926 | + if ( ! empty($what) && ! empty($action_desc)) { |
|
2927 | 2927 | // how many records affected ? more than one record ? or just one ? |
2928 | - if ( $success > 1 && empty( $notices[ 'errors' ] ) ) { |
|
2928 | + if ($success > 1 && empty($notices['errors'])) { |
|
2929 | 2929 | // set plural msg |
2930 | 2930 | EE_Error::add_success( |
2931 | 2931 | sprintf( |
2932 | - __( 'The "%s" have been successfully %s.', 'event_espresso' ), |
|
2932 | + __('The "%s" have been successfully %s.', 'event_espresso'), |
|
2933 | 2933 | $what, |
2934 | 2934 | $action_desc |
2935 | 2935 | ), |
2936 | 2936 | __FILE__, __FUNCTION__, __LINE__ |
2937 | 2937 | ); |
2938 | - } else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) { |
|
2938 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2939 | 2939 | // set singular msg |
2940 | 2940 | EE_Error::add_success( |
2941 | 2941 | sprintf( |
2942 | - __( 'The "%s" has been successfully %s.', 'event_espresso' ), |
|
2942 | + __('The "%s" has been successfully %s.', 'event_espresso'), |
|
2943 | 2943 | $what, |
2944 | 2944 | $action_desc |
2945 | 2945 | ), |
@@ -2948,7 +2948,7 @@ discard block |
||
2948 | 2948 | } |
2949 | 2949 | } |
2950 | 2950 | // check that $query_args isn't something crazy |
2951 | - if ( ! is_array( $query_args )) { |
|
2951 | + if ( ! is_array($query_args)) { |
|
2952 | 2952 | $query_args = array(); |
2953 | 2953 | } |
2954 | 2954 | |
@@ -2961,36 +2961,36 @@ discard block |
||
2961 | 2961 | * @param array $query_args The original query_args array coming into the |
2962 | 2962 | * method. |
2963 | 2963 | */ |
2964 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2964 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2965 | 2965 | |
2966 | 2966 | //calculate where we're going (if we have a "save and close" button pushed) |
2967 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2967 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2968 | 2968 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2969 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2969 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2970 | 2970 | // regenerate query args array from referrer URL |
2971 | - parse_str( $parsed_url['query'], $query_args ); |
|
2971 | + parse_str($parsed_url['query'], $query_args); |
|
2972 | 2972 | // correct page and action will be in the query args now |
2973 | - $redirect_url = admin_url( 'admin.php' ); |
|
2973 | + $redirect_url = admin_url('admin.php'); |
|
2974 | 2974 | } |
2975 | 2975 | |
2976 | 2976 | //merge any default query_args set in _default_route_query_args property |
2977 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2977 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2978 | 2978 | $args_to_merge = array(); |
2979 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2979 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2980 | 2980 | //is there a wp_referer array in our _default_route_query_args property? |
2981 | - if ( $query_param == 'wp_referer' ) { |
|
2981 | + if ($query_param == 'wp_referer') { |
|
2982 | 2982 | $query_value = (array) $query_value; |
2983 | - foreach ( $query_value as $reference => $value ) { |
|
2984 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2983 | + foreach ($query_value as $reference => $value) { |
|
2984 | + if (strpos($reference, 'nonce') !== false) { |
|
2985 | 2985 | continue; |
2986 | 2986 | } |
2987 | 2987 | |
2988 | 2988 | //finally we will override any arguments in the referer with |
2989 | 2989 | //what might be set on the _default_route_query_args array. |
2990 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2991 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2990 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2991 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2992 | 2992 | } else { |
2993 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2993 | + $args_to_merge[$reference] = urlencode($value); |
|
2994 | 2994 | } |
2995 | 2995 | } |
2996 | 2996 | continue; |
@@ -3001,7 +3001,7 @@ discard block |
||
3001 | 3001 | |
3002 | 3002 | //now let's merge these arguments but override with what was specifically sent in to the |
3003 | 3003 | //redirect. |
3004 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
3004 | + $query_args = array_merge($args_to_merge, $query_args); |
|
3005 | 3005 | } |
3006 | 3006 | |
3007 | 3007 | $this->_process_notices($query_args); |
@@ -3010,19 +3010,19 @@ discard block |
||
3010 | 3010 | // generate redirect url |
3011 | 3011 | |
3012 | 3012 | // if redirecting to anything other than the main page, add a nonce |
3013 | - if ( isset( $query_args['action'] )) { |
|
3013 | + if (isset($query_args['action'])) { |
|
3014 | 3014 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3015 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3015 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3016 | 3016 | } |
3017 | 3017 | |
3018 | 3018 | //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). |
3019 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3019 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3020 | 3020 | |
3021 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3021 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3022 | 3022 | |
3023 | 3023 | |
3024 | 3024 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3025 | - if ( defined('DOING_AJAX' ) ) { |
|
3025 | + if (defined('DOING_AJAX')) { |
|
3026 | 3026 | $default_data = array( |
3027 | 3027 | 'close' => TRUE, |
3028 | 3028 | 'redirect_url' => $redirect_url, |
@@ -3031,11 +3031,11 @@ discard block |
||
3031 | 3031 | ); |
3032 | 3032 | |
3033 | 3033 | $this->_template_args['success'] = $success; |
3034 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3034 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3035 | 3035 | $this->_return_json(); |
3036 | 3036 | } |
3037 | 3037 | |
3038 | - wp_safe_redirect( $redirect_url ); |
|
3038 | + wp_safe_redirect($redirect_url); |
|
3039 | 3039 | exit(); |
3040 | 3040 | } |
3041 | 3041 | |
@@ -3051,30 +3051,30 @@ discard block |
||
3051 | 3051 | * @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. |
3052 | 3052 | * @return void |
3053 | 3053 | */ |
3054 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3054 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3055 | 3055 | |
3056 | 3056 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3057 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3058 | - $notices = EE_Error::get_notices( false ); |
|
3059 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3060 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3057 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3058 | + $notices = EE_Error::get_notices(false); |
|
3059 | + if (empty($this->_template_args['success'])) { |
|
3060 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3061 | 3061 | } |
3062 | 3062 | |
3063 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3064 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3063 | + if (empty($this->_template_args['errors'])) { |
|
3064 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3065 | 3065 | } |
3066 | 3066 | |
3067 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3068 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3067 | + if (empty($this->_template_args['attention'])) { |
|
3068 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3069 | 3069 | } |
3070 | 3070 | } |
3071 | 3071 | |
3072 | 3072 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3073 | 3073 | |
3074 | 3074 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3075 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3076 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3077 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3075 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3076 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3077 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3078 | 3078 | } |
3079 | 3079 | } |
3080 | 3080 | |
@@ -3104,7 +3104,7 @@ discard block |
||
3104 | 3104 | $exclude_nonce = false |
3105 | 3105 | ) { |
3106 | 3106 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3107 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3107 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3108 | 3108 | throw new EE_Error( |
3109 | 3109 | sprintf( |
3110 | 3110 | __( |
@@ -3115,7 +3115,7 @@ discard block |
||
3115 | 3115 | ) |
3116 | 3116 | ); |
3117 | 3117 | } |
3118 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3118 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3119 | 3119 | throw new EE_Error( |
3120 | 3120 | sprintf( |
3121 | 3121 | __( |
@@ -3127,8 +3127,8 @@ discard block |
||
3127 | 3127 | ); |
3128 | 3128 | } |
3129 | 3129 | //finally check user access for this button. |
3130 | - $has_access = $this->check_user_access( $action, true ); |
|
3131 | - if ( ! $has_access ) { |
|
3130 | + $has_access = $this->check_user_access($action, true); |
|
3131 | + if ( ! $has_access) { |
|
3132 | 3132 | return ''; |
3133 | 3133 | } |
3134 | 3134 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3136,11 +3136,11 @@ discard block |
||
3136 | 3136 | 'action' => $action |
3137 | 3137 | ); |
3138 | 3138 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3139 | - if ( ! empty( $extra_request ) ) { |
|
3140 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3139 | + if ( ! empty($extra_request)) { |
|
3140 | + $query_args = array_merge($extra_request, $query_args); |
|
3141 | 3141 | } |
3142 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3143 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3142 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3143 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3144 | 3144 | } |
3145 | 3145 | |
3146 | 3146 | |
@@ -3155,11 +3155,11 @@ discard block |
||
3155 | 3155 | $args = array( |
3156 | 3156 | 'label' => $this->_admin_page_title, |
3157 | 3157 | 'default' => 10, |
3158 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3158 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3159 | 3159 | ); |
3160 | 3160 | //ONLY add the screen option if the user has access to it. |
3161 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3162 | - add_screen_option( $option, $args ); |
|
3161 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3162 | + add_screen_option($option, $args); |
|
3163 | 3163 | } |
3164 | 3164 | } |
3165 | 3165 | |
@@ -3175,36 +3175,36 @@ discard block |
||
3175 | 3175 | * @return void |
3176 | 3176 | */ |
3177 | 3177 | private function _set_per_page_screen_options() { |
3178 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3179 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3178 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3179 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3180 | 3180 | |
3181 | - if ( !$user = wp_get_current_user() ) |
|
3181 | + if ( ! $user = wp_get_current_user()) |
|
3182 | 3182 | return; |
3183 | 3183 | $option = $_POST['wp_screen_options']['option']; |
3184 | 3184 | $value = $_POST['wp_screen_options']['value']; |
3185 | 3185 | |
3186 | - if ( $option != sanitize_key( $option ) ) |
|
3186 | + if ($option != sanitize_key($option)) |
|
3187 | 3187 | return; |
3188 | 3188 | |
3189 | 3189 | $map_option = $option; |
3190 | 3190 | |
3191 | 3191 | $option = str_replace('-', '_', $option); |
3192 | 3192 | |
3193 | - switch ( $map_option ) { |
|
3194 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3193 | + switch ($map_option) { |
|
3194 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3195 | 3195 | $value = (int) $value; |
3196 | - if ( $value < 1 || $value > 999 ) |
|
3196 | + if ($value < 1 || $value > 999) |
|
3197 | 3197 | return; |
3198 | 3198 | break; |
3199 | 3199 | default: |
3200 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3201 | - if ( false === $value ) |
|
3200 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3201 | + if (false === $value) |
|
3202 | 3202 | return; |
3203 | 3203 | break; |
3204 | 3204 | } |
3205 | 3205 | |
3206 | 3206 | update_user_meta($user->ID, $option, $value); |
3207 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3207 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3208 | 3208 | exit; |
3209 | 3209 | } |
3210 | 3210 | } |
@@ -3215,8 +3215,8 @@ discard block |
||
3215 | 3215 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3216 | 3216 | * @param array $data array that will be assigned to template args. |
3217 | 3217 | */ |
3218 | - public function set_template_args( $data ) { |
|
3219 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3218 | + public function set_template_args($data) { |
|
3219 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3220 | 3220 | } |
3221 | 3221 | |
3222 | 3222 | |
@@ -3232,26 +3232,26 @@ discard block |
||
3232 | 3232 | * @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. |
3233 | 3233 | * @return void |
3234 | 3234 | */ |
3235 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3235 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3236 | 3236 | $user_id = get_current_user_id(); |
3237 | 3237 | |
3238 | - if ( !$skip_route_verify ) |
|
3238 | + if ( ! $skip_route_verify) |
|
3239 | 3239 | $this->_verify_route($route); |
3240 | 3240 | |
3241 | 3241 | |
3242 | 3242 | //now let's set the string for what kind of transient we're setting |
3243 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3244 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3243 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3244 | + $data = $notices ? array('notices' => $data) : $data; |
|
3245 | 3245 | //is there already a transient for this route? If there is then let's ADD to that transient |
3246 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3247 | - if ( $existing ) { |
|
3248 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3246 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3247 | + if ($existing) { |
|
3248 | + $data = array_merge((array) $data, (array) $existing); |
|
3249 | 3249 | } |
3250 | 3250 | |
3251 | - if ( is_multisite() && is_network_admin() ) { |
|
3252 | - set_site_transient( $transient, $data, 8 ); |
|
3251 | + if (is_multisite() && is_network_admin()) { |
|
3252 | + set_site_transient($transient, $data, 8); |
|
3253 | 3253 | } else { |
3254 | - set_transient( $transient, $data, 8 ); |
|
3254 | + set_transient($transient, $data, 8); |
|
3255 | 3255 | } |
3256 | 3256 | } |
3257 | 3257 | |
@@ -3263,18 +3263,18 @@ discard block |
||
3263 | 3263 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3264 | 3264 | * @return mixed data |
3265 | 3265 | */ |
3266 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3266 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3267 | 3267 | $user_id = get_current_user_id(); |
3268 | - $route = !$route ? $this->_req_action : $route; |
|
3269 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3270 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3268 | + $route = ! $route ? $this->_req_action : $route; |
|
3269 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3270 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3271 | 3271 | //delete transient after retrieval (just in case it hasn't expired); |
3272 | - if ( is_multisite() && is_network_admin() ) { |
|
3273 | - delete_site_transient( $transient ); |
|
3272 | + if (is_multisite() && is_network_admin()) { |
|
3273 | + delete_site_transient($transient); |
|
3274 | 3274 | } else { |
3275 | - delete_transient( $transient ); |
|
3275 | + delete_transient($transient); |
|
3276 | 3276 | } |
3277 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3277 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3278 | 3278 | } |
3279 | 3279 | |
3280 | 3280 | |
@@ -3291,12 +3291,12 @@ discard block |
||
3291 | 3291 | |
3292 | 3292 | //retrieve all existing transients |
3293 | 3293 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3294 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3295 | - foreach ( $results as $result ) { |
|
3296 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3297 | - get_transient( $transient ); |
|
3298 | - if ( is_multisite() && is_network_admin() ) { |
|
3299 | - get_site_transient( $transient ); |
|
3294 | + if ($results = $wpdb->get_results($query)) { |
|
3295 | + foreach ($results as $result) { |
|
3296 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3297 | + get_transient($transient); |
|
3298 | + if (is_multisite() && is_network_admin()) { |
|
3299 | + get_site_transient($transient); |
|
3300 | 3300 | } |
3301 | 3301 | } |
3302 | 3302 | } |
@@ -3454,23 +3454,23 @@ discard block |
||
3454 | 3454 | * @param string $line line no where error occurred |
3455 | 3455 | * @return boolean |
3456 | 3456 | */ |
3457 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3457 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3458 | 3458 | |
3459 | 3459 | //remove any options that are NOT going to be saved with the config settings. |
3460 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3460 | + if (isset($config->core->ee_ueip_optin)) { |
|
3461 | 3461 | $config->core->ee_ueip_has_notified = TRUE; |
3462 | 3462 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3463 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3464 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3463 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3464 | + update_option('ee_ueip_has_notified', TRUE); |
|
3465 | 3465 | } |
3466 | 3466 | // and save it (note we're also doing the network save here) |
3467 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3468 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3469 | - if ( $config_saved && $net_saved ) { |
|
3470 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3467 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3468 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3469 | + if ($config_saved && $net_saved) { |
|
3470 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3471 | 3471 | return TRUE; |
3472 | 3472 | } else { |
3473 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3473 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3474 | 3474 | return FALSE; |
3475 | 3475 | } |
3476 | 3476 | } |
@@ -3483,7 +3483,7 @@ discard block |
||
3483 | 3483 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3484 | 3484 | * @return array |
3485 | 3485 | */ |
3486 | - public function get_yes_no_values(){ |
|
3486 | + public function get_yes_no_values() { |
|
3487 | 3487 | return $this->_yes_no_values; |
3488 | 3488 | } |
3489 | 3489 | |
@@ -3505,8 +3505,8 @@ discard block |
||
3505 | 3505 | * |
3506 | 3506 | * @return string |
3507 | 3507 | */ |
3508 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3509 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3508 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3509 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3510 | 3510 | } |
3511 | 3511 | |
3512 | 3512 | |
@@ -3520,8 +3520,8 @@ discard block |
||
3520 | 3520 | * |
3521 | 3521 | * @return string |
3522 | 3522 | */ |
3523 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3524 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3523 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3524 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3525 | 3525 | } |
3526 | 3526 | |
3527 | 3527 | |
@@ -3540,8 +3540,8 @@ discard block |
||
3540 | 3540 | * @return bool success/fail |
3541 | 3541 | */ |
3542 | 3542 | protected function _process_resend_registration() { |
3543 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3544 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3543 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3544 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3545 | 3545 | return $this->_template_args['success']; |
3546 | 3546 | } |
3547 | 3547 | |
@@ -3554,11 +3554,11 @@ discard block |
||
3554 | 3554 | * @param \EE_Payment $payment |
3555 | 3555 | * @return bool success/fail |
3556 | 3556 | */ |
3557 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3558 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3559 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3560 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3561 | - return $this->_template_args[ 'success' ]; |
|
3557 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3558 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3559 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3560 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3561 | + return $this->_template_args['success']; |
|
3562 | 3562 | } |
3563 | 3563 | |
3564 | 3564 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | namespace EventEspresso\core\services\commands; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 |