@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | 2 | /** |
| 3 | - * Event Espresso |
|
| 4 | - * |
|
| 5 | - * Event Registration and Management Plugin for WordPress |
|
| 6 | - * |
|
| 7 | - * @ package Event Espresso |
|
| 8 | - * @ author Event Espresso |
|
| 9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 11 | - * @ link http://www.eventespresso.com |
|
| 12 | - * @ version 4.0 |
|
| 13 | - * |
|
| 14 | - * ------------------------------------------------------------------------ |
|
| 15 | - * |
|
| 16 | - * EE_System |
|
| 17 | - * |
|
| 18 | - * @package Event Espresso |
|
| 19 | - * @subpackage core/ |
|
| 20 | - * @author Brent Christensen, Michael Nelson |
|
| 21 | - * |
|
| 22 | - * ------------------------------------------------------------------------ |
|
| 23 | - */ |
|
| 3 | + * Event Espresso |
|
| 4 | + * |
|
| 5 | + * Event Registration and Management Plugin for WordPress |
|
| 6 | + * |
|
| 7 | + * @ package Event Espresso |
|
| 8 | + * @ author Event Espresso |
|
| 9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 11 | + * @ link http://www.eventespresso.com |
|
| 12 | + * @ version 4.0 |
|
| 13 | + * |
|
| 14 | + * ------------------------------------------------------------------------ |
|
| 15 | + * |
|
| 16 | + * EE_System |
|
| 17 | + * |
|
| 18 | + * @package Event Espresso |
|
| 19 | + * @subpackage core/ |
|
| 20 | + * @author Brent Christensen, Michael Nelson |
|
| 21 | + * |
|
| 22 | + * ------------------------------------------------------------------------ |
|
| 23 | + */ |
|
| 24 | 24 | final class EE_System { |
| 25 | 25 | |
| 26 | 26 | |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * detect_if_activation_or_upgrade |
|
| 210 | - * |
|
| 211 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
| 212 | - * and either setting up the DB or setting up maintenance mode etc. |
|
| 213 | - * |
|
| 214 | - * @access public |
|
| 215 | - * @return void |
|
| 216 | - */ |
|
| 209 | + * detect_if_activation_or_upgrade |
|
| 210 | + * |
|
| 211 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
| 212 | + * and either setting up the DB or setting up maintenance mode etc. |
|
| 213 | + * |
|
| 214 | + * @access public |
|
| 215 | + * @return void |
|
| 216 | + */ |
|
| 217 | 217 | public function detect_if_activation_or_upgrade() { |
| 218 | 218 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
| 219 | 219 | |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | $query_params = array( 'page' => 'espresso_about' ); |
| 518 | 518 | |
| 519 | 519 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
| 520 | - $query_params['new_activation'] = TRUE; |
|
| 520 | + $query_params['new_activation'] = TRUE; |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
| 524 | - $query_params['reactivation'] = TRUE; |
|
| 524 | + $query_params['reactivation'] = TRUE; |
|
| 525 | 525 | } |
| 526 | 526 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
| 527 | 527 | wp_safe_redirect( $url ); |
@@ -624,11 +624,11 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | |
| 626 | 626 | /** |
| 627 | - * _incompatible_addon_error |
|
| 628 | - * |
|
| 629 | - * @access public |
|
| 630 | - * @return void |
|
| 631 | - */ |
|
| 627 | + * _incompatible_addon_error |
|
| 628 | + * |
|
| 629 | + * @access public |
|
| 630 | + * @return void |
|
| 631 | + */ |
|
| 632 | 632 | private function _incompatible_addon_error() { |
| 633 | 633 | // get array of classes hooking into here |
| 634 | 634 | $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
@@ -750,14 +750,14 @@ discard block |
||
| 750 | 750 | |
| 751 | 751 | |
| 752 | 752 | /** |
| 753 | - * load_controllers |
|
| 754 | - * |
|
| 755 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
| 756 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
| 757 | - * |
|
| 758 | - * @access public |
|
| 759 | - * @return void |
|
| 760 | - */ |
|
| 753 | + * load_controllers |
|
| 754 | + * |
|
| 755 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
| 756 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
| 757 | + * |
|
| 758 | + * @access public |
|
| 759 | + * @return void |
|
| 760 | + */ |
|
| 761 | 761 | public function load_controllers() { |
| 762 | 762 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
| 763 | 763 | // let's get it started |
@@ -774,13 +774,13 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | |
| 776 | 776 | /** |
| 777 | - * core_loaded_and_ready |
|
| 778 | - * |
|
| 779 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
| 780 | - * |
|
| 781 | - * @access public |
|
| 782 | - * @return void |
|
| 783 | - */ |
|
| 777 | + * core_loaded_and_ready |
|
| 778 | + * |
|
| 779 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
| 780 | + * |
|
| 781 | + * @access public |
|
| 782 | + * @return void |
|
| 783 | + */ |
|
| 784 | 784 | public function core_loaded_and_ready() { |
| 785 | 785 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
| 786 | 786 | do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
@@ -791,13 +791,13 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | |
| 793 | 793 | /** |
| 794 | - * initialize |
|
| 795 | - * |
|
| 796 | - * this is the best place to begin initializing client code |
|
| 797 | - * |
|
| 798 | - * @access public |
|
| 799 | - * @return void |
|
| 800 | - */ |
|
| 794 | + * initialize |
|
| 795 | + * |
|
| 796 | + * this is the best place to begin initializing client code |
|
| 797 | + * |
|
| 798 | + * @access public |
|
| 799 | + * @return void |
|
| 800 | + */ |
|
| 801 | 801 | public function initialize() { |
| 802 | 802 | do_action( 'AHEE__EE_System__initialize' ); |
| 803 | 803 | } |
@@ -805,13 +805,13 @@ discard block |
||
| 805 | 805 | |
| 806 | 806 | |
| 807 | 807 | /** |
| 808 | - * initialize_last |
|
| 809 | - * |
|
| 810 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
| 811 | - * |
|
| 812 | - * @access public |
|
| 813 | - * @return void |
|
| 814 | - */ |
|
| 808 | + * initialize_last |
|
| 809 | + * |
|
| 810 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
| 811 | + * |
|
| 812 | + * @access public |
|
| 813 | + * @return void |
|
| 814 | + */ |
|
| 815 | 815 | public function initialize_last() { |
| 816 | 816 | do_action( 'AHEE__EE_System__initialize_last' ); |
| 817 | 817 | } |
@@ -820,14 +820,14 @@ discard block |
||
| 820 | 820 | |
| 821 | 821 | |
| 822 | 822 | /** |
| 823 | - * set_hooks_for_shortcodes_modules_and_addons |
|
| 824 | - * |
|
| 825 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
| 826 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
| 827 | - * |
|
| 828 | - * @access public |
|
| 829 | - * @return void |
|
| 830 | - */ |
|
| 823 | + * set_hooks_for_shortcodes_modules_and_addons |
|
| 824 | + * |
|
| 825 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
| 826 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
| 827 | + * |
|
| 828 | + * @access public |
|
| 829 | + * @return void |
|
| 830 | + */ |
|
| 831 | 831 | public function set_hooks_for_shortcodes_modules_and_addons() { |
| 832 | 832 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
| 833 | 833 | } |
@@ -836,13 +836,13 @@ discard block |
||
| 836 | 836 | |
| 837 | 837 | |
| 838 | 838 | /** |
| 839 | - * do_not_cache |
|
| 840 | - * |
|
| 841 | - * sets no cache headers and defines no cache constants for WP plugins |
|
| 842 | - * |
|
| 843 | - * @access public |
|
| 844 | - * @return void |
|
| 845 | - */ |
|
| 839 | + * do_not_cache |
|
| 840 | + * |
|
| 841 | + * sets no cache headers and defines no cache constants for WP plugins |
|
| 842 | + * |
|
| 843 | + * @access public |
|
| 844 | + * @return void |
|
| 845 | + */ |
|
| 846 | 846 | public static function do_not_cache() { |
| 847 | 847 | // set no cache constants |
| 848 | 848 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | //Current post |
| 962 | 962 | global $post; |
| 963 | 963 | |
| 964 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
| 964 | + if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
| 965 | 965 | //Events Edit Current Event |
| 966 | 966 | $admin_bar->add_menu(array( |
| 967 | 967 | 'id' => 'espresso-toolbar-events-edit', |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public static function instance() { |
| 104 | 104 | // check if class object is instantiated |
| 105 | - if ( ! self::$_instance instanceof EE_System ) { |
|
| 105 | + if ( ! self::$_instance instanceof EE_System) { |
|
| 106 | 106 | self::$_instance = new self(); |
| 107 | 107 | } |
| 108 | 108 | return self::$_instance; |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | * resets the instance and returns it |
| 114 | 114 | * @return EE_System |
| 115 | 115 | */ |
| 116 | - public static function reset(){ |
|
| 116 | + public static function reset() { |
|
| 117 | 117 | self::$_instance->_req_type = NULL; |
| 118 | 118 | //we need to reset the migration manager in order for it to detect DMSs properly |
| 119 | 119 | EE_Data_Migration_Manager::reset(); |
| 120 | 120 | //make sure none of the old hooks are left hanging around |
| 121 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 121 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 122 | 122 | self::instance()->detect_activations_or_upgrades(); |
| 123 | 123 | self::instance()->perform_activations_upgrades_and_migrations(); |
| 124 | 124 | return self::instance(); |
@@ -134,26 +134,26 @@ discard block |
||
| 134 | 134 | * @access private |
| 135 | 135 | */ |
| 136 | 136 | private function __construct() { |
| 137 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
| 137 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
| 138 | 138 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
| 139 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
| 139 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
| 140 | 140 | // when an ee addon is activated, we want to call the core hook(s) again |
| 141 | 141 | // because the newly-activated addon didn't get a chance to run at all |
| 142 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
| 142 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
| 143 | 143 | // detect whether install or upgrade |
| 144 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
| 144 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
| 145 | 145 | // load EE_Config, EE_Textdomain, etc |
| 146 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
| 146 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
| 147 | 147 | // load EE_Config, EE_Textdomain, etc |
| 148 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
| 148 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
| 149 | 149 | // you wanna get going? I wanna get going... let's get going! |
| 150 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
| 150 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
| 151 | 151 | //other housekeeping |
| 152 | 152 | //exclude EE critical pages from wp_list_pages |
| 153 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
| 153 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
| 154 | 154 | // ALL EE Addons should use the following hook point to attach their initial setup too |
| 155 | 155 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
| 156 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
| 156 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | |
@@ -173,30 +173,30 @@ discard block |
||
| 173 | 173 | public function load_espresso_addons() { |
| 174 | 174 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
| 175 | 175 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
| 176 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
| 176 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
| 177 | 177 | //load and setup EE_Capabilities |
| 178 | - EE_Registry::instance()->load_core( 'Capabilities' ); |
|
| 178 | + EE_Registry::instance()->load_core('Capabilities'); |
|
| 179 | 179 | //caps need to be initialized on every request so that capability maps are set. |
| 180 | 180 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
| 181 | 181 | EE_Registry::instance()->CAP->init_caps(); |
| 182 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
| 182 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
| 183 | 183 | //if the WP API basic auth plugin isn't already loaded, load it now. |
| 184 | 184 | //We want it for mobile apps. Just include the entire plugin |
| 185 | 185 | //also, don't load the basic auth when a plugin is getting activated, because |
| 186 | 186 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
| 187 | 187 | //and causes a fatal error |
| 188 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
| 189 | - && ! function_exists( 'json_basic_auth_error' ) |
|
| 188 | + if ( ! function_exists('json_basic_auth_handler') |
|
| 189 | + && ! function_exists('json_basic_auth_error') |
|
| 190 | 190 | && ! ( |
| 191 | - isset( $_GET[ 'action'] ) |
|
| 192 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
| 191 | + isset($_GET['action']) |
|
| 192 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
| 193 | 193 | ) |
| 194 | 194 | && ! ( |
| 195 | - isset( $_GET['activate' ] ) |
|
| 196 | - && $_GET['activate' ] === 'true' |
|
| 195 | + isset($_GET['activate']) |
|
| 196 | + && $_GET['activate'] === 'true' |
|
| 197 | 197 | ) |
| 198 | 198 | ) { |
| 199 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
| 199 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | * @access public |
| 213 | 213 | * @return void |
| 214 | 214 | */ |
| 215 | - public function detect_activations_or_upgrades(){ |
|
| 215 | + public function detect_activations_or_upgrades() { |
|
| 216 | 216 | //first off: let's make sure to handle core |
| 217 | 217 | $this->detect_if_activation_or_upgrade(); |
| 218 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
| 218 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
| 219 | 219 | //detect teh request type for that addon |
| 220 | 220 | $addon->detect_activation_or_upgrade(); |
| 221 | 221 | } |
@@ -236,44 +236,44 @@ discard block |
||
| 236 | 236 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
| 237 | 237 | |
| 238 | 238 | // load M-Mode class |
| 239 | - EE_Registry::instance()->load_core( 'Maintenance_Mode' ); |
|
| 239 | + EE_Registry::instance()->load_core('Maintenance_Mode'); |
|
| 240 | 240 | // check if db has been updated, or if its a brand-new installation |
| 241 | 241 | |
| 242 | 242 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
| 243 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
| 243 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
| 244 | 244 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
| 245 | - if( $request_type != EE_System::req_type_normal){ |
|
| 245 | + if ($request_type != EE_System::req_type_normal) { |
|
| 246 | 246 | EE_Registry::instance()->load_helper('Activation'); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - switch($request_type){ |
|
| 249 | + switch ($request_type) { |
|
| 250 | 250 | case EE_System::req_type_new_activation: |
| 251 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
| 252 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 251 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
| 252 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 253 | 253 | break; |
| 254 | 254 | case EE_System::req_type_reactivation: |
| 255 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
| 256 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 255 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
| 256 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 257 | 257 | break; |
| 258 | 258 | case EE_System::req_type_upgrade: |
| 259 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
| 259 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
| 260 | 260 | //migrations may be required now that we've upgraded |
| 261 | 261 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
| 262 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 262 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 263 | 263 | // echo "done upgrade";die; |
| 264 | 264 | break; |
| 265 | 265 | case EE_System::req_type_downgrade: |
| 266 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
| 266 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
| 267 | 267 | //its possible migrations are no longer required |
| 268 | 268 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
| 269 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
| 269 | + $this->_handle_core_version_change($espresso_db_update); |
|
| 270 | 270 | break; |
| 271 | 271 | case EE_System::req_type_normal: |
| 272 | 272 | default: |
| 273 | 273 | // $this->_maybe_redirect_to_ee_about(); |
| 274 | 274 | break; |
| 275 | 275 | } |
| 276 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
| 276 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -281,10 +281,10 @@ discard block |
||
| 281 | 281 | * initializing the database later during the request |
| 282 | 282 | * @param array $espresso_db_update |
| 283 | 283 | */ |
| 284 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
| 285 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
| 284 | + protected function _handle_core_version_change($espresso_db_update) { |
|
| 285 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
| 286 | 286 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
| 287 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
| 287 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | |
@@ -299,44 +299,44 @@ discard block |
||
| 299 | 299 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
| 300 | 300 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
| 301 | 301 | */ |
| 302 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
| 303 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
| 304 | - if( ! $espresso_db_update){ |
|
| 305 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
| 302 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
| 303 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
| 304 | + if ( ! $espresso_db_update) { |
|
| 305 | + $espresso_db_update = get_option('espresso_db_update'); |
|
| 306 | 306 | } |
| 307 | 307 | // check that option is an array |
| 308 | - if( ! is_array( $espresso_db_update )) { |
|
| 308 | + if ( ! is_array($espresso_db_update)) { |
|
| 309 | 309 | // if option is FALSE, then it never existed |
| 310 | - if ( $espresso_db_update === FALSE ) { |
|
| 310 | + if ($espresso_db_update === FALSE) { |
|
| 311 | 311 | // make $espresso_db_update an array and save option with autoload OFF |
| 312 | - $espresso_db_update = array(); |
|
| 313 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
| 312 | + $espresso_db_update = array(); |
|
| 313 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
| 314 | 314 | } else { |
| 315 | 315 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
| 316 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
| 317 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
| 316 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
| 317 | + update_option('espresso_db_update', $espresso_db_update); |
|
| 318 | 318 | } |
| 319 | - }else{ |
|
| 319 | + } else { |
|
| 320 | 320 | $corrected_db_update = array(); |
| 321 | 321 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
| 322 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
| 323 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
| 322 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
| 323 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
| 324 | 324 | //the key is an int, and the value IS NOT an array |
| 325 | 325 | //so it must be numerically-indexed, where values are versions installed... |
| 326 | 326 | //fix it! |
| 327 | 327 | $version_string = $should_be_array; |
| 328 | 328 | $corrected_db_update[$version_string] = array('unknown-date'); |
| 329 | - }else{ |
|
| 329 | + } else { |
|
| 330 | 330 | //ok it checks out |
| 331 | 331 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | $espresso_db_update = $corrected_db_update; |
| 335 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
| 335 | + update_option('espresso_db_update', $espresso_db_update); |
|
| 336 | 336 | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
| 339 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
| 340 | 340 | return $espresso_db_update; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -355,34 +355,34 @@ discard block |
||
| 355 | 355 | * so we prefer to only do it when necessary |
| 356 | 356 | * @return void |
| 357 | 357 | */ |
| 358 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
| 358 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
| 359 | 359 | $request_type = $this->detect_req_type(); |
| 360 | 360 | //only initialize system if we're not in maintenance mode. |
| 361 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
| 362 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
| 361 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
| 362 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
| 363 | 363 | |
| 364 | - if( $verify_schema ) { |
|
| 364 | + if ($verify_schema) { |
|
| 365 | 365 | EEH_Activation::initialize_db_and_folders(); |
| 366 | 366 | } |
| 367 | 367 | EEH_Activation::initialize_db_content(); |
| 368 | 368 | EEH_Activation::system_initialization(); |
| 369 | - if( $initialize_addons_too ) { |
|
| 369 | + if ($initialize_addons_too) { |
|
| 370 | 370 | $this->initialize_addons(); |
| 371 | 371 | } |
| 372 | - }else{ |
|
| 373 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
| 372 | + } else { |
|
| 373 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
| 374 | 374 | } |
| 375 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
| 376 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
| 375 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
| 376 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
| 381 | 381 | * Initializes the db for all registered addons |
| 382 | 382 | */ |
| 383 | - public function initialize_addons(){ |
|
| 383 | + public function initialize_addons() { |
|
| 384 | 384 | //foreach registered addon, make sure its db is up-to-date too |
| 385 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
| 385 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
| 386 | 386 | $addon->initialize_db_if_no_migrations_required(); |
| 387 | 387 | } |
| 388 | 388 | } |
@@ -394,16 +394,16 @@ discard block |
||
| 394 | 394 | * @param string $current_version_to_add version to be added to the version history |
| 395 | 395 | * @return boolean success as to whether or not this option was changed |
| 396 | 396 | */ |
| 397 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
| 398 | - if( ! $version_history ) { |
|
| 397 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
| 398 | + if ( ! $version_history) { |
|
| 399 | 399 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
| 400 | 400 | } |
| 401 | - if( $current_version_to_add == NULL){ |
|
| 401 | + if ($current_version_to_add == NULL) { |
|
| 402 | 402 | $current_version_to_add = espresso_version(); |
| 403 | 403 | } |
| 404 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
| 404 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
| 405 | 405 | // re-save |
| 406 | - return update_option( 'espresso_db_update', $version_history ); |
|
| 406 | + return update_option('espresso_db_update', $version_history); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | |
@@ -420,10 +420,10 @@ discard block |
||
| 420 | 420 | * but still know if this is a new install or not |
| 421 | 421 | * @return int one of the constants on EE_System::req_type_ |
| 422 | 422 | */ |
| 423 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
| 424 | - if ( $this->_req_type === NULL ){ |
|
| 425 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
| 426 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
| 423 | + public function detect_req_type($espresso_db_update = NULL) { |
|
| 424 | + if ($this->_req_type === NULL) { |
|
| 425 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
| 426 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
| 427 | 427 | } |
| 428 | 428 | return $this->_req_type; |
| 429 | 429 | } |
@@ -439,39 +439,39 @@ discard block |
||
| 439 | 439 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
| 440 | 440 | * @return int one of the constants on EE_System::req_type_* |
| 441 | 441 | */ |
| 442 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
| 443 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
| 444 | - if( $activation_history_for_addon ){ |
|
| 442 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
| 443 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
| 444 | + if ($activation_history_for_addon) { |
|
| 445 | 445 | //it exists, so this isn't a completely new install |
| 446 | 446 | //check if this version already in that list of previously installed versions |
| 447 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
| 447 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
| 448 | 448 | //it a version we haven't seen before |
| 449 | - if( $version_is_higher === 1 ){ |
|
| 449 | + if ($version_is_higher === 1) { |
|
| 450 | 450 | $req_type = EE_System::req_type_upgrade; |
| 451 | - }else{ |
|
| 451 | + } else { |
|
| 452 | 452 | $req_type = EE_System::req_type_downgrade; |
| 453 | 453 | } |
| 454 | - delete_option( $activation_indicator_option_name ); |
|
| 454 | + delete_option($activation_indicator_option_name); |
|
| 455 | 455 | } else { |
| 456 | 456 | // its not an update. maybe a reactivation? |
| 457 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
| 458 | - if ( $version_is_higher === -1 ){ |
|
| 457 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
| 458 | + if ($version_is_higher === -1) { |
|
| 459 | 459 | $req_type = EE_System::req_type_downgrade; |
| 460 | - }elseif( $version_is_higher === 0 ){ |
|
| 460 | + }elseif ($version_is_higher === 0) { |
|
| 461 | 461 | //we've seen this version before, but it's an activation. must be a reactivation |
| 462 | 462 | $req_type = EE_System::req_type_reactivation; |
| 463 | - }else{//$version_is_higher === 1 |
|
| 463 | + } else {//$version_is_higher === 1 |
|
| 464 | 464 | $req_type = EE_System::req_type_upgrade; |
| 465 | 465 | } |
| 466 | - delete_option( $activation_indicator_option_name ); |
|
| 466 | + delete_option($activation_indicator_option_name); |
|
| 467 | 467 | } else { |
| 468 | 468 | //we've seen this version before and the activation indicate doesn't show it was just activated |
| 469 | - if ( $version_is_higher === -1 ){ |
|
| 469 | + if ($version_is_higher === -1) { |
|
| 470 | 470 | $req_type = EE_System::req_type_downgrade; |
| 471 | - }elseif( $version_is_higher === 0 ){ |
|
| 471 | + }elseif ($version_is_higher === 0) { |
|
| 472 | 472 | //we've seen this version before and it's not an activation. its normal request |
| 473 | 473 | $req_type = EE_System::req_type_normal; |
| 474 | - }else{//$version_is_higher === 1 |
|
| 474 | + } else {//$version_is_higher === 1 |
|
| 475 | 475 | $req_type = EE_System::req_type_upgrade; |
| 476 | 476 | } |
| 477 | 477 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | } else { |
| 480 | 480 | //brand new install |
| 481 | 481 | $req_type = EE_System::req_type_new_activation; |
| 482 | - delete_option( $activation_indicator_option_name ); |
|
| 482 | + delete_option($activation_indicator_option_name); |
|
| 483 | 483 | } |
| 484 | 484 | return $req_type; |
| 485 | 485 | } |
@@ -497,30 +497,30 @@ discard block |
||
| 497 | 497 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
| 498 | 498 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
| 499 | 499 | */ |
| 500 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
| 500 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
| 501 | 501 | //find the most recently-activated version |
| 502 | 502 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
| 503 | 503 | $most_recently_active_version = '0.0.0.dev.000'; |
| 504 | - if( is_array( $activation_history_for_addon ) ){ |
|
| 505 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
| 504 | + if (is_array($activation_history_for_addon)) { |
|
| 505 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
| 506 | 506 | //check there is a record of when this version was activated. Otherwise, |
| 507 | 507 | //mark it as unknown |
| 508 | - if( ! $times_activated ){ |
|
| 509 | - $times_activated = array( 'unknown-date'); |
|
| 508 | + if ( ! $times_activated) { |
|
| 509 | + $times_activated = array('unknown-date'); |
|
| 510 | 510 | } |
| 511 | - if( is_string( $times_activated ) ){ |
|
| 512 | - $times_activated = array( $times_activated ); |
|
| 511 | + if (is_string($times_activated)) { |
|
| 512 | + $times_activated = array($times_activated); |
|
| 513 | 513 | } |
| 514 | - foreach( $times_activated as $an_activation ){ |
|
| 515 | - if( $an_activation != 'unknown-date' && |
|
| 516 | - $an_activation > $most_recently_active_version_activation ){ |
|
| 514 | + foreach ($times_activated as $an_activation) { |
|
| 515 | + if ($an_activation != 'unknown-date' && |
|
| 516 | + $an_activation > $most_recently_active_version_activation) { |
|
| 517 | 517 | $most_recently_active_version = $version; |
| 518 | 518 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
| 523 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | |
@@ -530,20 +530,20 @@ discard block |
||
| 530 | 530 | * @return void |
| 531 | 531 | */ |
| 532 | 532 | public function redirect_to_about_ee() { |
| 533 | - $notices = EE_Error::get_notices( FALSE ); |
|
| 533 | + $notices = EE_Error::get_notices(FALSE); |
|
| 534 | 534 | //if current user is an admin and it's not an ajax request |
| 535 | - if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) && ! isset( $notices[ 'errors' ] ) ){ |
|
| 536 | - $query_params = array( 'page' => 'espresso_about' ); |
|
| 535 | + if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) { |
|
| 536 | + $query_params = array('page' => 'espresso_about'); |
|
| 537 | 537 | |
| 538 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
| 538 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
| 539 | 539 | $query_params['new_activation'] = TRUE; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
| 542 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
| 543 | 543 | $query_params['reactivation'] = TRUE; |
| 544 | 544 | } |
| 545 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
| 546 | - wp_safe_redirect( $url ); |
|
| 545 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
| 546 | + wp_safe_redirect($url); |
|
| 547 | 547 | exit(); |
| 548 | 548 | } |
| 549 | 549 | } |
@@ -557,31 +557,31 @@ discard block |
||
| 557 | 557 | * |
| 558 | 558 | * @return void |
| 559 | 559 | */ |
| 560 | - public function load_core_configuration(){ |
|
| 561 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
| 562 | - EE_Registry::instance()->load_core( 'EE_Load_Textdomain' ); |
|
| 560 | + public function load_core_configuration() { |
|
| 561 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
| 562 | + EE_Registry::instance()->load_core('EE_Load_Textdomain'); |
|
| 563 | 563 | //load textdomain |
| 564 | 564 | EE_Load_Textdomain::load_textdomain(); |
| 565 | 565 | // load and setup EE_Config and EE_Network_Config |
| 566 | - EE_Registry::instance()->load_core( 'Config' ); |
|
| 567 | - EE_Registry::instance()->load_core( 'Network_Config' ); |
|
| 566 | + EE_Registry::instance()->load_core('Config'); |
|
| 567 | + EE_Registry::instance()->load_core('Network_Config'); |
|
| 568 | 568 | // setup autoloaders |
| 569 | 569 | // enable logging? |
| 570 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
| 571 | - EE_Registry::instance()->load_core( 'Log' ); |
|
| 570 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
| 571 | + EE_Registry::instance()->load_core('Log'); |
|
| 572 | 572 | } |
| 573 | 573 | // check for activation errors |
| 574 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
| 575 | - if ( $activation_errors ) { |
|
| 576 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 577 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
| 574 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
| 575 | + if ($activation_errors) { |
|
| 576 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
| 577 | + update_option('ee_plugin_activation_errors', FALSE); |
|
| 578 | 578 | } |
| 579 | 579 | // get model names |
| 580 | 580 | $this->_parse_model_names(); |
| 581 | 581 | |
| 582 | 582 | //load caf stuff a chance to play during the activation process too. |
| 583 | 583 | $this->_maybe_brew_regular(); |
| 584 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
| 584 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | |
@@ -590,23 +590,23 @@ discard block |
||
| 590 | 590 | * |
| 591 | 591 | * @return void |
| 592 | 592 | */ |
| 593 | - private function _parse_model_names(){ |
|
| 593 | + private function _parse_model_names() { |
|
| 594 | 594 | //get all the files in the EE_MODELS folder that end in .model.php |
| 595 | - $models = glob( EE_MODELS.'*.model.php'); |
|
| 595 | + $models = glob(EE_MODELS.'*.model.php'); |
|
| 596 | 596 | $model_names = array(); |
| 597 | 597 | $non_abstract_db_models = array(); |
| 598 | - foreach( $models as $model ){ |
|
| 598 | + foreach ($models as $model) { |
|
| 599 | 599 | // get model classname |
| 600 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
| 601 | - $shortname = str_replace( 'EEM_', '', $classname ); |
|
| 600 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
| 601 | + $shortname = str_replace('EEM_', '', $classname); |
|
| 602 | 602 | $reflectionClass = new ReflectionClass($classname); |
| 603 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
| 603 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
| 604 | 604 | $non_abstract_db_models[$shortname] = $classname; |
| 605 | 605 | } |
| 606 | - $model_names[ $shortname ] = $classname; |
|
| 606 | + $model_names[$shortname] = $classname; |
|
| 607 | 607 | } |
| 608 | - EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
| 609 | - EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
| 608 | + EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
| 609 | + EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | |
@@ -616,8 +616,8 @@ discard block |
||
| 616 | 616 | * @return void |
| 617 | 617 | */ |
| 618 | 618 | private function _maybe_brew_regular() { |
| 619 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
| 620 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
| 619 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
| 620 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | |
@@ -634,9 +634,9 @@ discard block |
||
| 634 | 634 | * @return void |
| 635 | 635 | */ |
| 636 | 636 | public function register_shortcodes_modules_and_widgets() { |
| 637 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
| 637 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
| 638 | 638 | // check for addons using old hookpoint |
| 639 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
| 639 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
| 640 | 640 | $this->_incompatible_addon_error(); |
| 641 | 641 | } |
| 642 | 642 | } |
@@ -650,19 +650,19 @@ discard block |
||
| 650 | 650 | */ |
| 651 | 651 | private function _incompatible_addon_error() { |
| 652 | 652 | // get array of classes hooking into here |
| 653 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
| 654 | - if ( ! empty( $class_names )) { |
|
| 655 | - $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' ); |
|
| 653 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
| 654 | + if ( ! empty($class_names)) { |
|
| 655 | + $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'); |
|
| 656 | 656 | $msg .= '<ul>'; |
| 657 | - foreach ( $class_names as $class_name ) { |
|
| 658 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
| 657 | + foreach ($class_names as $class_name) { |
|
| 658 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
| 659 | 659 | } |
| 660 | 660 | $msg .= '</ul>'; |
| 661 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
| 661 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
| 662 | 662 | // save list of incompatible addons to wp-options for later use |
| 663 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
| 664 | - if ( is_admin() ) { |
|
| 665 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 663 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
| 664 | + if (is_admin()) { |
|
| 665 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | } |
@@ -679,25 +679,25 @@ discard block |
||
| 679 | 679 | * |
| 680 | 680 | * @return void |
| 681 | 681 | */ |
| 682 | - public function brew_espresso(){ |
|
| 683 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
| 682 | + public function brew_espresso() { |
|
| 683 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
| 684 | 684 | // load some final core systems |
| 685 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
| 686 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
| 687 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
| 688 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
| 689 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
| 690 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
| 691 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
| 692 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
| 693 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
| 694 | - |
|
| 695 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
| 685 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
| 686 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
| 687 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
| 688 | + add_action('init', array($this, 'load_controllers'), 7); |
|
| 689 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
| 690 | + add_action('init', array($this, 'initialize'), 10); |
|
| 691 | + add_action('init', array($this, 'initialize_last'), 100); |
|
| 692 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
| 693 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
| 694 | + |
|
| 695 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
| 696 | 696 | // pew pew pew |
| 697 | - EE_Registry::instance()->load_core( 'PUE' ); |
|
| 698 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
| 697 | + EE_Registry::instance()->load_core('PUE'); |
|
| 698 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
| 699 | 699 | } |
| 700 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
| 700 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | */ |
| 712 | 712 | public function set_hooks_for_core() { |
| 713 | 713 | $this->_deactivate_incompatible_addons(); |
| 714 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
| 714 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | |
@@ -720,15 +720,15 @@ discard block |
||
| 720 | 720 | * Using the information gathered in EE_System::_incompatible_addon_error, |
| 721 | 721 | * deactivates any addons considered incompatible with the current version of EE |
| 722 | 722 | */ |
| 723 | - private function _deactivate_incompatible_addons(){ |
|
| 724 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
| 725 | - if ( ! empty( $incompatible_addons )) { |
|
| 726 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
| 727 | - foreach ( $active_plugins as $active_plugin ) { |
|
| 728 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
| 729 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
| 730 | - unset( $_GET['activate'] ); |
|
| 731 | - espresso_deactivate_plugin( $active_plugin ); |
|
| 723 | + private function _deactivate_incompatible_addons() { |
|
| 724 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
| 725 | + if ( ! empty($incompatible_addons)) { |
|
| 726 | + $active_plugins = get_option('active_plugins', array()); |
|
| 727 | + foreach ($active_plugins as $active_plugin) { |
|
| 728 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
| 729 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
| 730 | + unset($_GET['activate']); |
|
| 731 | + espresso_deactivate_plugin($active_plugin); |
|
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | 734 | } |
@@ -745,10 +745,10 @@ discard block |
||
| 745 | 745 | */ |
| 746 | 746 | public function perform_activations_upgrades_and_migrations() { |
| 747 | 747 | //first check if we had previously attempted to setup EE's directories but failed |
| 748 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
| 748 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
| 749 | 749 | EEH_Activation::create_upload_directories(); |
| 750 | 750 | } |
| 751 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
| 751 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | |
@@ -760,10 +760,10 @@ discard block |
||
| 760 | 760 | * @return void |
| 761 | 761 | */ |
| 762 | 762 | public function load_CPTs_and_session() { |
| 763 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
| 763 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
| 764 | 764 | // register Custom Post Types |
| 765 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
| 766 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
| 765 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
| 766 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | |
@@ -778,19 +778,19 @@ discard block |
||
| 778 | 778 | * @return void |
| 779 | 779 | */ |
| 780 | 780 | public function load_controllers() { |
| 781 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
| 781 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
| 782 | 782 | // let's get it started |
| 783 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
| 784 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
| 785 | - EE_Registry::instance()->load_core( 'Front_Controller' ); |
|
| 786 | - } else if ( ! EE_FRONT_AJAX ) { |
|
| 787 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
| 788 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
| 789 | - } else if ( EE_Maintenance_Mode::instance()->level() ) { |
|
| 783 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
| 784 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
| 785 | + EE_Registry::instance()->load_core('Front_Controller'); |
|
| 786 | + } else if ( ! EE_FRONT_AJAX) { |
|
| 787 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
| 788 | + EE_Registry::instance()->load_core('Admin'); |
|
| 789 | + } else if (EE_Maintenance_Mode::instance()->level()) { |
|
| 790 | 790 | // still need to make sure template helper functions are loaded in M-Mode |
| 791 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 791 | + EE_Registry::instance()->load_helper('Template'); |
|
| 792 | 792 | } |
| 793 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
| 793 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | |
@@ -804,10 +804,10 @@ discard block |
||
| 804 | 804 | * @return void |
| 805 | 805 | */ |
| 806 | 806 | public function core_loaded_and_ready() { |
| 807 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
| 808 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
| 807 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
| 808 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
| 809 | 809 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
| 810 | - EE_Registry::instance()->load_core( 'Session' ); |
|
| 810 | + EE_Registry::instance()->load_core('Session'); |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | * @return void |
| 822 | 822 | */ |
| 823 | 823 | public function initialize() { |
| 824 | - do_action( 'AHEE__EE_System__initialize' ); |
|
| 824 | + do_action('AHEE__EE_System__initialize'); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | * @return void |
| 836 | 836 | */ |
| 837 | 837 | public function initialize_last() { |
| 838 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
| 838 | + do_action('AHEE__EE_System__initialize_last'); |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | |
@@ -867,21 +867,21 @@ discard block |
||
| 867 | 867 | */ |
| 868 | 868 | public static function do_not_cache() { |
| 869 | 869 | // set no cache constants |
| 870 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
| 871 | - define( 'DONOTCACHEPAGE', true ); |
|
| 870 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
| 871 | + define('DONOTCACHEPAGE', true); |
|
| 872 | 872 | } |
| 873 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
| 874 | - define( 'DONOTCACHCEOBJECT', true ); |
|
| 873 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
| 874 | + define('DONOTCACHCEOBJECT', true); |
|
| 875 | 875 | } |
| 876 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
| 877 | - define( 'DONOTCACHEDB', true ); |
|
| 876 | + if ( ! defined('DONOTCACHEDB')) { |
|
| 877 | + define('DONOTCACHEDB', true); |
|
| 878 | 878 | } |
| 879 | 879 | // add no cache headers |
| 880 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
| 880 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
| 881 | 881 | // plus a little extra for nginx and Google Chrome |
| 882 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
| 882 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
| 883 | 883 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
| 884 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
| 884 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | * @param $headers |
| 894 | 894 | * @return array |
| 895 | 895 | */ |
| 896 | - public static function extra_nocache_headers ( $headers ) { |
|
| 896 | + public static function extra_nocache_headers($headers) { |
|
| 897 | 897 | // for NGINX |
| 898 | 898 | $headers['X-Accel-Expires'] = 0; |
| 899 | 899 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -922,15 +922,15 @@ discard block |
||
| 922 | 922 | * @param $admin_bar |
| 923 | 923 | * @return void |
| 924 | 924 | */ |
| 925 | - public function espresso_toolbar_items( $admin_bar ) { |
|
| 925 | + public function espresso_toolbar_items($admin_bar) { |
|
| 926 | 926 | |
| 927 | 927 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
| 928 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
| 928 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
| 929 | 929 | return; |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 933 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
| 932 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 933 | + EE_Registry::instance()->load_helper('URL'); |
|
| 934 | 934 | $menu_class = 'espresso_menu_item_class'; |
| 935 | 935 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
| 936 | 936 | //because they're only defined in each of their respective constructors |
@@ -942,20 +942,20 @@ discard block |
||
| 942 | 942 | //Top Level |
| 943 | 943 | $admin_bar->add_menu(array( |
| 944 | 944 | 'id' => 'espresso-toolbar', |
| 945 | - '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>', |
|
| 945 | + '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>', |
|
| 946 | 946 | 'href' => $events_admin_url, |
| 947 | 947 | 'meta' => array( |
| 948 | 948 | 'title' => __('Event Espresso', 'event_espresso'), |
| 949 | - 'class' => $menu_class . 'first' |
|
| 949 | + 'class' => $menu_class.'first' |
|
| 950 | 950 | ), |
| 951 | 951 | )); |
| 952 | 952 | |
| 953 | 953 | //Events |
| 954 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
| 954 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
| 955 | 955 | $admin_bar->add_menu(array( |
| 956 | 956 | 'id' => 'espresso-toolbar-events', |
| 957 | 957 | 'parent' => 'espresso-toolbar', |
| 958 | - 'title' => __( 'Events', 'event_espresso' ), |
|
| 958 | + 'title' => __('Events', 'event_espresso'), |
|
| 959 | 959 | 'href' => $events_admin_url, |
| 960 | 960 | 'meta' => array( |
| 961 | 961 | 'title' => __('Events', 'event_espresso'), |
@@ -966,13 +966,13 @@ discard block |
||
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | |
| 969 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
| 969 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
| 970 | 970 | //Events Add New |
| 971 | 971 | $admin_bar->add_menu(array( |
| 972 | 972 | 'id' => 'espresso-toolbar-events-new', |
| 973 | 973 | 'parent' => 'espresso-toolbar-events', |
| 974 | 974 | 'title' => __('Add New', 'event_espresso'), |
| 975 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
| 975 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
| 976 | 976 | 'meta' => array( |
| 977 | 977 | 'title' => __('Add New', 'event_espresso'), |
| 978 | 978 | 'target' => '', |
@@ -981,18 +981,18 @@ discard block |
||
| 981 | 981 | )); |
| 982 | 982 | } |
| 983 | 983 | |
| 984 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
| 984 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
| 985 | 985 | |
| 986 | 986 | //Current post |
| 987 | 987 | global $post; |
| 988 | 988 | |
| 989 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
| 989 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
| 990 | 990 | //Events Edit Current Event |
| 991 | 991 | $admin_bar->add_menu(array( |
| 992 | 992 | 'id' => 'espresso-toolbar-events-edit', |
| 993 | 993 | 'parent' => 'espresso-toolbar-events', |
| 994 | 994 | 'title' => __('Edit Event', 'event_espresso'), |
| 995 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
| 995 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
| 996 | 996 | 'meta' => array( |
| 997 | 997 | 'title' => __('Edit Event', 'event_espresso'), |
| 998 | 998 | 'target' => '', |
@@ -1004,11 +1004,11 @@ discard block |
||
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | //Events View |
| 1007 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
| 1007 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
| 1008 | 1008 | $admin_bar->add_menu(array( |
| 1009 | 1009 | 'id' => 'espresso-toolbar-events-view', |
| 1010 | 1010 | 'parent' => 'espresso-toolbar-events', |
| 1011 | - 'title' => __( 'View', 'event_espresso' ), |
|
| 1011 | + 'title' => __('View', 'event_espresso'), |
|
| 1012 | 1012 | 'href' => $events_admin_url, |
| 1013 | 1013 | 'meta' => array( |
| 1014 | 1014 | 'title' => __('View', 'event_espresso'), |
@@ -1018,12 +1018,12 @@ discard block |
||
| 1018 | 1018 | )); |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
| 1021 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
| 1022 | 1022 | //Events View All |
| 1023 | 1023 | $admin_bar->add_menu(array( |
| 1024 | 1024 | 'id' => 'espresso-toolbar-events-all', |
| 1025 | 1025 | 'parent' => 'espresso-toolbar-events-view', |
| 1026 | - 'title' => __( 'All', 'event_espresso' ), |
|
| 1026 | + 'title' => __('All', 'event_espresso'), |
|
| 1027 | 1027 | 'href' => $events_admin_url, |
| 1028 | 1028 | 'meta' => array( |
| 1029 | 1029 | 'title' => __('All', 'event_espresso'), |
@@ -1034,13 +1034,13 @@ discard block |
||
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | |
| 1037 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
| 1037 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
| 1038 | 1038 | //Events View Today |
| 1039 | 1039 | $admin_bar->add_menu(array( |
| 1040 | 1040 | 'id' => 'espresso-toolbar-events-today', |
| 1041 | 1041 | 'parent' => 'espresso-toolbar-events-view', |
| 1042 | 1042 | 'title' => __('Today', 'event_espresso'), |
| 1043 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
| 1043 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
| 1044 | 1044 | 'meta' => array( |
| 1045 | 1045 | 'title' => __('Today', 'event_espresso'), |
| 1046 | 1046 | 'target' => '', |
@@ -1050,13 +1050,13 @@ discard block |
||
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | |
| 1053 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
| 1053 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
| 1054 | 1054 | //Events View This Month |
| 1055 | 1055 | $admin_bar->add_menu(array( |
| 1056 | 1056 | 'id' => 'espresso-toolbar-events-month', |
| 1057 | 1057 | 'parent' => 'espresso-toolbar-events-view', |
| 1058 | - 'title' => __( 'This Month', 'event_espresso'), |
|
| 1059 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
| 1058 | + 'title' => __('This Month', 'event_espresso'), |
|
| 1059 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
| 1060 | 1060 | 'meta' => array( |
| 1061 | 1061 | 'title' => __('This Month', 'event_espresso'), |
| 1062 | 1062 | 'target' => '', |
@@ -1066,11 +1066,11 @@ discard block |
||
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | //Registration Overview |
| 1069 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
| 1069 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
| 1070 | 1070 | $admin_bar->add_menu(array( |
| 1071 | 1071 | 'id' => 'espresso-toolbar-registrations', |
| 1072 | 1072 | 'parent' => 'espresso-toolbar', |
| 1073 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
| 1073 | + 'title' => __('Registrations', 'event_espresso'), |
|
| 1074 | 1074 | 'href' => $reg_admin_url, |
| 1075 | 1075 | 'meta' => array( |
| 1076 | 1076 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1081,12 +1081,12 @@ discard block |
||
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | //Registration Overview Today |
| 1084 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
| 1084 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
| 1085 | 1085 | $admin_bar->add_menu(array( |
| 1086 | 1086 | 'id' => 'espresso-toolbar-registrations-today', |
| 1087 | 1087 | 'parent' => 'espresso-toolbar-registrations', |
| 1088 | - 'title' => __( 'Today', 'event_espresso'), |
|
| 1089 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
| 1088 | + 'title' => __('Today', 'event_espresso'), |
|
| 1089 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
| 1090 | 1090 | 'meta' => array( |
| 1091 | 1091 | 'title' => __('Today', 'event_espresso'), |
| 1092 | 1092 | 'target' => '', |
@@ -1096,14 +1096,14 @@ discard block |
||
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | 1098 | //Registration Overview Today Completed |
| 1099 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
| 1099 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
| 1100 | 1100 | $admin_bar->add_menu(array( |
| 1101 | 1101 | 'id' => 'espresso-toolbar-registrations-today-approved', |
| 1102 | 1102 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1103 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
| 1104 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
| 1103 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1104 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
| 1105 | 1105 | 'meta' => array( |
| 1106 | - 'title' => __('Approved', 'event_espresso' ), |
|
| 1106 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1107 | 1107 | 'target' => '', |
| 1108 | 1108 | 'class' => $menu_class |
| 1109 | 1109 | ), |
@@ -1111,14 +1111,14 @@ discard block |
||
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | 1113 | //Registration Overview Today Pending\ |
| 1114 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
| 1114 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
| 1115 | 1115 | $admin_bar->add_menu(array( |
| 1116 | 1116 | 'id' => 'espresso-toolbar-registrations-today-pending', |
| 1117 | 1117 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1118 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
| 1119 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
| 1118 | + 'title' => __('Pending', 'event_espresso'), |
|
| 1119 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
| 1120 | 1120 | 'meta' => array( |
| 1121 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
| 1121 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
| 1122 | 1122 | 'target' => '', |
| 1123 | 1123 | 'class' => $menu_class |
| 1124 | 1124 | ), |
@@ -1126,14 +1126,14 @@ discard block |
||
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | //Registration Overview Today Incomplete |
| 1129 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
| 1129 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
| 1130 | 1130 | $admin_bar->add_menu(array( |
| 1131 | 1131 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
| 1132 | 1132 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1133 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
| 1134 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
| 1133 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1134 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
| 1135 | 1135 | 'meta' => array( |
| 1136 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
| 1136 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1137 | 1137 | 'target' => '', |
| 1138 | 1138 | 'class' => $menu_class |
| 1139 | 1139 | ), |
@@ -1141,12 +1141,12 @@ discard block |
||
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | 1143 | //Registration Overview Today Incomplete |
| 1144 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
| 1144 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
| 1145 | 1145 | $admin_bar->add_menu(array( |
| 1146 | 1146 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
| 1147 | 1147 | 'parent' => 'espresso-toolbar-registrations-today', |
| 1148 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
| 1149 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
| 1148 | + 'title' => __('Cancelled', 'event_espresso'), |
|
| 1149 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
| 1150 | 1150 | 'meta' => array( |
| 1151 | 1151 | 'title' => __('Cancelled', 'event_espresso'), |
| 1152 | 1152 | 'target' => '', |
@@ -1156,12 +1156,12 @@ discard block |
||
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | 1158 | //Registration Overview This Month |
| 1159 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
| 1159 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
| 1160 | 1160 | $admin_bar->add_menu(array( |
| 1161 | 1161 | 'id' => 'espresso-toolbar-registrations-month', |
| 1162 | 1162 | 'parent' => 'espresso-toolbar-registrations', |
| 1163 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
| 1164 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
| 1163 | + 'title' => __('This Month', 'event_espresso'), |
|
| 1164 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
| 1165 | 1165 | 'meta' => array( |
| 1166 | 1166 | 'title' => __('This Month', 'event_espresso'), |
| 1167 | 1167 | 'target' => '', |
@@ -1171,12 +1171,12 @@ discard block |
||
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | //Registration Overview This Month Approved |
| 1174 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
| 1174 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
| 1175 | 1175 | $admin_bar->add_menu(array( |
| 1176 | 1176 | 'id' => 'espresso-toolbar-registrations-month-approved', |
| 1177 | 1177 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1178 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
| 1179 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
| 1178 | + 'title' => __('Approved', 'event_espresso'), |
|
| 1179 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
| 1180 | 1180 | 'meta' => array( |
| 1181 | 1181 | 'title' => __('Approved', 'event_espresso'), |
| 1182 | 1182 | 'target' => '', |
@@ -1186,12 +1186,12 @@ discard block |
||
| 1186 | 1186 | } |
| 1187 | 1187 | |
| 1188 | 1188 | //Registration Overview This Month Pending |
| 1189 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
| 1189 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
| 1190 | 1190 | $admin_bar->add_menu(array( |
| 1191 | 1191 | 'id' => 'espresso-toolbar-registrations-month-pending', |
| 1192 | 1192 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1193 | - 'title' => __( 'Pending', 'event_espresso'), |
|
| 1194 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
| 1193 | + 'title' => __('Pending', 'event_espresso'), |
|
| 1194 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
| 1195 | 1195 | 'meta' => array( |
| 1196 | 1196 | 'title' => __('Pending', 'event_espresso'), |
| 1197 | 1197 | 'target' => '', |
@@ -1201,14 +1201,14 @@ discard block |
||
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | //Registration Overview This Month Not Approved |
| 1204 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
| 1204 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
| 1205 | 1205 | $admin_bar->add_menu(array( |
| 1206 | 1206 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
| 1207 | 1207 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1208 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
| 1209 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
| 1208 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1209 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
| 1210 | 1210 | 'meta' => array( |
| 1211 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
| 1211 | + 'title' => __('Not Approved', 'event_espresso'), |
|
| 1212 | 1212 | 'target' => '', |
| 1213 | 1213 | 'class' => $menu_class |
| 1214 | 1214 | ), |
@@ -1217,12 +1217,12 @@ discard block |
||
| 1217 | 1217 | |
| 1218 | 1218 | |
| 1219 | 1219 | //Registration Overview This Month Cancelled |
| 1220 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
| 1220 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
| 1221 | 1221 | $admin_bar->add_menu(array( |
| 1222 | 1222 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
| 1223 | 1223 | 'parent' => 'espresso-toolbar-registrations-month', |
| 1224 | 1224 | 'title' => __('Cancelled', 'event_espresso'), |
| 1225 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
| 1225 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
| 1226 | 1226 | 'meta' => array( |
| 1227 | 1227 | 'title' => __('Cancelled', 'event_espresso'), |
| 1228 | 1228 | 'target' => '', |
@@ -1232,11 +1232,11 @@ discard block |
||
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | //Extensions & Services |
| 1235 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
| 1235 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
| 1236 | 1236 | $admin_bar->add_menu(array( |
| 1237 | 1237 | 'id' => 'espresso-toolbar-extensions-and-services', |
| 1238 | 1238 | 'parent' => 'espresso-toolbar', |
| 1239 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
| 1239 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
| 1240 | 1240 | 'href' => $extensions_admin_url, |
| 1241 | 1241 | 'meta' => array( |
| 1242 | 1242 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1258,8 +1258,8 @@ discard block |
||
| 1258 | 1258 | * @param array $exclude_array any existing pages being excluded are in this array. |
| 1259 | 1259 | * @return array |
| 1260 | 1260 | */ |
| 1261 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
| 1262 | - return array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() ); |
|
| 1261 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
| 1262 | + return array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array()); |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | |
@@ -1279,11 +1279,11 @@ discard block |
||
| 1279 | 1279 | */ |
| 1280 | 1280 | public function wp_enqueue_scripts() { |
| 1281 | 1281 | // 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' ); |
| 1282 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
| 1282 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
| 1283 | 1283 | // 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' ); |
| 1284 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
| 1284 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
| 1285 | 1285 | // register jQuery Validate |
| 1286 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE ); |
|
| 1286 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
| 1287 | 1287 | } |
| 1288 | 1288 | } |
| 1289 | 1289 | } |
@@ -1,29 +1,29 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Event Espresso |
|
| 5 | - * |
|
| 6 | - * Event Registration and Ticketing Management Plugin for WordPress |
|
| 7 | - * |
|
| 8 | - * @ package Event Espresso |
|
| 9 | - * @ author Seth Shoultes |
|
| 10 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 11 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 12 | - * @ link http://www.eventespresso.com |
|
| 13 | - * @ version $VID:$ |
|
| 14 | - * |
|
| 15 | - * ------------------------------------------------------------------------ |
|
| 16 | - * |
|
| 17 | - * EE_Maintenance_Mode Class |
|
| 18 | - * |
|
| 19 | - * Super Duper Class Description |
|
| 20 | - * |
|
| 21 | - * @package Event Espresso |
|
| 22 | - * @subpackage core |
|
| 23 | - * @author Michael Nelson |
|
| 24 | - * |
|
| 25 | - * ------------------------------------------------------------------------ |
|
| 26 | - */ |
|
| 3 | + * |
|
| 4 | + * Event Espresso |
|
| 5 | + * |
|
| 6 | + * Event Registration and Ticketing Management Plugin for WordPress |
|
| 7 | + * |
|
| 8 | + * @ package Event Espresso |
|
| 9 | + * @ author Seth Shoultes |
|
| 10 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 11 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 12 | + * @ link http://www.eventespresso.com |
|
| 13 | + * @ version $VID:$ |
|
| 14 | + * |
|
| 15 | + * ------------------------------------------------------------------------ |
|
| 16 | + * |
|
| 17 | + * EE_Maintenance_Mode Class |
|
| 18 | + * |
|
| 19 | + * Super Duper Class Description |
|
| 20 | + * |
|
| 21 | + * @package Event Espresso |
|
| 22 | + * @subpackage core |
|
| 23 | + * @author Michael Nelson |
|
| 24 | + * |
|
| 25 | + * ------------------------------------------------------------------------ |
|
| 26 | + */ |
|
| 27 | 27 | class EE_Maintenance_Mode { |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | const option_name_maintenance_mode = 'ee_maintenance_mode'; |
| 50 | 50 | /** |
| 51 | - * EE_Maintenance_Mode Object |
|
| 52 | - * @var EE_Maintenance_Mode $_instance |
|
| 53 | - * @access private |
|
| 54 | - */ |
|
| 51 | + * EE_Maintenance_Mode Object |
|
| 52 | + * @var EE_Maintenance_Mode $_instance |
|
| 53 | + * @access private |
|
| 54 | + */ |
|
| 55 | 55 | private static $_instance = NULL; |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public static function instance() { |
| 75 | 75 | // check if class object is instantiated |
| 76 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) { |
|
| 76 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) { |
|
| 77 | 77 | self::$_instance = new self(); |
| 78 | 78 | } |
| 79 | 79 | return self::$_instance; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode) |
| 84 | 84 | * @return EE_Maintenance_Mode |
| 85 | 85 | */ |
| 86 | - public static function reset(){ |
|
| 86 | + public static function reset() { |
|
| 87 | 87 | self::instance()->set_maintenance_mode_if_db_old(); |
| 88 | 88 | return self::instance(); |
| 89 | 89 | } |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | private function __construct() { |
| 100 | 100 | // if M-Mode level 2 is engaged, we still need basic assets loaded |
| 101 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' )); |
|
| 101 | + add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode')); |
|
| 102 | 102 | // shut 'er down down for maintenance ? |
| 103 | - add_filter( 'the_content', array( $this, 'the_content' ), 2 ); |
|
| 103 | + add_filter('the_content', array($this, 'the_content'), 2); |
|
| 104 | 104 | // add powered by EE msg |
| 105 | - add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 ); |
|
| 105 | + add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * retrieves the maintenance mode option value from the db |
| 113 | 113 | * @return int |
| 114 | 114 | */ |
| 115 | - public function real_level(){ |
|
| 116 | - return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance ); |
|
| 115 | + public function real_level() { |
|
| 116 | + return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * thinks their tables are present and up-to-date). |
| 122 | 122 | * @return boolean |
| 123 | 123 | */ |
| 124 | - public function models_can_query(){ |
|
| 124 | + public function models_can_query() { |
|
| 125 | 125 | return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode |
| 135 | 135 | * @return int |
| 136 | 136 | */ |
| 137 | - public function level(){ |
|
| 137 | + public function level() { |
|
| 138 | 138 | $real_maintenance_mode_level = $this->real_level(); |
| 139 | 139 | //if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend |
| 140 | - if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests |
|
| 140 | + if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests |
|
| 141 | 141 | current_user_can('administrator') && //when the user is an admin |
| 142 | - $real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1 |
|
| 142 | + $real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1 |
|
| 143 | 143 | $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
| 144 | - }else{ |
|
| 144 | + } else { |
|
| 145 | 145 | $maintenance_mode_level = $real_maintenance_mode_level; |
| 146 | 146 | } |
| 147 | 147 | return $maintenance_mode_level; |
@@ -151,17 +151,17 @@ discard block |
||
| 151 | 151 | * Determines if we need to put EE in maintenance mode because the database needs updating |
| 152 | 152 | * @return boolean true if DB is old and maintenance mode was triggered; false otherwise |
| 153 | 153 | */ |
| 154 | - public function set_maintenance_mode_if_db_old(){ |
|
| 155 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
| 156 | - if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){ |
|
| 154 | + public function set_maintenance_mode_if_db_old() { |
|
| 155 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
| 156 | + if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
| 157 | 157 | update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
| 158 | 158 | return true; |
| 159 | - }elseif( $this->level() == self::level_2_complete_maintenance ){ |
|
| 159 | + }elseif ($this->level() == self::level_2_complete_maintenance) { |
|
| 160 | 160 | //we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
| 161 | 161 | //then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
| 162 | - update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance ); |
|
| 162 | + update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance); |
|
| 163 | 163 | return false; |
| 164 | - }else{ |
|
| 164 | + } else { |
|
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | * @param int $level |
| 172 | 172 | * @return void |
| 173 | 173 | */ |
| 174 | - public function set_maintenance_level($level){ |
|
| 175 | - do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level ); |
|
| 174 | + public function set_maintenance_level($level) { |
|
| 175 | + do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level); |
|
| 176 | 176 | update_option(self::option_name_maintenance_mode, intval($level)); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | * @return string |
| 200 | 200 | */ |
| 201 | 201 | public function load_assets_required_for_m_mode() { |
| 202 | - if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) { |
|
| 203 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
| 202 | + if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) { |
|
| 203 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
| 204 | 204 | wp_enqueue_style('espresso_default'); |
| 205 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 206 | - wp_enqueue_script( 'espresso_core' ); |
|
| 205 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 206 | + wp_enqueue_script('espresso_core'); |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public static function template_include() { |
| 223 | 223 | // shut 'er down down for maintenance ? then don't use any of our templates for our endpoints |
| 224 | - return get_template_directory() . '/index.php'; |
|
| 224 | + return get_template_directory().'/index.php'; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | * @param string $the_content |
| 236 | 236 | * @return string |
| 237 | 237 | */ |
| 238 | - public function the_content( $the_content ) { |
|
| 238 | + public function the_content($the_content) { |
|
| 239 | 239 | // check if M-mode is engaged and for EE shortcode |
| 240 | - if ( $this->level() && strpos( $the_content, '[ESPRESSO_' ) !== false ) { |
|
| 240 | + if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) { |
|
| 241 | 241 | // this can eventually be moved to a template, or edited via admin. But for now... |
| 242 | 242 | $the_content = sprintf( |
| 243 | - __( '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso' ), |
|
| 243 | + __('%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso'), |
|
| 244 | 244 | '<h3>', |
| 245 | 245 | '</h3><p>', |
| 246 | 246 | '</p>' |
@@ -264,16 +264,16 @@ discard block |
||
| 264 | 264 | // check if M-mode is engaged and for EE shortcode |
| 265 | 265 | if ( |
| 266 | 266 | $this->real_level() && |
| 267 | - current_user_can( 'administrator' ) && |
|
| 267 | + current_user_can('administrator') && |
|
| 268 | 268 | ! is_admin() && |
| 269 | - ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
| 269 | + ! (defined('DOING_AJAX') && DOING_AJAX) |
|
| 270 | 270 | && EE_Registry::instance()->REQ->is_espresso_page() |
| 271 | 271 | ) { |
| 272 | 272 | printf( |
| 273 | - __( '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso' ), |
|
| 273 | + __('%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso'), |
|
| 274 | 274 | '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
| 275 | 275 | '">×</a><p>', |
| 276 | - ' » <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">', |
|
| 276 | + ' » <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">', |
|
| 277 | 277 | '</a></p></div>' |
| 278 | 278 | ); |
| 279 | 279 | } |
@@ -291,9 +291,9 @@ discard block |
||
| 291 | 291 | * @ return void |
| 292 | 292 | */ |
| 293 | 293 | final function __destruct() {} |
| 294 | - final function __call($a,$b) {} |
|
| 294 | + final function __call($a, $b) {} |
|
| 295 | 295 | final function __get($a) {} |
| 296 | - final function __set($a,$b) {} |
|
| 296 | + final function __set($a, $b) {} |
|
| 297 | 297 | final function __isset($a) {} |
| 298 | 298 | final function __unset($a) {} |
| 299 | 299 | final function __sleep() { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | final function __invoke() {} |
| 305 | 305 | final function __set_state() {} |
| 306 | 306 | final function __clone() {} |
| 307 | - final static function __callStatic($a,$b) {} |
|
| 307 | + final static function __callStatic($a, $b) {} |
|
| 308 | 308 | |
| 309 | 309 | } |
| 310 | 310 | // End of file EE_Maintenance_Mode.core.php |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This template will display The Loop that displays your venues |
|
| 4 | - * |
|
| 5 | - * @ package Event Espresso |
|
| 6 | - * @ author Seth Shoultes |
|
| 7 | - * @ copyright (c) 2008-2013 Event Espresso All Rights Reserved. |
|
| 8 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 9 | - * @ link http://www.eventespresso.com |
|
| 10 | - * @ version 4+ |
|
| 11 | - */ |
|
| 3 | + * This template will display The Loop that displays your venues |
|
| 4 | + * |
|
| 5 | + * @ package Event Espresso |
|
| 6 | + * @ author Seth Shoultes |
|
| 7 | + * @ copyright (c) 2008-2013 Event Espresso All Rights Reserved. |
|
| 8 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 9 | + * @ link http://www.eventespresso.com |
|
| 10 | + * @ version 4+ |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | if ( have_posts() ) : ?> |
| 14 | 14 | |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | * @ link http://www.eventespresso.com |
| 10 | 10 | * @ version 4+ |
| 11 | 11 | */ |
| 12 | -define( 'EE_THEME_FUNCTIONS_LOADED', TRUE ); |
|
| 12 | +define('EE_THEME_FUNCTIONS_LOADED', TRUE); |
|
| 13 | 13 | |
| 14 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
| 14 | +if ( ! function_exists('espresso_pagination')) { |
|
| 15 | 15 | /** |
| 16 | 16 | * espresso_pagination |
| 17 | 17 | * |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | $big = 999999999; // need an unlikely integer |
| 24 | 24 | $pagination = paginate_links( |
| 25 | 25 | array( |
| 26 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
| 26 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
| 27 | 27 | 'format' => '?paged=%#%', |
| 28 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
| 28 | + 'current' => max(1, get_query_var('paged')), |
|
| 29 | 29 | 'total' => $wp_query->max_num_pages, |
| 30 | 30 | 'show_all' => true, |
| 31 | 31 | 'end_size' => 10, |
| 32 | 32 | 'mid_size' => 6, |
| 33 | 33 | 'prev_next' => true, |
| 34 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
| 35 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
| 34 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
| 35 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
| 36 | 36 | 'type' => 'plain', |
| 37 | 37 | 'add_args' => false, |
| 38 | 38 | 'add_fragment' => '' |
| 39 | 39 | ) |
| 40 | 40 | ); |
| 41 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
| 41 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public static function instance() { |
| 130 | 130 | // check if class object is instantiated, and instantiated properly |
| 131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
| 131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
| 132 | 132 | self::$_instance = new self(); |
| 133 | 133 | } |
| 134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
| 145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
| 146 | 146 | * @return EE_Config |
| 147 | 147 | */ |
| 148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
| 149 | - if ( $hard_reset ) { |
|
| 148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
| 149 | + if ($hard_reset) { |
|
| 150 | 150 | self::$_instance->_config_option_names = array(); |
| 151 | 151 | self::$_instance->_initialize_config(); |
| 152 | 152 | self::$_instance->update_espresso_config(); |
| 153 | 153 | } |
| 154 | - if( self::$_instance instanceof EE_Config ){ |
|
| 154 | + if (self::$_instance instanceof EE_Config) { |
|
| 155 | 155 | self::$_instance->shutdown(); |
| 156 | 156 | } |
| 157 | 157 | self::$_instance = NULL; |
| 158 | 158 | //we don't need to reset the static properties imo because those should |
| 159 | 159 | //only change when a module is added or removed. Currently we don't |
| 160 | 160 | //support removing a module during a request when it previously existed |
| 161 | - if( $reinstantiate ){ |
|
| 161 | + if ($reinstantiate) { |
|
| 162 | 162 | return self::instance(); |
| 163 | - }else{ |
|
| 163 | + } else { |
|
| 164 | 164 | return NULL; |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | * @return \EE_Config |
| 175 | 175 | */ |
| 176 | 176 | private function __construct() { |
| 177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
| 178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
| 177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
| 178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
| 179 | 179 | // setup empty config classes |
| 180 | 180 | $this->_initialize_config(); |
| 181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
| 183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
| 184 | 184 | $this->_verify_config(); |
| 185 | 185 | // register shortcodes and modules |
| 186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
| 186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
| 187 | 187 | // initialize shortcodes and modules |
| 188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
| 188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
| 189 | 189 | // register widgets |
| 190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
| 190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
| 191 | 191 | // shutdown |
| 192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
| 192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
| 193 | 193 | // construct__end hook |
| 194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
| 194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
| 195 | 195 | // hardcoded hack |
| 196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
| 197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return string current theme set. |
| 205 | 205 | */ |
| 206 | 206 | public static function get_current_theme() { |
| 207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | private function _load_core_config() { |
| 240 | 240 | // load_core_config__start hook |
| 241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
| 241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
| 242 | 242 | $espresso_config = $this->get_espresso_config(); |
| 243 | - foreach ( $espresso_config as $config => $settings ) { |
|
| 243 | + foreach ($espresso_config as $config => $settings) { |
|
| 244 | 244 | // load_core_config__start hook |
| 245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
| 246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
| 247 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
| 245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
| 246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
| 247 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
| 248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
| 249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
| 249 | + if (method_exists($settings, 'populate')) { |
|
| 250 | 250 | $this->{$config}->populate(); |
| 251 | 251 | } |
| 252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
| 252 | + if (method_exists($settings, 'do_hooks')) { |
|
| 253 | 253 | $this->{$config}->do_hooks(); |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
| 257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
| 258 | 258 | $this->update_espresso_config(); |
| 259 | 259 | } |
| 260 | 260 | // load_core_config__end hook |
| 261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
| 261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
| 272 | 272 | protected function _verify_config() { |
| 273 | 273 | |
| 274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
| 275 | - ? $this->core : new EE_Core_Config(); |
|
| 276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
| 275 | + ? $this->core : new EE_Core_Config(); |
|
| 276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
| 277 | 277 | |
| 278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
| 279 | - ? $this->organization : new EE_Organization_Config(); |
|
| 280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
| 279 | + ? $this->organization : new EE_Organization_Config(); |
|
| 280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
| 281 | 281 | |
| 282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
| 283 | 283 | ? $this->currency : new EE_Currency_Config(); |
| 284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
| 284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
| 285 | 285 | |
| 286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
| 287 | 287 | ? $this->registration : new EE_Registration_Config(); |
| 288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
| 288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
| 289 | 289 | |
| 290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
| 291 | 291 | ? $this->admin : new EE_Admin_Config(); |
| 292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
| 292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
| 293 | 293 | |
| 294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
| 295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
| 296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
| 296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
| 297 | 297 | |
| 298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
| 299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
| 300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
| 300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
| 301 | 301 | |
| 302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
| 303 | 303 | ? $this->environment : new EE_Environment_Config(); |
| 304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
| 304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
| 305 | 305 | |
| 306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
| 307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
| 308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
| 308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
| 309 | 309 | |
| 310 | 310 | } |
| 311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | */ |
| 320 | 320 | public function get_espresso_config() { |
| 321 | 321 | // grab espresso configuration |
| 322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
| 322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | * @param $old_value |
| 333 | 333 | * @param $value |
| 334 | 334 | */ |
| 335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
| 335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
| 336 | 336 | // make sure we're checking the ee config |
| 337 | - if ( $option == 'ee_config' ) { |
|
| 337 | + if ($option == 'ee_config') { |
|
| 338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
| 339 | 339 | // but NOT exact instance like WP update_option does |
| 340 | - if ( $value != $old_value ) { |
|
| 340 | + if ($value != $old_value) { |
|
| 341 | 341 | // if they are NOT the same, then remove the hook, |
| 342 | 342 | // which means the subsequent update results will be based solely on the update query results |
| 343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
| 353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
| 354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
| 355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
| 355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | protected function _reset_espresso_addon_config() { |
| 369 | 369 | $this->_config_option_names = array(); |
| 370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
| 371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
| 372 | - $config_class = get_class( $addon_config_obj ); |
|
| 373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
| 374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
| 370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
| 371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
| 372 | + $config_class = get_class($addon_config_obj); |
|
| 373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
| 374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
| 375 | 375 | } |
| 376 | 376 | $this->addons->{$addon_name} = NULL; |
| 377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
| 387 | 387 | * @param bool $add_error |
| 388 | 388 | * @return bool |
| 389 | 389 | */ |
| 390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
| 390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
| 391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
| 392 | 392 | //$clone = clone( self::$_instance ); |
| 393 | 393 | //self::$_instance = NULL; |
| 394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
| 394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
| 395 | 395 | $this->_reset_espresso_addon_config(); |
| 396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
| 397 | 397 | // but BEFORE the actual update occurs |
| 398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
| 398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
| 399 | 399 | // now update "ee_config" |
| 400 | - $saved = update_option( 'ee_config', $this ); |
|
| 400 | + $saved = update_option('ee_config', $this); |
|
| 401 | 401 | // if not saved... check if the hook we just added still exists; |
| 402 | 402 | // if it does, it means one of two things: |
| 403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
| 408 | 408 | // but just means no update occurred, so don't display an error to the user. |
| 409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
| 410 | 410 | // then it means that something truly went wrong |
| 411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
| 411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
| 412 | 412 | // remove our action since we don't want it in the system anymore |
| 413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
| 414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
| 413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
| 414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
| 415 | 415 | //self::$_instance = $clone; |
| 416 | 416 | //unset( $clone ); |
| 417 | 417 | // if config remains the same or was updated successfully |
| 418 | - if ( $saved ) { |
|
| 419 | - if ( $add_success ) { |
|
| 418 | + if ($saved) { |
|
| 419 | + if ($add_success) { |
|
| 420 | 420 | EE_Error::add_success( |
| 421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
| 421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
| 422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
| 423 | 423 | ); |
| 424 | 424 | } |
| 425 | 425 | return TRUE; |
| 426 | 426 | } else { |
| 427 | - if ( $add_error ) { |
|
| 427 | + if ($add_error) { |
|
| 428 | 428 | EE_Error::add_error( |
| 429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
| 429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
| 430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
| 431 | 431 | ); |
| 432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
| 452 | 452 | $name = '', |
| 453 | 453 | $config_class = '', |
| 454 | 454 | $config_obj = NULL, |
| 455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
| 455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
| 456 | 456 | $display_errors = TRUE |
| 457 | 457 | ) { |
| 458 | 458 | try { |
| 459 | - foreach ( $tests_to_run as $test ) { |
|
| 460 | - switch ( $test ) { |
|
| 459 | + foreach ($tests_to_run as $test) { |
|
| 460 | + switch ($test) { |
|
| 461 | 461 | |
| 462 | 462 | // TEST #1 : check that section was set |
| 463 | 463 | case 1 : |
| 464 | - if ( empty( $section ) ) { |
|
| 465 | - if ( $display_errors ) { |
|
| 464 | + if (empty($section)) { |
|
| 465 | + if ($display_errors) { |
|
| 466 | 466 | throw new EE_Error( |
| 467 | 467 | sprintf( |
| 468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
| 468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
| 469 | 469 | $config_class |
| 470 | 470 | ) |
| 471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | // TEST #2 : check that settings section exists |
| 478 | 478 | case 2 : |
| 479 | - if ( ! isset( $this->{$section} ) ) { |
|
| 480 | - if ( $display_errors ) { |
|
| 479 | + if ( ! isset($this->{$section} )) { |
|
| 480 | + if ($display_errors) { |
|
| 481 | 481 | throw new EE_Error( |
| 482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
| 483 | - $section ) |
|
| 482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
| 483 | + $section) |
|
| 484 | 484 | ); |
| 485 | 485 | } |
| 486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
| 490 | 490 | // TEST #3 : check that section is the proper format |
| 491 | 491 | case 3 : |
| 492 | 492 | if ( |
| 493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
| 493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
| 494 | 494 | ) { |
| 495 | - if ( $display_errors ) { |
|
| 495 | + if ($display_errors) { |
|
| 496 | 496 | throw new EE_Error( |
| 497 | 497 | sprintf( |
| 498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
| 498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
| 499 | 499 | $section |
| 500 | 500 | ) |
| 501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | // TEST #4 : check that config section name has been set |
| 508 | 508 | case 4 : |
| 509 | - if ( empty( $name ) ) { |
|
| 510 | - if ( $display_errors ) { |
|
| 509 | + if (empty($name)) { |
|
| 510 | + if ($display_errors) { |
|
| 511 | 511 | throw new EE_Error( |
| 512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
| 513 | 513 | ); |
| 514 | 514 | } |
| 515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | // TEST #5 : check that a config class name has been set |
| 520 | 520 | case 5 : |
| 521 | - if ( empty( $config_class ) ) { |
|
| 522 | - if ( $display_errors ) { |
|
| 521 | + if (empty($config_class)) { |
|
| 522 | + if ($display_errors) { |
|
| 523 | 523 | throw new EE_Error( |
| 524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
| 525 | 525 | ); |
| 526 | 526 | } |
| 527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | // TEST #6 : verify config class is accessible |
| 532 | 532 | case 6 : |
| 533 | - if ( ! class_exists( $config_class ) ) { |
|
| 534 | - if ( $display_errors ) { |
|
| 533 | + if ( ! class_exists($config_class)) { |
|
| 534 | + if ($display_errors) { |
|
| 535 | 535 | throw new EE_Error( |
| 536 | 536 | sprintf( |
| 537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
| 537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
| 538 | 538 | $config_class |
| 539 | 539 | ) |
| 540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | // TEST #7 : check that config has even been set |
| 547 | 547 | case 7 : |
| 548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
| 549 | - if ( $display_errors ) { |
|
| 548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
| 549 | + if ($display_errors) { |
|
| 550 | 550 | throw new EE_Error( |
| 551 | 551 | sprintf( |
| 552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
| 552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
| 553 | 553 | $section, |
| 554 | 554 | $name |
| 555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
| 558 | 558 | return false; |
| 559 | 559 | } else { |
| 560 | 560 | // and make sure it's not serialized |
| 561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
| 561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
| 562 | 562 | } |
| 563 | 563 | break; |
| 564 | 564 | |
| 565 | 565 | // TEST #8 : check that config is the requested type |
| 566 | 566 | case 8 : |
| 567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
| 568 | - if ( $display_errors ) { |
|
| 567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
| 568 | + if ($display_errors) { |
|
| 569 | 569 | throw new EE_Error( |
| 570 | 570 | sprintf( |
| 571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
| 571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
| 572 | 572 | $section, |
| 573 | 573 | $name, |
| 574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | // TEST #9 : verify config object |
| 583 | 583 | case 9 : |
| 584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
| 585 | - if ( $display_errors ) { |
|
| 584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
| 585 | + if ($display_errors) { |
|
| 586 | 586 | throw new EE_Error( |
| 587 | 587 | sprintf( |
| 588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
| 589 | - print_r( $config_obj, true ) |
|
| 588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
| 589 | + print_r($config_obj, true) |
|
| 590 | 590 | ) |
| 591 | 591 | ); |
| 592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - } catch( EE_Error $e ) { |
|
| 600 | + } catch (EE_Error $e) { |
|
| 601 | 601 | $e->get_error(); |
| 602 | 602 | } |
| 603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
| 614 | 614 | * @param string $name |
| 615 | 615 | * @return string |
| 616 | 616 | */ |
| 617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
| 618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
| 617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
| 618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
| 629 | 629 | * @param string $name |
| 630 | 630 | * @return string |
| 631 | 631 | */ |
| 632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
| 633 | - return ! empty( $config_class ) |
|
| 632 | + private function _set_config_class($config_class = '', $name = '') { |
|
| 633 | + return ! empty($config_class) |
|
| 634 | 634 | ? $config_class |
| 635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
| 635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
| 646 | 646 | * @param EE_Config_Base $config_obj |
| 647 | 647 | * @return EE_Config_Base |
| 648 | 648 | */ |
| 649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
| 649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
| 650 | 650 | // ensure config class is set to something |
| 651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
| 653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
| 654 | 654 | return null; |
| 655 | 655 | } |
| 656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
| 658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
| 658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
| 660 | 660 | } |
| 661 | 661 | // verify the incoming config object but suppress errors |
| 662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
| 662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
| 663 | 663 | $config_obj = new $config_class(); |
| 664 | 664 | } |
| 665 | - if ( get_option( $config_option_name ) ) { |
|
| 666 | - update_option( $config_option_name, $config_obj ); |
|
| 665 | + if (get_option($config_option_name)) { |
|
| 666 | + update_option($config_option_name, $config_obj); |
|
| 667 | 667 | $this->{$section}->{$name} = $config_obj; |
| 668 | 668 | return $this->{$section}->{$name}; |
| 669 | 669 | } else { |
| 670 | 670 | // create a wp-option for this config |
| 671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
| 672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
| 671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
| 672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
| 673 | 673 | return $this->{$section}->{$name}; |
| 674 | 674 | } else { |
| 675 | 675 | EE_Error::add_error( |
| 676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
| 676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
| 677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
| 678 | 678 | ); |
| 679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
| 694 | 694 | * @param bool $throw_errors |
| 695 | 695 | * @return bool |
| 696 | 696 | */ |
| 697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
| 698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
| 697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
| 698 | + $config_obj = maybe_unserialize($config_obj); |
|
| 699 | 699 | // get class name of the incoming object |
| 700 | - $config_class = get_class( $config_obj ); |
|
| 700 | + $config_class = get_class($config_obj); |
|
| 701 | 701 | // run tests 1-5 and 9 to verify config |
| 702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
| 702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
| 703 | 703 | return false; |
| 704 | 704 | } |
| 705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
| 707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 708 | 708 | // save new config to db |
| 709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
| 709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
| 710 | 710 | } else { |
| 711 | 711 | // first check if the record already exists |
| 712 | - $existing_config = get_option( $config_option_name ); |
|
| 713 | - $config_obj = serialize( $config_obj ); |
|
| 712 | + $existing_config = get_option($config_option_name); |
|
| 713 | + $config_obj = serialize($config_obj); |
|
| 714 | 714 | // just return if db record is already up to date |
| 715 | - if ( $existing_config == $config_obj ) { |
|
| 715 | + if ($existing_config == $config_obj) { |
|
| 716 | 716 | $this->{$section}->{$name} = $config_obj; |
| 717 | 717 | return true; |
| 718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
| 718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
| 719 | 719 | // update wp-option for this config class |
| 720 | 720 | $this->{$section}->{$name} = $config_obj; |
| 721 | 721 | return true; |
| 722 | - } elseif ( $throw_errors ) { |
|
| 722 | + } elseif ($throw_errors) { |
|
| 723 | 723 | EE_Error::add_error( |
| 724 | 724 | sprintf( |
| 725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
| 725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
| 726 | 726 | $config_class, |
| 727 | - 'EE_Config->' . $section . '->' . $name |
|
| 727 | + 'EE_Config->'.$section.'->'.$name |
|
| 728 | 728 | ), |
| 729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
| 730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
| 744 | 744 | * @param string $config_class |
| 745 | 745 | * @return mixed EE_Config_Base | NULL |
| 746 | 746 | */ |
| 747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
| 747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
| 748 | 748 | // ensure config class is set to something |
| 749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
| 751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
| 752 | 752 | return NULL; |
| 753 | 753 | } |
| 754 | 754 | // now test if the requested config object exists, but suppress errors |
| 755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
| 755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
| 756 | 756 | // config already exists, so pass it back |
| 757 | 757 | return $this->{$section}->{$name}; |
| 758 | 758 | } |
| 759 | 759 | // load config option from db if it exists |
| 760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
| 760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
| 761 | 761 | // verify the newly retrieved config object, but suppress errors |
| 762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
| 762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
| 763 | 763 | // config is good, so set it and pass it back |
| 764 | 764 | $this->{$section}->{$name} = $config_obj; |
| 765 | 765 | return $this->{$section}->{$name}; |
| 766 | 766 | } |
| 767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
| 768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
| 768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
| 769 | 769 | // verify the newly created config object |
| 770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
| 770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
| 771 | 771 | return $this->{$section}->{$name}; |
| 772 | 772 | } else { |
| 773 | 773 | EE_Error::add_error( |
| 774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
| 774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
| 775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
| 776 | 776 | ); |
| 777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
| 786 | 786 | * @param string $config_option_name |
| 787 | 787 | * @return mixed EE_Config_Base | FALSE |
| 788 | 788 | */ |
| 789 | - public function get_config_option( $config_option_name = '' ) { |
|
| 789 | + public function get_config_option($config_option_name = '') { |
|
| 790 | 790 | // retrieve the wp-option for this config class. |
| 791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
| 791 | + return maybe_unserialize(get_option($config_option_name)); |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
| 801 | 801 | * @param $page_for_posts |
| 802 | 802 | * @return void |
| 803 | 803 | */ |
| 804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
| 804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
| 805 | 805 | // make sure page_for_posts is set |
| 806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
| 806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
| 807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
| 808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
| 809 | 809 | // allow others to mess stuff up :D |
| 810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
| 810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
| 811 | 811 | // verify that post_shortcodes is set |
| 812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
| 812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
| 813 | 813 | // cycle thru post_shortcodes |
| 814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
| 814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
| 815 | 815 | // are there any shortcodes to track ? |
| 816 | - if ( ! empty( $shortcodes )) { |
|
| 816 | + if ( ! empty($shortcodes)) { |
|
| 817 | 817 | // loop thru list of tracked shortcodes |
| 818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
| 818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
| 819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
| 820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
| 820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
| 821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
| 822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
| 822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
| 823 | 823 | } |
| 824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
| 825 | - if ( $post_name == $page_for_posts ) { |
|
| 825 | + if ($post_name == $page_for_posts) { |
|
| 826 | 826 | continue; |
| 827 | 827 | } |
| 828 | 828 | // make sure post still exists |
| 829 | - $post = get_post( $post_id ); |
|
| 830 | - if ( $post ) { |
|
| 829 | + $post = get_post($post_id); |
|
| 830 | + if ($post) { |
|
| 831 | 831 | // check that the post name matches what we have saved |
| 832 | - if ( $post->post_name == $post_name ) { |
|
| 832 | + if ($post->post_name == $post_name) { |
|
| 833 | 833 | // if so, then break before hitting the unset below |
| 834 | 834 | continue; |
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | 837 | // we don't like missing posts around here >:( |
| 838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
| 838 | + unset($this->core->post_shortcodes[$post_name]); |
|
| 839 | 839 | } |
| 840 | 840 | } else { |
| 841 | 841 | // you got no shortcodes to keep track of ! |
| 842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
| 842 | + unset($this->core->post_shortcodes[$post_name]); |
|
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
| 858 | 858 | * @return string |
| 859 | 859 | */ |
| 860 | 860 | public static function get_page_for_posts() { |
| 861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
| 862 | - if ( ! $page_for_posts ) { |
|
| 861 | + $page_for_posts = get_option('page_for_posts'); |
|
| 862 | + if ( ! $page_for_posts) { |
|
| 863 | 863 | return 'posts'; |
| 864 | 864 | } |
| 865 | 865 | /** @type WPDB $wpdb */ |
| 866 | 866 | global $wpdb; |
| 867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
| 868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
| 868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | */ |
| 883 | 883 | public function register_shortcodes_and_modules() { |
| 884 | 884 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
| 885 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
| 885 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
| 886 | 886 | // allow modules to set hooks for the rest of the system |
| 887 | 887 | EE_Registry::instance()->modules = $this->_register_modules(); |
| 888 | 888 | } |
@@ -914,21 +914,21 @@ discard block |
||
| 914 | 914 | public function widgets_init() { |
| 915 | 915 | //only init widgets on admin pages when not in complete maintenance, and |
| 916 | 916 | //on frontend when not in any maintenance mode |
| 917 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
| 917 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
| 918 | 918 | // grab list of installed widgets |
| 919 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
| 919 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
| 920 | 920 | // filter list of modules to register |
| 921 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
| 921 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
| 922 | 922 | |
| 923 | - if ( ! empty( $widgets_to_register ) ) { |
|
| 923 | + if ( ! empty($widgets_to_register)) { |
|
| 924 | 924 | // cycle thru widget folders |
| 925 | - foreach ( $widgets_to_register as $widget_path ) { |
|
| 925 | + foreach ($widgets_to_register as $widget_path) { |
|
| 926 | 926 | // add to list of installed widget modules |
| 927 | - EE_Config::register_ee_widget( $widget_path ); |
|
| 927 | + EE_Config::register_ee_widget($widget_path); |
|
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | 930 | // filter list of installed modules |
| 931 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
| 931 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
| 932 | 932 | } |
| 933 | 933 | } |
| 934 | 934 | |
@@ -941,54 +941,54 @@ discard block |
||
| 941 | 941 | * @param string $widget_path - full path up to and including widget folder |
| 942 | 942 | * @return void |
| 943 | 943 | */ |
| 944 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
| 945 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
| 944 | + public static function register_ee_widget($widget_path = NULL) { |
|
| 945 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
| 946 | 946 | $widget_ext = '.widget.php'; |
| 947 | 947 | // make all separators match |
| 948 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
| 948 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
| 949 | 949 | // does the file path INCLUDE the actual file name as part of the path ? |
| 950 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
| 950 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
| 951 | 951 | // grab and shortcode file name from directory name and break apart at dots |
| 952 | - $file_name = explode( '.', basename( $widget_path )); |
|
| 952 | + $file_name = explode('.', basename($widget_path)); |
|
| 953 | 953 | // take first segment from file name pieces and remove class prefix if it exists |
| 954 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
| 954 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
| 955 | 955 | // sanitize shortcode directory name |
| 956 | - $widget = sanitize_key( $widget ); |
|
| 956 | + $widget = sanitize_key($widget); |
|
| 957 | 957 | // now we need to rebuild the shortcode path |
| 958 | - $widget_path = explode( DS, $widget_path ); |
|
| 958 | + $widget_path = explode(DS, $widget_path); |
|
| 959 | 959 | // remove last segment |
| 960 | - array_pop( $widget_path ); |
|
| 960 | + array_pop($widget_path); |
|
| 961 | 961 | // glue it back together |
| 962 | - $widget_path = implode( DS, $widget_path ); |
|
| 962 | + $widget_path = implode(DS, $widget_path); |
|
| 963 | 963 | } else { |
| 964 | 964 | // grab and sanitize widget directory name |
| 965 | - $widget = sanitize_key( basename( $widget_path )); |
|
| 965 | + $widget = sanitize_key(basename($widget_path)); |
|
| 966 | 966 | } |
| 967 | 967 | // create classname from widget directory name |
| 968 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
| 968 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
| 969 | 969 | // add class prefix |
| 970 | - $widget_class = 'EEW_' . $widget; |
|
| 970 | + $widget_class = 'EEW_'.$widget; |
|
| 971 | 971 | // does the widget exist ? |
| 972 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
| 972 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
| 973 | 973 | $msg = sprintf( |
| 974 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
| 974 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
| 975 | 975 | $widget_class, |
| 976 | - $widget_path . DS . $widget_class . $widget_ext |
|
| 976 | + $widget_path.DS.$widget_class.$widget_ext |
|
| 977 | 977 | ); |
| 978 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 978 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 979 | 979 | return; |
| 980 | 980 | } |
| 981 | 981 | // load the widget class file |
| 982 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
| 982 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
| 983 | 983 | // verify that class exists |
| 984 | - if ( ! class_exists( $widget_class )) { |
|
| 985 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
| 986 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 984 | + if ( ! class_exists($widget_class)) { |
|
| 985 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
| 986 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 987 | 987 | return; |
| 988 | 988 | } |
| 989 | - register_widget( $widget_class ); |
|
| 989 | + register_widget($widget_class); |
|
| 990 | 990 | // add to array of registered widgets |
| 991 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
| 991 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | |
@@ -1001,18 +1001,18 @@ discard block |
||
| 1001 | 1001 | */ |
| 1002 | 1002 | private function _register_shortcodes() { |
| 1003 | 1003 | // grab list of installed shortcodes |
| 1004 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
| 1004 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
| 1005 | 1005 | // filter list of modules to register |
| 1006 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
| 1007 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
| 1006 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
| 1007 | + if ( ! empty($shortcodes_to_register)) { |
|
| 1008 | 1008 | // cycle thru shortcode folders |
| 1009 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
| 1009 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
| 1010 | 1010 | // add to list of installed shortcode modules |
| 1011 | - EE_Config::register_shortcode( $shortcode_path ); |
|
| 1011 | + EE_Config::register_shortcode($shortcode_path); |
|
| 1012 | 1012 | } |
| 1013 | 1013 | } |
| 1014 | 1014 | // filter list of installed modules |
| 1015 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
| 1015 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | |
@@ -1024,56 +1024,56 @@ discard block |
||
| 1024 | 1024 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 1025 | 1025 | * @return bool |
| 1026 | 1026 | */ |
| 1027 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
| 1028 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
| 1027 | + public static function register_shortcode($shortcode_path = NULL) { |
|
| 1028 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
| 1029 | 1029 | $shortcode_ext = '.shortcode.php'; |
| 1030 | 1030 | // make all separators match |
| 1031 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
| 1031 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
| 1032 | 1032 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1033 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
| 1033 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
| 1034 | 1034 | // grab shortcode file name from directory name and break apart at dots |
| 1035 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
| 1035 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
| 1036 | 1036 | // take first segment from file name pieces and remove class prefix if it exists |
| 1037 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
| 1037 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
| 1038 | 1038 | // sanitize shortcode directory name |
| 1039 | - $shortcode = sanitize_key( $shortcode ); |
|
| 1039 | + $shortcode = sanitize_key($shortcode); |
|
| 1040 | 1040 | // now we need to rebuild the shortcode path |
| 1041 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
| 1041 | + $shortcode_path = explode(DS, $shortcode_path); |
|
| 1042 | 1042 | // remove last segment |
| 1043 | - array_pop( $shortcode_path ); |
|
| 1043 | + array_pop($shortcode_path); |
|
| 1044 | 1044 | // glue it back together |
| 1045 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
| 1045 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
| 1046 | 1046 | } else { |
| 1047 | 1047 | // we need to generate the filename based off of the folder name |
| 1048 | 1048 | // grab and sanitize shortcode directory name |
| 1049 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
| 1050 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
| 1049 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
| 1050 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | // create classname from shortcode directory or file name |
| 1053 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
| 1053 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
| 1054 | 1054 | // add class prefix |
| 1055 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1055 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1056 | 1056 | // does the shortcode exist ? |
| 1057 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
| 1057 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
| 1058 | 1058 | $msg = sprintf( |
| 1059 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
| 1059 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
| 1060 | 1060 | $shortcode_class, |
| 1061 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
| 1061 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
| 1062 | 1062 | ); |
| 1063 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1063 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1064 | 1064 | return FALSE; |
| 1065 | 1065 | } |
| 1066 | 1066 | // load the shortcode class file |
| 1067 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
| 1067 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
| 1068 | 1068 | // verify that class exists |
| 1069 | - if ( ! class_exists( $shortcode_class )) { |
|
| 1070 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
| 1071 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1069 | + if ( ! class_exists($shortcode_class)) { |
|
| 1070 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
| 1071 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1072 | 1072 | return FALSE; |
| 1073 | 1073 | } |
| 1074 | - $shortcode = strtoupper( $shortcode ); |
|
| 1074 | + $shortcode = strtoupper($shortcode); |
|
| 1075 | 1075 | // add to array of registered shortcodes |
| 1076 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
| 1076 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
| 1077 | 1077 | return TRUE; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
@@ -1088,23 +1088,23 @@ discard block |
||
| 1088 | 1088 | */ |
| 1089 | 1089 | private function _register_modules() { |
| 1090 | 1090 | // grab list of installed modules |
| 1091 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
| 1091 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
| 1092 | 1092 | // filter list of modules to register |
| 1093 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
| 1093 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
| 1094 | 1094 | |
| 1095 | 1095 | |
| 1096 | - if ( ! empty( $modules_to_register ) ) { |
|
| 1096 | + if ( ! empty($modules_to_register)) { |
|
| 1097 | 1097 | // loop through folders |
| 1098 | - foreach ( $modules_to_register as $module_path ) { |
|
| 1098 | + foreach ($modules_to_register as $module_path) { |
|
| 1099 | 1099 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
| 1100 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
| 1100 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
| 1101 | 1101 | // add to list of installed modules |
| 1102 | - EE_Config::register_module( $module_path ); |
|
| 1102 | + EE_Config::register_module($module_path); |
|
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | 1105 | } |
| 1106 | 1106 | // filter list of installed modules |
| 1107 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
| 1107 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | |
@@ -1117,54 +1117,54 @@ discard block |
||
| 1117 | 1117 | * @param string $module_path - full path up to and including module folder |
| 1118 | 1118 | * @return bool |
| 1119 | 1119 | */ |
| 1120 | - public static function register_module( $module_path = NULL ) { |
|
| 1121 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
| 1120 | + public static function register_module($module_path = NULL) { |
|
| 1121 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
| 1122 | 1122 | $module_ext = '.module.php'; |
| 1123 | 1123 | // make all separators match |
| 1124 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
| 1124 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
| 1125 | 1125 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1126 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
| 1126 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
| 1127 | 1127 | // grab and shortcode file name from directory name and break apart at dots |
| 1128 | - $module_file = explode( '.', basename( $module_path )); |
|
| 1128 | + $module_file = explode('.', basename($module_path)); |
|
| 1129 | 1129 | // now we need to rebuild the shortcode path |
| 1130 | - $module_path = explode( DS, $module_path ); |
|
| 1130 | + $module_path = explode(DS, $module_path); |
|
| 1131 | 1131 | // remove last segment |
| 1132 | - array_pop( $module_path ); |
|
| 1132 | + array_pop($module_path); |
|
| 1133 | 1133 | // glue it back together |
| 1134 | - $module_path = implode( DS, $module_path ) . DS; |
|
| 1134 | + $module_path = implode(DS, $module_path).DS; |
|
| 1135 | 1135 | // take first segment from file name pieces and sanitize it |
| 1136 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
| 1136 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
| 1137 | 1137 | // ensure class prefix is added |
| 1138 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
| 1138 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
| 1139 | 1139 | } else { |
| 1140 | 1140 | // we need to generate the filename based off of the folder name |
| 1141 | 1141 | // grab and sanitize module name |
| 1142 | - $module = strtolower( basename( $module_path )); |
|
| 1143 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
| 1142 | + $module = strtolower(basename($module_path)); |
|
| 1143 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
| 1144 | 1144 | // like trailingslashit() |
| 1145 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
| 1145 | + $module_path = rtrim($module_path, DS).DS; |
|
| 1146 | 1146 | // create classname from module directory name |
| 1147 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
| 1147 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
| 1148 | 1148 | // add class prefix |
| 1149 | - $module_class = 'EED_' . $module; |
|
| 1149 | + $module_class = 'EED_'.$module; |
|
| 1150 | 1150 | } |
| 1151 | 1151 | // does the module exist ? |
| 1152 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
| 1153 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
| 1154 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1152 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
| 1153 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
| 1154 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1155 | 1155 | return FALSE; |
| 1156 | 1156 | } |
| 1157 | 1157 | // load the module class file |
| 1158 | - require_once( $module_path . $module_class . $module_ext ); |
|
| 1158 | + require_once($module_path.$module_class.$module_ext); |
|
| 1159 | 1159 | // verify that class exists |
| 1160 | - if ( ! class_exists( $module_class )) { |
|
| 1161 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
| 1162 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1160 | + if ( ! class_exists($module_class)) { |
|
| 1161 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
| 1162 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1163 | 1163 | return FALSE; |
| 1164 | 1164 | } |
| 1165 | 1165 | // add to array of registered modules |
| 1166 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
| 1167 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
| 1166 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
| 1167 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
| 1168 | 1168 | return TRUE; |
| 1169 | 1169 | } |
| 1170 | 1170 | |
@@ -1178,23 +1178,23 @@ discard block |
||
| 1178 | 1178 | */ |
| 1179 | 1179 | private function _initialize_shortcodes() { |
| 1180 | 1180 | // cycle thru shortcode folders |
| 1181 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
| 1181 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
| 1182 | 1182 | // add class prefix |
| 1183 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1183 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1184 | 1184 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1185 | 1185 | // which set hooks ? |
| 1186 | - if ( is_admin() ) { |
|
| 1186 | + if (is_admin()) { |
|
| 1187 | 1187 | // fire immediately |
| 1188 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
| 1188 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
| 1189 | 1189 | } else { |
| 1190 | 1190 | // delay until other systems are online |
| 1191 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
| 1191 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
| 1192 | 1192 | // convert classname to UPPERCASE and create WP shortcode. |
| 1193 | - $shortcode_tag = strtoupper( $shortcode ); |
|
| 1193 | + $shortcode_tag = strtoupper($shortcode); |
|
| 1194 | 1194 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
| 1195 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
| 1195 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
| 1196 | 1196 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
| 1197 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
| 1197 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
| 1198 | 1198 | } |
| 1199 | 1199 | } |
| 1200 | 1200 | } |
@@ -1211,15 +1211,15 @@ discard block |
||
| 1211 | 1211 | */ |
| 1212 | 1212 | private function _initialize_modules() { |
| 1213 | 1213 | // cycle thru shortcode folders |
| 1214 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
| 1214 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
| 1215 | 1215 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1216 | 1216 | // which set hooks ? |
| 1217 | - if ( is_admin() ) { |
|
| 1217 | + if (is_admin()) { |
|
| 1218 | 1218 | // fire immediately |
| 1219 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
| 1219 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
| 1220 | 1220 | } else { |
| 1221 | 1221 | // delay until other systems are online |
| 1222 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
| 1222 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
| 1223 | 1223 | } |
| 1224 | 1224 | } |
| 1225 | 1225 | } |
@@ -1237,26 +1237,26 @@ discard block |
||
| 1237 | 1237 | * @param string $key - url param key indicating a route is being called |
| 1238 | 1238 | * @return bool |
| 1239 | 1239 | */ |
| 1240 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
| 1241 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
| 1242 | - $module = str_replace( 'EED_', '', $module ); |
|
| 1243 | - $module_class = 'EED_' . $module; |
|
| 1244 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) { |
|
| 1245 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
| 1246 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1240 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
| 1241 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
| 1242 | + $module = str_replace('EED_', '', $module); |
|
| 1243 | + $module_class = 'EED_'.$module; |
|
| 1244 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
| 1245 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
| 1246 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1247 | 1247 | return FALSE; |
| 1248 | 1248 | } |
| 1249 | - if ( empty( $route )) { |
|
| 1250 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
| 1251 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1249 | + if (empty($route)) { |
|
| 1250 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
| 1251 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1252 | 1252 | return FALSE; |
| 1253 | 1253 | } |
| 1254 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
| 1255 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1256 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1254 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
| 1255 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
| 1256 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1257 | 1257 | return FALSE; |
| 1258 | 1258 | } |
| 1259 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
| 1259 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
| 1260 | 1260 | return TRUE; |
| 1261 | 1261 | } |
| 1262 | 1262 | |
@@ -1270,11 +1270,11 @@ discard block |
||
| 1270 | 1270 | * @param string $key - url param key indicating a route is being called |
| 1271 | 1271 | * @return string |
| 1272 | 1272 | */ |
| 1273 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
| 1274 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
| 1275 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
| 1276 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
| 1277 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
| 1273 | + public static function get_route($route = NULL, $key = 'ee') { |
|
| 1274 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
| 1275 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
| 1276 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
| 1277 | + return EE_Config::$_module_route_map[$key][$route]; |
|
| 1278 | 1278 | } |
| 1279 | 1279 | return NULL; |
| 1280 | 1280 | } |
@@ -1303,35 +1303,35 @@ discard block |
||
| 1303 | 1303 | * @param string $key - url param key indicating a route is being called |
| 1304 | 1304 | * @return bool |
| 1305 | 1305 | */ |
| 1306 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
| 1307 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
| 1308 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1309 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
| 1310 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1306 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
| 1307 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
| 1308 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1309 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
| 1310 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1311 | 1311 | return FALSE; |
| 1312 | 1312 | } |
| 1313 | - if ( empty( $forward )) { |
|
| 1314 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
| 1315 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1313 | + if (empty($forward)) { |
|
| 1314 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
| 1315 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1316 | 1316 | return FALSE; |
| 1317 | 1317 | } |
| 1318 | - if ( is_array( $forward )) { |
|
| 1319 | - if ( ! isset( $forward[1] )) { |
|
| 1320 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1321 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1318 | + if (is_array($forward)) { |
|
| 1319 | + if ( ! isset($forward[1])) { |
|
| 1320 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
| 1321 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1322 | 1322 | return FALSE; |
| 1323 | 1323 | } |
| 1324 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
| 1325 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
| 1326 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1324 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
| 1325 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
| 1326 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1327 | 1327 | return FALSE; |
| 1328 | 1328 | } |
| 1329 | - } else if ( ! function_exists( $forward )) { |
|
| 1330 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
| 1331 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1329 | + } else if ( ! function_exists($forward)) { |
|
| 1330 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
| 1331 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1332 | 1332 | return FALSE; |
| 1333 | 1333 | } |
| 1334 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
| 1334 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
| 1335 | 1335 | return TRUE; |
| 1336 | 1336 | } |
| 1337 | 1337 | |
@@ -1346,10 +1346,10 @@ discard block |
||
| 1346 | 1346 | * @param string $key - url param key indicating a route is being called |
| 1347 | 1347 | * @return string |
| 1348 | 1348 | */ |
| 1349 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1350 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
| 1351 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
| 1352 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1349 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
| 1350 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
| 1351 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
| 1352 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
| 1353 | 1353 | } |
| 1354 | 1354 | return NULL; |
| 1355 | 1355 | } |
@@ -1366,19 +1366,19 @@ discard block |
||
| 1366 | 1366 | * @param string $key - url param key indicating a route is being called |
| 1367 | 1367 | * @return bool |
| 1368 | 1368 | */ |
| 1369 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
| 1370 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
| 1371 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1372 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
| 1373 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1369 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
| 1370 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
| 1371 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1372 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
| 1373 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1374 | 1374 | return FALSE; |
| 1375 | 1375 | } |
| 1376 | - if ( ! is_readable( $view )) { |
|
| 1377 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
| 1378 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1376 | + if ( ! is_readable($view)) { |
|
| 1377 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
| 1378 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1379 | 1379 | return FALSE; |
| 1380 | 1380 | } |
| 1381 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
| 1381 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
| 1382 | 1382 | return TRUE; |
| 1383 | 1383 | } |
| 1384 | 1384 | |
@@ -1395,10 +1395,10 @@ discard block |
||
| 1395 | 1395 | * @param string $key - url param key indicating a route is being called |
| 1396 | 1396 | * @return string |
| 1397 | 1397 | */ |
| 1398 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1399 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
| 1400 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
| 1401 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1398 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
| 1399 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
| 1400 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
| 1401 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
| 1402 | 1402 | } |
| 1403 | 1403 | return NULL; |
| 1404 | 1404 | } |
@@ -1406,7 +1406,7 @@ discard block |
||
| 1406 | 1406 | |
| 1407 | 1407 | |
| 1408 | 1408 | public function shutdown() { |
| 1409 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
| 1409 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | 1412 | |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | * magic functions in use, except we'll allow them to magically set and get stuff... |
| 1423 | 1423 | * basically, they should just be well-defined stdClasses |
| 1424 | 1424 | */ |
| 1425 | -class EE_Config_Base{ |
|
| 1425 | +class EE_Config_Base { |
|
| 1426 | 1426 | |
| 1427 | 1427 | /** |
| 1428 | 1428 | * Utility function for escaping the value of a property and returning. |
@@ -1431,13 +1431,13 @@ discard block |
||
| 1431 | 1431 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
| 1432 | 1432 | * @throws \EE_Error |
| 1433 | 1433 | */ |
| 1434 | - public function get_pretty( $property ) { |
|
| 1435 | - if ( ! property_exists( $this, $property ) ) { |
|
| 1436 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
| 1434 | + public function get_pretty($property) { |
|
| 1435 | + if ( ! property_exists($this, $property)) { |
|
| 1436 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
| 1437 | 1437 | } |
| 1438 | 1438 | //just handling escaping of strings for now. |
| 1439 | - if ( is_string( $this->{$property} ) ) { |
|
| 1440 | - return stripslashes( $this->{$property} ); |
|
| 1439 | + if (is_string($this->{$property} )) { |
|
| 1440 | + return stripslashes($this->{$property} ); |
|
| 1441 | 1441 | } |
| 1442 | 1442 | return $this->{$property}; |
| 1443 | 1443 | } |
@@ -1446,19 +1446,19 @@ discard block |
||
| 1446 | 1446 | |
| 1447 | 1447 | public function populate() { |
| 1448 | 1448 | //grab defaults via a new instance of this class. |
| 1449 | - $class_name = get_class( $this ); |
|
| 1449 | + $class_name = get_class($this); |
|
| 1450 | 1450 | $defaults = new $class_name; |
| 1451 | 1451 | |
| 1452 | 1452 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
| 1453 | 1453 | //default from our $defaults object. |
| 1454 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
| 1455 | - if ( is_null( $this->{$property} ) ) { |
|
| 1454 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
| 1455 | + if (is_null($this->{$property} )) { |
|
| 1456 | 1456 | $this->{$property} = $value; |
| 1457 | 1457 | } |
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | 1460 | //cleanup |
| 1461 | - unset( $defaults ); |
|
| 1461 | + unset($defaults); |
|
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | |
@@ -1550,12 +1550,12 @@ discard block |
||
| 1550 | 1550 | */ |
| 1551 | 1551 | public function __construct() { |
| 1552 | 1552 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
| 1553 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
| 1553 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
| 1554 | 1554 | // set default organization settings |
| 1555 | 1555 | $this->current_blog_id = get_current_blog_id(); |
| 1556 | 1556 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
| 1557 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
| 1558 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
| 1557 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
| 1558 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
| 1559 | 1559 | $this->post_shortcodes = array(); |
| 1560 | 1560 | $this->module_route_map = array(); |
| 1561 | 1561 | $this->module_forward_map = array(); |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | $this->event_cpt_slug = __('events', 'event_espresso'); |
| 1575 | 1575 | |
| 1576 | 1576 | //ueip constant check |
| 1577 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
| 1577 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
| 1578 | 1578 | $this->ee_ueip_optin = FALSE; |
| 1579 | 1579 | $this->ee_ueip_has_notified = TRUE; |
| 1580 | 1580 | } |
@@ -1614,8 +1614,8 @@ discard block |
||
| 1614 | 1614 | * @return string |
| 1615 | 1615 | */ |
| 1616 | 1616 | public function reg_page_url() { |
| 1617 | - if ( ! $this->reg_page_url ) { |
|
| 1618 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
| 1617 | + if ( ! $this->reg_page_url) { |
|
| 1618 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
| 1619 | 1619 | } |
| 1620 | 1620 | return $this->reg_page_url; |
| 1621 | 1621 | } |
@@ -1628,12 +1628,12 @@ discard block |
||
| 1628 | 1628 | * @return string |
| 1629 | 1629 | */ |
| 1630 | 1630 | public function txn_page_url($query_args = array()) { |
| 1631 | - if ( ! $this->txn_page_url ) { |
|
| 1632 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
| 1631 | + if ( ! $this->txn_page_url) { |
|
| 1632 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
| 1633 | 1633 | } |
| 1634 | - if($query_args){ |
|
| 1635 | - return add_query_arg($query_args,$this->txn_page_url); |
|
| 1636 | - }else{ |
|
| 1634 | + if ($query_args) { |
|
| 1635 | + return add_query_arg($query_args, $this->txn_page_url); |
|
| 1636 | + } else { |
|
| 1637 | 1637 | return $this->txn_page_url; |
| 1638 | 1638 | } |
| 1639 | 1639 | } |
@@ -1645,12 +1645,12 @@ discard block |
||
| 1645 | 1645 | * @return string |
| 1646 | 1646 | */ |
| 1647 | 1647 | public function thank_you_page_url($query_args = array()) { |
| 1648 | - if ( ! $this->thank_you_page_url ) { |
|
| 1649 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
| 1648 | + if ( ! $this->thank_you_page_url) { |
|
| 1649 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
| 1650 | 1650 | } |
| 1651 | - if($query_args){ |
|
| 1652 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
| 1653 | - }else{ |
|
| 1651 | + if ($query_args) { |
|
| 1652 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
| 1653 | + } else { |
|
| 1654 | 1654 | return $this->thank_you_page_url; |
| 1655 | 1655 | } |
| 1656 | 1656 | } |
@@ -1661,8 +1661,8 @@ discard block |
||
| 1661 | 1661 | * @return string |
| 1662 | 1662 | */ |
| 1663 | 1663 | public function cancel_page_url() { |
| 1664 | - if ( ! $this->cancel_page_url ) { |
|
| 1665 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
| 1664 | + if ( ! $this->cancel_page_url) { |
|
| 1665 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
| 1666 | 1666 | } |
| 1667 | 1667 | return $this->cancel_page_url; |
| 1668 | 1668 | } |
@@ -1690,7 +1690,7 @@ discard block |
||
| 1690 | 1690 | //reset all url properties |
| 1691 | 1691 | $this->_reset_urls(); |
| 1692 | 1692 | //return what to save to db |
| 1693 | - return array_keys( get_object_vars( $this ) ); |
|
| 1693 | + return array_keys(get_object_vars($this)); |
|
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | 1696 | } |
@@ -1922,39 +1922,39 @@ discard block |
||
| 1922 | 1922 | * @param null $CNT_ISO |
| 1923 | 1923 | * @return \EE_Currency_Config |
| 1924 | 1924 | */ |
| 1925 | - public function __construct( $CNT_ISO = NULL ) { |
|
| 1925 | + public function __construct($CNT_ISO = NULL) { |
|
| 1926 | 1926 | |
| 1927 | 1927 | // get country code from organization settings or use default |
| 1928 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1928 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1929 | 1929 | // but override if requested |
| 1930 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
| 1931 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
| 1930 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
| 1931 | + EE_Registry::instance()->load_helper('Activation'); |
|
| 1932 | 1932 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
| 1933 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
| 1933 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
| 1934 | 1934 | // retrieve the country settings from the db, just in case they have been customized |
| 1935 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
| 1936 | - if ( $country instanceof EE_Country ) { |
|
| 1937 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1938 | - $this->name = $country->currency_name_single(); // Dollar |
|
| 1939 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1940 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1941 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1942 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1943 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1944 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1935 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
| 1936 | + if ($country instanceof EE_Country) { |
|
| 1937 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1938 | + $this->name = $country->currency_name_single(); // Dollar |
|
| 1939 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1940 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1941 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1942 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1943 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1944 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1945 | 1945 | } |
| 1946 | 1946 | } |
| 1947 | 1947 | // fallback to hardcoded defaults, in case the above failed |
| 1948 | - if ( empty( $this->code )) { |
|
| 1948 | + if (empty($this->code)) { |
|
| 1949 | 1949 | // set default currency settings |
| 1950 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1951 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
| 1952 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
| 1953 | - $this->sign = '$'; // currency sign: $ |
|
| 1954 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1955 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1956 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1957 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1950 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1951 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
| 1952 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
| 1953 | + $this->sign = '$'; // currency sign: $ |
|
| 1954 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1955 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1956 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1957 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1958 | 1958 | } |
| 1959 | 1959 | } |
| 1960 | 1960 | } |
@@ -2094,7 +2094,7 @@ discard block |
||
| 2094 | 2094 | * @since 4.8.8.rc.019 |
| 2095 | 2095 | */ |
| 2096 | 2096 | public function do_hooks() { |
| 2097 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
| 2097 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
| 2098 | 2098 | } |
| 2099 | 2099 | |
| 2100 | 2100 | |
@@ -2102,7 +2102,7 @@ discard block |
||
| 2102 | 2102 | * @return void |
| 2103 | 2103 | */ |
| 2104 | 2104 | public function set_default_reg_status_on_EEM_Event() { |
| 2105 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
| 2105 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
| 2106 | 2106 | } |
| 2107 | 2107 | |
| 2108 | 2108 | |
@@ -2207,10 +2207,10 @@ discard block |
||
| 2207 | 2207 | * @param bool $reset |
| 2208 | 2208 | * @return string |
| 2209 | 2209 | */ |
| 2210 | - public function log_file_name( $reset = FALSE ) { |
|
| 2211 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
| 2212 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2213 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2210 | + public function log_file_name($reset = FALSE) { |
|
| 2211 | + if (empty($this->log_file_name) || $reset) { |
|
| 2212 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2213 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2214 | 2214 | } |
| 2215 | 2215 | return $this->log_file_name; |
| 2216 | 2216 | } |
@@ -2222,10 +2222,10 @@ discard block |
||
| 2222 | 2222 | * @param bool $reset |
| 2223 | 2223 | * @return string |
| 2224 | 2224 | */ |
| 2225 | - public function debug_file_name( $reset = FALSE ) { |
|
| 2226 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
| 2227 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2228 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2225 | + public function debug_file_name($reset = FALSE) { |
|
| 2226 | + if (empty($this->debug_file_name) || $reset) { |
|
| 2227 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2228 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2229 | 2229 | } |
| 2230 | 2230 | return $this->debug_file_name; |
| 2231 | 2231 | } |
@@ -2398,21 +2398,21 @@ discard block |
||
| 2398 | 2398 | // set default map settings |
| 2399 | 2399 | $this->use_google_maps = TRUE; |
| 2400 | 2400 | // for event details pages (reg page) |
| 2401 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2402 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2403 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2404 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2405 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2406 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2407 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2401 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2402 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2403 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2404 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2405 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2406 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2407 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2408 | 2408 | // for event list pages |
| 2409 | - $this->event_list_map_width = 300; // ee_map_width |
|
| 2410 | - $this->event_list_map_height = 185; // ee_map_height |
|
| 2411 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2412 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2413 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2414 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2415 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2409 | + $this->event_list_map_width = 300; // ee_map_width |
|
| 2410 | + $this->event_list_map_height = 185; // ee_map_height |
|
| 2411 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2412 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2413 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2414 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2415 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2416 | 2416 | } |
| 2417 | 2417 | |
| 2418 | 2418 | } |
@@ -2423,7 +2423,7 @@ discard block |
||
| 2423 | 2423 | /** |
| 2424 | 2424 | * stores Events_Archive settings |
| 2425 | 2425 | */ |
| 2426 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
| 2426 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
| 2427 | 2427 | |
| 2428 | 2428 | public $display_status_banner; |
| 2429 | 2429 | public $display_description; |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | /** |
| 2443 | 2443 | * class constructor |
| 2444 | 2444 | */ |
| 2445 | - public function __construct(){ |
|
| 2445 | + public function __construct() { |
|
| 2446 | 2446 | $this->display_status_banner = 0; |
| 2447 | 2447 | $this->display_description = 1; |
| 2448 | 2448 | $this->display_ticket_selector = 0; |
@@ -2462,7 +2462,7 @@ discard block |
||
| 2462 | 2462 | /** |
| 2463 | 2463 | * Stores Event_Single_Config settings |
| 2464 | 2464 | */ |
| 2465 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
| 2465 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
| 2466 | 2466 | |
| 2467 | 2467 | public $display_status_banner_single; |
| 2468 | 2468 | public $display_venue; |
@@ -2491,7 +2491,7 @@ discard block |
||
| 2491 | 2491 | /** |
| 2492 | 2492 | * Stores Ticket_Selector_Config settings |
| 2493 | 2493 | */ |
| 2494 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
| 2494 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
| 2495 | 2495 | public $show_ticket_sale_columns; |
| 2496 | 2496 | public $show_ticket_details; |
| 2497 | 2497 | public $show_expired_tickets; |
@@ -2545,7 +2545,7 @@ discard block |
||
| 2545 | 2545 | * @return void |
| 2546 | 2546 | */ |
| 2547 | 2547 | protected function _set_php_values() { |
| 2548 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
| 2548 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
| 2549 | 2549 | $this->php->version = phpversion(); |
| 2550 | 2550 | } |
| 2551 | 2551 | |
@@ -2564,8 +2564,8 @@ discard block |
||
| 2564 | 2564 | * @type string $msg Any message to be displayed. |
| 2565 | 2565 | * } |
| 2566 | 2566 | */ |
| 2567 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
| 2568 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
| 2567 | + public function max_input_vars_limit_check($input_count = 0) { |
|
| 2568 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
| 2569 | 2569 | return __('The number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso'); |
| 2570 | 2570 | } else { |
| 2571 | 2571 | return ''; |
@@ -2601,7 +2601,7 @@ discard block |
||
| 2601 | 2601 | * stores payment gateway info |
| 2602 | 2602 | * @deprecated |
| 2603 | 2603 | */ |
| 2604 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
| 2604 | +class EE_Gateway_Config extends EE_Config_Base { |
|
| 2605 | 2605 | |
| 2606 | 2606 | /** |
| 2607 | 2607 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2623,9 +2623,9 @@ discard block |
||
| 2623 | 2623 | * class constructor |
| 2624 | 2624 | * @deprecated |
| 2625 | 2625 | */ |
| 2626 | - public function __construct(){ |
|
| 2626 | + public function __construct() { |
|
| 2627 | 2627 | $this->payment_settings = array(); |
| 2628 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
| 2628 | + $this->active_gateways = array('Invoice' => FALSE); |
|
| 2629 | 2629 | } |
| 2630 | 2630 | } |
| 2631 | 2631 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function instance() { |
| 80 | 80 | // check if class object is instantiated |
| 81 | - if ( ! self::$_instance instanceof EE_CPT_Strategy ) { |
|
| 81 | + if ( ! self::$_instance instanceof EE_CPT_Strategy) { |
|
| 82 | 82 | self::$_instance = new self(); |
| 83 | 83 | } |
| 84 | 84 | return self::$_instance; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // d( $this->_CPT_endpoints ); |
| 102 | 102 | // d( $this->_CPT_taxonomies ); |
| 103 | 103 | |
| 104 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 ); |
|
| 104 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 5); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | private function _set_CPT_endpoints() { |
| 116 | 116 | $_CPT_endpoints = array(); |
| 117 | - if ( is_array( $this->_CPTs )) { |
|
| 118 | - foreach ( $this->_CPTs as $CPT_type => $CPT ) { |
|
| 119 | - $_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type; |
|
| 117 | + if (is_array($this->_CPTs)) { |
|
| 118 | + foreach ($this->_CPTs as $CPT_type => $CPT) { |
|
| 119 | + $_CPT_endpoints [$CPT['plural_slug']] = $CPT_type; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | return $_CPT_endpoints; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param WP_Query $WP_Query |
| 132 | 132 | * @return void |
| 133 | 133 | */ |
| 134 | - private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) { |
|
| 134 | + private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) { |
|
| 135 | 135 | $WP_Query->is_espresso_event_single = FALSE; |
| 136 | 136 | $WP_Query->is_espresso_event_archive = FALSE; |
| 137 | 137 | $WP_Query->is_espresso_event_taxonomy = FALSE; |
@@ -158,16 +158,16 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | private function _set_CPT_taxonomies() { |
| 160 | 160 | // check if taxonomies have already been set |
| 161 | - if ( empty( $this->_CPT_taxonomies )) { |
|
| 161 | + if (empty($this->_CPT_taxonomies)) { |
|
| 162 | 162 | // and that this CPT has taxonomies registered for it |
| 163 | - if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) { |
|
| 163 | + if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) { |
|
| 164 | 164 | // if so then grab them, but we want the taxonomy name as the key |
| 165 | - $taxonomies = array_flip( $this->CPT['args']['taxonomies'] ); |
|
| 165 | + $taxonomies = array_flip($this->CPT['args']['taxonomies']); |
|
| 166 | 166 | // then grab the list of ALL taxonomies |
| 167 | 167 | $all_taxonomies = EE_Register_CPTs::get_taxonomies(); |
| 168 | - foreach ( $taxonomies as $taxonomy => $details ) { |
|
| 168 | + foreach ($taxonomies as $taxonomy => $details) { |
|
| 169 | 169 | // add details to our taxonomies if they exist |
| 170 | - $taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL; |
|
| 170 | + $taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL; |
|
| 171 | 171 | } |
| 172 | 172 | $this->_CPT_taxonomies = $taxonomies; |
| 173 | 173 | } |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | * @return void |
| 193 | 193 | */ |
| 194 | 194 | private function _set_CPT_terms() { |
| 195 | - if ( empty( $this->_CPT_terms )) { |
|
| 195 | + if (empty($this->_CPT_terms)) { |
|
| 196 | 196 | $terms = EEM_Term::instance()->get_all_CPT_post_tags(); |
| 197 | - foreach ( $terms as $term ) { |
|
| 198 | - if ( $term instanceof EE_Term ) { |
|
| 199 | - $this->_CPT_terms[ $term->slug() ] = $term; |
|
| 197 | + foreach ($terms as $term) { |
|
| 198 | + if ($term instanceof EE_Term) { |
|
| 199 | + $this->_CPT_terms[$term->slug()] = $term; |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -211,24 +211,24 @@ discard block |
||
| 211 | 211 | * @param $WP_Query |
| 212 | 212 | * @return void |
| 213 | 213 | */ |
| 214 | - private function _set_post_type_for_terms( WP_Query $WP_Query ) { |
|
| 214 | + private function _set_post_type_for_terms(WP_Query $WP_Query) { |
|
| 215 | 215 | // is a tag set ? |
| 216 | - if ( isset( $WP_Query->query['tag'] )) { |
|
| 216 | + if (isset($WP_Query->query['tag'])) { |
|
| 217 | 217 | // set post_tags |
| 218 | 218 | $this->_set_CPT_terms(); |
| 219 | 219 | // is this tag archive term in the list of terms used by our CPTs ? |
| 220 | - $term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL; |
|
| 220 | + $term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL; |
|
| 221 | 221 | // verify the term |
| 222 | - if ( $term instanceof EE_Term ) { |
|
| 223 | - $term->post_type = array_merge( array( 'post', 'page' ), (array)$term->post_type ); |
|
| 224 | - $term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term ); |
|
| 222 | + if ($term instanceof EE_Term) { |
|
| 223 | + $term->post_type = array_merge(array('post', 'page'), (array) $term->post_type); |
|
| 224 | + $term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term); |
|
| 225 | 225 | // if a post type is already set |
| 226 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
| 226 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
| 227 | 227 | // add to existing array |
| 228 | - $term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type ); |
|
| 228 | + $term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type); |
|
| 229 | 229 | } |
| 230 | 230 | // just set post_type to our CPT |
| 231 | - $WP_Query->set( 'post_type', $term->post_type ); |
|
| 231 | + $WP_Query->set('post_type', $term->post_type); |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | * in order for is_archive() and is_single() methods to work properly. |
| 244 | 244 | * @return void |
| 245 | 245 | */ |
| 246 | - public function _possibly_set_ee_request_var(){ |
|
| 246 | + public function _possibly_set_ee_request_var() { |
|
| 247 | 247 | // check if ee action var has been set |
| 248 | - if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) { |
|
| 248 | + if ( ! EE_Registry::instance()->REQ->is_set('ee')) { |
|
| 249 | 249 | // check that route exists for CPT archive slug |
| 250 | - if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) { |
|
| 250 | + if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) { |
|
| 251 | 251 | // ie: set "ee" to "events" |
| 252 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] ); |
|
| 252 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']); |
|
| 253 | 253 | // or does it match a single page CPT like /event/ |
| 254 | - } else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) { |
|
| 254 | + } else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) { |
|
| 255 | 255 | // ie: set "ee" to "event" |
| 256 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
| 256 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | * @param WP_Query $WP_Query |
| 268 | 268 | * @return void |
| 269 | 269 | */ |
| 270 | - public function _set_paging( $WP_Query ) { |
|
| 271 | - if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) { |
|
| 272 | - $page = ( get_query_var('page') ) ? get_query_var('page') : NULL; |
|
| 273 | - $paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page; |
|
| 274 | - $WP_Query->set( 'paged', $paged ); |
|
| 270 | + public function _set_paging($WP_Query) { |
|
| 271 | + if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) { |
|
| 272 | + $page = (get_query_var('page')) ? get_query_var('page') : NULL; |
|
| 273 | + $paged = (get_query_var('paged')) ? get_query_var('paged') : $page; |
|
| 274 | + $WP_Query->set('paged', $paged); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
@@ -288,35 +288,35 @@ discard block |
||
| 288 | 288 | * @param WP_Query $WP_Query |
| 289 | 289 | * @return void |
| 290 | 290 | */ |
| 291 | - public function pre_get_posts( $WP_Query ) { |
|
| 291 | + public function pre_get_posts($WP_Query) { |
|
| 292 | 292 | // check that post-type is set |
| 293 | - if ( ! $WP_Query instanceof WP_Query ) { |
|
| 293 | + if ( ! $WP_Query instanceof WP_Query) { |
|
| 294 | 294 | return; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // add our conditionals |
| 298 | - $this->_set_EE_tags_on_WP_Query( $WP_Query ); |
|
| 298 | + $this->_set_EE_tags_on_WP_Query($WP_Query); |
|
| 299 | 299 | // check for terms |
| 300 | - $this->_set_post_type_for_terms( $WP_Query ); |
|
| 300 | + $this->_set_post_type_for_terms($WP_Query); |
|
| 301 | 301 | // make sure paging is always set |
| 302 | - $this->_set_paging( $WP_Query ); |
|
| 302 | + $this->_set_paging($WP_Query); |
|
| 303 | 303 | |
| 304 | 304 | // is a taxonomy set ? |
| 305 | - if ( $WP_Query->is_tax ) { |
|
| 305 | + if ($WP_Query->is_tax) { |
|
| 306 | 306 | // loop thru our taxonomies |
| 307 | - foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) { |
|
| 307 | + foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) { |
|
| 308 | 308 | // check if one of our taxonomies is set as a query var |
| 309 | - if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) { |
|
| 309 | + if (isset($WP_Query->query[$CPT_taxonomy])) { |
|
| 310 | 310 | // but which CPT does that correspond to??? hmmm... guess we gotta go looping |
| 311 | - foreach ( $this->_CPTs as $post_type => $CPT ) { |
|
| 311 | + foreach ($this->_CPTs as $post_type => $CPT) { |
|
| 312 | 312 | // verify our CPT has args, is public and has taxonomies set |
| 313 | - if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) { |
|
| 313 | + if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) { |
|
| 314 | 314 | // does the captured taxonomy belong to this CPT ? |
| 315 | - if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) { |
|
| 315 | + if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) { |
|
| 316 | 316 | // if so, then add this CPT post_type to the current query's array of post_types' |
| 317 | - $WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array(); |
|
| 317 | + $WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array(); |
|
| 318 | 318 | $WP_Query->query_vars['post_type'][] = $post_type; |
| 319 | - switch( $post_type ) { |
|
| 319 | + switch ($post_type) { |
|
| 320 | 320 | case 'espresso_events' : |
| 321 | 321 | $WP_Query->is_espresso_event_taxonomy = TRUE; |
| 322 | 322 | break; |
@@ -337,27 +337,27 @@ discard block |
||
| 337 | 337 | // d( $CPT_taxonomy ); |
| 338 | 338 | // d( $WP_Query ); |
| 339 | 339 | |
| 340 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
| 340 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
| 341 | 341 | // loop thru post_types as array |
| 342 | - foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) { |
|
| 342 | + foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) { |
|
| 343 | 343 | |
| 344 | 344 | // is current query for an EE CPT ? |
| 345 | - if ( isset( $this->_CPTs[ $post_type ] )) { |
|
| 345 | + if (isset($this->_CPTs[$post_type])) { |
|
| 346 | 346 | // is EE on or off ? |
| 347 | - if ( EE_Maintenance_Mode::instance()->level() ) { |
|
| 347 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
| 348 | 348 | // reroute CPT template view to maintenance_mode.template.php |
| 349 | - if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){ |
|
| 350 | - add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 ); |
|
| 349 | + if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) { |
|
| 350 | + add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999); |
|
| 351 | 351 | } |
| 352 | - if( has_filter( 'the_content',array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) { |
|
| 353 | - add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 ); |
|
| 352 | + if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) { |
|
| 353 | + add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1); |
|
| 354 | 354 | } |
| 355 | 355 | return; |
| 356 | 356 | } |
| 357 | 357 | // load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037 |
| 358 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
| 358 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
| 359 | 359 | // grab details for the CPT the current query is for |
| 360 | - $this->CPT = $this->_CPTs[ $post_type ]; |
|
| 360 | + $this->CPT = $this->_CPTs[$post_type]; |
|
| 361 | 361 | // set post type |
| 362 | 362 | $this->CPT['post_type'] = $post_type; |
| 363 | 363 | // set taxonomies |
@@ -365,27 +365,27 @@ discard block |
||
| 365 | 365 | // the post or category or term that is triggering EE |
| 366 | 366 | $this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page(); |
| 367 | 367 | // requested post name |
| 368 | - $this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' ); |
|
| 368 | + $this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name'); |
|
| 369 | 369 | //d( $this->CPT ); |
| 370 | 370 | // add support for viewing 'private', 'draft', or 'pending' posts |
| 371 | - if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) { |
|
| 371 | + if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) { |
|
| 372 | 372 | // we can just inject directly into the WP_Query object |
| 373 | - $WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
| 373 | + $WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
| 374 | 374 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
| 375 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
| 375 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
| 376 | 376 | } |
| 377 | 377 | $this->_possibly_set_ee_request_var(); |
| 378 | 378 | // convert post_type to model name |
| 379 | - $model_name = str_replace( 'EE_', '', $this->CPT['class_name'] ); |
|
| 379 | + $model_name = str_replace('EE_', '', $this->CPT['class_name']); |
|
| 380 | 380 | // get CPT table data via CPT Model |
| 381 | - $this->CPT_model = EE_Registry::instance()->load_model( $model_name ); |
|
| 381 | + $this->CPT_model = EE_Registry::instance()->load_model($model_name); |
|
| 382 | 382 | $this->CPT['tables'] = $this->CPT_model->get_tables(); |
| 383 | 383 | // is there a Meta Table for this CPT? |
| 384 | - $this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE; |
|
| 384 | + $this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE; |
|
| 385 | 385 | // creates classname like: CPT_Event_Strategy |
| 386 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
| 386 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
| 387 | 387 | // load and instantiate |
| 388 | - $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT )); |
|
| 388 | + $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT)); |
|
| 389 | 389 | |
| 390 | 390 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
| 391 | 391 | // here's the list of available filters in the WP_Query object |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | // 'post_limits' |
| 398 | 398 | // 'posts_fields' |
| 399 | 399 | // 'posts_join' |
| 400 | - add_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
| 401 | - add_filter( 'posts_join', array( $this, 'posts_join' )); |
|
| 402 | - add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 ); |
|
| 403 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
| 404 | - add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 ); |
|
| 400 | + add_filter('posts_fields', array($this, 'posts_fields')); |
|
| 401 | + add_filter('posts_join', array($this, 'posts_join')); |
|
| 402 | + add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4); |
|
| 403 | + add_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
| 404 | + add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2); |
|
| 405 | 405 | |
| 406 | - $this->_do_template_filters( $WP_Query ); |
|
| 406 | + $this->_do_template_filters($WP_Query); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -418,13 +418,13 @@ discard block |
||
| 418 | 418 | * @param $SQL |
| 419 | 419 | * @return string |
| 420 | 420 | */ |
| 421 | - public function posts_fields( $SQL ) { |
|
| 421 | + public function posts_fields($SQL) { |
|
| 422 | 422 | // does this CPT have a meta table ? |
| 423 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
| 423 | + if ( ! empty($this->CPT['meta_table'])) { |
|
| 424 | 424 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
| 425 | - $SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ; |
|
| 425 | + $SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* '; |
|
| 426 | 426 | } |
| 427 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
| 427 | + remove_filter('posts_fields', array($this, 'posts_fields')); |
|
| 428 | 428 | return $SQL; |
| 429 | 429 | } |
| 430 | 430 | |
@@ -452,14 +452,14 @@ discard block |
||
| 452 | 452 | * @param $SQL |
| 453 | 453 | * @return string |
| 454 | 454 | */ |
| 455 | - public function posts_join( $SQL ) { |
|
| 455 | + public function posts_join($SQL) { |
|
| 456 | 456 | // does this CPT have a meta table ? |
| 457 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
| 457 | + if ( ! empty($this->CPT['meta_table'])) { |
|
| 458 | 458 | global $wpdb; |
| 459 | 459 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
| 460 | - $SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) '; |
|
| 460 | + $SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) '; |
|
| 461 | 461 | } |
| 462 | - remove_filter( 'posts_join', array( $this, 'posts_join' )); |
|
| 462 | + remove_filter('posts_join', array($this, 'posts_join')); |
|
| 463 | 463 | return $SQL; |
| 464 | 464 | } |
| 465 | 465 | |
@@ -472,18 +472,18 @@ discard block |
||
| 472 | 472 | * @param \WP_Post[] $posts |
| 473 | 473 | * @return \WP_Post[] |
| 474 | 474 | */ |
| 475 | - public function the_posts( $posts ) { |
|
| 475 | + public function the_posts($posts) { |
|
| 476 | 476 | // d( $posts ); |
| 477 | 477 | $CPT_class = $this->CPT['class_name']; |
| 478 | 478 | // loop thru posts |
| 479 | - if ( is_array( $posts )) { |
|
| 480 | - foreach( $posts as $key => $post ) { |
|
| 481 | - if ( isset( $this->_CPTs[ $post->post_type ] )) { |
|
| 482 | - $post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object( $post ); |
|
| 479 | + if (is_array($posts)) { |
|
| 480 | + foreach ($posts as $key => $post) { |
|
| 481 | + if (isset($this->_CPTs[$post->post_type])) { |
|
| 482 | + $post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object($post); |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 ); |
|
| 486 | + remove_filter('the_posts', array($this, 'the_posts'), 1); |
|
| 487 | 487 | return $posts; |
| 488 | 488 | } |
| 489 | 489 | |
@@ -494,17 +494,17 @@ discard block |
||
| 494 | 494 | * @param $ID |
| 495 | 495 | * @return string |
| 496 | 496 | */ |
| 497 | - function get_edit_post_link( $url, $ID ) { |
|
| 497 | + function get_edit_post_link($url, $ID) { |
|
| 498 | 498 | //need to make sure we only edit links if our cpt |
| 499 | 499 | global $post; |
| 500 | - if ( ! isset( $this->_CPTs[ $post->post_type ] )) { |
|
| 500 | + if ( ! isset($this->_CPTs[$post->post_type])) { |
|
| 501 | 501 | return $url; |
| 502 | 502 | } |
| 503 | 503 | //k made it here so all is good. |
| 504 | 504 | $scheme = is_ssl() ? 'https' : 'http'; |
| 505 | - $url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme ); |
|
| 505 | + $url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme); |
|
| 506 | 506 | // http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6 |
| 507 | - return wp_nonce_url( add_query_arg( array( 'page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' ); |
|
| 507 | + return wp_nonce_url(add_query_arg(array('page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce'); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | |
@@ -518,11 +518,11 @@ discard block |
||
| 518 | 518 | * @param WP_Query $WP_Query |
| 519 | 519 | * @return void |
| 520 | 520 | */ |
| 521 | - protected function _do_template_filters( WP_Query $WP_Query ) { |
|
| 521 | + protected function _do_template_filters(WP_Query $WP_Query) { |
|
| 522 | 522 | // if it's the main query and requested cpt supports page_templates, |
| 523 | - if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) { |
|
| 523 | + if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) { |
|
| 524 | 524 | // then let's hook into the appropriate query_template hook |
| 525 | - add_filter( 'single_template', array( $this, 'single_cpt_template' ) ); |
|
| 525 | + add_filter('single_template', array($this, 'single_cpt_template')); |
|
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | |
@@ -536,17 +536,17 @@ discard block |
||
| 536 | 536 | * @param string $current_template Existing default template path derived for this page call. |
| 537 | 537 | * @return string the path to the full template file. |
| 538 | 538 | */ |
| 539 | - public function single_cpt_template( $current_template ) { |
|
| 539 | + public function single_cpt_template($current_template) { |
|
| 540 | 540 | $object = get_queried_object(); |
| 541 | 541 | //does this called object HAVE a page template set that is something other than the default. |
| 542 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
| 542 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
| 543 | 543 | |
| 544 | 544 | //exit early if default or not set or invalid path (accounts for theme changes) |
| 545 | - if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) { |
|
| 545 | + if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) { |
|
| 546 | 546 | return $current_template; |
| 547 | 547 | } |
| 548 | 548 | //made it here so we SHOULD be able to just locate the template and then return it. |
| 549 | - $template = locate_template( array($template) ); |
|
| 549 | + $template = locate_template(array($template)); |
|
| 550 | 550 | |
| 551 | 551 | return $template; |
| 552 | 552 | } |
@@ -594,9 +594,9 @@ discard block |
||
| 594 | 594 | * @param array $arguments |
| 595 | 595 | * @return \EE_CPT_Default_Strategy |
| 596 | 596 | */ |
| 597 | - public function __construct( $arguments = array() ) { |
|
| 598 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
| 599 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
| 597 | + public function __construct($arguments = array()) { |
|
| 598 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
| 599 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
| 600 | 600 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 601 | 601 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
| 602 | 602 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
@@ -611,9 +611,9 @@ discard block |
||
| 611 | 611 | * @param \WP_Query $WP_Query |
| 612 | 612 | * @return \WP_Query |
| 613 | 613 | */ |
| 614 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
| 614 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
| 615 | 615 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 616 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
| 616 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
| 617 | 617 | return $WP_Query; |
| 618 | 618 | } |
| 619 | 619 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | * @param \WP_Query $WP_Query |
| 632 | 632 | * @return \WP_Post[] |
| 633 | 633 | */ |
| 634 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
| 634 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
| 635 | 635 | return $posts; |
| 636 | 636 | } |
| 637 | 637 | |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | * @param string $single |
| 648 | 648 | * @return mixed |
| 649 | 649 | */ |
| 650 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
| 650 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
| 651 | 651 | return $meta_value; |
| 652 | 652 | } |
| 653 | 653 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param WP $WP |
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | - public abstract function run( WP $WP ); |
|
| 45 | + public abstract function run(WP $WP); |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param array $attributes |
| 55 | 55 | * @return mixed |
| 56 | 56 | */ |
| 57 | - public abstract function process_shortcode( $attributes = array() ); |
|
| 57 | + public abstract function process_shortcode($attributes = array()); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | * @param string $shortcode_class |
| 66 | 66 | * @return \EES_Shortcode |
| 67 | 67 | */ |
| 68 | - final public static function instance( $shortcode_class = NULL ) { |
|
| 69 | - $shortcode_class = ! empty( $shortcode_class ) ? $shortcode_class : get_called_class(); |
|
| 70 | - if ( $shortcode_class == 'EES_Shortcode' || empty( $shortcode_class )) { |
|
| 68 | + final public static function instance($shortcode_class = NULL) { |
|
| 69 | + $shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class(); |
|
| 70 | + if ($shortcode_class == 'EES_Shortcode' || empty($shortcode_class)) { |
|
| 71 | 71 | return NULL; |
| 72 | 72 | } |
| 73 | - $shortcode = str_replace( 'EES_', '', strtoupper( $shortcode_class )); |
|
| 74 | - $shortcode_obj = isset( EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
| 73 | + $shortcode = str_replace('EES_', '', strtoupper($shortcode_class)); |
|
| 74 | + $shortcode_obj = isset(EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL; |
|
| 75 | 75 | return $shortcode_obj instanceof $shortcode_class || $shortcode_class == 'self' ? $shortcode_obj : new $shortcode_class(); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -86,23 +86,23 @@ discard block |
||
| 86 | 86 | * @param $attributes |
| 87 | 87 | * @return mixed |
| 88 | 88 | */ |
| 89 | - final public static function fallback_shortcode_processor( $attributes ) { |
|
| 90 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
| 89 | + final public static function fallback_shortcode_processor($attributes) { |
|
| 90 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
| 91 | 91 | return null; |
| 92 | 92 | } |
| 93 | 93 | // what shortcode was actually parsed ? |
| 94 | 94 | $shortcode_class = get_called_class(); |
| 95 | 95 | // notify rest of system that fallback processor was triggered |
| 96 | - add_filter( 'FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true' ); |
|
| 96 | + add_filter('FHEE__fallback_shortcode_processor__'.$shortcode_class, '__return_true'); |
|
| 97 | 97 | // get instance of actual shortcode |
| 98 | - $shortcode_obj = self::instance( $shortcode_class ); |
|
| 98 | + $shortcode_obj = self::instance($shortcode_class); |
|
| 99 | 99 | // verify class |
| 100 | - if ( $shortcode_obj instanceof EES_Shortcode ) { |
|
| 100 | + if ($shortcode_obj instanceof EES_Shortcode) { |
|
| 101 | 101 | global $wp; |
| 102 | - $shortcode_obj->run( $wp ); |
|
| 102 | + $shortcode_obj->run($wp); |
|
| 103 | 103 | // set attributes and run the shortcode |
| 104 | - $shortcode_obj->_attributes = (array)$attributes; |
|
| 105 | - return $shortcode_obj->process_shortcode( $shortcode_obj->_attributes ); |
|
| 104 | + $shortcode_obj->_attributes = (array) $attributes; |
|
| 105 | + return $shortcode_obj->process_shortcode($shortcode_obj->_attributes); |
|
| 106 | 106 | } else { |
| 107 | 107 | return NULL; |
| 108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param $attributes |
| 119 | 119 | * @return string |
| 120 | 120 | */ |
| 121 | - final public static function invalid_shortcode_processor( $attributes ) { |
|
| 121 | + final public static function invalid_shortcode_processor($attributes) { |
|
| 122 | 122 | return ''; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | final public function __construct() { |
| 134 | 134 | // get classname, remove EES_prefix, and convert to UPPERCASE |
| 135 | - $shortcode = strtoupper( str_replace( 'EES_', '', get_class( $this ))); |
|
| 135 | + $shortcode = strtoupper(str_replace('EES_', '', get_class($this))); |
|
| 136 | 136 | // assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier |
| 137 | - add_shortcode( $shortcode, array( $this, 'process_shortcode' )); |
|
| 137 | + add_shortcode($shortcode, array($this, 'process_shortcode')); |
|
| 138 | 138 | // make sure system knows this is an EE page |
| 139 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
| 139 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
| 18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * espresso_get_template_part |
| 21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | * @param string $name The name of the specialised template. |
| 26 | 26 | * @return string the html output for the formatted money value |
| 27 | 27 | */ |
| 28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
| 29 | - EEH_Template::get_template_part( $slug, $name ); |
|
| 28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
| 29 | + EEH_Template::get_template_part($slug, $name); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
| 35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
| 36 | 36 | /** |
| 37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
| 38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $suffix added to the end of the generated class |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
| 45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return boolean |
| 71 | 71 | */ |
| 72 | 72 | public static function is_espresso_theme() { |
| 73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
| 73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | 81 | public static function load_espresso_theme_functions() { |
| 82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
| 83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
| 84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
| 82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
| 83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
| 84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | * @return array |
| 94 | 94 | */ |
| 95 | 95 | public static function get_espresso_themes() { |
| 96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
| 97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
| 98 | - if ( empty( $espresso_themes ) ) { |
|
| 96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
| 97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
| 98 | + if (empty($espresso_themes)) { |
|
| 99 | 99 | return array(); |
| 100 | 100 | } |
| 101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
| 102 | - unset( $espresso_themes[ $key ] ); |
|
| 101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
| 102 | + unset($espresso_themes[$key]); |
|
| 103 | 103 | } |
| 104 | 104 | EEH_Template::$_espresso_themes = array(); |
| 105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
| 106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
| 105 | + foreach ($espresso_themes as $espresso_theme) { |
|
| 106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | * @param bool $return_string |
| 123 | 123 | * @return string the html output for the formatted money value |
| 124 | 124 | */ |
| 125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
| 126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
| 125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
| 126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
| 127 | 127 | $templates = array(); |
| 128 | 128 | $name = (string) $name; |
| 129 | - if ( $name != '' ) { |
|
| 129 | + if ($name != '') { |
|
| 130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
| 131 | 131 | } |
| 132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
| 133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
| 134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
| 133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
| 134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
| 182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
| 183 | 183 | * @return mixed |
| 184 | 184 | */ |
| 185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
| 185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
| 186 | 186 | // first use WP locate_template to check for template in the current theme folder |
| 187 | - $template_path = locate_template( $templates ); |
|
| 187 | + $template_path = locate_template($templates); |
|
| 188 | 188 | |
| 189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
| 189 | + if ($check_if_custom && ! empty($template_path)) |
|
| 190 | 190 | return TRUE; |
| 191 | 191 | |
| 192 | 192 | // not in the theme |
| 193 | - if ( empty( $template_path )) { |
|
| 193 | + if (empty($template_path)) { |
|
| 194 | 194 | // not even a template to look for ? |
| 195 | - if ( empty( $templates )) { |
|
| 195 | + if (empty($templates)) { |
|
| 196 | 196 | // get post_type |
| 197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
| 197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
| 198 | 198 | // get array of EE Custom Post Types |
| 199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
| 200 | 200 | // build template name based on request |
| 201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
| 202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
| 201 | + if (isset($EE_CPTs[$post_type])) { |
|
| 202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | // currently active EE template theme |
@@ -210,80 +210,80 @@ discard block |
||
| 210 | 210 | // array of paths to folders that may contain templates |
| 211 | 211 | $template_folder_paths = array( |
| 212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
| 213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
| 213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
| 214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
| 215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
| 219 | - if ( ! $check_if_custom ) { |
|
| 219 | + if ( ! $check_if_custom) { |
|
| 220 | 220 | $core_paths = array( |
| 221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
| 222 | - EE_PUBLIC . $current_theme, |
|
| 222 | + EE_PUBLIC.$current_theme, |
|
| 223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
| 224 | - EE_TEMPLATES . $current_theme, |
|
| 224 | + EE_TEMPLATES.$current_theme, |
|
| 225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
| 226 | 226 | EE_PLUGIN_DIR_PATH |
| 227 | 227 | ); |
| 228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
| 228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // now filter that array |
| 232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
| 233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
| 234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
| 232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
| 233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
| 234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
| 235 | 235 | // array to hold all possible template paths |
| 236 | 236 | $full_template_paths = array(); |
| 237 | 237 | |
| 238 | 238 | EE_Registry::instance()->load_helper('File'); |
| 239 | 239 | // loop through $templates |
| 240 | - foreach ( $templates as $template ) { |
|
| 240 | + foreach ($templates as $template) { |
|
| 241 | 241 | // normalize directory separators |
| 242 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
| 243 | - $file_name = basename( $template ); |
|
| 244 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
| 242 | + $template = EEH_File::standardise_directory_separators($template); |
|
| 243 | + $file_name = basename($template); |
|
| 244 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
| 245 | 245 | // while looping through all template folder paths |
| 246 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
| 246 | + foreach ($template_folder_paths as $template_folder_path) { |
|
| 247 | 247 | // normalize directory separators |
| 248 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
| 248 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
| 249 | 249 | // determine if any common base path exists between the two paths |
| 250 | 250 | $common_base_path = EEH_Template::_find_common_base_path( |
| 251 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
| 251 | + array($template_folder_path, $template_path_minus_file_name) |
|
| 252 | 252 | ); |
| 253 | - if ( $common_base_path !== '' ) { |
|
| 253 | + if ($common_base_path !== '') { |
|
| 254 | 254 | // both paths have a common base, so just tack the filename onto our search path |
| 255 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
| 255 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
| 256 | 256 | } else { |
| 257 | 257 | // no common base path, so let's just concatenate |
| 258 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
| 258 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
| 259 | 259 | } |
| 260 | 260 | // build up our template locations array by adding our resolved paths |
| 261 | 261 | $full_template_paths[] = $resolved_path; |
| 262 | 262 | } |
| 263 | 263 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
| 264 | - array_unshift( $full_template_paths, $template ); |
|
| 264 | + array_unshift($full_template_paths, $template); |
|
| 265 | 265 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
| 266 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
| 266 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
| 267 | 267 | } |
| 268 | 268 | // filter final array of full template paths |
| 269 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
| 269 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
| 270 | 270 | // now loop through our final array of template location paths and check each location |
| 271 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
| 272 | - if ( is_readable( $full_template_path )) { |
|
| 273 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
| 271 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
| 272 | + if (is_readable($full_template_path)) { |
|
| 273 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
| 274 | 274 | break; |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | // if we got it and you want to see it... |
| 279 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
| 280 | - if ( $return_string ) { |
|
| 281 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
| 279 | + if ($template_path && $load && ! $check_if_custom) { |
|
| 280 | + if ($return_string) { |
|
| 281 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
| 282 | 282 | } else { |
| 283 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
| 283 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
| 286 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | |
@@ -296,21 +296,21 @@ discard block |
||
| 296 | 296 | * @param array $paths |
| 297 | 297 | * @return string |
| 298 | 298 | */ |
| 299 | - protected static function _find_common_base_path( $paths ) { |
|
| 299 | + protected static function _find_common_base_path($paths) { |
|
| 300 | 300 | $last_offset = 0; |
| 301 | 301 | $common_base_path = ''; |
| 302 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
| 302 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
| 303 | 303 | $dir_length = $index - $last_offset + 1; |
| 304 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
| 305 | - foreach ( $paths as $path ) { |
|
| 306 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
| 304 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
| 305 | + foreach ($paths as $path) { |
|
| 306 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
| 307 | 307 | return $common_base_path; |
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | $common_base_path .= $directory; |
| 311 | 311 | $last_offset = $index + 1; |
| 312 | 312 | } |
| 313 | - return substr( $common_base_path, 0, -1 ); |
|
| 313 | + return substr($common_base_path, 0, -1); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
| 323 | 323 | * @return mixed string |
| 324 | 324 | */ |
| 325 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
| 325 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
| 326 | 326 | //require the template validator for verifying variables are set according to how the template requires |
| 327 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
| 327 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | 330 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -335,26 +335,26 @@ discard block |
||
| 335 | 335 | * |
| 336 | 336 | * @since 4.6.0 |
| 337 | 337 | */ |
| 338 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
| 339 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
| 338 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
| 339 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
| 340 | 340 | |
| 341 | 341 | // you gimme nuttin - YOU GET NUTTIN !! |
| 342 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
| 342 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
| 343 | 343 | return ''; |
| 344 | 344 | } |
| 345 | 345 | // if $template_args are not in an array, then make it so |
| 346 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
| 347 | - $template_args = array( $template_args ); |
|
| 346 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
| 347 | + $template_args = array($template_args); |
|
| 348 | 348 | } |
| 349 | - extract( (array) $template_args); |
|
| 349 | + extract((array) $template_args); |
|
| 350 | 350 | |
| 351 | - if ( $return_string ) { |
|
| 351 | + if ($return_string) { |
|
| 352 | 352 | // because we want to return a string, we are going to capture the output |
| 353 | 353 | ob_start(); |
| 354 | - include( $template_path ); |
|
| 354 | + include($template_path); |
|
| 355 | 355 | return ob_get_clean(); |
| 356 | 356 | } else { |
| 357 | - include( $template_path ); |
|
| 357 | + include($template_path); |
|
| 358 | 358 | } |
| 359 | 359 | return ''; |
| 360 | 360 | } |
@@ -372,27 +372,27 @@ discard block |
||
| 372 | 372 | * @param string $suffix added to the end of the generated class |
| 373 | 373 | * @return string |
| 374 | 374 | */ |
| 375 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 375 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 376 | 376 | // in the beginning... |
| 377 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
| 377 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
| 378 | 378 | // da muddle |
| 379 | 379 | $class = ''; |
| 380 | 380 | // the end |
| 381 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
| 381 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
| 382 | 382 | // is the passed object an EE object ? |
| 383 | - if ( $object instanceof EE_Base_Class ) { |
|
| 383 | + if ($object instanceof EE_Base_Class) { |
|
| 384 | 384 | // grab the exact type of object |
| 385 | - $obj_class = get_class( $object ); |
|
| 385 | + $obj_class = get_class($object); |
|
| 386 | 386 | // depending on the type of object... |
| 387 | - switch ( $obj_class ) { |
|
| 387 | + switch ($obj_class) { |
|
| 388 | 388 | // no specifics just yet... |
| 389 | 389 | default : |
| 390 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
| 391 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
| 390 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
| 391 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
| 392 | 392 | |
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | - return $prefix . $class . $suffix; |
|
| 395 | + return $prefix.$class.$suffix; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | |
@@ -408,50 +408,50 @@ discard block |
||
| 408 | 408 | * @param string $cur_code_span_class |
| 409 | 409 | * @return string the html output for the formatted money value |
| 410 | 410 | */ |
| 411 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
| 411 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
| 412 | 412 | // ensure amount was received |
| 413 | - if ( is_null( $amount ) ) { |
|
| 414 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
| 415 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 413 | + if (is_null($amount)) { |
|
| 414 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
| 415 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 416 | 416 | return ''; |
| 417 | 417 | } |
| 418 | 418 | //ensure amount is float |
| 419 | 419 | $amount = (float) $amount; |
| 420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
| 421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
| 421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
| 422 | 422 | // still a number or was amount converted to a string like "free" ? |
| 423 | - if ( is_float( $amount_formatted )) { |
|
| 423 | + if (is_float($amount_formatted)) { |
|
| 424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
| 425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
| 425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
| 426 | 426 | // verify results |
| 427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
| 427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
| 428 | 428 | // set default config country currency settings |
| 429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
| 430 | 430 | } |
| 431 | 431 | // format float |
| 432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
| 432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
| 433 | 433 | // add formatting ? |
| 434 | - if ( ! $return_raw ) { |
|
| 434 | + if ( ! $return_raw) { |
|
| 435 | 435 | // add currency sign |
| 436 | - if( $mny->sign_b4 ){ |
|
| 437 | - if( $amount >= 0 ){ |
|
| 438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
| 439 | - }else{ |
|
| 440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
| 436 | + if ($mny->sign_b4) { |
|
| 437 | + if ($amount >= 0) { |
|
| 438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
| 439 | + } else { |
|
| 440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - }else{ |
|
| 444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
| 443 | + } else { |
|
| 444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | // add currency code ? |
| 448 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
| 448 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
| 449 | 449 | } |
| 450 | 450 | // filter results |
| 451 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
| 451 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
| 452 | 452 | } |
| 453 | 453 | // clean up vars |
| 454 | - unset( $mny ); |
|
| 454 | + unset($mny); |
|
| 455 | 455 | // return formatted currency amount |
| 456 | 456 | return $amount_formatted; |
| 457 | 457 | } |
@@ -466,11 +466,11 @@ discard block |
||
| 466 | 466 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
| 467 | 467 | * @return string The localized label for the status id. |
| 468 | 468 | */ |
| 469 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
| 469 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
| 470 | 470 | /** @type EEM_Status $EEM_Status */ |
| 471 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
| 472 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
| 473 | - return $status[ $status_id ]; |
|
| 471 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
| 472 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
| 473 | + return $status[$status_id]; |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | * @param string $icon |
| 484 | 484 | * @return string the html output for the button |
| 485 | 485 | */ |
| 486 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
| 487 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
| 488 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
| 486 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
| 487 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
| 488 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
| 489 | 489 | return $button; |
| 490 | 490 | } |
| 491 | 491 | |
@@ -502,21 +502,21 @@ discard block |
||
| 502 | 502 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
| 503 | 503 | * @return string generated link |
| 504 | 504 | */ |
| 505 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
| 505 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
| 506 | 506 | |
| 507 | - if ( ! $page ) |
|
| 508 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
| 507 | + if ( ! $page) |
|
| 508 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
| 509 | 509 | |
| 510 | - if ( ! $action ) |
|
| 511 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
| 510 | + if ( ! $action) |
|
| 511 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
| 512 | 512 | |
| 513 | 513 | $action = empty($action) ? 'default' : $action; |
| 514 | 514 | |
| 515 | 515 | |
| 516 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
| 517 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 518 | - $help_text = !$help_text ? '' : $help_text; |
|
| 519 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
| 516 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
| 517 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 518 | + $help_text = ! $help_text ? '' : $help_text; |
|
| 519 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
@@ -528,31 +528,31 @@ discard block |
||
| 528 | 528 | * @param EE_Help_Tour |
| 529 | 529 | * @return string html |
| 530 | 530 | */ |
| 531 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
| 531 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
| 532 | 532 | $id = $tour->get_slug(); |
| 533 | 533 | $stops = $tour->get_stops(); |
| 534 | 534 | |
| 535 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
| 535 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
| 536 | 536 | |
| 537 | - foreach ( $stops as $stop ) { |
|
| 538 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
| 539 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
| 537 | + foreach ($stops as $stop) { |
|
| 538 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
| 539 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
| 540 | 540 | |
| 541 | 541 | //if container is set to modal then let's make sure we set the options accordingly |
| 542 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
| 542 | + if (empty($data_id) && empty($data_class)) { |
|
| 543 | 543 | $stop['options']['modal'] = true; |
| 544 | 544 | $stop['options']['expose'] = true; |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
| 548 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
| 547 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
| 548 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
| 549 | 549 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
| 550 | 550 | |
| 551 | 551 | //options |
| 552 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
| 552 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
| 553 | 553 | $options = ' data-options="'; |
| 554 | - foreach ( $stop['options'] as $option => $value ) { |
|
| 555 | - $options .= $option . ':' . $value . ';'; |
|
| 554 | + foreach ($stop['options'] as $option => $value) { |
|
| 555 | + $options .= $option.':'.$value.';'; |
|
| 556 | 556 | } |
| 557 | 557 | $options .= '"'; |
| 558 | 558 | } else { |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | //let's put all together |
| 563 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
| 563 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $content .= '</ol>'; |
@@ -581,31 +581,31 @@ discard block |
||
| 581 | 581 | * @throws EE_Error |
| 582 | 582 | * @return string html structure for status. |
| 583 | 583 | */ |
| 584 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
| 585 | - if ( !is_array( $status_array ) ) |
|
| 586 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
| 584 | + public static function status_legend($status_array, $active_status = '') { |
|
| 585 | + if ( ! is_array($status_array)) |
|
| 586 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
| 587 | 587 | |
| 588 | 588 | $setup_array = array(); |
| 589 | - foreach ( $status_array as $item => $status ) { |
|
| 589 | + foreach ($status_array as $item => $status) { |
|
| 590 | 590 | $setup_array[$item] = array( |
| 591 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
| 592 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
| 591 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
| 592 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
| 593 | 593 | 'status' => $status |
| 594 | 594 | ); |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
| 598 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
| 599 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
| 600 | - foreach ( $setup_array as $item => $details ) { |
|
| 597 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
| 598 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
| 599 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
| 600 | + foreach ($setup_array as $item => $details) { |
|
| 601 | 601 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
| 602 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
| 603 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
| 604 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
| 605 | - $content .= '</dt>' . "\n"; |
|
| 602 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
| 603 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
| 604 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
| 605 | + $content .= '</dt>'."\n"; |
|
| 606 | 606 | } |
| 607 | - $content .= '</dl>' . "\n"; |
|
| 608 | - $content .= '</div>' . "\n"; |
|
| 607 | + $content .= '</dl>'."\n"; |
|
| 608 | + $content .= '</div>'."\n"; |
|
| 609 | 609 | return $content; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -618,8 +618,8 @@ discard block |
||
| 618 | 618 | * @return string |
| 619 | 619 | */ |
| 620 | 620 | public static function layout_array_as_table($data) { |
| 621 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
| 622 | - $data = (array)$data; |
|
| 621 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
| 622 | + $data = (array) $data; |
|
| 623 | 623 | } |
| 624 | 624 | EE_Registry::instance()->load_helper('Array'); |
| 625 | 625 | ob_start(); |
@@ -633,10 +633,10 @@ discard block |
||
| 633 | 633 | ?> |
| 634 | 634 | <tr> |
| 635 | 635 | <td> |
| 636 | - <?php echo $data_key;?> |
|
| 636 | + <?php echo $data_key; ?> |
|
| 637 | 637 | </td> |
| 638 | 638 | <td> |
| 639 | - <?php echo self::layout_array_as_table($data_values);?> |
|
| 639 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
| 640 | 640 | </td> |
| 641 | 641 | </tr> |
| 642 | 642 | <?php |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | <ul> |
| 651 | 651 | <?php |
| 652 | 652 | foreach ($data as $datum) { |
| 653 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
| 653 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
| 654 | 654 | }?> |
| 655 | 655 | </ul> |
| 656 | 656 | <?php |
@@ -680,8 +680,8 @@ discard block |
||
| 680 | 680 | * |
| 681 | 681 | * @return string |
| 682 | 682 | */ |
| 683 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 684 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
| 683 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 684 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | |
@@ -705,13 +705,13 @@ discard block |
||
| 705 | 705 | * ) |
| 706 | 706 | * @return string |
| 707 | 707 | */ |
| 708 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 708 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 709 | 709 | $page_links = array(); |
| 710 | 710 | $disable_first = $disable_last = ''; |
| 711 | 711 | $total_items = (int) $total_items; |
| 712 | 712 | $per_page = (int) $per_page; |
| 713 | 713 | $current = (int) $current; |
| 714 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
| 714 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
| 715 | 715 | |
| 716 | 716 | //filter items_label |
| 717 | 717 | $items_label = apply_filters( |
@@ -719,68 +719,68 @@ discard block |
||
| 719 | 719 | $items_label |
| 720 | 720 | ); |
| 721 | 721 | |
| 722 | - if ( empty( $items_label ) |
|
| 723 | - || ! is_array( $items_label ) |
|
| 724 | - || ! isset( $items_label['single'] ) |
|
| 725 | - || ! isset( $items_label['plural'] ) ) { |
|
| 722 | + if (empty($items_label) |
|
| 723 | + || ! is_array($items_label) |
|
| 724 | + || ! isset($items_label['single']) |
|
| 725 | + || ! isset($items_label['plural'])) { |
|
| 726 | 726 | $items_label = array( |
| 727 | - 'single' => __( '1 item', 'event_espresso' ), |
|
| 728 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
| 727 | + 'single' => __('1 item', 'event_espresso'), |
|
| 728 | + 'plural' => __('%s items', 'event_espresso') |
|
| 729 | 729 | ); |
| 730 | 730 | } else { |
| 731 | 731 | $items_label = array( |
| 732 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
| 733 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
| 732 | + 'single' => '1 '.esc_html($items_label['single']), |
|
| 733 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
| 734 | 734 | ); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - $total_pages = ceil( $total_items / $per_page ); |
|
| 737 | + $total_pages = ceil($total_items / $per_page); |
|
| 738 | 738 | |
| 739 | - if ( $total_pages <= 1 ) |
|
| 739 | + if ($total_pages <= 1) |
|
| 740 | 740 | return ''; |
| 741 | 741 | |
| 742 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
| 742 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
| 743 | 743 | |
| 744 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
| 744 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
| 745 | 745 | |
| 746 | - if ( $current === 1 ) { |
|
| 746 | + if ($current === 1) { |
|
| 747 | 747 | $disable_first = ' disabled'; |
| 748 | 748 | } |
| 749 | - if ( $current == $total_pages ) { |
|
| 749 | + if ($current == $total_pages) { |
|
| 750 | 750 | $disable_last = ' disabled'; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 754 | - 'first-page' . $disable_first, |
|
| 755 | - esc_attr__( 'Go to the first page' ), |
|
| 756 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
| 753 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 754 | + 'first-page'.$disable_first, |
|
| 755 | + esc_attr__('Go to the first page'), |
|
| 756 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
| 757 | 757 | '«' |
| 758 | 758 | ); |
| 759 | 759 | |
| 760 | 760 | $page_links[] = sprintf( |
| 761 | 761 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 762 | - 'prev-page' . $disable_first, |
|
| 763 | - esc_attr__( 'Go to the previous page' ), |
|
| 764 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
| 762 | + 'prev-page'.$disable_first, |
|
| 763 | + esc_attr__('Go to the previous page'), |
|
| 764 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
| 765 | 765 | '‹' |
| 766 | 766 | ); |
| 767 | 767 | |
| 768 | - if ( ! $show_num_field ) { |
|
| 768 | + if ( ! $show_num_field) { |
|
| 769 | 769 | $html_current_page = $current; |
| 770 | 770 | } else { |
| 771 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 772 | - esc_attr__( 'Current page' ), |
|
| 771 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 772 | + esc_attr__('Current page'), |
|
| 773 | 773 | $current, |
| 774 | - strlen( $total_pages ) |
|
| 774 | + strlen($total_pages) |
|
| 775 | 775 | ); |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | $html_total_pages = sprintf( |
| 779 | 779 | '<span class="total-pages">%s</span>', |
| 780 | - number_format_i18n( $total_pages ) |
|
| 780 | + number_format_i18n($total_pages) |
|
| 781 | 781 | ); |
| 782 | 782 | $page_links[] = sprintf( |
| 783 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
| 783 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
| 784 | 784 | $html_current_page, |
| 785 | 785 | $html_total_pages, |
| 786 | 786 | '<span class="paging-input">', |
@@ -789,29 +789,29 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | $page_links[] = sprintf( |
| 791 | 791 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 792 | - 'next-page' . $disable_last, |
|
| 793 | - esc_attr__( 'Go to the next page' ), |
|
| 794 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
| 792 | + 'next-page'.$disable_last, |
|
| 793 | + esc_attr__('Go to the next page'), |
|
| 794 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
| 795 | 795 | '›' |
| 796 | 796 | ); |
| 797 | 797 | |
| 798 | 798 | $page_links[] = sprintf( |
| 799 | 799 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 800 | - 'last-page' . $disable_last, |
|
| 801 | - esc_attr__( 'Go to the last page' ), |
|
| 802 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
| 800 | + 'last-page'.$disable_last, |
|
| 801 | + esc_attr__('Go to the last page'), |
|
| 802 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
| 803 | 803 | '»' |
| 804 | 804 | ); |
| 805 | 805 | |
| 806 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
| 806 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
| 807 | 807 | // set page class |
| 808 | - if ( $total_pages ) { |
|
| 808 | + if ($total_pages) { |
|
| 809 | 809 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
| 810 | 810 | } else { |
| 811 | 811 | $page_class = ' no-pages'; |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
| 814 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
| 828 | 828 | |
| 829 | 829 | |
| 830 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
| 830 | +if ( ! function_exists('espresso_pagination')) { |
|
| 831 | 831 | /** |
| 832 | 832 | * espresso_pagination |
| 833 | 833 | * |
@@ -839,21 +839,21 @@ discard block |
||
| 839 | 839 | $big = 999999999; // need an unlikely integer |
| 840 | 840 | $pagination = paginate_links( |
| 841 | 841 | array( |
| 842 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
| 842 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
| 843 | 843 | 'format' => '?paged=%#%', |
| 844 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
| 844 | + 'current' => max(1, get_query_var('paged')), |
|
| 845 | 845 | 'total' => $wp_query->max_num_pages, |
| 846 | 846 | 'show_all' => true, |
| 847 | 847 | 'end_size' => 10, |
| 848 | 848 | 'mid_size' => 6, |
| 849 | 849 | 'prev_next' => true, |
| 850 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
| 851 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
| 850 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
| 851 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
| 852 | 852 | 'type' => 'plain', |
| 853 | 853 | 'add_args' => false, |
| 854 | 854 | 'add_fragment' => '' |
| 855 | 855 | ) |
| 856 | 856 | ); |
| 857 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
| 857 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
| 858 | 858 | } |
| 859 | 859 | } |
| 860 | 860 | \ No newline at end of file |