@@ -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 | * Event Espresso |
4 | 4 | * |
@@ -75,37 +75,37 @@ discard block |
||
75 | 75 | $this->Request_Handler = $Request_Handler; |
76 | 76 | $this->Module_Request_Router = $Module_Request_Router; |
77 | 77 | // make sure template tags are loaded immediately so that themes don't break |
78 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
78 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
79 | 79 | // determine how to integrate WP_Query with the EE models |
80 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
80 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
81 | 81 | // load other resources and begin to actually run shortcodes and modules |
82 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
82 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
83 | 83 | // analyse the incoming WP request |
84 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
84 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
85 | 85 | // process any content shortcodes |
86 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
86 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
87 | 87 | // process request with module factory |
88 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
88 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
89 | 89 | // before headers sent |
90 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
90 | + add_action('wp', array($this, 'wp'), 5); |
|
91 | 91 | // load css and js |
92 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
92 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
93 | 93 | // header |
94 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
95 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
94 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
95 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
96 | 96 | // display errors |
97 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
97 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
98 | 98 | // the content |
99 | 99 | // add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
100 | 100 | //exclude our private cpt comments |
101 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
101 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
102 | 102 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
103 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
103 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
104 | 104 | // action hook EE |
105 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
105 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
106 | 106 | // for checking that browser cookies are enabled |
107 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
108 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
107 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
108 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | * @return void |
142 | 142 | */ |
143 | 143 | public function load_espresso_template_tags() { |
144 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
145 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
144 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
145 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
158 | 158 | * @return array array of comment clauses with modifications. |
159 | 159 | */ |
160 | - public function filter_wp_comments( $clauses ) { |
|
160 | + public function filter_wp_comments($clauses) { |
|
161 | 161 | global $wpdb; |
162 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
162 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
163 | 163 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
164 | - foreach ( $cpts as $cpt => $details ) { |
|
165 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
164 | + foreach ($cpts as $cpt => $details) { |
|
165 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | return $clauses; |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @return void |
180 | 180 | */ |
181 | 181 | public function employ_CPT_Strategy() { |
182 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
183 | - $this->Registry->load_core( 'CPT_Strategy' ); |
|
182 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
183 | + $this->Registry->load_core('CPT_Strategy'); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | * @param string $url incoming url |
193 | 193 | * @return string final assembled url |
194 | 194 | */ |
195 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
196 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
197 | - $url = str_replace( 'http://', 'https://', $url ); |
|
195 | + public function maybe_force_admin_ajax_ssl($url) { |
|
196 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
197 | + $url = str_replace('http://', 'https://', $url); |
|
198 | 198 | } |
199 | 199 | return $url; |
200 | 200 | } |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @param WP $WP |
232 | 232 | * @return void |
233 | 233 | */ |
234 | - public function get_request( WP $WP ) { |
|
235 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
236 | - $this->Request_Handler->parse_request( $WP ); |
|
237 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
234 | + public function get_request(WP $WP) { |
|
235 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
236 | + $this->Request_Handler->parse_request($WP); |
|
237 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -246,21 +246,21 @@ discard block |
||
246 | 246 | * @param WP $WP |
247 | 247 | * @return void |
248 | 248 | */ |
249 | - public function _initialize_shortcodes( WP $WP ) { |
|
250 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
251 | - $this->Request_Handler->set_request_vars( $WP ); |
|
249 | + public function _initialize_shortcodes(WP $WP) { |
|
250 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
251 | + $this->Request_Handler->set_request_vars($WP); |
|
252 | 252 | // grab post_name from request |
253 | - $current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get( 'post_name' )); |
|
254 | - $show_on_front = get_option( 'show_on_front' ); |
|
253 | + $current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get('post_name')); |
|
254 | + $show_on_front = get_option('show_on_front'); |
|
255 | 255 | // if it's not set, then check if frontpage is blog |
256 | - if ( empty( $current_post ) ) { |
|
256 | + if (empty($current_post)) { |
|
257 | 257 | // yup.. this is the posts page, prepare to load all shortcode modules |
258 | 258 | $current_post = 'posts'; |
259 | 259 | // unless.. |
260 | - if ( $show_on_front === 'page' ) { |
|
260 | + if ($show_on_front === 'page') { |
|
261 | 261 | // some other page is set as the homepage |
262 | - $page_on_front = get_option( 'page_on_front' ); |
|
263 | - if ( $page_on_front ) { |
|
262 | + $page_on_front = get_option('page_on_front'); |
|
263 | + if ($page_on_front) { |
|
264 | 264 | // k now we need to find the post_name for this page |
265 | 265 | global $wpdb; |
266 | 266 | $page_on_front = $wpdb->get_var( |
@@ -277,22 +277,22 @@ discard block |
||
277 | 277 | // where are posts being displayed ? |
278 | 278 | $page_for_posts = EE_Config::get_page_for_posts(); |
279 | 279 | // in case $current_post is hierarchical like: /parent-page/current-page |
280 | - $current_post = basename( $current_post ); |
|
280 | + $current_post = basename($current_post); |
|
281 | 281 | // are we on a category page? |
282 | - $term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars ); |
|
282 | + $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars); |
|
283 | 283 | // make sure shortcodes are set |
284 | - if ( isset( $this->Registry->CFG->core->post_shortcodes )) { |
|
285 | - if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
286 | - $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
284 | + if (isset($this->Registry->CFG->core->post_shortcodes)) { |
|
285 | + if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) { |
|
286 | + $this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
287 | 287 | } |
288 | 288 | // cycle thru all posts with shortcodes set |
289 | - foreach ( $this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
289 | + foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
290 | 290 | // filter shortcodes so |
291 | - $post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes ); |
|
291 | + $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes); |
|
292 | 292 | // now cycle thru shortcodes |
293 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
293 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
294 | 294 | // are we on this page, or on the blog page, or an EE CPT category page ? |
295 | - if ( $current_post === $post_name || $term_exists ) { |
|
295 | + if ($current_post === $post_name || $term_exists) { |
|
296 | 296 | // maybe init the shortcode |
297 | 297 | $this->initialize_shortcode_if_active_on_page( |
298 | 298 | $shortcode_class, |
@@ -307,16 +307,16 @@ discard block |
||
307 | 307 | // but the shortcode is not being tracked for this page |
308 | 308 | } else if ( |
309 | 309 | $post_name !== $page_for_posts |
310 | - && isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) |
|
311 | - && ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) |
|
310 | + && isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts]) |
|
311 | + && ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class]) |
|
312 | 312 | ) { |
313 | 313 | // then remove the "fallback" shortcode processor |
314 | - remove_shortcode( $shortcode_class ); |
|
314 | + remove_shortcode($shortcode_class); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | } |
318 | 318 | } |
319 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
319 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | $WP |
339 | 339 | ) { |
340 | 340 | // verify shortcode is in list of registered shortcodes |
341 | - if ( ! isset( $this->Registry->shortcodes->{$shortcode_class} ) ) { |
|
342 | - if ( $current_post !== $page_for_posts && current_user_can( 'edit_post', $post_id ) ) { |
|
341 | + if ( ! isset($this->Registry->shortcodes->{$shortcode_class} )) { |
|
342 | + if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
343 | 343 | EE_Error::add_error( |
344 | 344 | sprintf( |
345 | 345 | __( |
@@ -352,24 +352,24 @@ discard block |
||
352 | 352 | __FUNCTION__, |
353 | 353 | __LINE__ |
354 | 354 | ); |
355 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
355 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
356 | 356 | } |
357 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) ); |
|
357 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
358 | 358 | return; |
359 | 359 | } |
360 | 360 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
361 | 361 | if ( |
362 | 362 | $term_exists |
363 | 363 | || $current_post === $page_for_posts |
364 | - || isset( $this->Registry->CFG->core->post_shortcodes[ $current_post ] ) |
|
364 | + || isset($this->Registry->CFG->core->post_shortcodes[$current_post]) |
|
365 | 365 | ) { |
366 | 366 | // let's pause to reflect on this... |
367 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
367 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
368 | 368 | // ensure that class is actually a shortcode |
369 | 369 | if ( |
370 | - defined( 'WP_DEBUG' ) |
|
370 | + defined('WP_DEBUG') |
|
371 | 371 | && WP_DEBUG === true |
372 | - && ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) |
|
372 | + && ! $sc_reflector->isSubclassOf('EES_Shortcode') |
|
373 | 373 | ) { |
374 | 374 | EE_Error::add_error( |
375 | 375 | sprintf( |
@@ -383,13 +383,13 @@ discard block |
||
383 | 383 | __FUNCTION__, |
384 | 384 | __LINE__ |
385 | 385 | ); |
386 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
386 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
387 | 387 | return; |
388 | 388 | } |
389 | 389 | // and pass the request object to the run method |
390 | 390 | $this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
391 | 391 | // fire the shortcode class's run method, so that it can activate resources |
392 | - $this->Registry->shortcodes->{$shortcode_class}->run( $WP ); |
|
392 | + $this->Registry->shortcodes->{$shortcode_class}->run($WP); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
@@ -402,19 +402,19 @@ discard block |
||
402 | 402 | * @param WP_Query $WP_Query |
403 | 403 | * @return void |
404 | 404 | */ |
405 | - public function pre_get_posts( $WP_Query ) { |
|
405 | + public function pre_get_posts($WP_Query) { |
|
406 | 406 | // only load Module_Request_Router if this is the main query |
407 | 407 | if ( |
408 | 408 | $this->Module_Request_Router instanceof EE_Module_Request_Router |
409 | 409 | && $WP_Query->is_main_query() |
410 | 410 | ) { |
411 | 411 | // cycle thru module routes |
412 | - while ( $route = $this->Module_Request_Router->get_route( $WP_Query )) { |
|
412 | + while ($route = $this->Module_Request_Router->get_route($WP_Query)) { |
|
413 | 413 | // determine module and method for route |
414 | - $module = $this->Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
415 | - if( $module instanceof EED_Module ) { |
|
414 | + $module = $this->Module_Request_Router->resolve_route($route[0], $route[1]); |
|
415 | + if ($module instanceof EED_Module) { |
|
416 | 416 | // get registered view for route |
417 | - $this->_template_path = $this->Module_Request_Router->get_view( $route ); |
|
417 | + $this->_template_path = $this->Module_Request_Router->get_view($route); |
|
418 | 418 | // grab module name |
419 | 419 | $module_name = $module->module_name(); |
420 | 420 | // map the module to the module objects |
@@ -456,29 +456,29 @@ discard block |
||
456 | 456 | public function wp_enqueue_scripts() { |
457 | 457 | |
458 | 458 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
459 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
459 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
460 | 460 | |
461 | 461 | $this->Registry->CFG->template_settings->enable_default_style = TRUE; |
462 | 462 | //Load the ThemeRoller styles if enabled |
463 | - if ( isset( $this->Registry->CFG->template_settings->enable_default_style ) && $this->Registry->CFG->template_settings->enable_default_style ) { |
|
463 | + if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) { |
|
464 | 464 | |
465 | 465 | //Load custom style sheet if available |
466 | - if ( isset( $this->Registry->CFG->template_settings->custom_style_sheet )) { |
|
467 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
466 | + if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) { |
|
467 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
468 | 468 | wp_enqueue_style('espresso_custom_css'); |
469 | 469 | } |
470 | 470 | |
471 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
472 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
471 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
472 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
473 | 473 | } else { |
474 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
474 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
475 | 475 | } |
476 | 476 | wp_enqueue_style('espresso_default'); |
477 | 477 | |
478 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
479 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
478 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
479 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
480 | 480 | } else { |
481 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
481 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | } |
@@ -486,38 +486,38 @@ discard block |
||
486 | 486 | } |
487 | 487 | |
488 | 488 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
489 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
489 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
490 | 490 | |
491 | - wp_enqueue_script( 'jquery' ); |
|
491 | + wp_enqueue_script('jquery'); |
|
492 | 492 | //let's make sure that all required scripts have been setup |
493 | - if ( function_exists( 'wp_script_is' ) && ! wp_script_is( 'jquery' )) { |
|
493 | + if (function_exists('wp_script_is') && ! wp_script_is('jquery')) { |
|
494 | 494 | $msg = sprintf( |
495 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
495 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
496 | 496 | '<em><br />', |
497 | 497 | '</em>' |
498 | 498 | ); |
499 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
499 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
500 | 500 | } |
501 | 501 | // load core js |
502 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
503 | - wp_enqueue_script( 'espresso_core' ); |
|
504 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
502 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
503 | + wp_enqueue_script('espresso_core'); |
|
504 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
505 | 505 | |
506 | 506 | } |
507 | 507 | |
508 | 508 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
509 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
509 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
510 | 510 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
511 | 511 | } |
512 | 512 | |
513 | 513 | |
514 | 514 | //accounting.js library |
515 | 515 | // @link http://josscrowcroft.github.io/accounting.js/ |
516 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
517 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
518 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
519 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
520 | - wp_enqueue_script( 'ee-accounting' ); |
|
516 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
517 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
518 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
519 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
520 | + wp_enqueue_script('ee-accounting'); |
|
521 | 521 | |
522 | 522 | $currency_config = array( |
523 | 523 | 'currency' => array( |
@@ -540,21 +540,21 @@ discard block |
||
540 | 540 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
541 | 541 | } |
542 | 542 | |
543 | - if ( ! function_exists( 'wp_head' )) { |
|
543 | + if ( ! function_exists('wp_head')) { |
|
544 | 544 | $msg = sprintf( |
545 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
545 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
546 | 546 | '<em><br />', |
547 | 547 | '</em>' |
548 | 548 | ); |
549 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
549 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
550 | 550 | } |
551 | - if ( ! function_exists( 'wp_footer' )) { |
|
551 | + if ( ! function_exists('wp_footer')) { |
|
552 | 552 | $msg = sprintf( |
553 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
553 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
554 | 554 | '<em><br />', |
555 | 555 | '</em>' |
556 | 556 | ); |
557 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
557 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | } |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | * @return void |
569 | 569 | */ |
570 | 570 | public function header_meta_tag() { |
571 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
571 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public function display_errors() { |
611 | 611 | static $shown_already = FALSE; |
612 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
612 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
613 | 613 | if ( |
614 | 614 | ! $shown_already |
615 | - && apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
615 | + && apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
616 | 616 | && is_main_query() |
617 | 617 | && ! is_feed() |
618 | 618 | && in_the_loop() |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | ) { |
621 | 621 | echo EE_Error::get_notices(); |
622 | 622 | $shown_already = TRUE; |
623 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
623 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
624 | 624 | } |
625 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
625 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
@@ -637,12 +637,12 @@ discard block |
||
637 | 637 | * @param string $template_include_path |
638 | 638 | * @return string |
639 | 639 | */ |
640 | - public function template_include( $template_include_path = NULL ) { |
|
641 | - if ( $this->Request_Handler->is_espresso_page() ) { |
|
642 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
643 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
644 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
645 | - $this->_template = basename( $this->_template_path ); |
|
640 | + public function template_include($template_include_path = NULL) { |
|
641 | + if ($this->Request_Handler->is_espresso_page()) { |
|
642 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
643 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
644 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
645 | + $this->_template = basename($this->_template_path); |
|
646 | 646 | return $this->_template_path; |
647 | 647 | } |
648 | 648 | return $template_include_path; |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | * @param bool $with_path |
658 | 658 | * @return string |
659 | 659 | */ |
660 | - public function get_selected_template( $with_path = FALSE ) { |
|
660 | + public function get_selected_template($with_path = FALSE) { |
|
661 | 661 | return $with_path ? $this->_template_path : $this->_template; |
662 | 662 | } |
663 | 663 |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | * @since 4.6 |
11 | 11 | * |
12 | 12 | */ |
13 | -class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
13 | +class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param null $validation_error_message |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = NULL ) { |
|
19 | - if( ! $validation_error_message ){ |
|
18 | + public function __construct($validation_error_message = NULL) { |
|
19 | + if ( ! $validation_error_message) { |
|
20 | 20 | $allowedtags = $this->_get_allowed_tags(); |
21 | - $validation_error_message = sprintf( __( "Only simple HTML tags are allowed. Eg, %s", "event_espresso" ), implode( ",", array_keys( $allowedtags ) ) ); |
|
21 | + $validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags))); |
|
22 | 22 | } |
23 | - parent::__construct( $validation_error_message ); |
|
23 | + parent::__construct($validation_error_message); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function get_list_of_allowed_tags() { |
45 | 45 | $allowed_tags = $this->_get_allowed_tags(); |
46 | - ksort( $allowed_tags ); |
|
47 | - return implode( ', ', array_keys( $allowed_tags ) ); |
|
46 | + ksort($allowed_tags); |
|
47 | + return implode(', ', array_keys($allowed_tags)); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function validate($normalized_value) { |
57 | 57 | $allowedtags = $this->_get_allowed_tags(); |
58 | - parent::validate( $normalized_value ); |
|
59 | - $normalized_value_sans_tags = wp_kses( "$normalized_value",$allowedtags ); |
|
60 | - if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) { |
|
61 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' ); |
|
58 | + parent::validate($normalized_value); |
|
59 | + $normalized_value_sans_tags = wp_kses("$normalized_value", $allowedtags); |
|
60 | + if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) { |
|
61 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -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 | * EE_Admin_Page_CPT class |
4 | 6 | * |
@@ -236,8 +238,9 @@ discard block |
||
236 | 238 | |
237 | 239 | $containers = array(); |
238 | 240 | |
239 | - if ( empty( $wp_meta_boxes ) ) |
|
240 | - return; |
|
241 | + if ( empty( $wp_meta_boxes ) ) { |
|
242 | + return; |
|
243 | + } |
|
241 | 244 | |
242 | 245 | $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
243 | 246 | |
@@ -341,8 +344,9 @@ discard block |
||
341 | 344 | |
342 | 345 | |
343 | 346 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
344 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
345 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
347 | + if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) { |
|
348 | + add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
349 | + } |
|
346 | 350 | |
347 | 351 | //add preview button |
348 | 352 | add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
@@ -352,12 +356,14 @@ discard block |
||
352 | 356 | add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
353 | 357 | |
354 | 358 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
355 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
356 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
359 | + if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) { |
|
360 | + add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
361 | + } |
|
357 | 362 | |
358 | 363 | //This allows for adding additional stuff after the title field on the wp post edit form. This is also before the wp_editor for post description field. |
359 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
360 | - add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
364 | + if ( method_exists( $this, 'edit_form_after_title' ) ) { |
|
365 | + add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
366 | + } |
|
361 | 367 | |
362 | 368 | |
363 | 369 | /** |
@@ -548,7 +554,9 @@ discard block |
||
548 | 554 | |
549 | 555 | |
550 | 556 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
551 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
557 | + if ( !defined('DOING_AUTOSAVE') ) { |
|
558 | + define('DOING_AUTOSAVE', true); |
|
559 | + } |
|
552 | 560 | |
553 | 561 | //if we made it here then the nonce checked out. Let's run our methods and actions |
554 | 562 | if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
@@ -578,8 +586,9 @@ discard block |
||
578 | 586 | protected function _extend_page_config_for_cpt() { |
579 | 587 | |
580 | 588 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
581 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
582 | - return; |
|
589 | + if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) { |
|
590 | + return; |
|
591 | + } |
|
583 | 592 | |
584 | 593 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
585 | 594 | if ( !empty( $this->_cpt_object ) ) { |
@@ -611,8 +620,9 @@ discard block |
||
611 | 620 | } |
612 | 621 | |
613 | 622 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
614 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
615 | - return; |
|
623 | + if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) { |
|
624 | + return; |
|
625 | + } |
|
616 | 626 | |
617 | 627 | |
618 | 628 | $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
@@ -896,8 +906,10 @@ discard block |
||
896 | 906 | } |
897 | 907 | } |
898 | 908 | |
899 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
900 | - return; //TODO we'll remove this after reimplementing autosave in 4.2 |
|
909 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
910 | + return; |
|
911 | + } |
|
912 | + //TODO we'll remove this after reimplementing autosave in 4.2 |
|
901 | 913 | $this->_insert_update_cpt_item( $post_id, $post ); |
902 | 914 | } |
903 | 915 | |
@@ -974,7 +986,9 @@ discard block |
||
974 | 986 | */ |
975 | 987 | public function modify_current_screen() { |
976 | 988 | //ONLY do this if the current page_route IS a cpt route |
977 | - if ( !$this->_cpt_route ) return; |
|
989 | + if ( !$this->_cpt_route ) { |
|
990 | + return; |
|
991 | + } |
|
978 | 992 | //routing things REALLY early b/c this is a cpt admin page |
979 | 993 | set_current_screen( $this->_cpt_routes[$this->_req_action]); |
980 | 994 | $this->_current_screen = get_current_screen(); |
@@ -1014,8 +1028,9 @@ discard block |
||
1014 | 1028 | public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
1015 | 1029 | if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
1016 | 1030 | $post = get_post( $id ); |
1017 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
1018 | - $shortlink = home_url('?p=' . $post->ID); |
|
1031 | + if ( isset($post->post_type) && $this->page_slug == $post->post_type ) { |
|
1032 | + $shortlink = home_url('?p=' . $post->ID); |
|
1033 | + } |
|
1019 | 1034 | } |
1020 | 1035 | return $shortlink; |
1021 | 1036 | } |
@@ -1028,7 +1043,9 @@ discard block |
||
1028 | 1043 | * @return void |
1029 | 1044 | */ |
1030 | 1045 | public function route_admin_request() { |
1031 | - if ( $this->_cpt_route ) return; |
|
1046 | + if ( $this->_cpt_route ) { |
|
1047 | + return; |
|
1048 | + } |
|
1032 | 1049 | try { |
1033 | 1050 | $this->_route_admin_request(); |
1034 | 1051 | } catch ( EE_Error $e ) { |
@@ -1067,8 +1084,9 @@ discard block |
||
1067 | 1084 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
1068 | 1085 | |
1069 | 1086 | //can't do anything without revision so let's get out if not present |
1070 | - if ( empty( $rev_id ) ) |
|
1071 | - return $location; |
|
1087 | + if ( empty( $rev_id ) ) { |
|
1088 | + return $location; |
|
1089 | + } |
|
1072 | 1090 | |
1073 | 1091 | //get rev_post_data |
1074 | 1092 | $rev = get_post($rev_id); |
@@ -1097,8 +1115,9 @@ discard block |
||
1097 | 1115 | */ |
1098 | 1116 | public function modify_edit_post_link( $link, $id, $context ) { |
1099 | 1117 | $post = get_post( $id ); |
1100 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1101 | - return $link; |
|
1118 | + if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) { |
|
1119 | + return $link; |
|
1120 | + } |
|
1102 | 1121 | $query_args = array( |
1103 | 1122 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1104 | 1123 | 'post' => $id |
@@ -1118,8 +1137,9 @@ discard block |
||
1118 | 1137 | */ |
1119 | 1138 | public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
1120 | 1139 | $post = get_post($post_id); |
1121 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1122 | - return $delete_link; |
|
1140 | + if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) { |
|
1141 | + return $delete_link; |
|
1142 | + } |
|
1123 | 1143 | |
1124 | 1144 | return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
1125 | 1145 | } |
@@ -1133,8 +1153,9 @@ discard block |
||
1133 | 1153 | * @return string url to redirect to |
1134 | 1154 | */ |
1135 | 1155 | public function cpt_trash_post_location_redirect( $location, $status ) { |
1136 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1137 | - return $location; |
|
1156 | + if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) { |
|
1157 | + return $location; |
|
1158 | + } |
|
1138 | 1159 | |
1139 | 1160 | $post = get_post( $this->_req_data['post'] ); |
1140 | 1161 | $query_args = array( 'action' => 'default' ); |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | |
79 | 79 | |
80 | 80 | /** |
81 | - * @var EE_CPT_Base |
|
82 | - */ |
|
81 | + * @var EE_CPT_Base |
|
82 | + */ |
|
83 | 83 | protected $_cpt_model_obj = FALSE; |
84 | 84 | |
85 | 85 | |
@@ -659,12 +659,12 @@ discard block |
||
659 | 659 | $model = null; |
660 | 660 | if ( |
661 | 661 | empty( $this->_cpt_model_names ) |
662 | - || ( |
|
663 | - ! $ignore_route_check |
|
664 | - && ! isset( $this->_cpt_routes[ $this->_req_action ] ) |
|
665 | - ) || ( |
|
666 | - $this->_cpt_model_obj instanceof EE_CPT_Base |
|
667 | - && $this->_cpt_model_obj->ID() === $id |
|
662 | + || ( |
|
663 | + ! $ignore_route_check |
|
664 | + && ! isset( $this->_cpt_routes[ $this->_req_action ] ) |
|
665 | + ) || ( |
|
666 | + $this->_cpt_model_obj instanceof EE_CPT_Base |
|
667 | + && $this->_cpt_model_obj->ID() === $id |
|
668 | 668 | ) |
669 | 669 | ) { |
670 | 670 | EE_Admin::debug_log( __METHOD__, array( '**RETURN**' => true ) ); |
@@ -906,9 +906,9 @@ discard block |
||
906 | 906 | //if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit. |
907 | 907 | if ( $update |
908 | 908 | && ( |
909 | - ! $this->_cpt_model_obj instanceof EE_CPT_Base |
|
910 | - || $this->_cpt_model_obj->ID() !== $post_id |
|
911 | - ) |
|
909 | + ! $this->_cpt_model_obj instanceof EE_CPT_Base |
|
910 | + || $this->_cpt_model_obj->ID() !== $post_id |
|
911 | + ) |
|
912 | 912 | ) { |
913 | 913 | return; |
914 | 914 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param object $post The post object of the cpt that was saved. |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - abstract protected function _insert_update_cpt_item( $post_id, $post ); |
|
116 | + abstract protected function _insert_update_cpt_item($post_id, $post); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $post_id The ID of the cpt that was trashed |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - abstract public function trash_cpt_item( $post_id ); |
|
129 | + abstract public function trash_cpt_item($post_id); |
|
130 | 130 | |
131 | 131 | |
132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param string $post_id theID of the cpt that was untrashed |
138 | 138 | * @return void |
139 | 139 | */ |
140 | - abstract public function restore_cpt_item( $post_id ); |
|
140 | + abstract public function restore_cpt_item($post_id); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $post_id the ID of the cpt that was deleted |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - abstract public function delete_cpt_item( $post_id ); |
|
151 | + abstract public function delete_cpt_item($post_id); |
|
152 | 152 | |
153 | 153 | |
154 | 154 | |
@@ -161,32 +161,32 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function _before_page_setup() { |
163 | 163 | |
164 | - $page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug; |
|
164 | + $page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug; |
|
165 | 165 | |
166 | - $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes ); |
|
166 | + $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes); |
|
167 | 167 | |
168 | 168 | //let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page |
169 | - $this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page ); |
|
169 | + $this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page); |
|
170 | 170 | |
171 | 171 | //tweak pagenow for page loading. |
172 | - if( ! $this->_pagenow_map ) { |
|
172 | + if ( ! $this->_pagenow_map) { |
|
173 | 173 | $this->_pagenow_map = array( |
174 | 174 | 'create_new' => 'post-new.php', |
175 | 175 | 'edit' => 'post.php', |
176 | 176 | 'trash' => 'post.php' |
177 | 177 | ); |
178 | 178 | } |
179 | - add_action( 'current_screen', array( $this, 'modify_pagenow') ); |
|
179 | + add_action('current_screen', array($this, 'modify_pagenow')); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | //TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param. |
183 | 183 | //get current page from autosave |
184 | - $current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | - $this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page; |
|
184 | + $current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | + $this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page; |
|
186 | 186 | |
187 | 187 | |
188 | 188 | //autosave... make sure its only for the correct page |
189 | - if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) { |
|
189 | + if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) { |
|
190 | 190 | //setup autosave ajax hook |
191 | 191 | //add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented |
192 | 192 | } |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function modify_pagenow( $current_screen ) { |
|
205 | + public function modify_pagenow($current_screen) { |
|
206 | 206 | global $pagenow; |
207 | 207 | //possibly reset pagenow. |
208 | - if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) { |
|
208 | + if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) { |
|
209 | 209 | $pagenow = $this->_pagenow_map[$this->_req_data['action']]; |
210 | 210 | } |
211 | 211 | } |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | * @param array $ids an array of ids for containers that hold form inputs we want autosave to pickup. Typically you would send along the id of a metabox container. |
221 | 221 | * @return void |
222 | 222 | */ |
223 | - protected function _register_autosave_containers( $ids ) { |
|
224 | - $this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids ); |
|
223 | + protected function _register_autosave_containers($ids) { |
|
224 | + $this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | |
237 | 237 | $containers = array(); |
238 | 238 | |
239 | - if ( empty( $wp_meta_boxes ) ) |
|
239 | + if (empty($wp_meta_boxes)) |
|
240 | 240 | return; |
241 | 241 | |
242 | - $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
242 | + $current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
243 | 243 | |
244 | - foreach ( $current_metaboxes as $box_context ) { |
|
245 | - foreach ( $box_context as $box_details ) { |
|
246 | - foreach ( $box_details as $box ) { |
|
247 | - if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){ |
|
244 | + foreach ($current_metaboxes as $box_context) { |
|
245 | + foreach ($box_context as $box_details) { |
|
246 | + foreach ($box_details as $box) { |
|
247 | + if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) { |
|
248 | 248 | $containers[] = $box['id']; |
249 | 249 | } |
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | - $this->_autosave_containers = array_merge( $this->_autosave_containers, $containers ); |
|
254 | + $this->_autosave_containers = array_merge($this->_autosave_containers, $containers); |
|
255 | 255 | |
256 | 256 | //add hidden inputs container |
257 | 257 | $this->_autosave_containers[] = 'ee-cpt-hidden-inputs'; |
@@ -268,13 +268,13 @@ discard block |
||
268 | 268 | wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2 |
269 | 269 | |
270 | 270 | //filter _autosave_containers |
271 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this ); |
|
272 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this ); |
|
271 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this); |
|
272 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this); |
|
273 | 273 | |
274 | - wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
274 | + wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
275 | 275 | |
276 | 276 | $unsaved_data_msg = array( |
277 | - 'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
277 | + 'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
278 | 278 | 'inputChanged' => 0 |
279 | 279 | ); |
280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public function load_page_dependencies() { |
287 | 287 | try { |
288 | 288 | $this->_load_page_dependencies(); |
289 | - } catch ( EE_Error $e ) { |
|
289 | + } catch (EE_Error $e) { |
|
290 | 290 | $e->get_error(); |
291 | 291 | } |
292 | 292 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | protected function _load_page_dependencies() { |
303 | 303 | |
304 | 304 | //we only add stuff if this is a cpt_route! |
305 | - if ( !$this->_cpt_route ) { |
|
305 | + if ( ! $this->_cpt_route) { |
|
306 | 306 | parent::_load_page_dependencies(); |
307 | 307 | return; |
308 | 308 | } |
@@ -312,72 +312,72 @@ discard block |
||
312 | 312 | |
313 | 313 | //the following filters are for setting all the redirects on DEFAULT WP custom post type actions |
314 | 314 | //let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects! Otherwise the redirects will happen on ALL post saves which wouldn't be good of course! |
315 | - add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') ); |
|
315 | + add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input')); |
|
316 | 316 | |
317 | 317 | //inject our Admin page nav tabs... |
318 | 318 | //let's make sure the nav tabs are set if they aren't already |
319 | 319 | //if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs(); |
320 | - add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) ); |
|
320 | + add_action('post_edit_form_tag', array($this, 'inject_nav_tabs')); |
|
321 | 321 | |
322 | 322 | //modify the post_updated messages array |
323 | - add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 ); |
|
323 | + add_action('post_updated_messages', array($this, 'post_update_messages'), 10); |
|
324 | 324 | |
325 | 325 | //add shortlink button to cpt edit screens. We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts! |
326 | - add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 ); |
|
326 | + add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4); |
|
327 | 327 | |
328 | 328 | //This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class. |
329 | - if ( !empty($this->_labels['publishbox'] ) ) { |
|
329 | + if ( ! empty($this->_labels['publishbox'])) { |
|
330 | 330 | |
331 | - $box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
331 | + $box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
332 | 332 | |
333 | - remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
334 | - add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
333 | + remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
334 | + add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | //let's add page_templates metabox if this cpt added support for it. |
338 | - if ( $this->_supports_page_templates($this->_cpt_object->name) ) { |
|
339 | - add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' ); |
|
338 | + if ($this->_supports_page_templates($this->_cpt_object->name)) { |
|
339 | + add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default'); |
|
340 | 340 | }/**/ |
341 | 341 | |
342 | 342 | |
343 | 343 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
344 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
345 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
344 | + if (method_exists($this, 'extra_permalink_field_buttons')) |
|
345 | + add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4); |
|
346 | 346 | |
347 | 347 | //add preview button |
348 | - add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
|
348 | + add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4); |
|
349 | 349 | |
350 | 350 | |
351 | 351 | //insert our own post_stati dropdown |
352 | - add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
|
352 | + add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10); |
|
353 | 353 | |
354 | 354 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
355 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
356 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
355 | + if (method_exists($this, 'extra_misc_actions_publish_box')) |
|
356 | + add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10); |
|
357 | 357 | |
358 | 358 | //This allows for adding additional stuff after the title field on the wp post edit form. This is also before the wp_editor for post description field. |
359 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
360 | - add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
359 | + if (method_exists($this, 'edit_form_after_title')) |
|
360 | + add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10); |
|
361 | 361 | |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route. |
365 | 365 | */ |
366 | - add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 ); |
|
366 | + add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3); |
|
367 | 367 | |
368 | 368 | |
369 | 369 | parent::_load_page_dependencies(); |
370 | 370 | |
371 | 371 | //notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes. |
372 | 372 | global $pagenow; |
373 | - do_action( 'load-' . $pagenow ); |
|
373 | + do_action('load-'.$pagenow); |
|
374 | 374 | |
375 | 375 | $this->modify_current_screen(); |
376 | - add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 ); |
|
376 | + add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30); |
|
377 | 377 | //we route REALLY early. |
378 | 378 | try { |
379 | 379 | $this->_route_admin_request(); |
380 | - } catch ( EE_Error $e ) { |
|
380 | + } catch (EE_Error $e) { |
|
381 | 381 | $e->get_error(); |
382 | 382 | } |
383 | 383 | } |
@@ -396,21 +396,21 @@ discard block |
||
396 | 396 | * |
397 | 397 | * @return string possibly a new url for our route. |
398 | 398 | */ |
399 | - public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) { |
|
399 | + public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) { |
|
400 | 400 | $routes_to_match = array( |
401 | 401 | 0 => array( |
402 | 402 | 'edit.php?post_type=espresso_attendees', |
403 | 403 | 'admin.php?page=espresso_registrations&action=contact_list' |
404 | 404 | ), |
405 | 405 | 1 => array( |
406 | - 'edit.php?post_type=' . $this->_cpt_object->name, |
|
407 | - 'admin.php?page=' . $this->_cpt_object->name |
|
406 | + 'edit.php?post_type='.$this->_cpt_object->name, |
|
407 | + 'admin.php?page='.$this->_cpt_object->name |
|
408 | 408 | ) |
409 | 409 | ); |
410 | 410 | |
411 | - foreach( $routes_to_match as $route_matches ) { |
|
412 | - if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) { |
|
413 | - return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url ); |
|
411 | + foreach ($routes_to_match as $route_matches) { |
|
412 | + if (strpos($good_protocol_url, $route_matches[0]) !== false) { |
|
413 | + return str_replace($route_matches[0], $route_matches[1], $good_protocol_url); |
|
414 | 414 | |
415 | 415 | } |
416 | 416 | } |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | * @param string $cpt_name The cpt slug we're checking on. |
427 | 427 | * @return bool True supported, false not. |
428 | 428 | */ |
429 | - private function _supports_page_templates( $cpt_name ) { |
|
429 | + private function _supports_page_templates($cpt_name) { |
|
430 | 430 | $cpt_args = EE_Register_CPTs::get_CPTs(); |
431 | - $cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | - return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE; |
|
431 | + $cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | + return ! empty($cpt_args['page_templates']) ? TRUE : FALSE; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | public function page_template_meta_box() { |
445 | 445 | global $post; |
446 | 446 | $template = ''; |
447 | - if ( count( get_page_templates( $post ) ) != 0 ) { |
|
448 | - $page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE ); |
|
449 | - $template = !empty( $page_template ) ? $page_template : ''; |
|
447 | + if (count(get_page_templates($post)) != 0) { |
|
448 | + $page_template = get_post_meta($post->ID, '_wp_page_template', TRUE); |
|
449 | + $template = ! empty($page_template) ? $page_template : ''; |
|
450 | 450 | } |
451 | 451 | ?> |
452 | 452 | <p><strong><?php _e('Template') ?></strong></p> |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | * @param string $new_slug what the slug is |
471 | 471 | * @return string The new html string for the permalink area |
472 | 472 | */ |
473 | - public function preview_button_html( $return, $id, $new_title, $new_slug ) { |
|
474 | - $post = get_post( $id ); |
|
475 | - if ( 'publish' != get_post_status( $post ) ) { |
|
476 | - $return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n"; |
|
473 | + public function preview_button_html($return, $id, $new_title, $new_slug) { |
|
474 | + $post = get_post($id); |
|
475 | + if ('publish' != get_post_status($post)) { |
|
476 | + $return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n"; |
|
477 | 477 | } |
478 | 478 | return $return; |
479 | 479 | } |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | 'cur_status' => $this->_cpt_model_obj->status(), |
494 | 494 | 'statuses' => $statuses, |
495 | 495 | 'cur_status_label' => $cur_status_label, |
496 | - 'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label ) |
|
496 | + 'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label) |
|
497 | 497 | ); |
498 | 498 | |
499 | 499 | //we'll add a trash post status (WP doesn't add one for some reason) |
500 | - if ( $this->_cpt_model_obj->status() == 'trash' ) { |
|
500 | + if ($this->_cpt_model_obj->status() == 'trash') { |
|
501 | 501 | $template_args['cur_status_label'] = __('Trashed', 'event_espresso'); |
502 | 502 | $statuses['trash'] = __('Trashed', 'event_espresso'); |
503 | 503 | $template_args['statuses'] = $statuses; |
504 | 504 | } |
505 | 505 | |
506 | - $template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php'; |
|
507 | - EEH_Template::display_template( $template, $template_args ); |
|
506 | + $template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php'; |
|
507 | + EEH_Template::display_template($template, $template_args); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -543,22 +543,22 @@ discard block |
||
543 | 543 | public function do_extra_autosave_stuff() { |
544 | 544 | |
545 | 545 | //next let's check for the autosave nonce (we'll use _verify_nonce ) |
546 | - $nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | - $this->_verify_nonce( $nonce, 'autosave' ); |
|
546 | + $nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | + $this->_verify_nonce($nonce, 'autosave'); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
551 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
551 | + if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true); |
|
552 | 552 | |
553 | 553 | //if we made it here then the nonce checked out. Let's run our methods and actions |
554 | - if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
|
555 | - call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) ); |
|
554 | + if (method_exists($this, '_ee_autosave_'.$this->_current_view)) { |
|
555 | + call_user_func(array($this, '_ee_autosave_'.$this->_current_view)); |
|
556 | 556 | } else { |
557 | 557 | $this->_template_args['success'] = TRUE; |
558 | 558 | } |
559 | 559 | |
560 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this ); |
|
561 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this ); |
|
560 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this); |
|
561 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this); |
|
562 | 562 | |
563 | 563 | //now let's return json |
564 | 564 | $this->_return_json(); |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | protected function _extend_page_config_for_cpt() { |
579 | 579 | |
580 | 580 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
581 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
581 | + if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug)) |
|
582 | 582 | return; |
583 | 583 | |
584 | 584 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
585 | - if ( !empty( $this->_cpt_object ) ) { |
|
586 | - $this->_page_routes = array_merge( array( |
|
585 | + if ( ! empty($this->_cpt_object)) { |
|
586 | + $this->_page_routes = array_merge(array( |
|
587 | 587 | 'create_new' => '_create_new_cpt_item', |
588 | 588 | 'edit' => '_edit_cpt_item' |
589 | - ), $this->_page_routes ); |
|
589 | + ), $this->_page_routes); |
|
590 | 590 | |
591 | 591 | |
592 | - $this->_page_config = array_merge( array( |
|
592 | + $this->_page_config = array_merge(array( |
|
593 | 593 | 'create_new' => array( |
594 | 594 | 'nav' => array( |
595 | 595 | 'label' => $this->_cpt_object->labels->add_new_item, |
@@ -611,23 +611,23 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
614 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
614 | + if ( ! isset($this->_cpt_routes[$this->_req_action])) |
|
615 | 615 | return; |
616 | 616 | |
617 | 617 | |
618 | - $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
|
618 | + $this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE; |
|
619 | 619 | //add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') ); |
620 | 620 | |
621 | 621 | |
622 | - if ( empty( $this->_cpt_object ) ) { |
|
623 | - $msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) ); |
|
624 | - throw new EE_Error( $msg ); |
|
622 | + if (empty($this->_cpt_object)) { |
|
623 | + $msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this)); |
|
624 | + throw new EE_Error($msg); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
628 | - if ( $this->_cpt_route ) { |
|
629 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
630 | - $this->_set_model_object( $id ); |
|
628 | + if ($this->_cpt_route) { |
|
629 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
630 | + $this->_set_model_object($id); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | } |
@@ -641,13 +641,13 @@ discard block |
||
641 | 641 | * @param int $id The id to retrieve the model object for. If empty we set a default object. |
642 | 642 | * @param bool $ignore_route_check |
643 | 643 | */ |
644 | - protected function _set_model_object( $id = NULL, $ignore_route_check = false ) { |
|
644 | + protected function _set_model_object($id = NULL, $ignore_route_check = false) { |
|
645 | 645 | $model = null; |
646 | 646 | if ( |
647 | - empty( $this->_cpt_model_names ) |
|
647 | + empty($this->_cpt_model_names) |
|
648 | 648 | || ( |
649 | 649 | ! $ignore_route_check |
650 | - && ! isset( $this->_cpt_routes[ $this->_req_action ] ) |
|
650 | + && ! isset($this->_cpt_routes[$this->_req_action]) |
|
651 | 651 | ) || ( |
652 | 652 | $this->_cpt_model_obj instanceof EE_CPT_Base |
653 | 653 | && $this->_cpt_model_obj->ID() === $id |
@@ -657,21 +657,21 @@ discard block |
||
657 | 657 | return; |
658 | 658 | } |
659 | 659 | //if ignore_route_check is true, then get the model name via EE_Register_CPTs |
660 | - if ( $ignore_route_check ) { |
|
660 | + if ($ignore_route_check) { |
|
661 | 661 | $model_names = EE_Register_CPTs::get_cpt_model_names(); |
662 | - $post_type = get_post_type( $id ); |
|
663 | - if ( isset( $model_names[ $post_type ] ) ) { |
|
664 | - $model = EE_Registry::instance()->load_model( $model_names[ $post_type ] ); |
|
662 | + $post_type = get_post_type($id); |
|
663 | + if (isset($model_names[$post_type])) { |
|
664 | + $model = EE_Registry::instance()->load_model($model_names[$post_type]); |
|
665 | 665 | } |
666 | 666 | } else { |
667 | - $model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] ); |
|
667 | + $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]); |
|
668 | 668 | } |
669 | 669 | |
670 | - if ( $model instanceof EEM_Base ) { |
|
671 | - $this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object(); |
|
670 | + if ($model instanceof EEM_Base) { |
|
671 | + $this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object(); |
|
672 | 672 | } |
673 | 673 | |
674 | - do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' ); |
|
674 | + do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object'); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | |
@@ -685,47 +685,47 @@ discard block |
||
685 | 685 | */ |
686 | 686 | public function admin_init_global() { |
687 | 687 | |
688 | - $post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL; |
|
688 | + $post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL; |
|
689 | 689 | |
690 | 690 | //its possible this is a new save so let's catch that instead |
691 | - $post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post; |
|
691 | + $post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post; |
|
692 | 692 | $post_type = $post ? $post->post_type : false; |
693 | 693 | |
694 | 694 | $current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork'; |
695 | 695 | |
696 | - $route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
696 | + $route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
697 | 697 | |
698 | - add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 ); |
|
699 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 ); |
|
698 | + add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3); |
|
699 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
700 | 700 | |
701 | 701 | |
702 | - if ( $post_type === $route_to_check ) { |
|
703 | - add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 ); |
|
702 | + if ($post_type === $route_to_check) { |
|
703 | + add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2); |
|
704 | 704 | //catch trashed wp redirect |
705 | - add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 ); |
|
705 | + add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | //now let's filter redirect if we're on a revision page and the revision is for an event CPT. |
709 | - $revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL; |
|
709 | + $revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
|
710 | 710 | |
711 | 711 | /**var_dump($this->_req_data); |
712 | 712 | exit();/**/ |
713 | 713 | |
714 | - if ( !empty( $revision ) ) { |
|
715 | - $action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL; |
|
714 | + if ( ! empty($revision)) { |
|
715 | + $action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL; |
|
716 | 716 | |
717 | 717 | //doing a restore? |
718 | - if ( !empty( $action ) && $action == 'restore' ) { |
|
718 | + if ( ! empty($action) && $action == 'restore') { |
|
719 | 719 | |
720 | 720 | //get post for revision |
721 | - $rev_post = get_post( $revision ); |
|
722 | - $rev_parent = get_post( $rev_post->post_parent ); |
|
721 | + $rev_post = get_post($revision); |
|
722 | + $rev_parent = get_post($rev_post->post_parent); |
|
723 | 723 | |
724 | 724 | //only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts. |
725 | - if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) { |
|
726 | - add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 ); |
|
725 | + if ($rev_parent && $rev_parent->post_type == $this->page_slug) { |
|
726 | + add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2); |
|
727 | 727 | //restores of revisions |
728 | - add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 ); |
|
728 | + add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2); |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
@@ -734,15 +734,15 @@ discard block |
||
734 | 734 | //NOTE we ONLY want to run these hooks if we're on the right class for the given post type. Otherwise we could see some really freaky things happen! |
735 | 735 | |
736 | 736 | |
737 | - if ( $post_type && $post_type === $route_to_check ) { |
|
737 | + if ($post_type && $post_type === $route_to_check) { |
|
738 | 738 | //$post_id, $post |
739 | - add_action('save_post', array( $this, 'insert_update'), 10, 3 ); |
|
739 | + add_action('save_post', array($this, 'insert_update'), 10, 3); |
|
740 | 740 | |
741 | 741 | //$post_id |
742 | - add_action('trashed_post', array( $this, 'before_trash_cpt_item' ), 10 ); |
|
743 | - add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 ); |
|
744 | - add_action('untrashed_post', array( $this, 'before_restore_cpt_item'), 10 ); |
|
745 | - add_action('after_delete_post', array( $this, 'before_delete_cpt_item'), 10 ); |
|
742 | + add_action('trashed_post', array($this, 'before_trash_cpt_item'), 10); |
|
743 | + add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10); |
|
744 | + add_action('untrashed_post', array($this, 'before_restore_cpt_item'), 10); |
|
745 | + add_action('after_delete_post', array($this, 'before_delete_cpt_item'), 10); |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | } |
@@ -756,13 +756,13 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @param int $post_id |
758 | 758 | */ |
759 | - public function before_trash_cpt_item( $post_id ) { |
|
760 | - $this->_set_model_object( $post_id, true ); |
|
759 | + public function before_trash_cpt_item($post_id) { |
|
760 | + $this->_set_model_object($post_id, true); |
|
761 | 761 | //if our cpt object isn't existent then get out immediately. |
762 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) { |
|
762 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) { |
|
763 | 763 | return; |
764 | 764 | } |
765 | - $this->trash_cpt_item( $post_id ); |
|
765 | + $this->trash_cpt_item($post_id); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | |
@@ -772,13 +772,13 @@ discard block |
||
772 | 772 | * |
773 | 773 | * @param $post_id |
774 | 774 | */ |
775 | - public function before_restore_cpt_item( $post_id ) { |
|
776 | - $this->_set_model_object( $post_id, true ); |
|
775 | + public function before_restore_cpt_item($post_id) { |
|
776 | + $this->_set_model_object($post_id, true); |
|
777 | 777 | //if our cpt object isn't existent then get out immediately. |
778 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) { |
|
778 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) { |
|
779 | 779 | return; |
780 | 780 | } |
781 | - $this->restore_cpt_item( $post_id ); |
|
781 | + $this->restore_cpt_item($post_id); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -787,13 +787,13 @@ discard block |
||
787 | 787 | * Execute some basic checks before calling the delete_cpt_item method in the child class. |
788 | 788 | * @param $post_id |
789 | 789 | */ |
790 | - public function before_delete_cpt_item( $post_id ) { |
|
791 | - $this->_set_model_object( $post_id, true ); |
|
790 | + public function before_delete_cpt_item($post_id) { |
|
791 | + $this->_set_model_object($post_id, true); |
|
792 | 792 | //if our cpt object isn't existent then get out immediately. |
793 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) { |
|
793 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) { |
|
794 | 794 | return; |
795 | 795 | } |
796 | - $this->delete_cpt_item( $post_id ); |
|
796 | + $this->delete_cpt_item($post_id); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | |
@@ -805,15 +805,15 @@ discard block |
||
805 | 805 | * @return void |
806 | 806 | */ |
807 | 807 | public function verify_cpt_object() { |
808 | - $label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
808 | + $label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
809 | 809 | // verify event object |
810 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
811 | - throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) ); |
|
810 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
811 | + throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label)); |
|
812 | 812 | } |
813 | 813 | //if auto-draft then throw an error |
814 | - if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) { |
|
814 | + if ($this->_cpt_model_obj->get('status') == 'auto-draft') { |
|
815 | 815 | EE_Error::overwrite_errors(); |
816 | - EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ ); |
|
816 | + EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__); |
|
817 | 817 | } |
818 | 818 | } |
819 | 819 | |
@@ -842,22 +842,22 @@ discard block |
||
842 | 842 | public function load_global_scripts_styles() { |
843 | 843 | parent::load_global_scripts_styles(); |
844 | 844 | |
845 | - if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
845 | + if ($this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
846 | 846 | //setup custom post status object for localize script but only if we've got a cpt object |
847 | 847 | $statuses = $this->_cpt_model_obj->get_custom_post_statuses(); |
848 | 848 | |
849 | - if ( !empty($statuses) ) { |
|
849 | + if ( ! empty($statuses)) { |
|
850 | 850 | //get ALL statuses! |
851 | 851 | $statuses = $this->_cpt_model_obj->get_all_post_statuses(); |
852 | 852 | //setup object |
853 | 853 | $ee_cpt_statuses = array(); |
854 | - foreach ( $statuses as $status => $label ) { |
|
854 | + foreach ($statuses as $status => $label) { |
|
855 | 855 | $ee_cpt_statuses[$status] = array( |
856 | 856 | 'label' => $label, |
857 | - 'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label ) |
|
857 | + 'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label) |
|
858 | 858 | ); |
859 | 859 | } |
860 | - wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses ); |
|
860 | + wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses); |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | } |
@@ -872,11 +872,11 @@ discard block |
||
872 | 872 | * @param bool $update Whether this is an update or a new save. |
873 | 873 | * @return void |
874 | 874 | */ |
875 | - public function insert_update( $post_id, $post, $update ) { |
|
875 | + public function insert_update($post_id, $post, $update) { |
|
876 | 876 | |
877 | 877 | //make sure that if this is a revision OR trash action that we don't do any updates! |
878 | 878 | if ( |
879 | - isset( $this->_req_data['action'] ) |
|
879 | + isset($this->_req_data['action']) |
|
880 | 880 | && ( |
881 | 881 | $this->_req_data['action'] == 'restore' |
882 | 882 | || $this->_req_data['action'] == 'trash' |
@@ -885,10 +885,10 @@ discard block |
||
885 | 885 | return; |
886 | 886 | } |
887 | 887 | |
888 | - $this->_set_model_object( $post_id, true ); |
|
888 | + $this->_set_model_object($post_id, true); |
|
889 | 889 | |
890 | 890 | //if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit. |
891 | - if ( $update |
|
891 | + if ($update |
|
892 | 892 | && ( |
893 | 893 | ! $this->_cpt_model_obj instanceof EE_CPT_Base |
894 | 894 | || $this->_cpt_model_obj->ID() !== $post_id |
@@ -909,19 +909,19 @@ discard block |
||
909 | 909 | }/**/ //TODO reactivate after autosave is implemented in 4.2 |
910 | 910 | |
911 | 911 | //take care of updating any selected page_template IF this cpt supports it. |
912 | - if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) { |
|
912 | + if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) { |
|
913 | 913 | $post->page_template = $this->_req_data['page_template']; |
914 | - $page_templates = wp_get_theme()->get_page_templates( $post ); |
|
915 | - if ( 'default' != $this->_req_data['page_template'] && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) { |
|
916 | - EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
914 | + $page_templates = wp_get_theme()->get_page_templates($post); |
|
915 | + if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) { |
|
916 | + EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
917 | 917 | } else { |
918 | - update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] ); |
|
918 | + update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | |
922 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
922 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
923 | 923 | return; //TODO we'll remove this after reimplementing autosave in 4.2 |
924 | - $this->_insert_update_cpt_item( $post_id, $post ); |
|
924 | + $this->_insert_update_cpt_item($post_id, $post); |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | |
@@ -934,15 +934,15 @@ discard block |
||
934 | 934 | * @param int $post_id ID of the post |
935 | 935 | * @return void |
936 | 936 | */ |
937 | - public function dont_permanently_delete_ee_cpts( $post_id ) { |
|
937 | + public function dont_permanently_delete_ee_cpts($post_id) { |
|
938 | 938 | //only do this if we're actually processing one of our CPTs |
939 | 939 | //if our cpt object isn't existent then get out immediately. |
940 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
940 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
941 | 941 | return; |
942 | 942 | } |
943 | 943 | |
944 | - delete_post_meta( $post_id, '_wp_trash_meta_status' ); |
|
945 | - delete_post_meta( $post_id, '_wp_trash_meta_time'); |
|
944 | + delete_post_meta($post_id, '_wp_trash_meta_status'); |
|
945 | + delete_post_meta($post_id, '_wp_trash_meta_time'); |
|
946 | 946 | |
947 | 947 | //our cpts may have comments so let's take care of that too |
948 | 948 | delete_post_meta($post_id, '_wp_trash_meta_comments_status'); |
@@ -960,14 +960,14 @@ discard block |
||
960 | 960 | * @param int $revision_id ID of revision being restored |
961 | 961 | * @return void |
962 | 962 | */ |
963 | - public function restore_revision( $post_id, $revision_id ) { |
|
964 | - $this->_restore_cpt_item( $post_id, $revision_id ); |
|
963 | + public function restore_revision($post_id, $revision_id) { |
|
964 | + $this->_restore_cpt_item($post_id, $revision_id); |
|
965 | 965 | |
966 | 966 | //global action |
967 | - do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
967 | + do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
968 | 968 | |
969 | 969 | //class specific action so you can limit hooking into a specific page. |
970 | - do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id ); |
|
970 | + do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id); |
|
971 | 971 | } |
972 | 972 | |
973 | 973 | |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | * @param int $revision_id ID of revision for item |
979 | 979 | * @return void |
980 | 980 | */ |
981 | - abstract protected function _restore_cpt_item( $post_id, $revision_id ); |
|
981 | + abstract protected function _restore_cpt_item($post_id, $revision_id); |
|
982 | 982 | |
983 | 983 | |
984 | 984 | |
@@ -997,9 +997,9 @@ discard block |
||
997 | 997 | */ |
998 | 998 | public function modify_current_screen() { |
999 | 999 | //ONLY do this if the current page_route IS a cpt route |
1000 | - if ( !$this->_cpt_route ) return; |
|
1000 | + if ( ! $this->_cpt_route) return; |
|
1001 | 1001 | //routing things REALLY early b/c this is a cpt admin page |
1002 | - set_current_screen( $this->_cpt_routes[$this->_req_action]); |
|
1002 | + set_current_screen($this->_cpt_routes[$this->_req_action]); |
|
1003 | 1003 | $this->_current_screen = get_current_screen(); |
1004 | 1004 | $this->_current_screen->base = 'event-espresso'; |
1005 | 1005 | $this->_add_help_tabs(); //we make sure we add any help tabs back in! |
@@ -1020,8 +1020,8 @@ discard block |
||
1020 | 1020 | * @param string $title The new title (or existing if there is no editor_title defined) |
1021 | 1021 | * @return string |
1022 | 1022 | */ |
1023 | - public function add_custom_editor_default_title( $title ) { |
|
1024 | - return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
1023 | + public function add_custom_editor_default_title($title) { |
|
1024 | + return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
@@ -1034,11 +1034,11 @@ discard block |
||
1034 | 1034 | * @param bool $allow_slugs Whether to allow post slugs in the shortlink. |
1035 | 1035 | * @return string |
1036 | 1036 | */ |
1037 | - public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
|
1038 | - if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
|
1039 | - $post = get_post( $id ); |
|
1040 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
1041 | - $shortlink = home_url('?p=' . $post->ID); |
|
1037 | + public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) { |
|
1038 | + if ( ! empty($id) && '' != get_option('permalink_structure')) { |
|
1039 | + $post = get_post($id); |
|
1040 | + if (isset($post->post_type) && $this->page_slug == $post->post_type) |
|
1041 | + $shortlink = home_url('?p='.$post->ID); |
|
1042 | 1042 | } |
1043 | 1043 | return $shortlink; |
1044 | 1044 | } |
@@ -1051,10 +1051,10 @@ discard block |
||
1051 | 1051 | * @return void |
1052 | 1052 | */ |
1053 | 1053 | public function route_admin_request() { |
1054 | - if ( $this->_cpt_route ) return; |
|
1054 | + if ($this->_cpt_route) return; |
|
1055 | 1055 | try { |
1056 | 1056 | $this->_route_admin_request(); |
1057 | - } catch ( EE_Error $e ) { |
|
1057 | + } catch (EE_Error $e) { |
|
1058 | 1058 | $e->get_error(); |
1059 | 1059 | } |
1060 | 1060 | } |
@@ -1067,12 +1067,12 @@ discard block |
||
1067 | 1067 | * @return string html |
1068 | 1068 | */ |
1069 | 1069 | public function cpt_post_form_hidden_input() { |
1070 | - echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />'; |
|
1070 | + echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />'; |
|
1071 | 1071 | |
1072 | 1072 | //we're also going to add the route value and the current page so we can direct autosave parsing correctly |
1073 | 1073 | echo '<div id="ee-cpt-hidden-inputs">'; |
1074 | - echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />'; |
|
1075 | - echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />'; |
|
1074 | + echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />'; |
|
1075 | + echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />'; |
|
1076 | 1076 | echo '</div>'; |
1077 | 1077 | } |
1078 | 1078 | |
@@ -1085,12 +1085,12 @@ discard block |
||
1085 | 1085 | * @param int $status Status for http header |
1086 | 1086 | * @return string new (or original) url to redirect to. |
1087 | 1087 | */ |
1088 | - public function revision_redirect( $location, $status ) { |
|
1088 | + public function revision_redirect($location, $status) { |
|
1089 | 1089 | //get revision |
1090 | 1090 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
1091 | 1091 | |
1092 | 1092 | //can't do anything without revision so let's get out if not present |
1093 | - if ( empty( $rev_id ) ) |
|
1093 | + if (empty($rev_id)) |
|
1094 | 1094 | return $location; |
1095 | 1095 | |
1096 | 1096 | //get rev_post_data |
@@ -1104,8 +1104,8 @@ discard block |
||
1104 | 1104 | 'message' => 5 |
1105 | 1105 | ); |
1106 | 1106 | |
1107 | - $this->_process_notices( $query_args, TRUE ); |
|
1108 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1107 | + $this->_process_notices($query_args, TRUE); |
|
1108 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | |
@@ -1118,16 +1118,16 @@ discard block |
||
1118 | 1118 | * @param string $context optional, defaults to display. How to write the '&' |
1119 | 1119 | * @return string the link |
1120 | 1120 | */ |
1121 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
1122 | - $post = get_post( $id ); |
|
1123 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1121 | + public function modify_edit_post_link($link, $id, $context) { |
|
1122 | + $post = get_post($id); |
|
1123 | + if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]) |
|
1124 | 1124 | return $link; |
1125 | 1125 | $query_args = array( |
1126 | 1126 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1127 | 1127 | 'post' => $id |
1128 | 1128 | ); |
1129 | 1129 | |
1130 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1130 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | |
@@ -1139,12 +1139,12 @@ discard block |
||
1139 | 1139 | * @param bool $force_delete whether this is forcing a hard delete instead of trash |
1140 | 1140 | * @return string new delete link |
1141 | 1141 | */ |
1142 | - public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
|
1142 | + public function modify_delete_post_link($delete_link, $post_id, $force_delete) { |
|
1143 | 1143 | $post = get_post($post_id); |
1144 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1144 | + if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])) |
|
1145 | 1145 | return $delete_link; |
1146 | 1146 | |
1147 | - return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
|
1147 | + return add_query_arg(array('current_route' => 'trash'), $delete_link); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | |
@@ -1155,16 +1155,16 @@ discard block |
||
1155 | 1155 | * @param string $status status |
1156 | 1156 | * @return string url to redirect to |
1157 | 1157 | */ |
1158 | - public function cpt_trash_post_location_redirect( $location, $status ) { |
|
1159 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1158 | + public function cpt_trash_post_location_redirect($location, $status) { |
|
1159 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post'])) |
|
1160 | 1160 | return $location; |
1161 | 1161 | |
1162 | - $post = get_post( $this->_req_data['post'] ); |
|
1163 | - $query_args = array( 'action' => 'default' ); |
|
1162 | + $post = get_post($this->_req_data['post']); |
|
1163 | + $query_args = array('action' => 'default'); |
|
1164 | 1164 | $this->_cpt_object = get_post_type_object($post->post_type); |
1165 | - EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) ); |
|
1166 | - $this->_process_notices( $query_args, TRUE ); |
|
1167 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1165 | + EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name)); |
|
1166 | + $this->_process_notices($query_args, TRUE); |
|
1167 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | |
@@ -1179,21 +1179,21 @@ discard block |
||
1179 | 1179 | * @param string $post_id This is the 'ID' value of the wp_posts table |
1180 | 1180 | * @return string the new location to redirect to |
1181 | 1181 | */ |
1182 | - public function cpt_post_location_redirect( $location, $post_id ) { |
|
1182 | + public function cpt_post_location_redirect($location, $post_id) { |
|
1183 | 1183 | //we DO have a match so let's setup the url |
1184 | 1184 | //we have to get the post to determine our route |
1185 | 1185 | $post = get_post($post_id); |
1186 | 1186 | $edit_route = $this->_cpt_edit_routes[$post->post_type]; |
1187 | 1187 | |
1188 | 1188 | //shared query_args |
1189 | - $query_args = array( 'action' => $edit_route, 'post' => $post_id ); |
|
1189 | + $query_args = array('action' => $edit_route, 'post' => $post_id); |
|
1190 | 1190 | $admin_url = $this->_admin_base_url; |
1191 | 1191 | // $append = ''; |
1192 | 1192 | |
1193 | - if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) { |
|
1194 | - $status = get_post_status( $post_id ); |
|
1195 | - if ( isset( $this->_req_data['publish'] ) ) { |
|
1196 | - switch ( $status ) { |
|
1193 | + if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) { |
|
1194 | + $status = get_post_status($post_id); |
|
1195 | + if (isset($this->_req_data['publish'])) { |
|
1196 | + switch ($status) { |
|
1197 | 1197 | case 'pending': |
1198 | 1198 | $message = 8; |
1199 | 1199 | break; |
@@ -1206,13 +1206,13 @@ discard block |
||
1206 | 1206 | } else { |
1207 | 1207 | $message = 'draft' == $status ? 10 : 1; |
1208 | 1208 | } |
1209 | - } else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) { |
|
1209 | + } else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) { |
|
1210 | 1210 | $message = 2; |
1211 | 1211 | // $append = '#postcustom'; |
1212 | - } else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) { |
|
1212 | + } else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) { |
|
1213 | 1213 | $message = 3; |
1214 | 1214 | // $append = '#postcustom'; |
1215 | - } elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) { |
|
1215 | + } elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') { |
|
1216 | 1216 | $message = 7; |
1217 | 1217 | } else { |
1218 | 1218 | $message = 4; |
@@ -1220,11 +1220,11 @@ discard block |
||
1220 | 1220 | |
1221 | 1221 | //change the message if the post type is not viewable on the frontend |
1222 | 1222 | $this->_cpt_object = get_post_type_object($post->post_type); |
1223 | - $message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1223 | + $message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1224 | 1224 | |
1225 | - $query_args = array_merge( array( 'message' => $message ), $query_args ); |
|
1226 | - $this->_process_notices( $query_args, TRUE ); |
|
1227 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1225 | + $query_args = array_merge(array('message' => $message), $query_args); |
|
1226 | + $this->_process_notices($query_args, TRUE); |
|
1227 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | |
@@ -1256,10 +1256,10 @@ discard block |
||
1256 | 1256 | * @param array $messages the original messages array |
1257 | 1257 | * @return array the new messages array |
1258 | 1258 | */ |
1259 | - public function post_update_messages( $messages ) { |
|
1259 | + public function post_update_messages($messages) { |
|
1260 | 1260 | global $post; |
1261 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1262 | - $id = empty( $id ) && is_object( $post ) ? $post->ID : NULL; |
|
1261 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1262 | + $id = empty($id) && is_object($post) ? $post->ID : NULL; |
|
1263 | 1263 | |
1264 | 1264 | // $post_type = $post ? $post->post_type : false; |
1265 | 1265 | |
@@ -1272,9 +1272,9 @@ discard block |
||
1272 | 1272 | 0 => '', //Unused. Messages start at index 1. |
1273 | 1273 | |
1274 | 1274 | 1 => sprintf( |
1275 | - __( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1275 | + __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1276 | 1276 | $this->_cpt_object->labels->singular_name, |
1277 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1277 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1278 | 1278 | '</a>' |
1279 | 1279 | ), |
1280 | 1280 | |
@@ -1282,38 +1282,38 @@ discard block |
||
1282 | 1282 | |
1283 | 1283 | 3 => __('Custom field deleted.'), |
1284 | 1284 | |
1285 | - 4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1285 | + 4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1286 | 1286 | |
1287 | - 5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE, |
|
1287 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE, |
|
1288 | 1288 | |
1289 | 1289 | 6 => sprintf( |
1290 | - __( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1290 | + __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1291 | 1291 | $this->_cpt_object->labels->singular_name, |
1292 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1292 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1293 | 1293 | '</a>' |
1294 | 1294 | ), |
1295 | 1295 | |
1296 | - 7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1296 | + 7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1297 | 1297 | |
1298 | 1298 | 8 => sprintf( |
1299 | 1299 | __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'), |
1300 | 1300 | $this->_cpt_object->labels->singular_name, |
1301 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">', |
|
1301 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">', |
|
1302 | 1302 | '</a>' |
1303 | 1303 | ), |
1304 | 1304 | |
1305 | 1305 | 9 => sprintf( |
1306 | - __( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1306 | + __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1307 | 1307 | $this->_cpt_object->labels->singular_name, |
1308 | - '<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>', |
|
1309 | - '<a target="_blank" href="' . esc_url( get_permalink( $id )), |
|
1308 | + '<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>', |
|
1309 | + '<a target="_blank" href="'.esc_url(get_permalink($id)), |
|
1310 | 1310 | '</a>' |
1311 | 1311 | ), |
1312 | 1312 | |
1313 | 1313 | 10 => sprintf( |
1314 | 1314 | __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'), |
1315 | 1315 | $this->_cpt_object->labels->singular_name, |
1316 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) , |
|
1316 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))), |
|
1317 | 1317 | '</a>' |
1318 | 1318 | ) |
1319 | 1319 | ); |
@@ -1340,24 +1340,24 @@ discard block |
||
1340 | 1340 | $post_type_object = $this->_cpt_object; |
1341 | 1341 | $title = $post_type_object->labels->add_new_item; |
1342 | 1342 | $editing = TRUE; |
1343 | - wp_enqueue_script( 'autosave' ); |
|
1344 | - $post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE ); |
|
1343 | + wp_enqueue_script('autosave'); |
|
1344 | + $post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE); |
|
1345 | 1345 | $post_ID = $post->ID; |
1346 | 1346 | $is_IE = $is_IE; |
1347 | 1347 | |
1348 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1348 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1349 | 1349 | |
1350 | 1350 | //modify the default editor title field with default title. |
1351 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1351 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1352 | 1352 | |
1353 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1353 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | |
1357 | 1357 | |
1358 | 1358 | |
1359 | 1359 | public function add_new_admin_page_global() { |
1360 | - $admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php'; |
|
1360 | + $admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php'; |
|
1361 | 1361 | ?> |
1362 | 1362 | <script type="text/javascript"> |
1363 | 1363 | adminpage = '<?php echo $admin_page; ?>'; |
@@ -1379,16 +1379,16 @@ discard block |
||
1379 | 1379 | */ |
1380 | 1380 | protected function _edit_cpt_item() { |
1381 | 1381 | global $post, $title, $is_IE, $post_type, $post_type_object; |
1382 | - $post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1383 | - $post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL; |
|
1382 | + $post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1383 | + $post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL; |
|
1384 | 1384 | |
1385 | - if ( empty ( $post ) ) { |
|
1386 | - wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); |
|
1385 | + if (empty ($post)) { |
|
1386 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
1390 | - wp_set_post_lock( $post_id ); |
|
1391 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
1389 | + if ( ! empty($_GET['get-post-lock'])) { |
|
1390 | + wp_set_post_lock($post_id); |
|
1391 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
1392 | 1392 | exit(); |
1393 | 1393 | } |
1394 | 1394 | |
@@ -1398,32 +1398,32 @@ discard block |
||
1398 | 1398 | $post_type = $this->_cpt_routes[$this->_req_action]; |
1399 | 1399 | $post_type_object = $this->_cpt_object; |
1400 | 1400 | |
1401 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
1402 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
1401 | + if ( ! wp_check_post_lock($post->ID)) { |
|
1402 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
1403 | 1403 | //wp_enqueue_script('autosave'); |
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | $title = $this->_cpt_object->labels->edit_item; |
1407 | 1407 | |
1408 | - add_action('admin_footer', '_admin_notice_post_locked' ); |
|
1408 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
1409 | 1409 | |
1410 | - if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) { |
|
1411 | - $create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this ); |
|
1410 | + if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) { |
|
1411 | + $create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this); |
|
1412 | 1412 | |
1413 | - $post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' ); |
|
1413 | + $post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php'); |
|
1414 | 1414 | } |
1415 | 1415 | |
1416 | - if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) { |
|
1416 | + if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) { |
|
1417 | 1417 | wp_enqueue_script('admin-comments'); |
1418 | 1418 | enqueue_comment_hotkeys_js(); |
1419 | 1419 | } |
1420 | 1420 | |
1421 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1421 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1422 | 1422 | |
1423 | 1423 | //modify the default editor title field with default title. |
1424 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1424 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1425 | 1425 | |
1426 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1426 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1427 | 1427 | |
1428 | 1428 | } |
1429 | 1429 |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $gateway = $payment_method->type_obj()->get_gateway(); |
97 | 97 | if ( |
98 | 98 | $gateway instanceof EE_Offsite_Gateway |
99 | - && $gateway->handle_IPN_in_this_request( |
|
99 | + && $gateway->handle_IPN_in_this_request( |
|
100 | 100 | \EE_Registry::instance()->REQ->params(), |
101 | 101 | true |
102 | 102 | ) |
@@ -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 | * EES_Espresso_Txn_Page |
4 | 4 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | */ |
29 | 29 | public static function set_hooks() { |
30 | - add_action( 'wp_loaded', array( 'EES_Espresso_Txn_Page', 'set_definitions' ), 2 ); |
|
30 | + add_action('wp_loaded', array('EES_Espresso_Txn_Page', 'set_definitions'), 2); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public static function set_definitions() { |
51 | - define( 'TXN_PAGE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
52 | - define( 'TXN_PAGE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
51 | + define('TXN_PAGE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
52 | + define('TXN_PAGE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | * @throws \Exception |
67 | 67 | * @throws \EE_Error |
68 | 68 | */ |
69 | - public function run( WP $WP ) { |
|
69 | + public function run(WP $WP) { |
|
70 | 70 | $this->_current_txn = null; |
71 | - if ( EE_Registry::instance()->REQ->is_set('e_reg_url_link' )){ |
|
71 | + if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
72 | 72 | /** @var EEM_Transaction $EEM_Transaction */ |
73 | - $EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' ); |
|
73 | + $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
74 | 74 | $this->_current_txn = $EEM_Transaction->get_transaction_from_reg_url_link(); |
75 | 75 | } |
76 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
76 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
77 | 77 | $payment_method = null; |
78 | - $payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', null ); |
|
79 | - if( $payment_method_slug ) { |
|
80 | - $payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug ); |
|
78 | + $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null); |
|
79 | + if ($payment_method_slug) { |
|
80 | + $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug); |
|
81 | 81 | } |
82 | 82 | |
83 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->is_off_site() ) { |
|
83 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) { |
|
84 | 84 | $gateway = $payment_method->type_obj()->get_gateway(); |
85 | 85 | if ( |
86 | 86 | $gateway instanceof EE_Offsite_Gateway |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | ) |
91 | 91 | ) { |
92 | 92 | /** @type EE_Payment_Processor $payment_processor */ |
93 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
94 | - $payment_processor->process_ipn( $_REQUEST, $this->_current_txn, $payment_method ); |
|
93 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
94 | + $payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | //allow gateways to add a filter to stop rendering the page |
98 | - if( apply_filters( 'FHEE__EES_Espresso_Txn_Page__run__exit', FALSE ) ){ |
|
98 | + if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) { |
|
99 | 99 | exit; |
100 | 100 | } |
101 | 101 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @param array $attributes |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - public function process_shortcode( $attributes = array() ) { |
|
116 | - return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' ); |
|
115 | + public function process_shortcode($attributes = array()) { |
|
116 | + return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | /** |
186 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
187 | - * |
|
188 | - * @access public |
|
189 | - * @return void |
|
190 | - */ |
|
186 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
187 | + * |
|
188 | + * @access public |
|
189 | + * @return void |
|
190 | + */ |
|
191 | 191 | public function init() { |
192 | 192 | EE_Admin::debug_log( __METHOD__ ); |
193 | 193 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | |
475 | 475 | |
476 | 476 | /** |
477 | - * admin_init |
|
478 | - * |
|
479 | - * @access public |
|
480 | - * @return void |
|
481 | - */ |
|
477 | + * admin_init |
|
478 | + * |
|
479 | + * @access public |
|
480 | + * @return void |
|
481 | + */ |
|
482 | 482 | public function admin_init() { |
483 | 483 | |
484 | 484 | /** |
@@ -631,11 +631,11 @@ discard block |
||
631 | 631 | |
632 | 632 | |
633 | 633 | /** |
634 | - * dismiss_persistent_admin_notice |
|
635 | - * |
|
636 | - * @access public |
|
637 | - * @return void |
|
638 | - */ |
|
634 | + * dismiss_persistent_admin_notice |
|
635 | + * |
|
636 | + * @access public |
|
637 | + * @return void |
|
638 | + */ |
|
639 | 639 | public function dismiss_ee_nag_notice_callback() { |
640 | 640 | EE_Error::dismiss_persistent_admin_notice(); |
641 | 641 | } |
@@ -1,4 +1,6 @@ |
||
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 | * |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function instance() { |
42 | 42 | // check if class object is instantiated |
43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
44 | 44 | self::$_instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | // define global EE_Admin constants |
58 | 58 | $this->_define_all_constants(); |
59 | 59 | // set autoloaders for our admin page classes based on included path information |
60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
61 | 61 | // admin hooks |
62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
63 | 63 | // load EE_Request_Handler early |
64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
66 | 66 | // post shortcode tracking |
67 | 67 | add_action( |
68 | 68 | 'AHEE__EE_System__initialize_last', |
69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
70 | 70 | ); |
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin === $main_file ) { |
|
122 | + if ($plugin === $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
177 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
178 | 178 | //ok so we want to enable the entire admin |
179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
182 | 182 | //at a glance dashboard widget |
183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
186 | 186 | } |
187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
189 | 189 | try { |
190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
192 | - } catch ( EE_Error $e ) { |
|
191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
192 | + } catch (EE_Error $e) { |
|
193 | 193 | $e->get_error(); |
194 | 194 | } |
195 | 195 | } |
196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @param object $post_type WP post type object |
212 | 212 | * @return object WP post type object |
213 | 213 | */ |
214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
214 | + public function remove_pages_from_nav_menu($post_type) { |
|
215 | 215 | //if this isn't the "pages" post type let's get out |
216 | - if ( $post_type->name !== 'page' ) { |
|
216 | + if ($post_type->name !== 'page') { |
|
217 | 217 | return $post_type; |
218 | 218 | } |
219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
235 | 235 | global $wp_meta_boxes, $pagenow; |
236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | $user = wp_get_current_user(); |
240 | 240 | //has this been done yet? |
241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
247 | 247 | |
248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
248 | + if (is_array($hidden_meta_boxes)) { |
|
249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
251 | + unset($hidden_meta_boxes[$key]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | public function register_custom_nav_menu_boxes() { |
276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string the (maybe) modified link |
291 | 291 | */ |
292 | - public function modify_edit_post_link( $link, $id ) { |
|
293 | - if ( ! $post = get_post( $id ) ){ |
|
292 | + public function modify_edit_post_link($link, $id) { |
|
293 | + if ( ! $post = get_post($id)) { |
|
294 | 294 | return $link; |
295 | 295 | } |
296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
296 | + if ($post->post_type === 'espresso_attendees') { |
|
297 | 297 | $query_args = array( |
298 | 298 | 'action' => 'edit_attendee', |
299 | 299 | 'post' => $id |
300 | 300 | ); |
301 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
301 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
302 | 302 | } |
303 | 303 | return $link; |
304 | 304 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | global $nav_menu_selected_id; |
311 | 311 | |
312 | 312 | $db_fields = false; |
313 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
313 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
314 | 314 | $current_tab = 'event-archives'; |
315 | 315 | |
316 | 316 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
331 | 331 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
332 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
333 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
332 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
333 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
335 | 335 | </a> |
336 | 336 | </li> |
337 | 337 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | <?php */ ?> |
350 | 350 | |
351 | 351 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
352 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
352 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
353 | 353 | ?>"> |
354 | 354 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
355 | 355 | <?php |
356 | 356 | $pages = $this->_get_extra_nav_menu_pages_items(); |
357 | 357 | $args['walker'] = $walker; |
358 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
358 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
359 | 359 | ?> |
360 | 360 | </ul> |
361 | 361 | </div><!-- /.tabs-panel --> |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | <p class="button-controls"> |
364 | 364 | <span class="list-controls"> |
365 | 365 | <a href="<?php |
366 | - echo esc_url( add_query_arg( |
|
366 | + echo esc_url(add_query_arg( |
|
367 | 367 | array( |
368 | 368 | 'extra-nav-menu-pages-tab' => 'event-archives', |
369 | 369 | 'selectall' => 1, |
370 | 370 | ), |
371 | - remove_query_arg( $removed_args ) |
|
371 | + remove_query_arg($removed_args) |
|
372 | 372 | )); |
373 | 373 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
374 | 374 | </span> |
375 | 375 | |
376 | 376 | <span class="add-to-menu"> |
377 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
377 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
378 | 378 | <span class="spinner"></span> |
379 | 379 | </span> |
380 | 380 | </p> |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | private function _get_extra_nav_menu_pages_items() { |
396 | 396 | $menuitems[] = array( |
397 | 397 | 'title' => __('Event List', 'event_espresso'), |
398 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
398 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
399 | 399 | 'description' => __('Archive page for all events.', 'event_espresso') |
400 | 400 | ); |
401 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
401 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param $menu_item_values |
411 | 411 | * @return stdClass |
412 | 412 | */ |
413 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
413 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
414 | 414 | $menu_item = new stdClass(); |
415 | 415 | $keys = array( |
416 | 416 | 'ID' => 0, |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'xfn' => '' |
431 | 431 | ); |
432 | 432 | |
433 | - foreach ( $keys as $key => $value) { |
|
434 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
433 | + foreach ($keys as $key => $value) { |
|
434 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
435 | 435 | } |
436 | 436 | return $menu_item; |
437 | 437 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | * - check if doing post processing of one of EE CPTs |
471 | 471 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
472 | 472 | */ |
473 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
474 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
475 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
473 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
474 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
475 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
482 | 482 | */ |
483 | 483 | global $pagenow; |
484 | - if ( $pagenow === 'options-reading.php' ) { |
|
485 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
484 | + if ($pagenow === 'options-reading.php') { |
|
485 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -494,25 +494,25 @@ discard block |
||
494 | 494 | * @param string $output Current output. |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - public function modify_dropdown_pages( $output ) { |
|
497 | + public function modify_dropdown_pages($output) { |
|
498 | 498 | //get critical pages |
499 | 499 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
500 | 500 | |
501 | 501 | //split current output by line break for easier parsing. |
502 | - $split_output = explode( "\n", $output ); |
|
502 | + $split_output = explode("\n", $output); |
|
503 | 503 | |
504 | 504 | //loop through to remove any critical pages from the array. |
505 | - foreach ( $critical_pages as $page_id ) { |
|
506 | - $needle = 'value="' . $page_id . '"'; |
|
507 | - foreach( $split_output as $key => $haystack ) { |
|
508 | - if( strpos( $haystack, $needle ) !== false ) { |
|
509 | - unset( $split_output[$key] ); |
|
505 | + foreach ($critical_pages as $page_id) { |
|
506 | + $needle = 'value="'.$page_id.'"'; |
|
507 | + foreach ($split_output as $key => $haystack) { |
|
508 | + if (strpos($haystack, $needle) !== false) { |
|
509 | + unset($split_output[$key]); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | 514 | //replace output with the new contents |
515 | - return implode( "\n", $split_output ); |
|
515 | + return implode("\n", $split_output); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -526,36 +526,36 @@ discard block |
||
526 | 526 | public function enqueue_admin_scripts() { |
527 | 527 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
528 | 528 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
529 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
529 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
530 | 530 | // register cookie script for future dependencies |
531 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
531 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
532 | 532 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
533 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
533 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
534 | 534 | // register jQuery Validate |
535 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
535 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
536 | 536 | } |
537 | 537 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
538 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
538 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
539 | 539 | //joyride style |
540 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
542 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
540 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
542 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
543 | 543 | //joyride JS |
544 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
545 | 545 | // wanna go for a joyride? |
546 | 546 | wp_enqueue_style('ee-joyride-css'); |
547 | 547 | wp_enqueue_script('jquery-joyride'); |
548 | 548 | } |
549 | 549 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
551 | 551 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
552 | 552 | } |
553 | 553 | //accounting.js library |
554 | 554 | // @link http://josscrowcroft.github.io/accounting.js/ |
555 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
556 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
557 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
558 | - wp_enqueue_script( 'ee-accounting' ); |
|
555 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
556 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
557 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
558 | + wp_enqueue_script('ee-accounting'); |
|
559 | 559 | // array of settings to get converted to JSON array via wp_localize_script |
560 | 560 | $currency_config = array( |
561 | 561 | 'currency' => array( |
@@ -602,11 +602,11 @@ discard block |
||
602 | 602 | public function get_persistent_admin_notices() { |
603 | 603 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
604 | 604 | $args = array( |
605 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
606 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
605 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
606 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
607 | 607 | ); |
608 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
609 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
608 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
609 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -627,26 +627,26 @@ discard block |
||
627 | 627 | * @param $elements |
628 | 628 | * @return array |
629 | 629 | */ |
630 | - public function dashboard_glance_items( $elements ) { |
|
630 | + public function dashboard_glance_items($elements) { |
|
631 | 631 | $events = EEM_Event::instance()->count(); |
632 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
633 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
632 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
633 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
634 | 634 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
635 | 635 | $registrations = EEM_Registration::instance()->count( |
636 | 636 | array( |
637 | 637 | array( |
638 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
638 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
639 | 639 | ) |
640 | 640 | ) |
641 | 641 | ); |
642 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
643 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
642 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
643 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
644 | 644 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
645 | 645 | |
646 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
646 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
647 | 647 | |
648 | - foreach ( $items as $type => $item_properties ) { |
|
649 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
648 | + foreach ($items as $type => $item_properties) { |
|
649 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
650 | 650 | } |
651 | 651 | return $elements; |
652 | 652 | } |
@@ -663,31 +663,31 @@ discard block |
||
663 | 663 | * @throws EE_Error |
664 | 664 | * @return string |
665 | 665 | */ |
666 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
666 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
667 | 667 | // check for date_format or time_format |
668 | - switch ( $option ) { |
|
668 | + switch ($option) { |
|
669 | 669 | case 'date_format' : |
670 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
670 | + $date_time_format = $value.' '.get_option('time_format'); |
|
671 | 671 | break; |
672 | 672 | case 'time_format' : |
673 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
673 | + $date_time_format = get_option('date_format').' '.$value; |
|
674 | 674 | break; |
675 | 675 | default : |
676 | 676 | $date_time_format = FALSE; |
677 | 677 | } |
678 | 678 | // do we have a date_time format to check ? |
679 | - if ( $date_time_format ) { |
|
680 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
679 | + if ($date_time_format) { |
|
680 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
681 | 681 | |
682 | - if ( is_array( $error_msg ) ) { |
|
683 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
682 | + if (is_array($error_msg)) { |
|
683 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
684 | 684 | |
685 | 685 | |
686 | - foreach ( $error_msg as $error ) { |
|
687 | - $msg .= '<li>' . $error . '</li>'; |
|
686 | + foreach ($error_msg as $error) { |
|
687 | + $msg .= '<li>'.$error.'</li>'; |
|
688 | 688 | } |
689 | 689 | |
690 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
690 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
691 | 691 | |
692 | 692 | // trigger WP settings error |
693 | 693 | add_settings_error( |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ); |
698 | 698 | |
699 | 699 | // set format to something valid |
700 | - switch ( $option ) { |
|
700 | + switch ($option) { |
|
701 | 701 | case 'date_format' : |
702 | 702 | $value = 'F j, Y'; |
703 | 703 | break; |
@@ -719,8 +719,8 @@ discard block |
||
719 | 719 | * @param $content |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function its_eSpresso( $content ) { |
|
723 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
722 | + public function its_eSpresso($content) { |
|
723 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -733,9 +733,9 @@ discard block |
||
733 | 733 | */ |
734 | 734 | public function espresso_admin_footer() { |
735 | 735 | return sprintf( |
736 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
736 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
737 | 737 | '<a href="https://eventespresso.com/" title="', |
738 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
738 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
739 | 739 | ); |
740 | 740 | } |
741 | 741 | |
@@ -755,12 +755,12 @@ discard block |
||
755 | 755 | * @param array $config |
756 | 756 | * @return void |
757 | 757 | */ |
758 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
759 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
760 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
758 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
759 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
760 | + if (class_exists('EE_Register_Admin_Page')) { |
|
761 | 761 | $config['page_path'] = $page_path; |
762 | 762 | } |
763 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
763 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
764 | 764 | |
765 | 765 | } |
766 | 766 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @param \WP_Post $post |
774 | 774 | * @return void |
775 | 775 | */ |
776 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
776 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
777 | 777 | EE_Error::doing_it_wrong( |
778 | 778 | __METHOD__, |
779 | 779 | __( |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | ), |
783 | 783 | '4.8.41' |
784 | 784 | ); |
785 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
785 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | * @param $value |
796 | 796 | * @return void |
797 | 797 | */ |
798 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
798 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
799 | 799 | EE_Error::doing_it_wrong( |
800 | 800 | __METHOD__, |
801 | 801 | __( |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | ), |
805 | 805 | '4.8.41' |
806 | 806 | ); |
807 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
807 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | } |
@@ -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 | * Class EE_Select_Reveal_Input |
4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $input_settings |
28 | 28 | */ |
29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
30 | - parent::__construct( $answer_options, $input_settings ); |
|
29 | + public function __construct($answer_options, $input_settings = array()) { |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function sibling_sections_controlled() { |
38 | 38 | $sibling_sections = array(); |
39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
40 | 40 | //if it's an empty string just leave it alone |
41 | - if( empty( $sibling_section_name ) ) { |
|
41 | + if (empty($sibling_section_name)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
45 | - if( |
|
44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
45 | + if ( |
|
46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
47 | - && ! empty( $sibling_section_name ) |
|
47 | + && ! empty($sibling_section_name) |
|
48 | 48 | ) { |
49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | return $sibling_sections; |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | * @param array $form_other_js_data |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
63 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
64 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
63 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
64 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
65 | 65 | } |
66 | 66 | $sibling_input_to_html_id_map = array(); |
67 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
68 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
67 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
68 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
69 | 69 | } |
70 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
70 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
71 | 71 | return $form_other_js_data; |
72 | 72 | } |
73 | 73 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | ! isset( $input_settings['include_whats_this_link'] ) |
34 | 34 | || ( |
35 | 35 | isset( $input_settings['include_whats_this_link'] ) |
36 | - && $input_settings['include_whats_this_link'] === true |
|
36 | + && $input_settings['include_whats_this_link'] === true |
|
37 | 37 | ) |
38 | 38 | ) { |
39 | 39 | $this->_html_label_text = sprintf( |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_CVV_Input extends EE_Text_Input{ |
|
11 | +class EE_CVV_Input extends EE_Text_Input { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param array $input_settings { |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal()); |
20 | 20 | $this->_add_validation_strategy( |
21 | 21 | new EE_Text_Validation_Strategy( |
22 | - isset( $input_settings[ 'validation_error_message' ] ) |
|
23 | - ? $input_settings[ 'validation_error_message' ] |
|
22 | + isset($input_settings['validation_error_message']) |
|
23 | + ? $input_settings['validation_error_message'] |
|
24 | 24 | : __( |
25 | 25 | 'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front', |
26 | 26 | 'event_espresso' |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | ) |
30 | 30 | ); |
31 | 31 | parent::__construct($input_settings); |
32 | - if( |
|
33 | - ! isset( $input_settings['include_whats_this_link'] ) |
|
32 | + if ( |
|
33 | + ! isset($input_settings['include_whats_this_link']) |
|
34 | 34 | || ( |
35 | - isset( $input_settings['include_whats_this_link'] ) |
|
35 | + isset($input_settings['include_whats_this_link']) |
|
36 | 36 | && $input_settings['include_whats_this_link'] === true |
37 | 37 | ) |
38 | 38 | ) { |
@@ -23,18 +23,18 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | //register tasks (and make sure only registered once). |
26 | - if ( ! has_action( 'FHEE__EEH_Activation__get_cron_tasks', array( $this, 'register_scheduled_tasks' ) ) ) { |
|
27 | - add_action( 'FHEE__EEH_Activation__get_cron_tasks', array( $this, 'register_scheduled_tasks' ), 10 ); |
|
26 | + if ( ! has_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'))) { |
|
27 | + add_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'), 10); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | //register callbacks for scheduled events (but make sure they are set only once). |
31 | - if ( ! has_action( 'AHEE__EE_Messages_Scheduler__generation', array( 'EE_Messages_Scheduler', 'batch_generation' ) ) ) { |
|
32 | - add_action( 'AHEE__EE_Messages_Scheduler__generation', array( 'EE_Messages_Scheduler', 'batch_generation') ); |
|
33 | - add_action( 'AHEE__EE_Messages_Scheduler__sending', array( 'EE_Messages_Scheduler', 'batch_sending' ) ); |
|
31 | + if ( ! has_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation'))) { |
|
32 | + add_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation')); |
|
33 | + add_action('AHEE__EE_Messages_Scheduler__sending', array('EE_Messages_Scheduler', 'batch_sending')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | //add custom schedules |
37 | - add_filter( 'cron_schedules', array( $this, 'custom_schedules' ) ); |
|
37 | + add_filter('cron_schedules', array($this, 'custom_schedules')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | * Add custom schedules for wp_cron |
45 | 45 | * @param $schedules |
46 | 46 | */ |
47 | - public function custom_schedules( $schedules ) { |
|
47 | + public function custom_schedules($schedules) { |
|
48 | 48 | $schedules['ee_message_cron'] = array( |
49 | 49 | 'interval' => self::message_cron_schedule, |
50 | - 'display' => __( 'This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)', 'event_espresso' ) |
|
50 | + 'display' => __('This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)', 'event_espresso') |
|
51 | 51 | ); |
52 | 52 | return $schedules; |
53 | 53 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param array $tasks already existing scheduled tasks |
59 | 59 | * @return array |
60 | 60 | */ |
61 | - public function register_scheduled_tasks( $tasks ) { |
|
61 | + public function register_scheduled_tasks($tasks) { |
|
62 | 62 | $tasks['AHEE__EE_Messages_Scheduler__generation'] = 'ee_message_cron'; |
63 | 63 | $tasks['AHEE__EE_Messages_Scheduler__sending'] = 'ee_message_cron'; |
64 | 64 | return $tasks; |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | * Note: The EED_Messages module has the handlers for these requests. |
71 | 71 | * @param string $task The task the request is being generated for. |
72 | 72 | */ |
73 | - public static function initiate_scheduled_non_blocking_request( $task ) { |
|
73 | + public static function initiate_scheduled_non_blocking_request($task) { |
|
74 | 74 | //transient is used for flood control on msg_cron_trigger requests |
75 | - $transient_key = 'ee_trans_' . uniqid( $task ); |
|
76 | - set_transient( $transient_key, 1, 5 * MINUTE_IN_SECONDS ); |
|
75 | + $transient_key = 'ee_trans_'.uniqid($task); |
|
76 | + set_transient($transient_key, 1, 5 * MINUTE_IN_SECONDS); |
|
77 | 77 | $request_url = add_query_arg( |
78 | 78 | array( |
79 | 79 | 'ee' => 'msg_cron_trigger', |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | ); |
85 | 85 | $request_args = array( |
86 | 86 | 'timeout' => 300, |
87 | - 'blocking' => ( defined( 'DOING_CRON' ) && DOING_CRON ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? true : false, |
|
87 | + 'blocking' => (defined('DOING_CRON') && DOING_CRON) || (defined('DOING_AJAX') && DOING_AJAX) ? true : false, |
|
88 | 88 | 'sslverify' => false, |
89 | 89 | 'redirection' => 10, |
90 | 90 | ); |
91 | - $response = wp_remote_get( $request_url, $request_args ); |
|
92 | - if ( is_wp_error( $response ) ) { |
|
93 | - trigger_error( $response->get_error_message() ); |
|
91 | + $response = wp_remote_get($request_url, $request_args); |
|
92 | + if (is_wp_error($response)) { |
|
93 | + trigger_error($response->get_error_message()); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * Callback for scheduled AHEE__EE_Messages_Scheduler__generation wp cron event |
103 | 103 | */ |
104 | 104 | public static function batch_generation() { |
105 | - EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( 'generate' ); |
|
105 | + EE_Messages_Scheduler::initiate_scheduled_non_blocking_request('generate'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * Callback for scheduled AHEE__EE_Messages_Scheduler__sending |
113 | 113 | */ |
114 | 114 | public static function batch_sending() { |
115 | - EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( 'send' ); |
|
115 | + EE_Messages_Scheduler::initiate_scheduled_non_blocking_request('send'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | } //end EE_Messages_Scheduler |
119 | 119 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | protected function _setup_data() { |
29 | - $this->_data = $this->_get_messages( $this->_per_page, $this->_view ); |
|
30 | - $this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true ); |
|
29 | + $this->_data = $this->_get_messages($this->_per_page, $this->_view); |
|
30 | + $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,32 +35,32 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function _set_properties() { |
37 | 37 | $this->_wp_list_args = array( |
38 | - 'singular' => __( 'Message', 'event_espresso' ), |
|
39 | - 'plural' => __( 'Messages', 'event_espresso' ), |
|
38 | + 'singular' => __('Message', 'event_espresso'), |
|
39 | + 'plural' => __('Messages', 'event_espresso'), |
|
40 | 40 | 'ajax' => true, |
41 | 41 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
42 | 42 | ); |
43 | 43 | |
44 | 44 | $this->_columns = array( |
45 | 45 | 'cb' => '<input type="checkbox" />', |
46 | - 'to' => __( 'To', 'event_espresso' ), |
|
47 | - 'from' => __( 'From', 'event_espresso' ), |
|
48 | - 'messenger' => __( 'Messenger', 'event_espresso' ), |
|
49 | - 'message_type' => __( 'Message Type', 'event_espresso' ), |
|
50 | - 'context' => __( 'Context', 'event_espresso' ), |
|
51 | - 'modified' => __( 'Modified', 'event_espresso' ), |
|
52 | - 'action' => __( 'Actions', 'event_espresso' ), |
|
53 | - 'msg_id' => __( 'ID', 'event_espresso' ), |
|
46 | + 'to' => __('To', 'event_espresso'), |
|
47 | + 'from' => __('From', 'event_espresso'), |
|
48 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
49 | + 'message_type' => __('Message Type', 'event_espresso'), |
|
50 | + 'context' => __('Context', 'event_espresso'), |
|
51 | + 'modified' => __('Modified', 'event_espresso'), |
|
52 | + 'action' => __('Actions', 'event_espresso'), |
|
53 | + 'msg_id' => __('ID', 'event_espresso'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->_sortable_columns = array( |
57 | - 'modified' => array( 'MSG_modified' => true ), |
|
58 | - 'message_type' => array( 'MSG_message_type' => false ), |
|
59 | - 'messenger' => array( 'MSG_messenger' => false ), |
|
60 | - 'to' => array( 'MSG_to' => false ), |
|
61 | - 'from' => array( 'MSG_from' => false ), |
|
62 | - 'context' => array( 'MSG_context' => false ), |
|
63 | - 'msg_id' => array( 'MSG_ID', false ), |
|
57 | + 'modified' => array('MSG_modified' => true), |
|
58 | + 'message_type' => array('MSG_message_type' => false), |
|
59 | + 'messenger' => array('MSG_messenger' => false), |
|
60 | + 'to' => array('MSG_to' => false), |
|
61 | + 'from' => array('MSG_from' => false), |
|
62 | + 'context' => array('MSG_context' => false), |
|
63 | + 'msg_id' => array('MSG_ID', false), |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_primary_column = 'to'; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param object $item the current item |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - protected function _get_row_class( $item ) { |
|
82 | - $class = parent::_get_row_class( $item ); |
|
81 | + protected function _get_row_class($item) { |
|
82 | + $class = parent::_get_row_class($item); |
|
83 | 83 | //add status class |
84 | - $class .= ' ee-status-strip msg-status-' . $item->STS_ID(); |
|
85 | - if ( $this->_has_checkbox_column ) { |
|
84 | + $class .= ' ee-status-strip msg-status-'.$item->STS_ID(); |
|
85 | + if ($this->_has_checkbox_column) { |
|
86 | 86 | $class .= ' has-checkbox-column'; |
87 | 87 | } |
88 | 88 | return $class; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function _get_table_filters() { |
103 | 103 | $filters = array(); |
104 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
104 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
105 | 105 | //setup messengers for selects |
106 | 106 | $m_values = $this->get_admin_page()->get_messengers_for_list_table(); |
107 | 107 | //lets do the same for message types |
@@ -110,88 +110,88 @@ discard block |
||
110 | 110 | $contexts = $this->get_admin_page()->get_contexts_for_message_types_for_list_table(); |
111 | 111 | $i = 1; |
112 | 112 | $labels = $c_values = array(); |
113 | - foreach ( $contexts as $context => $label ) { |
|
113 | + foreach ($contexts as $context => $label) { |
|
114 | 114 | //some message types may have the same label for a different context, so we're grouping these together so the end user |
115 | 115 | //doesn't get confused. |
116 | - if ( isset( $labels[ $label ] ) ) { |
|
117 | - $c_values[ $labels[ $label ] ]['id'] .= ',' . $context; |
|
116 | + if (isset($labels[$label])) { |
|
117 | + $c_values[$labels[$label]]['id'] .= ','.$context; |
|
118 | 118 | continue; |
119 | 119 | } |
120 | - $c_values[ $i ]['id'] = $context; |
|
121 | - $c_values[ $i ]['text'] = $label; |
|
122 | - $labels[ $label ] = $i; |
|
120 | + $c_values[$i]['id'] = $context; |
|
121 | + $c_values[$i]['text'] = $label; |
|
122 | + $labels[$label] = $i; |
|
123 | 123 | $i++; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $msgr_default[0] = array( |
127 | 127 | 'id' => 'none_selected', |
128 | - 'text' => __( 'All Messengers', 'event_espresso' ) |
|
128 | + 'text' => __('All Messengers', 'event_espresso') |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $mt_default[0] = array( |
132 | 132 | 'id' => 'none_selected', |
133 | - 'text' => __( 'All Message Types', 'event_espresso' ) |
|
133 | + 'text' => __('All Message Types', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | $c_default[0] = array( |
137 | 137 | 'id' => 'none_selected', |
138 | - 'text' => __( 'All Contexts', 'event_espresso ' ) |
|
138 | + 'text' => __('All Contexts', 'event_espresso ') |
|
139 | 139 | ); |
140 | 140 | |
141 | - $msgr_filters = count( $m_values ) > 1 |
|
142 | - ? array_merge( $msgr_default, $m_values ) |
|
141 | + $msgr_filters = count($m_values) > 1 |
|
142 | + ? array_merge($msgr_default, $m_values) |
|
143 | 143 | : $m_values; |
144 | - $mt_filters = ! empty( $mt_values ) && count( $mt_values ) > 1 |
|
145 | - ? array_merge( $mt_default, $mt_values ) |
|
144 | + $mt_filters = ! empty($mt_values) && count($mt_values) > 1 |
|
145 | + ? array_merge($mt_default, $mt_values) |
|
146 | 146 | : (array) $mt_values; |
147 | - $c_filters = ! empty( $c_values ) && count( $c_values ) > 1 |
|
148 | - ? array_merge( $c_default, $c_values ) |
|
147 | + $c_filters = ! empty($c_values) && count($c_values) > 1 |
|
148 | + ? array_merge($c_default, $c_values) |
|
149 | 149 | : (array) $c_values; |
150 | 150 | |
151 | - if ( empty( $msgr_filters ) ) { |
|
151 | + if (empty($msgr_filters)) { |
|
152 | 152 | $msgr_filters[0] = array( |
153 | 153 | 'id' => 'none_selected', |
154 | - 'text' => __( 'No Messengers active', 'event_espresso' ) |
|
154 | + 'text' => __('No Messengers active', 'event_espresso') |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | - if ( empty( $mt_filters ) ) { |
|
158 | + if (empty($mt_filters)) { |
|
159 | 159 | $mt_filters[0] = array( |
160 | 160 | 'id' => 'none_selected', |
161 | - 'text' => __( 'No Message Types active', 'event_espresso' ) |
|
161 | + 'text' => __('No Message Types active', 'event_espresso') |
|
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - if ( empty( $c_filters ) ) { |
|
165 | + if (empty($c_filters)) { |
|
166 | 166 | $c_filters[0] = array( |
167 | 167 | 'id' => 'none_selected', |
168 | - 'text' => __( 'No Contexts (because no message types active)', 'event_espresso' ) |
|
168 | + 'text' => __('No Contexts (because no message types active)', 'event_espresso') |
|
169 | 169 | ); |
170 | 170 | } |
171 | 171 | |
172 | - if ( count ( $msgr_filters ) > 1 ) { |
|
172 | + if (count($msgr_filters) > 1) { |
|
173 | 173 | $filters[] = EEH_Form_Fields::select_input( |
174 | 174 | 'ee_messenger_filter_by', |
175 | - array_values( $msgr_filters ), |
|
176 | - isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
177 | - ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) |
|
175 | + array_values($msgr_filters), |
|
176 | + isset($this->_req_data['ee_messenger_filter_by']) |
|
177 | + ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
178 | 178 | : '' |
179 | 179 | ); |
180 | 180 | } |
181 | - if ( count( $mt_filters ) > 1 ) { |
|
181 | + if (count($mt_filters) > 1) { |
|
182 | 182 | $filters[] = EEH_Form_Fields::select_input( |
183 | 183 | 'ee_message_type_filter_by', |
184 | - array_values( $mt_filters ), |
|
185 | - isset( $this->_req_data['ee_message_type_filter_by'] ) ? sanitize_title( |
|
184 | + array_values($mt_filters), |
|
185 | + isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_title( |
|
186 | 186 | $this->_req_data['ee_message_type_filter_by'] |
187 | 187 | ) : '' |
188 | 188 | ); |
189 | 189 | } |
190 | - if ( count( $c_filters ) > 1 ) { |
|
190 | + if (count($c_filters) > 1) { |
|
191 | 191 | $filters[] = EEH_Form_Fields::select_input( |
192 | 192 | 'ee_context_filter_by', |
193 | - array_values( $c_filters ), |
|
194 | - isset( $this->_req_data['ee_context_filter_by'] ) ? sanitize_text_field( |
|
193 | + array_values($c_filters), |
|
194 | + isset($this->_req_data['ee_context_filter_by']) ? sanitize_text_field( |
|
195 | 195 | $this->_req_data['ee_context_filter_by'] |
196 | 196 | ) : '' |
197 | 197 | ); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | |
204 | 204 | protected function _add_view_counts() { |
205 | - foreach ( $this->_views as $view => $args ) { |
|
206 | - $this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true ); |
|
205 | + foreach ($this->_views as $view => $args) { |
|
206 | + $this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return string checkbox |
215 | 215 | * @throws \EE_Error |
216 | 216 | */ |
217 | - public function column_cb( $message ) { |
|
218 | - return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() ); |
|
217 | + public function column_cb($message) { |
|
218 | + return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @return string |
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | - public function column_msg_id( EE_Message $message ) { |
|
228 | + public function column_msg_id(EE_Message $message) { |
|
229 | 229 | return $message->ID(); |
230 | 230 | } |
231 | 231 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @return string The recipient of the message |
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | - public function column_to( EE_Message $message ) { |
|
240 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
239 | + public function column_to(EE_Message $message) { |
|
240 | + EE_Registry::instance()->load_helper('URL'); |
|
241 | 241 | $actions = array(); |
242 | 242 | $actions['delete'] = '<a href="' |
243 | 243 | . EEH_URL::add_query_args_and_nonce( |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | 'action' => 'delete_ee_message', |
247 | 247 | 'MSG_ID' => $message->ID() |
248 | 248 | ), |
249 | - admin_url( 'admin.php' ) |
|
249 | + admin_url('admin.php') |
|
250 | 250 | ) |
251 | - . '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
252 | - return $message->to() . $this->row_actions( $actions ); |
|
251 | + . '">'.__('Delete', 'event_espresso').'</a>'; |
|
252 | + return $message->to().$this->row_actions($actions); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param EE_Message $message |
258 | 258 | * @return string The sender of the message |
259 | 259 | */ |
260 | - public function column_from( EE_Message $message ) { |
|
260 | + public function column_from(EE_Message $message) { |
|
261 | 261 | return $message->from(); |
262 | 262 | } |
263 | 263 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param EE_Message $message |
268 | 268 | * @return string The messenger used to send the message. |
269 | 269 | */ |
270 | - public function column_messenger( EE_Message $message ) { |
|
271 | - return ucwords( $message->messenger_label() ); |
|
270 | + public function column_messenger(EE_Message $message) { |
|
271 | + return ucwords($message->messenger_label()); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | * @param EE_Message $message |
277 | 277 | * @return string The message type used to generate the message. |
278 | 278 | */ |
279 | - public function column_message_type( EE_Message $message ) { |
|
280 | - return ucwords( $message->message_type_label() ); |
|
279 | + public function column_message_type(EE_Message $message) { |
|
280 | + return ucwords($message->message_type_label()); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param EE_Message $message |
286 | 286 | * @return string The context the message was generated for. |
287 | 287 | */ |
288 | - public function column_context( EE_Message $message ) { |
|
288 | + public function column_context(EE_Message $message) { |
|
289 | 289 | return $message->context_label(); |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param EE_Message $message |
295 | 295 | * @return string The timestamp when this message was last modified. |
296 | 296 | */ |
297 | - public function column_modified( EE_Message $message ) { |
|
297 | + public function column_modified(EE_Message $message) { |
|
298 | 298 | return $message->modified(); |
299 | 299 | } |
300 | 300 | |
@@ -303,36 +303,36 @@ discard block |
||
303 | 303 | * @param EE_Message $message |
304 | 304 | * @return string Actions that can be done on the current message. |
305 | 305 | */ |
306 | - public function column_action( EE_Message $message ) { |
|
307 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
306 | + public function column_action(EE_Message $message) { |
|
307 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
308 | 308 | $action_links = array( |
309 | - 'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ), |
|
310 | - 'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ), |
|
311 | - 'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ), |
|
312 | - 'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ), |
|
313 | - 'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ), |
|
314 | - 'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ), |
|
309 | + 'view' => EEH_MSG_Template::get_message_action_link('view', $message), |
|
310 | + 'error' => EEH_MSG_Template::get_message_action_link('error', $message), |
|
311 | + 'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message), |
|
312 | + 'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message), |
|
313 | + 'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message), |
|
314 | + 'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message), |
|
315 | 315 | ); |
316 | 316 | $content = ''; |
317 | - switch ( $message->STS_ID() ) { |
|
317 | + switch ($message->STS_ID()) { |
|
318 | 318 | case EEM_Message::status_sent : |
319 | - $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction']; |
|
319 | + $content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction']; |
|
320 | 320 | break; |
321 | 321 | case EEM_Message::status_resend : |
322 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
322 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
323 | 323 | break; |
324 | 324 | case EEM_Message::status_retry : |
325 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction']; |
|
325 | + $content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction']; |
|
326 | 326 | break; |
327 | 327 | case EEM_Message::status_failed : |
328 | 328 | case EEM_Message::status_debug_only : |
329 | - $content = $action_links['error'] . $action_links['view_transaction']; |
|
329 | + $content = $action_links['error'].$action_links['view_transaction']; |
|
330 | 330 | break; |
331 | 331 | case EEM_Message::status_idle : |
332 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
332 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
333 | 333 | break; |
334 | 334 | case EEM_Message::status_incomplete; |
335 | - $content = $action_links['generate_now'] . $action_links['view_transaction']; |
|
335 | + $content = $action_links['generate_now'].$action_links['view_transaction']; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | return $content; |
@@ -350,69 +350,69 @@ discard block |
||
350 | 350 | * @return int | EE_Message[] |
351 | 351 | * @throws \EE_Error |
352 | 352 | */ |
353 | - protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) { |
|
353 | + protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) { |
|
354 | 354 | |
355 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
355 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
356 | 356 | ? $this->_req_data['paged'] |
357 | 357 | : 1; |
358 | 358 | |
359 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
359 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
360 | 360 | ? $this->_req_data['perpage'] |
361 | 361 | : $perpage; |
362 | 362 | |
363 | - $offset = ( $current_page - 1 ) * $per_page; |
|
364 | - $limit = $all || $count ? null : array( $offset, $per_page ); |
|
363 | + $offset = ($current_page - 1) * $per_page; |
|
364 | + $limit = $all || $count ? null : array($offset, $per_page); |
|
365 | 365 | $query_params = array( |
366 | - 'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ], |
|
367 | - 'order' => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ], |
|
366 | + 'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'], |
|
367 | + 'order' => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'], |
|
368 | 368 | 'limit' => $limit, |
369 | 369 | ); |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Any filters coming in from other routes? |
373 | 373 | */ |
374 | - if ( isset( $this->_req_data['filterby'] ) ) { |
|
375 | - $query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() ); |
|
376 | - if ( ! $count ) { |
|
374 | + if (isset($this->_req_data['filterby'])) { |
|
375 | + $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params()); |
|
376 | + if ( ! $count) { |
|
377 | 377 | $query_params['group_by'] = 'MSG_ID'; |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | 381 | //view conditionals |
382 | - if ( $view !== 'all' && $count && $all ) { |
|
382 | + if ($view !== 'all' && $count && $all) { |
|
383 | 383 | $query_params[0]['AND*view_conditional'] = array( |
384 | - 'STS_ID' => strtoupper( $view ), |
|
384 | + 'STS_ID' => strtoupper($view), |
|
385 | 385 | ); |
386 | 386 | } |
387 | 387 | |
388 | - if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) { |
|
388 | + if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') { |
|
389 | 389 | $query_params[0]['AND*view_conditional'] = array( |
390 | - 'STS_ID' => strtoupper( $this->_req_data['status'] ), |
|
390 | + 'STS_ID' => strtoupper($this->_req_data['status']), |
|
391 | 391 | ); |
392 | 392 | } |
393 | 393 | |
394 | - if ( ! $all && ! empty( $this->_req_data['s'] ) ) { |
|
395 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
394 | + if ( ! $all && ! empty($this->_req_data['s'])) { |
|
395 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
396 | 396 | $query_params[0]['OR'] = array( |
397 | - 'MSG_to' => array( 'LIKE', $search_string ), |
|
398 | - 'MSG_from' => array( 'LIKE', $search_string ), |
|
399 | - 'MSG_subject' => array( 'LIKE', $search_string ), |
|
400 | - 'MSG_content' => array( 'LIKE', $search_string ), |
|
397 | + 'MSG_to' => array('LIKE', $search_string), |
|
398 | + 'MSG_from' => array('LIKE', $search_string), |
|
399 | + 'MSG_subject' => array('LIKE', $search_string), |
|
400 | + 'MSG_content' => array('LIKE', $search_string), |
|
401 | 401 | ); |
402 | 402 | } |
403 | 403 | |
404 | 404 | //account for debug only status. We don't show Messages with the EEM_Message::status_debug_only to clients when |
405 | 405 | //`WP_DEBUG` is false. |
406 | - if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { |
|
406 | + if ( ! defined('WP_DEBUG') || ! WP_DEBUG) { |
|
407 | 407 | $query_params[0]['AND*debug_only_conditional'] = array( |
408 | - 'STS_ID' => array( '!=', EEM_Message::status_debug_only ) |
|
408 | + 'STS_ID' => array('!=', EEM_Message::status_debug_only) |
|
409 | 409 | ); |
410 | 410 | } |
411 | 411 | |
412 | 412 | //account for filters |
413 | 413 | if ( |
414 | 414 | ! $all |
415 | - && isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
415 | + && isset($this->_req_data['ee_messenger_filter_by']) |
|
416 | 416 | && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected' |
417 | 417 | ) { |
418 | 418 | $query_params[0]['AND*messenger_filter'] = array( |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | if ( |
423 | 423 | ! $all |
424 | - && ! empty( $this->_req_data['ee_message_type_filter_by'] ) |
|
424 | + && ! empty($this->_req_data['ee_message_type_filter_by']) |
|
425 | 425 | && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected' |
426 | 426 | ) { |
427 | 427 | $query_params[0]['AND*message_type_filter'] = array( |
@@ -431,17 +431,17 @@ discard block |
||
431 | 431 | |
432 | 432 | if ( |
433 | 433 | ! $all |
434 | - && ! empty( $this->_req_data['ee_context_filter_by'] ) |
|
434 | + && ! empty($this->_req_data['ee_context_filter_by']) |
|
435 | 435 | && $this->_req_data['ee_context_filter_by'] !== 'none_selected' |
436 | 436 | ) { |
437 | 437 | $query_params[0]['AND*context_filter'] = array( |
438 | - 'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) ) |
|
438 | + 'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])) |
|
439 | 439 | ); |
440 | 440 | } |
441 | 441 | |
442 | 442 | return $count |
443 | - ? EEM_Message::instance()->count( $query_params, null, true ) |
|
444 | - : EEM_Message::instance()->get_all( $query_params ); |
|
443 | + ? EEM_Message::instance()->count($query_params, null, true) |
|
444 | + : EEM_Message::instance()->get_all($query_params); |
|
445 | 445 | |
446 | 446 | } |
447 | 447 | } //end EE_Message_List_Table class |
448 | 448 | \ No newline at end of file |