@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -578,7 +580,7 @@ discard block |
||
578 | 580 | $espresso_db_update = array( $espresso_db_update=>array() ); |
579 | 581 | update_option( 'espresso_db_update', $espresso_db_update ); |
580 | 582 | } |
581 | - }else{ |
|
583 | + } else{ |
|
582 | 584 | $corrected_db_update = array(); |
583 | 585 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
584 | 586 | foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
@@ -588,7 +590,7 @@ discard block |
||
588 | 590 | //fix it! |
589 | 591 | $version_string = $should_be_array; |
590 | 592 | $corrected_db_update[$version_string] = array('unknown-date'); |
591 | - }else{ |
|
593 | + } else{ |
|
592 | 594 | //ok it checks out |
593 | 595 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
594 | 596 | } |
@@ -633,7 +635,7 @@ discard block |
||
633 | 635 | $addon->initialize_db_if_no_migrations_required(); |
634 | 636 | } |
635 | 637 | } |
636 | - }else{ |
|
638 | + } else{ |
|
637 | 639 | EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
638 | 640 | } |
639 | 641 | if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
@@ -703,7 +705,7 @@ discard block |
||
703 | 705 | //it a version we haven't seen before |
704 | 706 | if( $version_is_higher === 1 ){ |
705 | 707 | $req_type = EE_System::req_type_upgrade; |
706 | - }else{ |
|
708 | + } else{ |
|
707 | 709 | $req_type = EE_System::req_type_downgrade; |
708 | 710 | } |
709 | 711 | delete_option( $activation_indicator_option_name ); |
@@ -712,10 +714,10 @@ discard block |
||
712 | 714 | if( get_option( $activation_indicator_option_name, FALSE ) ){ |
713 | 715 | if ( $version_is_higher === -1 ){ |
714 | 716 | $req_type = EE_System::req_type_downgrade; |
715 | - }elseif( $version_is_higher === 0 ){ |
|
717 | + } elseif( $version_is_higher === 0 ){ |
|
716 | 718 | //we've seen this version before, but it's an activation. must be a reactivation |
717 | 719 | $req_type = EE_System::req_type_reactivation; |
718 | - }else{//$version_is_higher === 1 |
|
720 | + } else{//$version_is_higher === 1 |
|
719 | 721 | $req_type = EE_System::req_type_upgrade; |
720 | 722 | } |
721 | 723 | delete_option( $activation_indicator_option_name ); |
@@ -723,10 +725,10 @@ discard block |
||
723 | 725 | //we've seen this version before and the activation indicate doesn't show it was just activated |
724 | 726 | if ( $version_is_higher === -1 ){ |
725 | 727 | $req_type = EE_System::req_type_downgrade; |
726 | - }elseif( $version_is_higher === 0 ){ |
|
728 | + } elseif( $version_is_higher === 0 ){ |
|
727 | 729 | //we've seen this version before and it's not an activation. its normal request |
728 | 730 | $req_type = EE_System::req_type_normal; |
729 | - }else{//$version_is_higher === 1 |
|
731 | + } else{//$version_is_higher === 1 |
|
730 | 732 | $req_type = EE_System::req_type_upgrade; |
731 | 733 | } |
732 | 734 | } |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | |
197 | 197 | |
198 | 198 | /** |
199 | - * detect_if_activation_or_upgrade |
|
200 | - * |
|
201 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
202 | - * and either setting up the DB or setting up maintenance mode etc. |
|
203 | - * |
|
204 | - * @access public |
|
205 | - * @return void |
|
206 | - */ |
|
199 | + * detect_if_activation_or_upgrade |
|
200 | + * |
|
201 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
202 | + * and either setting up the DB or setting up maintenance mode etc. |
|
203 | + * |
|
204 | + * @access public |
|
205 | + * @return void |
|
206 | + */ |
|
207 | 207 | public function detect_if_activation_or_upgrade() { |
208 | 208 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
209 | 209 | |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | $query_params = array( 'page' => 'espresso_about' ); |
513 | 513 | |
514 | 514 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
515 | - $query_params['new_activation'] = TRUE; |
|
515 | + $query_params['new_activation'] = TRUE; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
519 | - $query_params['reactivation'] = TRUE; |
|
519 | + $query_params['reactivation'] = TRUE; |
|
520 | 520 | } |
521 | 521 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
522 | 522 | wp_safe_redirect( $url ); |
@@ -619,11 +619,11 @@ discard block |
||
619 | 619 | |
620 | 620 | |
621 | 621 | /** |
622 | - * _incompatible_addon_error |
|
623 | - * |
|
624 | - * @access public |
|
625 | - * @return void |
|
626 | - */ |
|
622 | + * _incompatible_addon_error |
|
623 | + * |
|
624 | + * @access public |
|
625 | + * @return void |
|
626 | + */ |
|
627 | 627 | private function _incompatible_addon_error() { |
628 | 628 | // get array of classes hooking into here |
629 | 629 | $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | |
746 | 746 | |
747 | 747 | /** |
748 | - * load_controllers |
|
749 | - * |
|
750 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
751 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
752 | - * |
|
753 | - * @access public |
|
754 | - * @return void |
|
755 | - */ |
|
748 | + * load_controllers |
|
749 | + * |
|
750 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
751 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
752 | + * |
|
753 | + * @access public |
|
754 | + * @return void |
|
755 | + */ |
|
756 | 756 | public function load_controllers() { |
757 | 757 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
758 | 758 | // let's get it started |
@@ -769,13 +769,13 @@ discard block |
||
769 | 769 | |
770 | 770 | |
771 | 771 | /** |
772 | - * core_loaded_and_ready |
|
773 | - * |
|
774 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
775 | - * |
|
776 | - * @access public |
|
777 | - * @return void |
|
778 | - */ |
|
772 | + * core_loaded_and_ready |
|
773 | + * |
|
774 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
775 | + * |
|
776 | + * @access public |
|
777 | + * @return void |
|
778 | + */ |
|
779 | 779 | public function core_loaded_and_ready() { |
780 | 780 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
781 | 781 | do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
@@ -786,13 +786,13 @@ discard block |
||
786 | 786 | |
787 | 787 | |
788 | 788 | /** |
789 | - * initialize |
|
790 | - * |
|
791 | - * this is the best place to begin initializing client code |
|
792 | - * |
|
793 | - * @access public |
|
794 | - * @return void |
|
795 | - */ |
|
789 | + * initialize |
|
790 | + * |
|
791 | + * this is the best place to begin initializing client code |
|
792 | + * |
|
793 | + * @access public |
|
794 | + * @return void |
|
795 | + */ |
|
796 | 796 | public function initialize() { |
797 | 797 | do_action( 'AHEE__EE_System__initialize' ); |
798 | 798 | } |
@@ -800,13 +800,13 @@ discard block |
||
800 | 800 | |
801 | 801 | |
802 | 802 | /** |
803 | - * initialize_last |
|
804 | - * |
|
805 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
806 | - * |
|
807 | - * @access public |
|
808 | - * @return void |
|
809 | - */ |
|
803 | + * initialize_last |
|
804 | + * |
|
805 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
806 | + * |
|
807 | + * @access public |
|
808 | + * @return void |
|
809 | + */ |
|
810 | 810 | public function initialize_last() { |
811 | 811 | do_action( 'AHEE__EE_System__initialize_last' ); |
812 | 812 | } |
@@ -815,14 +815,14 @@ discard block |
||
815 | 815 | |
816 | 816 | |
817 | 817 | /** |
818 | - * set_hooks_for_shortcodes_modules_and_addons |
|
819 | - * |
|
820 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
821 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
822 | - * |
|
823 | - * @access public |
|
824 | - * @return void |
|
825 | - */ |
|
818 | + * set_hooks_for_shortcodes_modules_and_addons |
|
819 | + * |
|
820 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
821 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
822 | + * |
|
823 | + * @access public |
|
824 | + * @return void |
|
825 | + */ |
|
826 | 826 | public function set_hooks_for_shortcodes_modules_and_addons() { |
827 | 827 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
828 | 828 | } |
@@ -831,13 +831,13 @@ discard block |
||
831 | 831 | |
832 | 832 | |
833 | 833 | /** |
834 | - * do_not_cache |
|
835 | - * |
|
836 | - * sets no cache headers and defines no cache constants for WP plugins |
|
837 | - * |
|
838 | - * @access public |
|
839 | - * @return void |
|
840 | - */ |
|
834 | + * do_not_cache |
|
835 | + * |
|
836 | + * sets no cache headers and defines no cache constants for WP plugins |
|
837 | + * |
|
838 | + * @access public |
|
839 | + * @return void |
|
840 | + */ |
|
841 | 841 | public static function do_not_cache() { |
842 | 842 | // set no cache constants |
843 | 843 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | //Current post |
957 | 957 | global $post; |
958 | 958 | |
959 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
959 | + if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
960 | 960 | //Events Edit Current Event |
961 | 961 | $admin_bar->add_menu(array( |
962 | 962 | 'id' => 'espresso-toolbar-events-edit', |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * @param \EE_Registry $Registry |
89 | 89 | * @return \EE_System |
90 | 90 | */ |
91 | - public static function instance( EE_Registry $Registry = null ) { |
|
91 | + public static function instance(EE_Registry $Registry = null) { |
|
92 | 92 | // check if class object is instantiated |
93 | - if ( ! self::$_instance instanceof EE_System ) { |
|
94 | - self::$_instance = new self( $Registry ); |
|
93 | + if ( ! self::$_instance instanceof EE_System) { |
|
94 | + self::$_instance = new self($Registry); |
|
95 | 95 | } |
96 | 96 | return self::$_instance; |
97 | 97 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * resets the instance and returns it |
102 | 102 | * @return EE_System |
103 | 103 | */ |
104 | - public static function reset(){ |
|
104 | + public static function reset() { |
|
105 | 105 | self::$_instance->_req_type = NULL; |
106 | 106 | //we need to reset the migration manager in order for it to detect DMSs properly |
107 | 107 | EE_Data_Migration_Manager::reset(); |
108 | 108 | //make sure none of the old hooks are left hanging around |
109 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
109 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
110 | 110 | self::instance()->detect_activations_or_upgrades(); |
111 | 111 | self::instance()->perform_activations_upgrades_and_migrations(); |
112 | 112 | return self::instance(); |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | * @access private |
123 | 123 | * @param \EE_Registry $Registry |
124 | 124 | */ |
125 | - private function __construct( EE_Registry $Registry ) { |
|
125 | + private function __construct(EE_Registry $Registry) { |
|
126 | 126 | $this->registry = $Registry; |
127 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
127 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
128 | 128 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
129 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
129 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
130 | 130 | // when an ee addon is activated, we want to call the core hook(s) again |
131 | 131 | // because the newly-activated addon didn't get a chance to run at all |
132 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
132 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
133 | 133 | // detect whether install or upgrade |
134 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
134 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
135 | 135 | // load EE_Config, EE_Textdomain, etc |
136 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
136 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
137 | 137 | // load EE_Config, EE_Textdomain, etc |
138 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
138 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
139 | 139 | // you wanna get going? I wanna get going... let's get going! |
140 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
140 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
141 | 141 | //other housekeeping |
142 | 142 | //exclude EE critical pages from wp_list_pages |
143 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
143 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
144 | 144 | // ALL EE Addons should use the following hook point to attach their initial setup too |
145 | 145 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
146 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
146 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -163,30 +163,30 @@ discard block |
||
163 | 163 | public function load_espresso_addons() { |
164 | 164 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
165 | 165 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
166 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
166 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
167 | 167 | //load and setup EE_Capabilities |
168 | - $this->registry->load_core( 'Capabilities' ); |
|
168 | + $this->registry->load_core('Capabilities'); |
|
169 | 169 | //caps need to be initialized on every request so that capability maps are set. |
170 | 170 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
171 | 171 | $this->registry->CAP->init_caps(); |
172 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
172 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
173 | 173 | //if the WP API basic auth plugin isn't already loaded, load it now. |
174 | 174 | //We want it for mobile apps. Just include the entire plugin |
175 | 175 | //also, don't load the basic auth when a plugin is getting activated, because |
176 | 176 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
177 | 177 | //and causes a fatal error |
178 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
179 | - && ! function_exists( 'json_basic_auth_error' ) |
|
178 | + if ( ! function_exists('json_basic_auth_handler') |
|
179 | + && ! function_exists('json_basic_auth_error') |
|
180 | 180 | && ! ( |
181 | - isset( $_GET[ 'action'] ) |
|
182 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
181 | + isset($_GET['action']) |
|
182 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
183 | 183 | ) |
184 | 184 | && ! ( |
185 | - isset( $_GET['activate' ] ) |
|
186 | - && $_GET['activate' ] === 'true' |
|
185 | + isset($_GET['activate']) |
|
186 | + && $_GET['activate'] === 'true' |
|
187 | 187 | ) |
188 | 188 | ) { |
189 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
189 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * @access public |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function detect_activations_or_upgrades(){ |
|
205 | + public function detect_activations_or_upgrades() { |
|
206 | 206 | //first off: let's make sure to handle core |
207 | 207 | $this->detect_if_activation_or_upgrade(); |
208 | - foreach($this->registry->addons as $addon){ |
|
208 | + foreach ($this->registry->addons as $addon) { |
|
209 | 209 | //detect teh request type for that addon |
210 | 210 | $addon->detect_activation_or_upgrade(); |
211 | 211 | } |
@@ -226,44 +226,44 @@ discard block |
||
226 | 226 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
227 | 227 | |
228 | 228 | // load M-Mode class |
229 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
229 | + $this->registry->load_core('Maintenance_Mode'); |
|
230 | 230 | // check if db has been updated, or if its a brand-new installation |
231 | 231 | |
232 | 232 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
233 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
233 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
234 | 234 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
235 | - if( $request_type != EE_System::req_type_normal){ |
|
235 | + if ($request_type != EE_System::req_type_normal) { |
|
236 | 236 | $this->registry->load_helper('Activation'); |
237 | 237 | } |
238 | 238 | |
239 | - switch($request_type){ |
|
239 | + switch ($request_type) { |
|
240 | 240 | case EE_System::req_type_new_activation: |
241 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
242 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
241 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
242 | + $this->_handle_core_version_change($espresso_db_update); |
|
243 | 243 | break; |
244 | 244 | case EE_System::req_type_reactivation: |
245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
246 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
246 | + $this->_handle_core_version_change($espresso_db_update); |
|
247 | 247 | break; |
248 | 248 | case EE_System::req_type_upgrade: |
249 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
249 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
250 | 250 | //migrations may be required now that we've upgraded |
251 | 251 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
252 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
252 | + $this->_handle_core_version_change($espresso_db_update); |
|
253 | 253 | // echo "done upgrade";die; |
254 | 254 | break; |
255 | 255 | case EE_System::req_type_downgrade: |
256 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
256 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
257 | 257 | //its possible migrations are no longer required |
258 | 258 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
259 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
259 | + $this->_handle_core_version_change($espresso_db_update); |
|
260 | 260 | break; |
261 | 261 | case EE_System::req_type_normal: |
262 | 262 | default: |
263 | 263 | // $this->_maybe_redirect_to_ee_about(); |
264 | 264 | break; |
265 | 265 | } |
266 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
266 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * initializing the database later during the request |
272 | 272 | * @param array $espresso_db_update |
273 | 273 | */ |
274 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
275 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
274 | + protected function _handle_core_version_change($espresso_db_update) { |
|
275 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
276 | 276 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
277 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
277 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -289,44 +289,44 @@ discard block |
||
289 | 289 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
290 | 290 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
291 | 291 | */ |
292 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
293 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
294 | - if( ! $espresso_db_update){ |
|
295 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
292 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
293 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
294 | + if ( ! $espresso_db_update) { |
|
295 | + $espresso_db_update = get_option('espresso_db_update'); |
|
296 | 296 | } |
297 | 297 | // check that option is an array |
298 | - if( ! is_array( $espresso_db_update )) { |
|
298 | + if ( ! is_array($espresso_db_update)) { |
|
299 | 299 | // if option is FALSE, then it never existed |
300 | - if ( $espresso_db_update === FALSE ) { |
|
300 | + if ($espresso_db_update === FALSE) { |
|
301 | 301 | // make $espresso_db_update an array and save option with autoload OFF |
302 | - $espresso_db_update = array(); |
|
303 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
302 | + $espresso_db_update = array(); |
|
303 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
304 | 304 | } else { |
305 | 305 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
306 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
307 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
306 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
307 | + update_option('espresso_db_update', $espresso_db_update); |
|
308 | 308 | } |
309 | - }else{ |
|
309 | + } else { |
|
310 | 310 | $corrected_db_update = array(); |
311 | 311 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
312 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
313 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
312 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
313 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
314 | 314 | //the key is an int, and the value IS NOT an array |
315 | 315 | //so it must be numerically-indexed, where values are versions installed... |
316 | 316 | //fix it! |
317 | 317 | $version_string = $should_be_array; |
318 | 318 | $corrected_db_update[$version_string] = array('unknown-date'); |
319 | - }else{ |
|
319 | + } else { |
|
320 | 320 | //ok it checks out |
321 | 321 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | $espresso_db_update = $corrected_db_update; |
325 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
325 | + update_option('espresso_db_update', $espresso_db_update); |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | |
329 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
329 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
330 | 330 | return $espresso_db_update; |
331 | 331 | } |
332 | 332 | |
@@ -346,34 +346,34 @@ discard block |
||
346 | 346 | * so we prefer to only do it when necessary |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
349 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
350 | 350 | $request_type = $this->detect_req_type(); |
351 | 351 | //only initialize system if we're not in maintenance mode. |
352 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
353 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
352 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
353 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
354 | 354 | |
355 | - if( $verify_schema ) { |
|
355 | + if ($verify_schema) { |
|
356 | 356 | EEH_Activation::initialize_db_and_folders(); |
357 | 357 | } |
358 | 358 | EEH_Activation::initialize_db_content(); |
359 | 359 | EEH_Activation::system_initialization(); |
360 | - if( $initialize_addons_too ) { |
|
360 | + if ($initialize_addons_too) { |
|
361 | 361 | $this->initialize_addons(); |
362 | 362 | } |
363 | - }else{ |
|
364 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
363 | + } else { |
|
364 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
365 | 365 | } |
366 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
367 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
366 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
367 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Initializes the db for all registered addons |
373 | 373 | */ |
374 | - public function initialize_addons(){ |
|
374 | + public function initialize_addons() { |
|
375 | 375 | //foreach registered addon, make sure its db is up-to-date too |
376 | - foreach($this->registry->addons as $addon){ |
|
376 | + foreach ($this->registry->addons as $addon) { |
|
377 | 377 | $addon->initialize_db_if_no_migrations_required(); |
378 | 378 | } |
379 | 379 | } |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param string $current_version_to_add version to be added to the version history |
386 | 386 | * @return boolean success as to whether or not this option was changed |
387 | 387 | */ |
388 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
389 | - if( ! $version_history ) { |
|
388 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
389 | + if ( ! $version_history) { |
|
390 | 390 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
391 | 391 | } |
392 | - if( $current_version_to_add == NULL){ |
|
392 | + if ($current_version_to_add == NULL) { |
|
393 | 393 | $current_version_to_add = espresso_version(); |
394 | 394 | } |
395 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
395 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
396 | 396 | // re-save |
397 | - return update_option( 'espresso_db_update', $version_history ); |
|
397 | + return update_option('espresso_db_update', $version_history); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * but still know if this is a new install or not |
412 | 412 | * @return int one of the constants on EE_System::req_type_ |
413 | 413 | */ |
414 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
415 | - if ( $this->_req_type === NULL ){ |
|
416 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
414 | + public function detect_req_type($espresso_db_update = NULL) { |
|
415 | + if ($this->_req_type === NULL) { |
|
416 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
418 | 418 | } |
419 | 419 | return $this->_req_type; |
420 | 420 | } |
@@ -430,39 +430,39 @@ discard block |
||
430 | 430 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
431 | 431 | * @return int one of the constants on EE_System::req_type_* |
432 | 432 | */ |
433 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
434 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
435 | - if( $activation_history_for_addon ){ |
|
433 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
434 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
435 | + if ($activation_history_for_addon) { |
|
436 | 436 | //it exists, so this isn't a completely new install |
437 | 437 | //check if this version already in that list of previously installed versions |
438 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
438 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
439 | 439 | //it a version we haven't seen before |
440 | - if( $version_is_higher === 1 ){ |
|
440 | + if ($version_is_higher === 1) { |
|
441 | 441 | $req_type = EE_System::req_type_upgrade; |
442 | - }else{ |
|
442 | + } else { |
|
443 | 443 | $req_type = EE_System::req_type_downgrade; |
444 | 444 | } |
445 | - delete_option( $activation_indicator_option_name ); |
|
445 | + delete_option($activation_indicator_option_name); |
|
446 | 446 | } else { |
447 | 447 | // its not an update. maybe a reactivation? |
448 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
449 | - if ( $version_is_higher === -1 ){ |
|
448 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
449 | + if ($version_is_higher === -1) { |
|
450 | 450 | $req_type = EE_System::req_type_downgrade; |
451 | - }elseif( $version_is_higher === 0 ){ |
|
451 | + }elseif ($version_is_higher === 0) { |
|
452 | 452 | //we've seen this version before, but it's an activation. must be a reactivation |
453 | 453 | $req_type = EE_System::req_type_reactivation; |
454 | - }else{//$version_is_higher === 1 |
|
454 | + } else {//$version_is_higher === 1 |
|
455 | 455 | $req_type = EE_System::req_type_upgrade; |
456 | 456 | } |
457 | - delete_option( $activation_indicator_option_name ); |
|
457 | + delete_option($activation_indicator_option_name); |
|
458 | 458 | } else { |
459 | 459 | //we've seen this version before and the activation indicate doesn't show it was just activated |
460 | - if ( $version_is_higher === -1 ){ |
|
460 | + if ($version_is_higher === -1) { |
|
461 | 461 | $req_type = EE_System::req_type_downgrade; |
462 | - }elseif( $version_is_higher === 0 ){ |
|
462 | + }elseif ($version_is_higher === 0) { |
|
463 | 463 | //we've seen this version before and it's not an activation. its normal request |
464 | 464 | $req_type = EE_System::req_type_normal; |
465 | - }else{//$version_is_higher === 1 |
|
465 | + } else {//$version_is_higher === 1 |
|
466 | 466 | $req_type = EE_System::req_type_upgrade; |
467 | 467 | } |
468 | 468 | } |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | } else { |
471 | 471 | //brand new install |
472 | 472 | $req_type = EE_System::req_type_new_activation; |
473 | - delete_option( $activation_indicator_option_name ); |
|
473 | + delete_option($activation_indicator_option_name); |
|
474 | 474 | } |
475 | 475 | return $req_type; |
476 | 476 | } |
@@ -488,30 +488,30 @@ discard block |
||
488 | 488 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
489 | 489 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
490 | 490 | */ |
491 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
491 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
492 | 492 | //find the most recently-activated version |
493 | 493 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
494 | 494 | $most_recently_active_version = '0.0.0.dev.000'; |
495 | - if( is_array( $activation_history_for_addon ) ){ |
|
496 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
495 | + if (is_array($activation_history_for_addon)) { |
|
496 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
497 | 497 | //check there is a record of when this version was activated. Otherwise, |
498 | 498 | //mark it as unknown |
499 | - if( ! $times_activated ){ |
|
500 | - $times_activated = array( 'unknown-date'); |
|
499 | + if ( ! $times_activated) { |
|
500 | + $times_activated = array('unknown-date'); |
|
501 | 501 | } |
502 | - if( is_string( $times_activated ) ){ |
|
503 | - $times_activated = array( $times_activated ); |
|
502 | + if (is_string($times_activated)) { |
|
503 | + $times_activated = array($times_activated); |
|
504 | 504 | } |
505 | - foreach( $times_activated as $an_activation ){ |
|
506 | - if( $an_activation != 'unknown-date' && |
|
507 | - $an_activation > $most_recently_active_version_activation ){ |
|
505 | + foreach ($times_activated as $an_activation) { |
|
506 | + if ($an_activation != 'unknown-date' && |
|
507 | + $an_activation > $most_recently_active_version_activation) { |
|
508 | 508 | $most_recently_active_version = $version; |
509 | 509 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
514 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | |
@@ -521,24 +521,24 @@ discard block |
||
521 | 521 | * @return void |
522 | 522 | */ |
523 | 523 | public function redirect_to_about_ee() { |
524 | - $notices = EE_Error::get_notices( FALSE ); |
|
524 | + $notices = EE_Error::get_notices(FALSE); |
|
525 | 525 | //if current user is an admin and it's not an ajax request |
526 | 526 | if ( |
527 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
528 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
529 | - && ! isset( $notices[ 'errors' ] ) |
|
527 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
528 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
529 | + && ! isset($notices['errors']) |
|
530 | 530 | ) { |
531 | - $query_params = array( 'page' => 'espresso_about' ); |
|
531 | + $query_params = array('page' => 'espresso_about'); |
|
532 | 532 | |
533 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
533 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
534 | 534 | $query_params['new_activation'] = TRUE; |
535 | 535 | } |
536 | 536 | |
537 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
537 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
538 | 538 | $query_params['reactivation'] = TRUE; |
539 | 539 | } |
540 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
541 | - wp_safe_redirect( $url ); |
|
540 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
541 | + wp_safe_redirect($url); |
|
542 | 542 | exit(); |
543 | 543 | } |
544 | 544 | } |
@@ -552,31 +552,31 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @return void |
554 | 554 | */ |
555 | - public function load_core_configuration(){ |
|
556 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
557 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
555 | + public function load_core_configuration() { |
|
556 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
557 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
558 | 558 | //load textdomain |
559 | 559 | EE_Load_Textdomain::load_textdomain(); |
560 | 560 | // load and setup EE_Config and EE_Network_Config |
561 | - $this->registry->load_core( 'Config' ); |
|
562 | - $this->registry->load_core( 'Network_Config' ); |
|
561 | + $this->registry->load_core('Config'); |
|
562 | + $this->registry->load_core('Network_Config'); |
|
563 | 563 | // setup autoloaders |
564 | 564 | // enable logging? |
565 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
566 | - $this->registry->load_core( 'Log' ); |
|
565 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
566 | + $this->registry->load_core('Log'); |
|
567 | 567 | } |
568 | 568 | // check for activation errors |
569 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
570 | - if ( $activation_errors ) { |
|
571 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
572 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
569 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
570 | + if ($activation_errors) { |
|
571 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
572 | + update_option('ee_plugin_activation_errors', FALSE); |
|
573 | 573 | } |
574 | 574 | // get model names |
575 | 575 | $this->_parse_model_names(); |
576 | 576 | |
577 | 577 | //load caf stuff a chance to play during the activation process too. |
578 | 578 | $this->_maybe_brew_regular(); |
579 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
579 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -585,23 +585,23 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return void |
587 | 587 | */ |
588 | - private function _parse_model_names(){ |
|
588 | + private function _parse_model_names() { |
|
589 | 589 | //get all the files in the EE_MODELS folder that end in .model.php |
590 | - $models = glob( EE_MODELS.'*.model.php'); |
|
590 | + $models = glob(EE_MODELS.'*.model.php'); |
|
591 | 591 | $model_names = array(); |
592 | 592 | $non_abstract_db_models = array(); |
593 | - foreach( $models as $model ){ |
|
593 | + foreach ($models as $model) { |
|
594 | 594 | // get model classname |
595 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
596 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
595 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
596 | + $short_name = str_replace('EEM_', '', $classname); |
|
597 | 597 | $reflectionClass = new ReflectionClass($classname); |
598 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
599 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
598 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
599 | + $non_abstract_db_models[$short_name] = $classname; |
|
600 | 600 | } |
601 | - $model_names[ $short_name ] = $classname; |
|
601 | + $model_names[$short_name] = $classname; |
|
602 | 602 | } |
603 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
604 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
603 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
604 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -611,8 +611,8 @@ discard block |
||
611 | 611 | * @return void |
612 | 612 | */ |
613 | 613 | private function _maybe_brew_regular() { |
614 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
615 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
614 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
615 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
@@ -629,9 +629,9 @@ discard block |
||
629 | 629 | * @return void |
630 | 630 | */ |
631 | 631 | public function register_shortcodes_modules_and_widgets() { |
632 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
632 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
633 | 633 | // check for addons using old hookpoint |
634 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
634 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
635 | 635 | $this->_incompatible_addon_error(); |
636 | 636 | } |
637 | 637 | } |
@@ -645,19 +645,19 @@ discard block |
||
645 | 645 | */ |
646 | 646 | private function _incompatible_addon_error() { |
647 | 647 | // get array of classes hooking into here |
648 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
649 | - if ( ! empty( $class_names )) { |
|
650 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
648 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
649 | + if ( ! empty($class_names)) { |
|
650 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
651 | 651 | $msg .= '<ul>'; |
652 | - foreach ( $class_names as $class_name ) { |
|
653 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
652 | + foreach ($class_names as $class_name) { |
|
653 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
654 | 654 | } |
655 | 655 | $msg .= '</ul>'; |
656 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
656 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
657 | 657 | // save list of incompatible addons to wp-options for later use |
658 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
659 | - if ( is_admin() ) { |
|
660 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
658 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
659 | + if (is_admin()) { |
|
660 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | } |
@@ -674,25 +674,25 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function brew_espresso(){ |
|
678 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
677 | + public function brew_espresso() { |
|
678 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
679 | 679 | // load some final core systems |
680 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
681 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
682 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
683 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
684 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
685 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
686 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
687 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
688 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
689 | - |
|
690 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
680 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
681 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
682 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
683 | + add_action('init', array($this, 'load_controllers'), 7); |
|
684 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
685 | + add_action('init', array($this, 'initialize'), 10); |
|
686 | + add_action('init', array($this, 'initialize_last'), 100); |
|
687 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
688 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
689 | + |
|
690 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
691 | 691 | // pew pew pew |
692 | - $this->registry->load_core( 'PUE' ); |
|
693 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
692 | + $this->registry->load_core('PUE'); |
|
693 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
694 | 694 | } |
695 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
695 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | */ |
707 | 707 | public function set_hooks_for_core() { |
708 | 708 | $this->_deactivate_incompatible_addons(); |
709 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
709 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | |
@@ -715,15 +715,15 @@ discard block |
||
715 | 715 | * Using the information gathered in EE_System::_incompatible_addon_error, |
716 | 716 | * deactivates any addons considered incompatible with the current version of EE |
717 | 717 | */ |
718 | - private function _deactivate_incompatible_addons(){ |
|
719 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
720 | - if ( ! empty( $incompatible_addons )) { |
|
721 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
722 | - foreach ( $active_plugins as $active_plugin ) { |
|
723 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
724 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
725 | - unset( $_GET['activate'] ); |
|
726 | - espresso_deactivate_plugin( $active_plugin ); |
|
718 | + private function _deactivate_incompatible_addons() { |
|
719 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
720 | + if ( ! empty($incompatible_addons)) { |
|
721 | + $active_plugins = get_option('active_plugins', array()); |
|
722 | + foreach ($active_plugins as $active_plugin) { |
|
723 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
724 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
725 | + unset($_GET['activate']); |
|
726 | + espresso_deactivate_plugin($active_plugin); |
|
727 | 727 | } |
728 | 728 | } |
729 | 729 | } |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | */ |
741 | 741 | public function perform_activations_upgrades_and_migrations() { |
742 | 742 | //first check if we had previously attempted to setup EE's directories but failed |
743 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
743 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
744 | 744 | EEH_Activation::create_upload_directories(); |
745 | 745 | } |
746 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
746 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | |
@@ -755,10 +755,10 @@ discard block |
||
755 | 755 | * @return void |
756 | 756 | */ |
757 | 757 | public function load_CPTs_and_session() { |
758 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
758 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
759 | 759 | // register Custom Post Types |
760 | - $this->registry->load_core( 'Register_CPTs' ); |
|
761 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
760 | + $this->registry->load_core('Register_CPTs'); |
|
761 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | |
@@ -773,19 +773,19 @@ discard block |
||
773 | 773 | * @return void |
774 | 774 | */ |
775 | 775 | public function load_controllers() { |
776 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
776 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
777 | 777 | // let's get it started |
778 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
779 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
780 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
781 | - } else if ( ! EE_FRONT_AJAX ) { |
|
782 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
783 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
784 | - } else if ( EE_Maintenance_Mode::instance()->level() ) { |
|
778 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
779 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
780 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
781 | + } else if ( ! EE_FRONT_AJAX) { |
|
782 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
783 | + EE_Registry::instance()->load_core('Admin'); |
|
784 | + } else if (EE_Maintenance_Mode::instance()->level()) { |
|
785 | 785 | // still need to make sure template helper functions are loaded in M-Mode |
786 | - $this->registry->load_helper( 'Template' ); |
|
786 | + $this->registry->load_helper('Template'); |
|
787 | 787 | } |
788 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
788 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | |
@@ -799,9 +799,9 @@ discard block |
||
799 | 799 | * @return void |
800 | 800 | */ |
801 | 801 | public function core_loaded_and_ready() { |
802 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
803 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
804 | - $this->registry->load_core( 'Session' ); |
|
802 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
803 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
804 | + $this->registry->load_core('Session'); |
|
805 | 805 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
806 | 806 | } |
807 | 807 | |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * @return void |
817 | 817 | */ |
818 | 818 | public function initialize() { |
819 | - do_action( 'AHEE__EE_System__initialize' ); |
|
819 | + do_action('AHEE__EE_System__initialize'); |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * @return void |
831 | 831 | */ |
832 | 832 | public function initialize_last() { |
833 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
833 | + do_action('AHEE__EE_System__initialize_last'); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | |
@@ -862,21 +862,21 @@ discard block |
||
862 | 862 | */ |
863 | 863 | public static function do_not_cache() { |
864 | 864 | // set no cache constants |
865 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
866 | - define( 'DONOTCACHEPAGE', true ); |
|
865 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
866 | + define('DONOTCACHEPAGE', true); |
|
867 | 867 | } |
868 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
869 | - define( 'DONOTCACHCEOBJECT', true ); |
|
868 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
869 | + define('DONOTCACHCEOBJECT', true); |
|
870 | 870 | } |
871 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
872 | - define( 'DONOTCACHEDB', true ); |
|
871 | + if ( ! defined('DONOTCACHEDB')) { |
|
872 | + define('DONOTCACHEDB', true); |
|
873 | 873 | } |
874 | 874 | // add no cache headers |
875 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
875 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
876 | 876 | // plus a little extra for nginx and Google Chrome |
877 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
877 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
878 | 878 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
879 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
879 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @param $headers |
889 | 889 | * @return array |
890 | 890 | */ |
891 | - public static function extra_nocache_headers ( $headers ) { |
|
891 | + public static function extra_nocache_headers($headers) { |
|
892 | 892 | // for NGINX |
893 | 893 | $headers['X-Accel-Expires'] = 0; |
894 | 894 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -917,15 +917,15 @@ discard block |
||
917 | 917 | * @param WP_Admin_Bar $admin_bar |
918 | 918 | * @return void |
919 | 919 | */ |
920 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
920 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
921 | 921 | |
922 | 922 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
923 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
923 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
924 | 924 | return; |
925 | 925 | } |
926 | 926 | |
927 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
928 | - $this->registry->load_helper( 'URL' ); |
|
927 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
928 | + $this->registry->load_helper('URL'); |
|
929 | 929 | $menu_class = 'espresso_menu_item_class'; |
930 | 930 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
931 | 931 | //because they're only defined in each of their respective constructors |
@@ -937,20 +937,20 @@ discard block |
||
937 | 937 | //Top Level |
938 | 938 | $admin_bar->add_menu(array( |
939 | 939 | 'id' => 'espresso-toolbar', |
940 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
940 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
941 | 941 | 'href' => $events_admin_url, |
942 | 942 | 'meta' => array( |
943 | 943 | 'title' => __('Event Espresso', 'event_espresso'), |
944 | - 'class' => $menu_class . 'first' |
|
944 | + 'class' => $menu_class.'first' |
|
945 | 945 | ), |
946 | 946 | )); |
947 | 947 | |
948 | 948 | //Events |
949 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
949 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
950 | 950 | $admin_bar->add_menu(array( |
951 | 951 | 'id' => 'espresso-toolbar-events', |
952 | 952 | 'parent' => 'espresso-toolbar', |
953 | - 'title' => __( 'Events', 'event_espresso' ), |
|
953 | + 'title' => __('Events', 'event_espresso'), |
|
954 | 954 | 'href' => $events_admin_url, |
955 | 955 | 'meta' => array( |
956 | 956 | 'title' => __('Events', 'event_espresso'), |
@@ -961,13 +961,13 @@ discard block |
||
961 | 961 | } |
962 | 962 | |
963 | 963 | |
964 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
964 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
965 | 965 | //Events Add New |
966 | 966 | $admin_bar->add_menu(array( |
967 | 967 | 'id' => 'espresso-toolbar-events-new', |
968 | 968 | 'parent' => 'espresso-toolbar-events', |
969 | 969 | 'title' => __('Add New', 'event_espresso'), |
970 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
970 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
971 | 971 | 'meta' => array( |
972 | 972 | 'title' => __('Add New', 'event_espresso'), |
973 | 973 | 'target' => '', |
@@ -976,18 +976,18 @@ discard block |
||
976 | 976 | )); |
977 | 977 | } |
978 | 978 | |
979 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
979 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
980 | 980 | |
981 | 981 | //Current post |
982 | 982 | global $post; |
983 | 983 | |
984 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
984 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
985 | 985 | //Events Edit Current Event |
986 | 986 | $admin_bar->add_menu(array( |
987 | 987 | 'id' => 'espresso-toolbar-events-edit', |
988 | 988 | 'parent' => 'espresso-toolbar-events', |
989 | 989 | 'title' => __('Edit Event', 'event_espresso'), |
990 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
990 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
991 | 991 | 'meta' => array( |
992 | 992 | 'title' => __('Edit Event', 'event_espresso'), |
993 | 993 | 'target' => '', |
@@ -999,11 +999,11 @@ discard block |
||
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | //Events View |
1002 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
1002 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1003 | 1003 | $admin_bar->add_menu(array( |
1004 | 1004 | 'id' => 'espresso-toolbar-events-view', |
1005 | 1005 | 'parent' => 'espresso-toolbar-events', |
1006 | - 'title' => __( 'View', 'event_espresso' ), |
|
1006 | + 'title' => __('View', 'event_espresso'), |
|
1007 | 1007 | 'href' => $events_admin_url, |
1008 | 1008 | 'meta' => array( |
1009 | 1009 | 'title' => __('View', 'event_espresso'), |
@@ -1013,12 +1013,12 @@ discard block |
||
1013 | 1013 | )); |
1014 | 1014 | } |
1015 | 1015 | |
1016 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1016 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1017 | 1017 | //Events View All |
1018 | 1018 | $admin_bar->add_menu(array( |
1019 | 1019 | 'id' => 'espresso-toolbar-events-all', |
1020 | 1020 | 'parent' => 'espresso-toolbar-events-view', |
1021 | - 'title' => __( 'All', 'event_espresso' ), |
|
1021 | + 'title' => __('All', 'event_espresso'), |
|
1022 | 1022 | 'href' => $events_admin_url, |
1023 | 1023 | 'meta' => array( |
1024 | 1024 | 'title' => __('All', 'event_espresso'), |
@@ -1029,13 +1029,13 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
1032 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1032 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1033 | 1033 | //Events View Today |
1034 | 1034 | $admin_bar->add_menu(array( |
1035 | 1035 | 'id' => 'espresso-toolbar-events-today', |
1036 | 1036 | 'parent' => 'espresso-toolbar-events-view', |
1037 | 1037 | 'title' => __('Today', 'event_espresso'), |
1038 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1038 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1039 | 1039 | 'meta' => array( |
1040 | 1040 | 'title' => __('Today', 'event_espresso'), |
1041 | 1041 | 'target' => '', |
@@ -1045,13 +1045,13 @@ discard block |
||
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | |
1048 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1048 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1049 | 1049 | //Events View This Month |
1050 | 1050 | $admin_bar->add_menu(array( |
1051 | 1051 | 'id' => 'espresso-toolbar-events-month', |
1052 | 1052 | 'parent' => 'espresso-toolbar-events-view', |
1053 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1054 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1053 | + 'title' => __('This Month', 'event_espresso'), |
|
1054 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1055 | 1055 | 'meta' => array( |
1056 | 1056 | 'title' => __('This Month', 'event_espresso'), |
1057 | 1057 | 'target' => '', |
@@ -1061,11 +1061,11 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | //Registration Overview |
1064 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1064 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1065 | 1065 | $admin_bar->add_menu(array( |
1066 | 1066 | 'id' => 'espresso-toolbar-registrations', |
1067 | 1067 | 'parent' => 'espresso-toolbar', |
1068 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1068 | + 'title' => __('Registrations', 'event_espresso'), |
|
1069 | 1069 | 'href' => $reg_admin_url, |
1070 | 1070 | 'meta' => array( |
1071 | 1071 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1076,12 +1076,12 @@ discard block |
||
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | //Registration Overview Today |
1079 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1079 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1080 | 1080 | $admin_bar->add_menu(array( |
1081 | 1081 | 'id' => 'espresso-toolbar-registrations-today', |
1082 | 1082 | 'parent' => 'espresso-toolbar-registrations', |
1083 | - 'title' => __( 'Today', 'event_espresso'), |
|
1084 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1083 | + 'title' => __('Today', 'event_espresso'), |
|
1084 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1085 | 1085 | 'meta' => array( |
1086 | 1086 | 'title' => __('Today', 'event_espresso'), |
1087 | 1087 | 'target' => '', |
@@ -1091,14 +1091,14 @@ discard block |
||
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | //Registration Overview Today Completed |
1094 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1094 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1095 | 1095 | $admin_bar->add_menu(array( |
1096 | 1096 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1097 | 1097 | 'parent' => 'espresso-toolbar-registrations-today', |
1098 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1099 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1098 | + 'title' => __('Approved', 'event_espresso'), |
|
1099 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1100 | 1100 | 'meta' => array( |
1101 | - 'title' => __('Approved', 'event_espresso' ), |
|
1101 | + 'title' => __('Approved', 'event_espresso'), |
|
1102 | 1102 | 'target' => '', |
1103 | 1103 | 'class' => $menu_class |
1104 | 1104 | ), |
@@ -1106,14 +1106,14 @@ discard block |
||
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | //Registration Overview Today Pending\ |
1109 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1109 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1110 | 1110 | $admin_bar->add_menu(array( |
1111 | 1111 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1112 | 1112 | 'parent' => 'espresso-toolbar-registrations-today', |
1113 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1114 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1113 | + 'title' => __('Pending', 'event_espresso'), |
|
1114 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1115 | 1115 | 'meta' => array( |
1116 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1116 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1117 | 1117 | 'target' => '', |
1118 | 1118 | 'class' => $menu_class |
1119 | 1119 | ), |
@@ -1121,14 +1121,14 @@ discard block |
||
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | //Registration Overview Today Incomplete |
1124 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1124 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1125 | 1125 | $admin_bar->add_menu(array( |
1126 | 1126 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1127 | 1127 | 'parent' => 'espresso-toolbar-registrations-today', |
1128 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1129 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1128 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1129 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1130 | 1130 | 'meta' => array( |
1131 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1131 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1132 | 1132 | 'target' => '', |
1133 | 1133 | 'class' => $menu_class |
1134 | 1134 | ), |
@@ -1136,12 +1136,12 @@ discard block |
||
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | //Registration Overview Today Incomplete |
1139 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1139 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1140 | 1140 | $admin_bar->add_menu(array( |
1141 | 1141 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1142 | 1142 | 'parent' => 'espresso-toolbar-registrations-today', |
1143 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1144 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1143 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1144 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1145 | 1145 | 'meta' => array( |
1146 | 1146 | 'title' => __('Cancelled', 'event_espresso'), |
1147 | 1147 | 'target' => '', |
@@ -1151,12 +1151,12 @@ discard block |
||
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | //Registration Overview This Month |
1154 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1154 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1155 | 1155 | $admin_bar->add_menu(array( |
1156 | 1156 | 'id' => 'espresso-toolbar-registrations-month', |
1157 | 1157 | 'parent' => 'espresso-toolbar-registrations', |
1158 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1159 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1158 | + 'title' => __('This Month', 'event_espresso'), |
|
1159 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1160 | 1160 | 'meta' => array( |
1161 | 1161 | 'title' => __('This Month', 'event_espresso'), |
1162 | 1162 | 'target' => '', |
@@ -1166,12 +1166,12 @@ discard block |
||
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | //Registration Overview This Month Approved |
1169 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1169 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1170 | 1170 | $admin_bar->add_menu(array( |
1171 | 1171 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1172 | 1172 | 'parent' => 'espresso-toolbar-registrations-month', |
1173 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1174 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1173 | + 'title' => __('Approved', 'event_espresso'), |
|
1174 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1175 | 1175 | 'meta' => array( |
1176 | 1176 | 'title' => __('Approved', 'event_espresso'), |
1177 | 1177 | 'target' => '', |
@@ -1181,12 +1181,12 @@ discard block |
||
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | //Registration Overview This Month Pending |
1184 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1184 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1185 | 1185 | $admin_bar->add_menu(array( |
1186 | 1186 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1187 | 1187 | 'parent' => 'espresso-toolbar-registrations-month', |
1188 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1189 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1188 | + 'title' => __('Pending', 'event_espresso'), |
|
1189 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1190 | 1190 | 'meta' => array( |
1191 | 1191 | 'title' => __('Pending', 'event_espresso'), |
1192 | 1192 | 'target' => '', |
@@ -1196,14 +1196,14 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | //Registration Overview This Month Not Approved |
1199 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1199 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1200 | 1200 | $admin_bar->add_menu(array( |
1201 | 1201 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1202 | 1202 | 'parent' => 'espresso-toolbar-registrations-month', |
1203 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1204 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1203 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1204 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1205 | 1205 | 'meta' => array( |
1206 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1206 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1207 | 1207 | 'target' => '', |
1208 | 1208 | 'class' => $menu_class |
1209 | 1209 | ), |
@@ -1212,12 +1212,12 @@ discard block |
||
1212 | 1212 | |
1213 | 1213 | |
1214 | 1214 | //Registration Overview This Month Cancelled |
1215 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1215 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1216 | 1216 | $admin_bar->add_menu(array( |
1217 | 1217 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1218 | 1218 | 'parent' => 'espresso-toolbar-registrations-month', |
1219 | 1219 | 'title' => __('Cancelled', 'event_espresso'), |
1220 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1220 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1221 | 1221 | 'meta' => array( |
1222 | 1222 | 'title' => __('Cancelled', 'event_espresso'), |
1223 | 1223 | 'target' => '', |
@@ -1227,11 +1227,11 @@ discard block |
||
1227 | 1227 | } |
1228 | 1228 | |
1229 | 1229 | //Extensions & Services |
1230 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1230 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1231 | 1231 | $admin_bar->add_menu(array( |
1232 | 1232 | 'id' => 'espresso-toolbar-extensions-and-services', |
1233 | 1233 | 'parent' => 'espresso-toolbar', |
1234 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1234 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1235 | 1235 | 'href' => $extensions_admin_url, |
1236 | 1236 | 'meta' => array( |
1237 | 1237 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1253,8 +1253,8 @@ discard block |
||
1253 | 1253 | * @param array $exclude_array any existing pages being excluded are in this array. |
1254 | 1254 | * @return array |
1255 | 1255 | */ |
1256 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1257 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
1256 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1257 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1258 | 1258 | } |
1259 | 1259 | |
1260 | 1260 | |
@@ -1274,11 +1274,11 @@ discard block |
||
1274 | 1274 | */ |
1275 | 1275 | public function wp_enqueue_scripts() { |
1276 | 1276 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1277 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1277 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1278 | 1278 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1279 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1279 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1280 | 1280 | // register jQuery Validate |
1281 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE ); |
|
1281 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
1282 | 1282 | } |
1283 | 1283 | } |
1284 | 1284 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | |
34 | 34 | if ( ! class_exists( 'WP_List_Table' )) { |
35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
35 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -1,6 +1,7 @@ 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 | 6 | |
6 | 7 | /** |
@@ -362,8 +363,9 @@ discard block |
||
362 | 363 | |
363 | 364 | $sortable = array(); |
364 | 365 | foreach ( $_sortable as $id => $data ) { |
365 | - if ( empty( $data ) ) |
|
366 | - continue; |
|
366 | + if ( empty( $data ) ) { |
|
367 | + continue; |
|
368 | + } |
|
367 | 369 | |
368 | 370 | //fix for offset errors with WP_List_Table default get_columninfo() |
369 | 371 | if ( is_array($data) ) { |
@@ -375,8 +377,9 @@ discard block |
||
375 | 377 | |
376 | 378 | $data = (array) $data; |
377 | 379 | |
378 | - if ( !isset( $data[1] ) ) |
|
379 | - $_data[1] = false; |
|
380 | + if ( !isset( $data[1] ) ) { |
|
381 | + $_data[1] = false; |
|
382 | + } |
|
380 | 383 | |
381 | 384 | |
382 | 385 | $sortable[$id] = $_data; |
@@ -399,11 +402,12 @@ discard block |
||
399 | 402 | $actions = array(); |
400 | 403 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
401 | 404 | foreach ( $this->_views as $view => $args) { |
402 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
403 | - //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
405 | + if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) { |
|
406 | + //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
404 | 407 | foreach ( $args['bulk_action'] as $route =>$label ) { |
405 | 408 | if ( $this->_admin_page->check_user_access( $route, true ) ) { |
406 | 409 | $actions[$route] = $label; |
410 | + } |
|
407 | 411 | } |
408 | 412 | } |
409 | 413 | } |
@@ -633,14 +637,12 @@ discard block |
||
633 | 637 | echo '<th scope="row" class="check-column">'; |
634 | 638 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
635 | 639 | echo '</th>'; |
636 | - } |
|
637 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
640 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
638 | 641 | echo "<td $attributes>"; |
639 | 642 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
640 | 643 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
641 | 644 | echo "</td>"; |
642 | - } |
|
643 | - else { |
|
645 | + } else { |
|
644 | 646 | echo "<td $attributes>"; |
645 | 647 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
646 | 648 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
@@ -656,7 +658,7 @@ discard block |
||
656 | 658 | $this->_filters(); |
657 | 659 | echo $this->_get_hidden_fields(); |
658 | 660 | echo '<br class="clear">'; |
659 | - }else{ |
|
661 | + } else{ |
|
660 | 662 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
661 | 663 | foreach($this->_bottom_buttons as $type => $action){ |
662 | 664 | $route = isset( $action['route'] ) ? $action['route'] : ''; |
@@ -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 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * ------------------------------------------------------------------------ |
32 | 32 | */ |
33 | 33 | |
34 | -if ( ! class_exists( 'WP_List_Table' )) { |
|
35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
34 | +if ( ! class_exists('WP_List_Table')) { |
|
35 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -234,16 +234,16 @@ discard block |
||
234 | 234 | * constructor |
235 | 235 | * @param EE_Admin_Page object $admin_page we use this for obtaining everything we need in the list table. |
236 | 236 | */ |
237 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
237 | + public function __construct(EE_Admin_Page $admin_page) { |
|
238 | 238 | $this->_admin_page = $admin_page; |
239 | 239 | $this->_req_data = $this->_admin_page->get_request_data(); |
240 | 240 | $this->_view = $this->_admin_page->get_view(); |
241 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
241 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
242 | 242 | $this->_current_page = $this->get_pagenum(); |
243 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
244 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
243 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
244 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
245 | 245 | |
246 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
246 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
247 | 247 | |
248 | 248 | $this->_setup_data(); |
249 | 249 | $this->_add_view_counts(); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $this->_set_properties(); |
254 | 254 | |
255 | 255 | //set primary column |
256 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
256 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
257 | 257 | |
258 | 258 | //set parent defaults |
259 | 259 | parent::__construct($this->_wp_list_args); |
@@ -329,17 +329,17 @@ discard block |
||
329 | 329 | * @return html string |
330 | 330 | */ |
331 | 331 | protected function _get_hidden_fields() { |
332 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
333 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
332 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
333 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
334 | 334 | //if action is STILL empty, then we set it to default |
335 | - $action = empty( $action ) ? 'default' : $action; |
|
336 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
337 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
338 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
335 | + $action = empty($action) ? 'default' : $action; |
|
336 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
337 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
338 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
339 | 339 | |
340 | 340 | $bulk_actions = $this->_get_bulk_actions(); |
341 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
342 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
341 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
342 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | return $field; |
@@ -369,15 +369,15 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @var array |
371 | 371 | */ |
372 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
372 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
373 | 373 | |
374 | 374 | $sortable = array(); |
375 | - foreach ( $_sortable as $id => $data ) { |
|
376 | - if ( empty( $data ) ) |
|
375 | + foreach ($_sortable as $id => $data) { |
|
376 | + if (empty($data)) |
|
377 | 377 | continue; |
378 | 378 | |
379 | 379 | //fix for offset errors with WP_List_Table default get_columninfo() |
380 | - if ( is_array($data) ) { |
|
380 | + if (is_array($data)) { |
|
381 | 381 | $_data[0] = key($data); |
382 | 382 | $_data[1] = isset($data[1]) ? $data[1] : false; |
383 | 383 | } else { |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | |
387 | 387 | $data = (array) $data; |
388 | 388 | |
389 | - if ( !isset( $data[1] ) ) |
|
389 | + if ( ! isset($data[1])) |
|
390 | 390 | $_data[1] = false; |
391 | 391 | |
392 | 392 | |
393 | 393 | $sortable[$id] = $_data; |
394 | 394 | } |
395 | 395 | $primary = $this->get_primary_column_name(); |
396 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
396 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | * @return string |
403 | 403 | */ |
404 | 404 | protected function get_primary_column_name() { |
405 | - foreach( class_parents( $this ) as $parent ) { |
|
406 | - if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) { |
|
405 | + foreach (class_parents($this) as $parent) { |
|
406 | + if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') { |
|
407 | 407 | return parent::get_primary_column_name(); |
408 | 408 | } |
409 | 409 | } |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814) |
416 | 416 | * @return string |
417 | 417 | */ |
418 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
419 | - foreach( class_parents( $this ) as $parent ) { |
|
420 | - if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) { |
|
421 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
418 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
419 | + foreach (class_parents($this) as $parent) { |
|
420 | + if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') { |
|
421 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | ''; |
@@ -436,11 +436,11 @@ discard block |
||
436 | 436 | protected function _get_bulk_actions() { |
437 | 437 | $actions = array(); |
438 | 438 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
439 | - foreach ( $this->_views as $view => $args) { |
|
440 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
439 | + foreach ($this->_views as $view => $args) { |
|
440 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view) |
|
441 | 441 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
442 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
443 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
442 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
443 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
444 | 444 | $actions[$route] = $label; |
445 | 445 | } |
446 | 446 | } |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | */ |
459 | 459 | private function _filters() { |
460 | 460 | $classname = get_class($this); |
461 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
461 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
462 | 462 | |
463 | - if ( empty( $filters )) { |
|
463 | + if (empty($filters)) { |
|
464 | 464 | return; |
465 | 465 | } |
466 | - foreach ( $filters as $filter ) { |
|
466 | + foreach ($filters as $filter) { |
|
467 | 467 | echo $filter; |
468 | 468 | } |
469 | 469 | //add filter button at end |
470 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
470 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
471 | 471 | //add reset filters button at end |
472 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
472 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | * @param string $column_name |
484 | 484 | * @return string |
485 | 485 | */ |
486 | - public function set_primary_column( $column_name ) { |
|
487 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
486 | + public function set_primary_column($column_name) { |
|
487 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | array( |
504 | 504 | 'total_items' => $total_items, |
505 | 505 | 'per_page' => $this->_per_page, |
506 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
506 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
507 | 507 | ) |
508 | 508 | ); |
509 | 509 | } |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @return string html content for the column |
521 | 521 | */ |
522 | - public function column_default( $item, $column_name ) { |
|
522 | + public function column_default($item, $column_name) { |
|
523 | 523 | /** |
524 | 524 | * Dynamic hook allowing for adding additional column content in this list table. |
525 | 525 | * Note that $this->screen->id is in the format |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * hook prefix ("event-espresso") will be different. |
530 | 530 | * |
531 | 531 | */ |
532 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
532 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @var array |
547 | 547 | */ |
548 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
548 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
549 | 549 | return $columns; |
550 | 550 | } |
551 | 551 | |
@@ -557,18 +557,18 @@ discard block |
||
557 | 557 | $views = $this->get_views(); |
558 | 558 | $assembled_views = ''; |
559 | 559 | |
560 | - if ( empty( $views )) { |
|
560 | + if (empty($views)) { |
|
561 | 561 | return; |
562 | 562 | } |
563 | 563 | echo "<ul class='subsubsub'>\n"; |
564 | - foreach ( $views as $view ) { |
|
565 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
566 | - if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { |
|
567 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
564 | + foreach ($views as $view) { |
|
565 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
566 | + if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { |
|
567 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
571 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
572 | 572 | echo "</ul>"; |
573 | 573 | } |
574 | 574 | |
@@ -581,10 +581,10 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @param object $item The current item |
583 | 583 | */ |
584 | - public function single_row( $item ) { |
|
585 | - $row_class = $this->_get_row_class( $item ); |
|
586 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
587 | - $this->single_row_columns( $item ); |
|
584 | + public function single_row($item) { |
|
585 | + $row_class = $this->_get_row_class($item); |
|
586 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
587 | + $this->single_row_columns($item); |
|
588 | 588 | echo '</tr>'; |
589 | 589 | } |
590 | 590 | |
@@ -595,13 +595,13 @@ discard block |
||
595 | 595 | * @param object $item the current item |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - protected function _get_row_class( $item ) { |
|
598 | + protected function _get_row_class($item) { |
|
599 | 599 | static $row_class = ''; |
600 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
600 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
601 | 601 | |
602 | 602 | $new_row_class = $row_class; |
603 | 603 | |
604 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
604 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
605 | 605 | $new_row_class .= ' rowsortable'; |
606 | 606 | } |
607 | 607 | |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | |
621 | 621 | public function get_hidden_columns() { |
622 | 622 | $user_id = get_current_user_id(); |
623 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
624 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
625 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
626 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
623 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
624 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
625 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
626 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
627 | 627 | } |
628 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
629 | - $saved_columns = (array) get_user_option( $ref, $user_id ); |
|
628 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
629 | + $saved_columns = (array) get_user_option($ref, $user_id); |
|
630 | 630 | return $saved_columns; |
631 | 631 | } |
632 | 632 | |
@@ -641,47 +641,47 @@ discard block |
||
641 | 641 | * |
642 | 642 | * @param object $item The current item |
643 | 643 | */ |
644 | - public function single_row_columns( $item ) { |
|
645 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
644 | + public function single_row_columns($item) { |
|
645 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
646 | 646 | |
647 | 647 | global $wp_version; |
648 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
648 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
649 | 649 | |
650 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
650 | + foreach ($columns as $column_name => $column_display_name) { |
|
651 | 651 | |
652 | 652 | /** |
653 | 653 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
654 | 654 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
655 | 655 | */ |
656 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
657 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
656 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
657 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
658 | 658 | |
659 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
660 | - if ( $primary == $column_name ) { |
|
659 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
660 | + if ($primary == $column_name) { |
|
661 | 661 | $classes .= ' has-row-actions column-primary'; |
662 | 662 | } |
663 | 663 | |
664 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
664 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
665 | 665 | |
666 | 666 | $class = "class='$classes'"; |
667 | 667 | |
668 | 668 | $attributes = "$class$style$data"; |
669 | 669 | |
670 | - if ( 'cb' === $column_name ) { |
|
670 | + if ('cb' === $column_name) { |
|
671 | 671 | echo '<th scope="row" class="check-column">'; |
672 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
672 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
673 | 673 | echo '</th>'; |
674 | 674 | } |
675 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
675 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
676 | 676 | echo "<td $attributes>"; |
677 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
678 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
677 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
678 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
679 | 679 | echo "</td>"; |
680 | 680 | } |
681 | 681 | else { |
682 | 682 | echo "<td $attributes>"; |
683 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
684 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
683 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
684 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
685 | 685 | echo "</td>"; |
686 | 686 | } |
687 | 687 | } |
@@ -689,19 +689,19 @@ discard block |
||
689 | 689 | |
690 | 690 | |
691 | 691 | |
692 | - public function extra_tablenav( $which ) { |
|
693 | - if ( $which == 'top' ) { |
|
692 | + public function extra_tablenav($which) { |
|
693 | + if ($which == 'top') { |
|
694 | 694 | $this->_filters(); |
695 | 695 | echo $this->_get_hidden_fields(); |
696 | 696 | echo '<br class="clear">'; |
697 | - }else{ |
|
697 | + } else { |
|
698 | 698 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
699 | - foreach($this->_bottom_buttons as $type => $action){ |
|
700 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
701 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
699 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
700 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
701 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
702 | 702 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request); |
703 | 703 | } |
704 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
704 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
705 | 705 | echo '</div>'; |
706 | 706 | } |
707 | 707 | //echo $this->_entries_per_page_dropdown; |
@@ -751,13 +751,13 @@ discard block |
||
751 | 751 | * |
752 | 752 | * @return string The assembled action elements container. |
753 | 753 | */ |
754 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
754 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
755 | 755 | $content = ''; |
756 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
757 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
758 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
759 | - $content .= apply_filters( 'FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this ); |
|
760 | - $content .= ! empty( $container ) ? '</' . $container . '>' : ''; |
|
756 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
757 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
758 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
759 | + $content .= apply_filters('FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this); |
|
760 | + $content .= ! empty($container) ? '</'.$container.'>' : ''; |
|
761 | 761 | return $content; |
762 | 762 | } |
763 | 763 | } |
@@ -594,7 +594,7 @@ |
||
594 | 594 | * @since 4.1 |
595 | 595 | * @access public |
596 | 596 | * |
597 | - * @param object $item The current item |
|
597 | + * @param EE_Message_Template_Group $item The current item |
|
598 | 598 | */ |
599 | 599 | public function single_row( $item ) { |
600 | 600 | $row_class = $this->_get_row_class( $item ); |
@@ -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 | * |
@@ -231,8 +233,9 @@ discard block |
||
231 | 233 | |
232 | 234 | $containers = array(); |
233 | 235 | |
234 | - if ( empty( $wp_meta_boxes ) ) |
|
235 | - return; |
|
236 | + if ( empty( $wp_meta_boxes ) ) { |
|
237 | + return; |
|
238 | + } |
|
236 | 239 | |
237 | 240 | $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
238 | 241 | |
@@ -336,8 +339,9 @@ discard block |
||
336 | 339 | |
337 | 340 | |
338 | 341 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
339 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
340 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
342 | + if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) { |
|
343 | + add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
344 | + } |
|
341 | 345 | |
342 | 346 | //add preview button |
343 | 347 | add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
@@ -347,12 +351,14 @@ discard block |
||
347 | 351 | add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
348 | 352 | |
349 | 353 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
350 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
351 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
354 | + if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) { |
|
355 | + add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
356 | + } |
|
352 | 357 | |
353 | 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. |
354 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
355 | - 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 | + } |
|
356 | 362 | |
357 | 363 | |
358 | 364 | /** |
@@ -543,7 +549,9 @@ discard block |
||
543 | 549 | |
544 | 550 | |
545 | 551 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
546 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
552 | + if ( !defined('DOING_AUTOSAVE') ) { |
|
553 | + define('DOING_AUTOSAVE', true); |
|
554 | + } |
|
547 | 555 | |
548 | 556 | //if we made it here then the nonce checked out. Let's run our methods and actions |
549 | 557 | if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
@@ -573,8 +581,9 @@ discard block |
||
573 | 581 | protected function _extend_page_config_for_cpt() { |
574 | 582 | |
575 | 583 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
576 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
577 | - return; |
|
584 | + if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) { |
|
585 | + return; |
|
586 | + } |
|
578 | 587 | |
579 | 588 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
580 | 589 | if ( !empty( $this->_cpt_object ) ) { |
@@ -606,8 +615,9 @@ discard block |
||
606 | 615 | } |
607 | 616 | |
608 | 617 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
609 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
610 | - return; |
|
618 | + if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) { |
|
619 | + return; |
|
620 | + } |
|
611 | 621 | |
612 | 622 | |
613 | 623 | $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
@@ -803,8 +813,9 @@ discard block |
||
803 | 813 | public function insert_update( $post_id, $post ) { |
804 | 814 | |
805 | 815 | //make sure that if this is a revision OR trash action that we don't do any updates! |
806 | - if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) |
|
807 | - return; |
|
816 | + if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) { |
|
817 | + return; |
|
818 | + } |
|
808 | 819 | |
809 | 820 | //check for autosave and update our req_data property accordingly. |
810 | 821 | /*if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE && isset( $this->_req_data['ee_autosave_data'] ) ) { |
@@ -828,8 +839,10 @@ discard block |
||
828 | 839 | } |
829 | 840 | } |
830 | 841 | |
831 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
832 | - return; //TODO we'll remove this after reimplementing autosave in 4.2 |
|
842 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
843 | + return; |
|
844 | + } |
|
845 | + //TODO we'll remove this after reimplementing autosave in 4.2 |
|
833 | 846 | $this->_insert_update_cpt_item( $post_id, $post ); |
834 | 847 | } |
835 | 848 | |
@@ -900,7 +913,9 @@ discard block |
||
900 | 913 | */ |
901 | 914 | public function modify_current_screen() { |
902 | 915 | //ONLY do this if the current page_route IS a cpt route |
903 | - if ( !$this->_cpt_route ) return; |
|
916 | + if ( !$this->_cpt_route ) { |
|
917 | + return; |
|
918 | + } |
|
904 | 919 | //routing things REALLY early b/c this is a cpt admin page |
905 | 920 | set_current_screen( $this->_cpt_routes[$this->_req_action]); |
906 | 921 | $this->_current_screen = get_current_screen(); |
@@ -940,8 +955,9 @@ discard block |
||
940 | 955 | public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
941 | 956 | if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
942 | 957 | $post = get_post( $id ); |
943 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
944 | - $shortlink = home_url('?p=' . $post->ID); |
|
958 | + if ( isset($post->post_type) && $this->page_slug == $post->post_type ) { |
|
959 | + $shortlink = home_url('?p=' . $post->ID); |
|
960 | + } |
|
945 | 961 | } |
946 | 962 | return $shortlink; |
947 | 963 | } |
@@ -954,7 +970,9 @@ discard block |
||
954 | 970 | * @return void |
955 | 971 | */ |
956 | 972 | public function route_admin_request() { |
957 | - if ( $this->_cpt_route ) return; |
|
973 | + if ( $this->_cpt_route ) { |
|
974 | + return; |
|
975 | + } |
|
958 | 976 | try { |
959 | 977 | $this->_route_admin_request(); |
960 | 978 | } catch ( EE_Error $e ) { |
@@ -993,8 +1011,9 @@ discard block |
||
993 | 1011 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
994 | 1012 | |
995 | 1013 | //can't do anything without revision so let's get out if not present |
996 | - if ( empty( $rev_id ) ) |
|
997 | - return $location; |
|
1014 | + if ( empty( $rev_id ) ) { |
|
1015 | + return $location; |
|
1016 | + } |
|
998 | 1017 | |
999 | 1018 | //get rev_post_data |
1000 | 1019 | $rev = get_post($rev_id); |
@@ -1023,8 +1042,9 @@ discard block |
||
1023 | 1042 | */ |
1024 | 1043 | public function modify_edit_post_link( $link, $id, $context ) { |
1025 | 1044 | $post = get_post( $id ); |
1026 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1027 | - return $link; |
|
1045 | + if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) { |
|
1046 | + return $link; |
|
1047 | + } |
|
1028 | 1048 | $query_args = array( |
1029 | 1049 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1030 | 1050 | 'post' => $id |
@@ -1044,8 +1064,9 @@ discard block |
||
1044 | 1064 | */ |
1045 | 1065 | public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
1046 | 1066 | $post = get_post($post_id); |
1047 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1048 | - return $delete_link; |
|
1067 | + if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) { |
|
1068 | + return $delete_link; |
|
1069 | + } |
|
1049 | 1070 | |
1050 | 1071 | return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
1051 | 1072 | } |
@@ -1059,8 +1080,9 @@ discard block |
||
1059 | 1080 | * @return string url to redirect to |
1060 | 1081 | */ |
1061 | 1082 | public function cpt_trash_post_location_redirect( $location, $status ) { |
1062 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1063 | - return $location; |
|
1083 | + if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) { |
|
1084 | + return $location; |
|
1085 | + } |
|
1064 | 1086 | |
1065 | 1087 | $post = get_post( $this->_req_data['post'] ); |
1066 | 1088 | $query_args = array( 'action' => 'default' ); |
@@ -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 | } |
@@ -643,17 +643,17 @@ discard block |
||
643 | 643 | * @param int $id The id to retrieve the model object for. If empty we set a default object. |
644 | 644 | * @return void |
645 | 645 | */ |
646 | - protected function _set_model_object( $id = NULL ) { |
|
646 | + protected function _set_model_object($id = NULL) { |
|
647 | 647 | |
648 | - if ( empty( $this->_cpt_model_names ) || ! isset( $this->_cpt_routes[ $this->_req_action ] ) || ( is_object( $this->_cpt_model_obj ) && $this->_cpt_model_obj->ID() == $id )) { |
|
648 | + if (empty($this->_cpt_model_names) || ! isset($this->_cpt_routes[$this->_req_action]) || (is_object($this->_cpt_model_obj) && $this->_cpt_model_obj->ID() == $id)) { |
|
649 | 649 | //get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent. |
650 | 650 | return; |
651 | 651 | } |
652 | 652 | // load CPT object model |
653 | - $model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] ); |
|
654 | - $this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object(); |
|
653 | + $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]); |
|
654 | + $this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object(); |
|
655 | 655 | //d( $this->_cpt_model_obj ); |
656 | - do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' ); |
|
656 | + do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object'); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,47 +667,47 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public function admin_init_global() { |
669 | 669 | |
670 | - $post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL; |
|
670 | + $post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL; |
|
671 | 671 | |
672 | 672 | //its possible this is a new save so let's catch that instead |
673 | - $post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post; |
|
673 | + $post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post; |
|
674 | 674 | $post_type = $post ? $post->post_type : false; |
675 | 675 | |
676 | 676 | $current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork'; |
677 | 677 | |
678 | - $route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
678 | + $route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
679 | 679 | |
680 | - add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 ); |
|
681 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 ); |
|
680 | + add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3); |
|
681 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
682 | 682 | |
683 | 683 | |
684 | - if ( $post_type === $route_to_check ) { |
|
685 | - add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 ); |
|
684 | + if ($post_type === $route_to_check) { |
|
685 | + add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2); |
|
686 | 686 | //catch trashed wp redirect |
687 | - add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 ); |
|
687 | + add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | //now let's filter redirect if we're on a revision page and the revision is for an event CPT. |
691 | - $revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL; |
|
691 | + $revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
|
692 | 692 | |
693 | 693 | /**var_dump($this->_req_data); |
694 | 694 | exit();/**/ |
695 | 695 | |
696 | - if ( !empty( $revision ) ) { |
|
697 | - $action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL; |
|
696 | + if ( ! empty($revision)) { |
|
697 | + $action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL; |
|
698 | 698 | |
699 | 699 | //doing a restore? |
700 | - if ( !empty( $action ) && $action == 'restore' ) { |
|
700 | + if ( ! empty($action) && $action == 'restore') { |
|
701 | 701 | |
702 | 702 | //get post for revision |
703 | - $rev_post = get_post( $revision ); |
|
704 | - $rev_parent = get_post( $rev_post->post_parent ); |
|
703 | + $rev_post = get_post($revision); |
|
704 | + $rev_parent = get_post($rev_post->post_parent); |
|
705 | 705 | |
706 | 706 | //only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts. |
707 | - if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) { |
|
708 | - add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 ); |
|
707 | + if ($rev_parent && $rev_parent->post_type == $this->page_slug) { |
|
708 | + add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2); |
|
709 | 709 | //restores of revisions |
710 | - add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 ); |
|
710 | + add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2); |
|
711 | 711 | } |
712 | 712 | } |
713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | //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! |
717 | 717 | |
718 | 718 | |
719 | - if ( $post_type && $post_type === $route_to_check ) { |
|
719 | + if ($post_type && $post_type === $route_to_check) { |
|
720 | 720 | //$post_id, $post |
721 | - add_action('save_post', array( $this, 'insert_update'), 10, 2 ); |
|
721 | + add_action('save_post', array($this, 'insert_update'), 10, 2); |
|
722 | 722 | |
723 | 723 | //$post_id |
724 | - add_action('trashed_post', array( $this, 'trash_cpt_item' ), 10 ); |
|
725 | - add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 ); |
|
726 | - add_action('untrashed_post', array( $this, 'restore_cpt_item'), 10 ); |
|
727 | - add_action('after_delete_post', array( $this, 'delete_cpt_item'), 10 ); |
|
724 | + add_action('trashed_post', array($this, 'trash_cpt_item'), 10); |
|
725 | + add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10); |
|
726 | + add_action('untrashed_post', array($this, 'restore_cpt_item'), 10); |
|
727 | + add_action('after_delete_post', array($this, 'delete_cpt_item'), 10); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | } |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | * @return void |
740 | 740 | */ |
741 | 741 | public function verify_cpt_object() { |
742 | - $label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
742 | + $label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
743 | 743 | // verify event object |
744 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
745 | - 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 ) ); |
|
744 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
745 | + 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)); |
|
746 | 746 | } |
747 | 747 | //if auto-draft then throw an error |
748 | - if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) { |
|
748 | + if ($this->_cpt_model_obj->get('status') == 'auto-draft') { |
|
749 | 749 | EE_Error::overwrite_errors(); |
750 | - 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__ ); |
|
750 | + 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__); |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | |
@@ -776,22 +776,22 @@ discard block |
||
776 | 776 | public function load_global_scripts_styles() { |
777 | 777 | parent::load_global_scripts_styles(); |
778 | 778 | |
779 | - if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
779 | + if ($this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
780 | 780 | //setup custom post status object for localize script but only if we've got a cpt object |
781 | 781 | $statuses = $this->_cpt_model_obj->get_custom_post_statuses(); |
782 | 782 | |
783 | - if ( !empty($statuses) ) { |
|
783 | + if ( ! empty($statuses)) { |
|
784 | 784 | //get ALL statuses! |
785 | 785 | $statuses = $this->_cpt_model_obj->get_all_post_statuses(); |
786 | 786 | //setup object |
787 | 787 | $ee_cpt_statuses = array(); |
788 | - foreach ( $statuses as $status => $label ) { |
|
788 | + foreach ($statuses as $status => $label) { |
|
789 | 789 | $ee_cpt_statuses[$status] = array( |
790 | 790 | 'label' => $label, |
791 | - 'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label ) |
|
791 | + 'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label) |
|
792 | 792 | ); |
793 | 793 | } |
794 | - wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses ); |
|
794 | + wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | } |
@@ -805,10 +805,10 @@ discard block |
||
805 | 805 | * @param WP_Post $post Post object from WP |
806 | 806 | * @return void |
807 | 807 | */ |
808 | - public function insert_update( $post_id, $post ) { |
|
808 | + public function insert_update($post_id, $post) { |
|
809 | 809 | |
810 | 810 | //make sure that if this is a revision OR trash action that we don't do any updates! |
811 | - if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) |
|
811 | + if (isset($this->_req_data['action']) && ($this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash')) |
|
812 | 812 | return; |
813 | 813 | |
814 | 814 | //check for autosave and update our req_data property accordingly. |
@@ -823,19 +823,19 @@ discard block |
||
823 | 823 | }/**/ //TODO reactivate after autosave is implemented in 4.2 |
824 | 824 | |
825 | 825 | //take care of updating any selected page_template IF this cpt supports it. |
826 | - if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) { |
|
826 | + if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) { |
|
827 | 827 | $post->page_template = $this->_req_data['page_template']; |
828 | - $page_templates = wp_get_theme()->get_page_templates( $post ); |
|
829 | - if ( 'default' != $this->_req_data['page_template'] && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) { |
|
830 | - EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
828 | + $page_templates = wp_get_theme()->get_page_templates($post); |
|
829 | + if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) { |
|
830 | + EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | } else { |
832 | - update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] ); |
|
832 | + update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
836 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
836 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
837 | 837 | return; //TODO we'll remove this after reimplementing autosave in 4.2 |
838 | - $this->_insert_update_cpt_item( $post_id, $post ); |
|
838 | + $this->_insert_update_cpt_item($post_id, $post); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | * @param int $post_id ID of the post |
849 | 849 | * @return void |
850 | 850 | */ |
851 | - public function dont_permanently_delete_ee_cpts( $post_id ) { |
|
852 | - delete_post_meta( $post_id, '_wp_trash_meta_status' ); |
|
851 | + public function dont_permanently_delete_ee_cpts($post_id) { |
|
852 | + delete_post_meta($post_id, '_wp_trash_meta_status'); |
|
853 | 853 | delete_post_meta($post_id, '_wp_trash_meta_time'); |
854 | 854 | |
855 | 855 | //our cpts may have comments so let's take care of that too |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | * @param int $revision_id ID of revision being restored |
869 | 869 | * @return void |
870 | 870 | */ |
871 | - public function restore_revision( $post_id, $revision_id ) { |
|
872 | - $this->_restore_cpt_item( $post_id, $revision_id ); |
|
871 | + public function restore_revision($post_id, $revision_id) { |
|
872 | + $this->_restore_cpt_item($post_id, $revision_id); |
|
873 | 873 | |
874 | 874 | //global action |
875 | - do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
875 | + do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
876 | 876 | |
877 | 877 | //class specific action so you can limit hooking into a specific page. |
878 | - do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id ); |
|
878 | + do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @param int $revision_id ID of revision for item |
887 | 887 | * @return void |
888 | 888 | */ |
889 | - abstract protected function _restore_cpt_item( $post_id, $revision_id ); |
|
889 | + abstract protected function _restore_cpt_item($post_id, $revision_id); |
|
890 | 890 | |
891 | 891 | |
892 | 892 | |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | */ |
906 | 906 | public function modify_current_screen() { |
907 | 907 | //ONLY do this if the current page_route IS a cpt route |
908 | - if ( !$this->_cpt_route ) return; |
|
908 | + if ( ! $this->_cpt_route) return; |
|
909 | 909 | //routing things REALLY early b/c this is a cpt admin page |
910 | - set_current_screen( $this->_cpt_routes[$this->_req_action]); |
|
910 | + set_current_screen($this->_cpt_routes[$this->_req_action]); |
|
911 | 911 | $this->_current_screen = get_current_screen(); |
912 | 912 | $this->_current_screen->base = 'event-espresso'; |
913 | 913 | $this->_add_help_tabs(); //we make sure we add any help tabs back in! |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | * @param string $title The new title (or existing if there is no editor_title defined) |
929 | 929 | * @return string |
930 | 930 | */ |
931 | - public function add_custom_editor_default_title( $title ) { |
|
932 | - return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
931 | + public function add_custom_editor_default_title($title) { |
|
932 | + return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | |
@@ -942,11 +942,11 @@ discard block |
||
942 | 942 | * @param bool $allow_slugs Whether to allow post slugs in the shortlink. |
943 | 943 | * @return string |
944 | 944 | */ |
945 | - public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
|
946 | - if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
|
947 | - $post = get_post( $id ); |
|
948 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
949 | - $shortlink = home_url('?p=' . $post->ID); |
|
945 | + public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) { |
|
946 | + if ( ! empty($id) && '' != get_option('permalink_structure')) { |
|
947 | + $post = get_post($id); |
|
948 | + if (isset($post->post_type) && $this->page_slug == $post->post_type) |
|
949 | + $shortlink = home_url('?p='.$post->ID); |
|
950 | 950 | } |
951 | 951 | return $shortlink; |
952 | 952 | } |
@@ -959,10 +959,10 @@ discard block |
||
959 | 959 | * @return void |
960 | 960 | */ |
961 | 961 | public function route_admin_request() { |
962 | - if ( $this->_cpt_route ) return; |
|
962 | + if ($this->_cpt_route) return; |
|
963 | 963 | try { |
964 | 964 | $this->_route_admin_request(); |
965 | - } catch ( EE_Error $e ) { |
|
965 | + } catch (EE_Error $e) { |
|
966 | 966 | $e->get_error(); |
967 | 967 | } |
968 | 968 | } |
@@ -975,12 +975,12 @@ discard block |
||
975 | 975 | * @return string html |
976 | 976 | */ |
977 | 977 | public function cpt_post_form_hidden_input() { |
978 | - echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />'; |
|
978 | + echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />'; |
|
979 | 979 | |
980 | 980 | //we're also going to add the route value and the current page so we can direct autosave parsing correctly |
981 | 981 | echo '<div id="ee-cpt-hidden-inputs">'; |
982 | - echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />'; |
|
983 | - echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />'; |
|
982 | + echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />'; |
|
983 | + echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />'; |
|
984 | 984 | echo '</div>'; |
985 | 985 | } |
986 | 986 | |
@@ -993,12 +993,12 @@ discard block |
||
993 | 993 | * @param int $status Status for http header |
994 | 994 | * @return string new (or original) url to redirect to. |
995 | 995 | */ |
996 | - public function revision_redirect( $location, $status ) { |
|
996 | + public function revision_redirect($location, $status) { |
|
997 | 997 | //get revision |
998 | 998 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
999 | 999 | |
1000 | 1000 | //can't do anything without revision so let's get out if not present |
1001 | - if ( empty( $rev_id ) ) |
|
1001 | + if (empty($rev_id)) |
|
1002 | 1002 | return $location; |
1003 | 1003 | |
1004 | 1004 | //get rev_post_data |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | 'message' => 5 |
1013 | 1013 | ); |
1014 | 1014 | |
1015 | - $this->_process_notices( $query_args, TRUE ); |
|
1016 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1015 | + $this->_process_notices($query_args, TRUE); |
|
1016 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | |
@@ -1026,16 +1026,16 @@ discard block |
||
1026 | 1026 | * @param string $context optional, defaults to display. How to write the '&' |
1027 | 1027 | * @return string the link |
1028 | 1028 | */ |
1029 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
1030 | - $post = get_post( $id ); |
|
1031 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1029 | + public function modify_edit_post_link($link, $id, $context) { |
|
1030 | + $post = get_post($id); |
|
1031 | + if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]) |
|
1032 | 1032 | return $link; |
1033 | 1033 | $query_args = array( |
1034 | 1034 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1035 | 1035 | 'post' => $id |
1036 | 1036 | ); |
1037 | 1037 | |
1038 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1038 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
@@ -1047,12 +1047,12 @@ discard block |
||
1047 | 1047 | * @param bool $force_delete whether this is forcing a hard delete instead of trash |
1048 | 1048 | * @return string new delete link |
1049 | 1049 | */ |
1050 | - public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
|
1050 | + public function modify_delete_post_link($delete_link, $post_id, $force_delete) { |
|
1051 | 1051 | $post = get_post($post_id); |
1052 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1052 | + if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])) |
|
1053 | 1053 | return $delete_link; |
1054 | 1054 | |
1055 | - return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
|
1055 | + return add_query_arg(array('current_route' => 'trash'), $delete_link); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | |
@@ -1063,16 +1063,16 @@ discard block |
||
1063 | 1063 | * @param string $status status |
1064 | 1064 | * @return string url to redirect to |
1065 | 1065 | */ |
1066 | - public function cpt_trash_post_location_redirect( $location, $status ) { |
|
1067 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1066 | + public function cpt_trash_post_location_redirect($location, $status) { |
|
1067 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post'])) |
|
1068 | 1068 | return $location; |
1069 | 1069 | |
1070 | - $post = get_post( $this->_req_data['post'] ); |
|
1071 | - $query_args = array( 'action' => 'default' ); |
|
1070 | + $post = get_post($this->_req_data['post']); |
|
1071 | + $query_args = array('action' => 'default'); |
|
1072 | 1072 | $this->_cpt_object = get_post_type_object($post->post_type); |
1073 | - EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) ); |
|
1074 | - $this->_process_notices( $query_args, TRUE ); |
|
1075 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1073 | + EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name)); |
|
1074 | + $this->_process_notices($query_args, TRUE); |
|
1075 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @param string $post_id This is the 'ID' value of the wp_posts table |
1088 | 1088 | * @return string the new location to redirect to |
1089 | 1089 | */ |
1090 | - public function cpt_post_location_redirect( $location, $post_id ) { |
|
1090 | + public function cpt_post_location_redirect($location, $post_id) { |
|
1091 | 1091 | //we DO have a match so let's setup the url |
1092 | 1092 | |
1093 | 1093 | //we have to get the post to determine our route |
@@ -1095,14 +1095,14 @@ discard block |
||
1095 | 1095 | $edit_route = $this->_cpt_edit_routes[$post->post_type]; |
1096 | 1096 | |
1097 | 1097 | //shared query_args |
1098 | - $query_args = array( 'action' => $edit_route, 'post' => $post_id ); |
|
1098 | + $query_args = array('action' => $edit_route, 'post' => $post_id); |
|
1099 | 1099 | $admin_url = $this->_admin_base_url; |
1100 | 1100 | // $append = ''; |
1101 | 1101 | |
1102 | - if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) { |
|
1103 | - $status = get_post_status( $post_id ); |
|
1104 | - if ( isset( $this->_req_data['publish'] ) ) { |
|
1105 | - switch ( $status ) { |
|
1102 | + if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) { |
|
1103 | + $status = get_post_status($post_id); |
|
1104 | + if (isset($this->_req_data['publish'])) { |
|
1105 | + switch ($status) { |
|
1106 | 1106 | case 'pending': |
1107 | 1107 | $message = 8; |
1108 | 1108 | break; |
@@ -1115,13 +1115,13 @@ discard block |
||
1115 | 1115 | } else { |
1116 | 1116 | $message = 'draft' == $status ? 10 : 1; |
1117 | 1117 | } |
1118 | - } else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) { |
|
1118 | + } else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) { |
|
1119 | 1119 | $message = 2; |
1120 | 1120 | // $append = '#postcustom'; |
1121 | - } else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) { |
|
1121 | + } else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) { |
|
1122 | 1122 | $message = 3; |
1123 | 1123 | // $append = '#postcustom'; |
1124 | - } elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) { |
|
1124 | + } elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') { |
|
1125 | 1125 | $message = 7; |
1126 | 1126 | } else { |
1127 | 1127 | $message = 4; |
@@ -1129,12 +1129,12 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | //change the message if the post type is not viewable on the frontend |
1131 | 1131 | $this->_cpt_object = get_post_type_object($post->post_type); |
1132 | - $message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1132 | + $message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1133 | 1133 | |
1134 | - $query_args = array_merge( array( 'message' => $message ), $query_args ); |
|
1134 | + $query_args = array_merge(array('message' => $message), $query_args); |
|
1135 | 1135 | |
1136 | - $this->_process_notices( $query_args, TRUE ); |
|
1137 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1136 | + $this->_process_notices($query_args, TRUE); |
|
1137 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | |
@@ -1166,10 +1166,10 @@ discard block |
||
1166 | 1166 | * @param array $messages the original messages array |
1167 | 1167 | * @return array the new messages array |
1168 | 1168 | */ |
1169 | - public function post_update_messages( $messages ) { |
|
1169 | + public function post_update_messages($messages) { |
|
1170 | 1170 | global $post; |
1171 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1172 | - $id = empty( $id ) && is_object( $post ) ? $post->ID : NULL; |
|
1171 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1172 | + $id = empty($id) && is_object($post) ? $post->ID : NULL; |
|
1173 | 1173 | |
1174 | 1174 | // $post_type = $post ? $post->post_type : false; |
1175 | 1175 | |
@@ -1182,9 +1182,9 @@ discard block |
||
1182 | 1182 | 0 => '', //Unused. Messages start at index 1. |
1183 | 1183 | |
1184 | 1184 | 1 => sprintf( |
1185 | - __( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1185 | + __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1186 | 1186 | $this->_cpt_object->labels->singular_name, |
1187 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1187 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1188 | 1188 | '</a>' |
1189 | 1189 | ), |
1190 | 1190 | |
@@ -1192,38 +1192,38 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | 3 => __('Custom field deleted.'), |
1194 | 1194 | |
1195 | - 4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1195 | + 4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1196 | 1196 | |
1197 | - 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, |
|
1197 | + 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, |
|
1198 | 1198 | |
1199 | 1199 | 6 => sprintf( |
1200 | - __( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1200 | + __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1201 | 1201 | $this->_cpt_object->labels->singular_name, |
1202 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1202 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1203 | 1203 | '</a>' |
1204 | 1204 | ), |
1205 | 1205 | |
1206 | - 7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1206 | + 7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1207 | 1207 | |
1208 | 1208 | 8 => sprintf( |
1209 | 1209 | __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'), |
1210 | 1210 | $this->_cpt_object->labels->singular_name, |
1211 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">', |
|
1211 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">', |
|
1212 | 1212 | '</a>' |
1213 | 1213 | ), |
1214 | 1214 | |
1215 | 1215 | 9 => sprintf( |
1216 | - __( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1216 | + __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1217 | 1217 | $this->_cpt_object->labels->singular_name, |
1218 | - '<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>', |
|
1219 | - '<a target="_blank" href="' . esc_url( get_permalink( $id )), |
|
1218 | + '<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>', |
|
1219 | + '<a target="_blank" href="'.esc_url(get_permalink($id)), |
|
1220 | 1220 | '</a>' |
1221 | 1221 | ), |
1222 | 1222 | |
1223 | 1223 | 10 => sprintf( |
1224 | 1224 | __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'), |
1225 | 1225 | $this->_cpt_object->labels->singular_name, |
1226 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) , |
|
1226 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))), |
|
1227 | 1227 | '</a>' |
1228 | 1228 | ) |
1229 | 1229 | ); |
@@ -1250,24 +1250,24 @@ discard block |
||
1250 | 1250 | $post_type_object = $this->_cpt_object; |
1251 | 1251 | $title = $post_type_object->labels->add_new_item; |
1252 | 1252 | $editing = TRUE; |
1253 | - wp_enqueue_script( 'autosave' ); |
|
1254 | - $post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE ); |
|
1253 | + wp_enqueue_script('autosave'); |
|
1254 | + $post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE); |
|
1255 | 1255 | $post_ID = $post->ID; |
1256 | 1256 | $is_IE = $is_IE; |
1257 | 1257 | |
1258 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1258 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1259 | 1259 | |
1260 | 1260 | //modify the default editor title field with default title. |
1261 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1261 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1262 | 1262 | |
1263 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1263 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | |
1267 | 1267 | |
1268 | 1268 | |
1269 | 1269 | public function add_new_admin_page_global() { |
1270 | - $admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php'; |
|
1270 | + $admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php'; |
|
1271 | 1271 | ?> |
1272 | 1272 | <script type="text/javascript"> |
1273 | 1273 | adminpage = '<?php echo $admin_page; ?>'; |
@@ -1289,16 +1289,16 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | protected function _edit_cpt_item() { |
1291 | 1291 | global $post, $title, $is_IE, $post_type, $post_type_object; |
1292 | - $post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1293 | - $post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL; |
|
1292 | + $post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1293 | + $post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL; |
|
1294 | 1294 | |
1295 | - if ( empty ( $post ) ) { |
|
1296 | - wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); |
|
1295 | + if (empty ($post)) { |
|
1296 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
1300 | - wp_set_post_lock( $post_id ); |
|
1301 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
1299 | + if ( ! empty($_GET['get-post-lock'])) { |
|
1300 | + wp_set_post_lock($post_id); |
|
1301 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
1302 | 1302 | exit(); |
1303 | 1303 | } |
1304 | 1304 | |
@@ -1310,32 +1310,32 @@ discard block |
||
1310 | 1310 | $post_type_object = $this->_cpt_object; |
1311 | 1311 | $is_IE = $is_IE; |
1312 | 1312 | |
1313 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
1314 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
1313 | + if ( ! wp_check_post_lock($post->ID)) { |
|
1314 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
1315 | 1315 | //wp_enqueue_script('autosave'); |
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | $title = $this->_cpt_object->labels->edit_item; |
1319 | 1319 | |
1320 | - add_action('admin_footer', '_admin_notice_post_locked' ); |
|
1320 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
1321 | 1321 | |
1322 | - if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) { |
|
1323 | - $create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this ); |
|
1322 | + if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) { |
|
1323 | + $create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this); |
|
1324 | 1324 | |
1325 | - $post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' ); |
|
1325 | + $post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php'); |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | - if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) { |
|
1328 | + if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) { |
|
1329 | 1329 | wp_enqueue_script('admin-comments'); |
1330 | 1330 | enqueue_comment_hotkeys_js(); |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1333 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1334 | 1334 | |
1335 | 1335 | //modify the default editor title field with default title. |
1336 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1336 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1337 | 1337 | |
1338 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1338 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1339 | 1339 | |
1340 | 1340 | } |
1341 | 1341 |
@@ -1,23 +1,23 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * EE_Admin_Page_CPT class |
|
4 | - * |
|
5 | - * This class is for child classes that utilize core WP CPT views for add/edit pages. All you have to do is extend this class instead of the usual EE_Admin_Page class for your child. |
|
6 | - * |
|
7 | - * Please not the following caveats: |
|
8 | - * |
|
9 | - * 1. When using add_meta_box() - it must use $this->wp_page_slug as the screen_id for the page NOT $this->_current_screen->id. This is b/c there is a bug with how WP renders its custom post type pages that doesn't accept the default current_screen for metaboxes. |
|
10 | - * |
|
11 | - * 2. the same is true for any help_tabs or screen_options you want to add to custom post type views. |
|
12 | - * |
|
13 | - * 3. it is EXPECTED that $this->page_slug will be IDENTICAL to what slug/id was used when doing register_post_type(). So for instance, if you registered a "books" post type then $this->page_slug = 'espresso_books' would NOT be valid. So the correct id for the new post type would be "espresso_books". Remember, you can still use something totally different for front-end rewrite slugs in your configuration array for the register post type. |
|
14 | - * |
|
15 | - * @package Event Espresso |
|
16 | - * @subpackage includes/core/admin/EE_Admin_Page.core.php |
|
17 | - * @abstract |
|
18 | - * @author Darren Ethier |
|
19 | - * |
|
20 | - */ |
|
3 | + * EE_Admin_Page_CPT class |
|
4 | + * |
|
5 | + * This class is for child classes that utilize core WP CPT views for add/edit pages. All you have to do is extend this class instead of the usual EE_Admin_Page class for your child. |
|
6 | + * |
|
7 | + * Please not the following caveats: |
|
8 | + * |
|
9 | + * 1. When using add_meta_box() - it must use $this->wp_page_slug as the screen_id for the page NOT $this->_current_screen->id. This is b/c there is a bug with how WP renders its custom post type pages that doesn't accept the default current_screen for metaboxes. |
|
10 | + * |
|
11 | + * 2. the same is true for any help_tabs or screen_options you want to add to custom post type views. |
|
12 | + * |
|
13 | + * 3. it is EXPECTED that $this->page_slug will be IDENTICAL to what slug/id was used when doing register_post_type(). So for instance, if you registered a "books" post type then $this->page_slug = 'espresso_books' would NOT be valid. So the correct id for the new post type would be "espresso_books". Remember, you can still use something totally different for front-end rewrite slugs in your configuration array for the register post type. |
|
14 | + * |
|
15 | + * @package Event Espresso |
|
16 | + * @subpackage includes/core/admin/EE_Admin_Page.core.php |
|
17 | + * @abstract |
|
18 | + * @author Darren Ethier |
|
19 | + * |
|
20 | + */ |
|
21 | 21 | abstract class EE_Admin_Page_CPT extends EE_Admin_Page { |
22 | 22 | |
23 | 23 | |
@@ -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 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function do_initial_loads() { |
33 | 33 | //we want to use the corresponding admin page object (but not route it!). To do this we just set _routing to false. That way this page object is being loaded on all pages to make sure we hook into admin properly. But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;) |
34 | 34 | //This is important because we have hooks that help redirect custom post type saves |
35 | - if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) { |
|
35 | + if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) { |
|
36 | 36 | $this->_routing = FALSE; |
37 | 37 | $this->_initialize_admin_page(); |
38 | 38 | } else { |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | $this->_initialize_admin_page(); |
41 | 41 | //added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality |
42 | 42 | remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization'); |
43 | - add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 ); |
|
43 | + add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100); |
|
44 | 44 | //end removal of autosave functionality. |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function wp_just_in_time_script_localization() { |
49 | - wp_localize_script( 'autosave', 'autosaveL10n', array( |
|
49 | + wp_localize_script('autosave', 'autosaveL10n', array( |
|
50 | 50 | 'autosaveInterval' => 172800, |
51 | 51 | 'savingText' => __('Saving Draft…'), |
52 | 52 | 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.') |
53 | - ) ); |
|
53 | + )); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 |
@@ -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 | * |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | - * @ link {@link http://www.eventespresso.com} |
|
12 | - * @ since 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | + * @ link {@link http://www.eventespresso.com} |
|
12 | + * @ since 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + */ |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * EE_Admin_Page_Init |
@@ -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 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | //let's do a scan and see what installed pages we have |
120 | 120 | $this->_get_installed_pages(); |
121 | 121 | //set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to). |
122 | - add_action('admin_menu', array( $this, 'set_menus' )); |
|
123 | - add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) ); |
|
122 | + add_action('admin_menu', array($this, 'set_menus')); |
|
123 | + add_action('network_admin_menu', array($this, 'set_network_menus')); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @return void |
134 | 134 | */ |
135 | 135 | private function _define_caffeinated_constants() { |
136 | - if ( ! defined( 'EE_CORE_CAF_ADMIN' ) ) { |
|
137 | - define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/'); |
|
138 | - define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/'); |
|
139 | - define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/'); |
|
140 | - define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/'); |
|
141 | - define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/'); |
|
142 | - define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/'); |
|
136 | + if ( ! defined('EE_CORE_CAF_ADMIN')) { |
|
137 | + define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/'); |
|
138 | + define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/'); |
|
139 | + define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/'); |
|
140 | + define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/'); |
|
141 | + define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/'); |
|
142 | + define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/'); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | //set array of EE_Admin_Page_Menu_Group objects |
160 | 160 | $groups = array( |
161 | - 'main' => new EE_Admin_Page_Menu_Group( array( |
|
161 | + 'main' => new EE_Admin_Page_Menu_Group(array( |
|
162 | 162 | 'menu_label' => __('Main', 'event_espresso'), |
163 | 163 | 'show_on_menu' => EE_Admin_Page_Menu_Map::NONE, |
164 | 164 | 'menu_slug' => 'main', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'menu_order' => 0, |
167 | 167 | 'parent_slug' => 'espresso_events', |
168 | 168 | )), |
169 | - 'management' => new EE_Admin_Page_Menu_Group( array( |
|
169 | + 'management' => new EE_Admin_Page_Menu_Group(array( |
|
170 | 170 | 'menu_label' => __('Management', 'event_espresso'), |
171 | 171 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
172 | 172 | 'menu_slug' => 'management', |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | 'menu_order' => 10, |
175 | 175 | 'parent_slug' => 'espresso_events' |
176 | 176 | )), |
177 | - 'settings' => new EE_Admin_Page_Menu_Group( array( |
|
177 | + 'settings' => new EE_Admin_Page_Menu_Group(array( |
|
178 | 178 | 'menu_label' => __('Settings', 'event_espresso'), |
179 | 179 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
180 | 180 | 'menu_slug' => 'settings', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'menu_order' => 30, |
183 | 183 | 'parent_slug' => 'espresso_events' |
184 | 184 | )), |
185 | - 'templates' => new EE_Admin_Page_Menu_Group( array( |
|
185 | + 'templates' => new EE_Admin_Page_Menu_Group(array( |
|
186 | 186 | 'menu_label' => __('Templates', 'event_espresso'), |
187 | 187 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
188 | 188 | 'menu_slug' => 'templates', |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | 'menu_order' => 40, |
191 | 191 | 'parent_slug' => 'espresso_events' |
192 | 192 | )), |
193 | - 'extras' => new EE_Admin_Page_Menu_Group( array( |
|
193 | + 'extras' => new EE_Admin_Page_Menu_Group(array( |
|
194 | 194 | 'menu_label' => __('Extras', 'event_espresso'), |
195 | 195 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
196 | 196 | 'menu_slug' => 'extras', |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | 'parent_slug' => 'espresso_events', |
200 | 200 | 'maintenance_mode_parent' => 'espresso_maintenance_settings' |
201 | 201 | )), |
202 | - 'tools' => new EE_Admin_Page_Menu_Group( array( |
|
202 | + 'tools' => new EE_Admin_Page_Menu_Group(array( |
|
203 | 203 | 'menu_label' => __("Tools", "event_espresso"), |
204 | 204 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
205 | 205 | 'menu_slug' => 'tools', |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'menu_order' => 60, |
208 | 208 | 'parent_slug' => 'espresso_events' |
209 | 209 | )), |
210 | - 'addons' => new EE_Admin_Page_Menu_Group( array( |
|
210 | + 'addons' => new EE_Admin_Page_Menu_Group(array( |
|
211 | 211 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
212 | 212 | 'menu_label' => __('Add-ons', 'event_espresso'), |
213 | 213 | 'menu_slug' => 'addons', |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | )) |
218 | 218 | ); |
219 | 219 | |
220 | - $this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups ); |
|
220 | + $this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | private function _rearrange_menu_groups() { |
236 | 236 | $groups = array(); |
237 | 237 | //first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects ) |
238 | - usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) ); |
|
239 | - foreach ( $this->_admin_menu_groups as $group ) { |
|
240 | - if ( ! $group instanceof EE_Admin_Page_Menu_Group ) |
|
241 | - throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
238 | + usort($this->_admin_menu_groups, array($this, '_sort_menu_maps')); |
|
239 | + foreach ($this->_admin_menu_groups as $group) { |
|
240 | + if ( ! $group instanceof EE_Admin_Page_Menu_Group) |
|
241 | + throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE))); |
|
242 | 242 | $groups[$group->menu_slug] = $group; |
243 | 243 | } |
244 | 244 | return $groups; |
@@ -256,48 +256,48 @@ discard block |
||
256 | 256 | */ |
257 | 257 | private function _get_installed_pages() { |
258 | 258 | $installed_refs = array(); |
259 | - $exclude = array( 'assets', 'templates' ); |
|
259 | + $exclude = array('assets', 'templates'); |
|
260 | 260 | // grab everything in the admin core directory |
261 | - $admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR ); |
|
262 | - if ( $admin_screens ) { |
|
263 | - foreach( $admin_screens as $admin_screen ) { |
|
261 | + $admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR); |
|
262 | + if ($admin_screens) { |
|
263 | + foreach ($admin_screens as $admin_screen) { |
|
264 | 264 | // files and anything in the exclude array need not apply |
265 | - if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) { |
|
265 | + if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) { |
|
266 | 266 | // these folders represent the different EE admin pages |
267 | - $installed_refs[ basename( $admin_screen ) ] = $admin_screen; |
|
267 | + $installed_refs[basename($admin_screen)] = $admin_screen; |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | - if ( empty( $installed_refs ) ) { |
|
272 | + if (empty($installed_refs)) { |
|
273 | 273 | $error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso'); |
274 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES ); |
|
275 | - throw new EE_Error( implode( '||', $error_msg )); |
|
274 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES); |
|
275 | + throw new EE_Error(implode('||', $error_msg)); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | //this just checks the caffeinated folder and takes care of setting up any caffeinated stuff. |
279 | 279 | $installed_refs = $this->_set_caffeinated($installed_refs); |
280 | 280 | //allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.; |
281 | - $installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs ); |
|
282 | - $this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends ); |
|
281 | + $installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs); |
|
282 | + $this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends); |
|
283 | 283 | |
284 | 284 | //loop through admin pages and setup the $_installed_pages array. |
285 | 285 | $hooks_ref = array(); |
286 | - foreach ( $installed_refs as $page => $path ) { |
|
286 | + foreach ($installed_refs as $page => $path) { |
|
287 | 287 | // set autoloaders for our admin page classes based on included path information |
288 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path ); |
|
288 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path); |
|
289 | 289 | // build list of installed pages |
290 | - $this->_installed_pages[$page] = $this->_load_admin_page( $page, $path ); |
|
290 | + $this->_installed_pages[$page] = $this->_load_admin_page($page, $path); |
|
291 | 291 | // verify returned object |
292 | - if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) { |
|
293 | - if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) { |
|
292 | + if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) { |
|
293 | + if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) { |
|
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | 297 | //skip if in full maintenance mode and maintenance_mode_parent is set |
298 | 298 | $maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent; |
299 | - if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
300 | - unset( $installed_refs[$page] ); |
|
299 | + if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
300 | + unset($installed_refs[$page]); |
|
301 | 301 | continue; |
302 | 302 | } |
303 | 303 | |
@@ -305,45 +305,45 @@ discard block |
||
305 | 305 | //flag for register hooks on extended pages b/c extended pages use the default INIT. |
306 | 306 | $extend = FALSE; |
307 | 307 | //now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals. If there are then let's hook into the init admin filter and load our extend instead. |
308 | - if ( isset( $this->_caffeinated_extends[$page] ) ) { |
|
308 | + if (isset($this->_caffeinated_extends[$page])) { |
|
309 | 309 | $this->_current_caf_extend_slug = $page; |
310 | - $path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name(); |
|
311 | - $path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";'; |
|
312 | - $page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name(); |
|
313 | - $page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";'; |
|
310 | + $path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name(); |
|
311 | + $path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";'; |
|
312 | + $page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name(); |
|
313 | + $page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";'; |
|
314 | 314 | |
315 | - $hook_function_path = create_function( '$path_to_file', $path_runtime); |
|
316 | - $hook_function_page = create_function( '$admin_page', $page_runtime ); |
|
315 | + $hook_function_path = create_function('$path_to_file', $path_runtime); |
|
316 | + $hook_function_page = create_function('$admin_page', $page_runtime); |
|
317 | 317 | |
318 | - add_filter( $path_hook, $hook_function_path ); |
|
319 | - add_filter( $page_hook, $hook_function_page ); |
|
318 | + add_filter($path_hook, $hook_function_path); |
|
319 | + add_filter($page_hook, $hook_function_page); |
|
320 | 320 | $extend = TRUE; |
321 | 321 | } |
322 | 322 | //let's do the registered hooks |
323 | - $extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend ); |
|
323 | + $extended_hooks = $this->_installed_pages[$page]->register_hooks($extend); |
|
324 | 324 | $hooks_ref = array_merge($hooks_ref, $extended_hooks); |
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | 328 | //the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder. So we want to make sure we load the file for the parent. |
329 | 329 | //first make sure we've got unique values |
330 | - $hooks_ref = array_unique( $hooks_ref ); |
|
330 | + $hooks_ref = array_unique($hooks_ref); |
|
331 | 331 | //now let's loop and require! |
332 | - foreach ( $hooks_ref as $path ) { |
|
333 | - require_once( $path ); |
|
332 | + foreach ($hooks_ref as $path) { |
|
333 | + require_once($path); |
|
334 | 334 | } |
335 | 335 | //make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested. |
336 | 336 | global $ee_menu_slugs; |
337 | 337 | $ee_menu_slugs = $this->_menu_slugs; |
338 | 338 | |
339 | 339 | //we need to loop again to run any early code |
340 | - foreach ( $installed_refs as $page => $path ) { |
|
341 | - if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) { |
|
340 | + foreach ($installed_refs as $page => $path) { |
|
341 | + if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) { |
|
342 | 342 | $this->_installed_pages[$page]->do_initial_loads(); |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages ); |
|
346 | + do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages); |
|
347 | 347 | |
348 | 348 | } |
349 | 349 | |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | * @param string $page_slug |
356 | 356 | * @return EE_Admin_Page |
357 | 357 | */ |
358 | - public function get_admin_page_object( $page_slug = '' ) { |
|
359 | - if ( isset( $this->_installed_pages[ $page_slug ] )) { |
|
360 | - return $this->_installed_pages[ $page_slug ]->loaded_page_object(); |
|
358 | + public function get_admin_page_object($page_slug = '') { |
|
359 | + if (isset($this->_installed_pages[$page_slug])) { |
|
360 | + return $this->_installed_pages[$page_slug]->loaded_page_object(); |
|
361 | 361 | } |
362 | 362 | return NULL; |
363 | 363 | } |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | * @param $dir_name |
371 | 371 | * @return string |
372 | 372 | */ |
373 | - private function _get_classname_for_admin_page( $dir_name = '' ) { |
|
374 | - $class_name = str_replace( '_', ' ', strtolower( $dir_name )); |
|
375 | - return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page'; |
|
373 | + private function _get_classname_for_admin_page($dir_name = '') { |
|
374 | + $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
375 | + return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page'; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | * @param $dir_name |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - private function _get_classname_for_admin_init_page( $dir_name = '' ) { |
|
387 | - $class_name = str_replace( '_', ' ', strtolower( $dir_name )); |
|
388 | - return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init'; |
|
386 | + private function _get_classname_for_admin_init_page($dir_name = '') { |
|
387 | + $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
388 | + return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init'; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | |
@@ -398,13 +398,13 @@ discard block |
||
398 | 398 | * @throws EE_Error |
399 | 399 | * @return object|bool return page object if valid, bool false if not. |
400 | 400 | */ |
401 | - private function _load_admin_page( $page = '', $path = '' ) { |
|
402 | - $class_name = $this->_get_classname_for_admin_init_page( $page ); |
|
403 | - EE_Registry::instance()->load_file( $path, $class_name, 'core' ); |
|
404 | - if ( ! class_exists( $class_name )) { |
|
405 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page); |
|
406 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name ); |
|
407 | - throw new EE_Error( implode( '||', $error_msg )); |
|
401 | + private function _load_admin_page($page = '', $path = '') { |
|
402 | + $class_name = $this->_get_classname_for_admin_init_page($page); |
|
403 | + EE_Registry::instance()->load_file($path, $class_name, 'core'); |
|
404 | + if ( ! class_exists($class_name)) { |
|
405 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page); |
|
406 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name); |
|
407 | + throw new EE_Error(implode('||', $error_msg)); |
|
408 | 408 | } |
409 | 409 | $a = new ReflectionClass($class_name); |
410 | 410 | return $a->newInstance(); |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | public function set_menus() { |
424 | 424 | //prep the menu pages (sort, group.) |
425 | 425 | $this->_prep_pages(); |
426 | - foreach( $this->_prepped_menu_maps as $menu_map ) { |
|
427 | - if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) { |
|
428 | - $menu_map->add_menu_page( FALSE ); |
|
426 | + foreach ($this->_prepped_menu_maps as $menu_map) { |
|
427 | + if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) { |
|
428 | + $menu_map->add_menu_page(FALSE); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | } |
@@ -438,11 +438,11 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return void |
440 | 440 | */ |
441 | - public function set_network_menus(){ |
|
441 | + public function set_network_menus() { |
|
442 | 442 | $this->_prep_pages(); |
443 | - foreach( $this->_prepped_menu_maps as $menu_map ) { |
|
444 | - if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) { |
|
445 | - $menu_map->add_menu_page( TRUE ); |
|
443 | + foreach ($this->_prepped_menu_maps as $menu_map) { |
|
444 | + if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) { |
|
445 | + $menu_map->add_menu_page(TRUE); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
@@ -463,22 +463,22 @@ discard block |
||
463 | 463 | //rearrange _admin_menu_groups to be indexed by group slug. |
464 | 464 | $menu_groups = $this->_rearrange_menu_groups(); |
465 | 465 | |
466 | - foreach( $this->_installed_pages as $page ) { |
|
467 | - if ( $page instanceof EE_Admin_page_Init ) { |
|
466 | + foreach ($this->_installed_pages as $page) { |
|
467 | + if ($page instanceof EE_Admin_page_Init) { |
|
468 | 468 | $page_map = $page->get_menu_map(); |
469 | 469 | //if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item. |
470 | - if ( is_array( $page_map ) || empty( $page_map ) ) { |
|
471 | - EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core. This means that full functionality for this component is not available. This error message usually appears with an Add-on that is out of date. Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) ); |
|
470 | + if (is_array($page_map) || empty($page_map)) { |
|
471 | + EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core. This means that full functionality for this component is not available. This error message usually appears with an Add-on that is out of date. Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label)); |
|
472 | 472 | continue; |
473 | 473 | } |
474 | 474 | |
475 | 475 | //if page map is NOT a EE_Admin_Page_Menu_Map object then throw error. |
476 | - if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) { |
|
477 | - throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object. Instead it is %s. Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) ); |
|
476 | + if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) { |
|
477 | + throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object. Instead it is %s. Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map)); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | //use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array. |
481 | - if ( empty( $page_map->maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
481 | + if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
482 | 482 | continue; |
483 | 483 | } |
484 | 484 | |
@@ -487,21 +487,21 @@ discard block |
||
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | - if ( empty( $pages_array )) { |
|
491 | - throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') ); |
|
490 | + if (empty($pages_array)) { |
|
491 | + throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso')); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | //let's sort the groups, make sure it's a valid group, add header (if to show). |
495 | - foreach ( $pages_array as $group => $menu_maps ) { |
|
495 | + foreach ($pages_array as $group => $menu_maps) { |
|
496 | 496 | //valid_group? |
497 | - if ( ! array_key_exists( $group, $menu_groups ) ) |
|
497 | + if ( ! array_key_exists($group, $menu_groups)) |
|
498 | 498 | continue; |
499 | 499 | |
500 | 500 | //sort pages. |
501 | - usort( $menu_maps, array( $this, '_sort_menu_maps' ) ); |
|
501 | + usort($menu_maps, array($this, '_sort_menu_maps')); |
|
502 | 502 | |
503 | 503 | //prepend header |
504 | - array_unshift( $menu_maps, $menu_groups[$group] ); |
|
504 | + array_unshift($menu_maps, $menu_groups[$group]); |
|
505 | 505 | |
506 | 506 | //reset $pages_array with prepped data |
507 | 507 | $pages_array[$group] = $menu_maps; |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | |
510 | 510 | |
511 | 511 | //now let's setup the _prepped_menu_maps property |
512 | - foreach ( $menu_groups as $group => $group_objs ) { |
|
513 | - if ( isset( $pages_array[$group] ) ) |
|
514 | - $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
512 | + foreach ($menu_groups as $group => $group_objs) { |
|
513 | + if (isset($pages_array[$group])) |
|
514 | + $this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]); |
|
515 | 515 | }/**/ |
516 | 516 | |
517 | 517 | } |
@@ -531,10 +531,10 @@ discard block |
||
531 | 531 | * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded. |
532 | 532 | * @return array |
533 | 533 | */ |
534 | - private function _set_caffeinated( $installed_refs ) { |
|
534 | + private function _set_caffeinated($installed_refs) { |
|
535 | 535 | |
536 | 536 | //first let's check if there IS a caffeinated folder. If there is not then lets get out. |
537 | - if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) { |
|
537 | + if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) { |
|
538 | 538 | return $installed_refs; |
539 | 539 | } |
540 | 540 | |
@@ -543,15 +543,15 @@ discard block |
||
543 | 543 | $exclude = array('tickets'); |
544 | 544 | |
545 | 545 | //okay let's setup an "New" pages first (we'll return installed refs later) |
546 | - $new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR ); |
|
547 | - if ( $new_admin_screens ) { |
|
548 | - foreach( $new_admin_screens as $admin_screen ) { |
|
546 | + $new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR); |
|
547 | + if ($new_admin_screens) { |
|
548 | + foreach ($new_admin_screens as $admin_screen) { |
|
549 | 549 | // files and anything in the exclude array need not apply |
550 | - if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) { |
|
550 | + if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) { |
|
551 | 551 | // these folders represent the different NEW EE admin pages |
552 | - $installed_refs[ basename( $admin_screen ) ] = $admin_screen; |
|
552 | + $installed_refs[basename($admin_screen)] = $admin_screen; |
|
553 | 553 | // set autoloaders for our admin page classes based on included path information |
554 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen ); |
|
554 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen); |
|
555 | 555 | // $this->_caf_autoloader[] = array( |
556 | 556 | // 'dir' => 'new', |
557 | 557 | // 'folder' => basename( $admin_screen ) |
@@ -561,18 +561,18 @@ discard block |
||
561 | 561 | } |
562 | 562 | |
563 | 563 | //let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page) |
564 | - $extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR ); |
|
565 | - if ( $extends ) { |
|
566 | - foreach( $extends as $extend ) { |
|
567 | - if ( is_dir( $extend ) ) { |
|
568 | - $extend_ref = basename( $extend ); |
|
564 | + $extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR); |
|
565 | + if ($extends) { |
|
566 | + foreach ($extends as $extend) { |
|
567 | + if (is_dir($extend)) { |
|
568 | + $extend_ref = basename($extend); |
|
569 | 569 | //now let's make sure there is a file that matches the expected format |
570 | - $filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) ); |
|
571 | - $filename = 'Extend_' . $filename . '_Admin_Page'; |
|
572 | - $this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' ); |
|
570 | + $filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref))); |
|
571 | + $filename = 'Extend_'.$filename.'_Admin_Page'; |
|
572 | + $this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php'); |
|
573 | 573 | $this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename; |
574 | 574 | // set autoloaders for our admin page classes based on included path information |
575 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend ); |
|
575 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend); |
|
576 | 576 | // $this->_caf_autoloader[] = array( |
577 | 577 | // 'dir' => 'extend', |
578 | 578 | // 'folder' => $extend_ref |
@@ -583,22 +583,22 @@ discard block |
||
583 | 583 | |
584 | 584 | //let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!). |
585 | 585 | $ee_admin_hooks = array(); |
586 | - $hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' ); |
|
587 | - if ( $hooks ) { |
|
588 | - foreach ( $hooks as $hook ) { |
|
589 | - if ( is_readable( $hook ) ) { |
|
586 | + $hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php'); |
|
587 | + if ($hooks) { |
|
588 | + foreach ($hooks as $hook) { |
|
589 | + if (is_readable($hook)) { |
|
590 | 590 | require_once $hook; |
591 | - $classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook ); |
|
591 | + $classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook); |
|
592 | 592 | $classname = str_replace('.class.php', '', $classname); |
593 | - if ( class_exists( $classname ) ) { |
|
594 | - $a = new ReflectionClass( $classname ); |
|
593 | + if (class_exists($classname)) { |
|
594 | + $a = new ReflectionClass($classname); |
|
595 | 595 | $ee_admin_hooks[] = $a->newInstance(); |
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |
599 | 599 | }/**/ |
600 | 600 | |
601 | - $ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks ); |
|
601 | + $ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks); |
|
602 | 602 | |
603 | 603 | return $installed_refs; |
604 | 604 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | * @param EE_Admin_Page_Menu_Map $b being compared to |
656 | 656 | * @return int sort order |
657 | 657 | */ |
658 | - private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) { |
|
659 | - if ( $a->menu_order == $b->menu_order ) |
|
658 | + private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) { |
|
659 | + if ($a->menu_order == $b->menu_order) |
|
660 | 660 | return 0; |
661 | 661 | return ($a->menu_order < $b->menu_order) ? -1 : 1; |
662 | 662 | } |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -237,8 +238,9 @@ discard block |
||
237 | 238 | //first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects ) |
238 | 239 | usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) ); |
239 | 240 | foreach ( $this->_admin_menu_groups as $group ) { |
240 | - if ( ! $group instanceof EE_Admin_Page_Menu_Group ) |
|
241 | - throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
241 | + if ( ! $group instanceof EE_Admin_Page_Menu_Group ) { |
|
242 | + throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
243 | + } |
|
242 | 244 | $groups[$group->menu_slug] = $group; |
243 | 245 | } |
244 | 246 | return $groups; |
@@ -494,8 +496,9 @@ discard block |
||
494 | 496 | //let's sort the groups, make sure it's a valid group, add header (if to show). |
495 | 497 | foreach ( $pages_array as $group => $menu_maps ) { |
496 | 498 | //valid_group? |
497 | - if ( ! array_key_exists( $group, $menu_groups ) ) |
|
498 | - continue; |
|
499 | + if ( ! array_key_exists( $group, $menu_groups ) ) { |
|
500 | + continue; |
|
501 | + } |
|
499 | 502 | |
500 | 503 | //sort pages. |
501 | 504 | usort( $menu_maps, array( $this, '_sort_menu_maps' ) ); |
@@ -510,8 +513,9 @@ discard block |
||
510 | 513 | |
511 | 514 | //now let's setup the _prepped_menu_maps property |
512 | 515 | foreach ( $menu_groups as $group => $group_objs ) { |
513 | - if ( isset( $pages_array[$group] ) ) |
|
514 | - $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
516 | + if ( isset( $pages_array[$group] ) ) { |
|
517 | + $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
518 | + } |
|
515 | 519 | }/**/ |
516 | 520 | |
517 | 521 | } |
@@ -656,8 +660,9 @@ discard block |
||
656 | 660 | * @return int sort order |
657 | 661 | */ |
658 | 662 | private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) { |
659 | - if ( $a->menu_order == $b->menu_order ) |
|
660 | - return 0; |
|
663 | + if ( $a->menu_order == $b->menu_order ) { |
|
664 | + return 0; |
|
665 | + } |
|
661 | 666 | return ($a->menu_order < $b->menu_order) ? -1 : 1; |
662 | 667 | } |
663 | 668 |
@@ -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 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'action' => 'admin_option_settings', |
61 | 61 | 'page' => 'espresso_general_settings' |
62 | 62 | ); |
63 | - return '<p>' . sprintf( __('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="' . EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php') ) . '">', '</a>' ) . '</p>'; |
|
63 | + return '<p>'.sprintf(__('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="'.EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')).'">', '</a>').'</p>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <div class="wrap espresso-admin about-wrap"> |
2 | 2 | |
3 | 3 | <h1><?php echo $admin_page_title; ?></h1> |
4 | - <div class="about-text"><?php echo !empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
|
5 | - <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf( esc_attr__( '%s Logo', 'event_espresso' ), 'Event Espresso' ); ?>"/><br /><?php printf( __('Version %s', 'event_espresso' ), EVENT_ESPRESSO_VERSION ); ?></div> |
|
4 | + <div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
|
5 | + <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf(esc_attr__('%s Logo', 'event_espresso'), 'Event Espresso'); ?>"/><br /><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div> |
|
6 | 6 | |
7 | 7 | <?php echo $nav_tabs; ?> |
8 | 8 | |
9 | 9 | |
10 | 10 | <?php |
11 | - do_action( 'AHEE__admin_wrapper__template__before_about_admin_page_content' ); |
|
11 | + do_action('AHEE__admin_wrapper__template__before_about_admin_page_content'); |
|
12 | 12 | echo $about_admin_page_content; |
13 | - do_action( 'AHEE__admin_wrapper__template__after_about_admin_page_content' ); |
|
13 | + do_action('AHEE__admin_wrapper__template__after_about_admin_page_content'); |
|
14 | 14 | ?> |
15 | 15 | |
16 | 16 | </div> |
@@ -10,13 +10,13 @@ |
||
10 | 10 | |
11 | 11 | <?php |
12 | 12 | //let's loop through the columns |
13 | - for ( $i = 1; $i <= $num_columns; $i++ ) { |
|
14 | - $metaref = ( $i === 1 ) ? 'normal' : 'side'; |
|
15 | - $metaref = ( $i > 2 ) ? 'column'.$i : $metaref; |
|
13 | + for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | + $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | + $metaref = ($i > 2) ? 'column'.$i : $metaref; |
|
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
19 | - <?php do_meta_boxes( $current_page, $metaref, NULL ); ?> |
|
19 | + <?php do_meta_boxes($current_page, $metaref, NULL); ?> |
|
20 | 20 | </div> |
21 | 21 | <?php }// end column loop ?> |
22 | 22 | </div> <!-- post-body --> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( $publish_box_extra_content ) : ?> |
|
1 | +<?php if ($publish_box_extra_content) : ?> |
|
2 | 2 | <div id="minor-publishing"> |
3 | 3 | <?php echo $publish_box_extra_content; ?> |
4 | 4 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | <div id="espresso_major_buttons_wrapper"> |
15 | 15 | |
16 | - <?php if ( $publish_delete_link ) : ?> |
|
16 | + <?php if ($publish_delete_link) : ?> |
|
17 | 17 | <div id="delete-action"> |
18 | 18 | <?php echo $publish_delete_link; ?> |
19 | 19 | </div> |