@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // defined some new constants related to caffeinated folder |
14 | -define( 'EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
15 | -define( 'EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS ); |
|
16 | -define( 'EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS ); |
|
17 | -define( 'EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
14 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
15 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
16 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
17 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * EE_Brewing_Regular constructor. |
37 | 37 | */ |
38 | - public function __construct( TableAnalysis $table_analysis ) { |
|
38 | + public function __construct(TableAnalysis $table_analysis) { |
|
39 | 39 | $this->_table_analysis = $table_analysis; |
40 | - if ( defined( 'EE_CAFF_PATH' ) ) { |
|
40 | + if (defined('EE_CAFF_PATH')) { |
|
41 | 41 | // activation |
42 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ) ); |
|
42 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
43 | 43 | // load caff init |
44 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ) ); |
|
44 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
45 | 45 | // remove the "powered by" credit link from receipts and invoices |
46 | - add_filter( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false' ); |
|
46 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
47 | 47 | // add caffeinated modules |
48 | 48 | add_filter( |
49 | 49 | 'FHEE__EE_Config__register_modules__modules_to_register', |
50 | - array( $this, 'caffeinated_modules_to_register' ) |
|
50 | + array($this, 'caffeinated_modules_to_register') |
|
51 | 51 | ); |
52 | 52 | // load caff scripts |
53 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts' ), 10 ); |
|
54 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
53 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
54 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
55 | 55 | add_filter( |
56 | 56 | 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', |
57 | - array( $this, 'caf_payment_methods' ) |
|
57 | + array($this, 'caf_payment_methods') |
|
58 | 58 | ); |
59 | 59 | // caffeinated constructed |
60 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
60 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
61 | 61 | //seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
62 | - add_filter( 'FHEE__ee_show_affiliate_links', '__return_false' ); |
|
62 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @param array $paths original helper paths array |
72 | 72 | * @return array new array of paths |
73 | 73 | */ |
74 | - public function caf_helper_paths( $paths ) { |
|
75 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
74 | + public function caf_helper_paths($paths) { |
|
75 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
76 | 76 | return $paths; |
77 | 77 | } |
78 | 78 | |
@@ -89,21 +89,21 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @global wpdb $wpdb |
91 | 91 | */ |
92 | - public function initialize_caf_db_content(){ |
|
92 | + public function initialize_caf_db_content() { |
|
93 | 93 | global $wpdb; |
94 | 94 | //use same method of getting creator id as the version introducing the change |
95 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
95 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
96 | 96 | $price_type_table = $wpdb->prefix."esp_price_type"; |
97 | 97 | $price_table = $wpdb->prefix."esp_price"; |
98 | - if ( $this->_get_table_analysis()->tableExists( $price_type_table ) ) { |
|
98 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
99 | 99 | |
100 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
101 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
102 | - if ( $tax_price_type_count <= 1 ) { |
|
100 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
101 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
102 | + if ($tax_price_type_count <= 1) { |
|
103 | 103 | $wpdb->insert( |
104 | 104 | $price_type_table, |
105 | 105 | array( |
106 | - 'PRT_name' => __( "Regional Tax", "event_espresso" ), |
|
106 | + 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
107 | 107 | 'PBT_ID' => 4, |
108 | 108 | 'PRT_is_percent' => true, |
109 | 109 | 'PRT_order' => 60, |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | 'PRT_wp_user' => $default_creator_id, |
112 | 112 | ), |
113 | 113 | array( |
114 | - '%s',//PRT_name |
|
115 | - '%d',//PBT_id |
|
116 | - '%d',//PRT_is_percent |
|
117 | - '%d',//PRT_order |
|
118 | - '%d',//PRT_deleted |
|
114 | + '%s', //PRT_name |
|
115 | + '%d', //PBT_id |
|
116 | + '%d', //PRT_is_percent |
|
117 | + '%d', //PRT_order |
|
118 | + '%d', //PRT_deleted |
|
119 | 119 | '%d', //PRT_wp_user |
120 | 120 | ) |
121 | 121 | ); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $result = $wpdb->insert( |
124 | 124 | $price_type_table, |
125 | 125 | array( |
126 | - 'PRT_name' => __( "Federal Tax", "event_espresso" ), |
|
126 | + 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
127 | 127 | 'PBT_ID' => 4, |
128 | 128 | 'PRT_is_percent' => true, |
129 | 129 | 'PRT_order' => 70, |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | 'PRT_wp_user' => $default_creator_id, |
132 | 132 | ), |
133 | 133 | array( |
134 | - '%s',//PRT_name |
|
135 | - '%d',//PBT_id |
|
136 | - '%d',//PRT_is_percent |
|
137 | - '%d',//PRT_order |
|
138 | - '%d',//PRT_deleted |
|
134 | + '%s', //PRT_name |
|
135 | + '%d', //PBT_id |
|
136 | + '%d', //PRT_is_percent |
|
137 | + '%d', //PRT_order |
|
138 | + '%d', //PRT_deleted |
|
139 | 139 | '%d' //PRT_wp_user |
140 | 140 | ) |
141 | 141 | ); |
142 | - if ( $result ) { |
|
142 | + if ($result) { |
|
143 | 143 | $wpdb->insert( |
144 | 144 | $price_table, |
145 | 145 | array( |
146 | 146 | 'PRT_ID' => $wpdb->insert_id, |
147 | 147 | 'PRC_amount' => 15.00, |
148 | - 'PRC_name' => __( "Sales Tax", "event_espresso" ), |
|
148 | + 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
149 | 149 | 'PRC_desc' => '', |
150 | 150 | 'PRC_is_default' => true, |
151 | 151 | 'PRC_overrides' => null, |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | 'PRC_wp_user' => $default_creator_id, |
156 | 156 | ), |
157 | 157 | array( |
158 | - '%d',//PRT_id |
|
159 | - '%f',//PRC_amount |
|
160 | - '%s',//PRC_name |
|
161 | - '%s',//PRC_desc |
|
162 | - '%d',//PRC_is_default |
|
163 | - '%d',//PRC_overrides |
|
164 | - '%d',//PRC_deleted |
|
165 | - '%d',//PRC_order |
|
166 | - '%d',//PRC_parent |
|
158 | + '%d', //PRT_id |
|
159 | + '%f', //PRC_amount |
|
160 | + '%s', //PRC_name |
|
161 | + '%s', //PRC_desc |
|
162 | + '%d', //PRC_is_default |
|
163 | + '%d', //PRC_overrides |
|
164 | + '%d', //PRC_deleted |
|
165 | + '%d', //PRC_order |
|
166 | + '%d', //PRC_parent |
|
167 | 167 | '%d' //PRC_wp_user |
168 | 168 | ) |
169 | 169 | ); |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | * @param array $modules_to_register |
182 | 182 | * @return array |
183 | 183 | */ |
184 | - public function caffeinated_modules_to_register( $modules_to_register = array() ) { |
|
185 | - if ( is_readable( EE_CAFF_PATH . 'modules' ) ) { |
|
186 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
187 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register ) ) { |
|
188 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
184 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
185 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
186 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
187 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
188 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | return $modules_to_register; |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | |
196 | 196 | public function caffeinated_init() { |
197 | 197 | // EE_Register_CPTs hooks |
198 | - add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
199 | - add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
200 | - add_filter( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
201 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), false ); |
|
198 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
199 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
200 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
201 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), false); |
|
202 | 202 | // caffeinated_init__complete hook |
203 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
203 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param array $taxonomy_array |
218 | 218 | * @return array |
219 | 219 | */ |
220 | - public function filter_taxonomies( array $taxonomy_array ) { |
|
220 | + public function filter_taxonomies(array $taxonomy_array) { |
|
221 | 221 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
222 | 222 | return $taxonomy_array; |
223 | 223 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param array $cpt_array |
229 | 229 | * @return mixed |
230 | 230 | */ |
231 | - public function filter_cpts( array $cpt_array ) { |
|
231 | + public function filter_cpts(array $cpt_array) { |
|
232 | 232 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
233 | 233 | return $cpt_array; |
234 | 234 | } |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @param array $menuitems |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - public function nav_metabox_items( array $menuitems ) { |
|
242 | + public function nav_metabox_items(array $menuitems) { |
|
243 | 243 | $menuitems[] = array( |
244 | - 'title' => __( 'Venue List', 'event_espresso' ), |
|
245 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
246 | - 'description' => __( 'Archive page for all venues.', 'event_espresso' ), |
|
244 | + 'title' => __('Venue List', 'event_espresso'), |
|
245 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
246 | + 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
247 | 247 | ); |
248 | 248 | return $menuitems; |
249 | 249 | } |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | * @param array $payment_method_paths |
257 | 257 | * @return array values are folder paths to payment method folders |
258 | 258 | */ |
259 | - public function caf_payment_methods( $payment_method_paths ) { |
|
260 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
261 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
259 | + public function caf_payment_methods($payment_method_paths) { |
|
260 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
261 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
262 | 262 | return $payment_method_paths; |
263 | 263 | } |
264 | 264 | /** |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * @throws \EE_Error |
268 | 268 | */ |
269 | 269 | protected function _get_table_analysis() { |
270 | - if( $this->_table_analysis instanceof TableAnalysis ) { |
|
270 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
271 | 271 | return $this->_table_analysis; |
272 | 272 | } else { |
273 | 273 | throw new \EE_Error( |
274 | 274 | sprintf( |
275 | - __( 'Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
276 | - get_class( $this ) |
|
275 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
276 | + get_class($this) |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
282 | 282 | $brewing = new EE_Brewing_Regular( |
283 | - EE_Registry::instance()->create( 'TableAnalysis', array(), true ) |
|
283 | + EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
284 | 284 | ); |
@@ -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 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @param mixed $data incoming data object|array. Suggested that child classes use type hinting for expected |
267 | 267 | * data object. But here parent will be generic because we don't know what's coming in. |
268 | 268 | */ |
269 | - public function __construct( $data ) { |
|
269 | + public function __construct($data) { |
|
270 | 270 | $this->_data = $data; |
271 | 271 | $this->_setup_data(); |
272 | 272 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return mixed The prepped data for db |
290 | 290 | */ |
291 | - static public function convert_data_for_persistent_storage( $data ) { |
|
291 | + static public function convert_data_for_persistent_storage($data) { |
|
292 | 292 | return $data; |
293 | 293 | } |
294 | 294 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return mixed |
306 | 306 | */ |
307 | - static public function convert_data_from_persistent_storage( $data ) { |
|
307 | + static public function convert_data_from_persistent_storage($data) { |
|
308 | 308 | return $data; |
309 | 309 | } |
310 | 310 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | protected function _assemble_data() { |
332 | 332 | //verify that reg_objs is set |
333 | 333 | if ( |
334 | - ! is_array( $this->reg_objs ) |
|
335 | - && ! reset( $this->reg_objs ) instanceof EE_Registration |
|
334 | + ! is_array($this->reg_objs) |
|
335 | + && ! reset($this->reg_objs) instanceof EE_Registration |
|
336 | 336 | ) { |
337 | 337 | throw new EE_Error( |
338 | 338 | __( |
@@ -347,84 +347,84 @@ discard block |
||
347 | 347 | $answers = $questions = $attendees = $line_items = $registrations = array(); |
348 | 348 | $total_ticket_count = 0; |
349 | 349 | |
350 | - if ( ! empty( $this->reg_objs ) ) { |
|
350 | + if ( ! empty($this->reg_objs)) { |
|
351 | 351 | $event_attendee_count = array(); |
352 | - foreach ( $this->reg_objs as $reg ) { |
|
352 | + foreach ($this->reg_objs as $reg) { |
|
353 | 353 | |
354 | 354 | if ( |
355 | - $this->_skip_registration_for_processing( $reg ) |
|
355 | + $this->_skip_registration_for_processing($reg) |
|
356 | 356 | ) { |
357 | 357 | continue; |
358 | 358 | } |
359 | 359 | |
360 | 360 | $evt_id = $reg->event_ID(); |
361 | 361 | /** @type EE_Ticket $ticket */ |
362 | - $ticket = $reg->get_first_related( 'Ticket' ); |
|
362 | + $ticket = $reg->get_first_related('Ticket'); |
|
363 | 363 | $relateddatetime = $ticket->datetimes(); |
364 | 364 | $total_ticket_count++; |
365 | - $tickets[ $ticket->ID() ]['ticket'] = $ticket; |
|
366 | - $tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] ) |
|
367 | - && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
368 | - ? $tickets[ $ticket->ID() ]['count'] + 1 |
|
365 | + $tickets[$ticket->ID()]['ticket'] = $ticket; |
|
366 | + $tickets[$ticket->ID()]['count'] = is_array($tickets[$ticket->ID()]) |
|
367 | + && isset($tickets[$ticket->ID()]['count']) |
|
368 | + ? $tickets[$ticket->ID()]['count'] + 1 |
|
369 | 369 | : 1; |
370 | - $tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
371 | - $tickets[ $ticket->ID() ]['dtt_objs'] = $relateddatetime; |
|
372 | - $tickets[ $ticket->ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
370 | + $tickets[$ticket->ID()]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
371 | + $tickets[$ticket->ID()]['dtt_objs'] = $relateddatetime; |
|
372 | + $tickets[$ticket->ID()]['reg_objs'][$reg->ID()] = $reg; |
|
373 | 373 | $event = $reg->event(); |
374 | - $tickets[ $ticket->ID() ]['EE_Event'] = $event; |
|
375 | - $evtcache[ $evt_id ] = $event; |
|
376 | - $eventsetup[ $evt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
377 | - $eventsetup[ $evt_id ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
378 | - $eventsetup[ $evt_id ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
379 | - $event_attendee_count[ $evt_id ] = isset( $event_attendee_count[ $evt_id ] ) |
|
380 | - ? $event_attendee_count[ $evt_id ] + 1 |
|
374 | + $tickets[$ticket->ID()]['EE_Event'] = $event; |
|
375 | + $evtcache[$evt_id] = $event; |
|
376 | + $eventsetup[$evt_id]['reg_objs'][$reg->ID()] = $reg; |
|
377 | + $eventsetup[$evt_id]['tkt_objs'][$ticket->ID()] = $ticket; |
|
378 | + $eventsetup[$evt_id]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
379 | + $event_attendee_count[$evt_id] = isset($event_attendee_count[$evt_id]) |
|
380 | + ? $event_attendee_count[$evt_id] + 1 |
|
381 | 381 | : 0; |
382 | - $attendees[ $reg->attendee_ID() ]['line_ref'][] = $evt_id; |
|
383 | - $attendees[ $reg->attendee_ID() ]['att_obj'] = $reg->attendee(); |
|
384 | - $attendees[ $reg->attendee_ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
382 | + $attendees[$reg->attendee_ID()]['line_ref'][] = $evt_id; |
|
383 | + $attendees[$reg->attendee_ID()]['att_obj'] = $reg->attendee(); |
|
384 | + $attendees[$reg->attendee_ID()]['reg_objs'][$reg->ID()] = $reg; |
|
385 | 385 | //$attendees[ $reg->attendee_ID() ]['registration_id'] = $reg->ID(); |
386 | - $attendees[ $reg->attendee_ID() ]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
386 | + $attendees[$reg->attendee_ID()]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
387 | 387 | ? $reg->attendee()->email() |
388 | 388 | : ''; |
389 | - $attendees[ $reg->attendee_ID() ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
390 | - $attendees[ $reg->attendee_ID() ]['evt_objs'][ $evt_id ] = $event; |
|
389 | + $attendees[$reg->attendee_ID()]['tkt_objs'][$ticket->ID()] = $ticket; |
|
390 | + $attendees[$reg->attendee_ID()]['evt_objs'][$evt_id] = $event; |
|
391 | 391 | |
392 | 392 | //registrations |
393 | - $registrations[ $reg->ID() ]['tkt_obj'] = $ticket; |
|
394 | - $registrations[ $reg->ID() ]['evt_obj'] = $event; |
|
395 | - $registrations[ $reg->ID() ]['reg_obj'] = $reg; |
|
396 | - $registrations[ $reg->ID() ]['att_obj'] = $reg->attendee(); |
|
393 | + $registrations[$reg->ID()]['tkt_obj'] = $ticket; |
|
394 | + $registrations[$reg->ID()]['evt_obj'] = $event; |
|
395 | + $registrations[$reg->ID()]['reg_obj'] = $reg; |
|
396 | + $registrations[$reg->ID()]['att_obj'] = $reg->attendee(); |
|
397 | 397 | |
398 | 398 | //set up answer objects |
399 | - $rel_ans = $reg->get_many_related( 'Answer' ); |
|
400 | - foreach ( $rel_ans as $ansid => $answer ) { |
|
401 | - if ( ! isset( $questions[ $ansid ] ) ) { |
|
402 | - $questions[ $ansid ] = $answer->get_first_related( 'Question' ); |
|
399 | + $rel_ans = $reg->get_many_related('Answer'); |
|
400 | + foreach ($rel_ans as $ansid => $answer) { |
|
401 | + if ( ! isset($questions[$ansid])) { |
|
402 | + $questions[$ansid] = $answer->get_first_related('Question'); |
|
403 | 403 | } |
404 | - $answers[ $ansid ] = $answer; |
|
405 | - $registrations[ $reg->ID() ]['ans_objs'][ $ansid ] = $answer; |
|
404 | + $answers[$ansid] = $answer; |
|
405 | + $registrations[$reg->ID()]['ans_objs'][$ansid] = $answer; |
|
406 | 406 | } |
407 | 407 | |
408 | - foreach ( $relateddatetime as $dtt_id => $datetime ) { |
|
409 | - $eventsetup[ $evt_id ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
410 | - $registrations[ $reg->ID() ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
408 | + foreach ($relateddatetime as $dtt_id => $datetime) { |
|
409 | + $eventsetup[$evt_id]['dtt_objs'][$dtt_id] = $datetime; |
|
410 | + $registrations[$reg->ID()]['dtt_objs'][$dtt_id] = $datetime; |
|
411 | 411 | |
412 | - if ( isset( $datetimes[ $dtt_id ] ) ) { |
|
412 | + if (isset($datetimes[$dtt_id])) { |
|
413 | 413 | continue; //already have this info in the datetimes array. |
414 | 414 | } |
415 | 415 | |
416 | - $datetimes[ $dtt_id ]['tkt_objs'][] = $ticket; |
|
417 | - $datetimes[ $dtt_id ]['datetime'] = $datetime; |
|
418 | - $datetimes[ $dtt_id ]['evt_objs'][ $evt_id ] = $event; |
|
419 | - $datetimes[ $dtt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
416 | + $datetimes[$dtt_id]['tkt_objs'][] = $ticket; |
|
417 | + $datetimes[$dtt_id]['datetime'] = $datetime; |
|
418 | + $datetimes[$dtt_id]['evt_objs'][$evt_id] = $event; |
|
419 | + $datetimes[$dtt_id]['reg_objs'][$reg->ID()] = $reg; |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
423 | 423 | //let's loop through the unique event=>reg items and setup data on them |
424 | 424 | |
425 | - if ( ! empty( $eventsetup ) ) { |
|
426 | - foreach ( $eventsetup as $evt_id => $items ) { |
|
427 | - if ( $this->txn instanceof EE_Transaction ) { |
|
425 | + if ( ! empty($eventsetup)) { |
|
426 | + foreach ($eventsetup as $evt_id => $items) { |
|
427 | + if ($this->txn instanceof EE_Transaction) { |
|
428 | 428 | $ticket_line_items_for_event = EEM_Line_Item::instance()->get_all( |
429 | 429 | array( |
430 | 430 | array( |
@@ -437,25 +437,25 @@ discard block |
||
437 | 437 | } else { |
438 | 438 | $ticket_line_items_for_event = array(); |
439 | 439 | } |
440 | - $events[ $evt_id ] = array( |
|
440 | + $events[$evt_id] = array( |
|
441 | 441 | 'ID' => $evt_id, |
442 | - 'event' => $evtcache[ $evt_id ], |
|
443 | - 'name' => $evtcache[ $evt_id ] instanceof EE_Event ? $evtcache[ $evt_id ]->name() : '', |
|
444 | - 'total_attendees' => $event_attendee_count[ $evt_id ], |
|
442 | + 'event' => $evtcache[$evt_id], |
|
443 | + 'name' => $evtcache[$evt_id] instanceof EE_Event ? $evtcache[$evt_id]->name() : '', |
|
444 | + 'total_attendees' => $event_attendee_count[$evt_id], |
|
445 | 445 | 'reg_objs' => $items['reg_objs'], |
446 | 446 | 'tkt_objs' => $items['tkt_objs'], |
447 | 447 | 'att_objs' => $items['att_objs'], |
448 | - 'dtt_objs' => isset( $items['dtt_objs'] ) ? $items['dtt_objs'] : array(), |
|
448 | + 'dtt_objs' => isset($items['dtt_objs']) ? $items['dtt_objs'] : array(), |
|
449 | 449 | 'line_items' => $ticket_line_items_for_event, |
450 | 450 | ); |
451 | 451 | |
452 | 452 | //make sure the tickets have the line items setup for them. |
453 | - foreach ( $ticket_line_items_for_event as $line_id => $line_item ) { |
|
454 | - if ( $line_item instanceof EE_Line_Item ) { |
|
455 | - $tickets[ $line_item->ticket()->ID() ]['line_item'] = $line_item; |
|
456 | - $tickets[ $line_item->ticket()->ID() ]['sub_line_items'] = $line_item->children(); |
|
457 | - $line_items[ $line_item->ID() ]['children'] = $line_item->children(); |
|
458 | - $line_items[ $line_item->ID() ]['EE_Ticket'] = $line_item->ticket(); |
|
453 | + foreach ($ticket_line_items_for_event as $line_id => $line_item) { |
|
454 | + if ($line_item instanceof EE_Line_Item) { |
|
455 | + $tickets[$line_item->ticket()->ID()]['line_item'] = $line_item; |
|
456 | + $tickets[$line_item->ticket()->ID()]['sub_line_items'] = $line_item->children(); |
|
457 | + $line_items[$line_item->ID()]['children'] = $line_item->children(); |
|
458 | + $line_items[$line_item->ID()]['EE_Ticket'] = $line_item->ticket(); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $this->total_ticket_count = $total_ticket_count; |
478 | 478 | $this->registrations = $registrations; |
479 | 479 | |
480 | - if ( $this->txn instanceof EE_Transaction ) { |
|
480 | + if ($this->txn instanceof EE_Transaction) { |
|
481 | 481 | $this->tax_line_items = $this->txn->tax_items(); |
482 | 482 | $this->additional_line_items = $this->txn->non_ticket_line_items(); |
483 | 483 | $this->payments = $this->txn->payments(); |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | //let's get just the primary_attendee_data! First we get the primary registration object. |
488 | 488 | $primary_reg = $this->txn->primary_registration(); |
489 | 489 | // verify |
490 | - if ( $primary_reg instanceof EE_Registration ) { |
|
490 | + if ($primary_reg instanceof EE_Registration) { |
|
491 | 491 | |
492 | 492 | // get attendee object |
493 | - if ( $primary_reg->attendee() instanceof EE_Attendee ) { |
|
493 | + if ($primary_reg->attendee() instanceof EE_Attendee) { |
|
494 | 494 | |
495 | 495 | //now we can setup the primary_attendee_data array |
496 | 496 | $this->primary_attendee_data = array( |
@@ -534,8 +534,8 @@ discard block |
||
534 | 534 | * @return bool returning true means we DO want to skip processing. returning false means we DON'T want to skip |
535 | 535 | * processing |
536 | 536 | */ |
537 | - protected function _skip_registration_for_processing( EE_Registration $registration ) { |
|
538 | - if ( empty( $this->filtered_reg_status ) ) { |
|
537 | + protected function _skip_registration_for_processing(EE_Registration $registration) { |
|
538 | + if (empty($this->filtered_reg_status)) { |
|
539 | 539 | return false; |
540 | 540 | } |
541 | 541 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | * @return float total taxes to apply to ticket. |
39 | 39 | * @throws \EE_Error |
40 | 40 | */ |
41 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
41 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
42 | 42 | $tax = 0; |
43 | 43 | $total_tax = 0; |
44 | 44 | //This first checks to see if the given ticket is taxable. |
45 | - if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
45 | + if ( ! $ticket->get('TKT_taxable')) { |
|
46 | 46 | return $tax; |
47 | 47 | } |
48 | 48 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
49 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
49 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
50 | 50 | //get taxes |
51 | 51 | $taxes = self::get_taxes_for_admin(); |
52 | 52 | //apply taxes to subtotal |
53 | - foreach ( $taxes as $tax ) { |
|
53 | + foreach ($taxes as $tax) { |
|
54 | 54 | //assuming taxes are not cumulative |
55 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
55 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
56 | 56 | } |
57 | 57 | return $total_tax; |
58 | 58 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function get_total_taxes_percentage() { |
70 | 70 | $total_tax_percent = 0; |
71 | - foreach ( self::get_taxes_for_admin() as $tax_price ) { |
|
72 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
71 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
72 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
73 | 73 | } |
74 | 74 | return $total_tax_percent; |
75 | 75 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @return float |
82 | 82 | * @throws \EE_Error |
83 | 83 | */ |
84 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $TKT_ID = $ticket->ID(); |
86 | - return isset( self::$_subtotal[ $TKT_ID ] ) |
|
87 | - ? self::$_subtotal[ $TKT_ID ] |
|
88 | - : self::_get_subtotal_for_admin( $ticket ); |
|
86 | + return isset(self::$_subtotal[$TKT_ID]) |
|
87 | + ? self::$_subtotal[$TKT_ID] |
|
88 | + : self::_get_subtotal_for_admin($ticket); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
100 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
101 | 101 | $subtotal = 0; |
102 | 102 | //get all prices |
103 | 103 | $prices = $ticket->get_many_related( |
104 | 104 | 'Price', |
105 | 105 | array( |
106 | 106 | 'default_where_conditions' => 'none', |
107 | - 'order_by' => array( 'PRC_order' => 'ASC' ), |
|
107 | + 'order_by' => array('PRC_order' => 'ASC'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | //let's loop through them (base price is always the first item) |
111 | - foreach ( $prices as $price ) { |
|
112 | - if ( $price instanceof EE_Price ) { |
|
111 | + foreach ($prices as $price) { |
|
112 | + if ($price instanceof EE_Price) { |
|
113 | 113 | $price_type = $price->type_obj(); |
114 | - if ( $price_type instanceof EE_Price_Type ) { |
|
115 | - switch ( $price->type_obj()->base_type() ) { |
|
114 | + if ($price_type instanceof EE_Price_Type) { |
|
115 | + switch ($price->type_obj()->base_type()) { |
|
116 | 116 | case 1: // base price |
117 | 117 | case 3: // surcharges |
118 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
119 | - : $price->get( 'PRC_amount' ); |
|
118 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
119 | + : $price->get('PRC_amount'); |
|
120 | 120 | break; |
121 | 121 | case 2: // discounts |
122 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
123 | - : $price->get( 'PRC_amount' ); |
|
122 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
123 | + : $price->get('PRC_amount'); |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | 129 | $TKT_ID = $ticket->ID(); |
130 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
130 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
131 | 131 | return $subtotal; |
132 | 132 | } |
133 | 133 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | * @throws \EE_Error |
141 | 141 | */ |
142 | 142 | public static function get_taxes_for_admin() { |
143 | - if ( empty( self::$_default_taxes ) ) { |
|
144 | - self::$_default_taxes = EE_Registry::instance()->load_model( 'Price' )->get_all( |
|
145 | - array( array( 'Price_Type.PBT_ID' => 4 ) ) |
|
143 | + if (empty(self::$_default_taxes)) { |
|
144 | + self::$_default_taxes = EE_Registry::instance()->load_model('Price')->get_all( |
|
145 | + array(array('Price_Type.PBT_ID' => 4)) |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | return self::$_default_taxes; |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <p><strong><?php _e('PayPal Standard', 'event_espresso'); ?></strong></p> |
2 | -<p><span class="required"><?php _e('Please Note! This gateway has been deprecated and replaced with the PayPal Express payment method. ', 'event_espresso'); ?> <?php printf( __('If you still want to use this gateway, please follow the directions to %1$sactivate it here%2$s.', 'event_espresso'), "<a href='https://eventespresso.com/wiki/paypal-standard-payment-gateway/#deprecated' target='_blank'>", '</a>'); ?></span></p> |
|
2 | +<p><span class="required"><?php _e('Please Note! This gateway has been deprecated and replaced with the PayPal Express payment method. ', 'event_espresso'); ?> <?php printf(__('If you still want to use this gateway, please follow the directions to %1$sactivate it here%2$s.', 'event_espresso'), "<a href='https://eventespresso.com/wiki/paypal-standard-payment-gateway/#deprecated' target='_blank'>", '</a>'); ?></span></p> |
|
3 | 3 | <p> |
4 | 4 | <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?> |
5 | 5 | </p> |
6 | 6 | <p> |
7 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?> |
|
7 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?> |
|
8 | 8 | </p> |
9 | 9 | <p><strong><?php _e('PayPal Standard Settings', 'event_espresso'); ?></strong></p> |
10 | 10 | <ul> |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | </li> |
23 | 23 | <li> |
24 | 24 | <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br /> |
25 | -<?php printf( __('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/> |
|
26 | -<?php _e( 'Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso' );?> |
|
25 | +<?php printf(__('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/> |
|
26 | +<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?> |
|
27 | 27 | </li> |
28 | 28 | <li> |
29 | 29 | <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br /> |
30 | 30 | <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it should calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/> |
31 | -<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?> |
|
31 | +<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?> |
|
32 | 32 | <li> |
33 | -<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/> |
|
34 | -<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/> |
|
35 | -<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?><br/> |
|
36 | -<?php _e( 'Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso' );?> |
|
33 | +<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/> |
|
34 | +<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/> |
|
35 | +<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/> |
|
36 | +<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | 39 | <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br /> |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @final |
485 | 485 | * @access protected |
486 | - * @return void |
|
486 | + * @return false|null |
|
487 | 487 | */ |
488 | 488 | final protected function _page_setup() { |
489 | 489 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
758 | 758 | * |
759 | 759 | * @access protected |
760 | - * @return void |
|
760 | + * @return false|null |
|
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | 763 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | /** |
820 | 820 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
821 | 821 | * @param string $route the route name we're verifying |
822 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
822 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
823 | 823 | */ |
824 | 824 | protected function _verify_route( $route ) { |
825 | 825 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -3411,7 +3411,7 @@ discard block |
||
3411 | 3411 | |
3412 | 3412 | |
3413 | 3413 | /** |
3414 | - * @return mixed |
|
3414 | + * @return string[] |
|
3415 | 3415 | */ |
3416 | 3416 | public function default_espresso_metaboxes() { |
3417 | 3417 | return $this->_default_espresso_metaboxes; |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | |
3430 | 3430 | |
3431 | 3431 | /** |
3432 | - * @return mixed |
|
3432 | + * @return string |
|
3433 | 3433 | */ |
3434 | 3434 | public function wp_page_slug() { |
3435 | 3435 | return $this->_wp_page_slug; |
@@ -862,34 +862,34 @@ discard block |
||
862 | 862 | |
863 | 863 | |
864 | 864 | |
865 | - /** |
|
866 | - * _route_admin_request() |
|
867 | - * Meat and potatoes of the class. Basically, this dude checks out what's being requested and sees if theres are some doodads to work the magic and handle the flingjangy. |
|
868 | - * Translation: Checks if the requested action is listed in the page routes and then will try to load the corresponding method. |
|
869 | - * |
|
870 | - * @access protected |
|
871 | - * @return void |
|
872 | - * @throws \EE_Error |
|
873 | - */ |
|
865 | + /** |
|
866 | + * _route_admin_request() |
|
867 | + * Meat and potatoes of the class. Basically, this dude checks out what's being requested and sees if theres are some doodads to work the magic and handle the flingjangy. |
|
868 | + * Translation: Checks if the requested action is listed in the page routes and then will try to load the corresponding method. |
|
869 | + * |
|
870 | + * @access protected |
|
871 | + * @return void |
|
872 | + * @throws \EE_Error |
|
873 | + */ |
|
874 | 874 | protected function _route_admin_request() { |
875 | 875 | if ( ! $this->_is_UI_request ){ |
876 | 876 | $this->_verify_routes(); |
877 | - } |
|
877 | + } |
|
878 | 878 | $nonce_check = isset( $this->_route_config['require_nonce'] ) |
879 | - ? $this->_route_config['require_nonce'] |
|
880 | - : true; |
|
879 | + ? $this->_route_config['require_nonce'] |
|
880 | + : true; |
|
881 | 881 | |
882 | 882 | if ( $this->_req_action !== 'default' && $nonce_check ) { |
883 | 883 | // set nonce from post data |
884 | 884 | $nonce = isset($this->_req_data[ $this->_req_nonce ]) |
885 | - ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) |
|
886 | - : ''; |
|
885 | + ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) |
|
886 | + : ''; |
|
887 | 887 | $this->_verify_nonce( $nonce, $this->_req_nonce ); |
888 | 888 | } |
889 | 889 | //set the nav_tabs array but ONLY if this is UI_request |
890 | 890 | if ( $this->_is_UI_request ){ |
891 | 891 | $this->_set_nav_tabs(); |
892 | - } |
|
892 | + } |
|
893 | 893 | // grab callback function |
894 | 894 | $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
895 | 895 | |
@@ -899,55 +899,55 @@ discard block |
||
899 | 899 | $error_msg = ''; |
900 | 900 | |
901 | 901 | // action right before calling route |
902 | - // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
|
902 | + // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
|
903 | 903 | if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
904 | 904 | do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
905 | 905 | } |
906 | 906 | |
907 | 907 | // right before calling the route, let's remove _wp_http_referer from the |
908 | - // $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
|
908 | + // $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
|
909 | 909 | $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
910 | 910 | |
911 | 911 | if ( ! empty( $func )) { |
912 | - if ( is_array( $func ) ) { |
|
913 | - list( $class, $method ) = $func; |
|
914 | - } else if ( strpos( $func, '::' ) !== false ) { |
|
915 | - list( $class, $method ) = explode( '::', $func ); |
|
916 | - } else { |
|
917 | - $class = $this; |
|
918 | - $method = $func; |
|
919 | - } |
|
920 | - if ( ! ( is_object( $class ) && $class === $this ) ) { |
|
921 | - // send along this admin page object for access by addons. |
|
922 | - $args['admin_page_object'] = $this; |
|
923 | - } |
|
924 | - if ( |
|
912 | + if ( is_array( $func ) ) { |
|
913 | + list( $class, $method ) = $func; |
|
914 | + } else if ( strpos( $func, '::' ) !== false ) { |
|
915 | + list( $class, $method ) = explode( '::', $func ); |
|
916 | + } else { |
|
917 | + $class = $this; |
|
918 | + $method = $func; |
|
919 | + } |
|
920 | + if ( ! ( is_object( $class ) && $class === $this ) ) { |
|
921 | + // send along this admin page object for access by addons. |
|
922 | + $args['admin_page_object'] = $this; |
|
923 | + } |
|
924 | + if ( |
|
925 | 925 | //is it a method on a class that doesn't work? |
926 | - ( |
|
927 | - method_exists( $class, $method ) |
|
928 | - && call_user_func_array( array( $class, $method ), $args ) === false |
|
929 | - ) || ( |
|
926 | + ( |
|
927 | + method_exists( $class, $method ) |
|
928 | + && call_user_func_array( array( $class, $method ), $args ) === false |
|
929 | + ) || ( |
|
930 | 930 | //is it a standalone function that doesn't work? |
931 | - function_exists( $method ) |
|
932 | - && call_user_func_array( $func, array_merge( array( 'admin_page_object' => $this ), $args ) ) === false |
|
933 | - ) || ( |
|
931 | + function_exists( $method ) |
|
932 | + && call_user_func_array( $func, array_merge( array( 'admin_page_object' => $this ), $args ) ) === false |
|
933 | + ) || ( |
|
934 | 934 | //is it neither a class method NOR a standalone function? |
935 | 935 | ! method_exists( $class, $method ) |
936 | 936 | && ! function_exists( $method ) |
937 | 937 | ) |
938 | - ) { |
|
939 | - // user error msg |
|
940 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
941 | - // developer error msg |
|
942 | - $error_msg .= '||'; |
|
943 | - $error_msg .= sprintf( |
|
944 | - __( |
|
945 | - 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', |
|
946 | - 'event_espresso' |
|
947 | - ), |
|
948 | - $method |
|
949 | - ); |
|
950 | - } |
|
938 | + ) { |
|
939 | + // user error msg |
|
940 | + $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
941 | + // developer error msg |
|
942 | + $error_msg .= '||'; |
|
943 | + $error_msg .= sprintf( |
|
944 | + __( |
|
945 | + 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', |
|
946 | + 'event_espresso' |
|
947 | + ), |
|
948 | + $method |
|
949 | + ); |
|
950 | + } |
|
951 | 951 | |
952 | 952 | if ( ! empty( $error_msg ) ) { |
953 | 953 | throw new EE_Error( $error_msg ); |
@@ -1340,8 +1340,8 @@ discard block |
||
1340 | 1340 | * verifies user access for this admin page |
1341 | 1341 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1342 | 1342 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1343 | - * @return BOOL|wp_die() |
|
1344 | - */ |
|
1343 | + * @return BOOL|wp_die() |
|
1344 | + */ |
|
1345 | 1345 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1346 | 1346 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1347 | 1347 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1727,11 +1727,11 @@ discard block |
||
1727 | 1727 | |
1728 | 1728 | |
1729 | 1729 | /** |
1730 | - * admin_footer_scripts_eei18n_js_strings |
|
1731 | - * |
|
1732 | - * @access public |
|
1733 | - * @return void |
|
1734 | - */ |
|
1730 | + * admin_footer_scripts_eei18n_js_strings |
|
1731 | + * |
|
1732 | + * @access public |
|
1733 | + * @return void |
|
1734 | + */ |
|
1735 | 1735 | public function admin_footer_scripts_eei18n_js_strings() { |
1736 | 1736 | |
1737 | 1737 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1787,11 +1787,11 @@ discard block |
||
1787 | 1787 | |
1788 | 1788 | |
1789 | 1789 | /** |
1790 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1791 | - * |
|
1792 | - * @access public |
|
1793 | - * @return void |
|
1794 | - */ |
|
1790 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1791 | + * |
|
1792 | + * @access public |
|
1793 | + * @return void |
|
1794 | + */ |
|
1795 | 1795 | public function add_xdebug_style() { |
1796 | 1796 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1797 | 1797 | } |
@@ -1848,9 +1848,9 @@ discard block |
||
1848 | 1848 | |
1849 | 1849 | /** |
1850 | 1850 | * set current view for List Table |
1851 | - * @access public |
|
1852 | - * @return array |
|
1853 | - */ |
|
1851 | + * @access public |
|
1852 | + * @return array |
|
1853 | + */ |
|
1854 | 1854 | protected function _set_list_table_view() { |
1855 | 1855 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1856 | 1856 | |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | * @access protected |
1940 | 1940 | * @param int $max_entries total number of rows in the table |
1941 | 1941 | * @return string |
1942 | - */ |
|
1942 | + */ |
|
1943 | 1943 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1944 | 1944 | |
1945 | 1945 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1984,9 +1984,9 @@ discard block |
||
1984 | 1984 | |
1985 | 1985 | /** |
1986 | 1986 | * _set_search_attributes |
1987 | - * @access protected |
|
1988 | - * @return void |
|
1989 | - */ |
|
1987 | + * @access protected |
|
1988 | + * @return void |
|
1989 | + */ |
|
1990 | 1990 | public function _set_search_attributes() { |
1991 | 1991 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1992 | 1992 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -2006,7 +2006,7 @@ discard block |
||
2006 | 2006 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
2007 | 2007 | * @access private |
2008 | 2008 | * @return void |
2009 | - */ |
|
2009 | + */ |
|
2010 | 2010 | private function _add_registered_meta_boxes() { |
2011 | 2011 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2012 | 2012 | |
@@ -2056,13 +2056,13 @@ discard block |
||
2056 | 2056 | * @return void |
2057 | 2057 | */ |
2058 | 2058 | private function _add_screen_columns() { |
2059 | - if ( |
|
2060 | - is_array($this->_route_config) |
|
2061 | - && isset( $this->_route_config['columns'] ) |
|
2062 | - && is_array($this->_route_config['columns']) |
|
2063 | - && count( $this->_route_config['columns'] ) === 2 |
|
2064 | - ) { |
|
2065 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2059 | + if ( |
|
2060 | + is_array($this->_route_config) |
|
2061 | + && isset( $this->_route_config['columns'] ) |
|
2062 | + && is_array($this->_route_config['columns']) |
|
2063 | + && count( $this->_route_config['columns'] ) === 2 |
|
2064 | + ) { |
|
2065 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2066 | 2066 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2067 | 2067 | $screen_id = $this->_current_screen->id; |
2068 | 2068 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
@@ -2242,7 +2242,6 @@ discard block |
||
2242 | 2242 | * Note: currently there is no validation for this. However if you want the delete button, the |
2243 | 2243 | * save, and save and close buttons to work properly, then you will want to include a |
2244 | 2244 | * values for the name and id arguments. |
2245 | - |
|
2246 | 2245 | * |
2247 | 2246 | *@todo Add in validation for name/id arguments. |
2248 | 2247 | * @param string $name key used for the action ID (i.e. event_id) |
@@ -2301,9 +2300,9 @@ discard block |
||
2301 | 2300 | |
2302 | 2301 | /** |
2303 | 2302 | * displays an error message to ppl who have javascript disabled |
2304 | - * @access private |
|
2305 | - * @return string |
|
2306 | - */ |
|
2303 | + * @access private |
|
2304 | + * @return string |
|
2305 | + */ |
|
2307 | 2306 | private function _display_no_javascript_warning() { |
2308 | 2307 | ?> |
2309 | 2308 | <noscript> |
@@ -2326,9 +2325,9 @@ discard block |
||
2326 | 2325 | |
2327 | 2326 | /** |
2328 | 2327 | * displays espresso success and/or error notices |
2329 | - * @access private |
|
2330 | - * @return string |
|
2331 | - */ |
|
2328 | + * @access private |
|
2329 | + * @return string |
|
2330 | + */ |
|
2332 | 2331 | private function _display_espresso_notices() { |
2333 | 2332 | $notices = $this->_get_transient( TRUE ); |
2334 | 2333 | echo stripslashes($notices); |
@@ -2340,10 +2339,10 @@ discard block |
||
2340 | 2339 | |
2341 | 2340 | |
2342 | 2341 | /** |
2343 | - * spinny things pacify the masses |
|
2344 | - * @access private |
|
2345 | - * @return string |
|
2346 | - */ |
|
2342 | + * spinny things pacify the masses |
|
2343 | + * @access private |
|
2344 | + * @return string |
|
2345 | + */ |
|
2347 | 2346 | protected function _add_admin_page_ajax_loading_img() { |
2348 | 2347 | ?> |
2349 | 2348 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2357,10 +2356,10 @@ discard block |
||
2357 | 2356 | |
2358 | 2357 | |
2359 | 2358 | /** |
2360 | - * add admin page overlay for modal boxes |
|
2361 | - * @access private |
|
2362 | - * @return string |
|
2363 | - */ |
|
2359 | + * add admin page overlay for modal boxes |
|
2360 | + * @access private |
|
2361 | + * @return string |
|
2362 | + */ |
|
2364 | 2363 | protected function _add_admin_page_overlay() { |
2365 | 2364 | ?> |
2366 | 2365 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2422,10 +2421,10 @@ discard block |
||
2422 | 2421 | |
2423 | 2422 | |
2424 | 2423 | /** |
2425 | - * generates HTML wrapper for an admin details page |
|
2426 | - * @access public |
|
2427 | - * @return void |
|
2428 | - */ |
|
2424 | + * generates HTML wrapper for an admin details page |
|
2425 | + * @access public |
|
2426 | + * @return void |
|
2427 | + */ |
|
2429 | 2428 | public function display_admin_page_with_sidebar() { |
2430 | 2429 | |
2431 | 2430 | $this->_display_admin_page(TRUE); |
@@ -2435,10 +2434,10 @@ discard block |
||
2435 | 2434 | |
2436 | 2435 | |
2437 | 2436 | /** |
2438 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2439 | - * @access public |
|
2440 | - * @return void |
|
2441 | - */ |
|
2437 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2438 | + * @access public |
|
2439 | + * @return void |
|
2440 | + */ |
|
2442 | 2441 | public function display_admin_page_with_no_sidebar() { |
2443 | 2442 | $this->_display_admin_page(); |
2444 | 2443 | } |
@@ -2477,18 +2476,18 @@ discard block |
||
2477 | 2476 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2478 | 2477 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2479 | 2478 | $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route |
2480 | - ? 'poststuff' |
|
2481 | - : 'espresso-default-admin'; |
|
2479 | + ? 'poststuff' |
|
2480 | + : 'espresso-default-admin'; |
|
2482 | 2481 | |
2483 | - $template_path = $sidebar |
|
2484 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2485 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2482 | + $template_path = $sidebar |
|
2483 | + ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2484 | + : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2486 | 2485 | |
2487 | 2486 | if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
2488 | 2487 | $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
2489 | - } |
|
2488 | + } |
|
2490 | 2489 | |
2491 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2490 | + $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2492 | 2491 | |
2493 | 2492 | $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
2494 | 2493 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
@@ -2701,11 +2700,11 @@ discard block |
||
2701 | 2700 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2702 | 2701 | if ( NULL === error_get_last() || ! headers_sent() ) |
2703 | 2702 | header('Content-Type: application/json; charset=UTF-8'); |
2704 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2705 | - echo wp_json_encode( $json ); |
|
2706 | - } else { |
|
2707 | - echo json_encode( $json ); |
|
2708 | - } |
|
2703 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2704 | + echo wp_json_encode( $json ); |
|
2705 | + } else { |
|
2706 | + echo json_encode( $json ); |
|
2707 | + } |
|
2709 | 2708 | exit(); |
2710 | 2709 | } |
2711 | 2710 | |
@@ -2744,11 +2743,11 @@ discard block |
||
2744 | 2743 | |
2745 | 2744 | |
2746 | 2745 | /** |
2747 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2748 | - * @access public |
|
2749 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2750 | - * @return void |
|
2751 | - */ |
|
2746 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2747 | + * @access public |
|
2748 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2749 | + * @return void |
|
2750 | + */ |
|
2752 | 2751 | public function admin_page_wrapper($about = FALSE) { |
2753 | 2752 | |
2754 | 2753 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2805,9 +2804,9 @@ discard block |
||
2805 | 2804 | */ |
2806 | 2805 | private function _sort_nav_tabs( $a, $b ) { |
2807 | 2806 | if ($a['order'] == $b['order']) { |
2808 | - return 0; |
|
2809 | - } |
|
2810 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2807 | + return 0; |
|
2808 | + } |
|
2809 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2811 | 2810 | } |
2812 | 2811 | |
2813 | 2812 |
@@ -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 |
@@ -462,16 +462,16 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function _global_ajax_hooks() { |
464 | 464 | //for lazy loading of metabox content |
465 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
465 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
469 | 469 | |
470 | 470 | public function ajax_metabox_content() { |
471 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
472 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
471 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
472 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
473 | 473 | |
474 | - self::cached_rss_display( $contentid, $url ); |
|
474 | + self::cached_rss_display($contentid, $url); |
|
475 | 475 | wp_die(); |
476 | 476 | } |
477 | 477 | |
@@ -490,87 +490,87 @@ discard block |
||
490 | 490 | //requires? |
491 | 491 | |
492 | 492 | //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. |
493 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
493 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
494 | 494 | |
495 | 495 | |
496 | 496 | //next verify if we need to load anything... |
497 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
498 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
497 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
498 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
499 | 499 | |
500 | 500 | global $ee_menu_slugs; |
501 | 501 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 502 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
503 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
504 | 504 | |
505 | 505 | |
506 | 506 | // 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 |
507 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
508 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
508 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
509 | 509 | } |
510 | 510 | // then set blank or -1 action values to 'default' |
511 | - $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 | + $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'; |
|
512 | 512 | |
513 | 513 | //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. |
514 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
515 | 515 | |
516 | 516 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
517 | 517 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
518 | 518 | |
519 | 519 | $this->_current_view = $this->_req_action; |
520 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
520 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
521 | 521 | $this->_define_page_props(); |
522 | 522 | |
523 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
523 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
524 | 524 | |
525 | 525 | //default things |
526 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
526 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
527 | 527 | |
528 | 528 | //set page configs |
529 | 529 | $this->_set_page_routes(); |
530 | 530 | $this->_set_page_config(); |
531 | 531 | |
532 | 532 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
533 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
533 | + if (isset($this->_req_data['wp_referer'])) { |
|
534 | 534 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
535 | 535 | } |
536 | 536 | |
537 | 537 | //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 |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config')) |
|
539 | 539 | $this->_extend_page_config(); |
540 | 540 | |
541 | 541 | //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. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
543 | 543 | $this->_extend_page_config_for_cpt(); |
544 | 544 | |
545 | 545 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
547 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
546 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
547 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //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 |
551 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
552 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
551 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
552 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
556 | 556 | //next route only if routing enabled |
557 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
557 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
558 | 558 | |
559 | 559 | $this->_verify_routes(); |
560 | 560 | |
561 | 561 | //next let's just check user_access and kill if no access |
562 | 562 | $this->check_user_access(); |
563 | 563 | |
564 | - if ( $this->_is_UI_request ) { |
|
564 | + if ($this->_is_UI_request) { |
|
565 | 565 | //admin_init stuff - global, all views for this page class, specific view |
566 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
567 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
568 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
566 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
567 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
568 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | } else { |
572 | 572 | //hijack regular WP loading and route admin request immediately |
573 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
573 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
574 | 574 | $this->route_admin_request(); |
575 | 575 | } |
576 | 576 | } |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | * @return void |
588 | 588 | */ |
589 | 589 | private function _do_other_page_hooks() { |
590 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
590 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
591 | 591 | |
592 | - foreach ( $registered_pages as $page ) { |
|
592 | + foreach ($registered_pages as $page) { |
|
593 | 593 | |
594 | 594 | //now let's setup the file name and class that should be present |
595 | 595 | $classname = str_replace('.class.php', '', $page); |
596 | 596 | |
597 | 597 | //autoloaders should take care of loading file |
598 | - if ( !class_exists( $classname ) ) { |
|
599 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
600 | - $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 ); |
|
601 | - throw new EE_Error( implode( '||', $error_msg )); |
|
598 | + if ( ! class_exists($classname)) { |
|
599 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
600 | + $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); |
|
601 | + throw new EE_Error(implode('||', $error_msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $a = new ReflectionClass($classname); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function load_page_dependencies() { |
614 | 614 | try { |
615 | 615 | $this->_load_page_dependencies(); |
616 | - } catch ( EE_Error $e ) { |
|
616 | + } catch (EE_Error $e) { |
|
617 | 617 | $e->get_error(); |
618 | 618 | } |
619 | 619 | } |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | $this->_current_screen = get_current_screen(); |
632 | 632 | |
633 | 633 | //load admin_notices - global, page class, and view specific |
634 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
636 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
637 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
635 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
636 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
637 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | //load network admin_notices - global, page class, and view specific |
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
642 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
643 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
642 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
643 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | //this will save any per_page screen options if they are present |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | //add screen options - global, page child class, and view specific |
657 | 657 | $this->_add_global_screen_options(); |
658 | 658 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | |
663 | 663 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,33 +668,33 @@ discard block |
||
668 | 668 | //add feature_pointers - global, page child class, and view specific |
669 | 669 | $this->_add_feature_pointers(); |
670 | 670 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
671 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
672 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
673 | 673 | |
674 | 674 | //enqueue scripts/styles - global, page class, and view specific |
675 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
677 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
679 | 679 | |
680 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
680 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
681 | 681 | |
682 | 682 | //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 |
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
685 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
686 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
687 | 687 | |
688 | 688 | //admin footer scripts |
689 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
690 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
691 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
692 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
693 | 693 | |
694 | 694 | |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
696 | 696 | //targeted hook |
697 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
697 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | private function _set_defaults() { |
710 | 710 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
711 | 711 | |
712 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
713 | 713 | |
714 | 714 | $this->default_nav_tab_name = 'overview'; |
715 | 715 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | public function route_admin_request() { |
737 | 737 | try { |
738 | 738 | $this->_route_admin_request(); |
739 | - } catch ( EE_Error $e ) { |
|
739 | + } catch (EE_Error $e) { |
|
740 | 740 | $e->get_error(); |
741 | 741 | } |
742 | 742 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $this->_wp_page_slug = $wp_page_slug; |
748 | 748 | |
749 | 749 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
750 | - if ( is_network_admin() ) { |
|
750 | + if (is_network_admin()) { |
|
751 | 751 | $this->_wp_page_slug .= '-network'; |
752 | 752 | } |
753 | 753 | } |
@@ -760,53 +760,53 @@ discard block |
||
760 | 760 | * @return void |
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
763 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
764 | 764 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
765 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
766 | 766 | |
767 | 767 | $this->_route = FALSE; |
768 | 768 | $func = FALSE; |
769 | 769 | $args = array(); |
770 | 770 | |
771 | 771 | // check that the page_routes array is not empty |
772 | - if ( empty( $this->_page_routes )) { |
|
772 | + if (empty($this->_page_routes)) { |
|
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that the requested page route exists |
781 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
782 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
781 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
782 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
783 | 783 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
784 | 784 | } else { |
785 | 785 | // user error msg |
786 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
786 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
787 | 787 | // developer error msg |
788 | - $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 ); |
|
789 | - throw new EE_Error( $error_msg ); |
|
788 | + $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); |
|
789 | + throw new EE_Error($error_msg); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // and that a default route exists |
793 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
793 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
794 | 794 | // user error msg |
795 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
795 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
796 | 796 | // developer error msg |
797 | - $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' ); |
|
798 | - throw new EE_Error( $error_msg ); |
|
797 | + $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'); |
|
798 | + throw new EE_Error($error_msg); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
802 | 802 | //first lets' catch if the UI request has EVER been set. |
803 | - if ( $this->_is_UI_request === NULL ) { |
|
803 | + if ($this->_is_UI_request === NULL) { |
|
804 | 804 | //lets set if this is a UI request or not. |
805 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
805 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
806 | 806 | |
807 | 807 | |
808 | 808 | //wait a minute... we might have a noheader in the route array |
809 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
809 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->_set_current_labels(); |
@@ -821,15 +821,15 @@ discard block |
||
821 | 821 | * @param string $route the route name we're verifying |
822 | 822 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
823 | 823 | */ |
824 | - protected function _verify_route( $route ) { |
|
825 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
824 | + protected function _verify_route($route) { |
|
825 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
826 | 826 | return true; |
827 | 827 | } else { |
828 | 828 | // user error msg |
829 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
829 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
830 | 830 | // developer error msg |
831 | - $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 ); |
|
832 | - throw new EE_Error( $error_msg ); |
|
831 | + $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); |
|
832 | + throw new EE_Error($error_msg); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
@@ -843,18 +843,18 @@ discard block |
||
843 | 843 | * @param string $nonce_ref The nonce reference string (name0) |
844 | 844 | * @return mixed (bool|die) |
845 | 845 | */ |
846 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
846 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
847 | 847 | // verify nonce against expected value |
848 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
848 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
849 | 849 | // these are not the droids you are looking for !!! |
850 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
851 | - if ( WP_DEBUG ) { |
|
852 | - $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__ ); |
|
850 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
851 | + if (WP_DEBUG) { |
|
852 | + $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__); |
|
853 | 853 | } |
854 | - if ( ! defined( 'DOING_AJAX' )) { |
|
855 | - wp_die( $msg ); |
|
854 | + if ( ! defined('DOING_AJAX')) { |
|
855 | + wp_die($msg); |
|
856 | 856 | } else { |
857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
858 | 858 | $this->_return_json(); |
859 | 859 | } |
860 | 860 | } |
@@ -872,72 +872,72 @@ discard block |
||
872 | 872 | * @throws \EE_Error |
873 | 873 | */ |
874 | 874 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ){ |
|
875 | + if ( ! $this->_is_UI_request) { |
|
876 | 876 | $this->_verify_routes(); |
877 | 877 | } |
878 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) |
|
878 | + $nonce_check = isset($this->_route_config['require_nonce']) |
|
879 | 879 | ? $this->_route_config['require_nonce'] |
880 | 880 | : true; |
881 | 881 | |
882 | - if ( $this->_req_action !== 'default' && $nonce_check ) { |
|
882 | + if ($this->_req_action !== 'default' && $nonce_check) { |
|
883 | 883 | // set nonce from post data |
884 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) |
|
885 | - ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) |
|
884 | + $nonce = isset($this->_req_data[$this->_req_nonce]) |
|
885 | + ? sanitize_text_field($this->_req_data[$this->_req_nonce]) |
|
886 | 886 | : ''; |
887 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
887 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
888 | 888 | } |
889 | 889 | //set the nav_tabs array but ONLY if this is UI_request |
890 | - if ( $this->_is_UI_request ){ |
|
890 | + if ($this->_is_UI_request) { |
|
891 | 891 | $this->_set_nav_tabs(); |
892 | 892 | } |
893 | 893 | // grab callback function |
894 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
894 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
895 | 895 | |
896 | 896 | // check if callback has args |
897 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
897 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
898 | 898 | |
899 | 899 | $error_msg = ''; |
900 | 900 | |
901 | 901 | // action right before calling route |
902 | 902 | // (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
903 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
904 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
903 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
904 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | // right before calling the route, let's remove _wp_http_referer from the |
908 | 908 | // $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
909 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
909 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
910 | 910 | |
911 | - if ( ! empty( $func )) { |
|
912 | - if ( is_array( $func ) ) { |
|
913 | - list( $class, $method ) = $func; |
|
914 | - } else if ( strpos( $func, '::' ) !== false ) { |
|
915 | - list( $class, $method ) = explode( '::', $func ); |
|
911 | + if ( ! empty($func)) { |
|
912 | + if (is_array($func)) { |
|
913 | + list($class, $method) = $func; |
|
914 | + } else if (strpos($func, '::') !== false) { |
|
915 | + list($class, $method) = explode('::', $func); |
|
916 | 916 | } else { |
917 | 917 | $class = $this; |
918 | 918 | $method = $func; |
919 | 919 | } |
920 | - if ( ! ( is_object( $class ) && $class === $this ) ) { |
|
920 | + if ( ! (is_object($class) && $class === $this)) { |
|
921 | 921 | // send along this admin page object for access by addons. |
922 | 922 | $args['admin_page_object'] = $this; |
923 | 923 | } |
924 | 924 | if ( |
925 | 925 | //is it a method on a class that doesn't work? |
926 | 926 | ( |
927 | - method_exists( $class, $method ) |
|
928 | - && call_user_func_array( array( $class, $method ), $args ) === false |
|
927 | + method_exists($class, $method) |
|
928 | + && call_user_func_array(array($class, $method), $args) === false |
|
929 | 929 | ) || ( |
930 | 930 | //is it a standalone function that doesn't work? |
931 | - function_exists( $method ) |
|
932 | - && call_user_func_array( $func, array_merge( array( 'admin_page_object' => $this ), $args ) ) === false |
|
931 | + function_exists($method) |
|
932 | + && call_user_func_array($func, array_merge(array('admin_page_object' => $this), $args)) === false |
|
933 | 933 | ) || ( |
934 | 934 | //is it neither a class method NOR a standalone function? |
935 | - ! method_exists( $class, $method ) |
|
936 | - && ! function_exists( $method ) |
|
935 | + ! method_exists($class, $method) |
|
936 | + && ! function_exists($method) |
|
937 | 937 | ) |
938 | 938 | ) { |
939 | 939 | // user error msg |
940 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
940 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
941 | 941 | // developer error msg |
942 | 942 | $error_msg .= '||'; |
943 | 943 | $error_msg .= sprintf( |
@@ -949,15 +949,15 @@ discard block |
||
949 | 949 | ); |
950 | 950 | } |
951 | 951 | |
952 | - if ( ! empty( $error_msg ) ) { |
|
953 | - throw new EE_Error( $error_msg ); |
|
952 | + if ( ! empty($error_msg)) { |
|
953 | + throw new EE_Error($error_msg); |
|
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
957 | 957 | //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. |
958 | 958 | //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. |
959 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
960 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
959 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
960 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
961 | 961 | } |
962 | 962 | } |
963 | 963 | |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | * @param string $new_route New (non header) route to redirect to. |
974 | 974 | * @return void |
975 | 975 | */ |
976 | - protected function _reset_routing_properties( $new_route ) { |
|
976 | + protected function _reset_routing_properties($new_route) { |
|
977 | 977 | $this->_is_UI_request = TRUE; |
978 | 978 | //now we set the current route to whatever the headers_sent_route is set at |
979 | 979 | $this->_req_data['action'] = $new_route; |
@@ -1019,23 +1019,23 @@ discard block |
||
1019 | 1019 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
1020 | 1020 | * @return string |
1021 | 1021 | */ |
1022 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
1022 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
1023 | 1023 | |
1024 | 1024 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
1025 | - if ( $sticky ) { |
|
1025 | + if ($sticky) { |
|
1026 | 1026 | $request = $_REQUEST; |
1027 | - unset( $request['_wp_http_referer'] ); |
|
1028 | - unset( $request['wp_referer'] ); |
|
1029 | - foreach ( $request as $key => $value ) { |
|
1027 | + unset($request['_wp_http_referer']); |
|
1028 | + unset($request['wp_referer']); |
|
1029 | + foreach ($request as $key => $value) { |
|
1030 | 1030 | //do not add nonces |
1031 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1031 | + if (strpos($key, 'nonce') !== false) { |
|
1032 | 1032 | continue; |
1033 | 1033 | } |
1034 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1034 | + $args['wp_referer['.$key.']'] = $value; |
|
1035 | 1035 | } |
1036 | 1036 | } |
1037 | 1037 | |
1038 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1038 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
@@ -1051,8 +1051,8 @@ discard block |
||
1051 | 1051 | * @uses EEH_Template::get_help_tab_link() |
1052 | 1052 | * @return string generated link |
1053 | 1053 | */ |
1054 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1055 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1054 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1055 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | |
@@ -1069,30 +1069,30 @@ discard block |
||
1069 | 1069 | */ |
1070 | 1070 | protected function _add_help_tabs() { |
1071 | 1071 | $tour_buttons = ''; |
1072 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1072 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1073 | 1073 | $config = $this->_page_config[$this->_req_action]; |
1074 | 1074 | |
1075 | 1075 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1076 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1076 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1077 | 1077 | $tb = array(); |
1078 | 1078 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1079 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1079 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1080 | 1080 | //if this is the end tour then we don't need to setup a button |
1081 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1081 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1082 | 1082 | continue; |
1083 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1083 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1084 | 1084 | } |
1085 | 1085 | $tour_buttons .= implode('<br />', $tb); |
1086 | 1086 | $tour_buttons .= '</div></div>'; |
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1090 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1090 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1091 | 1091 | //check that the callback given is valid |
1092 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1093 | - 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) ) ); |
|
1092 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1093 | + 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))); |
|
1094 | 1094 | |
1095 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1095 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1096 | 1096 | |
1097 | 1097 | $content .= $tour_buttons; //add help tour buttons. |
1098 | 1098 | |
@@ -1101,49 +1101,49 @@ discard block |
||
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1104 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1104 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1105 | 1105 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1109 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1109 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1110 | 1110 | $_ht['id'] = $this->page_slug; |
1111 | 1111 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1112 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1112 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1113 | 1113 | $this->_current_screen->add_help_tab($_ht); |
1114 | 1114 | }/**/ |
1115 | 1115 | |
1116 | 1116 | |
1117 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1117 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1118 | 1118 | |
1119 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1119 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1120 | 1120 | //we're here so there ARE help tabs! |
1121 | 1121 | |
1122 | 1122 | //make sure we've got what we need |
1123 | - if ( !isset( $cfg['title'] ) ) |
|
1124 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1123 | + if ( ! isset($cfg['title'])) |
|
1124 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1125 | 1125 | |
1126 | 1126 | |
1127 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1128 | - 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') ); |
|
1127 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1128 | + 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')); |
|
1129 | 1129 | |
1130 | 1130 | |
1131 | 1131 | |
1132 | 1132 | //first priority goes to content. |
1133 | - if ( !empty($cfg['content'] ) ) { |
|
1134 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1133 | + if ( ! empty($cfg['content'])) { |
|
1134 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1135 | 1135 | |
1136 | 1136 | //second priority goes to filename |
1137 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1138 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1137 | + } else if ( ! empty($cfg['filename'])) { |
|
1138 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1139 | 1139 | |
1140 | 1140 | |
1141 | 1141 | //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) |
1142 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1142 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1143 | 1143 | |
1144 | 1144 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1145 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1146 | - 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__ ); |
|
1145 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1146 | + 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__); |
|
1147 | 1147 | return; |
1148 | 1148 | } |
1149 | 1149 | $template_args['admin_page_obj'] = $this; |
@@ -1154,21 +1154,21 @@ discard block |
||
1154 | 1154 | |
1155 | 1155 | |
1156 | 1156 | //check if callback is valid |
1157 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1158 | - 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__ ); |
|
1157 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1158 | + 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__); |
|
1159 | 1159 | return; |
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | //setup config array for help tab method |
1163 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1163 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1164 | 1164 | $_ht = array( |
1165 | 1165 | 'id' => $id, |
1166 | 1166 | 'title' => $cfg['title'], |
1167 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1167 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1168 | 1168 | 'content' => $content |
1169 | 1169 | ); |
1170 | 1170 | |
1171 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1171 | + $this->_current_screen->add_help_tab($_ht); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,49 +1188,49 @@ discard block |
||
1188 | 1188 | $this->_help_tour = array(); |
1189 | 1189 | |
1190 | 1190 | //exit early if help tours are turned off globally |
1191 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1191 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1192 | 1192 | return; |
1193 | 1193 | |
1194 | 1194 | //loop through _page_config to find any help_tour defined |
1195 | - foreach ( $this->_page_config as $route => $config ) { |
|
1195 | + foreach ($this->_page_config as $route => $config) { |
|
1196 | 1196 | //we're only going to set things up for this route |
1197 | - if ( $route !== $this->_req_action ) |
|
1197 | + if ($route !== $this->_req_action) |
|
1198 | 1198 | continue; |
1199 | 1199 | |
1200 | - if ( isset( $config['help_tour'] ) ) { |
|
1200 | + if (isset($config['help_tour'])) { |
|
1201 | 1201 | |
1202 | - foreach( $config['help_tour'] as $tour ) { |
|
1203 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1202 | + foreach ($config['help_tour'] as $tour) { |
|
1203 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1204 | 1204 | //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 |
1205 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1205 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1206 | 1206 | |
1207 | 1207 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1208 | - if ( !is_readable($file_path) ) { |
|
1209 | - 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__ ); |
|
1208 | + if ( ! is_readable($file_path)) { |
|
1209 | + 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__); |
|
1210 | 1210 | return; |
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | require_once $file_path; |
1214 | - if ( !class_exists( $tour ) ) { |
|
1215 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1216 | - $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) ); |
|
1217 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1214 | + if ( ! class_exists($tour)) { |
|
1215 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1216 | + $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)); |
|
1217 | + throw new EE_Error(implode('||', $error_msg)); |
|
1218 | 1218 | } |
1219 | 1219 | $a = new ReflectionClass($tour); |
1220 | 1220 | $tour_obj = $a->newInstance($this->_is_caf); |
1221 | 1221 | |
1222 | 1222 | $tours[] = $tour_obj; |
1223 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1223 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1227 | 1227 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1228 | 1228 | $tours[] = $end_stop_tour; |
1229 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1229 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1230 | 1230 | } |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - if ( !empty( $tours ) ) |
|
1233 | + if ( ! empty($tours)) |
|
1234 | 1234 | $this->_help_tour['tours'] = $tours; |
1235 | 1235 | |
1236 | 1236 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1246,12 +1246,12 @@ discard block |
||
1246 | 1246 | * @return void |
1247 | 1247 | */ |
1248 | 1248 | protected function _add_qtips() { |
1249 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1249 | + if (isset($this->_route_config['qtips'])) { |
|
1250 | 1250 | $qtips = (array) $this->_route_config['qtips']; |
1251 | 1251 | //load qtip loader |
1252 | 1252 | $path = array( |
1253 | - $this->_get_dir() . '/qtips/', |
|
1254 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1253 | + $this->_get_dir().'/qtips/', |
|
1254 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1255 | 1255 | ); |
1256 | 1256 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1257 | 1257 | } |
@@ -1268,41 +1268,41 @@ discard block |
||
1268 | 1268 | * @return void |
1269 | 1269 | */ |
1270 | 1270 | protected function _set_nav_tabs() { |
1271 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1271 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1272 | 1272 | $i = 0; |
1273 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1274 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1273 | + foreach ($this->_page_config as $slug => $config) { |
|
1274 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1275 | 1275 | continue; //no nav tab for this config |
1276 | 1276 | |
1277 | 1277 | //check for persistent flag |
1278 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1278 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1279 | 1279 | continue; //nav tab is only to appear when route requested. |
1280 | 1280 | |
1281 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1281 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1282 | 1282 | continue; //no nav tab becasue current user does not have access. |
1283 | 1283 | |
1284 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1284 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1285 | 1285 | $this->_nav_tabs[$slug] = array( |
1286 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1287 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1288 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1289 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1286 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1287 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1288 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1289 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1290 | 1290 | ); |
1291 | 1291 | $i++; |
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | //if $this->_nav_tabs is empty then lets set the default |
1295 | - if ( empty( $this->_nav_tabs ) ) { |
|
1295 | + if (empty($this->_nav_tabs)) { |
|
1296 | 1296 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1297 | 1297 | 'url' => $this->admin_base_url, |
1298 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1298 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1299 | 1299 | 'css_class' => 'nav-tab-active', |
1300 | 1300 | 'order' => 10 |
1301 | 1301 | ); |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | //now let's sort the tabs according to order |
1305 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1305 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1306 | 1306 | |
1307 | 1307 | } |
1308 | 1308 | |
@@ -1318,10 +1318,10 @@ discard block |
||
1318 | 1318 | * @return void |
1319 | 1319 | */ |
1320 | 1320 | private function _set_current_labels() { |
1321 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1322 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1323 | - if ( is_array($text) ) { |
|
1324 | - foreach ( $text as $sublabel => $subtext ) { |
|
1321 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1322 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1323 | + if (is_array($text)) { |
|
1324 | + foreach ($text as $sublabel => $subtext) { |
|
1325 | 1325 | $this->_labels[$label][$sublabel] = $subtext; |
1326 | 1326 | } |
1327 | 1327 | } else { |
@@ -1342,24 +1342,24 @@ discard block |
||
1342 | 1342 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1343 | 1343 | * @return BOOL|wp_die() |
1344 | 1344 | */ |
1345 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1346 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1347 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1348 | - $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; |
|
1345 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1346 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1347 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1348 | + $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; |
|
1349 | 1349 | |
1350 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1351 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1350 | + if (empty($capability) && empty($route_to_check)) { |
|
1351 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1352 | 1352 | } else { |
1353 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1353 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1354 | 1354 | } |
1355 | 1355 | |
1356 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1356 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1357 | 1357 | |
1358 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1359 | - if ( $verify_only ) { |
|
1358 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1359 | + if ($verify_only) { |
|
1360 | 1360 | return FALSE; |
1361 | 1361 | } else { |
1362 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1362 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1363 | 1363 | } |
1364 | 1364 | } |
1365 | 1365 | return TRUE; |
@@ -1436,7 +1436,7 @@ discard block |
||
1436 | 1436 | $this->_add_admin_page_overlay(); |
1437 | 1437 | |
1438 | 1438 | //if metaboxes are present we need to add the nonce field |
1439 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1439 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1440 | 1440 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1441 | 1441 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1442 | 1442 | } |
@@ -1455,19 +1455,19 @@ discard block |
||
1455 | 1455 | */ |
1456 | 1456 | public function admin_footer_global() { |
1457 | 1457 | //dialog container for dialog helper |
1458 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1458 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1459 | 1459 | $d_cont .= '<div class="ee-notices"></div>'; |
1460 | 1460 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1461 | 1461 | $d_cont .= '</div>'; |
1462 | 1462 | echo $d_cont; |
1463 | 1463 | |
1464 | 1464 | //help tour stuff? |
1465 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1465 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1466 | 1466 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | //current set timezone for timezone js |
1470 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1470 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | |
@@ -1491,18 +1491,18 @@ discard block |
||
1491 | 1491 | * @access protected |
1492 | 1492 | * @return string content |
1493 | 1493 | */ |
1494 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1494 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1495 | 1495 | $content = ''; |
1496 | 1496 | |
1497 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1498 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1497 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1498 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1499 | 1499 | |
1500 | 1500 | |
1501 | 1501 | //loop through the array and setup content |
1502 | - foreach ( $help_array as $trigger => $help ) { |
|
1502 | + foreach ($help_array as $trigger => $help) { |
|
1503 | 1503 | //make sure the array is setup properly |
1504 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1505 | - 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') ); |
|
1504 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1505 | + 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')); |
|
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1512,10 +1512,10 @@ discard block |
||
1512 | 1512 | 'help_popup_content' => $help['content'] |
1513 | 1513 | ); |
1514 | 1514 | |
1515 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1515 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1516 | 1516 | } |
1517 | 1517 | |
1518 | - if ( $display ) |
|
1518 | + if ($display) |
|
1519 | 1519 | echo $content; |
1520 | 1520 | else |
1521 | 1521 | return $content; |
@@ -1532,18 +1532,18 @@ discard block |
||
1532 | 1532 | */ |
1533 | 1533 | private function _get_help_content() { |
1534 | 1534 | //what is the method we're looking for? |
1535 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1535 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1536 | 1536 | |
1537 | 1537 | //if method doesn't exist let's get out. |
1538 | - if ( !method_exists( $this, $method_name ) ) |
|
1538 | + if ( ! method_exists($this, $method_name)) |
|
1539 | 1539 | return array(); |
1540 | 1540 | |
1541 | 1541 | //k we're good to go let's retrieve the help array |
1542 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1542 | + $help_array = call_user_func(array($this, $method_name)); |
|
1543 | 1543 | |
1544 | 1544 | //make sure we've got an array! |
1545 | - if ( !is_array($help_array) ) { |
|
1546 | - 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' ) ); |
|
1545 | + if ( ! is_array($help_array)) { |
|
1546 | + 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')); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | return $help_array; |
@@ -1565,27 +1565,27 @@ discard block |
||
1565 | 1565 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1566 | 1566 | * @return string |
1567 | 1567 | */ |
1568 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1568 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1569 | 1569 | |
1570 | - if ( defined('DOING_AJAX') ) return; |
|
1570 | + if (defined('DOING_AJAX')) return; |
|
1571 | 1571 | |
1572 | 1572 | //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 |
1573 | 1573 | $help_array = $this->_get_help_content(); |
1574 | 1574 | $help_content = ''; |
1575 | 1575 | |
1576 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1576 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1577 | 1577 | $help_array[$trigger_id] = array( |
1578 | 1578 | 'title' => __('Missing Content', 'event_espresso'), |
1579 | 1579 | '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') |
1580 | 1580 | ); |
1581 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1581 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | //let's setup the trigger |
1585 | - $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>'; |
|
1586 | - $content = $content . $help_content; |
|
1585 | + $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>'; |
|
1586 | + $content = $content.$help_content; |
|
1587 | 1587 | |
1588 | - if ( $display ) |
|
1588 | + if ($display) |
|
1589 | 1589 | echo $content; |
1590 | 1590 | else |
1591 | 1591 | return $content; |
@@ -1642,15 +1642,15 @@ discard block |
||
1642 | 1642 | public function load_global_scripts_styles() { |
1643 | 1643 | /** STYLES **/ |
1644 | 1644 | // add debugging styles |
1645 | - if ( WP_DEBUG ) { |
|
1646 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1645 | + if (WP_DEBUG) { |
|
1646 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1647 | 1647 | } |
1648 | 1648 | |
1649 | 1649 | //register all styles |
1650 | - 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 ); |
|
1651 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1650 | + 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); |
|
1651 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1652 | 1652 | //helpers styles |
1653 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1653 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1654 | 1654 | //enqueue global styles |
1655 | 1655 | wp_enqueue_style('ee-admin-css'); |
1656 | 1656 | |
@@ -1658,66 +1658,66 @@ discard block |
||
1658 | 1658 | /** SCRIPTS **/ |
1659 | 1659 | |
1660 | 1660 | //register all scripts |
1661 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1662 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1663 | - 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 ); |
|
1661 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1662 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1663 | + 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); |
|
1664 | 1664 | |
1665 | - 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 ); |
|
1665 | + 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); |
|
1666 | 1666 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1667 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1667 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1668 | 1668 | add_filter('FHEE_load_joyride', '__return_true'); |
1669 | 1669 | |
1670 | 1670 | //script for sorting tables |
1671 | - 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); |
|
1671 | + 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); |
|
1672 | 1672 | //script for parsing uri's |
1673 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1673 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1674 | 1674 | //and parsing associative serialized form elements |
1675 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1675 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1676 | 1676 | //helpers scripts |
1677 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1678 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1679 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1680 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1677 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1678 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1679 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1680 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1681 | 1681 | |
1682 | 1682 | //google charts |
1683 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1683 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1684 | 1684 | |
1685 | 1685 | //enqueue global scripts |
1686 | 1686 | |
1687 | 1687 | //taking care of metaboxes |
1688 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1688 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1689 | 1689 | wp_enqueue_script('dashboard'); |
1690 | 1690 | } |
1691 | 1691 | |
1692 | 1692 | //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 |
1693 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1693 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1694 | 1694 | wp_enqueue_script('ee_admin_js'); |
1695 | 1695 | wp_enqueue_style('ee-admin-css'); |
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | |
1699 | 1699 | //localize script for ajax lazy loading |
1700 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1701 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1700 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1701 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1702 | 1702 | |
1703 | 1703 | |
1704 | 1704 | /** |
1705 | 1705 | * help tour stuff |
1706 | 1706 | */ |
1707 | - if ( !empty( $this->_help_tour ) ) { |
|
1707 | + if ( ! empty($this->_help_tour)) { |
|
1708 | 1708 | |
1709 | 1709 | //register the js for kicking things off |
1710 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1710 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1711 | 1711 | |
1712 | 1712 | //setup tours for the js tour object |
1713 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1713 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1714 | 1714 | $tours[] = array( |
1715 | 1715 | 'id' => $tour->get_slug(), |
1716 | 1716 | 'options' => $tour->get_options() |
1717 | 1717 | ); |
1718 | 1718 | } |
1719 | 1719 | |
1720 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1720 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1721 | 1721 | |
1722 | 1722 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1723 | 1723 | } |
@@ -1735,52 +1735,52 @@ discard block |
||
1735 | 1735 | public function admin_footer_scripts_eei18n_js_strings() { |
1736 | 1736 | |
1737 | 1737 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1738 | - 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' ); |
|
1739 | - |
|
1740 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1750 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1751 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1752 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1753 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1754 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1755 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1756 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1757 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1758 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1759 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1760 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1761 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1762 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1763 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1764 | - |
|
1765 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1766 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1767 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1768 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1769 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1770 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1771 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1772 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1773 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1774 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1775 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1776 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1777 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1778 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1738 | + 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'); |
|
1739 | + |
|
1740 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1750 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1751 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1752 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1753 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1754 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1755 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1756 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1757 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1758 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1759 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1760 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1761 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1762 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1763 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1764 | + |
|
1765 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1766 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1767 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1768 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1769 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1770 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1771 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1772 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1773 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1774 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1775 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1776 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1777 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1778 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1779 | 1779 | |
1780 | 1780 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1781 | 1781 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1782 | 1782 | //espresso_core is listed as a dependency of ee_admin_js. |
1783 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1783 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1784 | 1784 | |
1785 | 1785 | } |
1786 | 1786 | |
@@ -1814,23 +1814,23 @@ discard block |
||
1814 | 1814 | protected function _set_list_table() { |
1815 | 1815 | |
1816 | 1816 | //first is this a list_table view? |
1817 | - if ( !isset($this->_route_config['list_table']) ) |
|
1817 | + if ( ! isset($this->_route_config['list_table'])) |
|
1818 | 1818 | return; //not a list_table view so get out. |
1819 | 1819 | |
1820 | 1820 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1821 | 1821 | |
1822 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1822 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1823 | 1823 | //user error msg |
1824 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1824 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1825 | 1825 | //developer error msg |
1826 | - $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 ); |
|
1827 | - throw new EE_Error( $error_msg ); |
|
1826 | + $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); |
|
1827 | + throw new EE_Error($error_msg); |
|
1828 | 1828 | } |
1829 | 1829 | |
1830 | 1830 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1831 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1832 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1833 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1831 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1832 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1833 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1834 | 1834 | |
1835 | 1835 | $this->_set_list_table_view(); |
1836 | 1836 | $this->_set_list_table_object(); |
@@ -1852,14 +1852,14 @@ discard block |
||
1852 | 1852 | * @return array |
1853 | 1853 | */ |
1854 | 1854 | protected function _set_list_table_view() { |
1855 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1855 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1856 | 1856 | |
1857 | 1857 | |
1858 | 1858 | // looking at active items or dumpster diving ? |
1859 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1860 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1859 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1860 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1861 | 1861 | } else { |
1862 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1862 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1863 | 1863 | } |
1864 | 1864 | } |
1865 | 1865 | |
@@ -1872,8 +1872,8 @@ discard block |
||
1872 | 1872 | * @throws \EE_Error |
1873 | 1873 | */ |
1874 | 1874 | protected function _set_list_table_object() { |
1875 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1876 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1875 | + if (isset($this->_route_config['list_table'])) { |
|
1876 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1877 | 1877 | throw new EE_Error( |
1878 | 1878 | sprintf( |
1879 | 1879 | __( |
@@ -1881,12 +1881,12 @@ discard block |
||
1881 | 1881 | 'event_espresso' |
1882 | 1882 | ), |
1883 | 1883 | $this->_route_config['list_table'], |
1884 | - get_class( $this ) |
|
1884 | + get_class($this) |
|
1885 | 1885 | ) |
1886 | 1886 | ); |
1887 | 1887 | } |
1888 | 1888 | $list_table = $this->_route_config['list_table']; |
1889 | - $this->_list_table_object = new $list_table( $this ); |
|
1889 | + $this->_list_table_object = new $list_table($this); |
|
1890 | 1890 | } |
1891 | 1891 | } |
1892 | 1892 | |
@@ -1903,27 +1903,27 @@ discard block |
||
1903 | 1903 | * |
1904 | 1904 | * @return array |
1905 | 1905 | */ |
1906 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1906 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1907 | 1907 | |
1908 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1908 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1909 | 1909 | |
1910 | - if ( empty( $this->_views )) { |
|
1910 | + if (empty($this->_views)) { |
|
1911 | 1911 | $this->_views = array(); |
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | // cycle thru views |
1915 | - foreach ( $this->_views as $key => $view ) { |
|
1915 | + foreach ($this->_views as $key => $view) { |
|
1916 | 1916 | $query_args = array(); |
1917 | 1917 | // check for current view |
1918 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1918 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1919 | 1919 | $query_args['action'] = $this->_req_action; |
1920 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1920 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1921 | 1921 | $query_args['status'] = $view['slug']; |
1922 | 1922 | //merge any other arguments sent in. |
1923 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1924 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1923 | + if (isset($extra_query_args[$view['slug']])) { |
|
1924 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1925 | 1925 | } |
1926 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1926 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | return $this->_views; |
@@ -1940,15 +1940,15 @@ discard block |
||
1940 | 1940 | * @param int $max_entries total number of rows in the table |
1941 | 1941 | * @return string |
1942 | 1942 | */ |
1943 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1943 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1944 | 1944 | |
1945 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1946 | - $values = array( 10, 25, 50, 100 ); |
|
1947 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1945 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1946 | + $values = array(10, 25, 50, 100); |
|
1947 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1948 | 1948 | |
1949 | - if ( $max_entries ) { |
|
1949 | + if ($max_entries) { |
|
1950 | 1950 | $values[] = $max_entries; |
1951 | - sort( $values ); |
|
1951 | + sort($values); |
|
1952 | 1952 | } |
1953 | 1953 | |
1954 | 1954 | $entries_per_page_dropdown = ' |
@@ -1957,15 +1957,15 @@ discard block |
||
1957 | 1957 | Show |
1958 | 1958 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1959 | 1959 | |
1960 | - foreach ( $values as $value ) { |
|
1961 | - if ( $value < $max_entries ) { |
|
1962 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1960 | + foreach ($values as $value) { |
|
1961 | + if ($value < $max_entries) { |
|
1962 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1963 | 1963 | $entries_per_page_dropdown .= ' |
1964 | 1964 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1965 | 1965 | } |
1966 | 1966 | } |
1967 | 1967 | |
1968 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1968 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1969 | 1969 | $entries_per_page_dropdown .= ' |
1970 | 1970 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1971 | 1971 | |
@@ -1988,8 +1988,8 @@ discard block |
||
1988 | 1988 | * @return void |
1989 | 1989 | */ |
1990 | 1990 | public function _set_search_attributes() { |
1991 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1992 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1991 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1992 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1993 | 1993 | } |
1994 | 1994 | |
1995 | 1995 | /*** END LIST TABLE METHODS **/ |
@@ -2008,10 +2008,10 @@ discard block |
||
2008 | 2008 | * @return void |
2009 | 2009 | */ |
2010 | 2010 | private function _add_registered_meta_boxes() { |
2011 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2011 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2012 | 2012 | |
2013 | 2013 | //we only add meta boxes if the page_route calls for it |
2014 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
2014 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
2015 | 2015 | && is_array( |
2016 | 2016 | $this->_route_config['metaboxes'] |
2017 | 2017 | ) |
@@ -2019,27 +2019,27 @@ discard block |
||
2019 | 2019 | // this simply loops through the callbacks provided |
2020 | 2020 | // and checks if there is a corresponding callback registered by the child |
2021 | 2021 | // if there is then we go ahead and process the metabox loader. |
2022 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
2022 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
2023 | 2023 | // first check for Closures |
2024 | - if ( $metabox_callback instanceof Closure ) { |
|
2024 | + if ($metabox_callback instanceof Closure) { |
|
2025 | 2025 | $result = $metabox_callback(); |
2026 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
2027 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
2026 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
2027 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
2028 | 2028 | } else { |
2029 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
2029 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
2030 | 2030 | } |
2031 | - if ( $result === FALSE ) { |
|
2031 | + if ($result === FALSE) { |
|
2032 | 2032 | // user error msg |
2033 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2033 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2034 | 2034 | // developer error msg |
2035 | - $error_msg .= '||' . sprintf( |
|
2035 | + $error_msg .= '||'.sprintf( |
|
2036 | 2036 | __( |
2037 | 2037 | '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.', |
2038 | 2038 | 'event_espresso' |
2039 | 2039 | ), |
2040 | 2040 | $metabox_callback |
2041 | 2041 | ); |
2042 | - throw new EE_Error( $error_msg ); |
|
2042 | + throw new EE_Error($error_msg); |
|
2043 | 2043 | } |
2044 | 2044 | } |
2045 | 2045 | } |
@@ -2058,19 +2058,19 @@ discard block |
||
2058 | 2058 | private function _add_screen_columns() { |
2059 | 2059 | if ( |
2060 | 2060 | is_array($this->_route_config) |
2061 | - && isset( $this->_route_config['columns'] ) |
|
2061 | + && isset($this->_route_config['columns']) |
|
2062 | 2062 | && is_array($this->_route_config['columns']) |
2063 | - && count( $this->_route_config['columns'] ) === 2 |
|
2063 | + && count($this->_route_config['columns']) === 2 |
|
2064 | 2064 | ) { |
2065 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2065 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2066 | 2066 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2067 | 2067 | $screen_id = $this->_current_screen->id; |
2068 | 2068 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2069 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2070 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2069 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2070 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2071 | 2071 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2072 | 2072 | $this->_template_args['screen'] = $this->_current_screen; |
2073 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2073 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2074 | 2074 | |
2075 | 2075 | //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. |
2076 | 2076 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2087,11 +2087,11 @@ discard block |
||
2087 | 2087 | */ |
2088 | 2088 | |
2089 | 2089 | private function _espresso_news_post_box() { |
2090 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2091 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2090 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2091 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2092 | 2092 | $this, |
2093 | 2093 | 'espresso_news_post_box' |
2094 | - ), $this->_wp_page_slug, 'side' ); |
|
2094 | + ), $this->_wp_page_slug, 'side'); |
|
2095 | 2095 | } |
2096 | 2096 | |
2097 | 2097 | |
@@ -2099,14 +2099,14 @@ discard block |
||
2099 | 2099 | * Code for setting up espresso ratings request metabox. |
2100 | 2100 | */ |
2101 | 2101 | protected function _espresso_ratings_request() { |
2102 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2102 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2103 | 2103 | return ''; |
2104 | 2104 | } |
2105 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2106 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2105 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2106 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2107 | 2107 | $this, |
2108 | 2108 | 'espresso_ratings_request' |
2109 | - ), $this->_wp_page_slug, 'side' ); |
|
2109 | + ), $this->_wp_page_slug, 'side'); |
|
2110 | 2110 | } |
2111 | 2111 | |
2112 | 2112 | |
@@ -2114,34 +2114,34 @@ discard block |
||
2114 | 2114 | * Code for setting up espresso ratings request metabox content. |
2115 | 2115 | */ |
2116 | 2116 | public function espresso_ratings_request() { |
2117 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2118 | - EEH_Template::display_template( $template_path, array() ); |
|
2117 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2118 | + EEH_Template::display_template($template_path, array()); |
|
2119 | 2119 | } |
2120 | 2120 | |
2121 | 2121 | |
2122 | 2122 | |
2123 | 2123 | |
2124 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2125 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2126 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2127 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2128 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2129 | - $post = '</div>' . "\n"; |
|
2124 | + public static function cached_rss_display($rss_id, $url) { |
|
2125 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2126 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2127 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2128 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2129 | + $post = '</div>'."\n"; |
|
2130 | 2130 | |
2131 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2132 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2133 | - echo $pre . $output . $post; |
|
2131 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2132 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2133 | + echo $pre.$output.$post; |
|
2134 | 2134 | return TRUE; |
2135 | 2135 | } |
2136 | 2136 | |
2137 | - if ( ! $doing_ajax ) { |
|
2138 | - echo $pre . $loading . $post; |
|
2137 | + if ( ! $doing_ajax) { |
|
2138 | + echo $pre.$loading.$post; |
|
2139 | 2139 | return FALSE; |
2140 | 2140 | } |
2141 | 2141 | |
2142 | 2142 | ob_start(); |
2143 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2144 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2143 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2144 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2145 | 2145 | return TRUE; |
2146 | 2146 | |
2147 | 2147 | } |
@@ -2153,13 +2153,13 @@ discard block |
||
2153 | 2153 | <div id="espresso_news_post_box_content" class="infolinks"> |
2154 | 2154 | <?php |
2155 | 2155 | // Get RSS Feed(s) |
2156 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2156 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2157 | 2157 | $url = urlencode($feed_url); |
2158 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2158 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2159 | 2159 | |
2160 | 2160 | ?> |
2161 | 2161 | </div> |
2162 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2162 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2163 | 2163 | </div> |
2164 | 2164 | <?php |
2165 | 2165 | } |
@@ -2180,32 +2180,32 @@ discard block |
||
2180 | 2180 | |
2181 | 2181 | protected function _espresso_sponsors_post_box() { |
2182 | 2182 | |
2183 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2184 | - if ( $show_sponsors ) |
|
2185 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2183 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2184 | + if ($show_sponsors) |
|
2185 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2186 | 2186 | } |
2187 | 2187 | |
2188 | 2188 | |
2189 | 2189 | public function espresso_sponsors_post_box() { |
2190 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2191 | - EEH_Template::display_template( $templatepath ); |
|
2190 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2191 | + EEH_Template::display_template($templatepath); |
|
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | |
2195 | 2195 | |
2196 | 2196 | private function _publish_post_box() { |
2197 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2197 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2198 | 2198 | |
2199 | 2199 | //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) |
2200 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2201 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2200 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2201 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2202 | 2202 | } else { |
2203 | 2203 | $box_label = __('Publish', 'event_espresso'); |
2204 | 2204 | } |
2205 | 2205 | |
2206 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2206 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2207 | 2207 | |
2208 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2208 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2209 | 2209 | |
2210 | 2210 | } |
2211 | 2211 | |
@@ -2213,9 +2213,9 @@ discard block |
||
2213 | 2213 | |
2214 | 2214 | public function editor_overview() { |
2215 | 2215 | //if we have extra content set let's add it in if not make sure its empty |
2216 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2217 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2218 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2216 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2217 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2218 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2219 | 2219 | } |
2220 | 2220 | |
2221 | 2221 | |
@@ -2231,8 +2231,8 @@ discard block |
||
2231 | 2231 | * @see $this->_set_publish_post_box_vars for param details |
2232 | 2232 | * @since 4.6.0 |
2233 | 2233 | */ |
2234 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2235 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2234 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2235 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2236 | 2236 | } |
2237 | 2237 | |
2238 | 2238 | |
@@ -2260,17 +2260,17 @@ discard block |
||
2260 | 2260 | $both_btns = true |
2261 | 2261 | ) { |
2262 | 2262 | // if Save & Close, use a custom redirect URL or default to the main page? |
2263 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2263 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2264 | 2264 | // create the Save & Close and Save buttons |
2265 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2265 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2266 | 2266 | //if we have extra content set let's add it in if not make sure its empty |
2267 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2267 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2268 | 2268 | |
2269 | 2269 | |
2270 | - if ( $delete && ! empty( $id ) ) { |
|
2270 | + if ($delete && ! empty($id)) { |
|
2271 | 2271 | //make sure we have a default if just true is sent. |
2272 | 2272 | $delete = ! empty($delete) ? $delete : 'delete'; |
2273 | - $delete_link_args = array( $name => $id ); |
|
2273 | + $delete_link_args = array($name => $id); |
|
2274 | 2274 | $delete = $this->get_action_link_or_button( |
2275 | 2275 | $delete, |
2276 | 2276 | $delete, |
@@ -2281,8 +2281,8 @@ discard block |
||
2281 | 2281 | ); |
2282 | 2282 | } |
2283 | 2283 | |
2284 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2285 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2284 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2285 | + if ( ! empty($name) && ! empty($id)) { |
|
2286 | 2286 | $hidden_field_arr[$name] = array( |
2287 | 2287 | 'type' => 'hidden', |
2288 | 2288 | 'value' => $id |
@@ -2292,7 +2292,7 @@ discard block |
||
2292 | 2292 | $hf = ''; |
2293 | 2293 | } |
2294 | 2294 | // add hidden field |
2295 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2295 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2296 | 2296 | |
2297 | 2297 | } |
2298 | 2298 | |
@@ -2309,8 +2309,8 @@ discard block |
||
2309 | 2309 | <noscript> |
2310 | 2310 | <div id="no-js-message" class="error"> |
2311 | 2311 | <p style="font-size:1.3em;"> |
2312 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2313 | - <?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' ); ?> |
|
2312 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2313 | + <?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'); ?> |
|
2314 | 2314 | </p> |
2315 | 2315 | </div> |
2316 | 2316 | </noscript> |
@@ -2330,7 +2330,7 @@ discard block |
||
2330 | 2330 | * @return string |
2331 | 2331 | */ |
2332 | 2332 | private function _display_espresso_notices() { |
2333 | - $notices = $this->_get_transient( TRUE ); |
|
2333 | + $notices = $this->_get_transient(TRUE); |
|
2334 | 2334 | echo stripslashes($notices); |
2335 | 2335 | } |
2336 | 2336 | |
@@ -2382,11 +2382,11 @@ discard block |
||
2382 | 2382 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2383 | 2383 | * @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. |
2384 | 2384 | */ |
2385 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2386 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2385 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2386 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2387 | 2387 | |
2388 | 2388 | //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. |
2389 | - if ( empty( $callback_args ) && $create_func ) { |
|
2389 | + if (empty($callback_args) && $create_func) { |
|
2390 | 2390 | $callback_args = array( |
2391 | 2391 | 'template_path' => $this->_template_path, |
2392 | 2392 | 'template_args' => $this->_template_args, |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | //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) |
2397 | 2397 | $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; |
2398 | 2398 | |
2399 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2399 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2400 | 2400 | } |
2401 | 2401 | |
2402 | 2402 | |
@@ -2409,7 +2409,7 @@ discard block |
||
2409 | 2409 | */ |
2410 | 2410 | public function display_admin_page_with_metabox_columns() { |
2411 | 2411 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2412 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2412 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2413 | 2413 | |
2414 | 2414 | //the final wrapper |
2415 | 2415 | $this->admin_page_wrapper(); |
@@ -2452,7 +2452,7 @@ discard block |
||
2452 | 2452 | * @return void |
2453 | 2453 | */ |
2454 | 2454 | public function display_about_admin_page() { |
2455 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2455 | + $this->_display_admin_page(FALSE, TRUE); |
|
2456 | 2456 | } |
2457 | 2457 | |
2458 | 2458 | |
@@ -2468,10 +2468,10 @@ discard block |
||
2468 | 2468 | * @return void |
2469 | 2469 | */ |
2470 | 2470 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2471 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2471 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2472 | 2472 | |
2473 | 2473 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2474 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2474 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2475 | 2475 | |
2476 | 2476 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2477 | 2477 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
@@ -2481,19 +2481,19 @@ discard block |
||
2481 | 2481 | : 'espresso-default-admin'; |
2482 | 2482 | |
2483 | 2483 | $template_path = $sidebar |
2484 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2485 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2484 | + ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' |
|
2485 | + : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2486 | 2486 | |
2487 | - if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
|
2488 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2487 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2488 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2489 | 2489 | } |
2490 | 2490 | |
2491 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2491 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2492 | 2492 | |
2493 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2493 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2494 | 2494 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2495 | 2495 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2496 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2496 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2497 | 2497 | |
2498 | 2498 | |
2499 | 2499 | // the final template wrapper |
@@ -2511,7 +2511,7 @@ discard block |
||
2511 | 2511 | * @return void |
2512 | 2512 | * @throws \EE_Error |
2513 | 2513 | */ |
2514 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2514 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2515 | 2515 | //let's generate a default preview action button if there isn't one already present. |
2516 | 2516 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2517 | 2517 | $buy_now_url = add_query_arg( |
@@ -2524,7 +2524,7 @@ discard block |
||
2524 | 2524 | ), |
2525 | 2525 | 'http://eventespresso.com/pricing/' |
2526 | 2526 | ); |
2527 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2527 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2528 | 2528 | ? $this->get_action_link_or_button( |
2529 | 2529 | '', |
2530 | 2530 | 'buy_now', |
@@ -2534,13 +2534,13 @@ discard block |
||
2534 | 2534 | true |
2535 | 2535 | ) |
2536 | 2536 | : $this->_template_args['preview_action_button']; |
2537 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2537 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2538 | 2538 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2539 | 2539 | $template_path, |
2540 | 2540 | $this->_template_args, |
2541 | 2541 | true |
2542 | 2542 | ); |
2543 | - $this->_display_admin_page( $display_sidebar ); |
|
2543 | + $this->_display_admin_page($display_sidebar); |
|
2544 | 2544 | } |
2545 | 2545 | |
2546 | 2546 | |
@@ -2574,49 +2574,49 @@ discard block |
||
2574 | 2574 | * @param boolean $sidebar whether to display with sidebar or not. |
2575 | 2575 | * @return void |
2576 | 2576 | */ |
2577 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2577 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2578 | 2578 | //setup search attributes |
2579 | 2579 | $this->_set_search_attributes(); |
2580 | 2580 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2581 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2581 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2582 | 2582 | |
2583 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2584 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2585 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2583 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2584 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2585 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2586 | 2586 | $this->_template_args['list_table'] = $this->_list_table_object; |
2587 | 2587 | $this->_template_args['current_route'] = $this->_req_action; |
2588 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2588 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2589 | 2589 | |
2590 | 2590 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2591 | - if( ! empty( $ajax_sorting_callback )) { |
|
2591 | + if ( ! empty($ajax_sorting_callback)) { |
|
2592 | 2592 | $sortable_list_table_form_fields = wp_nonce_field( |
2593 | - $ajax_sorting_callback . '_nonce', |
|
2594 | - $ajax_sorting_callback . '_nonce', |
|
2593 | + $ajax_sorting_callback.'_nonce', |
|
2594 | + $ajax_sorting_callback.'_nonce', |
|
2595 | 2595 | FALSE, |
2596 | 2596 | FALSE |
2597 | 2597 | ); |
2598 | 2598 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2599 | 2599 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2600 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2601 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2600 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2601 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2602 | 2602 | } else { |
2603 | 2603 | $sortable_list_table_form_fields = ''; |
2604 | 2604 | } |
2605 | 2605 | |
2606 | 2606 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2607 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2608 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2609 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2607 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2608 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2609 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2610 | 2610 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2611 | 2611 | |
2612 | 2612 | //display message about search results? |
2613 | 2613 | $this->_template_args['before_list_table'] .= apply_filters( |
2614 | 2614 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2615 | - ! empty( $this->_req_data['s'] ) |
|
2616 | - ? '<p class="ee-search-results">' . sprintf( |
|
2617 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2618 | - trim( $this->_req_data['s'], '%' ) |
|
2619 | - ) . '</p>' |
|
2615 | + ! empty($this->_req_data['s']) |
|
2616 | + ? '<p class="ee-search-results">'.sprintf( |
|
2617 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2618 | + trim($this->_req_data['s'], '%') |
|
2619 | + ).'</p>' |
|
2620 | 2620 | : '', |
2621 | 2621 | $this->page_slug, |
2622 | 2622 | $this->_req_data, |
@@ -2628,7 +2628,7 @@ discard block |
||
2628 | 2628 | true |
2629 | 2629 | ); |
2630 | 2630 | // the final template wrapper |
2631 | - if ( $sidebar ) |
|
2631 | + if ($sidebar) |
|
2632 | 2632 | $this->display_admin_page_with_sidebar(); |
2633 | 2633 | else |
2634 | 2634 | $this->display_admin_page_with_no_sidebar(); |
@@ -2651,9 +2651,9 @@ discard block |
||
2651 | 2651 | * @param array $items see above for format of array |
2652 | 2652 | * @return string html string of legend |
2653 | 2653 | */ |
2654 | - protected function _display_legend( $items ) { |
|
2655 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2656 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2654 | + protected function _display_legend($items) { |
|
2655 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2656 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2657 | 2657 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2658 | 2658 | } |
2659 | 2659 | |
@@ -2678,33 +2678,33 @@ discard block |
||
2678 | 2678 | * |
2679 | 2679 | * @return void |
2680 | 2680 | */ |
2681 | - protected function _return_json( $sticky_notices = false ) { |
|
2681 | + protected function _return_json($sticky_notices = false) { |
|
2682 | 2682 | |
2683 | 2683 | //make sure any EE_Error notices have been handled. |
2684 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2684 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2685 | 2685 | |
2686 | 2686 | |
2687 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2687 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2688 | 2688 | unset($this->_template_args['data']); |
2689 | 2689 | $json = array( |
2690 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2691 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2692 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2693 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2690 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2691 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2692 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2693 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2694 | 2694 | 'notices' => EE_Error::get_notices(), |
2695 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2696 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2695 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2696 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2697 | 2697 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2698 | 2698 | ); |
2699 | 2699 | |
2700 | 2700 | |
2701 | 2701 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2702 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2702 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2703 | 2703 | header('Content-Type: application/json; charset=UTF-8'); |
2704 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2705 | - echo wp_json_encode( $json ); |
|
2704 | + if (function_exists('wp_json_encode')) { |
|
2705 | + echo wp_json_encode($json); |
|
2706 | 2706 | } else { |
2707 | - echo json_encode( $json ); |
|
2707 | + echo json_encode($json); |
|
2708 | 2708 | } |
2709 | 2709 | exit(); |
2710 | 2710 | } |
@@ -2718,11 +2718,11 @@ discard block |
||
2718 | 2718 | * @throws EE_Error |
2719 | 2719 | */ |
2720 | 2720 | public function return_json() { |
2721 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2721 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2722 | 2722 | $this->_return_json(); |
2723 | 2723 | |
2724 | 2724 | else { |
2725 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2725 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2726 | 2726 | } |
2727 | 2727 | } |
2728 | 2728 | |
@@ -2735,7 +2735,7 @@ discard block |
||
2735 | 2735 | * |
2736 | 2736 | * @access public |
2737 | 2737 | */ |
2738 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2738 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2739 | 2739 | $this->_hook_obj = $hook_obj; |
2740 | 2740 | } |
2741 | 2741 | |
@@ -2751,33 +2751,33 @@ discard block |
||
2751 | 2751 | */ |
2752 | 2752 | public function admin_page_wrapper($about = FALSE) { |
2753 | 2753 | |
2754 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2754 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2755 | 2755 | |
2756 | 2756 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2757 | 2757 | |
2758 | 2758 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2759 | 2759 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2760 | 2760 | |
2761 | - $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'] : ''); |
|
2762 | - $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'] : ''); |
|
2761 | + $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'] : ''); |
|
2762 | + $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'] : ''); |
|
2763 | 2763 | |
2764 | 2764 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2765 | 2765 | |
2766 | 2766 | |
2767 | 2767 | |
2768 | 2768 | // load settings page wrapper template |
2769 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2769 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2770 | 2770 | |
2771 | 2771 | //about page? |
2772 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2772 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2773 | 2773 | |
2774 | 2774 | |
2775 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2776 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2775 | + if (defined('DOING_AJAX')) { |
|
2776 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2777 | 2777 | |
2778 | 2778 | $this->_return_json(); |
2779 | 2779 | } else { |
2780 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2780 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2781 | 2781 | } |
2782 | 2782 | |
2783 | 2783 | } |
@@ -2803,7 +2803,7 @@ discard block |
||
2803 | 2803 | * @param $b |
2804 | 2804 | * @return int |
2805 | 2805 | */ |
2806 | - private function _sort_nav_tabs( $a, $b ) { |
|
2806 | + private function _sort_nav_tabs($a, $b) { |
|
2807 | 2807 | if ($a['order'] == $b['order']) { |
2808 | 2808 | return 0; |
2809 | 2809 | } |
@@ -2823,7 +2823,7 @@ discard block |
||
2823 | 2823 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2824 | 2824 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2825 | 2825 | */ |
2826 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2826 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2827 | 2827 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2828 | 2828 | return $content; |
2829 | 2829 | } |
@@ -2845,25 +2845,25 @@ discard block |
||
2845 | 2845 | * @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. |
2846 | 2846 | * @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). |
2847 | 2847 | */ |
2848 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2848 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2849 | 2849 | //make sure $text and $actions are in an array |
2850 | 2850 | $text = (array) $text; |
2851 | 2851 | $actions = (array) $actions; |
2852 | 2852 | $referrer_url = empty($referrer) ? '' : $referrer; |
2853 | - $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 .'" />'; |
|
2853 | + $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.'" />'; |
|
2854 | 2854 | |
2855 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2856 | - $default_names = array( 'save', 'save_and_close' ); |
|
2855 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2856 | + $default_names = array('save', 'save_and_close'); |
|
2857 | 2857 | |
2858 | 2858 | //add in a hidden index for the current page (so save and close redirects properly) |
2859 | 2859 | $this->_template_args['save_buttons'] = $referrer_url; |
2860 | 2860 | |
2861 | - foreach ( $button_text as $key => $button ) { |
|
2861 | + foreach ($button_text as $key => $button) { |
|
2862 | 2862 | $ref = $default_names[$key]; |
2863 | - $id = $this->_current_view . '_' . $ref; |
|
2864 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2865 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2866 | - if ( !$both ) break; |
|
2863 | + $id = $this->_current_view.'_'.$ref; |
|
2864 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2865 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2866 | + if ( ! $both) break; |
|
2867 | 2867 | } |
2868 | 2868 | |
2869 | 2869 | } |
@@ -2878,8 +2878,8 @@ discard block |
||
2878 | 2878 | * @param string $route |
2879 | 2879 | * @param array $additional_hidden_fields |
2880 | 2880 | */ |
2881 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2882 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2881 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2882 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2883 | 2883 | } |
2884 | 2884 | |
2885 | 2885 | |
@@ -2892,30 +2892,30 @@ discard block |
||
2892 | 2892 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2893 | 2893 | * @return void |
2894 | 2894 | */ |
2895 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2895 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2896 | 2896 | |
2897 | - if ( empty( $route )) { |
|
2897 | + if (empty($route)) { |
|
2898 | 2898 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2899 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2900 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2899 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2900 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2901 | 2901 | } |
2902 | 2902 | // open form |
2903 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2903 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2904 | 2904 | // add nonce |
2905 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2905 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2906 | 2906 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2907 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2907 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2908 | 2908 | // add REQUIRED form action |
2909 | 2909 | $hidden_fields = array( |
2910 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2910 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2911 | 2911 | ); |
2912 | 2912 | // merge arrays |
2913 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2913 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2914 | 2914 | // generate form fields |
2915 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2915 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2916 | 2916 | // add fields to form |
2917 | - foreach ( (array)$form_fields as $field_name => $form_field ) { |
|
2918 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2917 | + foreach ((array) $form_fields as $field_name => $form_field) { |
|
2918 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2919 | 2919 | } |
2920 | 2920 | |
2921 | 2921 | // close form |
@@ -2932,8 +2932,8 @@ discard block |
||
2932 | 2932 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2933 | 2933 | * @since 4.5.0 |
2934 | 2934 | */ |
2935 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2936 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2935 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2936 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2937 | 2937 | } |
2938 | 2938 | |
2939 | 2939 | |
@@ -2949,38 +2949,38 @@ discard block |
||
2949 | 2949 | * @access protected |
2950 | 2950 | * @return void |
2951 | 2951 | */ |
2952 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2952 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2953 | 2953 | |
2954 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2954 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2955 | 2955 | |
2956 | 2956 | //class name for actions/filters. |
2957 | 2957 | $classname = get_class($this); |
2958 | 2958 | |
2959 | 2959 | //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 |
2960 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2961 | - $notices = EE_Error::get_notices( FALSE ); |
|
2960 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2961 | + $notices = EE_Error::get_notices(FALSE); |
|
2962 | 2962 | |
2963 | 2963 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2964 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2964 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2965 | 2965 | EE_Error::overwrite_success(); |
2966 | 2966 | } |
2967 | - if ( ! empty( $what ) && ! empty( $action_desc ) ) { |
|
2967 | + if ( ! empty($what) && ! empty($action_desc)) { |
|
2968 | 2968 | // how many records affected ? more than one record ? or just one ? |
2969 | - if ( $success > 1 && empty( $notices[ 'errors' ] ) ) { |
|
2969 | + if ($success > 1 && empty($notices['errors'])) { |
|
2970 | 2970 | // set plural msg |
2971 | 2971 | EE_Error::add_success( |
2972 | 2972 | sprintf( |
2973 | - __( 'The "%s" have been successfully %s.', 'event_espresso' ), |
|
2973 | + __('The "%s" have been successfully %s.', 'event_espresso'), |
|
2974 | 2974 | $what, |
2975 | 2975 | $action_desc |
2976 | 2976 | ), |
2977 | 2977 | __FILE__, __FUNCTION__, __LINE__ |
2978 | 2978 | ); |
2979 | - } else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) { |
|
2979 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2980 | 2980 | // set singular msg |
2981 | 2981 | EE_Error::add_success( |
2982 | 2982 | sprintf( |
2983 | - __( 'The "%s" has been successfully %s.', 'event_espresso' ), |
|
2983 | + __('The "%s" has been successfully %s.', 'event_espresso'), |
|
2984 | 2984 | $what, |
2985 | 2985 | $action_desc |
2986 | 2986 | ), |
@@ -2989,7 +2989,7 @@ discard block |
||
2989 | 2989 | } |
2990 | 2990 | } |
2991 | 2991 | // check that $query_args isn't something crazy |
2992 | - if ( ! is_array( $query_args )) { |
|
2992 | + if ( ! is_array($query_args)) { |
|
2993 | 2993 | $query_args = array(); |
2994 | 2994 | } |
2995 | 2995 | |
@@ -3002,36 +3002,36 @@ discard block |
||
3002 | 3002 | * @param array $query_args The original query_args array coming into the |
3003 | 3003 | * method. |
3004 | 3004 | */ |
3005 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
3005 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
3006 | 3006 | |
3007 | 3007 | //calculate where we're going (if we have a "save and close" button pushed) |
3008 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
3008 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
3009 | 3009 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
3010 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
3010 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
3011 | 3011 | // regenerate query args array from referrer URL |
3012 | - parse_str( $parsed_url['query'], $query_args ); |
|
3012 | + parse_str($parsed_url['query'], $query_args); |
|
3013 | 3013 | // correct page and action will be in the query args now |
3014 | - $redirect_url = admin_url( 'admin.php' ); |
|
3014 | + $redirect_url = admin_url('admin.php'); |
|
3015 | 3015 | } |
3016 | 3016 | |
3017 | 3017 | //merge any default query_args set in _default_route_query_args property |
3018 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
3018 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
3019 | 3019 | $args_to_merge = array(); |
3020 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
3020 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
3021 | 3021 | //is there a wp_referer array in our _default_route_query_args property? |
3022 | - if ( $query_param == 'wp_referer' ) { |
|
3022 | + if ($query_param == 'wp_referer') { |
|
3023 | 3023 | $query_value = (array) $query_value; |
3024 | - foreach ( $query_value as $reference => $value ) { |
|
3025 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
3024 | + foreach ($query_value as $reference => $value) { |
|
3025 | + if (strpos($reference, 'nonce') !== false) { |
|
3026 | 3026 | continue; |
3027 | 3027 | } |
3028 | 3028 | |
3029 | 3029 | //finally we will override any arguments in the referer with |
3030 | 3030 | //what might be set on the _default_route_query_args array. |
3031 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
3032 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
3031 | + if (isset($this->_default_route_query_args[$reference])) { |
|
3032 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
3033 | 3033 | } else { |
3034 | - $args_to_merge[$reference] = urlencode( $value ); |
|
3034 | + $args_to_merge[$reference] = urlencode($value); |
|
3035 | 3035 | } |
3036 | 3036 | } |
3037 | 3037 | continue; |
@@ -3042,7 +3042,7 @@ discard block |
||
3042 | 3042 | |
3043 | 3043 | //now let's merge these arguments but override with what was specifically sent in to the |
3044 | 3044 | //redirect. |
3045 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
3045 | + $query_args = array_merge($args_to_merge, $query_args); |
|
3046 | 3046 | } |
3047 | 3047 | |
3048 | 3048 | $this->_process_notices($query_args); |
@@ -3051,19 +3051,19 @@ discard block |
||
3051 | 3051 | // generate redirect url |
3052 | 3052 | |
3053 | 3053 | // if redirecting to anything other than the main page, add a nonce |
3054 | - if ( isset( $query_args['action'] )) { |
|
3054 | + if (isset($query_args['action'])) { |
|
3055 | 3055 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3056 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3056 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3057 | 3057 | } |
3058 | 3058 | |
3059 | 3059 | //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). |
3060 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3060 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3061 | 3061 | |
3062 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3062 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3063 | 3063 | |
3064 | 3064 | |
3065 | 3065 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3066 | - if ( defined('DOING_AJAX' ) ) { |
|
3066 | + if (defined('DOING_AJAX')) { |
|
3067 | 3067 | $default_data = array( |
3068 | 3068 | 'close' => TRUE, |
3069 | 3069 | 'redirect_url' => $redirect_url, |
@@ -3072,11 +3072,11 @@ discard block |
||
3072 | 3072 | ); |
3073 | 3073 | |
3074 | 3074 | $this->_template_args['success'] = $success; |
3075 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3075 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3076 | 3076 | $this->_return_json(); |
3077 | 3077 | } |
3078 | 3078 | |
3079 | - wp_safe_redirect( $redirect_url ); |
|
3079 | + wp_safe_redirect($redirect_url); |
|
3080 | 3080 | exit(); |
3081 | 3081 | } |
3082 | 3082 | |
@@ -3092,30 +3092,30 @@ discard block |
||
3092 | 3092 | * @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. |
3093 | 3093 | * @return void |
3094 | 3094 | */ |
3095 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3095 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3096 | 3096 | |
3097 | 3097 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3098 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3099 | - $notices = EE_Error::get_notices( false ); |
|
3100 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3101 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3098 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3099 | + $notices = EE_Error::get_notices(false); |
|
3100 | + if (empty($this->_template_args['success'])) { |
|
3101 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3102 | 3102 | } |
3103 | 3103 | |
3104 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3105 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3104 | + if (empty($this->_template_args['errors'])) { |
|
3105 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3106 | 3106 | } |
3107 | 3107 | |
3108 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3109 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3108 | + if (empty($this->_template_args['attention'])) { |
|
3109 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3110 | 3110 | } |
3111 | 3111 | } |
3112 | 3112 | |
3113 | 3113 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3114 | 3114 | |
3115 | 3115 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3116 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3117 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3118 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3116 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3117 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3118 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3119 | 3119 | } |
3120 | 3120 | } |
3121 | 3121 | |
@@ -3145,7 +3145,7 @@ discard block |
||
3145 | 3145 | $exclude_nonce = false |
3146 | 3146 | ) { |
3147 | 3147 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3148 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3148 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3149 | 3149 | throw new EE_Error( |
3150 | 3150 | sprintf( |
3151 | 3151 | __( |
@@ -3156,7 +3156,7 @@ discard block |
||
3156 | 3156 | ) |
3157 | 3157 | ); |
3158 | 3158 | } |
3159 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3159 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3160 | 3160 | throw new EE_Error( |
3161 | 3161 | sprintf( |
3162 | 3162 | __( |
@@ -3168,8 +3168,8 @@ discard block |
||
3168 | 3168 | ); |
3169 | 3169 | } |
3170 | 3170 | //finally check user access for this button. |
3171 | - $has_access = $this->check_user_access( $action, true ); |
|
3172 | - if ( ! $has_access ) { |
|
3171 | + $has_access = $this->check_user_access($action, true); |
|
3172 | + if ( ! $has_access) { |
|
3173 | 3173 | return ''; |
3174 | 3174 | } |
3175 | 3175 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3177,11 +3177,11 @@ discard block |
||
3177 | 3177 | 'action' => $action |
3178 | 3178 | ); |
3179 | 3179 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3180 | - if ( ! empty( $extra_request ) ) { |
|
3181 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3180 | + if ( ! empty($extra_request)) { |
|
3181 | + $query_args = array_merge($extra_request, $query_args); |
|
3182 | 3182 | } |
3183 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3184 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3183 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3184 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3185 | 3185 | } |
3186 | 3186 | |
3187 | 3187 | |
@@ -3196,11 +3196,11 @@ discard block |
||
3196 | 3196 | $args = array( |
3197 | 3197 | 'label' => $this->_admin_page_title, |
3198 | 3198 | 'default' => 10, |
3199 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3199 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3200 | 3200 | ); |
3201 | 3201 | //ONLY add the screen option if the user has access to it. |
3202 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3203 | - add_screen_option( $option, $args ); |
|
3202 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3203 | + add_screen_option($option, $args); |
|
3204 | 3204 | } |
3205 | 3205 | } |
3206 | 3206 | |
@@ -3216,36 +3216,36 @@ discard block |
||
3216 | 3216 | * @return void |
3217 | 3217 | */ |
3218 | 3218 | private function _set_per_page_screen_options() { |
3219 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3220 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3219 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3220 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3221 | 3221 | |
3222 | - if ( !$user = wp_get_current_user() ) |
|
3222 | + if ( ! $user = wp_get_current_user()) |
|
3223 | 3223 | return; |
3224 | 3224 | $option = $_POST['wp_screen_options']['option']; |
3225 | 3225 | $value = $_POST['wp_screen_options']['value']; |
3226 | 3226 | |
3227 | - if ( $option != sanitize_key( $option ) ) |
|
3227 | + if ($option != sanitize_key($option)) |
|
3228 | 3228 | return; |
3229 | 3229 | |
3230 | 3230 | $map_option = $option; |
3231 | 3231 | |
3232 | 3232 | $option = str_replace('-', '_', $option); |
3233 | 3233 | |
3234 | - switch ( $map_option ) { |
|
3235 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3234 | + switch ($map_option) { |
|
3235 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3236 | 3236 | $value = (int) $value; |
3237 | - if ( $value < 1 || $value > 999 ) |
|
3237 | + if ($value < 1 || $value > 999) |
|
3238 | 3238 | return; |
3239 | 3239 | break; |
3240 | 3240 | default: |
3241 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3242 | - if ( false === $value ) |
|
3241 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3242 | + if (false === $value) |
|
3243 | 3243 | return; |
3244 | 3244 | break; |
3245 | 3245 | } |
3246 | 3246 | |
3247 | 3247 | update_user_meta($user->ID, $option, $value); |
3248 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3248 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3249 | 3249 | exit; |
3250 | 3250 | } |
3251 | 3251 | } |
@@ -3256,8 +3256,8 @@ discard block |
||
3256 | 3256 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3257 | 3257 | * @param array $data array that will be assigned to template args. |
3258 | 3258 | */ |
3259 | - public function set_template_args( $data ) { |
|
3260 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3259 | + public function set_template_args($data) { |
|
3260 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3261 | 3261 | } |
3262 | 3262 | |
3263 | 3263 | |
@@ -3273,26 +3273,26 @@ discard block |
||
3273 | 3273 | * @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. |
3274 | 3274 | * @return void |
3275 | 3275 | */ |
3276 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3276 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3277 | 3277 | $user_id = get_current_user_id(); |
3278 | 3278 | |
3279 | - if ( !$skip_route_verify ) |
|
3279 | + if ( ! $skip_route_verify) |
|
3280 | 3280 | $this->_verify_route($route); |
3281 | 3281 | |
3282 | 3282 | |
3283 | 3283 | //now let's set the string for what kind of transient we're setting |
3284 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3285 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3284 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3285 | + $data = $notices ? array('notices' => $data) : $data; |
|
3286 | 3286 | //is there already a transient for this route? If there is then let's ADD to that transient |
3287 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3288 | - if ( $existing ) { |
|
3289 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3287 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3288 | + if ($existing) { |
|
3289 | + $data = array_merge((array) $data, (array) $existing); |
|
3290 | 3290 | } |
3291 | 3291 | |
3292 | - if ( is_multisite() && is_network_admin() ) { |
|
3293 | - set_site_transient( $transient, $data, 8 ); |
|
3292 | + if (is_multisite() && is_network_admin()) { |
|
3293 | + set_site_transient($transient, $data, 8); |
|
3294 | 3294 | } else { |
3295 | - set_transient( $transient, $data, 8 ); |
|
3295 | + set_transient($transient, $data, 8); |
|
3296 | 3296 | } |
3297 | 3297 | } |
3298 | 3298 | |
@@ -3304,18 +3304,18 @@ discard block |
||
3304 | 3304 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3305 | 3305 | * @return mixed data |
3306 | 3306 | */ |
3307 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3307 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3308 | 3308 | $user_id = get_current_user_id(); |
3309 | - $route = !$route ? $this->_req_action : $route; |
|
3310 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3311 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3309 | + $route = ! $route ? $this->_req_action : $route; |
|
3310 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3311 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3312 | 3312 | //delete transient after retrieval (just in case it hasn't expired); |
3313 | - if ( is_multisite() && is_network_admin() ) { |
|
3314 | - delete_site_transient( $transient ); |
|
3313 | + if (is_multisite() && is_network_admin()) { |
|
3314 | + delete_site_transient($transient); |
|
3315 | 3315 | } else { |
3316 | - delete_transient( $transient ); |
|
3316 | + delete_transient($transient); |
|
3317 | 3317 | } |
3318 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3318 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3319 | 3319 | } |
3320 | 3320 | |
3321 | 3321 | |
@@ -3332,12 +3332,12 @@ discard block |
||
3332 | 3332 | |
3333 | 3333 | //retrieve all existing transients |
3334 | 3334 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3335 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3336 | - foreach ( $results as $result ) { |
|
3337 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3338 | - get_transient( $transient ); |
|
3339 | - if ( is_multisite() && is_network_admin() ) { |
|
3340 | - get_site_transient( $transient ); |
|
3335 | + if ($results = $wpdb->get_results($query)) { |
|
3336 | + foreach ($results as $result) { |
|
3337 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3338 | + get_transient($transient); |
|
3339 | + if (is_multisite() && is_network_admin()) { |
|
3340 | + get_site_transient($transient); |
|
3341 | 3341 | } |
3342 | 3342 | } |
3343 | 3343 | } |
@@ -3487,23 +3487,23 @@ discard block |
||
3487 | 3487 | * @param string $line line no where error occurred |
3488 | 3488 | * @return boolean |
3489 | 3489 | */ |
3490 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3490 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3491 | 3491 | |
3492 | 3492 | //remove any options that are NOT going to be saved with the config settings. |
3493 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3493 | + if (isset($config->core->ee_ueip_optin)) { |
|
3494 | 3494 | $config->core->ee_ueip_has_notified = TRUE; |
3495 | 3495 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3496 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3497 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3496 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3497 | + update_option('ee_ueip_has_notified', TRUE); |
|
3498 | 3498 | } |
3499 | 3499 | // and save it (note we're also doing the network save here) |
3500 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3501 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3502 | - if ( $config_saved && $net_saved ) { |
|
3503 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3500 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3501 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3502 | + if ($config_saved && $net_saved) { |
|
3503 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3504 | 3504 | return TRUE; |
3505 | 3505 | } else { |
3506 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3506 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3507 | 3507 | return FALSE; |
3508 | 3508 | } |
3509 | 3509 | } |
@@ -3516,7 +3516,7 @@ discard block |
||
3516 | 3516 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3517 | 3517 | * @return array |
3518 | 3518 | */ |
3519 | - public function get_yes_no_values(){ |
|
3519 | + public function get_yes_no_values() { |
|
3520 | 3520 | return $this->_yes_no_values; |
3521 | 3521 | } |
3522 | 3522 | |
@@ -3538,8 +3538,8 @@ discard block |
||
3538 | 3538 | * |
3539 | 3539 | * @return string |
3540 | 3540 | */ |
3541 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3542 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3541 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3542 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3543 | 3543 | } |
3544 | 3544 | |
3545 | 3545 | |
@@ -3553,8 +3553,8 @@ discard block |
||
3553 | 3553 | * |
3554 | 3554 | * @return string |
3555 | 3555 | */ |
3556 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3557 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3556 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3557 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3558 | 3558 | } |
3559 | 3559 | |
3560 | 3560 | |
@@ -3573,8 +3573,8 @@ discard block |
||
3573 | 3573 | * @return bool success/fail |
3574 | 3574 | */ |
3575 | 3575 | protected function _process_resend_registration() { |
3576 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3577 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3576 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3577 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3578 | 3578 | return $this->_template_args['success']; |
3579 | 3579 | } |
3580 | 3580 | |
@@ -3587,11 +3587,11 @@ discard block |
||
3587 | 3587 | * @param \EE_Payment $payment |
3588 | 3588 | * @return bool success/fail |
3589 | 3589 | */ |
3590 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3591 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3592 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3593 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3594 | - return $this->_template_args[ 'success' ]; |
|
3590 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3591 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3592 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3593 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3594 | + return $this->_template_args['success']; |
|
3595 | 3595 | } |
3596 | 3596 | |
3597 | 3597 |
@@ -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(); |
@@ -500,7 +504,9 @@ discard block |
||
500 | 504 | global $ee_menu_slugs; |
501 | 505 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 506 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
507 | + if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) { |
|
508 | + return FALSE; |
|
509 | + } |
|
504 | 510 | |
505 | 511 | |
506 | 512 | // 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 |
@@ -535,12 +541,14 @@ discard block |
||
535 | 541 | } |
536 | 542 | |
537 | 543 | //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 |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
539 | - $this->_extend_page_config(); |
|
544 | + if ( method_exists( $this, '_extend_page_config' ) ) { |
|
545 | + $this->_extend_page_config(); |
|
546 | + } |
|
540 | 547 | |
541 | 548 | //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. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
543 | - $this->_extend_page_config_for_cpt(); |
|
549 | + if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) { |
|
550 | + $this->_extend_page_config_for_cpt(); |
|
551 | + } |
|
544 | 552 | |
545 | 553 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | 554 | $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
@@ -656,8 +664,9 @@ discard block |
||
656 | 664 | //add screen options - global, page child class, and view specific |
657 | 665 | $this->_add_global_screen_options(); |
658 | 666 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
667 | + if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) { |
|
668 | + call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
669 | + } |
|
661 | 670 | |
662 | 671 | |
663 | 672 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,28 +677,32 @@ discard block |
||
668 | 677 | //add feature_pointers - global, page child class, and view specific |
669 | 678 | $this->_add_feature_pointers(); |
670 | 679 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
680 | + if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) { |
|
681 | + call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
682 | + } |
|
673 | 683 | |
674 | 684 | //enqueue scripts/styles - global, page class, and view specific |
675 | 685 | add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
676 | 686 | add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
687 | + if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) { |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
689 | + } |
|
679 | 690 | |
680 | 691 | add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
681 | 692 | |
682 | 693 | //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 |
683 | 694 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
684 | 695 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
696 | + if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) { |
|
697 | + add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
698 | + } |
|
687 | 699 | |
688 | 700 | //admin footer scripts |
689 | 701 | add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
690 | 702 | add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
703 | + if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) { |
|
704 | + add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
705 | + } |
|
693 | 706 | |
694 | 707 | |
695 | 708 | do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
@@ -762,7 +775,9 @@ discard block |
||
762 | 775 | protected function _verify_routes() { |
763 | 776 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
764 | 777 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
778 | + if ( !$this->_current_page && !defined( 'DOING_AJAX')) { |
|
779 | + return FALSE; |
|
780 | + } |
|
766 | 781 | |
767 | 782 | $this->_route = FALSE; |
768 | 783 | $func = FALSE; |
@@ -1078,8 +1093,9 @@ discard block |
||
1078 | 1093 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1079 | 1094 | foreach ( $this->_help_tour['tours'] as $tour ) { |
1080 | 1095 | //if this is the end tour then we don't need to setup a button |
1081 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1082 | - continue; |
|
1096 | + if ( $tour instanceof EE_Help_Tour_final_stop ) { |
|
1097 | + continue; |
|
1098 | + } |
|
1083 | 1099 | $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
1084 | 1100 | } |
1085 | 1101 | $tour_buttons .= implode('<br />', $tb); |
@@ -1089,8 +1105,9 @@ discard block |
||
1089 | 1105 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1090 | 1106 | if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
1091 | 1107 | //check that the callback given is valid |
1092 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1093 | - 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) ) ); |
|
1108 | + if ( !method_exists($this, $config['help_sidebar'] ) ) { |
|
1109 | + 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) ) ); |
|
1110 | + } |
|
1094 | 1111 | |
1095 | 1112 | $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
1096 | 1113 | |
@@ -1114,18 +1131,23 @@ discard block |
||
1114 | 1131 | }/**/ |
1115 | 1132 | |
1116 | 1133 | |
1117 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1134 | + if ( !isset( $config['help_tabs'] ) ) { |
|
1135 | + return; |
|
1136 | + } |
|
1137 | + //no help tabs for this route |
|
1118 | 1138 | |
1119 | 1139 | foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
1120 | 1140 | //we're here so there ARE help tabs! |
1121 | 1141 | |
1122 | 1142 | //make sure we've got what we need |
1123 | - if ( !isset( $cfg['title'] ) ) |
|
1124 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1143 | + if ( !isset( $cfg['title'] ) ) { |
|
1144 | + throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1145 | + } |
|
1125 | 1146 | |
1126 | 1147 | |
1127 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1128 | - 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') ); |
|
1148 | + if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) { |
|
1149 | + 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') ); |
|
1150 | + } |
|
1129 | 1151 | |
1130 | 1152 | |
1131 | 1153 | |
@@ -1188,14 +1210,16 @@ discard block |
||
1188 | 1210 | $this->_help_tour = array(); |
1189 | 1211 | |
1190 | 1212 | //exit early if help tours are turned off globally |
1191 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1192 | - return; |
|
1213 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) { |
|
1214 | + return; |
|
1215 | + } |
|
1193 | 1216 | |
1194 | 1217 | //loop through _page_config to find any help_tour defined |
1195 | 1218 | foreach ( $this->_page_config as $route => $config ) { |
1196 | 1219 | //we're only going to set things up for this route |
1197 | - if ( $route !== $this->_req_action ) |
|
1198 | - continue; |
|
1220 | + if ( $route !== $this->_req_action ) { |
|
1221 | + continue; |
|
1222 | + } |
|
1199 | 1223 | |
1200 | 1224 | if ( isset( $config['help_tour'] ) ) { |
1201 | 1225 | |
@@ -1230,8 +1254,9 @@ discard block |
||
1230 | 1254 | } |
1231 | 1255 | } |
1232 | 1256 | |
1233 | - if ( !empty( $tours ) ) |
|
1234 | - $this->_help_tour['tours'] = $tours; |
|
1257 | + if ( !empty( $tours ) ) { |
|
1258 | + $this->_help_tour['tours'] = $tours; |
|
1259 | + } |
|
1235 | 1260 | |
1236 | 1261 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
1237 | 1262 | } |
@@ -1271,15 +1296,21 @@ discard block |
||
1271 | 1296 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1272 | 1297 | $i = 0; |
1273 | 1298 | foreach ( $this->_page_config as $slug => $config ) { |
1274 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1275 | - continue; //no nav tab for this config |
|
1299 | + if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) { |
|
1300 | + continue; |
|
1301 | + } |
|
1302 | + //no nav tab for this config |
|
1276 | 1303 | |
1277 | 1304 | //check for persistent flag |
1278 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1279 | - continue; //nav tab is only to appear when route requested. |
|
1305 | + if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) { |
|
1306 | + continue; |
|
1307 | + } |
|
1308 | + //nav tab is only to appear when route requested. |
|
1280 | 1309 | |
1281 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1282 | - continue; //no nav tab becasue current user does not have access. |
|
1310 | + if ( ! $this->check_user_access( $slug, TRUE ) ) { |
|
1311 | + continue; |
|
1312 | + } |
|
1313 | + //no nav tab becasue current user does not have access. |
|
1283 | 1314 | |
1284 | 1315 | $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
1285 | 1316 | $this->_nav_tabs[$slug] = array( |
@@ -1515,10 +1546,11 @@ discard block |
||
1515 | 1546 | $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
1516 | 1547 | } |
1517 | 1548 | |
1518 | - if ( $display ) |
|
1519 | - echo $content; |
|
1520 | - else |
|
1521 | - return $content; |
|
1549 | + if ( $display ) { |
|
1550 | + echo $content; |
|
1551 | + } else { |
|
1552 | + return $content; |
|
1553 | + } |
|
1522 | 1554 | } |
1523 | 1555 | |
1524 | 1556 | |
@@ -1535,8 +1567,9 @@ discard block |
||
1535 | 1567 | $method_name = '_help_popup_content_' . $this->_req_action; |
1536 | 1568 | |
1537 | 1569 | //if method doesn't exist let's get out. |
1538 | - if ( !method_exists( $this, $method_name ) ) |
|
1539 | - return array(); |
|
1570 | + if ( !method_exists( $this, $method_name ) ) { |
|
1571 | + return array(); |
|
1572 | + } |
|
1540 | 1573 | |
1541 | 1574 | //k we're good to go let's retrieve the help array |
1542 | 1575 | $help_array = call_user_func( array( $this, $method_name ) ); |
@@ -1567,7 +1600,9 @@ discard block |
||
1567 | 1600 | */ |
1568 | 1601 | protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
1569 | 1602 | |
1570 | - if ( defined('DOING_AJAX') ) return; |
|
1603 | + if ( defined('DOING_AJAX') ) { |
|
1604 | + return; |
|
1605 | + } |
|
1571 | 1606 | |
1572 | 1607 | //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 |
1573 | 1608 | $help_array = $this->_get_help_content(); |
@@ -1585,10 +1620,11 @@ discard block |
||
1585 | 1620 | $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>'; |
1586 | 1621 | $content = $content . $help_content; |
1587 | 1622 | |
1588 | - if ( $display ) |
|
1589 | - echo $content; |
|
1590 | - else |
|
1591 | - return $content; |
|
1623 | + if ( $display ) { |
|
1624 | + echo $content; |
|
1625 | + } else { |
|
1626 | + return $content; |
|
1627 | + } |
|
1592 | 1628 | } |
1593 | 1629 | |
1594 | 1630 | |
@@ -1814,8 +1850,10 @@ discard block |
||
1814 | 1850 | protected function _set_list_table() { |
1815 | 1851 | |
1816 | 1852 | //first is this a list_table view? |
1817 | - if ( !isset($this->_route_config['list_table']) ) |
|
1818 | - return; //not a list_table view so get out. |
|
1853 | + if ( !isset($this->_route_config['list_table']) ) { |
|
1854 | + return; |
|
1855 | + } |
|
1856 | + //not a list_table view so get out. |
|
1819 | 1857 | |
1820 | 1858 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1821 | 1859 | |
@@ -2181,8 +2219,9 @@ discard block |
||
2181 | 2219 | protected function _espresso_sponsors_post_box() { |
2182 | 2220 | |
2183 | 2221 | $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
2184 | - if ( $show_sponsors ) |
|
2185 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2222 | + if ( $show_sponsors ) { |
|
2223 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2224 | + } |
|
2186 | 2225 | } |
2187 | 2226 | |
2188 | 2227 | |
@@ -2628,10 +2667,11 @@ discard block |
||
2628 | 2667 | true |
2629 | 2668 | ); |
2630 | 2669 | // the final template wrapper |
2631 | - if ( $sidebar ) |
|
2632 | - $this->display_admin_page_with_sidebar(); |
|
2633 | - else |
|
2634 | - $this->display_admin_page_with_no_sidebar(); |
|
2670 | + if ( $sidebar ) { |
|
2671 | + $this->display_admin_page_with_sidebar(); |
|
2672 | + } else { |
|
2673 | + $this->display_admin_page_with_no_sidebar(); |
|
2674 | + } |
|
2635 | 2675 | } |
2636 | 2676 | |
2637 | 2677 | |
@@ -2699,8 +2739,9 @@ discard block |
||
2699 | 2739 | |
2700 | 2740 | |
2701 | 2741 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2702 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2703 | - header('Content-Type: application/json; charset=UTF-8'); |
|
2742 | + if ( NULL === error_get_last() || ! headers_sent() ) { |
|
2743 | + header('Content-Type: application/json; charset=UTF-8'); |
|
2744 | + } |
|
2704 | 2745 | if( function_exists( 'wp_json_encode' ) ) { |
2705 | 2746 | echo wp_json_encode( $json ); |
2706 | 2747 | } else { |
@@ -2718,10 +2759,9 @@ discard block |
||
2718 | 2759 | * @throws EE_Error |
2719 | 2760 | */ |
2720 | 2761 | public function return_json() { |
2721 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2722 | - $this->_return_json(); |
|
2723 | - |
|
2724 | - else { |
|
2762 | + if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2763 | + $this->_return_json(); |
|
2764 | + } else { |
|
2725 | 2765 | throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
2726 | 2766 | } |
2727 | 2767 | } |
@@ -2863,7 +2903,9 @@ discard block |
||
2863 | 2903 | $id = $this->_current_view . '_' . $ref; |
2864 | 2904 | $name = !empty($actions) ? $actions[$key] : $ref; |
2865 | 2905 | $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
2866 | - if ( !$both ) break; |
|
2906 | + if ( !$both ) { |
|
2907 | + break; |
|
2908 | + } |
|
2867 | 2909 | } |
2868 | 2910 | |
2869 | 2911 | } |
@@ -3219,13 +3261,15 @@ discard block |
||
3219 | 3261 | if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
3220 | 3262 | check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
3221 | 3263 | |
3222 | - if ( !$user = wp_get_current_user() ) |
|
3223 | - return; |
|
3264 | + if ( !$user = wp_get_current_user() ) { |
|
3265 | + return; |
|
3266 | + } |
|
3224 | 3267 | $option = $_POST['wp_screen_options']['option']; |
3225 | 3268 | $value = $_POST['wp_screen_options']['value']; |
3226 | 3269 | |
3227 | - if ( $option != sanitize_key( $option ) ) |
|
3228 | - return; |
|
3270 | + if ( $option != sanitize_key( $option ) ) { |
|
3271 | + return; |
|
3272 | + } |
|
3229 | 3273 | |
3230 | 3274 | $map_option = $option; |
3231 | 3275 | |
@@ -3234,13 +3278,15 @@ discard block |
||
3234 | 3278 | switch ( $map_option ) { |
3235 | 3279 | case $this->_current_page . '_' . $this->_current_view . '_per_page': |
3236 | 3280 | $value = (int) $value; |
3237 | - if ( $value < 1 || $value > 999 ) |
|
3238 | - return; |
|
3281 | + if ( $value < 1 || $value > 999 ) { |
|
3282 | + return; |
|
3283 | + } |
|
3239 | 3284 | break; |
3240 | 3285 | default: |
3241 | 3286 | $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
3242 | - if ( false === $value ) |
|
3243 | - return; |
|
3287 | + if ( false === $value ) { |
|
3288 | + return; |
|
3289 | + } |
|
3244 | 3290 | break; |
3245 | 3291 | } |
3246 | 3292 | |
@@ -3276,8 +3322,9 @@ discard block |
||
3276 | 3322 | protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
3277 | 3323 | $user_id = get_current_user_id(); |
3278 | 3324 | |
3279 | - if ( !$skip_route_verify ) |
|
3280 | - $this->_verify_route($route); |
|
3325 | + if ( !$skip_route_verify ) { |
|
3326 | + $this->_verify_route($route); |
|
3327 | + } |
|
3281 | 3328 | |
3282 | 3329 | |
3283 | 3330 | //now let's set the string for what kind of transient we're setting |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Default_Line_Item_Display_Strategy |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Default_Line_Item_Display_Strategy |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class EE_Default_Line_Item_Display_Strategy implements EEI_Line_Item_Display { |
16 | 16 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // quantity td |
165 | 165 | $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | - && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
167 | + && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
168 | 168 | ? 1 + ( $this->_tax_rate / 100 ) |
169 | 169 | : 1; |
170 | 170 | // price td |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param array $options |
58 | 58 | * @return mixed |
59 | 59 | */ |
60 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
60 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
61 | 61 | |
62 | 62 | $html = ''; |
63 | 63 | // set some default options and merge with incoming |
64 | 64 | $default_options = array( |
65 | - 'show_desc' => TRUE, // TRUE FALSE |
|
65 | + 'show_desc' => TRUE, // TRUE FALSE |
|
66 | 66 | 'odd' => FALSE |
67 | 67 | ); |
68 | - $options = array_merge( $default_options, (array)$options ); |
|
68 | + $options = array_merge($default_options, (array) $options); |
|
69 | 69 | |
70 | - switch( $line_item->type() ) { |
|
70 | + switch ($line_item->type()) { |
|
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_line_item: |
73 | 73 | // item row |
74 | - $html .= $this->_item_row( $line_item, $options ); |
|
74 | + $html .= $this->_item_row($line_item, $options); |
|
75 | 75 | // got any kids? |
76 | - foreach ( $line_item->children() as $child_line_item ) { |
|
77 | - $this->display_line_item( $child_line_item, $options ); |
|
76 | + foreach ($line_item->children() as $child_line_item) { |
|
77 | + $this->display_line_item($child_line_item, $options); |
|
78 | 78 | } |
79 | 79 | break; |
80 | 80 | |
81 | 81 | case EEM_Line_Item::type_sub_line_item: |
82 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
82 | + $html .= $this->_sub_item_row($line_item, $options); |
|
83 | 83 | break; |
84 | 84 | |
85 | 85 | case EEM_Line_Item::type_sub_total: |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | break; |
91 | 91 | |
92 | 92 | case EEM_Line_Item::type_tax_sub_total: |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
95 | 95 | // recursively feed children back into this method |
96 | - $this->display_line_item( $child_line_item, $options ); |
|
96 | + $this->display_line_item($child_line_item, $options); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | break; |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | case EEM_Line_Item::type_total: |
102 | 102 | // get all child line items |
103 | 103 | $children = $line_item->children(); |
104 | - if ( $options[ 'set_tax_rate' ] === true ) { |
|
104 | + if ($options['set_tax_rate'] === true) { |
|
105 | 105 | // loop thru tax child line items just to determine tax rate |
106 | - foreach ( $children as $child_line_item ) { |
|
107 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
106 | + foreach ($children as $child_line_item) { |
|
107 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
108 | 108 | // recursively feed children back into this method |
109 | - $this->display_line_item( $child_line_item, $options ); |
|
109 | + $this->display_line_item($child_line_item, $options); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | // now loop thru all non-tax child line items |
114 | - foreach ( $children as $child_line_item ) { |
|
115 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
114 | + foreach ($children as $child_line_item) { |
|
115 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
116 | 116 | // recursively feed children back into this method |
117 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
117 | + $html .= $this->display_line_item($child_line_item, $options); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param array $options |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
137 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
138 | 138 | // start of row |
139 | 139 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
140 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
140 | + $html = EEH_HTML::tr('', '', $row_class); |
|
141 | 141 | // name && desc |
142 | 142 | $name_and_desc = apply_filters( |
143 | 143 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
@@ -146,33 +146,33 @@ discard block |
||
146 | 146 | ); |
147 | 147 | $name_and_desc .= apply_filters( |
148 | 148 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
149 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
149 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
150 | 150 | $line_item, |
151 | 151 | $options |
152 | 152 | ); |
153 | - if ( $line_item->is_taxable() ) { |
|
153 | + if ($line_item->is_taxable()) { |
|
154 | 154 | $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
155 | - ? __( '* price includes taxes', 'event_espresso' ) |
|
156 | - : __( '* price does not include taxes', 'event_espresso' ); |
|
155 | + ? __('* price includes taxes', 'event_espresso') |
|
156 | + : __('* price does not include taxes', 'event_espresso'); |
|
157 | 157 | $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
158 | 158 | . $ticket_price_includes_taxes |
159 | 159 | . '</span>'; |
160 | 160 | } |
161 | 161 | |
162 | 162 | // name td |
163 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
163 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
164 | 164 | // quantity td |
165 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
165 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | 167 | && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
168 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
168 | + ? 1 + ($this->_tax_rate / 100) |
|
169 | 169 | : 1; |
170 | 170 | // price td |
171 | - $unit_price = EEH_Template::format_currency( $line_item->unit_price() * $tax_rate, false, false ); |
|
172 | - $html .= EEH_HTML::td( $unit_price, '', 'item_c jst-rght' ); |
|
171 | + $unit_price = EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false); |
|
172 | + $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
173 | 173 | // total td |
174 | - $total = EEH_Template::format_currency( $line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false ); |
|
175 | - $html .= EEH_HTML::td( $total, '', 'item_r jst-rght' ); |
|
174 | + $total = EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false); |
|
175 | + $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
176 | 176 | // end of row |
177 | 177 | $html .= EEH_HTML::trx(); |
178 | 178 | |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | * @param array $options |
189 | 189 | * @return mixed |
190 | 190 | */ |
191 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
191 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
192 | 192 | // start of row |
193 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
193 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
194 | 194 | // name && desc |
195 | 195 | $name_and_desc = $line_item->name(); |
196 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
196 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
197 | 197 | // name td |
198 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
198 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
199 | 199 | // discount/surcharge td |
200 | - if ( $line_item->is_percent() ) { |
|
201 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
200 | + if ($line_item->is_percent()) { |
|
201 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
202 | 202 | } else { |
203 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
203 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
204 | 204 | } |
205 | 205 | // total td |
206 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
206 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
207 | 207 | // end of row |
208 | 208 | $html .= EEH_HTML::trx(); |
209 | 209 | return $html; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * an array for storing request actions and their corresponding methods |
81 | - * @access private |
|
82 | - * @return void |
|
83 | - */ |
|
81 | + * @access private |
|
82 | + * @return void |
|
83 | + */ |
|
84 | 84 | protected function _set_page_routes() { |
85 | 85 | $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
86 | 86 | $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | 'capability' => 'ee_delete_default_price_type', |
186 | 186 | 'obj_id' => $prt_id |
187 | 187 | ), |
188 | - 'tax_settings' => array( |
|
189 | - 'func' => '_tax_settings', |
|
190 | - 'capability' => 'manage_options' |
|
191 | - ), |
|
192 | - 'update_tax_settings' => array( |
|
193 | - 'func' => '_update_tax_settings', |
|
194 | - 'capability' => 'manage_options', |
|
195 | - 'noheader' => true |
|
196 | - ), |
|
197 | - ); |
|
188 | + 'tax_settings' => array( |
|
189 | + 'func' => '_tax_settings', |
|
190 | + 'capability' => 'manage_options' |
|
191 | + ), |
|
192 | + 'update_tax_settings' => array( |
|
193 | + 'func' => '_update_tax_settings', |
|
194 | + 'capability' => 'manage_options', |
|
195 | + 'noheader' => true |
|
196 | + ), |
|
197 | + ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'order' => 10 |
210 | 210 | ), |
211 | 211 | 'list_table' => 'Prices_List_Table', |
212 | - 'help_tabs' => array( |
|
212 | + 'help_tabs' => array( |
|
213 | 213 | 'pricing_default_pricing_help_tab' => array( |
214 | 214 | 'title' => __('Default Pricing', 'event_espresso'), |
215 | 215 | 'filename' => 'pricing_default_pricing' |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | 'order' => 20, |
233 | 233 | 'persistent' => FALSE |
234 | 234 | ), |
235 | - 'help_tabs' => array( |
|
235 | + 'help_tabs' => array( |
|
236 | 236 | 'add_new_default_price_help_tab' => array( |
237 | 237 | 'title' => __('Add New Default Price', 'event_espresso'), |
238 | 238 | 'filename' => 'pricing_add_new_default_price' |
239 | 239 | ) |
240 | 240 | ), |
241 | - 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
241 | + 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
242 | 242 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | 252 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
253 | - 'help_tabs' => array( |
|
253 | + 'help_tabs' => array( |
|
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'order' => 30 |
266 | 266 | ), |
267 | 267 | 'list_table' => 'Price_Types_List_Table', |
268 | - 'help_tabs' => array( |
|
268 | + 'help_tabs' => array( |
|
269 | 269 | 'pricing_price_types_help_tab' => array( |
270 | 270 | 'title' => __('Price Types', 'event_espresso'), |
271 | 271 | 'filename' => 'pricing_price_types' |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | 'order' => 40, |
290 | 290 | 'persistent' => FALSE |
291 | 291 | ), |
292 | - 'help_tabs' => array( |
|
292 | + 'help_tabs' => array( |
|
293 | 293 | 'add_new_price_type_help_tab' => array( |
294 | 294 | 'title' => __('Add New Price Type', 'event_espresso'), |
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
298 | + 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | 299 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
@@ -305,36 +305,36 @@ discard block |
||
305 | 305 | 'order' => 40, |
306 | 306 | 'persistent' => FALSE |
307 | 307 | ), |
308 | - 'help_tabs' => array( |
|
308 | + 'help_tabs' => array( |
|
309 | 309 | 'edit_price_type_help_tab' => array( |
310 | 310 | 'title' => __('Edit Price Type', 'event_espresso'), |
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
314 | + 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | 315 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
319 | - 'tax_settings' => array( |
|
320 | - 'nav' => array( |
|
321 | - 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | - 'order' => 40 |
|
323 | - ), |
|
324 | - 'labels' => array( |
|
325 | - 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | - ), |
|
327 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | - // 'help_tabs' => array( |
|
329 | - // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | - // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | - // 'filename' => 'registration_form_reg_form_settings' |
|
332 | - // ), |
|
333 | - // ), |
|
334 | - // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | - 'require_nonce' => true |
|
336 | - ) |
|
337 | - ); |
|
319 | + 'tax_settings' => array( |
|
320 | + 'nav' => array( |
|
321 | + 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | + 'order' => 40 |
|
323 | + ), |
|
324 | + 'labels' => array( |
|
325 | + 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | + ), |
|
327 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | + // 'help_tabs' => array( |
|
329 | + // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | + // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | + // 'filename' => 'registration_form_reg_form_settings' |
|
332 | + // ), |
|
333 | + // ), |
|
334 | + // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | + 'require_nonce' => true |
|
336 | + ) |
|
337 | + ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -460,16 +460,16 @@ discard block |
||
460 | 460 | |
461 | 461 | /** |
462 | 462 | * generates HTML for main Prices Admin page |
463 | - * @access protected |
|
464 | - * @return void |
|
465 | - */ |
|
463 | + * @access protected |
|
464 | + * @return void |
|
465 | + */ |
|
466 | 466 | protected function _price_overview_list_table() { |
467 | 467 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
468 | - 'add_new_price', |
|
469 | - 'add', |
|
470 | - array(), |
|
471 | - 'add-new-h2' |
|
472 | - ); |
|
468 | + 'add_new_price', |
|
469 | + 'add', |
|
470 | + array(), |
|
471 | + 'add-new-h2' |
|
472 | + ); |
|
473 | 473 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
474 | 474 | $this->_search_btn_label = __('Default Prices', 'event_espresso'); |
475 | 475 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | |
482 | 482 | |
483 | 483 | /** |
484 | - * retrieve data for Prices List table |
|
485 | - * @access public |
|
486 | - * @param int $per_page how many prices displayed per page |
|
487 | - * @param boolean $count return the count or objects |
|
488 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | - * @return mixed (int|array) int = count || array of price objects |
|
490 | - */ |
|
484 | + * retrieve data for Prices List table |
|
485 | + * @access public |
|
486 | + * @param int $per_page how many prices displayed per page |
|
487 | + * @param boolean $count return the count or objects |
|
488 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | + * @return mixed (int|array) int = count || array of price objects |
|
490 | + */ |
|
491 | 491 | public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
492 | 492 | |
493 | 493 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | |
558 | 558 | /** |
559 | 559 | * _price_details |
560 | - * @access protected |
|
561 | - * @return void |
|
562 | - */ |
|
560 | + * @access protected |
|
561 | + * @return void |
|
562 | + */ |
|
563 | 563 | protected function _edit_price_details() { |
564 | 564 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
565 | 565 | // grab price ID |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | |
629 | 629 | /** |
630 | 630 | * declare price details page metaboxes |
631 | - * @access protected |
|
632 | - * @return void |
|
633 | - */ |
|
631 | + * @access protected |
|
632 | + * @return void |
|
633 | + */ |
|
634 | 634 | protected function _price_details_meta_boxes() { |
635 | 635 | add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
636 | 636 | } |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | /** |
644 | 644 | * _edit_price_details_meta_box |
645 | - * @access public |
|
646 | - * @return void |
|
647 | - */ |
|
645 | + * @access public |
|
646 | + * @return void |
|
647 | + */ |
|
648 | 648 | public function _edit_price_details_meta_box() { |
649 | 649 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
650 | 650 | } |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | |
656 | 656 | /** |
657 | 657 | * set_price_column_values |
658 | - * @access protected |
|
659 | - * @return array |
|
660 | - */ |
|
658 | + * @access protected |
|
659 | + * @return array |
|
660 | + */ |
|
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | 663 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | |
685 | 685 | /** |
686 | 686 | * insert_or_update_price |
687 | - * @param boolean $insert - whether to insert or update |
|
688 | - * @access protected |
|
689 | - * @return void |
|
690 | - */ |
|
687 | + * @param boolean $insert - whether to insert or update |
|
688 | + * @access protected |
|
689 | + * @return void |
|
690 | + */ |
|
691 | 691 | protected function _insert_or_update_price( $insert = FALSE ) { |
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | |
761 | 761 | /** |
762 | 762 | * _trash_or_restore_price |
763 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | - * @access protected |
|
765 | - * @return void |
|
766 | - */ |
|
763 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | + * @access protected |
|
765 | + * @return void |
|
766 | + */ |
|
767 | 767 | protected function _trash_or_restore_price( $trash = TRUE ) { |
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | |
844 | 844 | /** |
845 | 845 | * _delete_price |
846 | - * @access protected |
|
847 | - * @return void |
|
848 | - */ |
|
846 | + * @access protected |
|
847 | + * @return void |
|
848 | + */ |
|
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -922,16 +922,16 @@ discard block |
||
922 | 922 | |
923 | 923 | /** |
924 | 924 | * generates HTML for main Prices Admin page |
925 | - * @access protected |
|
926 | - * @return void |
|
927 | - */ |
|
925 | + * @access protected |
|
926 | + * @return void |
|
927 | + */ |
|
928 | 928 | protected function _price_types_overview_list_table() { |
929 | 929 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
930 | - 'add_new_price_type', |
|
931 | - 'add_type', |
|
932 | - array(), |
|
933 | - 'add-new-h2' |
|
934 | - ); |
|
930 | + 'add_new_price_type', |
|
931 | + 'add_type', |
|
932 | + array(), |
|
933 | + 'add-new-h2' |
|
934 | + ); |
|
935 | 935 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
936 | 936 | $this->_search_btn_label = __('Price Types', 'event_espresso'); |
937 | 937 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | |
944 | 944 | |
945 | 945 | /** |
946 | - * retrieve data for Price Types List table |
|
947 | - * @access public |
|
948 | - * @param int $per_page how many prices displayed per page |
|
949 | - * @param boolean $count return the count or objects |
|
950 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | - * @return mixed (int|array) int = count || array of price objects |
|
952 | - */ |
|
946 | + * retrieve data for Price Types List table |
|
947 | + * @access public |
|
948 | + * @param int $per_page how many prices displayed per page |
|
949 | + * @param boolean $count return the count or objects |
|
950 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | + * @return mixed (int|array) int = count || array of price objects |
|
952 | + */ |
|
953 | 953 | public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
954 | 954 | |
955 | 955 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1004,9 +1004,9 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | /** |
1006 | 1006 | * _edit_price_type_details |
1007 | - * @access protected |
|
1008 | - * @return void |
|
1009 | - */ |
|
1007 | + * @access protected |
|
1008 | + * @return void |
|
1009 | + */ |
|
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | 1012 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1070,9 +1070,9 @@ discard block |
||
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * declare price type details page metaboxes |
1073 | - * @access protected |
|
1074 | - * @return void |
|
1075 | - */ |
|
1073 | + * @access protected |
|
1074 | + * @return void |
|
1075 | + */ |
|
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | 1077 | add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
1078 | 1078 | } |
@@ -1083,9 +1083,9 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | /** |
1085 | 1085 | * _edit_price_type_details_meta_box |
1086 | - * @access public |
|
1087 | - * @return void |
|
1088 | - */ |
|
1086 | + * @access public |
|
1087 | + * @return void |
|
1088 | + */ |
|
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | 1090 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
1091 | 1091 | } |
@@ -1095,9 +1095,9 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | /** |
1097 | 1097 | * set_price_type_column_values |
1098 | - * @access protected |
|
1099 | - * @return void |
|
1100 | - */ |
|
1098 | + * @access protected |
|
1099 | + * @return void |
|
1100 | + */ |
|
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | 1103 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1145,10 +1145,10 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | /** |
1147 | 1147 | * _insert_or_update_price_type |
1148 | - * @param boolean $new_price_type - whether to insert or update |
|
1149 | - * @access protected |
|
1150 | - * @return void |
|
1151 | - */ |
|
1148 | + * @param boolean $new_price_type - whether to insert or update |
|
1149 | + * @access protected |
|
1150 | + * @return void |
|
1151 | + */ |
|
1152 | 1152 | protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1189,10 +1189,10 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | /** |
1191 | 1191 | * _trash_or_restore_price_type |
1192 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | - * @access protected |
|
1194 | - * @return void |
|
1195 | - */ |
|
1192 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | + * @access protected |
|
1194 | + * @return void |
|
1195 | + */ |
|
1196 | 1196 | protected function _trash_or_restore_price_type( $trash = TRUE ) { |
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1246,9 +1246,9 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | /** |
1248 | 1248 | * _delete_price_type |
1249 | - * @access protected |
|
1250 | - * @return void |
|
1251 | - */ |
|
1249 | + * @access protected |
|
1250 | + * @return void |
|
1251 | + */ |
|
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1285,76 +1285,76 @@ discard block |
||
1285 | 1285 | |
1286 | 1286 | /** |
1287 | 1287 | * _learn_more_about_pricing_link |
1288 | - * @access protected |
|
1289 | - * @return string |
|
1290 | - */ |
|
1288 | + * @access protected |
|
1289 | + * @return string |
|
1290 | + */ |
|
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | 1292 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | |
1297 | - protected function _tax_settings() { |
|
1298 | - $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | - $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | - $this->display_admin_page_with_sidebar(); |
|
1302 | - } |
|
1303 | - |
|
1304 | - |
|
1305 | - |
|
1306 | - /** |
|
1307 | - * @return \EE_Form_Section_Proper |
|
1308 | - * @throws \EE_Error |
|
1309 | - */ |
|
1310 | - protected function tax_settings_form() { |
|
1311 | - return new EE_Form_Section_Proper( |
|
1312 | - array( |
|
1313 | - 'name' => 'tax_settings_form', |
|
1314 | - 'html_id' => 'tax_settings_form', |
|
1315 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | - 'subsections' => apply_filters( |
|
1317 | - 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | - array( |
|
1319 | - 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | - array( |
|
1321 | - 'name' => 'tax_settings_tbl', |
|
1322 | - 'html_id' => 'tax_settings_tbl', |
|
1323 | - 'html_class' => 'form-table', |
|
1324 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | - 'subsections' => array( |
|
1326 | - 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | - array( |
|
1328 | - 'html_label_text' => __( |
|
1329 | - "Show Prices With Taxes Included?", |
|
1330 | - 'event_espresso' |
|
1331 | - ), |
|
1332 | - 'html_help_text' => __( |
|
1333 | - 'Indicates whether or not to display prices with the taxes included', |
|
1334 | - 'event_espresso' |
|
1335 | - ), |
|
1336 | - 'default' => isset( |
|
1337 | - EE_Registry::instance() |
|
1338 | - ->CFG |
|
1339 | - ->tax_settings |
|
1340 | - ->prices_displayed_including_taxes |
|
1341 | - ) |
|
1342 | - ? EE_Registry::instance() |
|
1343 | - ->CFG |
|
1344 | - ->tax_settings |
|
1345 | - ->prices_displayed_including_taxes |
|
1346 | - : true, |
|
1347 | - 'display_html_label_text' => false |
|
1348 | - ) |
|
1349 | - ), |
|
1350 | - ) |
|
1351 | - ) |
|
1352 | - ) |
|
1353 | - ) |
|
1354 | - ) |
|
1355 | - ) |
|
1356 | - ); |
|
1357 | - } |
|
1297 | + protected function _tax_settings() { |
|
1298 | + $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | + $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | + $this->display_admin_page_with_sidebar(); |
|
1302 | + } |
|
1303 | + |
|
1304 | + |
|
1305 | + |
|
1306 | + /** |
|
1307 | + * @return \EE_Form_Section_Proper |
|
1308 | + * @throws \EE_Error |
|
1309 | + */ |
|
1310 | + protected function tax_settings_form() { |
|
1311 | + return new EE_Form_Section_Proper( |
|
1312 | + array( |
|
1313 | + 'name' => 'tax_settings_form', |
|
1314 | + 'html_id' => 'tax_settings_form', |
|
1315 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | + 'subsections' => apply_filters( |
|
1317 | + 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | + array( |
|
1319 | + 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | + array( |
|
1321 | + 'name' => 'tax_settings_tbl', |
|
1322 | + 'html_id' => 'tax_settings_tbl', |
|
1323 | + 'html_class' => 'form-table', |
|
1324 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | + 'subsections' => array( |
|
1326 | + 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | + array( |
|
1328 | + 'html_label_text' => __( |
|
1329 | + "Show Prices With Taxes Included?", |
|
1330 | + 'event_espresso' |
|
1331 | + ), |
|
1332 | + 'html_help_text' => __( |
|
1333 | + 'Indicates whether or not to display prices with the taxes included', |
|
1334 | + 'event_espresso' |
|
1335 | + ), |
|
1336 | + 'default' => isset( |
|
1337 | + EE_Registry::instance() |
|
1338 | + ->CFG |
|
1339 | + ->tax_settings |
|
1340 | + ->prices_displayed_including_taxes |
|
1341 | + ) |
|
1342 | + ? EE_Registry::instance() |
|
1343 | + ->CFG |
|
1344 | + ->tax_settings |
|
1345 | + ->prices_displayed_including_taxes |
|
1346 | + : true, |
|
1347 | + 'display_html_label_text' => false |
|
1348 | + ) |
|
1349 | + ), |
|
1350 | + ) |
|
1351 | + ) |
|
1352 | + ) |
|
1353 | + ) |
|
1354 | + ) |
|
1355 | + ) |
|
1356 | + ); |
|
1357 | + } |
|
1358 | 1358 | |
1359 | 1359 | |
1360 | 1360 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
224 | 224 | ) |
225 | 225 | ), |
226 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
226 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
227 | 227 | 'require_nonce' => FALSE |
228 | 228 | ), |
229 | 229 | 'add_new_price' => array( |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | ) |
240 | 240 | ), |
241 | 241 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
242 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
242 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
245 | 245 | 'edit_price' => array( |
246 | 246 | 'nav' => array( |
247 | 247 | 'label' => __('Edit Default Price', 'event_espresso'), |
248 | 248 | 'order' => 20, |
249 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
249 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
252 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
253 | 253 | 'help_tabs' => array( |
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
257 | 257 | ) |
258 | 258 | ), |
259 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
259 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
260 | 260 | 'require_nonce' => FALSE |
261 | 261 | ), |
262 | 262 | 'price_types' => array( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
280 | 280 | ), |
281 | 281 | ), |
282 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
282 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
283 | 283 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
284 | 284 | 'require_nonce' => FALSE |
285 | 285 | ), |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
298 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
299 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
302 | 302 | 'edit_price_type' => array( |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
314 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
315 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | public function load_scripts_styles() { |
368 | 368 | //styles |
369 | 369 | wp_enqueue_style('espresso-ui-theme'); |
370 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
370 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
371 | 371 | wp_enqueue_style('espresso_PRICING'); |
372 | 372 | |
373 | 373 | //scripts |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | //wp_enqueue_script('jquery-ui-dialog'); |
378 | 378 | //wp_enqueue_script('jquery-ui-draggable'); |
379 | 379 | //wp_enqueue_script('jquery-ui-datepicker'); |
380 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
381 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
380 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
381 | + wp_enqueue_script('espresso_PRICING'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | public function load_scripts_styles_default() { |
389 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
389 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | |
417 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
417 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
418 | 418 | $this->_views['trashed'] = array( |
419 | 419 | 'slug' => 'trashed', |
420 | 420 | 'label' => __('Trash', 'event_espresso'), |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | |
447 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
447 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
448 | 448 | $this->_views['trashed'] = array( |
449 | 449 | 'slug' => 'trashed', |
450 | 450 | 'label' => __('Trash', 'event_espresso'), |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | protected function _price_overview_list_table() { |
467 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
467 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
468 | 468 | 'add_new_price', |
469 | 469 | 'add', |
470 | 470 | array(), |
@@ -488,18 +488,18 @@ discard block |
||
488 | 488 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
489 | 489 | * @return mixed (int|array) int = count || array of price objects |
490 | 490 | */ |
491 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
491 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
492 | 492 | |
493 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
493 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
494 | 494 | // start with an empty array |
495 | 495 | $event_pricing = array(); |
496 | 496 | |
497 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
498 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
497 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
498 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
499 | 499 | //$PRC = EEM_Price::instance(); |
500 | 500 | |
501 | 501 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
502 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
502 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
503 | 503 | |
504 | 504 | switch ($this->_req_data['orderby']) { |
505 | 505 | case 'name': |
@@ -512,27 +512,27 @@ discard block |
||
512 | 512 | $orderby = array('PRC_amount'=>$order); |
513 | 513 | break; |
514 | 514 | default: |
515 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
515 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
516 | 516 | } |
517 | 517 | |
518 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
519 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
518 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
519 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
520 | 520 | |
521 | 521 | $_where = array( |
522 | 522 | 'PRC_is_default' => 1, |
523 | 523 | 'PRC_deleted' => $trashed |
524 | 524 | ); |
525 | 525 | |
526 | - $offset = ($current_page-1)*$per_page; |
|
527 | - $limit = array( $offset, $per_page ); |
|
526 | + $offset = ($current_page - 1) * $per_page; |
|
527 | + $limit = array($offset, $per_page); |
|
528 | 528 | |
529 | - if ( isset( $this->_req_data['s'] ) ) { |
|
530 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
529 | + if (isset($this->_req_data['s'])) { |
|
530 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
531 | 531 | $_where['OR'] = array( |
532 | - 'PRC_name' => array('LIKE',$sstr ), |
|
533 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
534 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
535 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
532 | + 'PRC_name' => array('LIKE', $sstr), |
|
533 | + 'PRC_desc' => array('LIKE', $sstr), |
|
534 | + 'PRC_amount' => array('LIKE', $sstr), |
|
535 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | 'group_by'=>'PRC_ID' |
544 | 544 | ); |
545 | 545 | |
546 | - if($count){ |
|
547 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | - }else{ |
|
546 | + if ($count) { |
|
547 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | + } else { |
|
549 | 549 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
550 | 550 | } |
551 | 551 | } |
@@ -561,49 +561,49 @@ discard block |
||
561 | 561 | * @return void |
562 | 562 | */ |
563 | 563 | protected function _edit_price_details() { |
564 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
564 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
565 | 565 | // grab price ID |
566 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
566 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
567 | 567 | // change page title based on request action |
568 | - switch( $this->_req_action ) { |
|
568 | + switch ($this->_req_action) { |
|
569 | 569 | case 'add_new_price' : |
570 | - $this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' ); |
|
570 | + $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso'); |
|
571 | 571 | break; |
572 | 572 | case 'edit_price' : |
573 | - $this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' ); |
|
573 | + $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso'); |
|
574 | 574 | break; |
575 | 575 | default : |
576 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
576 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
577 | 577 | } |
578 | 578 | // add PRC_ID to title if editing |
579 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
579 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
580 | 580 | |
581 | 581 | // get prices |
582 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
582 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
583 | 583 | $PRC = EEM_Price::instance(); |
584 | 584 | |
585 | - if ( $PRC_ID ) { |
|
586 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
585 | + if ($PRC_ID) { |
|
586 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
587 | 587 | $additional_hidden_fields = array( |
588 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
588 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
589 | 589 | ); |
590 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
590 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
591 | 591 | } else { |
592 | 592 | $price = $PRC->get_new_price(); |
593 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
593 | + $this->_set_add_edit_form_tags('insert_price'); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | $this->_template_args['PRC_ID'] = $PRC_ID; |
597 | 597 | $this->_template_args['price'] = $price; |
598 | 598 | |
599 | 599 | // get price types |
600 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
600 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
601 | 601 | $PRT = EEM_Price_Type::instance(); |
602 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
602 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
603 | 603 | $price_type_names = array(); |
604 | 604 | if (empty($price_types)) { |
605 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
606 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
605 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
606 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
607 | 607 | exit(); |
608 | 608 | } else { |
609 | 609 | foreach ($price_types as $type) { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $this->_template_args['price_types'] = $price_type_names; |
617 | 617 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
618 | 618 | |
619 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
619 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
620 | 620 | // the details template wrapper |
621 | 621 | $this->display_admin_page_with_sidebar(); |
622 | 622 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @return void |
633 | 633 | */ |
634 | 634 | protected function _price_details_meta_boxes() { |
635 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
635 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @return void |
647 | 647 | */ |
648 | 648 | public function _edit_price_details_meta_box() { |
649 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
649 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
663 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
664 | 664 | |
665 | 665 | $set_column_values = array( |
666 | 666 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -688,12 +688,12 @@ discard block |
||
688 | 688 | * @access protected |
689 | 689 | * @return void |
690 | 690 | */ |
691 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
691 | + protected function _insert_or_update_price($insert = FALSE) { |
|
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
694 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
694 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
695 | 695 | |
696 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
696 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
697 | 697 | $PRC = EEM_Price::instance(); |
698 | 698 | |
699 | 699 | // why be so pessimistic ??? : ( |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | |
702 | 702 | $set_column_values = $this->set_price_column_values(); |
703 | 703 | // is this a new Price ? |
704 | - if ( $insert ) { |
|
704 | + if ($insert) { |
|
705 | 705 | // run the insert |
706 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
706 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
707 | 707 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
708 | 708 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
709 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
709 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
710 | 710 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
711 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
711 | + $ticket->_add_relation_to($PR, 'Price'); |
|
712 | 712 | $ticket->save(); |
713 | 713 | } |
714 | 714 | $success = 1; |
@@ -718,29 +718,29 @@ discard block |
||
718 | 718 | } |
719 | 719 | $action_desc = 'created'; |
720 | 720 | } else { |
721 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
721 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
722 | 722 | // run the update |
723 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
724 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
723 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
724 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
725 | 725 | $success = 1; |
726 | 726 | } |
727 | 727 | |
728 | 728 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
729 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
729 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
730 | 730 | |
731 | 731 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
732 | - if ( $PRC_ID === 1 ) { |
|
732 | + if ($PRC_ID === 1) { |
|
733 | 733 | $ticket = $PR->get_first_related('Ticket'); |
734 | - if ( $ticket ) { |
|
735 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
736 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
734 | + if ($ticket) { |
|
735 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
736 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
737 | 737 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
738 | 738 | $ticket->save(); |
739 | 739 | } |
740 | 740 | } else { |
741 | 741 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
742 | 742 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
743 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
743 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
744 | 744 | $ticket->save(); |
745 | 745 | } |
746 | 746 | } |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | $action_desc = 'updated'; |
749 | 749 | } |
750 | 750 | |
751 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
751 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
752 | 752 | |
753 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
753 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
754 | 754 | |
755 | 755 | } |
756 | 756 | |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | * @access protected |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
767 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
770 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
770 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
771 | 771 | |
772 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
772 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
773 | 773 | $PRC = EEM_Price::instance(); |
774 | 774 | |
775 | 775 | $success = 1; |
@@ -778,18 +778,18 @@ discard block |
||
778 | 778 | //get base ticket for updating |
779 | 779 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
780 | 780 | //Checkboxes |
781 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
781 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
782 | 782 | // if array has more than one element than success message should be plural |
783 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
783 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
784 | 784 | // cycle thru checkboxes |
785 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
786 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
785 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
786 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
787 | 787 | $success = 0; |
788 | 788 | } else { |
789 | 789 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
790 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
790 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
791 | 791 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
792 | - if ( $PRC_deleted ) { |
|
792 | + if ($PRC_deleted) { |
|
793 | 793 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
794 | 794 | } else { |
795 | 795 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | |
802 | 802 | } else { |
803 | 803 | // grab single id and delete |
804 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
805 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
804 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
805 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
806 | 806 | $success = 0; |
807 | 807 | } else { |
808 | 808 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
809 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
809 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
810 | 810 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
811 | - if ( $PRC_deleted ) { |
|
811 | + if ($PRC_deleted) { |
|
812 | 812 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
813 | 813 | } else { |
814 | 814 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -822,17 +822,17 @@ discard block |
||
822 | 822 | 'action' => 'default' |
823 | 823 | ); |
824 | 824 | |
825 | - if ( $success ) { |
|
826 | - if ( $trash ) { |
|
825 | + if ($success) { |
|
826 | + if ($trash) { |
|
827 | 827 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
828 | 828 | } else { |
829 | 829 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
830 | 830 | } |
831 | 831 | |
832 | - EE_Error::add_success( $msg ); |
|
832 | + EE_Error::add_success($msg); |
|
833 | 833 | } |
834 | 834 | |
835 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
835 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
836 | 836 | |
837 | 837 | } |
838 | 838 | |
@@ -849,19 +849,19 @@ discard block |
||
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
852 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
852 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
853 | 853 | |
854 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
854 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
855 | 855 | $PRC = EEM_Price::instance(); |
856 | 856 | |
857 | 857 | $success = 1; |
858 | 858 | //Checkboxes |
859 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
859 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
860 | 860 | // if array has more than one element than success message should be plural |
861 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
861 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
862 | 862 | // cycle thru bulk action checkboxes |
863 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
864 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
863 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
864 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
865 | 865 | $success = 0; |
866 | 866 | } |
867 | 867 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | |
876 | 876 | } |
877 | 877 | |
878 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
878 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
879 | 879 | |
880 | 880 | } |
881 | 881 | |
@@ -883,16 +883,16 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | public function update_price_order() { |
886 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
886 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
887 | 887 | |
888 | 888 | // grab our row IDs |
889 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
889 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
890 | 890 | |
891 | - if ( is_array( $row_ids )) { |
|
892 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
891 | + if (is_array($row_ids)) { |
|
892 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
893 | 893 | //Update the prices when re-ordering |
894 | 894 | $id = absint($row_ids[$i]); |
895 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
895 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
896 | 896 | $success = FALSE; |
897 | 897 | } |
898 | 898 | } |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | $success = FALSE; |
901 | 901 | } |
902 | 902 | |
903 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
903 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
904 | 904 | |
905 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
905 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
906 | 906 | die(); |
907 | 907 | } |
908 | 908 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | * @return void |
927 | 927 | */ |
928 | 928 | protected function _price_types_overview_list_table() { |
929 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
929 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
930 | 930 | 'add_new_price_type', |
931 | 931 | 'add_type', |
932 | 932 | array(), |
@@ -950,46 +950,46 @@ discard block |
||
950 | 950 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
951 | 951 | * @return mixed (int|array) int = count || array of price objects |
952 | 952 | */ |
953 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
953 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
954 | 954 | |
955 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
955 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
956 | 956 | // start with an empty array |
957 | 957 | |
958 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
959 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
958 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
959 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
960 | 960 | |
961 | 961 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
962 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
962 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
963 | 963 | switch ($this->_req_data['orderby']) { |
964 | 964 | case 'name': |
965 | - $orderby = array( 'PRT_name' => $order); |
|
965 | + $orderby = array('PRT_name' => $order); |
|
966 | 966 | break; |
967 | 967 | default: |
968 | - $orderby = array( 'PRT_order' => $order); |
|
968 | + $orderby = array('PRT_order' => $order); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | |
972 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
973 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
972 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
973 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
974 | 974 | |
975 | - $offset = ($current_page-1)*$per_page; |
|
976 | - $limit = array( $offset, $per_page ); |
|
975 | + $offset = ($current_page - 1) * $per_page; |
|
976 | + $limit = array($offset, $per_page); |
|
977 | 977 | |
978 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
978 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
979 | 979 | |
980 | - if ( isset( $this->_req_data['s'] ) ) { |
|
981 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
980 | + if (isset($this->_req_data['s'])) { |
|
981 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
982 | 982 | $_where['OR'] = array( |
983 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
983 | + 'PRT_name' => array('LIKE', $sstr) |
|
984 | 984 | ); |
985 | 985 | } |
986 | 986 | $query_params = array( |
987 | 987 | $_where, |
988 | 988 | 'order_by'=>$orderby, |
989 | 989 | 'limit'=>$limit); |
990 | - if($count){ |
|
990 | + if ($count) { |
|
991 | 991 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
992 | - }else{ |
|
992 | + } else { |
|
993 | 993 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
994 | 994 | } |
995 | 995 | |
@@ -1009,34 +1009,34 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1012 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1013 | 1013 | |
1014 | 1014 | |
1015 | 1015 | // grab price type ID |
1016 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
1016 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
1017 | 1017 | // change page title based on request action |
1018 | - switch( $this->_req_action ) { |
|
1018 | + switch ($this->_req_action) { |
|
1019 | 1019 | case 'add_new_price_type' : |
1020 | - $this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' ); |
|
1020 | + $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso'); |
|
1021 | 1021 | break; |
1022 | 1022 | case 'edit_price_type' : |
1023 | - $this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' ); |
|
1023 | + $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso'); |
|
1024 | 1024 | break; |
1025 | 1025 | default : |
1026 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
1026 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
1027 | 1027 | } |
1028 | 1028 | // add PRT_ID to title if editing |
1029 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
1029 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
1030 | 1030 | |
1031 | 1031 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
1032 | 1032 | |
1033 | - if ( $PRT_ID ) { |
|
1034 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
1035 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
1036 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
1033 | + if ($PRT_ID) { |
|
1034 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
1035 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
1036 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
1037 | 1037 | } else { |
1038 | 1038 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
1039 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
1039 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -1045,19 +1045,19 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
1047 | 1047 | $select_values = array(); |
1048 | - foreach ( $base_types as $ref => $text ) { |
|
1049 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
1048 | + foreach ($base_types as $ref => $text) { |
|
1049 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
1050 | 1050 | //do not allow creation of base_type_base_prices because that's a system only base type. |
1051 | 1051 | continue; |
1052 | 1052 | } |
1053 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
1053 | + $values[] = array('id' => $ref, 'text' => $text); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
1057 | 1057 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1058 | 1058 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1059 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1060 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1059 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1060 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1061 | 1061 | // the details template wrapper |
1062 | 1062 | $this->display_admin_page_with_sidebar(); |
1063 | 1063 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * @return void |
1075 | 1075 | */ |
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1077 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @return void |
1088 | 1088 | */ |
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1090 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | |
@@ -1100,9 +1100,9 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1103 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1104 | 1104 | |
1105 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1105 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1106 | 1106 | |
1107 | 1107 | switch ($base_type) { |
1108 | 1108 | |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | * @access protected |
1150 | 1150 | * @return void |
1151 | 1151 | */ |
1152 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1152 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1155 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1155 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1156 | 1156 | |
1157 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1157 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1158 | 1158 | $PRT = EEM_Price_Type::instance(); |
1159 | 1159 | |
1160 | 1160 | // why be so pessimistic ??? : ( |
@@ -1162,24 +1162,24 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | $set_column_values = $this->set_price_type_column_values(); |
1164 | 1164 | // is this a new Price ? |
1165 | - if ( $new_price_type ) { |
|
1165 | + if ($new_price_type) { |
|
1166 | 1166 | // run the insert |
1167 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1167 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1168 | 1168 | $success = 1; |
1169 | 1169 | } |
1170 | 1170 | $action_desc = 'created'; |
1171 | 1171 | } else { |
1172 | 1172 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1173 | 1173 | // run the update |
1174 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1175 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1174 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1175 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1176 | 1176 | $success = 1; |
1177 | 1177 | } |
1178 | 1178 | $action_desc = 'updated'; |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1182 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1181 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1182 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1183 | 1183 | |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1193,49 +1193,49 @@ discard block |
||
1193 | 1193 | * @access protected |
1194 | 1194 | * @return void |
1195 | 1195 | */ |
1196 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1196 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1200 | 1200 | |
1201 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1201 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | $PRT_deleted = $trash ? TRUE : FALSE; |
1206 | 1206 | //Checkboxes |
1207 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1207 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1208 | 1208 | // if array has more than one element than success message should be plural |
1209 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1210 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1209 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1210 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1211 | 1211 | // cycle thru checkboxes |
1212 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1213 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1212 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1213 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1214 | 1214 | $success = 0; |
1215 | 1215 | } |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | } else { |
1219 | 1219 | // grab single id and delete |
1220 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1221 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1220 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1221 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1222 | 1222 | $success = 0; |
1223 | 1223 | } |
1224 | 1224 | $what = 'Price Type'; |
1225 | 1225 | |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - $query_args = array( 'action' => 'price_types' ); |
|
1229 | - if ( $success ) { |
|
1230 | - if ( $trash ) { |
|
1228 | + $query_args = array('action' => 'price_types'); |
|
1229 | + if ($success) { |
|
1230 | + if ($trash) { |
|
1231 | 1231 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1232 | 1232 | } else { |
1233 | 1233 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1234 | 1234 | } |
1235 | - EE_Error::add_success( $msg ); |
|
1235 | + EE_Error::add_success($msg); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1238 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1239 | 1239 | |
1240 | 1240 | } |
1241 | 1241 | |
@@ -1252,19 +1252,19 @@ discard block |
||
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1255 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1255 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1256 | 1256 | |
1257 | 1257 | $PRT = EEM_Price_Type::instance(); |
1258 | 1258 | |
1259 | 1259 | $success = 1; |
1260 | 1260 | //Checkboxes |
1261 | - if (!empty($this->_req_data['checkbox'])) { |
|
1261 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1262 | 1262 | // if array has more than one element than success message should be plural |
1263 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1263 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1264 | 1264 | $what = $PRT->item_name($success); |
1265 | 1265 | // cycle thru bulk action checkboxes |
1266 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1267 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1266 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1267 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1268 | 1268 | $success = 0; |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1272,8 +1272,8 @@ discard block |
||
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | |
1275 | - $query_args = array( 'action'=> 'price_types' ); |
|
1276 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1275 | + $query_args = array('action'=> 'price_types'); |
|
1276 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | * @return string |
1290 | 1290 | */ |
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1292 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | * @return void |
1366 | 1366 | */ |
1367 | 1367 | public function _update_tax_settings() { |
1368 | - if ( ! isset( EE_Registry::instance()->CFG->tax_settings ) ) { |
|
1368 | + if ( ! isset(EE_Registry::instance()->CFG->tax_settings)) { |
|
1369 | 1369 | EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config(); |
1370 | 1370 | } |
1371 | 1371 | try { |
1372 | 1372 | $tax_form = $this->tax_settings_form(); |
1373 | 1373 | //check for form submission |
1374 | - if ( $tax_form->was_submitted() ) { |
|
1374 | + if ($tax_form->was_submitted()) { |
|
1375 | 1375 | //capture form data |
1376 | 1376 | $tax_form->receive_form_submission(); |
1377 | 1377 | //validate form data |
1378 | - if ( $tax_form->is_valid() ) { |
|
1378 | + if ($tax_form->is_valid()) { |
|
1379 | 1379 | //grab validated data from form |
1380 | 1380 | $valid_data = $tax_form->valid_data(); |
1381 | 1381 | //set data on config |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | ->prices_displayed_including_taxes |
1386 | 1386 | = $valid_data['tax_settings']['prices_displayed_including_taxes']; |
1387 | 1387 | } else { |
1388 | - if ( $tax_form->submission_error_message() !== '' ) { |
|
1388 | + if ($tax_form->submission_error_message() !== '') { |
|
1389 | 1389 | EE_Error::add_error( |
1390 | 1390 | $tax_form->submission_error_message(), |
1391 | 1391 | __FILE__, |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | } |
1396 | 1396 | } |
1397 | 1397 | } |
1398 | - } catch ( EE_Error $e ) { |
|
1399 | - EE_Error::add_error( $e->get_error(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1398 | + } catch (EE_Error $e) { |
|
1399 | + EE_Error::add_error($e->get_error(), __FILE__, __FUNCTION__, __LINE__); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | $what = 'Tax Settings'; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | __FUNCTION__, |
1408 | 1408 | __LINE__ |
1409 | 1409 | ); |
1410 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'tax_settings' ) ); |
|
1410 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'tax_settings')); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * This class is used for generating EE_Message objects with given info. |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return EE_Messages_Queue The new queue for holding generated EE_Message objects. |
118 | 118 | */ |
119 | - public function generate( $save = true ) { |
|
119 | + public function generate($save = true) { |
|
120 | 120 | //iterate through the messages in the queue, generate, and add to new queue. |
121 | 121 | $this->_generation_queue->get_message_repository()->rewind(); |
122 | - while ( $this->_generation_queue->get_message_repository()->valid() ) { |
|
122 | + while ($this->_generation_queue->get_message_repository()->valid()) { |
|
123 | 123 | //reset "current" properties |
124 | 124 | $this->_reset_current_properties(); |
125 | 125 | |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | $this->_generation_queue->get_message_repository()->next(); |
134 | 134 | $next_msg = $this->_generation_queue->get_message_repository()->current(); |
135 | 135 | //restore pointer to current item |
136 | - $this->_generation_queue->get_message_repository()->set_current( $msg ); |
|
136 | + $this->_generation_queue->get_message_repository()->set_current($msg); |
|
137 | 137 | |
138 | 138 | //skip and delete if the current $msg is NOT incomplete (queued for generation) |
139 | - if ( $msg->STS_ID() !== EEM_Message::status_incomplete ) { |
|
139 | + if ($msg->STS_ID() !== EEM_Message::status_incomplete) { |
|
140 | 140 | //we keep this item in the db just remove from the repo. |
141 | - $this->_generation_queue->get_message_repository()->remove( $msg ); |
|
141 | + $this->_generation_queue->get_message_repository()->remove($msg); |
|
142 | 142 | //next item |
143 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
143 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
147 | - if ( $this->_verify() ) { |
|
147 | + if ($this->_verify()) { |
|
148 | 148 | //let's get generating! |
149 | 149 | $this->_generate(); |
150 | 150 | } |
@@ -154,32 +154,32 @@ discard block |
||
154 | 154 | $msg->STS_ID() === EEM_Message::status_debug_only |
155 | 155 | && ! EEM_Message::debug() |
156 | 156 | ) { |
157 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
157 | + do_action('AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
158 | 158 | $this->_generation_queue->get_message_repository()->delete(); |
159 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
159 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | |
163 | 163 | //if there are error messages then let's set the status and the error message. |
164 | - if ( $this->_error_msg ) { |
|
164 | + if ($this->_error_msg) { |
|
165 | 165 | //if the status is already debug only, then let's leave it at that. |
166 | - if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) { |
|
167 | - $msg->set_STS_ID( EEM_Message::status_failed ); |
|
166 | + if ($msg->STS_ID() !== EEM_Message::status_debug_only) { |
|
167 | + $msg->set_STS_ID(EEM_Message::status_failed); |
|
168 | 168 | } |
169 | - do_action( 'AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
169 | + do_action('AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
170 | 170 | $msg->set_error_message( |
171 | - __( 'Message failed to generate for the following reasons: ' ) |
|
171 | + __('Message failed to generate for the following reasons: ') |
|
172 | 172 | . "\n" |
173 | - . implode( "\n", $this->_error_msg ) |
|
173 | + . implode("\n", $this->_error_msg) |
|
174 | 174 | ); |
175 | - $msg->set_modified( time() ); |
|
175 | + $msg->set_modified(time()); |
|
176 | 176 | } else { |
177 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
177 | + do_action('AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
178 | 178 | //remove from db |
179 | 179 | $this->_generation_queue->get_message_repository()->delete(); |
180 | 180 | } |
181 | 181 | //next item |
182 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
182 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | //generation queue is ALWAYS saved to record any errors in the generation process. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * so a EE_Extra_Meta entry could be created and attached to the EE_Message. In those cases the save flag is |
193 | 193 | * irrelevant. |
194 | 194 | */ |
195 | - if ( $save ) { |
|
195 | + if ($save) { |
|
196 | 196 | $this->_ready_queue->save(); |
197 | 197 | } |
198 | 198 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | protected function _reset_current_properties() { |
211 | 211 | $this->_verified = false; |
212 | 212 | //make sure any _data value in the current message type is reset |
213 | - if ( $this->_current_message_type instanceof EE_message_type ) { |
|
213 | + if ($this->_current_message_type instanceof EE_message_type) { |
|
214 | 214 | $this->_current_message_type->reset_data(); |
215 | 215 | } |
216 | 216 | $this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | protected function _generate() { |
231 | 231 | //double check verification has run and that everything is ready to work with (saves us having to validate everything again). |
232 | - if ( ! $this->_verified ) { |
|
232 | + if ( ! $this->_verified) { |
|
233 | 233 | return false; //get out because we don't have a valid setup to work with. |
234 | 234 | } |
235 | 235 | |
@@ -239,35 +239,35 @@ discard block |
||
239 | 239 | $this->_current_data_handler, |
240 | 240 | $this->_generation_queue->get_message_repository()->current()->context() |
241 | 241 | ); |
242 | - } catch ( EE_Error $e ) { |
|
242 | + } catch (EE_Error $e) { |
|
243 | 243 | $this->_error_msg[] = $e->getMessage(); |
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
247 | 247 | |
248 | 248 | //if no addressees then get out because there is nothing to generation (possible bad data). |
249 | - if ( ! $this->_valid_addressees( $addressees ) ) { |
|
250 | - do_action( 'AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
251 | - $this->_generation_queue->get_message_repository()->current()->set_STS_ID( EEM_Message::status_debug_only ); |
|
252 | - $this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
253 | - Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' ); |
|
249 | + if ( ! $this->_valid_addressees($addressees)) { |
|
250 | + do_action('AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
251 | + $this->_generation_queue->get_message_repository()->current()->set_STS_ID(EEM_Message::status_debug_only); |
|
252 | + $this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
253 | + Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso'); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | |
257 | 257 | $message_template_group = $this->_get_message_template_group(); |
258 | 258 | |
259 | 259 | //in the unlikely event there is no EE_Message_Template_Group available, get out! |
260 | - if ( ! $message_template_group instanceof EE_Message_Template_Group ) { |
|
261 | - $this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso' ); |
|
260 | + if ( ! $message_template_group instanceof EE_Message_Template_Group) { |
|
261 | + $this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso'); |
|
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | 265 | //get formatted templates for using to parse and setup EE_Message objects. |
266 | - $templates = $this->_get_templates( $message_template_group ); |
|
266 | + $templates = $this->_get_templates($message_template_group); |
|
267 | 267 | |
268 | 268 | |
269 | 269 | //setup new EE_Message objects (and add to _ready_queue) |
270 | - return $this->_assemble_messages( $addressees, $templates, $message_template_group ); |
|
270 | + return $this->_assemble_messages($addressees, $templates, $message_template_group); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | //so let's use that. |
286 | 286 | $GRP_ID = $this->_generation_queue->get_message_repository()->current()->GRP_ID(); |
287 | 287 | |
288 | - if ( $GRP_ID ) { |
|
288 | + if ($GRP_ID) { |
|
289 | 289 | //attempt to retrieve from repo first |
290 | - $GRP = $this->_template_collection->get_by_ID( $GRP_ID ); |
|
291 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
292 | - return $GRP; //got it! |
|
290 | + $GRP = $this->_template_collection->get_by_ID($GRP_ID); |
|
291 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
292 | + return $GRP; //got it! |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | //nope don't have it yet. Get from DB then add to repo if its not here, then that means the current GRP_ID |
296 | 296 | //is not valid, so we'll continue on in the code assuming there's NO GRP_ID. |
297 | - $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
298 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
299 | - $this->_template_collection->add( $GRP ); |
|
297 | + $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
298 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
299 | + $this->_template_collection->add($GRP); |
|
300 | 300 | return $GRP; |
301 | 301 | } |
302 | 302 | } |
@@ -315,41 +315,41 @@ discard block |
||
315 | 315 | //in vanilla EE we're assuming there's only one event. |
316 | 316 | //However, if there are multiple events then we'll just use the default templates instead of different |
317 | 317 | // templates per event (which could create problems). |
318 | - if ( count( $this->_current_data_handler->events ) === 1 ) { |
|
319 | - foreach ( $this->_current_data_handler->events as $event ) { |
|
318 | + if (count($this->_current_data_handler->events) === 1) { |
|
319 | + foreach ($this->_current_data_handler->events as $event) { |
|
320 | 320 | $EVT_ID = $event['ID']; |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | //before going any further, let's see if its in the queue |
325 | - $GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) ); |
|
325 | + $GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID)); |
|
326 | 326 | |
327 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
327 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
328 | 328 | return $GRP; |
329 | 329 | } |
330 | 330 | |
331 | 331 | //nope still no GRP? |
332 | 332 | //first we get the global template in case it has an override set. |
333 | - $global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa ); |
|
334 | - $global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) ); |
|
333 | + $global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa); |
|
334 | + $global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa)); |
|
335 | 335 | |
336 | 336 | //if this is an override, then we just return it. |
337 | - if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) { |
|
338 | - $this->_template_collection->add( $global_GRP, $EVT_ID ); |
|
337 | + if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) { |
|
338 | + $this->_template_collection->add($global_GRP, $EVT_ID); |
|
339 | 339 | return $global_GRP; |
340 | 340 | } |
341 | 341 | |
342 | 342 | //STILL here? Okay that means we want to see if there is event specific group and if there is we return it, |
343 | 343 | //otherwise we return the global group we retrieved. |
344 | - if ( $EVT_ID ) { |
|
344 | + if ($EVT_ID) { |
|
345 | 345 | $template_qa['Event.EVT_ID'] = $EVT_ID; |
346 | 346 | } |
347 | 347 | |
348 | - $GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
348 | + $GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
349 | 349 | $GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP; |
350 | 350 | |
351 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
352 | - $this->_template_collection->add( $GRP, $EVT_ID ); |
|
351 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
352 | + $this->_template_collection->add($GRP, $EVT_ID); |
|
353 | 353 | return $GRP; |
354 | 354 | } |
355 | 355 | |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | * ) |
374 | 374 | * ) |
375 | 375 | */ |
376 | - protected function _get_templates( EE_Message_Template_Group $message_template_group ) { |
|
376 | + protected function _get_templates(EE_Message_Template_Group $message_template_group) { |
|
377 | 377 | $templates = array(); |
378 | 378 | $context_templates = $message_template_group->context_templates(); |
379 | - foreach ( $context_templates as $context => $template_fields ) { |
|
380 | - foreach ( $template_fields as $template_field => $template_obj ) { |
|
381 | - if ( ! $template_obj instanceof EE_Message_Template ) { |
|
379 | + foreach ($context_templates as $context => $template_fields) { |
|
380 | + foreach ($template_fields as $template_field => $template_obj) { |
|
381 | + if ( ! $template_obj instanceof EE_Message_Template) { |
|
382 | 382 | continue; |
383 | 383 | } |
384 | - $templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' ); |
|
384 | + $templates[$template_field][$context] = $template_obj->get('MTP_content'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | return $templates; |
@@ -403,21 +403,21 @@ discard block |
||
403 | 403 | * get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added |
404 | 404 | * to the queue as EEM_Message::status_failed. Very rarely should "false" be returned from this method. |
405 | 405 | */ |
406 | - protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) { |
|
406 | + protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) { |
|
407 | 407 | |
408 | 408 | //if templates are empty then get out because we can't generate anything. |
409 | - if ( ! $templates ) { |
|
410 | - $this->_error_msg[] = __( 'Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso' ); |
|
409 | + if ( ! $templates) { |
|
410 | + $this->_error_msg[] = __('Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso'); |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
414 | 414 | //We use this as the counter for generated messages because don't forget we may be executing this inside of a |
415 | 415 | //generation_queue. So _ready_queue may have generated EE_Message objects already. |
416 | 416 | $generated_count = 0; |
417 | - foreach ( $addressees as $context => $recipients ) { |
|
418 | - foreach ( $recipients as $recipient ) { |
|
419 | - $message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group ); |
|
420 | - if ( $message instanceof EE_Message ) { |
|
417 | + foreach ($addressees as $context => $recipients) { |
|
418 | + foreach ($recipients as $recipient) { |
|
419 | + $message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group); |
|
420 | + if ($message instanceof EE_Message) { |
|
421 | 421 | $this->_ready_queue->add( |
422 | 422 | $message, |
423 | 423 | array(), |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | //if the current MSG being generated is for a test send then we'll only use ONE message in the generation. |
431 | - if ( $this->_generation_queue->get_message_repository()->is_test_send() ) { |
|
431 | + if ($this->_generation_queue->get_message_repository()->is_test_send()) { |
|
432 | 432 | break 2; |
433 | 433 | } |
434 | 434 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | ) { |
458 | 458 | //stuff we already know |
459 | 459 | $transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0; |
460 | - $transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
460 | + $transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
461 | 461 | ? $this->_current_data_handler->txn->ID() |
462 | 462 | : $transaction_id; |
463 | 463 | $message_fields = array( |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | //recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the |
472 | 472 | //info from the att_obj found in the EE_Messages_Addressee object. |
473 | - if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) { |
|
473 | + if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) { |
|
474 | 474 | $message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee |
475 | 475 | ? $recipient->att_obj->ID() |
476 | 476 | : 0; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $message_fields['MSG_recipient_ID'] = $recipient->recipient_id; |
480 | 480 | $message_fields['MSG_recipient_type'] = $recipient->recipient_type; |
481 | 481 | } |
482 | - $message = EE_Message_Factory::create( $message_fields ); |
|
482 | + $message = EE_Message_Factory::create($message_fields); |
|
483 | 483 | |
484 | 484 | //grab valid shortcodes for shortcode parser |
485 | 485 | $mt_shortcodes = $this->_current_message_type->get_valid_shortcodes(); |
@@ -487,43 +487,43 @@ discard block |
||
487 | 487 | |
488 | 488 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this |
489 | 489 | //context is turned off) EXCEPT if we're previewing |
490 | - if ( empty( $templates['to'][ $context ] ) |
|
490 | + if (empty($templates['to'][$context]) |
|
491 | 491 | && ! $this->_generation_queue->get_message_repository()->is_preview() |
492 | - && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
492 | + && ! $this->_current_messenger->allow_empty_to_field()) { |
|
493 | 493 | //we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field. |
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | $error_msg = array(); |
497 | - foreach ( $templates as $field => $field_context ) { |
|
497 | + foreach ($templates as $field => $field_context) { |
|
498 | 498 | $error_msg = array(); |
499 | 499 | //let's setup the valid shortcodes for the incoming context. |
500 | - $valid_shortcodes = $mt_shortcodes[ $context ]; |
|
500 | + $valid_shortcodes = $mt_shortcodes[$context]; |
|
501 | 501 | //merge in valid shortcodes for the field. |
502 | - $shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes; |
|
503 | - if ( isset( $templates[ $field ][ $context ] ) ) { |
|
502 | + $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
|
503 | + if (isset($templates[$field][$context])) { |
|
504 | 504 | //prefix field. |
505 | - $column_name = 'MSG_' . $field; |
|
505 | + $column_name = 'MSG_'.$field; |
|
506 | 506 | try { |
507 | 507 | $content = $this->_shortcode_parser->parse_message_template( |
508 | - $templates[ $field ][ $context ], |
|
508 | + $templates[$field][$context], |
|
509 | 509 | $recipient, |
510 | 510 | $shortcodes, |
511 | 511 | $this->_current_message_type, |
512 | 512 | $this->_current_messenger, |
513 | 513 | $message ); |
514 | - $message->set_field_or_extra_meta( $column_name, $content ); |
|
515 | - } catch ( EE_Error $e ) { |
|
516 | - $error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() ); |
|
517 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
514 | + $message->set_field_or_extra_meta($column_name, $content); |
|
515 | + } catch (EE_Error $e) { |
|
516 | + $error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage()); |
|
517 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
522 | - if ( $message->STS_ID() === EEM_Message::status_failed ) { |
|
523 | - $error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg ); |
|
524 | - $message->set_error_message( $error_msg ); |
|
522 | + if ($message->STS_ID() === EEM_Message::status_failed) { |
|
523 | + $error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg); |
|
524 | + $message->set_error_message($error_msg); |
|
525 | 525 | } else { |
526 | - $message->set_STS_ID( EEM_Message::status_idle ); |
|
526 | + $message->set_STS_ID(EEM_Message::status_idle); |
|
527 | 527 | } |
528 | 528 | return $message; |
529 | 529 | } |
@@ -557,14 +557,14 @@ discard block |
||
557 | 557 | * @param array $addressees Keys correspond to contexts for the message type and values are EE_Messages_Addressee[] |
558 | 558 | * @return bool |
559 | 559 | */ |
560 | - protected function _valid_addressees( $addressees ) { |
|
561 | - if ( ! $addressees || ! is_array( $addressees ) ) { |
|
560 | + protected function _valid_addressees($addressees) { |
|
561 | + if ( ! $addressees || ! is_array($addressees)) { |
|
562 | 562 | return false; |
563 | 563 | } |
564 | 564 | |
565 | - foreach ( $addressees as $addressee_array ) { |
|
566 | - foreach ( $addressee_array as $addressee ) { |
|
567 | - if ( ! $addressee instanceof EE_Messages_Addressee ) { |
|
565 | + foreach ($addressees as $addressee_array) { |
|
566 | + foreach ($addressee_array as $addressee) { |
|
567 | + if ( ! $addressee instanceof EE_Messages_Addressee) { |
|
568 | 568 | return false; |
569 | 569 | } |
570 | 570 | } |
@@ -585,19 +585,19 @@ discard block |
||
585 | 585 | protected function _validate_messenger_and_message_type() { |
586 | 586 | |
587 | 587 | //first are there any existing error messages? If so then return. |
588 | - if ( $this->_error_msg ) { |
|
588 | + if ($this->_error_msg) { |
|
589 | 589 | return false; |
590 | 590 | } |
591 | 591 | /** @type EE_Message $message */ |
592 | 592 | $message = $this->_generation_queue->get_message_repository()->current(); |
593 | 593 | try { |
594 | - $this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null; |
|
595 | - } catch ( Exception $e ) { |
|
594 | + $this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null; |
|
595 | + } catch (Exception $e) { |
|
596 | 596 | $this->_error_msg[] = $e->getMessage(); |
597 | 597 | } |
598 | 598 | try { |
599 | - $this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null; |
|
600 | - } catch ( Exception $e ) { |
|
599 | + $this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null; |
|
600 | + } catch (Exception $e) { |
|
601 | 601 | $this->_error_msg[] = $e->getMessage(); |
602 | 602 | } |
603 | 603 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | ! $this->_generation_queue->get_message_repository()->is_preview() |
610 | 610 | && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
611 | 611 | ) { |
612 | - $this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' ); |
|
612 | + $this->_error_msg[] = __('There is no generation data for this message. Unable to generate.'); |
|
613 | 613 | } |
614 | 614 | |
615 | - return empty( $this->_error_msg ); |
|
615 | + return empty($this->_error_msg); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | //First, are there any existing error messages? If so, return because if there were errors elsewhere this can't |
631 | 631 | //be used anyways. |
632 | - if ( $this->_error_msg ) { |
|
632 | + if ($this->_error_msg) { |
|
633 | 633 | return false; |
634 | 634 | } |
635 | 635 | |
@@ -638,29 +638,29 @@ discard block |
||
638 | 638 | /** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */ |
639 | 639 | $data_handler_class_name = $this->_generation_queue->get_message_repository()->get_data_handler() |
640 | 640 | ? $this->_generation_queue->get_message_repository()->get_data_handler() |
641 | - : 'EE_Messages_' . $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data'; |
|
641 | + : 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data'; |
|
642 | 642 | |
643 | 643 | //If this EE_Message is for a preview, then let's switch out to the preview data handler. |
644 | - if ( $this->_generation_queue->get_message_repository()->is_preview() ) { |
|
645 | - $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
644 | + if ($this->_generation_queue->get_message_repository()->is_preview()) { |
|
645 | + $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | //First get the class name for the data handler (and also verifies it exists. |
649 | - if ( ! class_exists( $data_handler_class_name ) ) { |
|
649 | + if ( ! class_exists($data_handler_class_name)) { |
|
650 | 650 | $this->_error_msg[] = sprintf( |
651 | - __( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso' ), |
|
651 | + __('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso'), |
|
652 | 652 | $data_handler_class_name |
653 | 653 | ); |
654 | 654 | return false; |
655 | 655 | } |
656 | 656 | |
657 | 657 | //convert generation_data for data_handler_instantiation. |
658 | - $generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data ); |
|
658 | + $generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data); |
|
659 | 659 | |
660 | 660 | //note, this may set error messages as well. |
661 | - $this->_set_data_handler( $generation_data, $data_handler_class_name ); |
|
661 | + $this->_set_data_handler($generation_data, $data_handler_class_name); |
|
662 | 662 | |
663 | - return empty( $this->_error_msg ); |
|
663 | + return empty($this->_error_msg); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | |
@@ -677,16 +677,16 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @return void. |
679 | 679 | */ |
680 | - protected function _set_data_handler( $generating_data, $data_handler_class_name ) { |
|
680 | + protected function _set_data_handler($generating_data, $data_handler_class_name) { |
|
681 | 681 | //valid classname for the data handler. Now let's setup the key for the data handler repository to see if there |
682 | 682 | //is already a ready data handler in the repository. |
683 | - $this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) ); |
|
684 | - if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data ) { |
|
683 | + $this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data)); |
|
684 | + if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data) { |
|
685 | 685 | //no saved data_handler in the repo so let's set one up and add it to the repo. |
686 | 686 | try { |
687 | - $this->_current_data_handler = new $data_handler_class_name( $generating_data ); |
|
688 | - $this->_data_handler_collection->add( $this->_current_data_handler, $generating_data ); |
|
689 | - } catch( EE_Error $e ) { |
|
687 | + $this->_current_data_handler = new $data_handler_class_name($generating_data); |
|
688 | + $this->_data_handler_collection->add($this->_current_data_handler, $generating_data); |
|
689 | + } catch (EE_Error $e) { |
|
690 | 690 | $this->_error_msg[] = $e->get_error(); |
691 | 691 | } |
692 | 692 | } |
@@ -706,13 +706,13 @@ discard block |
||
706 | 706 | * @param bool $preview Indicate whether this is being used for a preview or not. |
707 | 707 | * @return mixed Prepped data for persisting to the queue. false is returned if unable to prep data. |
708 | 708 | */ |
709 | - protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) { |
|
709 | + protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) { |
|
710 | 710 | /** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */ |
711 | - $data_handler = $message_to_generate->get_data_handler_class_name( $preview ); |
|
712 | - if ( ! $message_to_generate->valid() ) { |
|
711 | + $data_handler = $message_to_generate->get_data_handler_class_name($preview); |
|
712 | + if ( ! $message_to_generate->valid()) { |
|
713 | 713 | return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid. |
714 | 714 | } |
715 | - return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() ); |
|
715 | + return $data_handler::convert_data_for_persistent_storage($message_to_generate->data()); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | |
@@ -725,26 +725,26 @@ discard block |
||
725 | 725 | * @param EE_Message_To_Generate $message_to_generate |
726 | 726 | * @param bool $test_send Whether this is just a test send or not. Typically used for previews. |
727 | 727 | */ |
728 | - public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) { |
|
728 | + public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) { |
|
729 | 729 | //prep data |
730 | - $data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() ); |
|
730 | + $data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview()); |
|
731 | 731 | |
732 | 732 | $message = $message_to_generate->get_EE_Message(); |
733 | 733 | |
734 | 734 | //is there a GRP_ID in the request? |
735 | - if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) { |
|
736 | - $message->set_GRP_ID( $GRP_ID ); |
|
735 | + if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) { |
|
736 | + $message->set_GRP_ID($GRP_ID); |
|
737 | 737 | } |
738 | 738 | |
739 | - if ( $data === false ) { |
|
740 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
741 | - $message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) ); |
|
739 | + if ($data === false) { |
|
740 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
741 | + $message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso')); |
|
742 | 742 | } else { |
743 | 743 | //make sure that the data handler is cached on the message as well |
744 | 744 | $data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name(); |
745 | 745 | } |
746 | 746 | |
747 | - $this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send ); |
|
747 | + $this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * finds and sets the EE_Event object for use throughout class |
224 | 224 | * |
225 | 225 | * @access public |
226 | - * @param mixed $event |
|
226 | + * @param EE_Event|null $event |
|
227 | 227 | * @return bool |
228 | 228 | */ |
229 | 229 | protected static function set_event( $event = null ) { |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * process_ticket_selections |
585 | 585 | * |
586 | 586 | * @access public |
587 | - * @return array|boolean |
|
587 | + * @return boolean|null |
|
588 | 588 | */ |
589 | 589 | public function process_ticket_selections() { |
590 | 590 | do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @access private |
747 | 747 | * @param int $id |
748 | - * @return array|FALSE |
|
748 | + * @return string |
|
749 | 749 | */ |
750 | 750 | private static function _validate_post_data( $id = 0 ) { |
751 | 751 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | * @access private |
865 | 865 | * @param EE_Ticket $ticket |
866 | 866 | * @param int $qty |
867 | - * @return TRUE on success, FALSE on fail |
|
867 | + * @return boolean on success, FALSE on fail |
|
868 | 868 | * @throws \EE_Error |
869 | 869 | */ |
870 | 870 | private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
@@ -17,19 +17,19 @@ discard block |
||
17 | 17 | protected static $_event; |
18 | 18 | |
19 | 19 | /** |
20 | - * array of datetimes and the spaces available for them |
|
21 | - * |
|
22 | - * @access private |
|
23 | - * @var array |
|
24 | - */ |
|
20 | + * array of datetimes and the spaces available for them |
|
21 | + * |
|
22 | + * @access private |
|
23 | + * @var array |
|
24 | + */ |
|
25 | 25 | private static $_available_spaces = array(); |
26 | 26 | |
27 | 27 | /** |
28 | - * max attendees that can register for event at one time |
|
29 | - * |
|
30 | - * @access private |
|
31 | - * @var int |
|
32 | - */ |
|
28 | + * max attendees that can register for event at one time |
|
29 | + * |
|
30 | + * @access private |
|
31 | + * @var int |
|
32 | + */ |
|
33 | 33 | private static $_max_atndz = EE_INF; |
34 | 34 | |
35 | 35 | |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | return $permalink_string; |
198 | 198 | } |
199 | 199 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
200 | - . __( 'Embed', 'event_espresso' ) |
|
201 | - . '</a> '; |
|
200 | + . __( 'Embed', 'event_espresso' ) |
|
201 | + . '</a> '; |
|
202 | 202 | $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
203 | 203 | $iframe_string = esc_html( |
204 | 204 | '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @throws \EE_Error |
420 | 420 | */ |
421 | 421 | public static function display_ticket_selector_submit() { |
422 | - $html = ''; |
|
422 | + $html = ''; |
|
423 | 423 | if ( ! is_admin() ) { |
424 | 424 | // standard TS displayed with submit button, ie: "Register Now" |
425 | 425 | if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { |
@@ -478,14 +478,14 @@ discard block |
||
478 | 478 | $html .= EED_Ticket_Selector::display_view_details_btn(); |
479 | 479 | } else { |
480 | 480 | // no submit or view details button, and no additional content |
481 | - $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
|
481 | + $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
|
482 | 482 | } |
483 | - if ( ! is_archive()) { |
|
484 | - $html .= \EEH_Template::powered_by_event_espresso('', '', array( 'utm_content' => 'ticket_selector' )); |
|
485 | - } |
|
486 | - } |
|
487 | - return $html; |
|
488 | - } |
|
483 | + if ( ! is_archive()) { |
|
484 | + $html .= \EEH_Template::powered_by_event_espresso('', '', array( 'utm_content' => 'ticket_selector' )); |
|
485 | + } |
|
486 | + } |
|
487 | + return $html; |
|
488 | + } |
|
489 | 489 | |
490 | 490 | |
491 | 491 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @return array|boolean |
583 | 583 | */ |
584 | 584 | public function process_ticket_selections() { |
585 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
585 | + do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
586 | 586 | // do we have an event id? |
587 | 587 | if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
588 | 588 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
@@ -1005,11 +1005,11 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | |
1007 | 1007 | /** |
1008 | - * load js |
|
1009 | - * |
|
1010 | - * @access public |
|
1011 | - * @return void |
|
1012 | - */ |
|
1008 | + * load js |
|
1009 | + * |
|
1010 | + * @access public |
|
1011 | + * @return void |
|
1012 | + */ |
|
1013 | 1013 | public static function load_tckt_slctr_assets() { |
1014 | 1014 | // add some style |
1015 | 1015 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')){ exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Ticket Selector class |
4 | 4 | * |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | * @return EED_Ticket_Selector |
48 | 48 | */ |
49 | 49 | public static function instance() { |
50 | - return parent::get_instance( __CLASS__ ); |
|
50 | + return parent::get_instance(__CLASS__); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - protected function set_config(){ |
|
56 | - $this->set_config_section( 'template_settings' ); |
|
57 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
58 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
55 | + protected function set_config() { |
|
56 | + $this->set_config_section('template_settings'); |
|
57 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
58 | + $this->set_config_name('EED_Ticket_Selector'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function set_hooks() { |
72 | 72 | // routing |
73 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
74 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
75 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
76 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
77 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
73 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
74 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
75 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
76 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
77 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | * @return void |
87 | 87 | */ |
88 | 88 | public static function set_hooks_admin() { |
89 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
89 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
90 | 90 | //add button for iframe code to event editor. |
91 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
92 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
91 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
92 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | * @return void |
102 | 102 | */ |
103 | 103 | public static function set_definitions() { |
104 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
105 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
104 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
105 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
106 | 106 | |
107 | 107 | //if config is not set, initialize |
108 | 108 | //If config is not set, set it. |
109 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
109 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
110 | 110 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
111 | 111 | } |
112 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
112 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param WP $WP |
121 | 121 | * @return void |
122 | 122 | */ |
123 | - public function run( $WP ) {} |
|
123 | + public function run($WP) {} |
|
124 | 124 | |
125 | 125 | |
126 | 126 | |
@@ -134,23 +134,23 @@ discard block |
||
134 | 134 | public function ticket_selector_iframe() { |
135 | 135 | self::$_in_iframe = true; |
136 | 136 | /** @type EEM_Event $EEM_Event */ |
137 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
137 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
138 | 138 | $event = $EEM_Event->get_one_by_ID( |
139 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
139 | + EE_Registry::instance()->REQ->get('event', 0) |
|
140 | 140 | ); |
141 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
142 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
141 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
142 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
143 | 143 | $template_args['css'] = apply_filters( |
144 | 144 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
145 | 145 | array( |
146 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
147 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
148 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
149 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
146 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
147 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
148 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
149 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
150 | 150 | ) |
151 | 151 | ); |
152 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
153 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = esc_html__( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
152 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
153 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = esc_html__('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
154 | 154 | $template_args['eei18n'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
156 | 156 | EE_Registry::localize_i18n_js_strings() |
@@ -158,18 +158,18 @@ discard block |
||
158 | 158 | $template_args['js'] = apply_filters( |
159 | 159 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
160 | 160 | array( |
161 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
162 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
163 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
161 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
162 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
163 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
164 | 164 | ) |
165 | 165 | ); |
166 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
167 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
166 | + $template_args['notices'] = EEH_Template::display_template( |
|
167 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
168 | 168 | array(), |
169 | 169 | true |
170 | 170 | ); |
171 | 171 | EEH_Template::display_template( |
172 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
172 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
173 | 173 | $template_args |
174 | 174 | ); |
175 | 175 | exit; |
@@ -188,25 +188,25 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return string The new html string for the permalink area. |
190 | 190 | */ |
191 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
191 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
192 | 192 | //make sure this is ONLY when editing and the event id has been set. |
193 | - if ( ! empty( $id ) ) { |
|
194 | - $post = get_post( $id ); |
|
193 | + if ( ! empty($id)) { |
|
194 | + $post = get_post($id); |
|
195 | 195 | //if NOT event then let's get out. |
196 | - if ( $post->post_type !== 'espresso_events' ) { |
|
196 | + if ($post->post_type !== 'espresso_events') { |
|
197 | 197 | return $permalink_string; |
198 | 198 | } |
199 | 199 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
200 | - . __( 'Embed', 'event_espresso' ) |
|
200 | + . __('Embed', 'event_espresso') |
|
201 | 201 | . '</a> '; |
202 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
202 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
203 | 203 | $iframe_string = esc_html( |
204 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
204 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
205 | 205 | ); |
206 | 206 | $permalink_string .= ' |
207 | 207 | <div id="js-ts-iframe" style="display:none"> |
208 | 208 | <div style="width:100%; height: 500px;"> |
209 | - ' . $iframe_string . ' |
|
209 | + ' . $iframe_string.' |
|
210 | 210 | </div> |
211 | 211 | </div>'; |
212 | 212 | } |
@@ -225,22 +225,22 @@ discard block |
||
225 | 225 | * @param mixed $event |
226 | 226 | * @return bool |
227 | 227 | */ |
228 | - protected static function set_event( $event = null ) { |
|
229 | - if( $event === null ) { |
|
228 | + protected static function set_event($event = null) { |
|
229 | + if ($event === null) { |
|
230 | 230 | global $post; |
231 | 231 | $event = $post; |
232 | 232 | } |
233 | - if ( $event instanceof EE_Event ) { |
|
233 | + if ($event instanceof EE_Event) { |
|
234 | 234 | self::$_event = $event; |
235 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
235 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
236 | 236 | self::$_event = $event->EE_Event; |
237 | - } else if ( $event instanceof WP_Post && $event->post_type === 'espresso_events' ) { |
|
238 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
237 | + } else if ($event instanceof WP_Post && $event->post_type === 'espresso_events') { |
|
238 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
239 | 239 | self::$_event = $event->EE_Event; |
240 | 240 | } else { |
241 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
242 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
243 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
241 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
242 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
243 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | return true; |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | * @return string |
258 | 258 | * @throws \EE_Error |
259 | 259 | */ |
260 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
260 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
261 | 261 | // reset filter for displaying submit button |
262 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
262 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
263 | 263 | // poke and prod incoming event till it tells us what it is |
264 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
264 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
265 | 265 | return false; |
266 | 266 | } |
267 | 267 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | && ( |
273 | 273 | ! self::$_event->display_ticket_selector() |
274 | 274 | || $view_details |
275 | - || post_password_required( $event_post ) |
|
275 | + || post_password_required($event_post) |
|
276 | 276 | || ( |
277 | 277 | $_event_active_status !== EE_Datetime::active |
278 | 278 | && $_event_active_status !== EE_Datetime::upcoming |
@@ -290,34 +290,34 @@ discard block |
||
290 | 290 | $template_args = array(); |
291 | 291 | $template_args['event_status'] = $_event_active_status; |
292 | 292 | |
293 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
294 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
293 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
294 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
295 | 295 | |
296 | 296 | $template_args['EVT_ID'] = self::$_event->ID(); |
297 | 297 | $template_args['event'] = self::$_event; |
298 | 298 | |
299 | 299 | // is the event expired ? |
300 | 300 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
301 | - if ( $template_args['event_is_expired'] ) { |
|
302 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
301 | + if ($template_args['event_is_expired']) { |
|
302 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | $ticket_query_args = array( |
306 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
307 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
306 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
307 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
308 | 308 | ); |
309 | 309 | |
310 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
310 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
311 | 311 | //use the correct applicable time query depending on what version of core is being run. |
312 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
313 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
312 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
313 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | // get all tickets for this event ordered by the datetime |
317 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
317 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
318 | 318 | |
319 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
320 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
319 | + if (count($template_args['tickets']) < 1) { |
|
320 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
@@ -326,41 +326,41 @@ discard block |
||
326 | 326 | self::$_event->additional_limit() |
327 | 327 | ); |
328 | 328 | $template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz; |
329 | - if ( $template_args['max_atndz'] < 1 ) { |
|
330 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
331 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
332 | - $sales_closed_msg .= sprintf( |
|
333 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
329 | + if ($template_args['max_atndz'] < 1) { |
|
330 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
331 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
332 | + $sales_closed_msg .= sprintf( |
|
333 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
334 | 334 | '<div class="ee-attention" style="text-align: left;"><b>', |
335 | 335 | '</b><br />', |
336 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
336 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
337 | 337 | '</a></span></div>' |
338 | 338 | ); |
339 | 339 | } |
340 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
340 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
341 | 341 | } |
342 | 342 | |
343 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
344 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
343 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
344 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
345 | 345 | |
346 | 346 | // redirecting to another site for registration ?? |
347 | 347 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
348 | 348 | // if not redirecting to another site for registration |
349 | - if ( ! $external_url ) { |
|
349 | + if ( ! $external_url) { |
|
350 | 350 | // then display the ticket selector |
351 | - $ticket_selector = EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
351 | + $ticket_selector = EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
352 | 352 | } else { |
353 | 353 | // if not we still need to trigger the display of the submit button |
354 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
354 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
355 | 355 | //display notice to admin that registration is external |
356 | - $ticket_selector = ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
356 | + $ticket_selector = ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
357 | 357 | } |
358 | 358 | // now set up the form (but not for the admin) |
359 | 359 | $ticket_selector = ! is_admin() |
360 | 360 | ? EED_Ticket_Selector::ticket_selector_form_open( |
361 | 361 | self::$_event->ID(), |
362 | 362 | $external_url |
363 | - ) . $ticket_selector |
|
363 | + ).$ticket_selector |
|
364 | 364 | : $ticket_selector; |
365 | 365 | // submit button and form close tag |
366 | 366 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -380,31 +380,31 @@ discard block |
||
380 | 380 | * @param string $external_url |
381 | 381 | * @return string |
382 | 382 | */ |
383 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
383 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
384 | 384 | // if redirecting, we don't need any anything else |
385 | - if ( $external_url ) { |
|
386 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
387 | - $query_args = (array) EEH_URL::get_query_string( $external_url ); |
|
388 | - foreach ( $query_args as $query_arg => $value ) { |
|
385 | + if ($external_url) { |
|
386 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
387 | + $query_args = (array) EEH_URL::get_query_string($external_url); |
|
388 | + foreach ($query_args as $query_arg => $value) { |
|
389 | 389 | $html .= ' |
390 | - <input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
390 | + <input type="hidden" name="' . $query_arg.'" value="'.$value.'">'; |
|
391 | 391 | } |
392 | 392 | return $html; |
393 | 393 | } |
394 | 394 | // if there is no submit button, then don't start building a form |
395 | 395 | // because the "View Details" button will build its own form |
396 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { |
|
396 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
397 | 397 | return ''; |
398 | 398 | } |
399 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
400 | - if ( ! $checkout_url ) { |
|
401 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
399 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
400 | + if ( ! $checkout_url) { |
|
401 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
402 | 402 | } |
403 | 403 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
404 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
405 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce_' . $ID, TRUE, FALSE ); |
|
404 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
405 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce_'.$ID, TRUE, FALSE); |
|
406 | 406 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
407 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
407 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
408 | 408 | return $html; |
409 | 409 | } |
410 | 410 | |
@@ -420,26 +420,26 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public static function display_ticket_selector_submit() { |
422 | 422 | $html = ''; |
423 | - if ( ! is_admin() ) { |
|
423 | + if ( ! is_admin()) { |
|
424 | 424 | // standard TS displayed with submit button, ie: "Register Now" |
425 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { |
|
425 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
426 | 426 | $btn_text = apply_filters( |
427 | 427 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
428 | - __('Register Now', 'event_espresso' ), |
|
428 | + __('Register Now', 'event_espresso'), |
|
429 | 429 | EED_Ticket_Selector::$_event |
430 | 430 | ); |
431 | 431 | $external_url = EED_Ticket_Selector::$_event->external_url(); |
432 | - $html .= '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"'; |
|
432 | + $html .= '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"'; |
|
433 | 433 | $html .= ' class="ticket-selector-submit-btn '; |
434 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
435 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
434 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
435 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
436 | 436 | $html .= apply_filters( |
437 | 437 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
438 | 438 | '', |
439 | 439 | EED_Ticket_Selector::$_event |
440 | 440 | ); |
441 | 441 | $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
442 | - $html .= '<br/>' . \EED_Ticket_Selector::ticket_selector_form_close(); |
|
442 | + $html .= '<br/>'.\EED_Ticket_Selector::ticket_selector_form_close(); |
|
443 | 443 | } else if ( |
444 | 444 | // a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1) |
445 | 445 | EED_Ticket_Selector::$_max_atndz === 1 |
@@ -465,14 +465,14 @@ discard block |
||
465 | 465 | $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
466 | 466 | } else if ( |
467 | 467 | EED_Ticket_Selector::$_max_atndz === 1 |
468 | - && apply_filters( 'FHEE__EE_Ticket_Selector__hide_ticket_selector', false ) |
|
468 | + && apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false) |
|
469 | 469 | && ! is_single() |
470 | 470 | ) { |
471 | 471 | // this is a "Dude Where's my Ticket Selector?" (DWMTS) type event, |
472 | 472 | // but no tickets are available, so display event's "View Details" button. |
473 | 473 | // it is being viewed via somewhere other than a single post |
474 | - $html .= EED_Ticket_Selector::display_view_details_btn( true ); |
|
475 | - } else if ( is_archive() ) { |
|
474 | + $html .= EED_Ticket_Selector::display_view_details_btn(true); |
|
475 | + } else if (is_archive()) { |
|
476 | 476 | // event list, no tickets available so display event's "View Details" button |
477 | 477 | $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
478 | 478 | $html .= EED_Ticket_Selector::display_view_details_btn(); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
482 | 482 | } |
483 | 483 | if ( ! is_archive()) { |
484 | - $html .= \EEH_Template::powered_by_event_espresso('', '', array( 'utm_content' => 'ticket_selector' )); |
|
484 | + $html .= \EEH_Template::powered_by_event_espresso('', '', array('utm_content' => 'ticket_selector')); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | return $html; |
@@ -543,22 +543,22 @@ discard block |
||
543 | 543 | * @return string |
544 | 544 | * @throws \EE_Error |
545 | 545 | */ |
546 | - public static function display_view_details_btn( $DWMTS = false) { |
|
547 | - if ( ! self::$_event->get_permalink() ) { |
|
546 | + public static function display_view_details_btn($DWMTS = false) { |
|
547 | + if ( ! self::$_event->get_permalink()) { |
|
548 | 548 | EE_Error::add_error( |
549 | - __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), |
|
549 | + __('The URL for the Event Details page could not be retrieved.', 'event_espresso'), |
|
550 | 550 | __FILE__, __FUNCTION__, __LINE__ |
551 | 551 | ); |
552 | 552 | } |
553 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
553 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
554 | 554 | $btn_text = apply_filters( |
555 | 555 | 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', |
556 | - __( 'View Details', 'event_espresso' ), |
|
556 | + __('View Details', 'event_espresso'), |
|
557 | 557 | self::$_event |
558 | 558 | ); |
559 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
560 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
561 | - if ( $DWMTS ) { |
|
559 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
560 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
561 | + if ($DWMTS) { |
|
562 | 562 | $view_details_btn .= \EED_Ticket_Selector::ticket_selector_form_close(); |
563 | 563 | $view_details_btn .= \EED_Ticket_Selector::no_tkt_slctr_end_dv(); |
564 | 564 | $view_details_btn .= '<br/>'; |
@@ -582,9 +582,9 @@ discard block |
||
582 | 582 | * @return array|boolean |
583 | 583 | */ |
584 | 584 | public function process_ticket_selections() { |
585 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
585 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
586 | 586 | // do we have an event id? |
587 | - if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
587 | + if ( ! EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
588 | 588 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
589 | 589 | EE_Error::add_error( |
590 | 590 | sprintf( |
@@ -600,17 +600,17 @@ discard block |
||
600 | 600 | ); |
601 | 601 | } |
602 | 602 | //if event id is valid |
603 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ) ); |
|
603 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
604 | 604 | // check nonce |
605 | 605 | if ( |
606 | 606 | ! is_admin() |
607 | 607 | && ( |
608 | - ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce_' . $id ) |
|
609 | - || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce_' . $id ), 'process_ticket_selections' ) |
|
608 | + ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce_'.$id) |
|
609 | + || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce_'.$id), 'process_ticket_selections') |
|
610 | 610 | ) |
611 | 611 | ) { |
612 | 612 | EE_Error::add_error( |
613 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
613 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
614 | 614 | __FILE__, __FUNCTION__, __LINE__ |
615 | 615 | ); |
616 | 616 | return FALSE; |
@@ -624,16 +624,16 @@ discard block |
||
624 | 624 | |
625 | 625 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
626 | 626 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
627 | - EE_Registry::instance()->load_core( 'Session' ); |
|
627 | + EE_Registry::instance()->load_core('Session'); |
|
628 | 628 | // unless otherwise requested, clear the session |
629 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
630 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
629 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
630 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
631 | 631 | } |
632 | 632 | //d( EE_Registry::instance()->SSN ); |
633 | 633 | |
634 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
634 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
635 | 635 | // validate/sanitize data |
636 | - $valid = self::_validate_post_data( $id ); |
|
636 | + $valid = self::_validate_post_data($id); |
|
637 | 637 | |
638 | 638 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
639 | 639 | //EEH_Debug_Tools::printr( $valid, '$valid', __FILE__, __LINE__ ); |
@@ -641,41 +641,41 @@ discard block |
||
641 | 641 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
642 | 642 | |
643 | 643 | //check total tickets ordered vs max number of attendees that can register |
644 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
644 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
645 | 645 | |
646 | 646 | // ordering too many tickets !!! |
647 | 647 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
648 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
648 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
649 | 649 | // dev only message |
650 | 650 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
651 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
652 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
651 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
652 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
653 | 653 | } else { |
654 | 654 | |
655 | 655 | // all data appears to be valid |
656 | 656 | $tckts_slctd = FALSE; |
657 | 657 | $success = TRUE; |
658 | 658 | // load cart |
659 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
659 | + EE_Registry::instance()->load_core('Cart'); |
|
660 | 660 | |
661 | 661 | // cycle thru the number of data rows sent from the event listing |
662 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
662 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
663 | 663 | // does this row actually contain a ticket quantity? |
664 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
664 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
665 | 665 | // YES we have a ticket quantity |
666 | 666 | $tckts_slctd = TRUE; |
667 | 667 | // d( $valid['ticket_obj'][$x] ); |
668 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
668 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
669 | 669 | // then add ticket to cart |
670 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
670 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
671 | 671 | $success = ! $ticket_added ? FALSE : $success; |
672 | - if ( EE_Error::has_error() ) { |
|
672 | + if (EE_Error::has_error()) { |
|
673 | 673 | break; |
674 | 674 | } |
675 | 675 | } else { |
676 | 676 | // nothing added to cart retrieved |
677 | 677 | EE_Error::add_error( |
678 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
678 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
679 | 679 | __FILE__, __FUNCTION__, __LINE__ |
680 | 680 | ); |
681 | 681 | } |
@@ -684,45 +684,45 @@ discard block |
||
684 | 684 | //d( EE_Registry::instance()->CART ); |
685 | 685 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
686 | 686 | |
687 | - if ( $tckts_slctd ) { |
|
688 | - if ( $success ) { |
|
689 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
687 | + if ($tckts_slctd) { |
|
688 | + if ($success) { |
|
689 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
690 | 690 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
691 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
691 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
692 | 692 | EE_Registry::instance()->SSN->update(); |
693 | 693 | //d( EE_Registry::instance()->CART ); |
694 | 694 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
695 | 695 | // just return TRUE for registrations being made from admin |
696 | - if ( is_admin() ) { |
|
696 | + if (is_admin()) { |
|
697 | 697 | return TRUE; |
698 | 698 | } |
699 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
699 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
700 | 700 | exit(); |
701 | 701 | |
702 | 702 | } else { |
703 | - if ( ! EE_Error::has_error() ) { |
|
703 | + if ( ! EE_Error::has_error()) { |
|
704 | 704 | // nothing added to cart |
705 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
705 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
709 | 709 | } else { |
710 | 710 | // no ticket quantities were selected |
711 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
711 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
712 | 712 | } |
713 | 713 | } |
714 | 714 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
715 | 715 | // at this point, just return if registration is being made from admin |
716 | - if ( is_admin() ) { |
|
716 | + if (is_admin()) { |
|
717 | 717 | return FALSE; |
718 | 718 | } |
719 | - if ( $valid['return_url'] ) { |
|
720 | - EE_Error::get_notices( FALSE, TRUE ); |
|
721 | - wp_safe_redirect( $valid['return_url'] ); |
|
719 | + if ($valid['return_url']) { |
|
720 | + EE_Error::get_notices(FALSE, TRUE); |
|
721 | + wp_safe_redirect($valid['return_url']); |
|
722 | 722 | exit(); |
723 | - } elseif ( isset( $event_to_add['id'] )) { |
|
724 | - EE_Error::get_notices( FALSE, TRUE ); |
|
725 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
723 | + } elseif (isset($event_to_add['id'])) { |
|
724 | + EE_Error::get_notices(FALSE, TRUE); |
|
725 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
726 | 726 | exit(); |
727 | 727 | } else { |
728 | 728 | echo EE_Error::get_notices(); |
@@ -742,13 +742,13 @@ discard block |
||
742 | 742 | * @param int $id |
743 | 743 | * @return array|FALSE |
744 | 744 | */ |
745 | - private static function _validate_post_data( $id = 0 ) { |
|
746 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
745 | + private static function _validate_post_data($id = 0) { |
|
746 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
747 | 747 | |
748 | 748 | // d( $_POST ); |
749 | - if ( ! $id ) { |
|
749 | + if ( ! $id) { |
|
750 | 750 | EE_Error::add_error( |
751 | - __( 'The event id provided was not valid.', 'event_espresso' ), |
|
751 | + __('The event id provided was not valid.', 'event_espresso'), |
|
752 | 752 | __FILE__, |
753 | 753 | __FUNCTION__, |
754 | 754 | __LINE__ |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | // grab valid id |
761 | 761 | $valid_data['id'] = $id; |
762 | 762 | // grab and sanitize return-url |
763 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
763 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
764 | 764 | // array of other form names |
765 | 765 | $inputs_to_clean = array( |
766 | 766 | 'event_id' => 'tkt-slctr-event-id', |
@@ -773,22 +773,22 @@ discard block |
||
773 | 773 | // let's track the total number of tickets ordered.' |
774 | 774 | $valid_data['total_tickets'] = 0; |
775 | 775 | // cycle through $inputs_to_clean array |
776 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
776 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
777 | 777 | // check for POST data |
778 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
778 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
779 | 779 | // grab value |
780 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
780 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
781 | 781 | switch ($what) { |
782 | 782 | |
783 | 783 | // integers |
784 | 784 | case 'event_id': |
785 | - $valid_data[$what] = absint( $input_value ); |
|
785 | + $valid_data[$what] = absint($input_value); |
|
786 | 786 | // get event via the event id we put in the form |
787 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
787 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
788 | 788 | break; |
789 | 789 | case 'rows': |
790 | 790 | case 'max_atndz': |
791 | - $valid_data[$what] = absint( $input_value ); |
|
791 | + $valid_data[$what] = absint($input_value); |
|
792 | 792 | break; |
793 | 793 | |
794 | 794 | // arrays of integers |
@@ -796,27 +796,27 @@ discard block |
||
796 | 796 | /** @var array $row_qty */ |
797 | 797 | $row_qty = $input_value; |
798 | 798 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
799 | - if( ! is_array( $row_qty )) { |
|
799 | + if ( ! is_array($row_qty)) { |
|
800 | 800 | // get number of rows |
801 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
801 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
802 | 802 | // d( $rows ); |
803 | 803 | // explode ints by the dash |
804 | - $row_qty = explode( '-', $row_qty ); |
|
805 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
806 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
807 | - $row_qty = array( $row => $qty ); |
|
804 | + $row_qty = explode('-', $row_qty); |
|
805 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
806 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
807 | + $row_qty = array($row => $qty); |
|
808 | 808 | // d( $row_qty ); |
809 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
810 | - if ( ! isset( $row_qty[$x] )) { |
|
809 | + for ($x = 1; $x <= $rows; $x++) { |
|
810 | + if ( ! isset($row_qty[$x])) { |
|
811 | 811 | $row_qty[$x] = 0; |
812 | 812 | } |
813 | 813 | } |
814 | 814 | } |
815 | - ksort( $row_qty ); |
|
815 | + ksort($row_qty); |
|
816 | 816 | // d( $row_qty ); |
817 | 817 | // cycle thru values |
818 | - foreach ( $row_qty as $qty ) { |
|
819 | - $qty = absint( $qty ); |
|
818 | + foreach ($row_qty as $qty) { |
|
819 | + $qty = absint($qty); |
|
820 | 820 | // sanitize as integers |
821 | 821 | $valid_data[$what][] = $qty; |
822 | 822 | $valid_data['total_tickets'] += $qty; |
@@ -827,19 +827,19 @@ discard block |
||
827 | 827 | case 'ticket_id': |
828 | 828 | $value_array = array(); |
829 | 829 | // cycle thru values |
830 | - foreach ( (array) $input_value as $key => $value ) { |
|
830 | + foreach ((array) $input_value as $key => $value) { |
|
831 | 831 | // allow only numbers, letters, spaces, commas and dashes |
832 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
832 | + $value_array[$key] = wp_strip_all_tags($value); |
|
833 | 833 | // get ticket via the ticket id we put in the form |
834 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
835 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
834 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
835 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
836 | 836 | } |
837 | - $valid_data[ $what ] = $value_array; |
|
837 | + $valid_data[$what] = $value_array; |
|
838 | 838 | break; |
839 | 839 | |
840 | 840 | case 'return_url' : |
841 | 841 | // grab and sanitize return-url |
842 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
842 | + $valid_data[$what] = esc_url_raw($input_value); |
|
843 | 843 | break; |
844 | 844 | |
845 | 845 | } // end switch $what |
@@ -862,28 +862,28 @@ discard block |
||
862 | 862 | * @return TRUE on success, FALSE on fail |
863 | 863 | * @throws \EE_Error |
864 | 864 | */ |
865 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
866 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
865 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
866 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
867 | 867 | // get the number of spaces left for this datetime ticket |
868 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
868 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
869 | 869 | // compare available spaces against the number of tickets being purchased |
870 | - if ( $available_spaces >= $qty ) { |
|
870 | + if ($available_spaces >= $qty) { |
|
871 | 871 | // allow addons to prevent a ticket from being added to cart |
872 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
872 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
873 | 873 | return false; |
874 | 874 | } |
875 | 875 | // add event to cart |
876 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
877 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
876 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
877 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
878 | 878 | return true; |
879 | 879 | } else { |
880 | 880 | return false; |
881 | 881 | } |
882 | 882 | } else { |
883 | 883 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
884 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
884 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
885 | 885 | // greedy greedy greedy eh? |
886 | - if ( $available_spaces > 0 ) { |
|
886 | + if ($available_spaces > 0) { |
|
887 | 887 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
888 | 888 | EE_Error::add_error( |
889 | 889 | sprintf( |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | __FILE__, __FUNCTION__, __LINE__ |
900 | 900 | ); |
901 | 901 | } else { |
902 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
902 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
903 | 903 | } |
904 | 904 | return false; |
905 | 905 | } |
@@ -918,22 +918,22 @@ discard block |
||
918 | 918 | * @return int |
919 | 919 | * @throws \EE_Error |
920 | 920 | */ |
921 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
921 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
922 | 922 | // if the $_available_spaces array has not been set up yet... |
923 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
924 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
923 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
924 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
925 | 925 | } |
926 | 926 | $available_spaces = $ticket->qty() - $ticket->sold(); |
927 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
927 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
928 | 928 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
929 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
929 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
930 | 930 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
931 | - if ( $get_original_ticket_spaces ) { |
|
931 | + if ($get_original_ticket_spaces) { |
|
932 | 932 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
933 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
933 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
934 | 934 | } else { |
935 | 935 | // we want the updated ticket availability as stored in the "datetimes" array |
936 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
936 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | } |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | * @return void |
951 | 951 | * @throws \EE_Error |
952 | 952 | */ |
953 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
953 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
954 | 954 | // first, get all of the datetimes that are available to this ticket |
955 | 955 | $datetimes = $ticket->get_many_related( |
956 | 956 | 'Datetime', |
@@ -958,23 +958,23 @@ discard block |
||
958 | 958 | array( |
959 | 959 | 'DTT_EVT_end' => array( |
960 | 960 | '>=', |
961 | - EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ), |
|
961 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
962 | 962 | ), |
963 | 963 | ), |
964 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), |
|
964 | + 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
965 | 965 | ) |
966 | 966 | ); |
967 | - if ( ! empty( $datetimes )) { |
|
967 | + if ( ! empty($datetimes)) { |
|
968 | 968 | // now loop thru all of the datetimes |
969 | - foreach ( $datetimes as $datetime ) { |
|
970 | - if ( $datetime instanceof EE_Datetime ) { |
|
969 | + foreach ($datetimes as $datetime) { |
|
970 | + if ($datetime instanceof EE_Datetime) { |
|
971 | 971 | // the number of spaces available for the datetime without considering individual ticket quantities |
972 | 972 | $spaces_remaining = $datetime->spaces_remaining(); |
973 | 973 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
974 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
974 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
975 | 975 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
976 | 976 | // else just take the datetime spaces remaining, and assign to the datetimes array |
977 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
977 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | } |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | * @param int $qty |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
994 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
993 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
994 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
995 | 995 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
996 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
996 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
997 | 997 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
998 | - self::$_available_spaces['datetimes'][ $DTD_ID ] -= $qty; |
|
998 | + self::$_available_spaces['datetimes'][$DTD_ID] -= $qty; |
|
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | } |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | */ |
1013 | 1013 | public static function load_tckt_slctr_assets() { |
1014 | 1014 | // add some style |
1015 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
1016 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
1015 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
1016 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
1017 | 1017 | wp_enqueue_style('ticket_selector'); |
1018 | 1018 | // make it dance |
1019 | 1019 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -1027,9 +1027,9 @@ discard block |
||
1027 | 1027 | |
1028 | 1028 | public static function load_tckt_slctr_assets_admin() { |
1029 | 1029 | //iframe button js on admin event editor page |
1030 | - if ( EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit' ) { |
|
1031 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
1032 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
1030 | + if (EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit') { |
|
1031 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1032 | + wp_enqueue_script('ticket_selector_embed'); |
|
1033 | 1033 | } |
1034 | 1034 | } |
1035 | 1035 |