@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | 4 | /** |
5 | 5 | * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file. |
6 | 6 | */ |
7 | 7 | // defined some new constants related to caffeinated folder |
8 | -define( 'EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
9 | -define( 'EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS ); |
|
10 | -define( 'EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS ); |
|
11 | -define( 'EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
8 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
9 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
10 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
11 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * EE_Brewing_Regular class. Just a wrapper to help namespace activity for the functionality of this file. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * EE_Brewing_Regular constructor. |
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | - if ( defined( 'EE_CAFF_PATH' )) { |
|
26 | + if (defined('EE_CAFF_PATH')) { |
|
27 | 27 | // activation |
28 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' )); |
|
28 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
29 | 29 | // load caff init |
30 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' )); |
|
30 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
31 | 31 | // make it so the PDF receipt doesn't show our shameless plug |
32 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' ); |
|
32 | + add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); |
|
33 | 33 | // add caffeinated modules |
34 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' )); |
|
34 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); |
|
35 | 35 | // load caff scripts |
36 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 ); |
|
36 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
37 | 37 | |
38 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
38 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
39 | 39 | |
40 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) ); |
|
40 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); |
|
41 | 41 | // caffeinated constructed |
42 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
42 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * @param array $paths original helper paths array |
50 | 50 | * @return array new array of paths |
51 | 51 | */ |
52 | - public function caf_helper_paths( $paths ) { |
|
53 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
52 | + public function caf_helper_paths($paths) { |
|
53 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
54 | 54 | return $paths; |
55 | 55 | } |
56 | 56 | |
@@ -66,22 +66,22 @@ discard block |
||
66 | 66 | * Right now, we ASSUME the only price types in the system are default ones |
67 | 67 | * @global wpdb $wpdb |
68 | 68 | */ |
69 | - function initialize_caf_db_content(){ |
|
69 | + function initialize_caf_db_content() { |
|
70 | 70 | // echo "initialize caf db content!"; |
71 | 71 | global $wpdb; |
72 | 72 | |
73 | 73 | //use same method of getting creator id as the version introducing the change |
74 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
74 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
75 | 75 | |
76 | 76 | $price_type_table = $wpdb->prefix."esp_price_type"; |
77 | 77 | $price_table = $wpdb->prefix."esp_price"; |
78 | 78 | |
79 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
79 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
80 | 80 | |
81 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
82 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
81 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
82 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
83 | 83 | |
84 | - if ( $tax_price_type_count <= 1) { |
|
84 | + if ($tax_price_type_count <= 1) { |
|
85 | 85 | $wpdb->insert($price_type_table, |
86 | 86 | array( |
87 | 87 | 'PRT_name'=> __("Regional Tax", "event_espresso"), |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | 'PRT_wp_user' => $default_creator_id |
93 | 93 | ), |
94 | 94 | array( |
95 | - '%s',//PRT_name |
|
96 | - '%d',//PBT_id |
|
97 | - '%d',//PRT_is_percent |
|
98 | - '%d',//PRT_order |
|
99 | - '%d',//PRT_deleted |
|
95 | + '%s', //PRT_name |
|
96 | + '%d', //PBT_id |
|
97 | + '%d', //PRT_is_percent |
|
98 | + '%d', //PRT_order |
|
99 | + '%d', //PRT_deleted |
|
100 | 100 | '%d', //PRT_wp_user |
101 | 101 | ) |
102 | 102 | ); |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | 'PRT_wp_user' => $default_creator_id, |
112 | 112 | ), |
113 | 113 | array( |
114 | - '%s',//PRT_name |
|
115 | - '%d',//PBT_id |
|
116 | - '%d',//PRT_is_percent |
|
117 | - '%d',//PRT_order |
|
118 | - '%d',//PRT_deleted |
|
114 | + '%s', //PRT_name |
|
115 | + '%d', //PBT_id |
|
116 | + '%d', //PRT_is_percent |
|
117 | + '%d', //PRT_order |
|
118 | + '%d', //PRT_deleted |
|
119 | 119 | '%d' //PRT_wp_user |
120 | 120 | ) |
121 | 121 | ); |
122 | - if( $result ){ |
|
122 | + if ($result) { |
|
123 | 123 | $wpdb->insert($price_table, |
124 | 124 | array( |
125 | 125 | 'PRT_ID'=>$wpdb->insert_id, |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | 'PRC_wp_user' => $default_creator_id |
135 | 135 | ), |
136 | 136 | array( |
137 | - '%d',//PRT_id |
|
138 | - '%f',//PRC_amount |
|
139 | - '%s',//PRC_name |
|
140 | - '%s',//PRC_desc |
|
141 | - '%d',//PRC_is_default |
|
142 | - '%d',//PRC_overrides |
|
143 | - '%d',//PRC_deleted |
|
144 | - '%d',//PRC_order |
|
145 | - '%d',//PRC_parent |
|
137 | + '%d', //PRT_id |
|
138 | + '%f', //PRC_amount |
|
139 | + '%s', //PRC_name |
|
140 | + '%s', //PRC_desc |
|
141 | + '%d', //PRC_is_default |
|
142 | + '%d', //PRC_overrides |
|
143 | + '%d', //PRC_deleted |
|
144 | + '%d', //PRC_order |
|
145 | + '%d', //PRC_parent |
|
146 | 146 | '%d' //PRC_wp_user |
147 | 147 | ) |
148 | 148 | ); |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | * @param array $modules_to_register |
160 | 160 | * @return array |
161 | 161 | */ |
162 | - public function caffeinated_modules_to_register( $modules_to_register = array() ){ |
|
163 | - if ( is_readable( EE_CAFF_PATH . 'modules' )) { |
|
164 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
165 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { |
|
166 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
162 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
163 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
164 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
165 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
166 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | return $modules_to_register; |
@@ -171,19 +171,19 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | |
174 | - public function caffeinated_init(){ |
|
174 | + public function caffeinated_init() { |
|
175 | 175 | // EE_Register_CPTs hooks |
176 | - add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
177 | - add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
178 | - add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
179 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE ); |
|
176 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
177 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
178 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
179 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE); |
|
180 | 180 | // caffeinated_init__complete hook |
181 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
181 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | - public function enqueue_caffeinated_scripts(){ |
|
186 | + public function enqueue_caffeinated_scripts() { |
|
187 | 187 | // sound of crickets... |
188 | 188 | } |
189 | 189 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @return array |
197 | 197 | */ |
198 | 198 | |
199 | - public function filter_taxonomies( $taxonomy_array ) { |
|
199 | + public function filter_taxonomies($taxonomy_array) { |
|
200 | 200 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE; |
201 | 201 | return $taxonomy_array; |
202 | 202 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param $cpt_array |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - public function filter_cpts( $cpt_array ) { |
|
210 | + public function filter_cpts($cpt_array) { |
|
211 | 211 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE; |
212 | 212 | return $cpt_array; |
213 | 213 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | * @param $menu_items |
219 | 219 | * @return array |
220 | 220 | */ |
221 | - public function nav_metabox_items( $menu_items ) { |
|
221 | + public function nav_metabox_items($menu_items) { |
|
222 | 222 | $menu_items[] = array( |
223 | 223 | 'title' => __('Venue List', 'event_espresso'), |
224 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
224 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
225 | 225 | 'description' => __('Archive page for all venues.', 'event_espresso') |
226 | 226 | ); |
227 | 227 | return $menu_items; |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | * @param array $payment_method_paths |
233 | 233 | * @return array values are folder paths to payment method folders |
234 | 234 | */ |
235 | - public function caf_payment_methods( $payment_method_paths ) { |
|
236 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
237 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
235 | + public function caf_payment_methods($payment_method_paths) { |
|
236 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
237 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
238 | 238 | return $payment_method_paths; |
239 | 239 | } |
240 | 240 | } |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | +} |
|
4 | 6 | /** |
5 | 7 | * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file. |
6 | 8 | */ |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\ResettableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * EE_System |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * @param \EE_Registry $Registry |
91 | 91 | * @return \EE_System |
92 | 92 | */ |
93 | - public static function instance( EE_Registry $Registry = null ) { |
|
93 | + public static function instance(EE_Registry $Registry = null) { |
|
94 | 94 | // check if class object is instantiated |
95 | - if ( ! self::$_instance instanceof EE_System ) { |
|
96 | - self::$_instance = new self( $Registry ); |
|
95 | + if ( ! self::$_instance instanceof EE_System) { |
|
96 | + self::$_instance = new self($Registry); |
|
97 | 97 | } |
98 | 98 | return self::$_instance; |
99 | 99 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * resets the instance and returns it |
104 | 104 | * @return EE_System |
105 | 105 | */ |
106 | - public static function reset(){ |
|
106 | + public static function reset() { |
|
107 | 107 | self::$_instance->_req_type = NULL; |
108 | 108 | |
109 | 109 | //make sure none of the old hooks are left hanging around |
110 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
110 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
111 | 111 | |
112 | 112 | //we need to reset the migration manager in order for it to detect DMSs properly |
113 | 113 | EE_Data_Migration_Manager::reset(); |
@@ -127,28 +127,28 @@ discard block |
||
127 | 127 | * @access private |
128 | 128 | * @param \EE_Registry $Registry |
129 | 129 | */ |
130 | - private function __construct( EE_Registry $Registry ) { |
|
130 | + private function __construct(EE_Registry $Registry) { |
|
131 | 131 | $this->registry = $Registry; |
132 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
132 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
133 | 133 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
134 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
134 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
135 | 135 | // when an ee addon is activated, we want to call the core hook(s) again |
136 | 136 | // because the newly-activated addon didn't get a chance to run at all |
137 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
137 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
138 | 138 | // detect whether install or upgrade |
139 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
139 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
140 | 140 | // load EE_Config, EE_Textdomain, etc |
141 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
141 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
142 | 142 | // load EE_Config, EE_Textdomain, etc |
143 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
143 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
144 | 144 | // you wanna get going? I wanna get going... let's get going! |
145 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
145 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
146 | 146 | //other housekeeping |
147 | 147 | //exclude EE critical pages from wp_list_pages |
148 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
148 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
149 | 149 | // ALL EE Addons should use the following hook point to attach their initial setup too |
150 | 150 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
151 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
151 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -168,30 +168,30 @@ discard block |
||
168 | 168 | public function load_espresso_addons() { |
169 | 169 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
170 | 170 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
171 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
171 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
172 | 172 | //load and setup EE_Capabilities |
173 | - $this->registry->load_core( 'Capabilities' ); |
|
173 | + $this->registry->load_core('Capabilities'); |
|
174 | 174 | //caps need to be initialized on every request so that capability maps are set. |
175 | 175 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
176 | 176 | $this->registry->CAP->init_caps(); |
177 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
177 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
178 | 178 | //if the WP API basic auth plugin isn't already loaded, load it now. |
179 | 179 | //We want it for mobile apps. Just include the entire plugin |
180 | 180 | //also, don't load the basic auth when a plugin is getting activated, because |
181 | 181 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
182 | 182 | //and causes a fatal error |
183 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
184 | - && ! function_exists( 'json_basic_auth_error' ) |
|
183 | + if ( ! function_exists('json_basic_auth_handler') |
|
184 | + && ! function_exists('json_basic_auth_error') |
|
185 | 185 | && ! ( |
186 | - isset( $_GET[ 'action'] ) |
|
187 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
186 | + isset($_GET['action']) |
|
187 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
188 | 188 | ) |
189 | 189 | && ! ( |
190 | - isset( $_GET['activate' ] ) |
|
191 | - && $_GET['activate' ] === 'true' |
|
190 | + isset($_GET['activate']) |
|
191 | + && $_GET['activate'] === 'true' |
|
192 | 192 | ) |
193 | 193 | ) { |
194 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
194 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | * @access public |
208 | 208 | * @return void |
209 | 209 | */ |
210 | - public function detect_activations_or_upgrades(){ |
|
210 | + public function detect_activations_or_upgrades() { |
|
211 | 211 | //first off: let's make sure to handle core |
212 | 212 | $this->detect_if_activation_or_upgrade(); |
213 | - foreach($this->registry->addons as $addon){ |
|
213 | + foreach ($this->registry->addons as $addon) { |
|
214 | 214 | //detect teh request type for that addon |
215 | 215 | $addon->detect_activation_or_upgrade(); |
216 | 216 | } |
@@ -231,41 +231,41 @@ discard block |
||
231 | 231 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
232 | 232 | |
233 | 233 | // load M-Mode class |
234 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
234 | + $this->registry->load_core('Maintenance_Mode'); |
|
235 | 235 | // check if db has been updated, or if its a brand-new installation |
236 | 236 | |
237 | 237 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
238 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
238 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
239 | 239 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
240 | 240 | |
241 | - switch($request_type){ |
|
241 | + switch ($request_type) { |
|
242 | 242 | case EE_System::req_type_new_activation: |
243 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
244 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
243 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
244 | + $this->_handle_core_version_change($espresso_db_update); |
|
245 | 245 | break; |
246 | 246 | case EE_System::req_type_reactivation: |
247 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
248 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
247 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
248 | + $this->_handle_core_version_change($espresso_db_update); |
|
249 | 249 | break; |
250 | 250 | case EE_System::req_type_upgrade: |
251 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
251 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
252 | 252 | //migrations may be required now that we've upgraded |
253 | 253 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
254 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
254 | + $this->_handle_core_version_change($espresso_db_update); |
|
255 | 255 | // echo "done upgrade";die; |
256 | 256 | break; |
257 | 257 | case EE_System::req_type_downgrade: |
258 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
258 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
259 | 259 | //its possible migrations are no longer required |
260 | 260 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
261 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
261 | + $this->_handle_core_version_change($espresso_db_update); |
|
262 | 262 | break; |
263 | 263 | case EE_System::req_type_normal: |
264 | 264 | default: |
265 | 265 | // $this->_maybe_redirect_to_ee_about(); |
266 | 266 | break; |
267 | 267 | } |
268 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
268 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * initializing the database later during the request |
274 | 274 | * @param array $espresso_db_update |
275 | 275 | */ |
276 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
277 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
276 | + protected function _handle_core_version_change($espresso_db_update) { |
|
277 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
278 | 278 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
279 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
279 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -291,44 +291,44 @@ discard block |
||
291 | 291 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
292 | 292 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
293 | 293 | */ |
294 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
295 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
296 | - if( ! $espresso_db_update){ |
|
297 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
294 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
295 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
296 | + if ( ! $espresso_db_update) { |
|
297 | + $espresso_db_update = get_option('espresso_db_update'); |
|
298 | 298 | } |
299 | 299 | // check that option is an array |
300 | - if( ! is_array( $espresso_db_update )) { |
|
300 | + if ( ! is_array($espresso_db_update)) { |
|
301 | 301 | // if option is FALSE, then it never existed |
302 | - if ( $espresso_db_update === FALSE ) { |
|
302 | + if ($espresso_db_update === FALSE) { |
|
303 | 303 | // make $espresso_db_update an array and save option with autoload OFF |
304 | - $espresso_db_update = array(); |
|
305 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
304 | + $espresso_db_update = array(); |
|
305 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
306 | 306 | } else { |
307 | 307 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
308 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
309 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
308 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
309 | + update_option('espresso_db_update', $espresso_db_update); |
|
310 | 310 | } |
311 | - }else{ |
|
311 | + } else { |
|
312 | 312 | $corrected_db_update = array(); |
313 | 313 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
314 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
315 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
314 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
315 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
316 | 316 | //the key is an int, and the value IS NOT an array |
317 | 317 | //so it must be numerically-indexed, where values are versions installed... |
318 | 318 | //fix it! |
319 | 319 | $version_string = $should_be_array; |
320 | 320 | $corrected_db_update[$version_string] = array('unknown-date'); |
321 | - }else{ |
|
321 | + } else { |
|
322 | 322 | //ok it checks out |
323 | 323 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
324 | 324 | } |
325 | 325 | } |
326 | 326 | $espresso_db_update = $corrected_db_update; |
327 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
327 | + update_option('espresso_db_update', $espresso_db_update); |
|
328 | 328 | |
329 | 329 | } |
330 | 330 | |
331 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
331 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
332 | 332 | return $espresso_db_update; |
333 | 333 | } |
334 | 334 | |
@@ -348,34 +348,34 @@ discard block |
||
348 | 348 | * so we prefer to only do it when necessary |
349 | 349 | * @return void |
350 | 350 | */ |
351 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
351 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
352 | 352 | $request_type = $this->detect_req_type(); |
353 | 353 | //only initialize system if we're not in maintenance mode. |
354 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
355 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
354 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
355 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
356 | 356 | |
357 | - if( $verify_schema ) { |
|
357 | + if ($verify_schema) { |
|
358 | 358 | EEH_Activation::initialize_db_and_folders(); |
359 | 359 | } |
360 | 360 | EEH_Activation::initialize_db_content(); |
361 | 361 | EEH_Activation::system_initialization(); |
362 | - if( $initialize_addons_too ) { |
|
362 | + if ($initialize_addons_too) { |
|
363 | 363 | $this->initialize_addons(); |
364 | 364 | } |
365 | - }else{ |
|
366 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
365 | + } else { |
|
366 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
367 | 367 | } |
368 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
369 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
368 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
369 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Initializes the db for all registered addons |
375 | 375 | */ |
376 | - public function initialize_addons(){ |
|
376 | + public function initialize_addons() { |
|
377 | 377 | //foreach registered addon, make sure its db is up-to-date too |
378 | - foreach($this->registry->addons as $addon){ |
|
378 | + foreach ($this->registry->addons as $addon) { |
|
379 | 379 | $addon->initialize_db_if_no_migrations_required(); |
380 | 380 | } |
381 | 381 | } |
@@ -387,16 +387,16 @@ discard block |
||
387 | 387 | * @param string $current_version_to_add version to be added to the version history |
388 | 388 | * @return boolean success as to whether or not this option was changed |
389 | 389 | */ |
390 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
391 | - if( ! $version_history ) { |
|
390 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
391 | + if ( ! $version_history) { |
|
392 | 392 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
393 | 393 | } |
394 | - if( $current_version_to_add == NULL){ |
|
394 | + if ($current_version_to_add == NULL) { |
|
395 | 395 | $current_version_to_add = espresso_version(); |
396 | 396 | } |
397 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
397 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
398 | 398 | // re-save |
399 | - return update_option( 'espresso_db_update', $version_history ); |
|
399 | + return update_option('espresso_db_update', $version_history); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | |
@@ -413,10 +413,10 @@ discard block |
||
413 | 413 | * but still know if this is a new install or not |
414 | 414 | * @return int one of the constants on EE_System::req_type_ |
415 | 415 | */ |
416 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
417 | - if ( $this->_req_type === NULL ){ |
|
418 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
419 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
416 | + public function detect_req_type($espresso_db_update = NULL) { |
|
417 | + if ($this->_req_type === NULL) { |
|
418 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
419 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
420 | 420 | } |
421 | 421 | return $this->_req_type; |
422 | 422 | } |
@@ -432,39 +432,39 @@ discard block |
||
432 | 432 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
433 | 433 | * @return int one of the constants on EE_System::req_type_* |
434 | 434 | */ |
435 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
436 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
437 | - if( $activation_history_for_addon ){ |
|
435 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
436 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
437 | + if ($activation_history_for_addon) { |
|
438 | 438 | //it exists, so this isn't a completely new install |
439 | 439 | //check if this version already in that list of previously installed versions |
440 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
440 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
441 | 441 | //it a version we haven't seen before |
442 | - if( $version_is_higher === 1 ){ |
|
442 | + if ($version_is_higher === 1) { |
|
443 | 443 | $req_type = EE_System::req_type_upgrade; |
444 | - }else{ |
|
444 | + } else { |
|
445 | 445 | $req_type = EE_System::req_type_downgrade; |
446 | 446 | } |
447 | - delete_option( $activation_indicator_option_name ); |
|
447 | + delete_option($activation_indicator_option_name); |
|
448 | 448 | } else { |
449 | 449 | // its not an update. maybe a reactivation? |
450 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
451 | - if ( $version_is_higher === -1 ){ |
|
450 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
451 | + if ($version_is_higher === -1) { |
|
452 | 452 | $req_type = EE_System::req_type_downgrade; |
453 | - }elseif( $version_is_higher === 0 ){ |
|
453 | + }elseif ($version_is_higher === 0) { |
|
454 | 454 | //we've seen this version before, but it's an activation. must be a reactivation |
455 | 455 | $req_type = EE_System::req_type_reactivation; |
456 | - }else{//$version_is_higher === 1 |
|
456 | + } else {//$version_is_higher === 1 |
|
457 | 457 | $req_type = EE_System::req_type_upgrade; |
458 | 458 | } |
459 | - delete_option( $activation_indicator_option_name ); |
|
459 | + delete_option($activation_indicator_option_name); |
|
460 | 460 | } else { |
461 | 461 | //we've seen this version before and the activation indicate doesn't show it was just activated |
462 | - if ( $version_is_higher === -1 ){ |
|
462 | + if ($version_is_higher === -1) { |
|
463 | 463 | $req_type = EE_System::req_type_downgrade; |
464 | - }elseif( $version_is_higher === 0 ){ |
|
464 | + }elseif ($version_is_higher === 0) { |
|
465 | 465 | //we've seen this version before and it's not an activation. its normal request |
466 | 466 | $req_type = EE_System::req_type_normal; |
467 | - }else{//$version_is_higher === 1 |
|
467 | + } else {//$version_is_higher === 1 |
|
468 | 468 | $req_type = EE_System::req_type_upgrade; |
469 | 469 | } |
470 | 470 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | } else { |
473 | 473 | //brand new install |
474 | 474 | $req_type = EE_System::req_type_new_activation; |
475 | - delete_option( $activation_indicator_option_name ); |
|
475 | + delete_option($activation_indicator_option_name); |
|
476 | 476 | } |
477 | 477 | return $req_type; |
478 | 478 | } |
@@ -490,30 +490,30 @@ discard block |
||
490 | 490 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
491 | 491 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
492 | 492 | */ |
493 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
493 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
494 | 494 | //find the most recently-activated version |
495 | 495 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
496 | 496 | $most_recently_active_version = '0.0.0.dev.000'; |
497 | - if( is_array( $activation_history_for_addon ) ){ |
|
498 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
497 | + if (is_array($activation_history_for_addon)) { |
|
498 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
499 | 499 | //check there is a record of when this version was activated. Otherwise, |
500 | 500 | //mark it as unknown |
501 | - if( ! $times_activated ){ |
|
502 | - $times_activated = array( 'unknown-date'); |
|
501 | + if ( ! $times_activated) { |
|
502 | + $times_activated = array('unknown-date'); |
|
503 | 503 | } |
504 | - if( is_string( $times_activated ) ){ |
|
505 | - $times_activated = array( $times_activated ); |
|
504 | + if (is_string($times_activated)) { |
|
505 | + $times_activated = array($times_activated); |
|
506 | 506 | } |
507 | - foreach( $times_activated as $an_activation ){ |
|
508 | - if( $an_activation != 'unknown-date' && |
|
509 | - $an_activation > $most_recently_active_version_activation ){ |
|
507 | + foreach ($times_activated as $an_activation) { |
|
508 | + if ($an_activation != 'unknown-date' && |
|
509 | + $an_activation > $most_recently_active_version_activation) { |
|
510 | 510 | $most_recently_active_version = $version; |
511 | 511 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
512 | 512 | } |
513 | 513 | } |
514 | 514 | } |
515 | 515 | } |
516 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
516 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | |
@@ -523,24 +523,24 @@ discard block |
||
523 | 523 | * @return void |
524 | 524 | */ |
525 | 525 | public function redirect_to_about_ee() { |
526 | - $notices = EE_Error::get_notices( FALSE ); |
|
526 | + $notices = EE_Error::get_notices(FALSE); |
|
527 | 527 | //if current user is an admin and it's not an ajax request |
528 | 528 | if ( |
529 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
530 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
531 | - && ! isset( $notices[ 'errors' ] ) |
|
529 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
530 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
531 | + && ! isset($notices['errors']) |
|
532 | 532 | ) { |
533 | - $query_params = array( 'page' => 'espresso_about' ); |
|
533 | + $query_params = array('page' => 'espresso_about'); |
|
534 | 534 | |
535 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
535 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
536 | 536 | $query_params['new_activation'] = TRUE; |
537 | 537 | } |
538 | 538 | |
539 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
539 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
540 | 540 | $query_params['reactivation'] = TRUE; |
541 | 541 | } |
542 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
543 | - wp_safe_redirect( $url ); |
|
542 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
543 | + wp_safe_redirect($url); |
|
544 | 544 | exit(); |
545 | 545 | } |
546 | 546 | } |
@@ -554,31 +554,31 @@ discard block |
||
554 | 554 | * |
555 | 555 | * @return void |
556 | 556 | */ |
557 | - public function load_core_configuration(){ |
|
558 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
559 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
557 | + public function load_core_configuration() { |
|
558 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
559 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
560 | 560 | //load textdomain |
561 | 561 | EE_Load_Textdomain::load_textdomain(); |
562 | 562 | // load and setup EE_Config and EE_Network_Config |
563 | - $this->registry->load_core( 'Config' ); |
|
564 | - $this->registry->load_core( 'Network_Config' ); |
|
563 | + $this->registry->load_core('Config'); |
|
564 | + $this->registry->load_core('Network_Config'); |
|
565 | 565 | // setup autoloaders |
566 | 566 | // enable logging? |
567 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
568 | - $this->registry->load_core( 'Log' ); |
|
567 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
568 | + $this->registry->load_core('Log'); |
|
569 | 569 | } |
570 | 570 | // check for activation errors |
571 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
572 | - if ( $activation_errors ) { |
|
573 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
574 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
571 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
572 | + if ($activation_errors) { |
|
573 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
574 | + update_option('ee_plugin_activation_errors', FALSE); |
|
575 | 575 | } |
576 | 576 | // get model names |
577 | 577 | $this->_parse_model_names(); |
578 | 578 | |
579 | 579 | //load caf stuff a chance to play during the activation process too. |
580 | 580 | $this->_maybe_brew_regular(); |
581 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
581 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | |
@@ -587,23 +587,23 @@ discard block |
||
587 | 587 | * |
588 | 588 | * @return void |
589 | 589 | */ |
590 | - private function _parse_model_names(){ |
|
590 | + private function _parse_model_names() { |
|
591 | 591 | //get all the files in the EE_MODELS folder that end in .model.php |
592 | - $models = glob( EE_MODELS.'*.model.php'); |
|
592 | + $models = glob(EE_MODELS.'*.model.php'); |
|
593 | 593 | $model_names = array(); |
594 | 594 | $non_abstract_db_models = array(); |
595 | - foreach( $models as $model ){ |
|
595 | + foreach ($models as $model) { |
|
596 | 596 | // get model classname |
597 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
598 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
597 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
598 | + $short_name = str_replace('EEM_', '', $classname); |
|
599 | 599 | $reflectionClass = new ReflectionClass($classname); |
600 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
601 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
600 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
601 | + $non_abstract_db_models[$short_name] = $classname; |
|
602 | 602 | } |
603 | - $model_names[ $short_name ] = $classname; |
|
603 | + $model_names[$short_name] = $classname; |
|
604 | 604 | } |
605 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
606 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
605 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
606 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | * @return void |
614 | 614 | */ |
615 | 615 | private function _maybe_brew_regular() { |
616 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
617 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
616 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
617 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
618 | 618 | } |
619 | 619 | } |
620 | 620 | |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | * @return void |
632 | 632 | */ |
633 | 633 | public function register_shortcodes_modules_and_widgets() { |
634 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
634 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
635 | 635 | // check for addons using old hookpoint |
636 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
636 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
637 | 637 | $this->_incompatible_addon_error(); |
638 | 638 | } |
639 | 639 | } |
@@ -647,19 +647,19 @@ discard block |
||
647 | 647 | */ |
648 | 648 | private function _incompatible_addon_error() { |
649 | 649 | // get array of classes hooking into here |
650 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
651 | - if ( ! empty( $class_names )) { |
|
652 | - $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' ); |
|
650 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
651 | + if ( ! empty($class_names)) { |
|
652 | + $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 | 653 | $msg .= '<ul>'; |
654 | - foreach ( $class_names as $class_name ) { |
|
655 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
654 | + foreach ($class_names as $class_name) { |
|
655 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
656 | 656 | } |
657 | 657 | $msg .= '</ul>'; |
658 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
658 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
659 | 659 | // save list of incompatible addons to wp-options for later use |
660 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
661 | - if ( is_admin() ) { |
|
662 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
660 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
661 | + if (is_admin()) { |
|
662 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
663 | 663 | } |
664 | 664 | } |
665 | 665 | } |
@@ -676,26 +676,26 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return void |
678 | 678 | */ |
679 | - public function brew_espresso(){ |
|
680 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
679 | + public function brew_espresso() { |
|
680 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
681 | 681 | // load some final core systems |
682 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
683 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
684 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
685 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
686 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
687 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
688 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
689 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
690 | - add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
691 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
692 | - |
|
693 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
682 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
683 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
684 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
685 | + add_action('init', array($this, 'load_controllers'), 7); |
|
686 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
687 | + add_action('init', array($this, 'initialize'), 10); |
|
688 | + add_action('init', array($this, 'initialize_last'), 100); |
|
689 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
690 | + add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
691 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
692 | + |
|
693 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
694 | 694 | // pew pew pew |
695 | - $this->registry->load_core( 'PUE' ); |
|
696 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
695 | + $this->registry->load_core('PUE'); |
|
696 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
697 | 697 | } |
698 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
698 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function set_hooks_for_core() { |
711 | 711 | $this->_deactivate_incompatible_addons(); |
712 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
712 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -718,15 +718,15 @@ discard block |
||
718 | 718 | * Using the information gathered in EE_System::_incompatible_addon_error, |
719 | 719 | * deactivates any addons considered incompatible with the current version of EE |
720 | 720 | */ |
721 | - private function _deactivate_incompatible_addons(){ |
|
722 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
723 | - if ( ! empty( $incompatible_addons )) { |
|
724 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
725 | - foreach ( $active_plugins as $active_plugin ) { |
|
726 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
727 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
728 | - unset( $_GET['activate'] ); |
|
729 | - espresso_deactivate_plugin( $active_plugin ); |
|
721 | + private function _deactivate_incompatible_addons() { |
|
722 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
723 | + if ( ! empty($incompatible_addons)) { |
|
724 | + $active_plugins = get_option('active_plugins', array()); |
|
725 | + foreach ($active_plugins as $active_plugin) { |
|
726 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
727 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
728 | + unset($_GET['activate']); |
|
729 | + espresso_deactivate_plugin($active_plugin); |
|
730 | 730 | } |
731 | 731 | } |
732 | 732 | } |
@@ -743,10 +743,10 @@ discard block |
||
743 | 743 | */ |
744 | 744 | public function perform_activations_upgrades_and_migrations() { |
745 | 745 | //first check if we had previously attempted to setup EE's directories but failed |
746 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
746 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
747 | 747 | EEH_Activation::create_upload_directories(); |
748 | 748 | } |
749 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
749 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | * @return void |
759 | 759 | */ |
760 | 760 | public function load_CPTs_and_session() { |
761 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
761 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
762 | 762 | // register Custom Post Types |
763 | - $this->registry->load_core( 'Register_CPTs' ); |
|
764 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
763 | + $this->registry->load_core('Register_CPTs'); |
|
764 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | |
@@ -776,16 +776,16 @@ discard block |
||
776 | 776 | * @return void |
777 | 777 | */ |
778 | 778 | public function load_controllers() { |
779 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
779 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
780 | 780 | // let's get it started |
781 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
782 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
783 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
784 | - } else if ( ! EE_FRONT_AJAX ) { |
|
785 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
786 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
781 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
782 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
783 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
784 | + } else if ( ! EE_FRONT_AJAX) { |
|
785 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
786 | + EE_Registry::instance()->load_core('Admin'); |
|
787 | 787 | } |
788 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
788 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | |
@@ -799,9 +799,9 @@ discard block |
||
799 | 799 | * @return void |
800 | 800 | */ |
801 | 801 | public function core_loaded_and_ready() { |
802 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
803 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
804 | - $this->registry->load_core( 'Session' ); |
|
802 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
803 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
804 | + $this->registry->load_core('Session'); |
|
805 | 805 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
806 | 806 | } |
807 | 807 | |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * @return void |
817 | 817 | */ |
818 | 818 | public function initialize() { |
819 | - do_action( 'AHEE__EE_System__initialize' ); |
|
819 | + do_action('AHEE__EE_System__initialize'); |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * @return void |
831 | 831 | */ |
832 | 832 | public function initialize_last() { |
833 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
833 | + do_action('AHEE__EE_System__initialize_last'); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | |
@@ -862,21 +862,21 @@ discard block |
||
862 | 862 | */ |
863 | 863 | public static function do_not_cache() { |
864 | 864 | // set no cache constants |
865 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
866 | - define( 'DONOTCACHEPAGE', true ); |
|
865 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
866 | + define('DONOTCACHEPAGE', true); |
|
867 | 867 | } |
868 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
869 | - define( 'DONOTCACHCEOBJECT', true ); |
|
868 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
869 | + define('DONOTCACHCEOBJECT', true); |
|
870 | 870 | } |
871 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
872 | - define( 'DONOTCACHEDB', true ); |
|
871 | + if ( ! defined('DONOTCACHEDB')) { |
|
872 | + define('DONOTCACHEDB', true); |
|
873 | 873 | } |
874 | 874 | // add no cache headers |
875 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
875 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
876 | 876 | // plus a little extra for nginx and Google Chrome |
877 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
877 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
878 | 878 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
879 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
879 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @param $headers |
889 | 889 | * @return array |
890 | 890 | */ |
891 | - public static function extra_nocache_headers ( $headers ) { |
|
891 | + public static function extra_nocache_headers($headers) { |
|
892 | 892 | // for NGINX |
893 | 893 | $headers['X-Accel-Expires'] = 0; |
894 | 894 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -917,14 +917,14 @@ discard block |
||
917 | 917 | * @param WP_Admin_Bar $admin_bar |
918 | 918 | * @return void |
919 | 919 | */ |
920 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
920 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
921 | 921 | |
922 | 922 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
923 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
923 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
924 | 924 | return; |
925 | 925 | } |
926 | 926 | |
927 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
927 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
928 | 928 | $menu_class = 'espresso_menu_item_class'; |
929 | 929 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
930 | 930 | //because they're only defined in each of their respective constructors |
@@ -936,20 +936,20 @@ discard block |
||
936 | 936 | //Top Level |
937 | 937 | $admin_bar->add_menu(array( |
938 | 938 | 'id' => 'espresso-toolbar', |
939 | - '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>', |
|
939 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
940 | 940 | 'href' => $events_admin_url, |
941 | 941 | 'meta' => array( |
942 | 942 | 'title' => __('Event Espresso', 'event_espresso'), |
943 | - 'class' => $menu_class . 'first' |
|
943 | + 'class' => $menu_class.'first' |
|
944 | 944 | ), |
945 | 945 | )); |
946 | 946 | |
947 | 947 | //Events |
948 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
948 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
949 | 949 | $admin_bar->add_menu(array( |
950 | 950 | 'id' => 'espresso-toolbar-events', |
951 | 951 | 'parent' => 'espresso-toolbar', |
952 | - 'title' => __( 'Events', 'event_espresso' ), |
|
952 | + 'title' => __('Events', 'event_espresso'), |
|
953 | 953 | 'href' => $events_admin_url, |
954 | 954 | 'meta' => array( |
955 | 955 | 'title' => __('Events', 'event_espresso'), |
@@ -960,13 +960,13 @@ discard block |
||
960 | 960 | } |
961 | 961 | |
962 | 962 | |
963 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
963 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
964 | 964 | //Events Add New |
965 | 965 | $admin_bar->add_menu(array( |
966 | 966 | 'id' => 'espresso-toolbar-events-new', |
967 | 967 | 'parent' => 'espresso-toolbar-events', |
968 | 968 | 'title' => __('Add New', 'event_espresso'), |
969 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
969 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
970 | 970 | 'meta' => array( |
971 | 971 | 'title' => __('Add New', 'event_espresso'), |
972 | 972 | 'target' => '', |
@@ -975,18 +975,18 @@ discard block |
||
975 | 975 | )); |
976 | 976 | } |
977 | 977 | |
978 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
978 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
979 | 979 | |
980 | 980 | //Current post |
981 | 981 | global $post; |
982 | 982 | |
983 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
983 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
984 | 984 | //Events Edit Current Event |
985 | 985 | $admin_bar->add_menu(array( |
986 | 986 | 'id' => 'espresso-toolbar-events-edit', |
987 | 987 | 'parent' => 'espresso-toolbar-events', |
988 | 988 | 'title' => __('Edit Event', 'event_espresso'), |
989 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
989 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
990 | 990 | 'meta' => array( |
991 | 991 | 'title' => __('Edit Event', 'event_espresso'), |
992 | 992 | 'target' => '', |
@@ -998,11 +998,11 @@ discard block |
||
998 | 998 | } |
999 | 999 | |
1000 | 1000 | //Events View |
1001 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
1001 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1002 | 1002 | $admin_bar->add_menu(array( |
1003 | 1003 | 'id' => 'espresso-toolbar-events-view', |
1004 | 1004 | 'parent' => 'espresso-toolbar-events', |
1005 | - 'title' => __( 'View', 'event_espresso' ), |
|
1005 | + 'title' => __('View', 'event_espresso'), |
|
1006 | 1006 | 'href' => $events_admin_url, |
1007 | 1007 | 'meta' => array( |
1008 | 1008 | 'title' => __('View', 'event_espresso'), |
@@ -1012,12 +1012,12 @@ discard block |
||
1012 | 1012 | )); |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1015 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1016 | 1016 | //Events View All |
1017 | 1017 | $admin_bar->add_menu(array( |
1018 | 1018 | 'id' => 'espresso-toolbar-events-all', |
1019 | 1019 | 'parent' => 'espresso-toolbar-events-view', |
1020 | - 'title' => __( 'All', 'event_espresso' ), |
|
1020 | + 'title' => __('All', 'event_espresso'), |
|
1021 | 1021 | 'href' => $events_admin_url, |
1022 | 1022 | 'meta' => array( |
1023 | 1023 | 'title' => __('All', 'event_espresso'), |
@@ -1028,13 +1028,13 @@ discard block |
||
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | |
1031 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1031 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1032 | 1032 | //Events View Today |
1033 | 1033 | $admin_bar->add_menu(array( |
1034 | 1034 | 'id' => 'espresso-toolbar-events-today', |
1035 | 1035 | 'parent' => 'espresso-toolbar-events-view', |
1036 | 1036 | 'title' => __('Today', 'event_espresso'), |
1037 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1037 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1038 | 1038 | 'meta' => array( |
1039 | 1039 | 'title' => __('Today', 'event_espresso'), |
1040 | 1040 | 'target' => '', |
@@ -1044,13 +1044,13 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
1047 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1047 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1048 | 1048 | //Events View This Month |
1049 | 1049 | $admin_bar->add_menu(array( |
1050 | 1050 | 'id' => 'espresso-toolbar-events-month', |
1051 | 1051 | 'parent' => 'espresso-toolbar-events-view', |
1052 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1053 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1052 | + 'title' => __('This Month', 'event_espresso'), |
|
1053 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1054 | 1054 | 'meta' => array( |
1055 | 1055 | 'title' => __('This Month', 'event_espresso'), |
1056 | 1056 | 'target' => '', |
@@ -1060,11 +1060,11 @@ discard block |
||
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | //Registration Overview |
1063 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1063 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1064 | 1064 | $admin_bar->add_menu(array( |
1065 | 1065 | 'id' => 'espresso-toolbar-registrations', |
1066 | 1066 | 'parent' => 'espresso-toolbar', |
1067 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1067 | + 'title' => __('Registrations', 'event_espresso'), |
|
1068 | 1068 | 'href' => $reg_admin_url, |
1069 | 1069 | 'meta' => array( |
1070 | 1070 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1075,12 +1075,12 @@ discard block |
||
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | //Registration Overview Today |
1078 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1078 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1079 | 1079 | $admin_bar->add_menu(array( |
1080 | 1080 | 'id' => 'espresso-toolbar-registrations-today', |
1081 | 1081 | 'parent' => 'espresso-toolbar-registrations', |
1082 | - 'title' => __( 'Today', 'event_espresso'), |
|
1083 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1082 | + 'title' => __('Today', 'event_espresso'), |
|
1083 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1084 | 1084 | 'meta' => array( |
1085 | 1085 | 'title' => __('Today', 'event_espresso'), |
1086 | 1086 | 'target' => '', |
@@ -1090,14 +1090,14 @@ discard block |
||
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | //Registration Overview Today Completed |
1093 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1093 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1094 | 1094 | $admin_bar->add_menu(array( |
1095 | 1095 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1096 | 1096 | 'parent' => 'espresso-toolbar-registrations-today', |
1097 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1098 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1097 | + 'title' => __('Approved', 'event_espresso'), |
|
1098 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1099 | 1099 | 'meta' => array( |
1100 | - 'title' => __('Approved', 'event_espresso' ), |
|
1100 | + 'title' => __('Approved', 'event_espresso'), |
|
1101 | 1101 | 'target' => '', |
1102 | 1102 | 'class' => $menu_class |
1103 | 1103 | ), |
@@ -1105,14 +1105,14 @@ discard block |
||
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | //Registration Overview Today Pending\ |
1108 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1108 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1109 | 1109 | $admin_bar->add_menu(array( |
1110 | 1110 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1111 | 1111 | 'parent' => 'espresso-toolbar-registrations-today', |
1112 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1113 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1112 | + 'title' => __('Pending', 'event_espresso'), |
|
1113 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1114 | 1114 | 'meta' => array( |
1115 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1115 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1116 | 1116 | 'target' => '', |
1117 | 1117 | 'class' => $menu_class |
1118 | 1118 | ), |
@@ -1120,14 +1120,14 @@ discard block |
||
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | //Registration Overview Today Incomplete |
1123 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1123 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1124 | 1124 | $admin_bar->add_menu(array( |
1125 | 1125 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1126 | 1126 | 'parent' => 'espresso-toolbar-registrations-today', |
1127 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1128 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1127 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1128 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1129 | 1129 | 'meta' => array( |
1130 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1130 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1131 | 1131 | 'target' => '', |
1132 | 1132 | 'class' => $menu_class |
1133 | 1133 | ), |
@@ -1135,12 +1135,12 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | //Registration Overview Today Incomplete |
1138 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1138 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1139 | 1139 | $admin_bar->add_menu(array( |
1140 | 1140 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1141 | 1141 | 'parent' => 'espresso-toolbar-registrations-today', |
1142 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1143 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1142 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1143 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1144 | 1144 | 'meta' => array( |
1145 | 1145 | 'title' => __('Cancelled', 'event_espresso'), |
1146 | 1146 | 'target' => '', |
@@ -1150,12 +1150,12 @@ discard block |
||
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | //Registration Overview This Month |
1153 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1153 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1154 | 1154 | $admin_bar->add_menu(array( |
1155 | 1155 | 'id' => 'espresso-toolbar-registrations-month', |
1156 | 1156 | 'parent' => 'espresso-toolbar-registrations', |
1157 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1158 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1157 | + 'title' => __('This Month', 'event_espresso'), |
|
1158 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1159 | 1159 | 'meta' => array( |
1160 | 1160 | 'title' => __('This Month', 'event_espresso'), |
1161 | 1161 | 'target' => '', |
@@ -1165,12 +1165,12 @@ discard block |
||
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | //Registration Overview This Month Approved |
1168 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1168 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1169 | 1169 | $admin_bar->add_menu(array( |
1170 | 1170 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1171 | 1171 | 'parent' => 'espresso-toolbar-registrations-month', |
1172 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1173 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1172 | + 'title' => __('Approved', 'event_espresso'), |
|
1173 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1174 | 1174 | 'meta' => array( |
1175 | 1175 | 'title' => __('Approved', 'event_espresso'), |
1176 | 1176 | 'target' => '', |
@@ -1180,12 +1180,12 @@ discard block |
||
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | //Registration Overview This Month Pending |
1183 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1183 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1184 | 1184 | $admin_bar->add_menu(array( |
1185 | 1185 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1186 | 1186 | 'parent' => 'espresso-toolbar-registrations-month', |
1187 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1188 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1187 | + 'title' => __('Pending', 'event_espresso'), |
|
1188 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1189 | 1189 | 'meta' => array( |
1190 | 1190 | 'title' => __('Pending', 'event_espresso'), |
1191 | 1191 | 'target' => '', |
@@ -1195,14 +1195,14 @@ discard block |
||
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | //Registration Overview This Month Not Approved |
1198 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1198 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1199 | 1199 | $admin_bar->add_menu(array( |
1200 | 1200 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1201 | 1201 | 'parent' => 'espresso-toolbar-registrations-month', |
1202 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1203 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1202 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1203 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1204 | 1204 | 'meta' => array( |
1205 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1205 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1206 | 1206 | 'target' => '', |
1207 | 1207 | 'class' => $menu_class |
1208 | 1208 | ), |
@@ -1211,12 +1211,12 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | |
1213 | 1213 | //Registration Overview This Month Cancelled |
1214 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1214 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1215 | 1215 | $admin_bar->add_menu(array( |
1216 | 1216 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1217 | 1217 | 'parent' => 'espresso-toolbar-registrations-month', |
1218 | 1218 | 'title' => __('Cancelled', 'event_espresso'), |
1219 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1219 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1220 | 1220 | 'meta' => array( |
1221 | 1221 | 'title' => __('Cancelled', 'event_espresso'), |
1222 | 1222 | 'target' => '', |
@@ -1226,11 +1226,11 @@ discard block |
||
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | //Extensions & Services |
1229 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1229 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1230 | 1230 | $admin_bar->add_menu(array( |
1231 | 1231 | 'id' => 'espresso-toolbar-extensions-and-services', |
1232 | 1232 | 'parent' => 'espresso-toolbar', |
1233 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1233 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1234 | 1234 | 'href' => $extensions_admin_url, |
1235 | 1235 | 'meta' => array( |
1236 | 1236 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1252,8 +1252,8 @@ discard block |
||
1252 | 1252 | * @param array $exclude_array any existing pages being excluded are in this array. |
1253 | 1253 | * @return array |
1254 | 1254 | */ |
1255 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1256 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
1255 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1256 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | |
@@ -1273,15 +1273,15 @@ discard block |
||
1273 | 1273 | */ |
1274 | 1274 | public function wp_enqueue_scripts() { |
1275 | 1275 | // 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' ); |
1276 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1276 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1277 | 1277 | // 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' ); |
1278 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1278 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1279 | 1279 | // register jQuery Validate and additional methods |
1280 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
1281 | - wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE ); |
|
1280 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
1281 | + wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE); |
|
1282 | 1282 | } |
1283 | - wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true ); |
|
1284 | - wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
1283 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
1284 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
1285 | 1285 | } |
1286 | 1286 | } |
1287 | 1287 |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\ResettableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | +} |
|
4 | 6 | /** |
5 | 7 | * |
6 | 8 | * EE_System |
@@ -308,7 +310,7 @@ discard block |
||
308 | 310 | $espresso_db_update = array( $espresso_db_update=>array() ); |
309 | 311 | update_option( 'espresso_db_update', $espresso_db_update ); |
310 | 312 | } |
311 | - }else{ |
|
313 | + } else{ |
|
312 | 314 | $corrected_db_update = array(); |
313 | 315 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
314 | 316 | foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
@@ -318,7 +320,7 @@ discard block |
||
318 | 320 | //fix it! |
319 | 321 | $version_string = $should_be_array; |
320 | 322 | $corrected_db_update[$version_string] = array('unknown-date'); |
321 | - }else{ |
|
323 | + } else{ |
|
322 | 324 | //ok it checks out |
323 | 325 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
324 | 326 | } |
@@ -362,7 +364,7 @@ discard block |
||
362 | 364 | if( $initialize_addons_too ) { |
363 | 365 | $this->initialize_addons(); |
364 | 366 | } |
365 | - }else{ |
|
367 | + } else{ |
|
366 | 368 | EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
367 | 369 | } |
368 | 370 | if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
@@ -441,7 +443,7 @@ discard block |
||
441 | 443 | //it a version we haven't seen before |
442 | 444 | if( $version_is_higher === 1 ){ |
443 | 445 | $req_type = EE_System::req_type_upgrade; |
444 | - }else{ |
|
446 | + } else{ |
|
445 | 447 | $req_type = EE_System::req_type_downgrade; |
446 | 448 | } |
447 | 449 | delete_option( $activation_indicator_option_name ); |
@@ -450,10 +452,10 @@ discard block |
||
450 | 452 | if( get_option( $activation_indicator_option_name, FALSE ) ){ |
451 | 453 | if ( $version_is_higher === -1 ){ |
452 | 454 | $req_type = EE_System::req_type_downgrade; |
453 | - }elseif( $version_is_higher === 0 ){ |
|
455 | + } elseif( $version_is_higher === 0 ){ |
|
454 | 456 | //we've seen this version before, but it's an activation. must be a reactivation |
455 | 457 | $req_type = EE_System::req_type_reactivation; |
456 | - }else{//$version_is_higher === 1 |
|
458 | + } else{//$version_is_higher === 1 |
|
457 | 459 | $req_type = EE_System::req_type_upgrade; |
458 | 460 | } |
459 | 461 | delete_option( $activation_indicator_option_name ); |
@@ -461,10 +463,10 @@ discard block |
||
461 | 463 | //we've seen this version before and the activation indicate doesn't show it was just activated |
462 | 464 | if ( $version_is_higher === -1 ){ |
463 | 465 | $req_type = EE_System::req_type_downgrade; |
464 | - }elseif( $version_is_higher === 0 ){ |
|
466 | + } elseif( $version_is_higher === 0 ){ |
|
465 | 467 | //we've seen this version before and it's not an activation. its normal request |
466 | 468 | $req_type = EE_System::req_type_normal; |
467 | - }else{//$version_is_higher === 1 |
|
469 | + } else{//$version_is_higher === 1 |
|
468 | 470 | $req_type = EE_System::req_type_upgrade; |
469 | 471 | } |
470 | 472 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | 4 | /** |
5 | 5 | * EE_PUE |
6 | 6 | * |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | public function __construct() { |
20 | 20 | // throw new EE_Error('error'); |
21 | 21 | |
22 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
22 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
23 | 23 | |
24 | 24 | //wp have no MONTH_IN_SECONDS constant. So we approximate our own assuming all months are 4 weeks long. |
25 | - if ( !defined('MONTH_IN_SECONDS' ) ) |
|
26 | - define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
25 | + if ( ! defined('MONTH_IN_SECONDS')) |
|
26 | + define('MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4); |
|
27 | 27 | |
28 | - if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){ |
|
28 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
29 | 29 | $this->_uxip_hooks(); |
30 | 30 | } |
31 | 31 | |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
35 | 35 | |
36 | 36 | //has optin been selected for data collection? |
37 | - $espresso_data_optin = !empty($ueip_optin) ? $ueip_optin : NULL; |
|
37 | + $espresso_data_optin = ! empty($ueip_optin) ? $ueip_optin : NULL; |
|
38 | 38 | |
39 | - if ( empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
40 | - add_action('admin_notices', array( $this, 'espresso_data_collection_optin_notice' ), 10 ); |
|
41 | - add_action('admin_enqueue_scripts', array( $this, 'espresso_data_collection_enqueue_scripts' ), 10 ); |
|
42 | - add_action('wp_ajax_espresso_data_optin', array( $this, 'espresso_data_optin_ajax_handler' ), 10 ); |
|
39 | + if (empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
40 | + add_action('admin_notices', array($this, 'espresso_data_collection_optin_notice'), 10); |
|
41 | + add_action('admin_enqueue_scripts', array($this, 'espresso_data_collection_enqueue_scripts'), 10); |
|
42 | + add_action('wp_ajax_espresso_data_optin', array($this, 'espresso_data_optin_ajax_handler'), 10); |
|
43 | 43 | update_option('ee_ueip_optin', 'yes'); |
44 | 44 | $espresso_data_optin = 'yes'; |
45 | 45 | } |
@@ -48,80 +48,80 @@ discard block |
||
48 | 48 | $extra_stats = array(); |
49 | 49 | |
50 | 50 | //only collect extra stats if the plugin user has opted in. |
51 | - if ( !empty($espresso_data_optin) && $espresso_data_optin == 'yes' ) { |
|
51 | + if ( ! empty($espresso_data_optin) && $espresso_data_optin == 'yes') { |
|
52 | 52 | //let's only setup extra data if transient has expired |
53 | - if ( false === ( $transient = get_transient('ee_extra_data') ) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
53 | + if (false === ($transient = get_transient('ee_extra_data')) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
54 | 54 | |
55 | 55 | $current_site = is_multisite() ? get_current_site() : NULL; |
56 | - $site_pre = ! is_main_site() && ! empty($current_site) ? trim( preg_replace('/\b\w\S\w\b/', '', $current_site->domain ), '.' ) . '_' : ''; |
|
56 | + $site_pre = ! is_main_site() && ! empty($current_site) ? trim(preg_replace('/\b\w\S\w\b/', '', $current_site->domain), '.').'_' : ''; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | //active gateways |
60 | 60 | $active_gateways = get_option('event_espresso_active_gateways'); |
61 | - if ( !empty($active_gateways ) ) { |
|
62 | - foreach ( (array) $active_gateways as $gateway => $ignore ) { |
|
63 | - $extra_stats[$site_pre . $gateway . '_gateway_active'] = 1; |
|
61 | + if ( ! empty($active_gateways)) { |
|
62 | + foreach ((array) $active_gateways as $gateway => $ignore) { |
|
63 | + $extra_stats[$site_pre.$gateway.'_gateway_active'] = 1; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - if ( is_multisite() && is_main_site() ) { |
|
67 | + if (is_multisite() && is_main_site()) { |
|
68 | 68 | $extra_stats['is_multisite'] = true; |
69 | 69 | } |
70 | 70 | |
71 | 71 | //what is the current active theme? |
72 | 72 | $active_theme = get_option('uxip_ee_active_theme'); |
73 | - if ( !empty( $active_theme ) ) |
|
74 | - $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
73 | + if ( ! empty($active_theme)) |
|
74 | + $extra_stats[$site_pre.'active_theme'] = $active_theme; |
|
75 | 75 | |
76 | 76 | //event info regarding an all event count and all "active" event count |
77 | 77 | $all_events_count = get_option('uxip_ee4_all_events_count'); |
78 | - if ( !empty( $all_events_count ) ) |
|
79 | - $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
78 | + if ( ! empty($all_events_count)) |
|
79 | + $extra_stats[$site_pre.'ee4_all_events_count'] = $all_events_count; |
|
80 | 80 | $active_events_count = get_option('uxip_ee4_active_events_count'); |
81 | - if ( !empty( $active_events_count ) ) |
|
82 | - $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
81 | + if ( ! empty($active_events_count)) |
|
82 | + $extra_stats[$site_pre.'ee4_active_events_count'] = $active_events_count; |
|
83 | 83 | |
84 | 84 | //datetime stuff |
85 | 85 | $dtt_count = get_option('uxip_ee_all_dtts_count'); |
86 | - if ( !empty( $dtt_count ) ) |
|
87 | - $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
86 | + if ( ! empty($dtt_count)) |
|
87 | + $extra_stats[$site_pre.'all_dtts_count'] = $dtt_count; |
|
88 | 88 | |
89 | 89 | $dtt_sold = get_option('uxip_ee_dtt_sold'); |
90 | - if ( !empty( $dtt_sold ) ) |
|
91 | - $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
90 | + if ( ! empty($dtt_sold)) |
|
91 | + $extra_stats[$site_pre.'dtt_sold'] = $dtt_sold; |
|
92 | 92 | |
93 | 93 | //ticket stuff |
94 | 94 | $all_tkt_count = get_option('uxip_ee_all_tkt_count'); |
95 | - if ( !empty( $all_tkt_count ) ) |
|
96 | - $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
95 | + if ( ! empty($all_tkt_count)) |
|
96 | + $extra_stats[$site_pre.'all_tkt_count'] = $all_tkt_count; |
|
97 | 97 | |
98 | 98 | $free_tkt_count = get_option('uxip_ee_free_tkt_count'); |
99 | - if ( !empty( $free_tkt_count ) ) |
|
100 | - $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
99 | + if ( ! empty($free_tkt_count)) |
|
100 | + $extra_stats[$site_pre.'free_tkt_count'] = $free_tkt_count; |
|
101 | 101 | |
102 | 102 | $paid_tkt_count = get_option('uxip_ee_paid_tkt_count'); |
103 | - if ( !empty( $paid_tkt_count ) ) |
|
104 | - $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
103 | + if ( ! empty($paid_tkt_count)) |
|
104 | + $extra_stats[$site_pre.'paid_tkt_count'] = $paid_tkt_count; |
|
105 | 105 | |
106 | - $tkt_sold = get_option('uxip_ee_tkt_sold' ); |
|
107 | - if ( !empty($tkt_sold) ) |
|
108 | - $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
106 | + $tkt_sold = get_option('uxip_ee_tkt_sold'); |
|
107 | + if ( ! empty($tkt_sold)) |
|
108 | + $extra_stats[$site_pre.'tkt_sold'] = $tkt_sold; |
|
109 | 109 | |
110 | 110 | //phpversion checking |
111 | 111 | $extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown'; |
112 | 112 | |
113 | 113 | //set transient |
114 | - set_transient( 'ee_extra_data', $extra_stats, WEEK_IN_SECONDS ); |
|
114 | + set_transient('ee_extra_data', $extra_stats, WEEK_IN_SECONDS); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | |
119 | 119 | |
120 | 120 | // PUE Auto Upgrades stuff |
121 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { //include the file |
|
122 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php' ); |
|
121 | + if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { //include the file |
|
122 | + require_once(EE_THIRD_PARTY.'pue/pue-client.php'); |
|
123 | 123 | |
124 | - $api_key = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
124 | + $api_key = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
125 | 125 | $host_server_url = 'https://eventespresso.com'; //this needs to be the host server where plugin update engine is installed. Note, if you leave this blank then it is assumed the WordPress repo will be used and we'll just check there. |
126 | 126 | |
127 | 127 | //Note: PUE uses a simple preg_match to determine what type is currently installed based on version number. So it's important that you use a key for the version type that is unique and not found in another key. |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | //$plugin_slug['prerelease']['b'] = 'some-pre-release-slug'; |
134 | 134 | //..WOULD work! |
135 | 135 | $plugin_slug = array( |
136 | - 'free' => array( 'decaf' => 'event-espresso-core-decaf' ), |
|
137 | - 'premium' => array( 'p' => 'event-espresso-core-reg' ), |
|
138 | - 'prerelease' => array( 'beta' => 'event-espresso-core-pr' ) |
|
136 | + 'free' => array('decaf' => 'event-espresso-core-decaf'), |
|
137 | + 'premium' => array('p' => 'event-espresso-core-reg'), |
|
138 | + 'prerelease' => array('beta' => 'event-espresso-core-pr') |
|
139 | 139 | ); |
140 | 140 | |
141 | 141 | |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | * @param bool $extra |
166 | 166 | * @return string html. |
167 | 167 | */ |
168 | - public static function espresso_data_collection_optin_text( $extra = true ) { |
|
169 | - if ( ! $extra ) { |
|
170 | - echo '<h2 class="ee-admin-settings-hdr" '. (!$extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>'; |
|
171 | - echo sprintf( __('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>','<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">','</a>','<br><br>','<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">','</a>' ); |
|
168 | + public static function espresso_data_collection_optin_text($extra = true) { |
|
169 | + if ( ! $extra) { |
|
170 | + echo '<h2 class="ee-admin-settings-hdr" '.( ! $extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>'; |
|
171 | + echo sprintf(__('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>', '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<br><br>', '<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">', '</a>'); |
|
172 | 172 | } else { |
173 | - $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
|
173 | + $settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings')); |
|
174 | 174 | $settings_url .= '#UXIP_settings'; |
175 | - echo sprintf( __( 'The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso' ), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<a href="' . $settings_url . '" target="_blank">', '</a>' ); |
|
175 | + echo sprintf(__('The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso'), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<a href="'.$settings_url.'" target="_blank">', '</a>'); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | function espresso_data_collection_optin_notice() { |
183 | 183 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
184 | - if ( $ueip_has_notified ) return; |
|
184 | + if ($ueip_has_notified) return; |
|
185 | 185 | // $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
186 | 186 | // $settings_url = $settings_url . '#UXIP_settings'; |
187 | 187 | ?> |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | function espresso_data_collection_enqueue_scripts() { |
208 | - wp_register_script( 'ee-data-optin-js', EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
209 | - wp_register_style( 'ee-data-optin-css', EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
208 | + wp_register_script('ee-data-optin-js', EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
209 | + wp_register_style('ee-data-optin-css', EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION); |
|
210 | 210 | |
211 | 211 | wp_enqueue_script('ee-data-optin-js'); |
212 | 212 | wp_enqueue_style('ee-data-optin-css'); |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | function espresso_data_optin_ajax_handler() { |
222 | 222 | |
223 | 223 | //verify nonce |
224 | - if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit(); |
|
224 | + if (isset($_POST['nonce']) && ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) exit(); |
|
225 | 225 | |
226 | 226 | //made it here so let's save the selection |
227 | 227 | // $ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no'; |
228 | 228 | |
229 | 229 | //update_option('ee_ueip_optin', $ueip_optin); |
230 | 230 | EE_Registry::instance()->CFG->core->ee_ueip_has_notified = 1; |
231 | - EE_Registry::instance()->CFG->update_espresso_config( FALSE, FALSE ); |
|
231 | + EE_Registry::instance()->CFG->update_espresso_config(FALSE, FALSE); |
|
232 | 232 | exit(); |
233 | 233 | } |
234 | 234 | |
@@ -241,22 +241,22 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public static function is_update_available($basename = '') { |
243 | 243 | |
244 | - $basename = ! empty( $basename ) ? $basename : EE_PLUGIN_BASENAME; |
|
244 | + $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
245 | 245 | |
246 | 246 | $update = false; |
247 | 247 | |
248 | - $folder = DS . dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
248 | + $folder = DS.dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
249 | 249 | |
250 | 250 | $plugins = get_plugins($folder); |
251 | - $current = get_site_transient( 'update_plugins' ); |
|
251 | + $current = get_site_transient('update_plugins'); |
|
252 | 252 | |
253 | - foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
|
254 | - if ( isset( $current->response['plugin_file'] ) ) |
|
253 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
254 | + if (isset($current->response['plugin_file'])) |
|
255 | 255 | $update = true; |
256 | 256 | } |
257 | 257 | |
258 | 258 | //it's possible that there is an update but an invalid site-license-key is in use |
259 | - if ( get_site_option('pue_json_error_' . $basename ) ) |
|
259 | + if (get_site_option('pue_json_error_'.$basename)) |
|
260 | 260 | $update = true; |
261 | 261 | |
262 | 262 | return $update; |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @return void |
275 | 275 | */ |
276 | 276 | public function _uxip_hooks() { |
277 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
278 | - add_action('admin_init', array( $this, 'track_active_theme' ) ); |
|
279 | - add_action('admin_init', array( $this, 'track_event_info' ) ); |
|
277 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
278 | + add_action('admin_init', array($this, 'track_active_theme')); |
|
279 | + add_action('admin_init', array($this, 'track_event_info')); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -285,66 +285,66 @@ discard block |
||
285 | 285 | |
286 | 286 | public function track_active_theme() { |
287 | 287 | //we only check this once a month. |
288 | - if ( false === ( $transient = get_transient( 'ee_active_theme_check' ) ) ) { |
|
288 | + if (false === ($transient = get_transient('ee_active_theme_check'))) { |
|
289 | 289 | $theme = wp_get_theme(); |
290 | - update_option('uxip_ee_active_theme', $theme->get('Name') ); |
|
291 | - set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS ); |
|
290 | + update_option('uxip_ee_active_theme', $theme->get('Name')); |
|
291 | + set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | 295 | |
296 | 296 | public function track_event_info() { |
297 | 297 | //we only check this once every couple weeks. |
298 | - if ( false === ( $transient = get_transient( 'ee4_event_info_check') ) ) { |
|
298 | + if (false === ($transient = get_transient('ee4_event_info_check'))) { |
|
299 | 299 | //first let's get the number for ALL events |
300 | 300 | /** @var EEM_Event $EVT */ |
301 | - $EVT = EE_Registry::instance()->load_model( 'Event'); |
|
301 | + $EVT = EE_Registry::instance()->load_model('Event'); |
|
302 | 302 | $DTT = EE_Registry::instance()->load_model('Datetime'); |
303 | 303 | $TKT = EE_Registry::instance()->load_model('Ticket'); |
304 | 304 | $count = $EVT->count(); |
305 | - if ( $count > 0 ) |
|
305 | + if ($count > 0) |
|
306 | 306 | update_option('uxip_ee4_all_events_count', $count); |
307 | 307 | |
308 | 308 | //next let's just get the number of ACTIVE events |
309 | 309 | $count_active = $EVT->get_active_events(array(), TRUE); |
310 | - if ( $count_active > 0 ) |
|
310 | + if ($count_active > 0) |
|
311 | 311 | update_option('uxip_ee4_active_events_count', $count_active); |
312 | 312 | |
313 | 313 | //datetimes! |
314 | 314 | $dtt_count = $DTT->count(); |
315 | - if ( $dtt_count > 0 ) |
|
316 | - update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
315 | + if ($dtt_count > 0) |
|
316 | + update_option('uxip_ee_all_dtts_count', $dtt_count); |
|
317 | 317 | |
318 | 318 | |
319 | 319 | //dttsold |
320 | 320 | $dtt_sold = $DTT->sum(array(), 'DTT_sold'); |
321 | - if ( $dtt_sold > 0 ) |
|
322 | - update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
321 | + if ($dtt_sold > 0) |
|
322 | + update_option('uxip_ee_dtt_sold', $dtt_sold); |
|
323 | 323 | |
324 | 324 | //allticketcount |
325 | 325 | $all_tkt_count = $TKT->count(); |
326 | - if ( $all_tkt_count > 0 ) |
|
327 | - update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
326 | + if ($all_tkt_count > 0) |
|
327 | + update_option('uxip_ee_all_tkt_count', $all_tkt_count); |
|
328 | 328 | |
329 | 329 | //freetktcount |
330 | - $_where = array( 'TKT_price' => 0 ); |
|
330 | + $_where = array('TKT_price' => 0); |
|
331 | 331 | $free_tkt_count = $TKT->count(array($_where)); |
332 | - if ( $free_tkt_count > 0 ) |
|
333 | - update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
332 | + if ($free_tkt_count > 0) |
|
333 | + update_option('uxip_ee_free_tkt_count', $free_tkt_count); |
|
334 | 334 | |
335 | 335 | //paidtktcount |
336 | - $_where = array( 'TKT_price' => array('>', 0) ); |
|
337 | - $paid_tkt_count = $TKT->count( array( $_where ) ); |
|
338 | - if ( $paid_tkt_count > 0 ) |
|
339 | - update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
336 | + $_where = array('TKT_price' => array('>', 0)); |
|
337 | + $paid_tkt_count = $TKT->count(array($_where)); |
|
338 | + if ($paid_tkt_count > 0) |
|
339 | + update_option('uxip_ee_paid_tkt_count', $paid_tkt_count); |
|
340 | 340 | |
341 | 341 | //tktsold |
342 | - $tkt_sold = $TKT->sum( array(), 'TKT_sold' ); |
|
343 | - if( $tkt_sold > 0 ) |
|
344 | - update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
342 | + $tkt_sold = $TKT->sum(array(), 'TKT_sold'); |
|
343 | + if ($tkt_sold > 0) |
|
344 | + update_option('uxip_ee_tkt_sold', $tkt_sold); |
|
345 | 345 | |
346 | 346 | |
347 | - set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 ); |
|
347 | + set_transient('ee4_event_info_check', 1, WEEK_IN_SECONDS * 2); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | +} |
|
4 | 6 | /** |
5 | 7 | * EE_PUE |
6 | 8 | * |
@@ -22,8 +24,9 @@ discard block |
||
22 | 24 | do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
23 | 25 | |
24 | 26 | //wp have no MONTH_IN_SECONDS constant. So we approximate our own assuming all months are 4 weeks long. |
25 | - if ( !defined('MONTH_IN_SECONDS' ) ) |
|
26 | - define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
27 | + if ( !defined('MONTH_IN_SECONDS' ) ) { |
|
28 | + define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
29 | + } |
|
27 | 30 | |
28 | 31 | if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){ |
29 | 32 | $this->_uxip_hooks(); |
@@ -70,42 +73,51 @@ discard block |
||
70 | 73 | |
71 | 74 | //what is the current active theme? |
72 | 75 | $active_theme = get_option('uxip_ee_active_theme'); |
73 | - if ( !empty( $active_theme ) ) |
|
74 | - $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
76 | + if ( !empty( $active_theme ) ) { |
|
77 | + $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
78 | + } |
|
75 | 79 | |
76 | 80 | //event info regarding an all event count and all "active" event count |
77 | 81 | $all_events_count = get_option('uxip_ee4_all_events_count'); |
78 | - if ( !empty( $all_events_count ) ) |
|
79 | - $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
82 | + if ( !empty( $all_events_count ) ) { |
|
83 | + $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
84 | + } |
|
80 | 85 | $active_events_count = get_option('uxip_ee4_active_events_count'); |
81 | - if ( !empty( $active_events_count ) ) |
|
82 | - $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
86 | + if ( !empty( $active_events_count ) ) { |
|
87 | + $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
88 | + } |
|
83 | 89 | |
84 | 90 | //datetime stuff |
85 | 91 | $dtt_count = get_option('uxip_ee_all_dtts_count'); |
86 | - if ( !empty( $dtt_count ) ) |
|
87 | - $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
92 | + if ( !empty( $dtt_count ) ) { |
|
93 | + $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
94 | + } |
|
88 | 95 | |
89 | 96 | $dtt_sold = get_option('uxip_ee_dtt_sold'); |
90 | - if ( !empty( $dtt_sold ) ) |
|
91 | - $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
97 | + if ( !empty( $dtt_sold ) ) { |
|
98 | + $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
99 | + } |
|
92 | 100 | |
93 | 101 | //ticket stuff |
94 | 102 | $all_tkt_count = get_option('uxip_ee_all_tkt_count'); |
95 | - if ( !empty( $all_tkt_count ) ) |
|
96 | - $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
103 | + if ( !empty( $all_tkt_count ) ) { |
|
104 | + $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
105 | + } |
|
97 | 106 | |
98 | 107 | $free_tkt_count = get_option('uxip_ee_free_tkt_count'); |
99 | - if ( !empty( $free_tkt_count ) ) |
|
100 | - $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
108 | + if ( !empty( $free_tkt_count ) ) { |
|
109 | + $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
110 | + } |
|
101 | 111 | |
102 | 112 | $paid_tkt_count = get_option('uxip_ee_paid_tkt_count'); |
103 | - if ( !empty( $paid_tkt_count ) ) |
|
104 | - $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
113 | + if ( !empty( $paid_tkt_count ) ) { |
|
114 | + $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
115 | + } |
|
105 | 116 | |
106 | 117 | $tkt_sold = get_option('uxip_ee_tkt_sold' ); |
107 | - if ( !empty($tkt_sold) ) |
|
108 | - $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
118 | + if ( !empty($tkt_sold) ) { |
|
119 | + $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
120 | + } |
|
109 | 121 | |
110 | 122 | //phpversion checking |
111 | 123 | $extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown'; |
@@ -181,7 +193,9 @@ discard block |
||
181 | 193 | |
182 | 194 | function espresso_data_collection_optin_notice() { |
183 | 195 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
184 | - if ( $ueip_has_notified ) return; |
|
196 | + if ( $ueip_has_notified ) { |
|
197 | + return; |
|
198 | + } |
|
185 | 199 | // $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
186 | 200 | // $settings_url = $settings_url . '#UXIP_settings'; |
187 | 201 | ?> |
@@ -221,7 +235,9 @@ discard block |
||
221 | 235 | function espresso_data_optin_ajax_handler() { |
222 | 236 | |
223 | 237 | //verify nonce |
224 | - if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit(); |
|
238 | + if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) { |
|
239 | + exit(); |
|
240 | + } |
|
225 | 241 | |
226 | 242 | //made it here so let's save the selection |
227 | 243 | // $ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no'; |
@@ -251,13 +267,15 @@ discard block |
||
251 | 267 | $current = get_site_transient( 'update_plugins' ); |
252 | 268 | |
253 | 269 | foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
254 | - if ( isset( $current->response['plugin_file'] ) ) |
|
255 | - $update = true; |
|
270 | + if ( isset( $current->response['plugin_file'] ) ) { |
|
271 | + $update = true; |
|
272 | + } |
|
256 | 273 | } |
257 | 274 | |
258 | 275 | //it's possible that there is an update but an invalid site-license-key is in use |
259 | - if ( get_site_option('pue_json_error_' . $basename ) ) |
|
260 | - $update = true; |
|
276 | + if ( get_site_option('pue_json_error_' . $basename ) ) { |
|
277 | + $update = true; |
|
278 | + } |
|
261 | 279 | |
262 | 280 | return $update; |
263 | 281 | } |
@@ -302,46 +320,54 @@ discard block |
||
302 | 320 | $DTT = EE_Registry::instance()->load_model('Datetime'); |
303 | 321 | $TKT = EE_Registry::instance()->load_model('Ticket'); |
304 | 322 | $count = $EVT->count(); |
305 | - if ( $count > 0 ) |
|
306 | - update_option('uxip_ee4_all_events_count', $count); |
|
323 | + if ( $count > 0 ) { |
|
324 | + update_option('uxip_ee4_all_events_count', $count); |
|
325 | + } |
|
307 | 326 | |
308 | 327 | //next let's just get the number of ACTIVE events |
309 | 328 | $count_active = $EVT->get_active_events(array(), TRUE); |
310 | - if ( $count_active > 0 ) |
|
311 | - update_option('uxip_ee4_active_events_count', $count_active); |
|
329 | + if ( $count_active > 0 ) { |
|
330 | + update_option('uxip_ee4_active_events_count', $count_active); |
|
331 | + } |
|
312 | 332 | |
313 | 333 | //datetimes! |
314 | 334 | $dtt_count = $DTT->count(); |
315 | - if ( $dtt_count > 0 ) |
|
316 | - update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
335 | + if ( $dtt_count > 0 ) { |
|
336 | + update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
337 | + } |
|
317 | 338 | |
318 | 339 | |
319 | 340 | //dttsold |
320 | 341 | $dtt_sold = $DTT->sum(array(), 'DTT_sold'); |
321 | - if ( $dtt_sold > 0 ) |
|
322 | - update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
342 | + if ( $dtt_sold > 0 ) { |
|
343 | + update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
344 | + } |
|
323 | 345 | |
324 | 346 | //allticketcount |
325 | 347 | $all_tkt_count = $TKT->count(); |
326 | - if ( $all_tkt_count > 0 ) |
|
327 | - update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
348 | + if ( $all_tkt_count > 0 ) { |
|
349 | + update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
350 | + } |
|
328 | 351 | |
329 | 352 | //freetktcount |
330 | 353 | $_where = array( 'TKT_price' => 0 ); |
331 | 354 | $free_tkt_count = $TKT->count(array($_where)); |
332 | - if ( $free_tkt_count > 0 ) |
|
333 | - update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
355 | + if ( $free_tkt_count > 0 ) { |
|
356 | + update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
357 | + } |
|
334 | 358 | |
335 | 359 | //paidtktcount |
336 | 360 | $_where = array( 'TKT_price' => array('>', 0) ); |
337 | 361 | $paid_tkt_count = $TKT->count( array( $_where ) ); |
338 | - if ( $paid_tkt_count > 0 ) |
|
339 | - update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
362 | + if ( $paid_tkt_count > 0 ) { |
|
363 | + update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
364 | + } |
|
340 | 365 | |
341 | 366 | //tktsold |
342 | 367 | $tkt_sold = $TKT->sum( array(), 'TKT_sold' ); |
343 | - if( $tkt_sold > 0 ) |
|
344 | - update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
368 | + if( $tkt_sold > 0 ) { |
|
369 | + update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
370 | + } |
|
345 | 371 | |
346 | 372 | |
347 | 373 | set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
3 | 3 | |
4 | 4 | use EventEspresso\core\interfaces\InterminableInterface; |
5 | 5 | use EventEspresso\core\interfaces\ResettableInterface; |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | * @param \EE_Dependency_Map $dependency_map |
184 | 184 | * @return \EE_Registry instance |
185 | 185 | */ |
186 | - public static function instance( \EE_Dependency_Map $dependency_map = null ) { |
|
186 | + public static function instance(\EE_Dependency_Map $dependency_map = null) { |
|
187 | 187 | // check if class object is instantiated |
188 | - if ( ! self::$_instance instanceof EE_Registry ) { |
|
189 | - self::$_instance = new EE_Registry( $dependency_map ); |
|
188 | + if ( ! self::$_instance instanceof EE_Registry) { |
|
189 | + self::$_instance = new EE_Registry($dependency_map); |
|
190 | 190 | } |
191 | 191 | return self::$_instance; |
192 | 192 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * @param \EE_Dependency_Map $dependency_map |
202 | 202 | * @return \EE_Registry |
203 | 203 | */ |
204 | - protected function __construct( \EE_Dependency_Map $dependency_map ) { |
|
204 | + protected function __construct(\EE_Dependency_Map $dependency_map) { |
|
205 | 205 | $this->_dependency_map = $dependency_map; |
206 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
206 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -230,19 +230,19 @@ discard block |
||
230 | 230 | $this->modules = new StdClass(); |
231 | 231 | $this->shortcodes = new StdClass(); |
232 | 232 | $this->widgets = new StdClass(); |
233 | - $this->load_core( 'Base', array(), true ); |
|
233 | + $this->load_core('Base', array(), true); |
|
234 | 234 | // add our request and response objects to the cache |
235 | - $request_loader = $this->_dependency_map->class_loader( 'EE_Request' ); |
|
235 | + $request_loader = $this->_dependency_map->class_loader('EE_Request'); |
|
236 | 236 | $this->_set_cached_class( |
237 | 237 | $request_loader(), |
238 | 238 | 'EE_Request' |
239 | 239 | ); |
240 | - $response_loader = $this->_dependency_map->class_loader( 'EE_Response' ); |
|
240 | + $response_loader = $this->_dependency_map->class_loader('EE_Response'); |
|
241 | 241 | $this->_set_cached_class( |
242 | 242 | $response_loader(), |
243 | 243 | 'EE_Response' |
244 | 244 | ); |
245 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) ); |
|
245 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function init() { |
257 | 257 | // Get current page protocol |
258 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
258 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
259 | 259 | // Output admin-ajax.php URL with same protocol as current page |
260 | - self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol ); |
|
261 | - self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false; |
|
260 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
261 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | * @return string |
270 | 270 | */ |
271 | 271 | public static function localize_i18n_js_strings() { |
272 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
273 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
274 | - if ( is_scalar( $value ) ) { |
|
275 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
272 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
273 | + foreach ($i18n_js_strings as $key => $value) { |
|
274 | + if (is_scalar($value)) { |
|
275 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
279 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | /** |
285 | 285 | * @param mixed string | EED_Module $module |
286 | 286 | */ |
287 | - public function add_module( $module ) { |
|
288 | - if ( $module instanceof EED_Module ) { |
|
289 | - $module_class = get_class( $module ); |
|
287 | + public function add_module($module) { |
|
288 | + if ($module instanceof EED_Module) { |
|
289 | + $module_class = get_class($module); |
|
290 | 290 | $this->modules->{$module_class} = $module; |
291 | 291 | } else { |
292 | - if ( ! class_exists( 'EE_Module_Request_Router' ) ) { |
|
293 | - $this->load_core( 'Module_Request_Router' ); |
|
292 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
293 | + $this->load_core('Module_Request_Router'); |
|
294 | 294 | } |
295 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
295 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | * @param string $module_name |
303 | 303 | * @return mixed EED_Module | NULL |
304 | 304 | */ |
305 | - public function get_module( $module_name = '' ) { |
|
306 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
305 | + public function get_module($module_name = '') { |
|
306 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | |
@@ -317,20 +317,20 @@ discard block |
||
317 | 317 | * @param bool $load_only |
318 | 318 | * @return mixed |
319 | 319 | */ |
320 | - public function load_core( $class_name, $arguments = array(), $load_only = false ) { |
|
320 | + public function load_core($class_name, $arguments = array(), $load_only = false) { |
|
321 | 321 | $core_paths = apply_filters( |
322 | 322 | 'FHEE__EE_Registry__load_core__core_paths', |
323 | 323 | array( |
324 | 324 | EE_CORE, |
325 | 325 | EE_ADMIN, |
326 | 326 | EE_CPTS, |
327 | - EE_CORE . 'data_migration_scripts' . DS, |
|
328 | - EE_CORE . 'request_stack' . DS, |
|
329 | - EE_CORE . 'middleware' . DS, |
|
327 | + EE_CORE.'data_migration_scripts'.DS, |
|
328 | + EE_CORE.'request_stack'.DS, |
|
329 | + EE_CORE.'middleware'.DS, |
|
330 | 330 | ) |
331 | 331 | ); |
332 | 332 | // retrieve instantiated class |
333 | - return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only ); |
|
333 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | |
@@ -344,15 +344,15 @@ discard block |
||
344 | 344 | * @param bool $load_only |
345 | 345 | * @return mixed |
346 | 346 | */ |
347 | - public function load_service( $class_name, $arguments = array(), $load_only = false ) { |
|
347 | + public function load_service($class_name, $arguments = array(), $load_only = false) { |
|
348 | 348 | $service_paths = apply_filters( |
349 | 349 | 'FHEE__EE_Registry__load_service__service_paths', |
350 | 350 | array( |
351 | - EE_CORE . 'services' . DS, |
|
351 | + EE_CORE.'services'.DS, |
|
352 | 352 | ) |
353 | 353 | ); |
354 | 354 | // retrieve instantiated class |
355 | - return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only ); |
|
355 | + return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | * @param mixed $arguments |
366 | 366 | * @return EE_Data_Migration_Script_Base |
367 | 367 | */ |
368 | - public function load_dms( $class_name, $arguments = array() ) { |
|
368 | + public function load_dms($class_name, $arguments = array()) { |
|
369 | 369 | // retrieve instantiated class |
370 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false ); |
|
370 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
383 | 383 | * @return EE_Base_Class | bool |
384 | 384 | */ |
385 | - public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) { |
|
386 | - $paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array( |
|
385 | + public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) { |
|
386 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
387 | 387 | EE_CORE, |
388 | 388 | EE_CLASSES, |
389 | 389 | EE_BUSINESS |
390 | - ) ); |
|
390 | + )); |
|
391 | 391 | // retrieve instantiated class |
392 | - return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
392 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -402,11 +402,11 @@ discard block |
||
402 | 402 | * @param bool $load_only |
403 | 403 | * @return EEH_Base | bool |
404 | 404 | */ |
405 | - public function load_helper( $class_name, $arguments = array(), $load_only = true ) { |
|
405 | + public function load_helper($class_name, $arguments = array(), $load_only = true) { |
|
406 | 406 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
407 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) ); |
|
407 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
408 | 408 | // retrieve instantiated class |
409 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only ); |
|
409 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | |
@@ -421,16 +421,16 @@ discard block |
||
421 | 421 | * @param bool $cache whether to cache the object or not. |
422 | 422 | * @return mixed |
423 | 423 | */ |
424 | - public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) { |
|
424 | + public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) { |
|
425 | 425 | $paths = array( |
426 | 426 | EE_LIBRARIES, |
427 | - EE_LIBRARIES . 'messages' . DS, |
|
428 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
429 | - EE_LIBRARIES . 'qtips' . DS, |
|
430 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
427 | + EE_LIBRARIES.'messages'.DS, |
|
428 | + EE_LIBRARIES.'shortcodes'.DS, |
|
429 | + EE_LIBRARIES.'qtips'.DS, |
|
430 | + EE_LIBRARIES.'payment_methods'.DS, |
|
431 | 431 | ); |
432 | 432 | // retrieve instantiated class |
433 | - return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only ); |
|
433 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | * @param bool $load_only |
444 | 444 | * @return EEM_Base | bool |
445 | 445 | */ |
446 | - public function load_model( $class_name, $arguments = array(), $load_only = false ) { |
|
447 | - $paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array( |
|
446 | + public function load_model($class_name, $arguments = array(), $load_only = false) { |
|
447 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
448 | 448 | EE_MODELS, |
449 | 449 | EE_CORE |
450 | - ) ); |
|
450 | + )); |
|
451 | 451 | // retrieve instantiated class |
452 | - return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only ); |
|
452 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | |
@@ -462,15 +462,15 @@ discard block |
||
462 | 462 | * @param bool $load_only |
463 | 463 | * @return mixed | bool |
464 | 464 | */ |
465 | - public function load_model_class( $class_name, $arguments = array(), $load_only = true ) { |
|
465 | + public function load_model_class($class_name, $arguments = array(), $load_only = true) { |
|
466 | 466 | $paths = array( |
467 | - EE_MODELS . 'fields' . DS, |
|
468 | - EE_MODELS . 'helpers' . DS, |
|
469 | - EE_MODELS . 'relations' . DS, |
|
470 | - EE_MODELS . 'strategies' . DS |
|
467 | + EE_MODELS.'fields'.DS, |
|
468 | + EE_MODELS.'helpers'.DS, |
|
469 | + EE_MODELS.'relations'.DS, |
|
470 | + EE_MODELS.'strategies'.DS |
|
471 | 471 | ); |
472 | 472 | // retrieve instantiated class |
473 | - return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only ); |
|
473 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
481 | 481 | * @return boolean |
482 | 482 | */ |
483 | - public function is_model_name( $model_name ) { |
|
484 | - return isset( $this->models[ $model_name ] ) ? true : false; |
|
483 | + public function is_model_name($model_name) { |
|
484 | + return isset($this->models[$model_name]) ? true : false; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | * @param bool $load_only |
497 | 497 | * @return mixed |
498 | 498 | */ |
499 | - public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) { |
|
499 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) { |
|
500 | 500 | // retrieve instantiated class |
501 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only ); |
|
501 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | * @param bool $load_only |
514 | 514 | * @return EE_Addon |
515 | 515 | */ |
516 | - public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) { |
|
516 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) { |
|
517 | 517 | // retrieve instantiated class |
518 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only ); |
|
518 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -546,46 +546,46 @@ discard block |
||
546 | 546 | $load_only = false |
547 | 547 | ) { |
548 | 548 | // strip php file extension |
549 | - $class_name = str_replace( '.php', '', trim( $class_name ) ); |
|
549 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
550 | 550 | // does the class have a prefix ? |
551 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
551 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
552 | 552 | // make sure $class_prefix is uppercase |
553 | - $class_prefix = strtoupper( trim( $class_prefix ) ); |
|
553 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
554 | 554 | // add class prefix ONCE!!! |
555 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
555 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
556 | 556 | } |
557 | - $class_exists = class_exists( $class_name ); |
|
557 | + $class_exists = class_exists($class_name); |
|
558 | 558 | // if we're only loading the class and it already exists, then let's just return true immediately |
559 | - if ( $load_only && $class_exists ) { |
|
559 | + if ($load_only && $class_exists) { |
|
560 | 560 | return true; |
561 | 561 | } |
562 | 562 | // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection |
563 | 563 | // $cache is controlled by individual calls to separate Registry loader methods like load_class() |
564 | 564 | // $load_only is also controlled by individual calls to separate Registry loader methods like load_file() |
565 | - if ( $this->_cache_on && $cache && ! $load_only ) { |
|
565 | + if ($this->_cache_on && $cache && ! $load_only) { |
|
566 | 566 | // return object if it's already cached |
567 | - $cached_class = $this->_get_cached_class( $class_name, $class_prefix ); |
|
568 | - if ( $cached_class !== null ) { |
|
567 | + $cached_class = $this->_get_cached_class($class_name, $class_prefix); |
|
568 | + if ($cached_class !== null) { |
|
569 | 569 | return $cached_class; |
570 | 570 | } |
571 | 571 | } |
572 | 572 | // if the class doesn't already exist.. then we need to try and find the file and load it |
573 | - if ( ! $class_exists ) { |
|
573 | + if ( ! $class_exists) { |
|
574 | 574 | // get full path to file |
575 | - $path = $this->_resolve_path( $class_name, $type, $file_paths ); |
|
575 | + $path = $this->_resolve_path($class_name, $type, $file_paths); |
|
576 | 576 | // load the file |
577 | - $loaded = $this->_require_file( $path, $class_name, $type, $file_paths ); |
|
577 | + $loaded = $this->_require_file($path, $class_name, $type, $file_paths); |
|
578 | 578 | // if loading failed, or we are only loading a file but NOT instantiating an object |
579 | - if ( ! $loaded || $load_only ) { |
|
579 | + if ( ! $loaded || $load_only) { |
|
580 | 580 | // return boolean if only loading, or null if an object was expected |
581 | 581 | return $load_only ? $loaded : null; |
582 | 582 | } |
583 | 583 | } |
584 | 584 | // instantiate the requested object |
585 | - $class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db ); |
|
586 | - if ( $this->_cache_on && $cache ) { |
|
585 | + $class_obj = $this->_create_object($class_name, $arguments, $type, $from_db); |
|
586 | + if ($this->_cache_on && $cache) { |
|
587 | 587 | // save it for later... kinda like gum { : $ |
588 | - $this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db ); |
|
588 | + $this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db); |
|
589 | 589 | } |
590 | 590 | $this->_cache_on = true; |
591 | 591 | return $class_obj; |
@@ -608,24 +608,24 @@ discard block |
||
608 | 608 | * @param string $class_prefix |
609 | 609 | * @return null|object |
610 | 610 | */ |
611 | - protected function _get_cached_class( $class_name, $class_prefix = '' ) { |
|
612 | - if ( $class_name === 'EE_Registry' ) { |
|
611 | + protected function _get_cached_class($class_name, $class_prefix = '') { |
|
612 | + if ($class_name === 'EE_Registry') { |
|
613 | 613 | return $this; |
614 | 614 | } |
615 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
616 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
615 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
616 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
617 | 617 | } else { |
618 | 618 | // have to specify something, but not anything that will conflict |
619 | 619 | $class_abbreviation = 'FANCY_BATMAN_PANTS'; |
620 | 620 | } |
621 | 621 | // check if class has already been loaded, and return it if it has been |
622 | - if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) { |
|
622 | + if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) { |
|
623 | 623 | return $this->{$class_abbreviation}; |
624 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
624 | + } else if (isset ($this->{$class_name} )) { |
|
625 | 625 | return $this->{$class_name}; |
626 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
626 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
627 | 627 | return $this->LIB->{$class_name}; |
628 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
628 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
629 | 629 | return $this->addons->{$class_name}; |
630 | 630 | } |
631 | 631 | return null; |
@@ -646,20 +646,20 @@ discard block |
||
646 | 646 | * @param array $file_paths |
647 | 647 | * @return string | bool |
648 | 648 | */ |
649 | - protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) { |
|
649 | + protected function _resolve_path($class_name, $type = '', $file_paths = array()) { |
|
650 | 650 | // make sure $file_paths is an array |
651 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
651 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
652 | 652 | // cycle thru paths |
653 | - foreach ( $file_paths as $key => $file_path ) { |
|
653 | + foreach ($file_paths as $key => $file_path) { |
|
654 | 654 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
655 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
655 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
656 | 656 | // prep file type |
657 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
657 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
658 | 658 | // build full file path |
659 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
659 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
660 | 660 | //does the file exist and can be read ? |
661 | - if ( is_readable( $file_paths[ $key ] ) ) { |
|
662 | - return $file_paths[ $key ]; |
|
661 | + if (is_readable($file_paths[$key])) { |
|
662 | + return $file_paths[$key]; |
|
663 | 663 | } |
664 | 664 | } |
665 | 665 | return false; |
@@ -681,29 +681,29 @@ discard block |
||
681 | 681 | * @return boolean |
682 | 682 | * @throws \EE_Error |
683 | 683 | */ |
684 | - protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) { |
|
684 | + protected function _require_file($path, $class_name, $type = '', $file_paths = array()) { |
|
685 | 685 | // don't give up! you gotta... |
686 | 686 | try { |
687 | 687 | //does the file exist and can it be read ? |
688 | - if ( ! $path ) { |
|
688 | + if ( ! $path) { |
|
689 | 689 | // so sorry, can't find the file |
690 | - throw new EE_Error ( |
|
690 | + throw new EE_Error( |
|
691 | 691 | sprintf( |
692 | - __( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ), |
|
693 | - trim( $type, '.' ), |
|
692 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
693 | + trim($type, '.'), |
|
694 | 694 | $class_name, |
695 | - '<br />' . implode( ',<br />', $file_paths ) |
|
695 | + '<br />'.implode(',<br />', $file_paths) |
|
696 | 696 | ) |
697 | 697 | ); |
698 | 698 | } |
699 | 699 | // get the file |
700 | - require_once( $path ); |
|
700 | + require_once($path); |
|
701 | 701 | // if the class isn't already declared somewhere |
702 | - if ( class_exists( $class_name, false ) === false ) { |
|
702 | + if (class_exists($class_name, false) === false) { |
|
703 | 703 | // so sorry, not a class |
704 | 704 | throw new EE_Error( |
705 | 705 | sprintf( |
706 | - __( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ), |
|
706 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
707 | 707 | $type, |
708 | 708 | $path, |
709 | 709 | $class_name |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | ); |
712 | 712 | } |
713 | 713 | |
714 | - } catch ( EE_Error $e ) { |
|
714 | + } catch (EE_Error $e) { |
|
715 | 715 | $e->get_error(); |
716 | 716 | return false; |
717 | 717 | } |
@@ -743,55 +743,55 @@ discard block |
||
743 | 743 | * @return null | object |
744 | 744 | * @throws \EE_Error |
745 | 745 | */ |
746 | - protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) { |
|
746 | + protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) { |
|
747 | 747 | $class_obj = null; |
748 | 748 | // don't give up! you gotta... |
749 | 749 | try { |
750 | 750 | // create reflection |
751 | - $reflector = $this->get_ReflectionClass( $class_name ); |
|
751 | + $reflector = $this->get_ReflectionClass($class_name); |
|
752 | 752 | // make sure arguments are an array |
753 | - $arguments = is_array( $arguments ) ? $arguments : array( $arguments ); |
|
753 | + $arguments = is_array($arguments) ? $arguments : array($arguments); |
|
754 | 754 | // and if arguments array is numerically and sequentially indexed, then we want it to remain as is, |
755 | 755 | // else wrap it in an additional array so that it doesn't get split into multiple parameters |
756 | - $arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments ) |
|
756 | + $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments) |
|
757 | 757 | ? $arguments |
758 | - : array( $arguments ); |
|
758 | + : array($arguments); |
|
759 | 759 | // attempt to inject dependencies ? |
760 | - if ( $this->_dependency_map->has( $class_name ) ) { |
|
761 | - $arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments ); |
|
760 | + if ($this->_dependency_map->has($class_name)) { |
|
761 | + $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments); |
|
762 | 762 | } |
763 | 763 | // instantiate the class and add to the LIB array for tracking |
764 | 764 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
765 | - if ( $reflector->getConstructor() === null || $reflector->isAbstract() ) { |
|
765 | + if ($reflector->getConstructor() === null || $reflector->isAbstract()) { |
|
766 | 766 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
767 | 767 | //$instantiation_mode = "no constructor"; |
768 | 768 | $class_obj = true; |
769 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
769 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
770 | 770 | //$instantiation_mode = "new_instance_from_db"; |
771 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
772 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
771 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
772 | + } else if (method_exists($class_name, 'new_instance')) { |
|
773 | 773 | //$instantiation_mode = "new_instance"; |
774 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
775 | - } else if ( method_exists( $class_name, 'instance' ) ) { |
|
774 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
775 | + } else if (method_exists($class_name, 'instance')) { |
|
776 | 776 | //$instantiation_mode = "instance"; |
777 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
778 | - } else if ( $reflector->isInstantiable() ) { |
|
777 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
778 | + } else if ($reflector->isInstantiable()) { |
|
779 | 779 | //$instantiation_mode = "isInstantiable"; |
780 | - $class_obj = $reflector->newInstanceArgs( $arguments ); |
|
780 | + $class_obj = $reflector->newInstanceArgs($arguments); |
|
781 | 781 | } else { |
782 | 782 | // heh ? something's not right ! |
783 | 783 | //$instantiation_mode = 'none'; |
784 | 784 | throw new EE_Error( |
785 | 785 | sprintf( |
786 | - __( 'The %s file %s could not be instantiated.', 'event_espresso' ), |
|
786 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
787 | 787 | $type, |
788 | 788 | $class_name |
789 | 789 | ) |
790 | 790 | ); |
791 | 791 | } |
792 | - } catch ( Exception $e ) { |
|
793 | - if ( ! $e instanceof EE_Error ) { |
|
794 | - $e = new EE_Error( $e->getMessage() ); |
|
792 | + } catch (Exception $e) { |
|
793 | + if ( ! $e instanceof EE_Error) { |
|
794 | + $e = new EE_Error($e->getMessage()); |
|
795 | 795 | } |
796 | 796 | $e->get_error(); |
797 | 797 | } |
@@ -805,8 +805,8 @@ discard block |
||
805 | 805 | * @param array $array |
806 | 806 | * @return bool |
807 | 807 | */ |
808 | - protected function _array_is_numerically_and_sequentially_indexed( array $array ) { |
|
809 | - return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true; |
|
808 | + protected function _array_is_numerically_and_sequentially_indexed(array $array) { |
|
809 | + return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | |
@@ -821,14 +821,14 @@ discard block |
||
821 | 821 | * @param string $class_name |
822 | 822 | * @return ReflectionClass |
823 | 823 | */ |
824 | - public function get_ReflectionClass( $class_name ) { |
|
824 | + public function get_ReflectionClass($class_name) { |
|
825 | 825 | if ( |
826 | - ! isset( $this->_reflectors[ $class_name ] ) |
|
827 | - || ! $this->_reflectors[ $class_name ] instanceof ReflectionClass |
|
826 | + ! isset($this->_reflectors[$class_name]) |
|
827 | + || ! $this->_reflectors[$class_name] instanceof ReflectionClass |
|
828 | 828 | ) { |
829 | - $this->_reflectors[ $class_name ] = new ReflectionClass( $class_name ); |
|
829 | + $this->_reflectors[$class_name] = new ReflectionClass($class_name); |
|
830 | 830 | } |
831 | - return $this->_reflectors[ $class_name ]; |
|
831 | + return $this->_reflectors[$class_name]; |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -853,45 +853,45 @@ discard block |
||
853 | 853 | * @param array $arguments |
854 | 854 | * @return array |
855 | 855 | */ |
856 | - protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) { |
|
856 | + protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) { |
|
857 | 857 | // let's examine the constructor |
858 | 858 | $constructor = $reflector->getConstructor(); |
859 | 859 | // whu? huh? nothing? |
860 | - if ( ! $constructor ) { |
|
860 | + if ( ! $constructor) { |
|
861 | 861 | return $arguments; |
862 | 862 | } |
863 | 863 | // get constructor parameters |
864 | 864 | $params = $constructor->getParameters(); |
865 | 865 | // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected |
866 | - $argument_keys = array_keys( $arguments ); |
|
866 | + $argument_keys = array_keys($arguments); |
|
867 | 867 | // now loop thru all of the constructors expected parameters |
868 | - foreach ( $params as $index => $param ) { |
|
868 | + foreach ($params as $index => $param) { |
|
869 | 869 | // is this a dependency for a specific class ? |
870 | 870 | $param_class = $param->getClass() ? $param->getClass()->name : null; |
871 | 871 | if ( |
872 | 872 | // param is not even a class |
873 | - empty( $param_class ) |
|
873 | + empty($param_class) |
|
874 | 874 | // and something already exists in the incoming arguments for this param |
875 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
875 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
876 | 876 | ) { |
877 | 877 | // so let's skip this argument and move on to the next |
878 | 878 | continue; |
879 | 879 | } else if ( |
880 | 880 | // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class |
881 | - ! empty( $param_class ) |
|
882 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
883 | - && $arguments[ $argument_keys[ $index ] ] instanceof $param_class |
|
881 | + ! empty($param_class) |
|
882 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
883 | + && $arguments[$argument_keys[$index]] instanceof $param_class |
|
884 | 884 | ) { |
885 | 885 | // skip this argument and move on to the next |
886 | 886 | continue; |
887 | 887 | } else if ( |
888 | 888 | // parameter is type hinted as a class, and should be injected |
889 | - ! empty( $param_class ) |
|
890 | - && $this->_dependency_map->has_dependency_for_class( $class_name, $param_class ) |
|
889 | + ! empty($param_class) |
|
890 | + && $this->_dependency_map->has_dependency_for_class($class_name, $param_class) |
|
891 | 891 | ) { |
892 | - $arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index ); |
|
892 | + $arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index); |
|
893 | 893 | } else { |
894 | - $arguments[ $index ] = $param->getDefaultValue(); |
|
894 | + $arguments[$index] = $param->getDefaultValue(); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | * @param mixed $index |
909 | 909 | * @return array |
910 | 910 | */ |
911 | - protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) { |
|
911 | + protected function _resolve_dependency($class_name, $param_class, $arguments, $index) { |
|
912 | 912 | $dependency = null; |
913 | 913 | // should dependency be loaded from cache ? |
914 | 914 | $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency( |
@@ -918,30 +918,30 @@ discard block |
||
918 | 918 | : false; |
919 | 919 | // we might have a dependency... |
920 | 920 | // let's MAYBE try and find it in our cache if that's what's been requested |
921 | - $cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null; |
|
921 | + $cached_class = $cache_on ? $this->_get_cached_class($param_class) : null; |
|
922 | 922 | // and grab it if it exists |
923 | - if ( $cached_class instanceof $param_class ) { |
|
923 | + if ($cached_class instanceof $param_class) { |
|
924 | 924 | $dependency = $cached_class; |
925 | - } else if ( $param_class != $class_name ) { |
|
925 | + } else if ($param_class != $class_name) { |
|
926 | 926 | // obtain the loader method from the dependency map |
927 | - $loader = $this->_dependency_map->class_loader( $param_class ); |
|
927 | + $loader = $this->_dependency_map->class_loader($param_class); |
|
928 | 928 | // is loader a custom closure ? |
929 | - if ( $loader instanceof Closure ) { |
|
929 | + if ($loader instanceof Closure) { |
|
930 | 930 | $dependency = $loader(); |
931 | 931 | } else { |
932 | 932 | // set the cache on property for the recursive loading call |
933 | 933 | $this->_cache_on = $cache_on; |
934 | 934 | // if not, then let's try and load it via the registry |
935 | - $dependency = $this->{$loader}( $param_class ); |
|
935 | + $dependency = $this->{$loader}($param_class); |
|
936 | 936 | } |
937 | 937 | } |
938 | 938 | // did we successfully find the correct dependency ? |
939 | - if ( $dependency instanceof $param_class ) { |
|
939 | + if ($dependency instanceof $param_class) { |
|
940 | 940 | // then let's inject it into the incoming array of arguments at the correct location |
941 | - if ( isset( $argument_keys[ $index ] ) ) { |
|
942 | - $arguments[ $argument_keys[ $index ] ] = $dependency; |
|
941 | + if (isset($argument_keys[$index])) { |
|
942 | + $arguments[$argument_keys[$index]] = $dependency; |
|
943 | 943 | } else { |
944 | - $arguments[ $index ] = $dependency; |
|
944 | + $arguments[$index] = $dependency; |
|
945 | 945 | } |
946 | 946 | } |
947 | 947 | return $arguments; |
@@ -966,19 +966,19 @@ discard block |
||
966 | 966 | * @param bool $from_db |
967 | 967 | * @return void |
968 | 968 | */ |
969 | - protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) { |
|
970 | - if ( $class_name === 'EE_Registry' ) { |
|
969 | + protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) { |
|
970 | + if ($class_name === 'EE_Registry') { |
|
971 | 971 | return; |
972 | 972 | } |
973 | 973 | // return newly instantiated class |
974 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
975 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
974 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
975 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
976 | 976 | $this->{$class_abbreviation} = $class_obj; |
977 | - } else if ( property_exists( $this, $class_name ) ) { |
|
977 | + } else if (property_exists($this, $class_name)) { |
|
978 | 978 | $this->{$class_name} = $class_obj; |
979 | - } else if ( $class_prefix == 'addon' ) { |
|
979 | + } else if ($class_prefix == 'addon') { |
|
980 | 980 | $this->addons->{$class_name} = $class_obj; |
981 | - } else if ( ! $from_db ) { |
|
981 | + } else if ( ! $from_db) { |
|
982 | 982 | $this->LIB->{$class_name} = $class_obj; |
983 | 983 | } |
984 | 984 | } |
@@ -995,12 +995,12 @@ discard block |
||
995 | 995 | * @param array $arguments |
996 | 996 | * @return object |
997 | 997 | */ |
998 | - public static function factory( $classname, $arguments = array() ) { |
|
999 | - $loader = self::instance()->_dependency_map->class_loader( $classname ); |
|
1000 | - if ( $loader instanceof Closure ) { |
|
1001 | - return $loader( $arguments ); |
|
1002 | - } else if ( method_exists( EE_Registry::instance(), $loader ) ) { |
|
1003 | - return EE_Registry::instance()->{$loader}( $classname, $arguments ); |
|
998 | + public static function factory($classname, $arguments = array()) { |
|
999 | + $loader = self::instance()->_dependency_map->class_loader($classname); |
|
1000 | + if ($loader instanceof Closure) { |
|
1001 | + return $loader($arguments); |
|
1002 | + } else if (method_exists(EE_Registry::instance(), $loader)) { |
|
1003 | + return EE_Registry::instance()->{$loader}($classname, $arguments); |
|
1004 | 1004 | } |
1005 | 1005 | return null; |
1006 | 1006 | } |
@@ -1013,9 +1013,9 @@ discard block |
||
1013 | 1013 | * @param string $name |
1014 | 1014 | * @return EE_Addon |
1015 | 1015 | */ |
1016 | - public function get_addon_by_name( $name ) { |
|
1017 | - foreach ( $this->addons as $addon ) { |
|
1018 | - if ( $addon->name() == $name ) { |
|
1016 | + public function get_addon_by_name($name) { |
|
1017 | + foreach ($this->addons as $addon) { |
|
1018 | + if ($addon->name() == $name) { |
|
1019 | 1019 | return $addon; |
1020 | 1020 | } |
1021 | 1021 | } |
@@ -1031,8 +1031,8 @@ discard block |
||
1031 | 1031 | */ |
1032 | 1032 | public function get_addons_by_name() { |
1033 | 1033 | $addons = array(); |
1034 | - foreach ( $this->addons as $addon ) { |
|
1035 | - $addons[ $addon->name() ] = $addon; |
|
1034 | + foreach ($this->addons as $addon) { |
|
1035 | + $addons[$addon->name()] = $addon; |
|
1036 | 1036 | } |
1037 | 1037 | return $addons; |
1038 | 1038 | } |
@@ -1047,14 +1047,14 @@ discard block |
||
1047 | 1047 | * @return \EEM_Base |
1048 | 1048 | * @throws \EE_Error |
1049 | 1049 | */ |
1050 | - public function reset_model( $model_name ) { |
|
1051 | - $model = $this->load_model( $model_name ); |
|
1052 | - $model_class_name = get_class( $model ); |
|
1050 | + public function reset_model($model_name) { |
|
1051 | + $model = $this->load_model($model_name); |
|
1052 | + $model_class_name = get_class($model); |
|
1053 | 1053 | //get that model reset it and make sure we nuke the old reference to it |
1054 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
1054 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
1055 | 1055 | $this->LIB->{$model_class_name} = $model::reset(); |
1056 | 1056 | } else { |
1057 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
1057 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
1058 | 1058 | } |
1059 | 1059 | return $this->LIB->{$model_class_name}; |
1060 | 1060 | } |
@@ -1092,19 +1092,19 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return EE_Registry |
1094 | 1094 | */ |
1095 | - public static function reset( $hard = false, $reinstantiate = true, $reset_models = true ) { |
|
1095 | + public static function reset($hard = false, $reinstantiate = true, $reset_models = true) { |
|
1096 | 1096 | $instance = self::instance(); |
1097 | 1097 | $instance->_cache_on = true; |
1098 | 1098 | // reset some "special" classes |
1099 | 1099 | EEH_Activation::reset(); |
1100 | - $instance->CFG = $instance->CFG->reset( $hard, $reinstantiate ); |
|
1100 | + $instance->CFG = $instance->CFG->reset($hard, $reinstantiate); |
|
1101 | 1101 | $instance->CART = null; |
1102 | 1102 | $instance->MRM = null; |
1103 | 1103 | //handle of objects cached on LIB |
1104 | - foreach ( array( 'LIB', 'modules', 'shortcodes' ) as $cache ) { |
|
1105 | - foreach ( $instance->{$cache} as $class_name => $class ) { |
|
1106 | - if ( EE_Registry::_reset_and_unset_object( $class, $reset_models )) { |
|
1107 | - unset( $instance->{$cache}->{$class_name} ); |
|
1104 | + foreach (array('LIB', 'modules', 'shortcodes') as $cache) { |
|
1105 | + foreach ($instance->{$cache} as $class_name => $class) { |
|
1106 | + if (EE_Registry::_reset_and_unset_object($class, $reset_models)) { |
|
1107 | + unset($instance->{$cache}->{$class_name} ); |
|
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | } |
@@ -1122,12 +1122,12 @@ discard block |
||
1122 | 1122 | * @param bool $reset_models |
1123 | 1123 | * @return bool returns true if cached object should be unset |
1124 | 1124 | */ |
1125 | - private static function _reset_and_unset_object( $object, $reset_models ) { |
|
1125 | + private static function _reset_and_unset_object($object, $reset_models) { |
|
1126 | 1126 | static $count = 0; |
1127 | 1127 | $count++; |
1128 | - if ( $object instanceof ResettableInterface ) { |
|
1129 | - if ( $object instanceof EEM_Base ) { |
|
1130 | - if ( $reset_models ) { |
|
1128 | + if ($object instanceof ResettableInterface) { |
|
1129 | + if ($object instanceof EEM_Base) { |
|
1130 | + if ($reset_models) { |
|
1131 | 1131 | $object->reset(); |
1132 | 1132 | } |
1133 | 1133 | return false; |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | $object->reset(); |
1136 | 1136 | return false; |
1137 | 1137 | } |
1138 | - if ( ! $object instanceof InterminableInterface ) { |
|
1138 | + if ( ! $object instanceof InterminableInterface) { |
|
1139 | 1139 | return true; |
1140 | 1140 | } |
1141 | 1141 | return false; |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | * @param $a |
1157 | 1157 | * @param $b |
1158 | 1158 | */ |
1159 | - final function __call( $a, $b ) { |
|
1159 | + final function __call($a, $b) { |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | /** |
1165 | 1165 | * @param $a |
1166 | 1166 | */ |
1167 | - final function __get( $a ) { |
|
1167 | + final function __get($a) { |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | * @param $a |
1174 | 1174 | * @param $b |
1175 | 1175 | */ |
1176 | - final function __set( $a, $b ) { |
|
1176 | + final function __set($a, $b) { |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | /** |
1182 | 1182 | * @param $a |
1183 | 1183 | */ |
1184 | - final function __isset( $a ) { |
|
1184 | + final function __isset($a) { |
|
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | /** |
1190 | 1190 | * @param $a |
1191 | 1191 | */ |
1192 | - final function __unset( $a ) { |
|
1192 | + final function __unset($a) { |
|
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | * @param $a |
1237 | 1237 | * @param $b |
1238 | 1238 | */ |
1239 | - final static function __callStatic( $a, $b ) { |
|
1239 | + final static function __callStatic($a, $b) { |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | /** |
@@ -1245,9 +1245,9 @@ discard block |
||
1245 | 1245 | */ |
1246 | 1246 | public function cpt_models() { |
1247 | 1247 | $cpt_models = array(); |
1248 | - foreach( $this->non_abstract_db_models as $short_name => $classname ) { |
|
1249 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
1250 | - $cpt_models[ $short_name ] = $classname; |
|
1248 | + foreach ($this->non_abstract_db_models as $short_name => $classname) { |
|
1249 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
1250 | + $cpt_models[$short_name] = $classname; |
|
1251 | 1251 | } |
1252 | 1252 | } |
1253 | 1253 | return $cpt_models; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | 4 | /** |
5 | 5 | * Event Espresso |
6 | 6 | * |
@@ -63,31 +63,31 @@ discard block |
||
63 | 63 | * @param WP_Query $WP_Query |
64 | 64 | * @return string | NULL |
65 | 65 | */ |
66 | - public function get_route( WP_Query $WP_Query ) { |
|
66 | + public function get_route(WP_Query $WP_Query) { |
|
67 | 67 | $this->WP_Query = $WP_Query; |
68 | 68 | // assume this if first route being called |
69 | 69 | $previous_route = FALSE; |
70 | 70 | // but is it really ??? |
71 | - if ( ! empty( self::$_previous_routes )) { |
|
71 | + if ( ! empty(self::$_previous_routes)) { |
|
72 | 72 | // get last run route |
73 | - $previous_routes = array_values( self::$_previous_routes ); |
|
74 | - $previous_route = array_pop( $previous_routes ); |
|
73 | + $previous_routes = array_values(self::$_previous_routes); |
|
74 | + $previous_route = array_pop($previous_routes); |
|
75 | 75 | } |
76 | 76 | // has another route already been run ? |
77 | - if ( $previous_route ) { |
|
77 | + if ($previous_route) { |
|
78 | 78 | // check if forwarding has been set |
79 | - $current_route = $this->get_forward( $previous_route ); |
|
79 | + $current_route = $this->get_forward($previous_route); |
|
80 | 80 | try { |
81 | 81 | //check for recursive forwarding |
82 | - if ( isset( self::$_previous_routes[ $current_route ] )) { |
|
82 | + if (isset(self::$_previous_routes[$current_route])) { |
|
83 | 83 | throw new EE_Error( |
84 | 84 | sprintf( |
85 | - __('An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.','event_espresso'), |
|
85 | + __('An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.', 'event_espresso'), |
|
86 | 86 | $current_route |
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | } |
90 | - } catch ( EE_Error $e ) { |
|
90 | + } catch (EE_Error $e) { |
|
91 | 91 | $e->get_error(); |
92 | 92 | return NULL; |
93 | 93 | } |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | // grab all routes |
98 | 98 | $routes = EE_Registry::instance()->CFG->get_routes(); |
99 | 99 | //d( $routes ); |
100 | - foreach( $routes as $key => $route ) { |
|
100 | + foreach ($routes as $key => $route) { |
|
101 | 101 | // check request for module route |
102 | - if ( EE_Registry::instance()->REQ->is_set( $key )) { |
|
102 | + if (EE_Registry::instance()->REQ->is_set($key)) { |
|
103 | 103 | //echo '<b style="color:#2EA2CC;">key : <span style="color:#E76700">' . $key . '</span></b><br />'; |
104 | - $current_route = sanitize_text_field( EE_Registry::instance()->REQ->get( $key )); |
|
105 | - if ( $current_route ) { |
|
106 | - $current_route = array( $key, $current_route ); |
|
104 | + $current_route = sanitize_text_field(EE_Registry::instance()->REQ->get($key)); |
|
105 | + if ($current_route) { |
|
106 | + $current_route = array($key, $current_route); |
|
107 | 107 | //echo '<b style="color:#2EA2CC;">current_route : <span style="color:#E76700">' . $current_route . '</span></b><br />'; |
108 | 108 | break; |
109 | 109 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | } |
113 | 113 | // sorry, but I can't read what you route ! |
114 | - if ( empty( $current_route )) { |
|
114 | + if (empty($current_route)) { |
|
115 | 115 | return NULL; |
116 | 116 | } |
117 | 117 | //add route to previous routes array |
@@ -131,46 +131,46 @@ discard block |
||
131 | 131 | * @param string $current_route |
132 | 132 | * @return mixed EED_Module | boolean |
133 | 133 | */ |
134 | - public function resolve_route( $key, $current_route ) { |
|
134 | + public function resolve_route($key, $current_route) { |
|
135 | 135 | // get module method that route has been mapped to |
136 | - $module_method = EE_Config::get_route( $current_route, $key ); |
|
136 | + $module_method = EE_Config::get_route($current_route, $key); |
|
137 | 137 | //EEH_Debug_Tools::printr( $module_method, '$module_method <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
138 | 138 | // verify result was returned |
139 | - if ( empty( $module_method )) { |
|
140 | - $msg = sprintf( __( 'The requested route %s could not be mapped to any registered modules.', 'event_espresso' ), $current_route ); |
|
141 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
139 | + if (empty($module_method)) { |
|
140 | + $msg = sprintf(__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'), $current_route); |
|
141 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
142 | 142 | return FALSE; |
143 | 143 | } |
144 | 144 | // verify that result is an array |
145 | - if ( ! is_array( $module_method )) { |
|
146 | - $msg = sprintf( __( 'The %s route has not been properly registered.', 'event_espresso' ), $current_route ); |
|
147 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
145 | + if ( ! is_array($module_method)) { |
|
146 | + $msg = sprintf(__('The %s route has not been properly registered.', 'event_espresso'), $current_route); |
|
147 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
148 | 148 | return FALSE; |
149 | 149 | } |
150 | 150 | // grab module name |
151 | 151 | $module_name = $module_method[0]; |
152 | 152 | // verify that a class method was registered properly |
153 | - if ( ! isset( $module_method[1] )) { |
|
154 | - $msg = sprintf( __( 'A class method for the %s route has not been properly registered.', 'event_espresso' ), $current_route ); |
|
155 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
153 | + if ( ! isset($module_method[1])) { |
|
154 | + $msg = sprintf(__('A class method for the %s route has not been properly registered.', 'event_espresso'), $current_route); |
|
155 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
156 | 156 | return FALSE; |
157 | 157 | } |
158 | 158 | // grab method |
159 | 159 | $method = $module_method[1]; |
160 | 160 | // verify that class exists |
161 | - if ( ! class_exists( $module_name )) { |
|
162 | - $msg = sprintf( __( 'The requested %s class could not be found.', 'event_espresso' ), $module_name ); |
|
163 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
161 | + if ( ! class_exists($module_name)) { |
|
162 | + $msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name); |
|
163 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
164 | 164 | return FALSE; |
165 | 165 | } |
166 | 166 | // verify that method exists |
167 | - if ( ! method_exists( $module_name, $method )) { |
|
168 | - $msg = sprintf( __( 'The class method %s for the %s route is in invalid.', 'event_espresso' ), $method, $current_route ); |
|
169 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
167 | + if ( ! method_exists($module_name, $method)) { |
|
168 | + $msg = sprintf(__('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route); |
|
169 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
170 | 170 | return FALSE; |
171 | 171 | } |
172 | 172 | // instantiate module and call route method |
173 | - return $this->_module_router( $module_name, $method ); |
|
173 | + return $this->_module_router($module_name, $method); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | * @param string $module_name |
185 | 185 | * @return EED_Module | NULL |
186 | 186 | */ |
187 | - public static function module_factory( $module_name ) { |
|
188 | - if ( $module_name == 'EED_Module' ) { |
|
189 | - EE_Error::add_error( sprintf( __( 'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
187 | + public static function module_factory($module_name) { |
|
188 | + if ($module_name == 'EED_Module') { |
|
189 | + EE_Error::add_error(sprintf(__('EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__); |
|
190 | 190 | return NULL; |
191 | 191 | } |
192 | 192 | // let's pause to reflect on this... |
193 | - $mod_reflector = new ReflectionClass( $module_name ); |
|
193 | + $mod_reflector = new ReflectionClass($module_name); |
|
194 | 194 | // ensure that class is actually a module |
195 | - if ( ! $mod_reflector->isSubclassOf( 'EED_Module' )) { |
|
196 | - EE_Error::add_error( sprintf( __( 'The requested %s module is not of the class EED_Module.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
195 | + if ( ! $mod_reflector->isSubclassOf('EED_Module')) { |
|
196 | + EE_Error::add_error(sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__); |
|
197 | 197 | return NULL; |
198 | 198 | } |
199 | 199 | // instantiate and return module class |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | * @param string $method |
212 | 212 | * @return EED_Module | NULL |
213 | 213 | */ |
214 | - private function _module_router( $module_name, $method ) { |
|
214 | + private function _module_router($module_name, $method) { |
|
215 | 215 | // instantiate module class |
216 | - $module = EE_Module_Request_Router::module_factory( $module_name ); |
|
217 | - if ( $module instanceof EED_Module ) { |
|
216 | + $module = EE_Module_Request_Router::module_factory($module_name); |
|
217 | + if ($module instanceof EED_Module) { |
|
218 | 218 | // and call whatever action the route was for |
219 | 219 | try { |
220 | - call_user_func( array( $module, $method ), $this->WP_Query ); |
|
221 | - } catch ( EE_Error $e ) { |
|
220 | + call_user_func(array($module, $method), $this->WP_Query); |
|
221 | + } catch (EE_Error $e) { |
|
222 | 222 | $e->get_error(); |
223 | 223 | return NULL; |
224 | 224 | } |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | * @param $current_route |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - public function get_forward( $current_route ) { |
|
239 | - return EE_Config::get_forward( $current_route ); |
|
238 | + public function get_forward($current_route) { |
|
239 | + return EE_Config::get_forward($current_route); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | * @param $current_route |
249 | 249 | * @return string |
250 | 250 | */ |
251 | - public function get_view( $current_route ) { |
|
252 | - return EE_Config::get_view( $current_route ); |
|
251 | + public function get_view($current_route) { |
|
252 | + return EE_Config::get_view($current_route); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param $b |
260 | 260 | * @return bool |
261 | 261 | */ |
262 | - public function __set($a,$b) { return FALSE; } |
|
262 | + public function __set($a, $b) { return FALSE; } |
|
263 | 263 | |
264 | 264 | |
265 | 265 |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | +} |
|
4 | 6 | /** |
5 | 7 | * Event Espresso |
6 | 8 | * |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\ResettableInterface; |
2 | 2 | |
3 | -if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); /** |
|
5 | 5 | * |
6 | 6 | * Event Espresso |
7 | 7 | * |
@@ -69,24 +69,24 @@ discard block |
||
69 | 69 | * @param EE_Session $session |
70 | 70 | * @return \EE_Cart |
71 | 71 | */ |
72 | - public static function instance( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
73 | - if ( ! empty( $grand_total ) ){ |
|
74 | - self::$_instance = new self( $grand_total, $session ); |
|
72 | + public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
73 | + if ( ! empty($grand_total)) { |
|
74 | + self::$_instance = new self($grand_total, $session); |
|
75 | 75 | } |
76 | 76 | // or maybe retrieve an existing one ? |
77 | - if ( ! self::$_instance instanceof EE_Cart ) { |
|
77 | + if ( ! self::$_instance instanceof EE_Cart) { |
|
78 | 78 | // try getting the cart out of the session |
79 | 79 | $saved_cart = $session instanceof EE_Session ? $session->cart() : null; |
80 | - self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self( $grand_total, $session ); |
|
81 | - unset( $saved_cart ); |
|
80 | + self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session); |
|
81 | + unset($saved_cart); |
|
82 | 82 | } |
83 | 83 | // verify that cart is ok and grand total line item exists |
84 | - if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item ) { |
|
85 | - self::$_instance = new self( $grand_total, $session ); |
|
84 | + if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) { |
|
85 | + self::$_instance = new self($grand_total, $session); |
|
86 | 86 | } |
87 | 87 | self::$_instance->get_grand_total(); |
88 | 88 | // once everything is all said and done, save the cart to the EE_Session |
89 | - add_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 ); |
|
89 | + add_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
90 | 90 | return self::$_instance; |
91 | 91 | } |
92 | 92 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | * @param EE_Session $session |
101 | 101 | * @return \EE_Cart |
102 | 102 | */ |
103 | - private function __construct( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
104 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
105 | - $this->set_session( $session ); |
|
106 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
107 | - $this->set_grand_total_line_item( $grand_total ); |
|
103 | + private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
104 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
105 | + $this->set_session($session); |
|
106 | + if ($grand_total instanceof EE_Line_Item) { |
|
107 | + $this->set_grand_total_line_item($grand_total); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | * @param EE_Session $session |
117 | 117 | * @return EE_Cart |
118 | 118 | */ |
119 | - public static function reset( EE_Line_Item $grand_total = null, EE_Session $session = null ) { |
|
120 | - remove_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 ); |
|
121 | - if ( $session instanceof EE_Session ) { |
|
119 | + public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null) { |
|
120 | + remove_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
121 | + if ($session instanceof EE_Session) { |
|
122 | 122 | $session->reset_cart(); |
123 | 123 | } |
124 | 124 | self::$_instance = null; |
125 | - return self::instance( $grand_total, $session ); |
|
125 | + return self::instance($grand_total, $session); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | /** |
131 | 131 | * @param EE_Session $session |
132 | 132 | */ |
133 | - public function set_session( EE_Session $session = null ) { |
|
134 | - $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core( 'Session' ); |
|
133 | + public function set_session(EE_Session $session = null) { |
|
134 | + $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * know the grand total line item on it |
142 | 142 | * @param EE_Line_Item $line_item |
143 | 143 | */ |
144 | - public function set_grand_total_line_item( EE_Line_Item $line_item ) { |
|
144 | + public function set_grand_total_line_item(EE_Line_Item $line_item) { |
|
145 | 145 | $this->_grand_total = $line_item; |
146 | 146 | } |
147 | 147 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | * @param EE_Session $session |
155 | 155 | * @return \EE_Cart |
156 | 156 | */ |
157 | - public static function get_cart_from_txn( EE_Transaction $transaction, EE_Session $session = null ) { |
|
157 | + public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null) { |
|
158 | 158 | $grand_total = $transaction->total_line_item(); |
159 | 159 | $grand_total->get_items(); |
160 | 160 | $grand_total->tax_descendants(); |
161 | - return EE_Cart::instance( $grand_total, $session ); |
|
161 | + return EE_Cart::instance($grand_total, $session); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items |
168 | 168 | * @return EE_Line_Item |
169 | 169 | */ |
170 | - private function _create_grand_total(){ |
|
170 | + private function _create_grand_total() { |
|
171 | 171 | $this->_grand_total = EEH_Line_Item::create_total_line_item(); |
172 | 172 | return $this->_grand_total; |
173 | 173 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @return \EE_Line_Item[] |
181 | 181 | */ |
182 | 182 | public function get_tickets() { |
183 | - return EEH_Line_Item::get_ticket_line_items( $this->_grand_total ); |
|
183 | + return EEH_Line_Item::get_ticket_line_items($this->_grand_total); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function all_ticket_quantity_count() { |
195 | 195 | $tickets = $this->get_tickets(); |
196 | - if ( empty( $tickets )) { |
|
196 | + if (empty($tickets)) { |
|
197 | 197 | return 0; |
198 | 198 | } |
199 | 199 | $count = 0; |
200 | - foreach ( $tickets as $ticket ) { |
|
200 | + foreach ($tickets as $ticket) { |
|
201 | 201 | $count = $count + $ticket->get('LIN_quantity'); |
202 | 202 | } |
203 | 203 | return $count; |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | * Gets all the tax line items |
210 | 210 | * @return \EE_Line_Item[] |
211 | 211 | */ |
212 | - public function get_taxes(){ |
|
213 | - return EEH_Line_Item::get_taxes_subtotal( $this->_grand_total )->children(); |
|
212 | + public function get_taxes() { |
|
213 | + return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children(); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * Gets the total line item (which is a parent of all other line items) on this cart |
220 | 220 | * @return EE_Line_Item |
221 | 221 | */ |
222 | - public function get_grand_total(){ |
|
222 | + public function get_grand_total() { |
|
223 | 223 | return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total(); |
224 | 224 | } |
225 | 225 | |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @param int $qty |
233 | 233 | * @return TRUE on success, FALSE on fail |
234 | 234 | */ |
235 | - public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) { |
|
236 | - EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty ); |
|
235 | + public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) { |
|
236 | + EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty); |
|
237 | 237 | return $this->save_cart() ? TRUE : FALSE; |
238 | 238 | } |
239 | 239 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return float |
257 | 257 | */ |
258 | 258 | public function get_applied_taxes() { |
259 | - return EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
259 | + return EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return float |
268 | 268 | */ |
269 | 269 | public function get_cart_grand_total() { |
270 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
270 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
271 | 271 | return $this->get_grand_total()->total(); |
272 | 272 | } |
273 | 273 | |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public function recalculate_all_cart_totals() { |
282 | 282 | $pre_tax_total = $this->get_cart_total_before_tax(); |
283 | - $taxes_total = EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
284 | - $this->_grand_total->set_total( $pre_tax_total + $taxes_total ); |
|
283 | + $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
284 | + $this->_grand_total->set_total($pre_tax_total + $taxes_total); |
|
285 | 285 | $this->_grand_total->save_this_and_descendants_to_txn(); |
286 | 286 | return $this->get_grand_total()->total(); |
287 | 287 | } |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | * @param array|bool|string $line_item_codes |
295 | 295 | * @return int on success, FALSE on fail |
296 | 296 | */ |
297 | - public function delete_items( $line_item_codes = FALSE ) { |
|
298 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
299 | - return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes ); |
|
297 | + public function delete_items($line_item_codes = FALSE) { |
|
298 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
299 | + return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | * @return bool |
308 | 308 | */ |
309 | 309 | public function empty_cart() { |
310 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
310 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
311 | 311 | $this->_grand_total = $this->_create_grand_total(); |
312 | - return $this->save_cart( TRUE ); |
|
312 | + return $this->save_cart(TRUE); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | * @return bool |
321 | 321 | */ |
322 | 322 | public function delete_cart() { |
323 | - $deleted = EEH_Line_Item::delete_all_child_items( $this->_grand_total ); |
|
324 | - if ( $deleted ) { |
|
323 | + $deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total); |
|
324 | + if ($deleted) { |
|
325 | 325 | $deleted += $this->_grand_total->delete(); |
326 | 326 | $this->_grand_total = null; |
327 | 327 | } |
@@ -336,17 +336,17 @@ discard block |
||
336 | 336 | * @param bool $apply_taxes |
337 | 337 | * @return TRUE on success, FALSE on fail |
338 | 338 | */ |
339 | - public function save_cart( $apply_taxes = TRUE ) { |
|
340 | - if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) { |
|
341 | - EEH_Line_Item::ensure_taxes_applied( $this->_grand_total ); |
|
339 | + public function save_cart($apply_taxes = TRUE) { |
|
340 | + if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) { |
|
341 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
342 | 342 | //make sure we don't cache the transaction because it can get stale |
343 | - if( $this->_grand_total->get_one_from_cache( 'Transaction' ) instanceof EE_Transaction && |
|
344 | - $this->_grand_total->get_one_from_cache( 'Transaction' )->ID()) { |
|
345 | - $this->_grand_total->clear_cache( 'Transaction', null, true ); |
|
343 | + if ($this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction && |
|
344 | + $this->_grand_total->get_one_from_cache('Transaction')->ID()) { |
|
345 | + $this->_grand_total->clear_cache('Transaction', null, true); |
|
346 | 346 | } |
347 | 347 | } |
348 | - if ( $this->_session instanceof EE_Session ) { |
|
349 | - return $this->_session->set_cart( $this ); |
|
348 | + if ($this->_session instanceof EE_Session) { |
|
349 | + return $this->_session->set_cart($this); |
|
350 | 350 | } else { |
351 | 351 | return false; |
352 | 352 | } |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php use EventEspresso\core\interfaces\ResettableInterface; |
2 | 2 | |
3 | -if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | +if (!defined( 'EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | +} |
|
4 | 6 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
5 | 7 | * |
6 | 8 | * Event Espresso |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\InterminableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
4 | 4 | /** |
5 | 5 | * class EE_Request_Handler |
6 | 6 | * |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @param EE_Request $request |
53 | 53 | * @return \EE_Request_Handler |
54 | 54 | */ |
55 | - public function __construct( EE_Request $request ) { |
|
55 | + public function __construct(EE_Request $request) { |
|
56 | 56 | // grab request vars |
57 | 57 | $this->_params = $request->params(); |
58 | 58 | // AJAX ??? |
59 | - $this->ajax = defined( 'DOING_AJAX' ) && DOING_AJAX ? true : false; |
|
60 | - $this->front_ajax = defined( 'EE_FRONT_AJAX' ) && EE_FRONT_AJAX ? true : false; |
|
61 | - do_action( 'AHEE__EE_Request_Handler__construct__complete' ); |
|
59 | + $this->ajax = defined('DOING_AJAX') && DOING_AJAX ? true : false; |
|
60 | + $this->front_ajax = defined('EE_FRONT_AJAX') && EE_FRONT_AJAX ? true : false; |
|
61 | + do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | * @param WP $wp |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function parse_request( $wp = null ) { |
|
73 | + public function parse_request($wp = null) { |
|
74 | 74 | //if somebody forgot to provide us with WP, that's ok because its global |
75 | - if ( ! $wp instanceof WP ) { |
|
75 | + if ( ! $wp instanceof WP) { |
|
76 | 76 | global $wp; |
77 | 77 | } |
78 | - $this->set_request_vars( $wp ); |
|
78 | + $this->set_request_vars($wp); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | * @param WP $wp |
88 | 88 | * @return void |
89 | 89 | */ |
90 | - public function set_request_vars( $wp = null ) { |
|
91 | - if ( ! is_admin() ) { |
|
90 | + public function set_request_vars($wp = null) { |
|
91 | + if ( ! is_admin()) { |
|
92 | 92 | // set request post_id |
93 | - $this->set( 'post_id', $this->get_post_id_from_request( $wp )); |
|
93 | + $this->set('post_id', $this->get_post_id_from_request($wp)); |
|
94 | 94 | // set request post name |
95 | - $this->set( 'post_name', $this->get_post_name_from_request( $wp )); |
|
95 | + $this->set('post_name', $this->get_post_name_from_request($wp)); |
|
96 | 96 | // set request post_type |
97 | - $this->set( 'post_type', $this->get_post_type_from_request( $wp )); |
|
97 | + $this->set('post_type', $this->get_post_type_from_request($wp)); |
|
98 | 98 | // true or false ? is this page being used by EE ? |
99 | 99 | $this->set_espresso_page(); |
100 | 100 | } |
@@ -109,19 +109,19 @@ discard block |
||
109 | 109 | * @param WP $wp |
110 | 110 | * @return int |
111 | 111 | */ |
112 | - public function get_post_id_from_request( $wp = null ) { |
|
113 | - if ( ! $wp instanceof WP ){ |
|
112 | + public function get_post_id_from_request($wp = null) { |
|
113 | + if ( ! $wp instanceof WP) { |
|
114 | 114 | global $wp; |
115 | 115 | } |
116 | 116 | $post_id = null; |
117 | - if ( isset( $wp->query_vars['p'] )) { |
|
117 | + if (isset($wp->query_vars['p'])) { |
|
118 | 118 | $post_id = $wp->query_vars['p']; |
119 | 119 | } |
120 | - if ( ! $post_id && isset( $wp->query_vars['page_id'] )) { |
|
120 | + if ( ! $post_id && isset($wp->query_vars['page_id'])) { |
|
121 | 121 | $post_id = $wp->query_vars['page_id']; |
122 | 122 | } |
123 | - if ( ! $post_id && isset( $wp->request ) && is_numeric( basename( $wp->request ))) { |
|
124 | - $post_id = basename( $wp->request ); |
|
123 | + if ( ! $post_id && isset($wp->request) && is_numeric(basename($wp->request))) { |
|
124 | + $post_id = basename($wp->request); |
|
125 | 125 | } |
126 | 126 | return $post_id; |
127 | 127 | } |
@@ -135,35 +135,35 @@ discard block |
||
135 | 135 | * @param WP $wp |
136 | 136 | * @return string |
137 | 137 | */ |
138 | - public function get_post_name_from_request( $wp = null ) { |
|
139 | - if ( ! $wp instanceof WP ){ |
|
138 | + public function get_post_name_from_request($wp = null) { |
|
139 | + if ( ! $wp instanceof WP) { |
|
140 | 140 | global $wp; |
141 | 141 | } |
142 | 142 | $post_name = null; |
143 | - if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) { |
|
143 | + if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
|
144 | 144 | $post_name = $wp->query_vars['name']; |
145 | 145 | } |
146 | - if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) { |
|
146 | + if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
147 | 147 | $post_name = $wp->query_vars['pagename']; |
148 | 148 | } |
149 | - if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) { |
|
150 | - $possible_post_name = basename( $wp->request ); |
|
151 | - if ( ! is_numeric( $possible_post_name )) { |
|
149 | + if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) { |
|
150 | + $possible_post_name = basename($wp->request); |
|
151 | + if ( ! is_numeric($possible_post_name)) { |
|
152 | 152 | /** @type WPDB $wpdb */ |
153 | 153 | global $wpdb; |
154 | 154 | $SQL = "SELECT ID from $wpdb->posts WHERE post_status='publish' AND post_name=%s"; |
155 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name )); |
|
156 | - if ( $possible_post_name ) { |
|
155 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name)); |
|
156 | + if ($possible_post_name) { |
|
157 | 157 | $post_name = $possible_post_name; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
161 | - if ( ! $post_name && $this->get( 'post_id' )) { |
|
161 | + if ( ! $post_name && $this->get('post_id')) { |
|
162 | 162 | /** @type WPDB $wpdb */ |
163 | 163 | global $wpdb; |
164 | 164 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_status='publish' AND ID=%d"; |
165 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' ))); |
|
166 | - if( $possible_post_name ) { |
|
165 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id'))); |
|
166 | + if ($possible_post_name) { |
|
167 | 167 | $post_name = $possible_post_name; |
168 | 168 | } |
169 | 169 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | * @param WP $wp |
180 | 180 | * @return mixed |
181 | 181 | */ |
182 | - public function get_post_type_from_request( $wp = null ) { |
|
183 | - if ( ! $wp instanceof WP ){ |
|
182 | + public function get_post_type_from_request($wp = null) { |
|
183 | + if ( ! $wp instanceof WP) { |
|
184 | 184 | global $wp; |
185 | 185 | } |
186 | - return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null; |
|
186 | + return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -193,18 +193,18 @@ discard block |
||
193 | 193 | * @param WP $wp |
194 | 194 | * @return bool|string|void |
195 | 195 | */ |
196 | - public function get_current_page_permalink( $wp = null ) { |
|
197 | - $post_id = $this->get_post_id_from_request( $wp ); |
|
198 | - if ( $post_id ) { |
|
199 | - $current_page_permalink = get_permalink( $post_id ); |
|
196 | + public function get_current_page_permalink($wp = null) { |
|
197 | + $post_id = $this->get_post_id_from_request($wp); |
|
198 | + if ($post_id) { |
|
199 | + $current_page_permalink = get_permalink($post_id); |
|
200 | 200 | } else { |
201 | - if ( ! $wp instanceof WP ) { |
|
201 | + if ( ! $wp instanceof WP) { |
|
202 | 202 | global $wp; |
203 | 203 | } |
204 | - if ( $wp->request ) { |
|
205 | - $current_page_permalink = site_url( $wp->request ); |
|
204 | + if ($wp->request) { |
|
205 | + $current_page_permalink = site_url($wp->request); |
|
206 | 206 | } else { |
207 | - $current_page_permalink = esc_url( site_url( $_SERVER[ 'REQUEST_URI' ] ) ); |
|
207 | + $current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI'])); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | return $current_page_permalink; |
@@ -221,41 +221,41 @@ discard block |
||
221 | 221 | public function test_for_espresso_page() { |
222 | 222 | global $wp; |
223 | 223 | /** @type EE_CPT_Strategy $EE_CPT_Strategy */ |
224 | - $EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
224 | + $EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy'); |
|
225 | 225 | $espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies(); |
226 | - if ( is_array( $espresso_CPT_taxonomies ) ) { |
|
227 | - foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) { |
|
228 | - if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) { |
|
226 | + if (is_array($espresso_CPT_taxonomies)) { |
|
227 | + foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) { |
|
228 | + if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) { |
|
229 | 229 | return true; |
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
233 | 233 | // load espresso CPT endpoints |
234 | 234 | $espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints(); |
235 | - $post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints ); |
|
236 | - $post_types = (array)$this->get( 'post_type' ); |
|
237 | - foreach ( $post_types as $post_type ) { |
|
235 | + $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints); |
|
236 | + $post_types = (array) $this->get('post_type'); |
|
237 | + foreach ($post_types as $post_type) { |
|
238 | 238 | // was a post name passed ? |
239 | - if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) { |
|
239 | + if (isset($post_type_CPT_endpoints[$post_type])) { |
|
240 | 240 | // kk we know this is an espresso page, but is it a specific post ? |
241 | - if ( ! $this->get( 'post_name' ) ) { |
|
241 | + if ( ! $this->get('post_name')) { |
|
242 | 242 | // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
243 | - $post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null; |
|
243 | + $post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null; |
|
244 | 244 | // if the post type matches on of our then set the endpoint |
245 | - if ( $post_name ) { |
|
246 | - $this->set( 'post_name', $post_name ); |
|
245 | + if ($post_name) { |
|
246 | + $this->set('post_name', $post_name); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | return true; |
250 | 250 | } |
251 | 251 | } |
252 | - if ( $this->get( 'post_name' )) { |
|
252 | + if ($this->get('post_name')) { |
|
253 | 253 | // load all pages using espresso shortcodes |
254 | - $post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
254 | + $post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
255 | 255 | // make sure core pages are included |
256 | - $espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes ); |
|
256 | + $espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes); |
|
257 | 257 | // was a post name passed ? |
258 | - if ( isset( $espresso_pages[ $this->get( 'post_name' ) ] )) { |
|
258 | + if (isset($espresso_pages[$this->get('post_name')])) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param null|bool $value |
272 | 272 | * @return mixed |
273 | 273 | */ |
274 | - public function set_espresso_page( $value = null ) { |
|
274 | + public function set_espresso_page($value = null) { |
|
275 | 275 | $value = $value ? $value : $this->test_for_espresso_page(); |
276 | 276 | $this->_params['is_espresso_page'] = $value; |
277 | 277 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @return mixed |
286 | 286 | */ |
287 | 287 | public function is_espresso_page() { |
288 | - return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false; |
|
288 | + return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -309,14 +309,14 @@ discard block |
||
309 | 309 | * @param bool $override_ee |
310 | 310 | * @return void |
311 | 311 | */ |
312 | - public function set( $key, $value, $override_ee = false ) { |
|
312 | + public function set($key, $value, $override_ee = false) { |
|
313 | 313 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
314 | 314 | if ( |
315 | 315 | $key !== 'ee' || |
316 | - ( $key === 'ee' && empty( $this->_params['ee'] )) |
|
317 | - || ( $key === 'ee' && ! empty( $this->_params['ee'] ) && $override_ee ) |
|
316 | + ($key === 'ee' && empty($this->_params['ee'])) |
|
317 | + || ($key === 'ee' && ! empty($this->_params['ee']) && $override_ee) |
|
318 | 318 | ) { |
319 | - $this->_params[ $key ] = $value; |
|
319 | + $this->_params[$key] = $value; |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | * @param null $default |
331 | 331 | * @return mixed |
332 | 332 | */ |
333 | - public function get( $key, $default = null ) { |
|
334 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
333 | + public function get($key, $default = null) { |
|
334 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @param $key |
344 | 344 | * @return boolean |
345 | 345 | */ |
346 | - public function is_set( $key ) { |
|
347 | - return isset( $this->_params[ $key ] ) ? true : false; |
|
346 | + public function is_set($key) { |
|
347 | + return isset($this->_params[$key]) ? true : false; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | * @param $key |
357 | 357 | * @return void |
358 | 358 | */ |
359 | - public function un_set( $key ) { |
|
360 | - unset( $this->_params[ $key ] ); |
|
359 | + public function un_set($key) { |
|
360 | + unset($this->_params[$key]); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | * @param $value |
371 | 371 | * @return void |
372 | 372 | */ |
373 | - public function set_notice( $key, $value ) { |
|
374 | - $this->_notice[ $key ] = $value; |
|
373 | + public function set_notice($key, $value) { |
|
374 | + $this->_notice[$key] = $value; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | * @param $key |
384 | 384 | * @return mixed |
385 | 385 | */ |
386 | - public function get_notice( $key ) { |
|
387 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null; |
|
386 | + public function get_notice($key) { |
|
387 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : null; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @param $string |
397 | 397 | * @return void |
398 | 398 | */ |
399 | - public function add_output( $string ) { |
|
399 | + public function add_output($string) { |
|
400 | 400 | $this->_output .= $string; |
401 | 401 | } |
402 | 402 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | * @param $item |
419 | 419 | * @param $key |
420 | 420 | */ |
421 | - public function sanitize_text_field_for_array_walk( &$item, &$key ) { |
|
422 | - $item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item ); |
|
421 | + public function sanitize_text_field_for_array_walk(&$item, &$key) { |
|
422 | + $item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param $b |
430 | 430 | * @return bool |
431 | 431 | */ |
432 | - public function __set($a,$b) { return false; } |
|
432 | + public function __set($a, $b) { return false; } |
|
433 | 433 | |
434 | 434 | |
435 | 435 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\ResettableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
4 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
4 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
5 | 5 | /** |
6 | 6 | * |
7 | 7 | * EE_Payment_Processor |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | 31 | // check if class object is instantiated |
32 | - if ( ! self::$_instance instanceof EE_Payment_Processor ) { |
|
32 | + if ( ! self::$_instance instanceof EE_Payment_Processor) { |
|
33 | 33 | self::$_instance = new self(); |
34 | 34 | } |
35 | 35 | return self::$_instance; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | *@return EE_Payment_Processor |
55 | 55 | */ |
56 | 56 | private function __construct() { |
57 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
57 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $update_txn = true, |
94 | 94 | $cancel_url = '' |
95 | 95 | ) { |
96 | - if( (float)$amount < 0 ) { |
|
96 | + if ((float) $amount < 0) { |
|
97 | 97 | throw new EE_Error( |
98 | 98 | sprintf( |
99 | 99 | __( |
@@ -106,33 +106,33 @@ discard block |
||
106 | 106 | ); |
107 | 107 | } |
108 | 108 | // verify payment method |
109 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
109 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
110 | 110 | // verify transaction |
111 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
112 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
111 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
112 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
113 | 113 | // verify payment method type |
114 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
114 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
115 | 115 | $payment = $payment_method->type_obj()->process_payment( |
116 | 116 | $transaction, |
117 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
117 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
118 | 118 | $billing_form, |
119 | 119 | $return_url, |
120 | - add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ), |
|
120 | + add_query_arg(array('ee_cancel_payment' => true), $cancel_url), |
|
121 | 121 | $method, |
122 | 122 | $by_admin |
123 | 123 | ); |
124 | 124 | // check if payment method uses an off-site gateway |
125 | - if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) { |
|
125 | + if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) { |
|
126 | 126 | // don't process payments for off-site gateways yet because no payment has occurred yet |
127 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
127 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
128 | 128 | } |
129 | 129 | return $payment; |
130 | 130 | } else { |
131 | 131 | EE_Error::add_error( |
132 | 132 | sprintf( |
133 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
133 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
134 | 134 | '<br/>', |
135 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
135 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
136 | 136 | ), __FILE__, __FUNCTION__, __LINE__ |
137 | 137 | ); |
138 | 138 | return NULL; |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | * @throws EE_Error |
149 | 149 | * @return string |
150 | 150 | */ |
151 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
151 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
152 | 152 | /** @type \EE_Transaction $transaction */ |
153 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
153 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
154 | 154 | $primary_reg = $transaction->primary_registration(); |
155 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
155 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
156 | 156 | throw new EE_Error( |
157 | 157 | sprintf( |
158 | 158 | __( |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | ) |
164 | 164 | ); |
165 | 165 | } |
166 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
166 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
167 | 167 | $url = add_query_arg( |
168 | 168 | array( |
169 | 169 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -200,92 +200,92 @@ discard block |
||
200 | 200 | $update_txn = true, |
201 | 201 | $separate_IPN_request = true |
202 | 202 | ) { |
203 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
204 | - $_req_data = $this->_remove_unusable_characters_from_array( $_req_data ); |
|
205 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
203 | + EE_Registry::instance()->load_model('Change_Log'); |
|
204 | + $_req_data = $this->_remove_unusable_characters_from_array($_req_data); |
|
205 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
206 | 206 | $obj_for_log = null; |
207 | - if( $transaction instanceof EE_Transaction ){ |
|
207 | + if ($transaction instanceof EE_Transaction) { |
|
208 | 208 | $obj_for_log = $transaction; |
209 | - if( $payment_method instanceof EE_Payment_Method ) { |
|
209 | + if ($payment_method instanceof EE_Payment_Method) { |
|
210 | 210 | $obj_for_log = EEM_Payment::instance()->get_one( |
211 | 211 | array( |
212 | - array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), |
|
213 | - 'order_by' => array( 'PAY_timestamp' => 'desc' ) |
|
212 | + array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), |
|
213 | + 'order_by' => array('PAY_timestamp' => 'desc') |
|
214 | 214 | ) |
215 | 215 | ); |
216 | 216 | } |
217 | - } else if( $payment_method instanceof EE_Payment ) { |
|
217 | + } else if ($payment_method instanceof EE_Payment) { |
|
218 | 218 | $obj_for_log = $payment_method; |
219 | 219 | } |
220 | 220 | $log = EEM_Change_Log::instance()->log( |
221 | 221 | EEM_Change_Log::type_gateway, |
222 | - array( 'IPN data received' => $_req_data ), |
|
222 | + array('IPN data received' => $_req_data), |
|
223 | 223 | $obj_for_log |
224 | 224 | ); |
225 | - try{ |
|
225 | + try { |
|
226 | 226 | /** |
227 | 227 | * @var EE_Payment $payment |
228 | 228 | */ |
229 | 229 | $payment = NULL; |
230 | - if($transaction && $payment_method){ |
|
230 | + if ($transaction && $payment_method) { |
|
231 | 231 | /** @type EE_Transaction $transaction */ |
232 | 232 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
233 | 233 | /** @type EE_Payment_Method $payment_method */ |
234 | 234 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
235 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
236 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
235 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
236 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
237 | 237 | $log->set_object($payment); |
238 | 238 | } else { |
239 | 239 | // not a payment |
240 | 240 | EE_Error::add_error( |
241 | 241 | sprintf( |
242 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
242 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
243 | 243 | '<br/>', |
244 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
244 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
245 | 245 | ), |
246 | 246 | __FILE__, __FUNCTION__, __LINE__ |
247 | 247 | ); |
248 | 248 | } |
249 | - }else{ |
|
249 | + } else { |
|
250 | 250 | //that's actually pretty ok. The IPN just wasn't able |
251 | 251 | //to identify which transaction or payment method this was for |
252 | 252 | // give all active payment methods a chance to claim it |
253 | 253 | $active_payment_methods = EEM_Payment_Method::instance()->get_all_active(); |
254 | - foreach( $active_payment_methods as $active_payment_method ){ |
|
255 | - try{ |
|
256 | - $payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
254 | + foreach ($active_payment_methods as $active_payment_method) { |
|
255 | + try { |
|
256 | + $payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
257 | 257 | $payment_method = $active_payment_method; |
258 | 258 | EEM_Change_Log::instance()->log( |
259 | 259 | EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment |
260 | 260 | ); |
261 | 261 | break; |
262 | - } catch( EE_Error $e ) { |
|
262 | + } catch (EE_Error $e) { |
|
263 | 263 | //that's fine- it apparently couldn't handle the IPN |
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | } |
268 | 268 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
269 | - if( $payment instanceof EE_Payment){ |
|
269 | + if ($payment instanceof EE_Payment) { |
|
270 | 270 | $payment->save(); |
271 | 271 | // update the TXN |
272 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
273 | - }else{ |
|
272 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
273 | + } else { |
|
274 | 274 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
275 | - if($payment_method){ |
|
275 | + if ($payment_method) { |
|
276 | 276 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
277 | - }elseif($transaction){ |
|
277 | + }elseif ($transaction) { |
|
278 | 278 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
279 | 279 | } |
280 | 280 | } |
281 | 281 | return $payment; |
282 | 282 | |
283 | - } catch( EE_Error $e ) { |
|
283 | + } catch (EE_Error $e) { |
|
284 | 284 | do_action( |
285 | 285 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
286 | - __( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ), |
|
287 | - print_r( $transaction, TRUE ), |
|
288 | - print_r( $_req_data, TRUE ), |
|
286 | + __('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'), |
|
287 | + print_r($transaction, TRUE), |
|
288 | + print_r($_req_data, TRUE), |
|
289 | 289 | $e->getMessage() |
290 | 290 | ) |
291 | 291 | ); |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | * @param array $request_data |
301 | 301 | * @return array |
302 | 302 | */ |
303 | - protected function _remove_unusable_characters_from_array( array $request_data ) { |
|
303 | + protected function _remove_unusable_characters_from_array(array $request_data) { |
|
304 | 304 | $return_data = array(); |
305 | - foreach( $request_data as $key => $value ) { |
|
306 | - $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
|
305 | + foreach ($request_data as $key => $value) { |
|
306 | + $return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value); |
|
307 | 307 | } |
308 | 308 | return $return_data; |
309 | 309 | } |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | * @param string $request_data |
316 | 316 | * @return string |
317 | 317 | */ |
318 | - protected function _remove_unusable_characters( $request_data ) { |
|
319 | - return preg_replace( '/[^[:print:]]/', '', $request_data ); |
|
318 | + protected function _remove_unusable_characters($request_data) { |
|
319 | + return preg_replace('/[^[:print:]]/', '', $request_data); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, |
339 | 339 | * to call handle_ipn() for offsite gateways that don't receive separate IPNs |
340 | 340 | */ |
341 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
341 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
342 | 342 | /** @var $transaction EE_Transaction */ |
343 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
343 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
344 | 344 | $last_payment_method = $transaction->payment_method(); |
345 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
346 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
347 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
345 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
346 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
347 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
348 | 348 | return $payment; |
349 | 349 | } else { |
350 | 350 | return NULL; |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | EE_Payment $payment_to_refund, |
368 | 368 | $refund_info = array() |
369 | 369 | ) { |
370 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) { |
|
371 | - $payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info ); |
|
372 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
370 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { |
|
371 | + $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); |
|
372 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
373 | 373 | } |
374 | 374 | return $payment_to_refund; |
375 | 375 | } |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | * TXN is locked before updating |
411 | 411 | * @throws \EE_Error |
412 | 412 | */ |
413 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
413 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
414 | 414 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful'; |
415 | 415 | /** @type EE_Transaction $transaction */ |
416 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
416 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
417 | 417 | // can we freely update the TXN at this moment? |
418 | - if ( $IPN && $transaction->is_locked() ) { |
|
418 | + if ($IPN && $transaction->is_locked()) { |
|
419 | 419 | // don't update the transaction at this exact moment |
420 | 420 | // because the TXN is active in another request |
421 | 421 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -425,45 +425,45 @@ discard block |
||
425 | 425 | ); |
426 | 426 | } else { |
427 | 427 | // verify payment and that it has been saved |
428 | - if ( $payment instanceof EE_Payment && $payment->ID() ) { |
|
429 | - if( |
|
428 | + if ($payment instanceof EE_Payment && $payment->ID()) { |
|
429 | + if ( |
|
430 | 430 | $payment->payment_method() instanceof EE_Payment_Method |
431 | 431 | && $payment->payment_method()->type_obj() instanceof EE_PMT_Base |
432 | - ){ |
|
433 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
432 | + ) { |
|
433 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
434 | 434 | // update TXN registrations with payment info |
435 | - $this->process_registration_payments( $transaction, $payment ); |
|
435 | + $this->process_registration_payments($transaction, $payment); |
|
436 | 436 | } |
437 | 437 | $do_action = $payment->just_approved() |
438 | 438 | ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' |
439 | 439 | : $do_action; |
440 | 440 | } else { |
441 | 441 | // send out notifications |
442 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
442 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
443 | 443 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
444 | 444 | } |
445 | 445 | // if this is an IPN, then we want to know the initial TXN status prior to updating the TXN |
446 | 446 | // so that we know whether the status has changed and notifications should be triggered |
447 | - if ( $IPN ) { |
|
447 | + if ($IPN) { |
|
448 | 448 | /** @type EE_Transaction_Processor $transaction_processor */ |
449 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
450 | - $transaction_processor->set_old_txn_status( $transaction->status_ID() ); |
|
449 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
450 | + $transaction_processor->set_old_txn_status($transaction->status_ID()); |
|
451 | 451 | } |
452 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
452 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
453 | 453 | /** @type EE_Transaction_Payments $transaction_payments */ |
454 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
454 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
455 | 455 | // set new value for total paid |
456 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
456 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
457 | 457 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
458 | - if ( $update_txn ) { |
|
459 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
458 | + if ($update_txn) { |
|
459 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | // granular hook for others to use. |
463 | - do_action( $do_action, $transaction, $payment ); |
|
464 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' ); |
|
463 | + do_action($do_action, $transaction, $payment); |
|
464 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action'); |
|
465 | 465 | //global hook for others to use. |
466 | - do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment ); |
|
466 | + do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment); |
|
467 | 467 | } |
468 | 468 | } |
469 | 469 | |
@@ -483,25 +483,25 @@ discard block |
||
483 | 483 | $registrations = array() |
484 | 484 | ) { |
485 | 485 | // only process if payment was successful |
486 | - if ( $payment->status() !== EEM_Payment::status_id_approved ) { |
|
486 | + if ($payment->status() !== EEM_Payment::status_id_approved) { |
|
487 | 487 | return; |
488 | 488 | } |
489 | 489 | //EEM_Registration::instance()->show_next_x_db_queries(); |
490 | - if ( empty( $registrations )) { |
|
490 | + if (empty($registrations)) { |
|
491 | 491 | // find registrations with monies owing that can receive a payment |
492 | 492 | $registrations = $transaction->registrations( |
493 | 493 | array( |
494 | 494 | array( |
495 | 495 | // only these reg statuses can receive payments |
496 | - 'STS_ID' => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ), |
|
497 | - 'REG_final_price' => array( '!=', 0 ), |
|
498 | - 'REG_final_price*' => array( '!=', 'REG_paid', true ), |
|
496 | + 'STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), |
|
497 | + 'REG_final_price' => array('!=', 0), |
|
498 | + 'REG_final_price*' => array('!=', 'REG_paid', true), |
|
499 | 499 | ) |
500 | 500 | ) |
501 | 501 | ); |
502 | 502 | } |
503 | 503 | // still nothing ??!?? |
504 | - if ( empty( $registrations )) { |
|
504 | + if (empty($registrations)) { |
|
505 | 505 | return; |
506 | 506 | } |
507 | 507 | // todo: break out the following logic into a separate strategy class |
@@ -513,28 +513,28 @@ discard block |
||
513 | 513 | |
514 | 514 | $refund = $payment->is_a_refund(); |
515 | 515 | // how much is available to apply to registrations? |
516 | - $available_payment_amount = abs( $payment->amount() ); |
|
517 | - foreach ( $registrations as $registration ) { |
|
518 | - if ( $registration instanceof EE_Registration ) { |
|
516 | + $available_payment_amount = abs($payment->amount()); |
|
517 | + foreach ($registrations as $registration) { |
|
518 | + if ($registration instanceof EE_Registration) { |
|
519 | 519 | // nothing left? |
520 | - if ( $available_payment_amount <= 0 ) { |
|
520 | + if ($available_payment_amount <= 0) { |
|
521 | 521 | break; |
522 | 522 | } |
523 | - if ( $refund ) { |
|
524 | - $available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount ); |
|
523 | + if ($refund) { |
|
524 | + $available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount); |
|
525 | 525 | } else { |
526 | - $available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount ); |
|
526 | + $available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount); |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | } |
530 | - if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) { |
|
530 | + if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) { |
|
531 | 531 | EE_Error::add_attention( |
532 | 532 | sprintf( |
533 | - __( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ), |
|
534 | - EEH_Template::format_currency( $available_payment_amount ), |
|
535 | - implode( ', ', array_keys( $registrations ) ), |
|
533 | + __('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), |
|
534 | + EEH_Template::format_currency($available_payment_amount), |
|
535 | + implode(', ', array_keys($registrations)), |
|
536 | 536 | '<br/>', |
537 | - EEH_Template::format_currency( $payment->amount() ) |
|
537 | + EEH_Template::format_currency($payment->amount()) |
|
538 | 538 | ), |
539 | 539 | __FILE__, __FUNCTION__, __LINE__ |
540 | 540 | ); |
@@ -552,17 +552,17 @@ discard block |
||
552 | 552 | * @return float |
553 | 553 | * @throws \EE_Error |
554 | 554 | */ |
555 | - public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) { |
|
555 | + public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) { |
|
556 | 556 | $owing = $registration->final_price() - $registration->paid(); |
557 | - if ( $owing > 0 ) { |
|
557 | + if ($owing > 0) { |
|
558 | 558 | // don't allow payment amount to exceed the available payment amount, OR the amount owing |
559 | - $payment_amount = min( $available_payment_amount, $owing ); |
|
559 | + $payment_amount = min($available_payment_amount, $owing); |
|
560 | 560 | // update $available_payment_amount |
561 | 561 | $available_payment_amount -= $payment_amount; |
562 | 562 | //calculate and set new REG_paid |
563 | - $registration->set_paid( $registration->paid() + $payment_amount ); |
|
563 | + $registration->set_paid($registration->paid() + $payment_amount); |
|
564 | 564 | // now save it |
565 | - $this->_apply_registration_payment( $registration, $payment, $payment_amount ); |
|
565 | + $this->_apply_registration_payment($registration, $payment, $payment_amount); |
|
566 | 566 | } |
567 | 567 | return $available_payment_amount; |
568 | 568 | } |
@@ -578,19 +578,19 @@ discard block |
||
578 | 578 | * @return float |
579 | 579 | * @throws \EE_Error |
580 | 580 | */ |
581 | - protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) { |
|
581 | + protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) { |
|
582 | 582 | // find any existing reg payment records for this registration and payment |
583 | 583 | $existing_reg_payment = EEM_Registration_Payment::instance()->get_one( |
584 | - array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) ) |
|
584 | + array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID())) |
|
585 | 585 | ); |
586 | 586 | // if existing registration payment exists |
587 | - if ( $existing_reg_payment instanceof EE_Registration_Payment ) { |
|
587 | + if ($existing_reg_payment instanceof EE_Registration_Payment) { |
|
588 | 588 | // then update that record |
589 | - $existing_reg_payment->set_amount( $payment_amount ); |
|
589 | + $existing_reg_payment->set_amount($payment_amount); |
|
590 | 590 | $existing_reg_payment->save(); |
591 | 591 | } else { |
592 | 592 | // or add new relation between registration and payment and set amount |
593 | - $registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) ); |
|
593 | + $registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount)); |
|
594 | 594 | // make it stick |
595 | 595 | $registration->save(); |
596 | 596 | } |
@@ -607,21 +607,21 @@ discard block |
||
607 | 607 | * @return float |
608 | 608 | * @throws \EE_Error |
609 | 609 | */ |
610 | - public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) { |
|
610 | + public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) { |
|
611 | 611 | //EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ ); |
612 | - if ( $registration->paid() > 0 ) { |
|
612 | + if ($registration->paid() > 0) { |
|
613 | 613 | // ensure $available_refund_amount is NOT negative |
614 | - $available_refund_amount = (float)abs( $available_refund_amount ); |
|
614 | + $available_refund_amount = (float) abs($available_refund_amount); |
|
615 | 615 | // don't allow refund amount to exceed the available payment amount, OR the amount paid |
616 | - $refund_amount = min( $available_refund_amount, (float)$registration->paid() ); |
|
616 | + $refund_amount = min($available_refund_amount, (float) $registration->paid()); |
|
617 | 617 | // update $available_payment_amount |
618 | 618 | $available_refund_amount -= $refund_amount; |
619 | 619 | //calculate and set new REG_paid |
620 | - $registration->set_paid( $registration->paid() - $refund_amount ); |
|
620 | + $registration->set_paid($registration->paid() - $refund_amount); |
|
621 | 621 | // convert payment amount back to a negative value for storage in the db |
622 | - $refund_amount = (float)abs( $refund_amount ) * -1; |
|
622 | + $refund_amount = (float) abs($refund_amount) * -1; |
|
623 | 623 | // now save it |
624 | - $this->_apply_registration_payment( $registration, $payment, $refund_amount ); |
|
624 | + $this->_apply_registration_payment($registration, $payment, $refund_amount); |
|
625 | 625 | } |
626 | 626 | return $available_refund_amount; |
627 | 627 | } |
@@ -640,21 +640,21 @@ discard block |
||
640 | 640 | * @param bool $IPN |
641 | 641 | * @throws \EE_Error |
642 | 642 | */ |
643 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
643 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
644 | 644 | |
645 | 645 | /** @type EE_Transaction_Processor $transaction_processor */ |
646 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
646 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
647 | 647 | // is the Payment Options Reg Step completed ? |
648 | - $payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' ); |
|
648 | + $payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options'); |
|
649 | 649 | // if the Payment Options Reg Step is completed... |
650 | 650 | $revisit = $payment_options_step_completed === true ? true : false; |
651 | 651 | // then this is kinda sorta a revisit with regards to payments at least |
652 | - $transaction_processor->set_revisit( $revisit ); |
|
652 | + $transaction_processor->set_revisit($revisit); |
|
653 | 653 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
654 | 654 | if ( |
655 | 655 | $IPN && |
656 | 656 | $payment_options_step_completed !== true && |
657 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
657 | + ($payment->is_approved() || $payment->is_pending()) |
|
658 | 658 | ) { |
659 | 659 | $payment_options_step_completed = $transaction_processor->set_reg_step_completed( |
660 | 660 | $transaction, |
@@ -662,34 +662,34 @@ discard block |
||
662 | 662 | ); |
663 | 663 | } |
664 | 664 | /** @type EE_Transaction_Payments $transaction_payments */ |
665 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
665 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
666 | 666 | // maybe update status, but don't save transaction just yet |
667 | - $transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
667 | + $transaction_payments->update_transaction_status_based_on_total_paid($transaction, false); |
|
668 | 668 | // check if 'finalize_registration' step has been completed... |
669 | - $finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' ); |
|
669 | + $finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration'); |
|
670 | 670 | // if this is an IPN and the final step has not been initiated |
671 | - if ( $IPN && $payment_options_step_completed && $finalized === false ) { |
|
671 | + if ($IPN && $payment_options_step_completed && $finalized === false) { |
|
672 | 672 | // and if it hasn't already been set as being started... |
673 | - $finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
673 | + $finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
674 | 674 | } |
675 | 675 | $transaction->save(); |
676 | 676 | // because the above will return false if the final step was not fully completed, we need to check again... |
677 | - if ( $IPN && $finalized !== false ) { |
|
677 | + if ($IPN && $finalized !== false) { |
|
678 | 678 | // and if we are all good to go, then send out notifications |
679 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
679 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
680 | 680 | //ok, now process the transaction according to the payment |
681 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
681 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
682 | 682 | } |
683 | 683 | // DEBUG LOG |
684 | 684 | $payment_method = $payment->payment_method(); |
685 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
685 | + if ($payment_method instanceof EE_Payment_Method) { |
|
686 | 686 | $payment_method_type_obj = $payment_method->type_obj(); |
687 | - if ( $payment_method_type_obj instanceof EE_PMT_Base ) { |
|
687 | + if ($payment_method_type_obj instanceof EE_PMT_Base) { |
|
688 | 688 | $gateway = $payment_method_type_obj->get_gateway(); |
689 | - if ( $gateway instanceof EE_Gateway ){ |
|
689 | + if ($gateway instanceof EE_Gateway) { |
|
690 | 690 | $gateway->log( |
691 | 691 | array( |
692 | - 'message' => __( 'Post Payment Transaction Details', 'event_espresso' ), |
|
692 | + 'message' => __('Post Payment Transaction Details', 'event_espresso'), |
|
693 | 693 | 'transaction' => $transaction->model_field_array(), |
694 | 694 | 'finalized' => $finalized, |
695 | 695 | 'IPN' => $IPN, |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\interfaces\ResettableInterface; |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * Event Espresso |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public static function instance() { |
77 | 77 | // check if class object is instantiated |
78 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) { |
|
78 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) { |
|
79 | 79 | self::$_instance = new self(); |
80 | 80 | } |
81 | 81 | return self::$_instance; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode) |
86 | 86 | * @return EE_Maintenance_Mode |
87 | 87 | */ |
88 | - public static function reset(){ |
|
88 | + public static function reset() { |
|
89 | 89 | self::instance()->set_maintenance_mode_if_db_old(); |
90 | 90 | return self::instance(); |
91 | 91 | } |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function __construct() { |
102 | 102 | // if M-Mode level 2 is engaged, we still need basic assets loaded |
103 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' )); |
|
103 | + add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode')); |
|
104 | 104 | // shut 'er down down for maintenance ? |
105 | - add_filter( 'the_content', array( $this, 'the_content' ), 2 ); |
|
105 | + add_filter('the_content', array($this, 'the_content'), 2); |
|
106 | 106 | // add powered by EE msg |
107 | - add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 ); |
|
107 | + add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * retrieves the maintenance mode option value from the db |
115 | 115 | * @return int |
116 | 116 | */ |
117 | - public function real_level(){ |
|
118 | - return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance ); |
|
117 | + public function real_level() { |
|
118 | + return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * thinks their tables are present and up-to-date). |
124 | 124 | * @return boolean |
125 | 125 | */ |
126 | - public function models_can_query(){ |
|
126 | + public function models_can_query() { |
|
127 | 127 | return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance; |
128 | 128 | } |
129 | 129 | |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode |
137 | 137 | * @return int |
138 | 138 | */ |
139 | - public function level(){ |
|
139 | + public function level() { |
|
140 | 140 | $real_maintenance_mode_level = $this->real_level(); |
141 | 141 | //if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend |
142 | - if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests |
|
142 | + if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests |
|
143 | 143 | current_user_can('administrator') && //when the user is an admin |
144 | - $real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1 |
|
144 | + $real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1 |
|
145 | 145 | $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
146 | - }else{ |
|
146 | + } else { |
|
147 | 147 | $maintenance_mode_level = $real_maintenance_mode_level; |
148 | 148 | } |
149 | 149 | return $maintenance_mode_level; |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | * Determines if we need to put EE in maintenance mode because the database needs updating |
154 | 154 | * @return boolean true if DB is old and maintenance mode was triggered; false otherwise |
155 | 155 | */ |
156 | - public function set_maintenance_mode_if_db_old(){ |
|
157 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
158 | - if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){ |
|
156 | + public function set_maintenance_mode_if_db_old() { |
|
157 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
158 | + if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
159 | 159 | update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
160 | 160 | return true; |
161 | - }elseif( $this->level() == self::level_2_complete_maintenance ){ |
|
161 | + }elseif ($this->level() == self::level_2_complete_maintenance) { |
|
162 | 162 | //we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
163 | 163 | //then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
164 | - update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance ); |
|
164 | + update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance); |
|
165 | 165 | return false; |
166 | - }else{ |
|
166 | + } else { |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param int $level |
174 | 174 | * @return void |
175 | 175 | */ |
176 | - public function set_maintenance_level($level){ |
|
177 | - do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level ); |
|
176 | + public function set_maintenance_level($level) { |
|
177 | + do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level); |
|
178 | 178 | update_option(self::option_name_maintenance_mode, intval($level)); |
179 | 179 | } |
180 | 180 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * @return string |
202 | 202 | */ |
203 | 203 | public function load_assets_required_for_m_mode() { |
204 | - if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) { |
|
205 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
204 | + if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) { |
|
205 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
206 | 206 | wp_enqueue_style('espresso_default'); |
207 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
208 | - wp_enqueue_script( 'espresso_core' ); |
|
207 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
208 | + wp_enqueue_script('espresso_core'); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public static function template_include() { |
225 | 225 | // shut 'er down down for maintenance ? then don't use any of our templates for our endpoints |
226 | - return get_template_directory() . '/index.php'; |
|
226 | + return get_template_directory().'/index.php'; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | * @param string $the_content |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function the_content( $the_content ) { |
|
240 | + public function the_content($the_content) { |
|
241 | 241 | // check if M-mode is engaged and for EE shortcode |
242 | - if ( $this->level() && strpos( $the_content, '[ESPRESSO_' ) !== false ) { |
|
242 | + if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) { |
|
243 | 243 | // this can eventually be moved to a template, or edited via admin. But for now... |
244 | 244 | $the_content = sprintf( |
245 | - __( '%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' ), |
|
245 | + __('%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'), |
|
246 | 246 | '<h3>', |
247 | 247 | '</h3><p>', |
248 | 248 | '</p>' |
@@ -266,16 +266,16 @@ discard block |
||
266 | 266 | // check if M-mode is engaged and for EE shortcode |
267 | 267 | if ( |
268 | 268 | $this->real_level() && |
269 | - current_user_can( 'administrator' ) && |
|
269 | + current_user_can('administrator') && |
|
270 | 270 | ! is_admin() && |
271 | - ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
271 | + ! (defined('DOING_AJAX') && DOING_AJAX) |
|
272 | 272 | && EE_Registry::instance()->REQ->is_espresso_page() |
273 | 273 | ) { |
274 | 274 | printf( |
275 | - __( '%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' ), |
|
275 | + __('%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'), |
|
276 | 276 | '<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="', |
277 | 277 | '">×</a><p>', |
278 | - ' » <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">', |
|
278 | + ' » <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">', |
|
279 | 279 | '</a></p></div>' |
280 | 280 | ); |
281 | 281 | } |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | * @ return void |
294 | 294 | */ |
295 | 295 | final function __destruct() {} |
296 | - final function __call($a,$b) {} |
|
296 | + final function __call($a, $b) {} |
|
297 | 297 | final function __get($a) {} |
298 | - final function __set($a,$b) {} |
|
298 | + final function __set($a, $b) {} |
|
299 | 299 | final function __isset($a) {} |
300 | 300 | final function __unset($a) {} |
301 | 301 | final function __sleep() { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | final function __invoke() {} |
307 | 307 | final function __set_state() {} |
308 | 308 | final function __clone() {} |
309 | - final static function __callStatic($a,$b) {} |
|
309 | + final static function __callStatic($a, $b) {} |
|
310 | 310 | |
311 | 311 | } |
312 | 312 | // End of file EE_Maintenance_Mode.core.php |