@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * Class EE_Log |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return EE_Log |
63 | 63 | */ |
64 | 64 | public static function instance() { |
65 | - if ( ! self::$_instance instanceof EE_Log ) { |
|
65 | + if ( ! self::$_instance instanceof EE_Log) { |
|
66 | 66 | self::$_instance = new self(); |
67 | 67 | } |
68 | 68 | return self::$_instance; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function __construct() { |
76 | 76 | |
77 | - if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
77 | + if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS; |
|
81 | + $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS; |
|
82 | 82 | $this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name(); |
83 | 83 | $this->_log = ''; |
84 | 84 | $this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name(); |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
87 | 87 | $this->_remote_log = ''; |
88 | 88 | |
89 | - add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 ); |
|
90 | - add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 ); |
|
91 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
92 | - add_action( 'shutdown', array( $this, 'write_log' ), 9999 ); |
|
89 | + add_action('admin_init', array($this, 'verify_filesystem'), -10); |
|
90 | + add_action('AHEE_log', array($this, 'log'), 10, 4); |
|
91 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
92 | + add_action('shutdown', array($this, 'write_log'), 9999); |
|
93 | 93 | // if WP_DEBUG |
94 | - add_action( 'shutdown', array( $this, 'write_debug' ), 9999 ); |
|
94 | + add_action('shutdown', array($this, 'write_debug'), 9999); |
|
95 | 95 | } |
96 | - if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
97 | - add_action( 'shutdown', array( $this, 'send_log' ), 9999 ); |
|
96 | + if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
97 | + add_action('shutdown', array($this, 'send_log'), 9999); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function verify_filesystem() { |
110 | 110 | try { |
111 | - EE_Registry::instance()->load_helper( 'File' ); |
|
112 | - EEH_File::ensure_folder_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR ); |
|
113 | - EEH_File::ensure_folder_exists_and_is_writable( $this->_logs_folder ); |
|
114 | - EEH_File::add_htaccess_deny_from_all( $this->_logs_folder ); |
|
115 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file ); |
|
116 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file ); |
|
117 | - } catch( EE_Error $e ){ |
|
118 | - EE_Error::add_error( sprintf( __( 'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
111 | + EE_Registry::instance()->load_helper('File'); |
|
112 | + EEH_File::ensure_folder_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR); |
|
113 | + EEH_File::ensure_folder_exists_and_is_writable($this->_logs_folder); |
|
114 | + EEH_File::add_htaccess_deny_from_all($this->_logs_folder); |
|
115 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file); |
|
116 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file); |
|
117 | + } catch (EE_Error $e) { |
|
118 | + EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | } |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | * @param string $type |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - private function _format_message( $file = '', $function = '', $message = '', $type = '' ) { |
|
136 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
137 | - $msg .= '[' . current_time( 'mysql' ) . '] '; |
|
138 | - $msg .= ! empty( $file ) ? basename( $file ) : ''; |
|
139 | - $msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : ''; |
|
140 | - $msg .= ! empty( $function ) ? $function . '()' : ''; |
|
135 | + private function _format_message($file = '', $function = '', $message = '', $type = '') { |
|
136 | + $msg = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
137 | + $msg .= '['.current_time('mysql').'] '; |
|
138 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
139 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
140 | + $msg .= ! empty($function) ? $function.'()' : ''; |
|
141 | 141 | $msg .= PHP_EOL; |
142 | - $type = ! empty( $type ) ? $type : 'log message'; |
|
143 | - $msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
142 | + $type = ! empty($type) ? $type : 'log message'; |
|
143 | + $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : ''; |
|
144 | 144 | return $msg; |
145 | 145 | } |
146 | 146 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @param string $message |
156 | 156 | * @param string $type |
157 | 157 | */ |
158 | - public function log( $file = '', $function = '', $message = '', $type = '' ) { |
|
159 | - $this->_log .= $this->_format_message( $file, $function, $message, $type ); |
|
158 | + public function log($file = '', $function = '', $message = '', $type = '') { |
|
159 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | public function write_log() { |
169 | 169 | try { |
170 | 170 | //get existing log file and append new log info |
171 | - $this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log; |
|
172 | - EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' ); |
|
173 | - } catch( EE_Error $e ){ |
|
174 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
171 | + $this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log; |
|
172 | + EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log'); |
|
173 | + } catch (EE_Error $e) { |
|
174 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
175 | 175 | return; |
176 | 176 | } |
177 | 177 | } |
@@ -184,31 +184,31 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function send_log() { |
186 | 186 | |
187 | - if ( empty( $this->_remote_logging_url )) { |
|
187 | + if (empty($this->_remote_logging_url)) { |
|
188 | 188 | return; |
189 | 189 | } |
190 | 190 | |
191 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
192 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
193 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
194 | - $data .= '&time=' . time(); |
|
195 | - $data .= '&remote_log=' . $this->_log; |
|
196 | - $data .= '&request_array=' . json_encode( $_REQUEST ); |
|
191 | + $data = 'domain='.$_SERVER['HTTP_HOST']; |
|
192 | + $data .= '&ip='.$_SERVER['SERVER_ADDR']; |
|
193 | + $data .= '&server_type='.$_SERVER['SERVER_SOFTWARE']; |
|
194 | + $data .= '&time='.time(); |
|
195 | + $data .= '&remote_log='.$this->_log; |
|
196 | + $data .= '&request_array='.json_encode($_REQUEST); |
|
197 | 197 | $data .= '&action=save'; |
198 | 198 | |
199 | - if ( defined( 'EELOGGING_PASS' )) { |
|
200 | - $data .= '&pass=' . EELOGGING_PASS; |
|
199 | + if (defined('EELOGGING_PASS')) { |
|
200 | + $data .= '&pass='.EELOGGING_PASS; |
|
201 | 201 | } |
202 | - if ( defined( 'EELOGGING_KEY' )) { |
|
203 | - $data .= '&key=' . EELOGGING_KEY; |
|
202 | + if (defined('EELOGGING_KEY')) { |
|
203 | + $data .= '&key='.EELOGGING_KEY; |
|
204 | 204 | } |
205 | 205 | |
206 | - $c = curl_init( $this->_remote_logging_url ); |
|
207 | - curl_setopt( $c, CURLOPT_POST, TRUE ); |
|
208 | - curl_setopt( $c, CURLOPT_POSTFIELDS, $data ); |
|
209 | - curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE ); |
|
210 | - curl_exec( $c ); |
|
211 | - curl_close( $c ); |
|
206 | + $c = curl_init($this->_remote_logging_url); |
|
207 | + curl_setopt($c, CURLOPT_POST, TRUE); |
|
208 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
209 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); |
|
210 | + curl_exec($c); |
|
211 | + curl_close($c); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -219,18 +219,18 @@ discard block |
||
219 | 219 | * previous entries are overwritten |
220 | 220 | */ |
221 | 221 | public function write_debug() { |
222 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
222 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
223 | 223 | $this->_debug_log = ''; |
224 | - foreach ( $_GET as $key => $value ) { |
|
225 | - $this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
224 | + foreach ($_GET as $key => $value) { |
|
225 | + $this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
226 | 226 | } |
227 | - foreach ( $_POST as $key => $value ) { |
|
228 | - $this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
227 | + foreach ($_POST as $key => $value) { |
|
228 | + $this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
229 | 229 | } |
230 | 230 | try { |
231 | - EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' ); |
|
232 | - } catch( EE_Error $e ){ |
|
233 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
231 | + EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log'); |
|
232 | + } catch (EE_Error $e) { |
|
233 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * __clone |
243 | 243 | */ |
244 | 244 | public function __clone() { |
245 | - trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR ); |
|
245 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * Class EE_Log |
@@ -48,10 +48,10 @@ |
||
48 | 48 | */ |
49 | 49 | const option_name_maintenance_mode = 'ee_maintenance_mode'; |
50 | 50 | /** |
51 | - * EE_Maintenance_Mode Object |
|
52 | - * @var EE_Maintenance_Mode $_instance |
|
53 | - * @access private |
|
54 | - */ |
|
51 | + * EE_Maintenance_Mode Object |
|
52 | + * @var EE_Maintenance_Mode $_instance |
|
53 | + * @access private |
|
54 | + */ |
|
55 | 55 | private static $_instance = NULL; |
56 | 56 | |
57 | 57 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | current_user_can('administrator') && //when the user is an admin |
142 | 142 | $real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1 |
143 | 143 | $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
144 | - }else{ |
|
144 | + } else{ |
|
145 | 145 | $maintenance_mode_level = $real_maintenance_mode_level; |
146 | 146 | } |
147 | 147 | return $maintenance_mode_level; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){ |
157 | 157 | update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
158 | 158 | return true; |
159 | - }elseif( $this->level() == self::level_2_complete_maintenance ){ |
|
159 | + } elseif( $this->level() == self::level_2_complete_maintenance ){ |
|
160 | 160 | //we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
161 | 161 | //then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
162 | 162 | update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance ); |
163 | 163 | return false; |
164 | - }else{ |
|
164 | + } else{ |
|
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function instance() { |
75 | 75 | // check if class object is instantiated |
76 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) { |
|
76 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) { |
|
77 | 77 | self::$_instance = new self(); |
78 | 78 | } |
79 | 79 | return self::$_instance; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode) |
84 | 84 | * @return EE_Maintenance_Mode |
85 | 85 | */ |
86 | - public static function reset(){ |
|
86 | + public static function reset() { |
|
87 | 87 | self::instance()->set_maintenance_mode_if_db_old(); |
88 | 88 | return self::instance(); |
89 | 89 | } |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private function __construct() { |
100 | 100 | // if M-Mode level 2 is engaged, we still need basic assets loaded |
101 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' )); |
|
101 | + add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode')); |
|
102 | 102 | // shut 'er down down for maintenance ? |
103 | - add_filter( 'the_content', array( $this, 'the_content' ), 999 ); |
|
103 | + add_filter('the_content', array($this, 'the_content'), 999); |
|
104 | 104 | // add powered by EE msg |
105 | - add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 ); |
|
105 | + add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * retrieves the maintenance mode option value from the db |
113 | 113 | * @return int |
114 | 114 | */ |
115 | - public function real_level(){ |
|
116 | - return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance ); |
|
115 | + public function real_level() { |
|
116 | + return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * thinks their tables are present and up-to-date). |
122 | 122 | * @return boolean |
123 | 123 | */ |
124 | - public function models_can_query(){ |
|
124 | + public function models_can_query() { |
|
125 | 125 | return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance; |
126 | 126 | } |
127 | 127 | |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode |
135 | 135 | * @return int |
136 | 136 | */ |
137 | - public function level(){ |
|
137 | + public function level() { |
|
138 | 138 | $real_maintenance_mode_level = $this->real_level(); |
139 | 139 | //if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend |
140 | - if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests |
|
140 | + if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests |
|
141 | 141 | current_user_can('administrator') && //when the user is an admin |
142 | - $real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1 |
|
142 | + $real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1 |
|
143 | 143 | $maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance; |
144 | - }else{ |
|
144 | + } else { |
|
145 | 145 | $maintenance_mode_level = $real_maintenance_mode_level; |
146 | 146 | } |
147 | 147 | return $maintenance_mode_level; |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | * Determines if we need to put EE in maintenance mode because the database needs updating |
152 | 152 | * @return boolean true if DB is old and maintenance mode was triggered; false otherwise |
153 | 153 | */ |
154 | - public function set_maintenance_mode_if_db_old(){ |
|
155 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
156 | - if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){ |
|
154 | + public function set_maintenance_mode_if_db_old() { |
|
155 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
156 | + if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
157 | 157 | update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance); |
158 | 158 | return true; |
159 | - }elseif( $this->level() == self::level_2_complete_maintenance ){ |
|
159 | + }elseif ($this->level() == self::level_2_complete_maintenance) { |
|
160 | 160 | //we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run |
161 | 161 | //then we shouldn't be in mm2. (Maybe an addon got deactivated?) |
162 | - update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance ); |
|
162 | + update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance); |
|
163 | 163 | return false; |
164 | - }else{ |
|
164 | + } else { |
|
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | } |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * @param int $level |
172 | 172 | * @return void |
173 | 173 | */ |
174 | - public function set_maintenance_level($level){ |
|
175 | - do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level ); |
|
174 | + public function set_maintenance_level($level) { |
|
175 | + do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level); |
|
176 | 176 | update_option(self::option_name_maintenance_mode, intval($level)); |
177 | 177 | } |
178 | 178 | |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @return string |
200 | 200 | */ |
201 | 201 | public function load_assets_required_for_m_mode() { |
202 | - if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) { |
|
203 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
202 | + if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) { |
|
203 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
204 | 204 | wp_enqueue_style('espresso_default'); |
205 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
206 | - wp_enqueue_script( 'espresso_core' ); |
|
205 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
206 | + wp_enqueue_script('espresso_core'); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * @param string $template_path |
219 | 219 | * @return string |
220 | 220 | */ |
221 | - public static function template_include( $template_path ) { |
|
222 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
223 | - $template_located = EEH_Template::locate_template( EE_TEMPLATES . 'maintenance_mode.template.php', FALSE, FALSE ); |
|
221 | + public static function template_include($template_path) { |
|
222 | + EE_Registry::instance()->load_helper('Template'); |
|
223 | + $template_located = EEH_Template::locate_template(EE_TEMPLATES.'maintenance_mode.template.php', FALSE, FALSE); |
|
224 | 224 | return $template_located ? $template_located : $template_path; |
225 | 225 | } |
226 | 226 | |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * @param string $the_content |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - public function the_content( $the_content ) { |
|
238 | + public function the_content($the_content) { |
|
239 | 239 | // check if M-mode is engaged and for EE shortcode |
240 | - if ( $this->level() && strpos( $the_content, '[ESPRESSO_' )) { |
|
240 | + if ($this->level() && strpos($the_content, '[ESPRESSO_')) { |
|
241 | 241 | // this can eventually be moved to a template, or edited via admin. But for now... |
242 | 242 | $the_content = sprintf( |
243 | - __( '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso' ), |
|
243 | + __('%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso'), |
|
244 | 244 | '<h2>', |
245 | 245 | '</h2><p>', |
246 | 246 | '</p>' |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function display_maintenance_mode_notice() { |
264 | 264 | // check if M-mode is engaged and for EE shortcode |
265 | - if ( $this->real_level() && current_user_can( 'administrator' ) && ! is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )) { |
|
265 | + if ($this->real_level() && current_user_can('administrator') && ! is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) { |
|
266 | 266 | printf( |
267 | - __( '%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' ), |
|
267 | + __('%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'), |
|
268 | 268 | '<div id="ee-m-mode-admin-notice-dv" class=""><a class="close-espresso-notice" title="', |
269 | 269 | '">×</a><p>', |
270 | - ' » <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">', |
|
270 | + ' » <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">', |
|
271 | 271 | '</a></p></div>' |
272 | 272 | ); |
273 | 273 | } |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | * @ return void |
286 | 286 | */ |
287 | 287 | final function __destruct() {} |
288 | - final function __call($a,$b) {} |
|
288 | + final function __call($a, $b) {} |
|
289 | 289 | final function __get($a) {} |
290 | - final function __set($a,$b) {} |
|
290 | + final function __set($a, $b) {} |
|
291 | 291 | final function __isset($a) {} |
292 | 292 | final function __unset($a) {} |
293 | 293 | final function __sleep() { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | final function __invoke() {} |
299 | 299 | final function __set_state() {} |
300 | 300 | final function __clone() {} |
301 | - final static function __callStatic($a,$b) {} |
|
301 | + final static function __callStatic($a, $b) {} |
|
302 | 302 | |
303 | 303 | } |
304 | 304 | // End of file EE_Maintenance_Mode.core.php |
@@ -121,7 +121,7 @@ |
||
121 | 121 | |
122 | 122 | /** |
123 | 123 | * resolve_route |
124 | - * |
|
124 | + * |
|
125 | 125 | * this method simply takes a valid route, and resolves what module class method the route points to |
126 | 126 | * |
127 | 127 | * @access public |
@@ -61,31 +61,31 @@ discard block |
||
61 | 61 | * @param WP_Query $WP_Query |
62 | 62 | * @return string | NULL |
63 | 63 | */ |
64 | - public function get_route( WP_Query $WP_Query ) { |
|
64 | + public function get_route(WP_Query $WP_Query) { |
|
65 | 65 | $this->WP_Query = $WP_Query; |
66 | 66 | // assume this if first route being called |
67 | 67 | $previous_route = FALSE; |
68 | 68 | // but is it really ??? |
69 | - if ( ! empty( self::$_previous_routes )) { |
|
69 | + if ( ! empty(self::$_previous_routes)) { |
|
70 | 70 | // get last run route |
71 | - $previous_routes = array_values( self::$_previous_routes ); |
|
72 | - $previous_route = array_pop( $previous_routes ); |
|
71 | + $previous_routes = array_values(self::$_previous_routes); |
|
72 | + $previous_route = array_pop($previous_routes); |
|
73 | 73 | } |
74 | 74 | // has another route already been run ? |
75 | - if ( $previous_route ) { |
|
75 | + if ($previous_route) { |
|
76 | 76 | // check if forwarding has been set |
77 | - $current_route = $this->get_forward( $previous_route ); |
|
77 | + $current_route = $this->get_forward($previous_route); |
|
78 | 78 | try { |
79 | 79 | //check for recursive forwarding |
80 | - if ( isset( self::$_previous_routes[ $current_route ] )) { |
|
80 | + if (isset(self::$_previous_routes[$current_route])) { |
|
81 | 81 | throw new EE_Error( |
82 | 82 | sprintf( |
83 | - __('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'), |
|
83 | + __('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'), |
|
84 | 84 | $current_route |
85 | 85 | ) |
86 | 86 | ); |
87 | 87 | } |
88 | - } catch ( EE_Error $e ) { |
|
88 | + } catch (EE_Error $e) { |
|
89 | 89 | $e->get_error(); |
90 | 90 | return NULL; |
91 | 91 | } |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | // grab all routes |
96 | 96 | $routes = EE_Registry::instance()->CFG->get_routes(); |
97 | 97 | //d( $routes ); |
98 | - foreach( $routes as $key => $route ) { |
|
98 | + foreach ($routes as $key => $route) { |
|
99 | 99 | // check request for module route |
100 | - if ( EE_Registry::instance()->REQ->is_set( $key )) { |
|
100 | + if (EE_Registry::instance()->REQ->is_set($key)) { |
|
101 | 101 | //echo '<b style="color:#2EA2CC;">key : <span style="color:#E76700">' . $key . '</span></b><br />'; |
102 | - $current_route = sanitize_text_field( EE_Registry::instance()->REQ->get( $key )); |
|
103 | - if ( $current_route ) { |
|
104 | - $current_route = array( $key, $current_route ); |
|
102 | + $current_route = sanitize_text_field(EE_Registry::instance()->REQ->get($key)); |
|
103 | + if ($current_route) { |
|
104 | + $current_route = array($key, $current_route); |
|
105 | 105 | //echo '<b style="color:#2EA2CC;">current_route : <span style="color:#E76700">' . $current_route . '</span></b><br />'; |
106 | 106 | break; |
107 | 107 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | } |
111 | 111 | // sorry, but I can't read what you route ! |
112 | - if ( empty( $current_route )) { |
|
112 | + if (empty($current_route)) { |
|
113 | 113 | return NULL; |
114 | 114 | } |
115 | 115 | //add route to previous routes array |
@@ -129,46 +129,46 @@ discard block |
||
129 | 129 | * @param string $current_route |
130 | 130 | * @return mixed EED_Module | boolean |
131 | 131 | */ |
132 | - public function resolve_route( $key, $current_route ) { |
|
132 | + public function resolve_route($key, $current_route) { |
|
133 | 133 | // get module method that route has been mapped to |
134 | - $module_method = EE_Config::get_route( $current_route, $key ); |
|
134 | + $module_method = EE_Config::get_route($current_route, $key); |
|
135 | 135 | //EEH_Debug_Tools::printr( $module_method, '$module_method <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
136 | 136 | // verify result was returned |
137 | - if ( empty( $module_method )) { |
|
138 | - $msg = sprintf( __( 'The requested route %s could not be mapped to any registered modules.', 'event_espresso' ), $current_route ); |
|
139 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
137 | + if (empty($module_method)) { |
|
138 | + $msg = sprintf(__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'), $current_route); |
|
139 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
140 | 140 | return FALSE; |
141 | 141 | } |
142 | 142 | // verify that result is an array |
143 | - if ( ! is_array( $module_method )) { |
|
144 | - $msg = sprintf( __( 'The %s route has not been properly registered.', 'event_espresso' ), $current_route ); |
|
145 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
143 | + if ( ! is_array($module_method)) { |
|
144 | + $msg = sprintf(__('The %s route has not been properly registered.', 'event_espresso'), $current_route); |
|
145 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
146 | 146 | return FALSE; |
147 | 147 | } |
148 | 148 | // grab module name |
149 | 149 | $module_name = $module_method[0]; |
150 | 150 | // verify that a class method was registered properly |
151 | - if ( ! isset( $module_method[1] )) { |
|
152 | - $msg = sprintf( __( 'A class method for the %s route has not been properly registered.', 'event_espresso' ), $current_route ); |
|
153 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
151 | + if ( ! isset($module_method[1])) { |
|
152 | + $msg = sprintf(__('A class method for the %s route has not been properly registered.', 'event_espresso'), $current_route); |
|
153 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
154 | 154 | return FALSE; |
155 | 155 | } |
156 | 156 | // grab method |
157 | 157 | $method = $module_method[1]; |
158 | 158 | // verify that class exists |
159 | - if ( ! class_exists( $module_name )) { |
|
160 | - $msg = sprintf( __( 'The requested %s class could not be found.', 'event_espresso' ), $module_name ); |
|
161 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
159 | + if ( ! class_exists($module_name)) { |
|
160 | + $msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name); |
|
161 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
162 | 162 | return FALSE; |
163 | 163 | } |
164 | 164 | // verify that method exists |
165 | - if ( ! method_exists( $module_name, $method )) { |
|
166 | - $msg = sprintf( __( 'The class method %s for the %s route is in invalid.', 'event_espresso' ), $method, $current_route ); |
|
167 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
165 | + if ( ! method_exists($module_name, $method)) { |
|
166 | + $msg = sprintf(__('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route); |
|
167 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
168 | 168 | return FALSE; |
169 | 169 | } |
170 | 170 | // instantiate module and call route method |
171 | - return $this->_module_router( $module_name, $method ); |
|
171 | + return $this->_module_router($module_name, $method); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | * @param string $module_name |
183 | 183 | * @return EED_Module | NULL |
184 | 184 | */ |
185 | - public static function module_factory( $module_name ) { |
|
186 | - if ( $module_name == 'EED_Module' ) { |
|
187 | - 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__ ); |
|
185 | + public static function module_factory($module_name) { |
|
186 | + if ($module_name == 'EED_Module') { |
|
187 | + 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__); |
|
188 | 188 | return NULL; |
189 | 189 | } |
190 | 190 | // let's pause to reflect on this... |
191 | - $mod_reflector = new ReflectionClass( $module_name ); |
|
191 | + $mod_reflector = new ReflectionClass($module_name); |
|
192 | 192 | // ensure that class is actually a module |
193 | - if ( ! $mod_reflector->isSubclassOf( 'EED_Module' )) { |
|
194 | - EE_Error::add_error( sprintf( __( 'The requested %s module is not of the class EED_Module.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
193 | + if ( ! $mod_reflector->isSubclassOf('EED_Module')) { |
|
194 | + EE_Error::add_error(sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__); |
|
195 | 195 | return NULL; |
196 | 196 | } |
197 | 197 | // instantiate and return module class |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | * @param string $method |
210 | 210 | * @return EED_Module | NULL |
211 | 211 | */ |
212 | - private function _module_router( $module_name, $method ) { |
|
212 | + private function _module_router($module_name, $method) { |
|
213 | 213 | // instantiate module class |
214 | - $module = EE_Module_Request_Router::module_factory( $module_name ); |
|
215 | - if ( $module instanceof EED_Module ) { |
|
214 | + $module = EE_Module_Request_Router::module_factory($module_name); |
|
215 | + if ($module instanceof EED_Module) { |
|
216 | 216 | // and call whatever action the route was for |
217 | 217 | try { |
218 | - call_user_func( array( $module, $method ), $this->WP_Query ); |
|
219 | - } catch ( EE_Error $e ) { |
|
218 | + call_user_func(array($module, $method), $this->WP_Query); |
|
219 | + } catch (EE_Error $e) { |
|
220 | 220 | $e->get_error(); |
221 | 221 | return NULL; |
222 | 222 | } |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @param $current_route |
234 | 234 | * @return string |
235 | 235 | */ |
236 | - public function get_forward( $current_route ) { |
|
237 | - return EE_Config::get_forward( $current_route ); |
|
236 | + public function get_forward($current_route) { |
|
237 | + return EE_Config::get_forward($current_route); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | * @param $current_route |
247 | 247 | * @return string |
248 | 248 | */ |
249 | - public function get_view( $current_route ) { |
|
250 | - return EE_Config::get_view( $current_route ); |
|
249 | + public function get_view($current_route) { |
|
250 | + return EE_Config::get_view($current_route); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param $b |
258 | 258 | * @return bool |
259 | 259 | */ |
260 | - public function __set($a,$b) { return FALSE; } |
|
260 | + public function __set($a, $b) { return FALSE; } |
|
261 | 261 | |
262 | 262 | |
263 | 263 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | 60 | // check if class object is instantiated, and instantiated properly |
61 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Network_Config )) { |
|
61 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Network_Config)) { |
|
62 | 62 | self::$_instance = new self(); |
63 | 63 | } |
64 | 64 | return self::$_instance; |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * @return void |
75 | 75 | */ |
76 | 76 | private function __construct() { |
77 | - do_action( 'AHEE__EE_Network_Config__construct__begin',$this ); |
|
77 | + do_action('AHEE__EE_Network_Config__construct__begin', $this); |
|
78 | 78 | //set defaults |
79 | - $this->core = apply_filters( 'FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config() ); |
|
79 | + $this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config()); |
|
80 | 80 | $this->addons = array(); |
81 | 81 | |
82 | 82 | $this->_load_config(); |
83 | 83 | |
84 | 84 | // construct__end hook |
85 | - do_action( 'AHEE__EE_Network_Config__construct__end',$this ); |
|
85 | + do_action('AHEE__EE_Network_Config__construct__end', $this); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | */ |
96 | 96 | private function _load_config() { |
97 | 97 | $config = $this->get_config(); |
98 | - foreach ( $config as $prop => $settings ) { |
|
99 | - $prop_class = is_object( $settings ) ? get_class( $this->$prop ) : FALSE; |
|
100 | - if ( ! empty( $settings ) && ( ! $prop_class || ( $settings instanceof $prop_class ))) { |
|
98 | + foreach ($config as $prop => $settings) { |
|
99 | + $prop_class = is_object($settings) ? get_class($this->$prop) : FALSE; |
|
100 | + if ( ! empty($settings) && ( ! $prop_class || ($settings instanceof $prop_class))) { |
|
101 | 101 | $this->$prop = $settings; |
102 | 102 | } |
103 | 103 | } |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function get_config() { |
116 | 116 | // grab network configuration |
117 | - $CFG = get_site_option( 'ee_network_config', array() ); |
|
118 | - $CFG = apply_filters( 'FHEE__EE_Network_Config__get_config__CFG', $CFG ); |
|
117 | + $CFG = get_site_option('ee_network_config', array()); |
|
118 | + $CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG); |
|
119 | 119 | return $CFG; |
120 | 120 | } |
121 | 121 | |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | * @access public |
128 | 128 | * @return boolean success |
129 | 129 | */ |
130 | - public function update_config( $add_success = FALSE, $add_error = TRUE ) { |
|
131 | - do_action( 'AHEE__EE_Network_Config__update_config__begin',$this ); |
|
130 | + public function update_config($add_success = FALSE, $add_error = TRUE) { |
|
131 | + do_action('AHEE__EE_Network_Config__update_config__begin', $this); |
|
132 | 132 | // compare existing settings with what's already saved' |
133 | 133 | $saved_config = $this->get_config(); |
134 | 134 | // update |
135 | - $saved = $saved_config == $this ? TRUE : update_site_option( 'ee_network_config', $this ); |
|
136 | - do_action( 'AHEE__EE_Network_Config__update_config__end', $this, $saved ); |
|
135 | + $saved = $saved_config == $this ? TRUE : update_site_option('ee_network_config', $this); |
|
136 | + do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved); |
|
137 | 137 | // if config remains the same or was updated successfully |
138 | - if ( $saved ) { |
|
139 | - if ( $add_success ) { |
|
140 | - $msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso' ) : __( 'Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso' ); |
|
141 | - EE_Error::add_success( $msg ); |
|
138 | + if ($saved) { |
|
139 | + if ($add_success) { |
|
140 | + $msg = is_multisite() ? __('The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso') : __('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso'); |
|
141 | + EE_Error::add_success($msg); |
|
142 | 142 | } |
143 | 143 | return TRUE; |
144 | 144 | } else { |
145 | - if ( $add_error ) { |
|
146 | - $msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings were not updated.', 'event_espresso' ) : __( 'Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso' ); |
|
147 | - EE_Error::add_error( $msg , __FILE__, __FUNCTION__, __LINE__ ); |
|
145 | + if ($add_error) { |
|
146 | + $msg = is_multisite() ? __('The Event Espresso Network Configuration Settings were not updated.', 'event_espresso') : __('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso'); |
|
147 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
148 | 148 | } |
149 | 149 | return FALSE; |
150 | 150 | } |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @return array |
159 | 159 | */ |
160 | 160 | public function __sleep() { |
161 | - return apply_filters( 'FHEE__EE_Network_Config__sleep',array( |
|
161 | + return apply_filters('FHEE__EE_Network_Config__sleep', array( |
|
162 | 162 | 'core', |
163 | - ) ); |
|
163 | + )); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | } //end EE_Network_Config. |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * This property is used to hold an array of EE_default_term objects assigned to a custom post type when the post for that post type is published with no terms set for the taxonomy. |
35 | - * |
|
35 | + * |
|
36 | 36 | * @var array of EE_Default_Term objects |
37 | 37 | */ |
38 | 38 | protected $_default_terms = array(); |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | public function __construct() { |
51 | 51 | // throw new EE_Error('error'); |
52 | 52 | |
53 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
53 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
54 | 54 | |
55 | 55 | //wp have no MONTH_IN_SECONDS constant. So we approximate our own assuming all months are 4 weeks long. |
56 | - if ( !defined('MONTH_IN_SECONDS' ) ) |
|
57 | - define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
56 | + if ( ! defined('MONTH_IN_SECONDS')) |
|
57 | + define('MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4); |
|
58 | 58 | |
59 | - if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){ |
|
59 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
60 | 60 | $this->_uxip_hooks(); |
61 | 61 | } |
62 | 62 | |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
66 | 66 | |
67 | 67 | //has optin been selected for datacollection? |
68 | - $espresso_data_optin = !empty($ueip_optin) ? $ueip_optin : NULL; |
|
68 | + $espresso_data_optin = ! empty($ueip_optin) ? $ueip_optin : NULL; |
|
69 | 69 | |
70 | - if ( empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance ) { |
|
71 | - add_action('admin_notices', array( $this, 'espresso_data_collection_optin_notice' ), 10 ); |
|
72 | - add_action('admin_enqueue_scripts', array( $this, 'espresso_data_collection_enqueue_scripts' ), 10 ); |
|
73 | - add_action('wp_ajax_espresso_data_optin', array( $this, 'espresso_data_optin_ajax_handler' ), 10 ); |
|
70 | + if (empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance) { |
|
71 | + add_action('admin_notices', array($this, 'espresso_data_collection_optin_notice'), 10); |
|
72 | + add_action('admin_enqueue_scripts', array($this, 'espresso_data_collection_enqueue_scripts'), 10); |
|
73 | + add_action('wp_ajax_espresso_data_optin', array($this, 'espresso_data_optin_ajax_handler'), 10); |
|
74 | 74 | update_option('ee_ueip_optin', 'yes'); |
75 | 75 | $espresso_data_optin = 'yes'; |
76 | 76 | } |
@@ -79,80 +79,80 @@ discard block |
||
79 | 79 | $extra_stats = array(); |
80 | 80 | |
81 | 81 | //only collect extra stats if the plugin user has opted in. |
82 | - if ( !empty($espresso_data_optin) && $espresso_data_optin == 'yes' ) { |
|
82 | + if ( ! empty($espresso_data_optin) && $espresso_data_optin == 'yes') { |
|
83 | 83 | //let's only setup extra data if transient has expired |
84 | - if ( false === ( $transient = get_transient('ee_extra_data') ) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
84 | + if (false === ($transient = get_transient('ee_extra_data')) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
85 | 85 | |
86 | 86 | $current_site = is_multisite() ? get_current_site() : NULL; |
87 | - $site_pre = ! is_main_site() && ! empty($current_site) ? trim( preg_replace('/\b\w\S\w\b/', '', $current_site->domain ), '.' ) . '_' : ''; |
|
87 | + $site_pre = ! is_main_site() && ! empty($current_site) ? trim(preg_replace('/\b\w\S\w\b/', '', $current_site->domain), '.').'_' : ''; |
|
88 | 88 | |
89 | 89 | |
90 | 90 | //active gateways |
91 | 91 | $active_gateways = get_option('event_espresso_active_gateways'); |
92 | - if ( !empty($active_gateways ) ) { |
|
93 | - foreach ( (array) $active_gateways as $gateway => $ignore ) { |
|
94 | - $extra_stats[$site_pre . $gateway . '_gateway_active'] = 1; |
|
92 | + if ( ! empty($active_gateways)) { |
|
93 | + foreach ((array) $active_gateways as $gateway => $ignore) { |
|
94 | + $extra_stats[$site_pre.$gateway.'_gateway_active'] = 1; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - if ( is_multisite() && is_main_site() ) { |
|
98 | + if (is_multisite() && is_main_site()) { |
|
99 | 99 | $extra_stats['is_multisite'] = true; |
100 | 100 | } |
101 | 101 | |
102 | 102 | //what is the current active theme? |
103 | 103 | $active_theme = get_option('uxip_ee_active_theme'); |
104 | - if ( !empty( $active_theme ) ) |
|
105 | - $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
104 | + if ( ! empty($active_theme)) |
|
105 | + $extra_stats[$site_pre.'active_theme'] = $active_theme; |
|
106 | 106 | |
107 | 107 | //event info regarding an all event count and all "active" event count |
108 | 108 | $all_events_count = get_option('uxip_ee4_all_events_count'); |
109 | - if ( !empty( $all_events_count ) ) |
|
110 | - $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
109 | + if ( ! empty($all_events_count)) |
|
110 | + $extra_stats[$site_pre.'ee4_all_events_count'] = $all_events_count; |
|
111 | 111 | $active_events_count = get_option('uxip_ee4_active_events_count'); |
112 | - if ( !empty( $active_events_count ) ) |
|
113 | - $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
112 | + if ( ! empty($active_events_count)) |
|
113 | + $extra_stats[$site_pre.'ee4_active_events_count'] = $active_events_count; |
|
114 | 114 | |
115 | 115 | //datetime stuff |
116 | 116 | $dtt_count = get_option('uxip_ee_all_dtts_count'); |
117 | - if ( !empty( $dtt_count ) ) |
|
118 | - $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
117 | + if ( ! empty($dtt_count)) |
|
118 | + $extra_stats[$site_pre.'all_dtts_count'] = $dtt_count; |
|
119 | 119 | |
120 | 120 | $dtt_sold = get_option('uxip_ee_dtt_sold'); |
121 | - if ( !empty( $dtt_sold ) ) |
|
122 | - $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
121 | + if ( ! empty($dtt_sold)) |
|
122 | + $extra_stats[$site_pre.'dtt_sold'] = $dtt_sold; |
|
123 | 123 | |
124 | 124 | //ticket stuff |
125 | 125 | $all_tkt_count = get_option('uxip_ee_all_tkt_count'); |
126 | - if ( !empty( $all_tkt_count ) ) |
|
127 | - $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
126 | + if ( ! empty($all_tkt_count)) |
|
127 | + $extra_stats[$site_pre.'all_tkt_count'] = $all_tkt_count; |
|
128 | 128 | |
129 | 129 | $free_tkt_count = get_option('uxip_ee_free_tkt_count'); |
130 | - if ( !empty( $free_tkt_count ) ) |
|
131 | - $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
130 | + if ( ! empty($free_tkt_count)) |
|
131 | + $extra_stats[$site_pre.'free_tkt_count'] = $free_tkt_count; |
|
132 | 132 | |
133 | 133 | $paid_tkt_count = get_option('uxip_ee_paid_tkt_count'); |
134 | - if ( !empty( $paid_tkt_count ) ) |
|
135 | - $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
134 | + if ( ! empty($paid_tkt_count)) |
|
135 | + $extra_stats[$site_pre.'paid_tkt_count'] = $paid_tkt_count; |
|
136 | 136 | |
137 | - $tkt_sold = get_option('uxip_ee_tkt_sold' ); |
|
138 | - if ( !empty($tkt_sold) ) |
|
139 | - $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
137 | + $tkt_sold = get_option('uxip_ee_tkt_sold'); |
|
138 | + if ( ! empty($tkt_sold)) |
|
139 | + $extra_stats[$site_pre.'tkt_sold'] = $tkt_sold; |
|
140 | 140 | |
141 | 141 | //phpversion checking |
142 | 142 | $extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown'; |
143 | 143 | |
144 | 144 | //set transient |
145 | - set_transient( 'ee_extra_data', $extra_stats, WEEK_IN_SECONDS ); |
|
145 | + set_transient('ee_extra_data', $extra_stats, WEEK_IN_SECONDS); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | 150 | |
151 | 151 | // PUE Auto Upgrades stuff |
152 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { //include the file |
|
153 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php' ); |
|
152 | + if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { //include the file |
|
153 | + require_once(EE_THIRD_PARTY.'pue/pue-client.php'); |
|
154 | 154 | |
155 | - $api_key = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
155 | + $api_key = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
156 | 156 | $host_server_url = 'http://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. |
157 | 157 | |
158 | 158 | //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. |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | //$plugin_slug['prerelease']['b'] = 'some-pre-release-slug'; |
165 | 165 | //..WOULD work! |
166 | 166 | $plugin_slug = array( |
167 | - 'free' => array( 'decaf' => 'event-espresso-core-decaf' ), |
|
168 | - 'premium' => array( 'p' => 'event-espresso-core-reg' ), |
|
169 | - 'prerelease' => array( 'beta' => 'event-espresso-core-pr' ) |
|
167 | + 'free' => array('decaf' => 'event-espresso-core-decaf'), |
|
168 | + 'premium' => array('p' => 'event-espresso-core-reg'), |
|
169 | + 'prerelease' => array('beta' => 'event-espresso-core-pr') |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | * The purpose of this function is to display information about Event Espresso data collection and a optin selection for extra data collecting by users. |
194 | 194 | * @return string html. |
195 | 195 | */ |
196 | - public static function espresso_data_collection_optin_text( $extra = TRUE ) { |
|
197 | - if ( ! $extra ) { |
|
198 | - echo '<h4 '. (!$extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').'</h4>'; |
|
199 | - 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>' ); |
|
196 | + public static function espresso_data_collection_optin_text($extra = TRUE) { |
|
197 | + if ( ! $extra) { |
|
198 | + echo '<h4 '.( ! $extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').'</h4>'; |
|
199 | + 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>'); |
|
200 | 200 | } else { |
201 | - $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
|
201 | + $settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings')); |
|
202 | 202 | $settings_url .= '#UXIP_settings'; |
203 | - 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/" traget="_blank">', '</a>', '<a href="' . $settings_url . '" target="_blank">', '</a>' ); |
|
203 | + 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/" traget="_blank">', '</a>', '<a href="'.$settings_url.'" target="_blank">', '</a>'); |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | |
210 | 210 | function espresso_data_collection_optin_notice() { |
211 | 211 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
212 | - if ( $ueip_has_notified ) return; |
|
213 | - $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
|
214 | - $settings_url = $settings_url . '#UXIP_settings'; |
|
212 | + if ($ueip_has_notified) return; |
|
213 | + $settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings')); |
|
214 | + $settings_url = $settings_url.'#UXIP_settings'; |
|
215 | 215 | ?> |
216 | 216 | <div class="updated data-collect-optin" id="espresso-data-collect-optin-container"> |
217 | 217 | <div id="data-collect-optin-options-container"> |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @return void |
234 | 234 | */ |
235 | 235 | function espresso_data_collection_enqueue_scripts() { |
236 | - wp_register_script( 'ee-data-optin-js', EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
237 | - wp_register_style( 'ee-data-optin-css', EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
236 | + wp_register_script('ee-data-optin-js', EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
237 | + wp_register_style('ee-data-optin-css', EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION); |
|
238 | 238 | |
239 | 239 | wp_enqueue_script('ee-data-optin-js'); |
240 | 240 | wp_enqueue_style('ee-data-optin-css'); |
@@ -249,14 +249,14 @@ discard block |
||
249 | 249 | function espresso_data_optin_ajax_handler() { |
250 | 250 | |
251 | 251 | //verify nonce |
252 | - if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit(); |
|
252 | + if (isset($_POST['nonce']) && ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) exit(); |
|
253 | 253 | |
254 | 254 | //made it here so let's save the selection |
255 | - $ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no'; |
|
255 | + $ueip_optin = isset($_POST['selection']) ? $_POST['selection'] : 'no'; |
|
256 | 256 | |
257 | 257 | //update_option('ee_ueip_optin', $ueip_optin); |
258 | 258 | EE_Registry::instance()->CFG->core->ee_ueip_has_notified = 1; |
259 | - EE_Registry::instance()->CFG->update_espresso_config( FALSE, FALSE ); |
|
259 | + EE_Registry::instance()->CFG->update_espresso_config(FALSE, FALSE); |
|
260 | 260 | exit(); |
261 | 261 | } |
262 | 262 | |
@@ -269,22 +269,22 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public static function is_update_available($basename = '') { |
271 | 271 | |
272 | - $basename = ! empty( $basename ) ? $basename : EE_PLUGIN_BASENAME; |
|
272 | + $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
273 | 273 | |
274 | 274 | $update = false; |
275 | 275 | |
276 | - $folder = DS . dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
276 | + $folder = DS.dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
277 | 277 | |
278 | 278 | $plugins = get_plugins($folder); |
279 | - $current = get_site_transient( 'update_plugins' ); |
|
279 | + $current = get_site_transient('update_plugins'); |
|
280 | 280 | |
281 | - foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
|
282 | - if ( isset( $current->response['plugin_file'] ) ) |
|
281 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
282 | + if (isset($current->response['plugin_file'])) |
|
283 | 283 | $update = true; |
284 | 284 | } |
285 | 285 | |
286 | 286 | //it's possible that there is an update but an invalid site-license-key is in use |
287 | - if ( get_site_option('pue_json_error_' . $basename ) ) |
|
287 | + if (get_site_option('pue_json_error_'.$basename)) |
|
288 | 288 | $update = true; |
289 | 289 | |
290 | 290 | return $update; |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | * @return void |
303 | 303 | */ |
304 | 304 | public function _uxip_hooks() { |
305 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
306 | - add_action('admin_init', array( $this, 'track_active_theme' ) ); |
|
307 | - add_action('admin_init', array( $this, 'track_event_info' ) ); |
|
305 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
306 | + add_action('admin_init', array($this, 'track_active_theme')); |
|
307 | + add_action('admin_init', array($this, 'track_event_info')); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
@@ -313,65 +313,65 @@ discard block |
||
313 | 313 | |
314 | 314 | public function track_active_theme() { |
315 | 315 | //we only check this once a month. |
316 | - if ( false === ( $transient = get_transient( 'ee_active_theme_check' ) ) ) { |
|
316 | + if (false === ($transient = get_transient('ee_active_theme_check'))) { |
|
317 | 317 | $theme = wp_get_theme(); |
318 | - update_option('uxip_ee_active_theme', $theme->get('Name') ); |
|
319 | - set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS ); |
|
318 | + update_option('uxip_ee_active_theme', $theme->get('Name')); |
|
319 | + set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | 323 | |
324 | 324 | public function track_event_info() { |
325 | 325 | //we only check this once every couple weeks. |
326 | - if ( false === ( $transient = get_transient( 'ee4_event_info_check') ) ) { |
|
326 | + if (false === ($transient = get_transient('ee4_event_info_check'))) { |
|
327 | 327 | //first let's get the number for ALL events |
328 | 328 | $EVT = EE_Registry::instance()->load_model('Event'); |
329 | 329 | $DTT = EE_Registry::instance()->load_model('Datetime'); |
330 | 330 | $TKT = EE_Registry::instance()->load_model('Ticket'); |
331 | 331 | $count = $EVT->count(); |
332 | - if ( $count > 0 ) |
|
332 | + if ($count > 0) |
|
333 | 333 | update_option('uxip_ee4_all_events_count', $count); |
334 | 334 | |
335 | 335 | //next let's just get the number of ACTIVE events |
336 | 336 | $count_active = $EVT->get_active_events(array(), TRUE); |
337 | - if ( $count_active > 0 ) |
|
337 | + if ($count_active > 0) |
|
338 | 338 | update_option('uxip_ee4_active_events_count', $count_active); |
339 | 339 | |
340 | 340 | //datetimes! |
341 | 341 | $dtt_count = $DTT->count(); |
342 | - if ( $dtt_count > 0 ) |
|
343 | - update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
342 | + if ($dtt_count > 0) |
|
343 | + update_option('uxip_ee_all_dtts_count', $dtt_count); |
|
344 | 344 | |
345 | 345 | |
346 | 346 | //dttsold |
347 | 347 | $dtt_sold = $DTT->sum(array(), 'DTT_sold'); |
348 | - if ( $dtt_sold > 0 ) |
|
349 | - update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
348 | + if ($dtt_sold > 0) |
|
349 | + update_option('uxip_ee_dtt_sold', $dtt_sold); |
|
350 | 350 | |
351 | 351 | //allticketcount |
352 | 352 | $all_tkt_count = $TKT->count(); |
353 | - if ( $all_tkt_count > 0 ) |
|
354 | - update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
353 | + if ($all_tkt_count > 0) |
|
354 | + update_option('uxip_ee_all_tkt_count', $all_tkt_count); |
|
355 | 355 | |
356 | 356 | //freetktcount |
357 | - $_where = array( 'TKT_price' => 0 ); |
|
357 | + $_where = array('TKT_price' => 0); |
|
358 | 358 | $free_tkt_count = $TKT->count(array($_where)); |
359 | - if ( $free_tkt_count > 0 ) |
|
360 | - update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
359 | + if ($free_tkt_count > 0) |
|
360 | + update_option('uxip_ee_free_tkt_count', $free_tkt_count); |
|
361 | 361 | |
362 | 362 | //paidtktcount |
363 | - $_where = array( 'TKT_price' => array('>', 0) ); |
|
364 | - $paid_tkt_count = $TKT->count( array( $_where ) ); |
|
365 | - if ( $paid_tkt_count > 0 ) |
|
366 | - update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
363 | + $_where = array('TKT_price' => array('>', 0)); |
|
364 | + $paid_tkt_count = $TKT->count(array($_where)); |
|
365 | + if ($paid_tkt_count > 0) |
|
366 | + update_option('uxip_ee_paid_tkt_count', $paid_tkt_count); |
|
367 | 367 | |
368 | 368 | //tktsold |
369 | - $tkt_sold = $TKT->sum( array(), 'TKT_sold' ); |
|
370 | - if( $tkt_sold > 0 ) |
|
371 | - update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
369 | + $tkt_sold = $TKT->sum(array(), 'TKT_sold'); |
|
370 | + if ($tkt_sold > 0) |
|
371 | + update_option('uxip_ee_tkt_sold', $tkt_sold); |
|
372 | 372 | |
373 | 373 | |
374 | - set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 ); |
|
374 | + set_transient('ee4_event_info_check', 1, WEEK_IN_SECONDS * 2); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -53,8 +55,9 @@ discard block |
||
53 | 55 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
54 | 56 | |
55 | 57 | //wp have no MONTH_IN_SECONDS constant. So we approximate our own assuming all months are 4 weeks long. |
56 | - if ( !defined('MONTH_IN_SECONDS' ) ) |
|
57 | - define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
58 | + if ( !defined('MONTH_IN_SECONDS' ) ) { |
|
59 | + define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
60 | + } |
|
58 | 61 | |
59 | 62 | if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){ |
60 | 63 | $this->_uxip_hooks(); |
@@ -101,42 +104,51 @@ discard block |
||
101 | 104 | |
102 | 105 | //what is the current active theme? |
103 | 106 | $active_theme = get_option('uxip_ee_active_theme'); |
104 | - if ( !empty( $active_theme ) ) |
|
105 | - $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
107 | + if ( !empty( $active_theme ) ) { |
|
108 | + $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
109 | + } |
|
106 | 110 | |
107 | 111 | //event info regarding an all event count and all "active" event count |
108 | 112 | $all_events_count = get_option('uxip_ee4_all_events_count'); |
109 | - if ( !empty( $all_events_count ) ) |
|
110 | - $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
113 | + if ( !empty( $all_events_count ) ) { |
|
114 | + $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
115 | + } |
|
111 | 116 | $active_events_count = get_option('uxip_ee4_active_events_count'); |
112 | - if ( !empty( $active_events_count ) ) |
|
113 | - $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
117 | + if ( !empty( $active_events_count ) ) { |
|
118 | + $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
119 | + } |
|
114 | 120 | |
115 | 121 | //datetime stuff |
116 | 122 | $dtt_count = get_option('uxip_ee_all_dtts_count'); |
117 | - if ( !empty( $dtt_count ) ) |
|
118 | - $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
123 | + if ( !empty( $dtt_count ) ) { |
|
124 | + $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
125 | + } |
|
119 | 126 | |
120 | 127 | $dtt_sold = get_option('uxip_ee_dtt_sold'); |
121 | - if ( !empty( $dtt_sold ) ) |
|
122 | - $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
128 | + if ( !empty( $dtt_sold ) ) { |
|
129 | + $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
130 | + } |
|
123 | 131 | |
124 | 132 | //ticket stuff |
125 | 133 | $all_tkt_count = get_option('uxip_ee_all_tkt_count'); |
126 | - if ( !empty( $all_tkt_count ) ) |
|
127 | - $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
134 | + if ( !empty( $all_tkt_count ) ) { |
|
135 | + $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
136 | + } |
|
128 | 137 | |
129 | 138 | $free_tkt_count = get_option('uxip_ee_free_tkt_count'); |
130 | - if ( !empty( $free_tkt_count ) ) |
|
131 | - $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
139 | + if ( !empty( $free_tkt_count ) ) { |
|
140 | + $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
141 | + } |
|
132 | 142 | |
133 | 143 | $paid_tkt_count = get_option('uxip_ee_paid_tkt_count'); |
134 | - if ( !empty( $paid_tkt_count ) ) |
|
135 | - $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
144 | + if ( !empty( $paid_tkt_count ) ) { |
|
145 | + $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
146 | + } |
|
136 | 147 | |
137 | 148 | $tkt_sold = get_option('uxip_ee_tkt_sold' ); |
138 | - if ( !empty($tkt_sold) ) |
|
139 | - $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
149 | + if ( !empty($tkt_sold) ) { |
|
150 | + $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
151 | + } |
|
140 | 152 | |
141 | 153 | //phpversion checking |
142 | 154 | $extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown'; |
@@ -209,7 +221,9 @@ discard block |
||
209 | 221 | |
210 | 222 | function espresso_data_collection_optin_notice() { |
211 | 223 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
212 | - if ( $ueip_has_notified ) return; |
|
224 | + if ( $ueip_has_notified ) { |
|
225 | + return; |
|
226 | + } |
|
213 | 227 | $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
214 | 228 | $settings_url = $settings_url . '#UXIP_settings'; |
215 | 229 | ?> |
@@ -249,7 +263,9 @@ discard block |
||
249 | 263 | function espresso_data_optin_ajax_handler() { |
250 | 264 | |
251 | 265 | //verify nonce |
252 | - if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit(); |
|
266 | + if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) { |
|
267 | + exit(); |
|
268 | + } |
|
253 | 269 | |
254 | 270 | //made it here so let's save the selection |
255 | 271 | $ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no'; |
@@ -279,13 +295,15 @@ discard block |
||
279 | 295 | $current = get_site_transient( 'update_plugins' ); |
280 | 296 | |
281 | 297 | foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
282 | - if ( isset( $current->response['plugin_file'] ) ) |
|
283 | - $update = true; |
|
298 | + if ( isset( $current->response['plugin_file'] ) ) { |
|
299 | + $update = true; |
|
300 | + } |
|
284 | 301 | } |
285 | 302 | |
286 | 303 | //it's possible that there is an update but an invalid site-license-key is in use |
287 | - if ( get_site_option('pue_json_error_' . $basename ) ) |
|
288 | - $update = true; |
|
304 | + if ( get_site_option('pue_json_error_' . $basename ) ) { |
|
305 | + $update = true; |
|
306 | + } |
|
289 | 307 | |
290 | 308 | return $update; |
291 | 309 | } |
@@ -329,46 +347,54 @@ discard block |
||
329 | 347 | $DTT = EE_Registry::instance()->load_model('Datetime'); |
330 | 348 | $TKT = EE_Registry::instance()->load_model('Ticket'); |
331 | 349 | $count = $EVT->count(); |
332 | - if ( $count > 0 ) |
|
333 | - update_option('uxip_ee4_all_events_count', $count); |
|
350 | + if ( $count > 0 ) { |
|
351 | + update_option('uxip_ee4_all_events_count', $count); |
|
352 | + } |
|
334 | 353 | |
335 | 354 | //next let's just get the number of ACTIVE events |
336 | 355 | $count_active = $EVT->get_active_events(array(), TRUE); |
337 | - if ( $count_active > 0 ) |
|
338 | - update_option('uxip_ee4_active_events_count', $count_active); |
|
356 | + if ( $count_active > 0 ) { |
|
357 | + update_option('uxip_ee4_active_events_count', $count_active); |
|
358 | + } |
|
339 | 359 | |
340 | 360 | //datetimes! |
341 | 361 | $dtt_count = $DTT->count(); |
342 | - if ( $dtt_count > 0 ) |
|
343 | - update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
362 | + if ( $dtt_count > 0 ) { |
|
363 | + update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
364 | + } |
|
344 | 365 | |
345 | 366 | |
346 | 367 | //dttsold |
347 | 368 | $dtt_sold = $DTT->sum(array(), 'DTT_sold'); |
348 | - if ( $dtt_sold > 0 ) |
|
349 | - update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
369 | + if ( $dtt_sold > 0 ) { |
|
370 | + update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
371 | + } |
|
350 | 372 | |
351 | 373 | //allticketcount |
352 | 374 | $all_tkt_count = $TKT->count(); |
353 | - if ( $all_tkt_count > 0 ) |
|
354 | - update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
375 | + if ( $all_tkt_count > 0 ) { |
|
376 | + update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
377 | + } |
|
355 | 378 | |
356 | 379 | //freetktcount |
357 | 380 | $_where = array( 'TKT_price' => 0 ); |
358 | 381 | $free_tkt_count = $TKT->count(array($_where)); |
359 | - if ( $free_tkt_count > 0 ) |
|
360 | - update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
382 | + if ( $free_tkt_count > 0 ) { |
|
383 | + update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
384 | + } |
|
361 | 385 | |
362 | 386 | //paidtktcount |
363 | 387 | $_where = array( 'TKT_price' => array('>', 0) ); |
364 | 388 | $paid_tkt_count = $TKT->count( array( $_where ) ); |
365 | - if ( $paid_tkt_count > 0 ) |
|
366 | - update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
389 | + if ( $paid_tkt_count > 0 ) { |
|
390 | + update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
391 | + } |
|
367 | 392 | |
368 | 393 | //tktsold |
369 | 394 | $tkt_sold = $TKT->sum( array(), 'TKT_sold' ); |
370 | - if( $tkt_sold > 0 ) |
|
371 | - update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
395 | + if( $tkt_sold > 0 ) { |
|
396 | + update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
397 | + } |
|
372 | 398 | |
373 | 399 | |
374 | 400 | set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 ); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public static function instance() { |
171 | 171 | // check if class object is instantiated |
172 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) { |
|
172 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) { |
|
173 | 173 | self::$_instance = new self(); |
174 | 174 | } |
175 | 175 | return self::$_instance; |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | * @return \EE_Registry |
185 | 185 | */ |
186 | 186 | private function __construct() { |
187 | - $this->load_core( 'Base' ); |
|
187 | + $this->load_core('Base'); |
|
188 | 188 | // class library |
189 | 189 | $this->LIB = new StdClass(); |
190 | 190 | $this->addons = new StdClass(); |
191 | 191 | $this->modules = new StdClass(); |
192 | 192 | $this->shortcodes = new StdClass(); |
193 | 193 | $this->widgets = new StdClass(); |
194 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' )); |
|
194 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function init() { |
206 | 206 | // Get current page protocol |
207 | - $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
|
207 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
208 | 208 | // Output admin-ajax.php URL with same protocol as current page |
209 | - self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol ); |
|
210 | - self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE; |
|
209 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
210 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | /** |
216 | 216 | * @param mixed string | EED_Module $module |
217 | 217 | */ |
218 | - public function add_module( $module ) { |
|
219 | - if ( $module instanceof EED_Module ) { |
|
220 | - $module_class = get_class( $module ); |
|
218 | + public function add_module($module) { |
|
219 | + if ($module instanceof EED_Module) { |
|
220 | + $module_class = get_class($module); |
|
221 | 221 | $this->modules->{$module_class} = $module; |
222 | 222 | } else { |
223 | - if ( ! class_exists( 'EE_Module_Request_Router' )) { |
|
224 | - $this->load_core( 'Module_Request_Router' ); |
|
223 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
224 | + $this->load_core('Module_Request_Router'); |
|
225 | 225 | } |
226 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
226 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @param string $module_name |
234 | 234 | * @return mixed EED_Module | NULL |
235 | 235 | */ |
236 | - public function get_module( $module_name = '' ) { |
|
237 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
236 | + public function get_module($module_name = '') { |
|
237 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -247,18 +247,18 @@ discard block |
||
247 | 247 | * @param bool $load_only |
248 | 248 | * @return mixed |
249 | 249 | */ |
250 | - public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
250 | + public function load_core($class_name, $arguments = array(), $load_only = FALSE) { |
|
251 | 251 | $core_paths = apply_filters( |
252 | 252 | 'FHEE__EE_Registry__load_core__core_paths', |
253 | 253 | array( |
254 | 254 | EE_CORE, |
255 | 255 | EE_ADMIN, |
256 | 256 | EE_CPTS, |
257 | - EE_CORE . 'data_migration_scripts' . DS |
|
257 | + EE_CORE.'data_migration_scripts'.DS |
|
258 | 258 | ) |
259 | 259 | ); |
260 | 260 | // retrieve instantiated class |
261 | - return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only ); |
|
261 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | * @param mixed $arguments |
272 | 272 | * @return EE_Data_Migration_Script_Base |
273 | 273 | */ |
274 | - public function load_dms ( $class_name, $arguments = array() ) { |
|
274 | + public function load_dms($class_name, $arguments = array()) { |
|
275 | 275 | // retrieve instantiated class |
276 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE ); |
|
276 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
289 | 289 | * @return EE_Base_Class |
290 | 290 | */ |
291 | - public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
292 | - $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
|
291 | + public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
292 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
293 | 293 | EE_CORE, |
294 | 294 | EE_CLASSES, |
295 | 295 | EE_BUSINESS |
296 | 296 | )); |
297 | 297 | // retrieve instantiated class |
298 | - return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
298 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | * @param bool $load_only |
310 | 310 | * @return EEH_Base |
311 | 311 | */ |
312 | - public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
313 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) ); |
|
312 | + public function load_helper($class_name, $arguments = array(), $load_only = TRUE) { |
|
313 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
314 | 314 | // retrieve instantiated class |
315 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only ); |
|
315 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -326,16 +326,16 @@ discard block |
||
326 | 326 | * @param bool $load_only |
327 | 327 | * @return mixed |
328 | 328 | */ |
329 | - public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
329 | + public function load_lib($class_name, $arguments = array(), $load_only = FALSE) { |
|
330 | 330 | $paths = array( |
331 | 331 | EE_LIBRARIES, |
332 | - EE_LIBRARIES . 'messages' . DS, |
|
333 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
334 | - EE_LIBRARIES . 'qtips' . DS, |
|
335 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
332 | + EE_LIBRARIES.'messages'.DS, |
|
333 | + EE_LIBRARIES.'shortcodes'.DS, |
|
334 | + EE_LIBRARIES.'qtips'.DS, |
|
335 | + EE_LIBRARIES.'payment_methods'.DS, |
|
336 | 336 | ); |
337 | 337 | // retrieve instantiated class |
338 | - return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only ); |
|
338 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | * @param bool $load_only |
349 | 349 | * @return EEM_Base |
350 | 350 | */ |
351 | - public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
352 | - $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
|
351 | + public function load_model($class_name, $arguments = array(), $load_only = FALSE) { |
|
352 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
353 | 353 | EE_MODELS, |
354 | 354 | EE_CORE |
355 | 355 | )); |
356 | 356 | // retrieve instantiated class |
357 | - return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only ); |
|
357 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -367,15 +367,15 @@ discard block |
||
367 | 367 | * @param bool $load_only |
368 | 368 | * @return mixed |
369 | 369 | */ |
370 | - public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
370 | + public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) { |
|
371 | 371 | $paths = array( |
372 | - EE_MODELS . 'fields' . DS, |
|
373 | - EE_MODELS . 'helpers' . DS, |
|
374 | - EE_MODELS . 'relations' . DS, |
|
375 | - EE_MODELS . 'strategies' . DS |
|
372 | + EE_MODELS.'fields'.DS, |
|
373 | + EE_MODELS.'helpers'.DS, |
|
374 | + EE_MODELS.'relations'.DS, |
|
375 | + EE_MODELS.'strategies'.DS |
|
376 | 376 | ); |
377 | 377 | // retrieve instantiated class |
378 | - return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only ); |
|
378 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
388 | 388 | * @return boolean |
389 | 389 | */ |
390 | - public function is_model_name( $model_name ){ |
|
391 | - return isset( $this->models[ $model_name ] ) ? TRUE : FALSE; |
|
390 | + public function is_model_name($model_name) { |
|
391 | + return isset($this->models[$model_name]) ? TRUE : FALSE; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | * @param bool $load_only |
404 | 404 | * @return mixed |
405 | 405 | */ |
406 | - public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
|
406 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) { |
|
407 | 407 | // retrieve instantiated class |
408 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
408 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | * @param bool $load_only |
421 | 421 | * @return EE_Addon |
422 | 422 | */ |
423 | - public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
|
423 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) { |
|
424 | 424 | // retrieve instantiated class |
425 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
425 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | * @internal param string $file_path - file path including file name |
441 | 441 | * @return bool | object |
442 | 442 | */ |
443 | - private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
443 | + private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
444 | 444 | // strip php file extension |
445 | - $class_name = str_replace( '.php', '', trim( $class_name )); |
|
445 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
446 | 446 | // does the class have a prefix ? |
447 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
447 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
448 | 448 | // make sure $class_prefix is uppercase |
449 | - $class_prefix = strtoupper( trim( $class_prefix )); |
|
449 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
450 | 450 | // add class prefix ONCE!!! |
451 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
451 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | $class_abbreviations = array( |
@@ -461,56 +461,56 @@ discard block |
||
461 | 461 | ); |
462 | 462 | |
463 | 463 | // check if class has already been loaded, and return it if it has been |
464 | - if ( isset( $class_abbreviations[ $class_name ] ) && ! is_null( $this->$class_abbreviations[ $class_name ] )) { |
|
465 | - return $this->$class_abbreviations[ $class_name ]; |
|
466 | - } else if ( isset ( $this->{$class_name} )) { |
|
464 | + if (isset($class_abbreviations[$class_name]) && ! is_null($this->$class_abbreviations[$class_name])) { |
|
465 | + return $this->$class_abbreviations[$class_name]; |
|
466 | + } else if (isset ($this->{$class_name} )) { |
|
467 | 467 | return $this->{$class_name}; |
468 | - } else if ( isset ( $this->LIB->$class_name )) { |
|
468 | + } else if (isset ($this->LIB->$class_name)) { |
|
469 | 469 | return $this->LIB->$class_name; |
470 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->$class_name )) { |
|
470 | + } else if ($class_prefix == 'addon' && isset ($this->addons->$class_name)) { |
|
471 | 471 | return $this->addons->$class_name; |
472 | 472 | } |
473 | 473 | |
474 | 474 | // assume all paths lead nowhere |
475 | 475 | $path = FALSE; |
476 | 476 | // make sure $file_paths is an array |
477 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
477 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
478 | 478 | // cycle thru paths |
479 | - foreach ( $file_paths as $key => $file_path ) { |
|
479 | + foreach ($file_paths as $key => $file_path) { |
|
480 | 480 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
481 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
481 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
482 | 482 | // prep file type |
483 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
483 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
484 | 484 | // build full file path |
485 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
485 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
486 | 486 | //does the file exist and can be read ? |
487 | - if ( is_readable( $file_paths[ $key ] )) { |
|
488 | - $path = $file_paths[ $key ]; |
|
487 | + if (is_readable($file_paths[$key])) { |
|
488 | + $path = $file_paths[$key]; |
|
489 | 489 | break; |
490 | 490 | } |
491 | 491 | } |
492 | 492 | // don't give up! you gotta... |
493 | 493 | try { |
494 | 494 | //does the file exist and can it be read ? |
495 | - if ( ! $path ) { |
|
495 | + if ( ! $path) { |
|
496 | 496 | // so sorry, can't find the file |
497 | - throw new EE_Error ( |
|
498 | - sprintf ( |
|
499 | - __('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'), |
|
500 | - trim( $type, '.' ), |
|
497 | + throw new EE_Error( |
|
498 | + sprintf( |
|
499 | + __('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'), |
|
500 | + trim($type, '.'), |
|
501 | 501 | $class_name, |
502 | - '<br />' . implode( ',<br />', $file_paths ) |
|
502 | + '<br />'.implode(',<br />', $file_paths) |
|
503 | 503 | ) |
504 | 504 | ); |
505 | 505 | } |
506 | 506 | // get the file |
507 | - require_once( $path ); |
|
507 | + require_once($path); |
|
508 | 508 | // if the class isn't already declared somewhere |
509 | - if ( class_exists( $class_name, FALSE ) === FALSE ) { |
|
509 | + if (class_exists($class_name, FALSE) === FALSE) { |
|
510 | 510 | // so sorry, not a class |
511 | 511 | throw new EE_Error( |
512 | 512 | sprintf( |
513 | - __('The %s file %s does not appear to contain the %s Class.','event_espresso'), |
|
513 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
514 | 514 | $type, |
515 | 515 | $path, |
516 | 516 | $class_name |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | ); |
519 | 519 | } |
520 | 520 | |
521 | - } catch ( EE_Error $e ) { |
|
521 | + } catch (EE_Error $e) { |
|
522 | 522 | $e->get_error(); |
523 | 523 | } |
524 | 524 | |
@@ -526,38 +526,38 @@ discard block |
||
526 | 526 | // don't give up! you gotta... |
527 | 527 | try { |
528 | 528 | // create reflection |
529 | - $reflector = new ReflectionClass( $class_name ); |
|
529 | + $reflector = new ReflectionClass($class_name); |
|
530 | 530 | // instantiate the class and add to the LIB array for tracking |
531 | 531 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
532 | - if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) { |
|
532 | + if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) { |
|
533 | 533 | // $instantiation_mode = 0; |
534 | 534 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
535 | 535 | return TRUE; |
536 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
536 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
537 | 537 | // $instantiation_mode = 1; |
538 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
539 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
538 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
539 | + } else if (method_exists($class_name, 'new_instance')) { |
|
540 | 540 | // $instantiation_mode = 2; |
541 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
542 | - } else if ( method_exists( $class_name, 'instance' )) { |
|
541 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
542 | + } else if (method_exists($class_name, 'instance')) { |
|
543 | 543 | // $instantiation_mode = 3; |
544 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
545 | - } else if ( $reflector->isInstantiable() ) { |
|
544 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
545 | + } else if ($reflector->isInstantiable()) { |
|
546 | 546 | // $instantiation_mode = 4; |
547 | - $class_obj = $reflector->newInstance( $arguments ); |
|
548 | - } else if ( ! $load_only ) { |
|
547 | + $class_obj = $reflector->newInstance($arguments); |
|
548 | + } else if ( ! $load_only) { |
|
549 | 549 | // heh ? something's not right ! |
550 | 550 | // $instantiation_mode = 5; |
551 | 551 | throw new EE_Error( |
552 | 552 | sprintf( |
553 | - __('The %s file %s could not be instantiated.','event_espresso'), |
|
553 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
554 | 554 | $type, |
555 | 555 | $class_name |
556 | 556 | ) |
557 | 557 | ); |
558 | 558 | } |
559 | 559 | |
560 | - } catch ( EE_Error $e ) { |
|
560 | + } catch (EE_Error $e) { |
|
561 | 561 | $e->get_error(); |
562 | 562 | } |
563 | 563 | |
@@ -569,15 +569,15 @@ discard block |
||
569 | 569 | // EEH_Debug_Tools::printr( $class_obj, '$class_obj <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
570 | 570 | |
571 | 571 | |
572 | - if ( isset( $class_obj )) { |
|
572 | + if (isset($class_obj)) { |
|
573 | 573 | // return newly instantiated class |
574 | - if ( isset( $class_abbreviations[ $class_name ] )) { |
|
575 | - $this->$class_abbreviations[ $class_name ] = $class_obj; |
|
576 | - } else if ( EEH_Class_Tools::has_property( $this, $class_name )) { |
|
574 | + if (isset($class_abbreviations[$class_name])) { |
|
575 | + $this->$class_abbreviations[$class_name] = $class_obj; |
|
576 | + } else if (EEH_Class_Tools::has_property($this, $class_name)) { |
|
577 | 577 | $this->{$class_name} = $class_obj; |
578 | - } else if ( $class_prefix == 'addon' && $cache ) { |
|
578 | + } else if ($class_prefix == 'addon' && $cache) { |
|
579 | 579 | $this->addons->$class_name = $class_obj; |
580 | - } else if ( !$from_db && $cache ) { |
|
580 | + } else if ( ! $from_db && $cache) { |
|
581 | 581 | $this->LIB->$class_name = $class_obj; |
582 | 582 | } |
583 | 583 | return $class_obj; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * @param $a |
603 | 603 | * @param $b |
604 | 604 | */ |
605 | - final function __call($a,$b) {} |
|
605 | + final function __call($a, $b) {} |
|
606 | 606 | |
607 | 607 | |
608 | 608 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | * @param $a |
618 | 618 | * @param $b |
619 | 619 | */ |
620 | - final function __set($a,$b) {} |
|
620 | + final function __set($a, $b) {} |
|
621 | 621 | |
622 | 622 | |
623 | 623 | |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | * @param $a |
658 | 658 | * @param $b |
659 | 659 | */ |
660 | - final static function __callStatic($a,$b) {} |
|
660 | + final static function __callStatic($a, $b) {} |
|
661 | 661 | |
662 | 662 | /** |
663 | 663 | * Gets the addon by its name/slug (not classname. For that, just |
@@ -665,9 +665,9 @@ discard block |
||
665 | 665 | * @param string $name |
666 | 666 | * @return EE_Addon |
667 | 667 | */ |
668 | - public function get_addon_by_name( $name ){ |
|
669 | - foreach($this->addons as $addon){ |
|
670 | - if( $addon->name() == $name){ |
|
668 | + public function get_addon_by_name($name) { |
|
669 | + foreach ($this->addons as $addon) { |
|
670 | + if ($addon->name() == $name) { |
|
671 | 671 | return $addon; |
672 | 672 | } |
673 | 673 | } |
@@ -678,10 +678,10 @@ discard block |
||
678 | 678 | * |
679 | 679 | * @return EE_Addon[] where the KEYS are the addon's name() |
680 | 680 | */ |
681 | - public function get_addons_by_name(){ |
|
681 | + public function get_addons_by_name() { |
|
682 | 682 | $addons = array(); |
683 | - foreach($this->addons as $addon){ |
|
684 | - $addons[ $addon->name() ] = $addon; |
|
683 | + foreach ($this->addons as $addon) { |
|
684 | + $addons[$addon->name()] = $addon; |
|
685 | 685 | } |
686 | 686 | return $addons; |
687 | 687 | } |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | * @param string $model_name |
693 | 693 | * @return EEM_Base |
694 | 694 | */ |
695 | - public function reset_model( $model_name ){ |
|
696 | - $model = $this->load_model( $model_name ); |
|
697 | - $model_class_name = get_class( $model ); |
|
695 | + public function reset_model($model_name) { |
|
696 | + $model = $this->load_model($model_name); |
|
697 | + $model_class_name = get_class($model); |
|
698 | 698 | //get that model reset it and make sure we nuke the old reference to it |
699 | - if ( is_callable( array( $model_class_name, 'reset' ))) { |
|
699 | + if (is_callable(array($model_class_name, 'reset'))) { |
|
700 | 700 | $this->LIB->$model_class_name = $model::reset(); |
701 | - }else{ |
|
702 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
701 | + } else { |
|
702 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
703 | 703 | } |
704 | 704 | return $this->LIB->$model_class_name; |
705 | 705 | } |
@@ -715,15 +715,15 @@ discard block |
||
715 | 715 | * currently reinstantiate the singletons at the moment) |
716 | 716 | * @return EE_Registry |
717 | 717 | */ |
718 | - public static function reset( $hard = FALSE, $reinstantiate = TRUE ){ |
|
718 | + public static function reset($hard = FALSE, $reinstantiate = TRUE) { |
|
719 | 719 | $instance = self::instance(); |
720 | 720 | $instance->load_helper('Activation'); |
721 | 721 | EEH_Activation::reset(); |
722 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
722 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
723 | 723 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
724 | 724 | $instance->LIB = new stdClass(); |
725 | - foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){ |
|
726 | - $instance->reset_model( $model_name ); |
|
725 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
726 | + $instance->reset_model($model_name); |
|
727 | 727 | } |
728 | 728 | return $instance; |
729 | 729 | } |
@@ -698,7 +698,7 @@ |
||
698 | 698 | //get that model reset it and make sure we nuke the old reference to it |
699 | 699 | if ( is_callable( array( $model_class_name, 'reset' ))) { |
700 | 700 | $this->LIB->$model_class_name = $model::reset(); |
701 | - }else{ |
|
701 | + } else{ |
|
702 | 702 | throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
703 | 703 | } |
704 | 704 | return $this->LIB->$model_class_name; |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | final class EE_Registry { |
12 | 12 | |
13 | 13 | /** |
14 | - * EE_Registry Object |
|
15 | - * @var EE_Registry $_instance |
|
16 | - * @access private |
|
17 | - */ |
|
14 | + * EE_Registry Object |
|
15 | + * @var EE_Registry $_instance |
|
16 | + * @access private |
|
17 | + */ |
|
18 | 18 | private static $_instance = NULL; |
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
22 | - * EE_Cart Object |
|
23 | - * @access public |
|
24 | - * @var EE_Cart $CART |
|
25 | - */ |
|
22 | + * EE_Cart Object |
|
23 | + * @access public |
|
24 | + * @var EE_Cart $CART |
|
25 | + */ |
|
26 | 26 | public $CART = NULL; |
27 | 27 | |
28 | 28 | /** |
29 | - * EE_Config Object |
|
30 | - * @access public |
|
31 | - * @var EE_Config $CFG |
|
32 | - */ |
|
29 | + * EE_Config Object |
|
30 | + * @access public |
|
31 | + * @var EE_Config $CFG |
|
32 | + */ |
|
33 | 33 | public $CFG = NULL; |
34 | 34 | |
35 | 35 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | /** |
47 | - * StdClass object for storing library classes in |
|
48 | - * @public LIB |
|
49 | - */ |
|
47 | + * StdClass object for storing library classes in |
|
48 | + * @public LIB |
|
49 | + */ |
|
50 | 50 | public $LIB = NULL; |
51 | 51 | |
52 | 52 | /** |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public $REQ = NULL; |
58 | 58 | |
59 | 59 | /** |
60 | - * EE_Session Object |
|
61 | - * @access public |
|
62 | - * @var EE_Session $SSN |
|
63 | - */ |
|
60 | + * EE_Session Object |
|
61 | + * @access public |
|
62 | + * @var EE_Session $SSN |
|
63 | + */ |
|
64 | 64 | public $SSN = NULL; |
65 | 65 | |
66 | 66 | |
@@ -127,21 +127,21 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | /** |
130 | - * $i18n_js_strings - internationalization for JS strings |
|
131 | - * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | - * in js file: var translatedString = eei18n.string_key; |
|
133 | - * |
|
134 | - * @access public |
|
135 | - * @var array |
|
136 | - */ |
|
130 | + * $i18n_js_strings - internationalization for JS strings |
|
131 | + * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | + * in js file: var translatedString = eei18n.string_key; |
|
133 | + * |
|
134 | + * @access public |
|
135 | + * @var array |
|
136 | + */ |
|
137 | 137 | public static $i18n_js_strings = array(); |
138 | 138 | |
139 | 139 | /** |
140 | - * $main_file - path to espresso.php |
|
141 | - * |
|
142 | - * @access public |
|
143 | - * @var array |
|
144 | - */ |
|
140 | + * $main_file - path to espresso.php |
|
141 | + * |
|
142 | + * @access public |
|
143 | + * @var array |
|
144 | + */ |
|
145 | 145 | public $main_file; |
146 | 146 | |
147 | 147 |
@@ -137,11 +137,11 @@ |
||
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
140 | - * private constructor to prevent direct creation |
|
141 | - * @Constructor |
|
142 | - * @access private |
|
143 | - * @return EE_Session |
|
144 | - */ |
|
140 | + * private constructor to prevent direct creation |
|
141 | + * @Constructor |
|
142 | + * @access private |
|
143 | + * @return EE_Session |
|
144 | + */ |
|
145 | 145 | private function __construct() { |
146 | 146 | |
147 | 147 | // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' ); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
3 | 5 | * |
4 | 6 | * Event Espresso |
@@ -349,7 +351,7 @@ discard block |
||
349 | 351 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
350 | 352 | if ( ! empty( $key )) { |
351 | 353 | return isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL; |
352 | - } else { |
|
354 | + } else { |
|
353 | 355 | return $this->_session_data; |
354 | 356 | } |
355 | 357 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/** |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); /** |
|
3 | 3 | * |
4 | 4 | * Event Espresso |
5 | 5 | * |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * array for defining default session vars |
96 | 96 | * @var array |
97 | 97 | */ |
98 | - private $_default_session_vars = array ( |
|
98 | + private $_default_session_vars = array( |
|
99 | 99 | 'id' => NULL, |
100 | 100 | 'user_id' => NULL, |
101 | 101 | 'ip_address' => NULL, |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * @access public |
118 | 118 | * @return EE_Session |
119 | 119 | */ |
120 | - public static function instance ( ) { |
|
120 | + public static function instance( ) { |
|
121 | 121 | // check if class object is instantiated |
122 | - if ( ! self::$_instance instanceof EE_Session ) { |
|
122 | + if ( ! self::$_instance instanceof EE_Session) { |
|
123 | 123 | self::$_instance = new self(); |
124 | 124 | } |
125 | 125 | return self::$_instance; |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | private function __construct() { |
137 | 137 | |
138 | 138 | // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' ); |
139 | - if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) { |
|
139 | + if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) { |
|
140 | 140 | return NULL; |
141 | 141 | } |
142 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
143 | - define( 'ESPRESSO_SESSION', TRUE ); |
|
142 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
143 | + define('ESPRESSO_SESSION', TRUE); |
|
144 | 144 | // default session lifespan in seconds |
145 | 145 | $this->_lifespan = apply_filters( |
146 | 146 | 'FHEE__EE_Session__construct___lifespan', |
@@ -153,35 +153,35 @@ discard block |
||
153 | 153 | * } |
154 | 154 | */ |
155 | 155 | // retrieve session options from db |
156 | - $session_settings = get_option( 'ee_session_settings' ); |
|
157 | - if ( $session_settings !== FALSE ) { |
|
156 | + $session_settings = get_option('ee_session_settings'); |
|
157 | + if ($session_settings !== FALSE) { |
|
158 | 158 | // cycle though existing session options |
159 | - foreach ( $session_settings as $var_name => $session_setting ) { |
|
159 | + foreach ($session_settings as $var_name => $session_setting) { |
|
160 | 160 | // set values for class properties |
161 | 161 | $this->_{$var_name} = $session_setting; |
162 | 162 | } |
163 | 163 | } |
164 | 164 | // are we using encryption? |
165 | - if ( $this->_use_encryption ) { |
|
165 | + if ($this->_use_encryption) { |
|
166 | 166 | // instantiate the class object making all properties and methods accessible via $this->encryption ex: $this->encryption->encrypt(); |
167 | - $this->encryption = EE_Registry::instance()->load_core( 'Encryption' ); |
|
167 | + $this->encryption = EE_Registry::instance()->load_core('Encryption'); |
|
168 | 168 | } |
169 | 169 | // filter hook allows outside functions/classes/plugins to change default empty cart |
170 | - $extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() ); |
|
171 | - array_merge( $this->_default_session_vars, $extra_default_session_vars ); |
|
170 | + $extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array()); |
|
171 | + array_merge($this->_default_session_vars, $extra_default_session_vars); |
|
172 | 172 | // apply default session vars |
173 | 173 | $this->_set_defaults(); |
174 | 174 | // check for existing session and retrieve it from db |
175 | - if ( ! $this->_espresso_session() ) { |
|
175 | + if ( ! $this->_espresso_session()) { |
|
176 | 176 | // or just start a new one |
177 | 177 | $this->_create_espresso_session(); |
178 | 178 | } |
179 | 179 | |
180 | 180 | // check request for 'clear_session' param |
181 | - add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' )); |
|
181 | + add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded')); |
|
182 | 182 | // once everything is all said and done, |
183 | - add_action( 'shutdown', array( $this, 'update' ), 100 ); |
|
184 | - add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 ); |
|
183 | + add_action('shutdown', array($this, 'update'), 100); |
|
184 | + add_action('shutdown', array($this, 'garbage_collection'), 999); |
|
185 | 185 | |
186 | 186 | } |
187 | 187 | |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | private function _set_defaults() { |
215 | 215 | // set some defaults |
216 | - foreach ( $this->_default_session_vars as $key => $default_var ) { |
|
217 | - if ( is_array( $default_var )) { |
|
218 | - $this->_session_data[ $key ] = array(); |
|
216 | + foreach ($this->_default_session_vars as $key => $default_var) { |
|
217 | + if (is_array($default_var)) { |
|
218 | + $this->_session_data[$key] = array(); |
|
219 | 219 | } else { |
220 | - $this->_session_data[ $key ] = ''; |
|
220 | + $this->_session_data[$key] = ''; |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param \EE_Cart $cart |
240 | 240 | * @return bool |
241 | 241 | */ |
242 | - public function set_cart( EE_Cart $cart ) { |
|
242 | + public function set_cart(EE_Cart $cart) { |
|
243 | 243 | $this->_session_data['cart'] = $cart; |
244 | 244 | return TRUE; |
245 | 245 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @return \EE_Cart |
260 | 260 | */ |
261 | 261 | public function cart() { |
262 | - return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL; |
|
262 | + return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @param \EE_Checkout $checkout |
269 | 269 | * @return bool |
270 | 270 | */ |
271 | - public function set_checkout( EE_Checkout $checkout ) { |
|
271 | + public function set_checkout(EE_Checkout $checkout) { |
|
272 | 272 | $this->_session_data['checkout'] = $checkout; |
273 | 273 | return TRUE; |
274 | 274 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @return \EE_Checkout |
289 | 289 | */ |
290 | 290 | public function checkout() { |
291 | - return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL; |
|
291 | + return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | * @param \EE_Transaction $transaction |
298 | 298 | * @return bool |
299 | 299 | */ |
300 | - public function set_transaction( EE_Transaction $transaction ) { |
|
300 | + public function set_transaction(EE_Transaction $transaction) { |
|
301 | 301 | // first remove the session from the transaction before we save the transaction in the session |
302 | - $transaction->set_txn_session_data( NULL ); |
|
302 | + $transaction->set_txn_session_data(NULL); |
|
303 | 303 | $this->_session_data['transaction'] = $transaction; |
304 | 304 | return TRUE; |
305 | 305 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return \EE_Transaction |
320 | 320 | */ |
321 | 321 | public function transaction() { |
322 | - return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL; |
|
322 | + return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | * @param bool $reset_cache |
332 | 332 | * @return array |
333 | 333 | */ |
334 | - public function get_session_data( $key = NULL, $reset_cache = FALSE ) { |
|
335 | - if ( $reset_cache ) { |
|
334 | + public function get_session_data($key = NULL, $reset_cache = FALSE) { |
|
335 | + if ($reset_cache) { |
|
336 | 336 | $this->reset_cart(); |
337 | 337 | $this->reset_checkout(); |
338 | 338 | $this->reset_transaction(); |
339 | 339 | } |
340 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
341 | - if ( ! empty( $key )) { |
|
342 | - return isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL; |
|
343 | - } else { |
|
340 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
341 | + if ( ! empty($key)) { |
|
342 | + return isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL; |
|
343 | + } else { |
|
344 | 344 | return $this->_session_data; |
345 | 345 | } |
346 | 346 | } |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | * @param array $data |
354 | 354 | * @return TRUE on success, FALSE on fail |
355 | 355 | */ |
356 | - public function set_session_data( $data ) { |
|
356 | + public function set_session_data($data) { |
|
357 | 357 | |
358 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
358 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
359 | 359 | // echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.' ( line no: ' . __LINE__ . ' )</h3>'; |
360 | 360 | |
361 | 361 | // nothing ??? bad data ??? go home! |
362 | - if ( empty( $data ) || ! is_array( $data )) { |
|
363 | - EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
362 | + if (empty($data) || ! is_array($data)) { |
|
363 | + EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
364 | 364 | return FALSE; |
365 | 365 | } |
366 | 366 | |
367 | - foreach ( $data as $key =>$value ) { |
|
368 | - if ( isset( $this->_default_session_vars[ $key ] )) { |
|
369 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ ); |
|
367 | + foreach ($data as $key =>$value) { |
|
368 | + if (isset($this->_default_session_vars[$key])) { |
|
369 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__); |
|
370 | 370 | return FALSE; |
371 | 371 | } else { |
372 | - $this->_session_data[ $key ] = $value; |
|
372 | + $this->_session_data[$key] = $value; |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | */ |
389 | 389 | private function _espresso_session() { |
390 | 390 | |
391 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
391 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
392 | 392 | // is the SID being passed explicitly ? |
393 | - if ( isset( $_REQUEST['EESID'] )) { |
|
394 | - session_id( sanitize_text_field( $_REQUEST['EESID'] )); |
|
393 | + if (isset($_REQUEST['EESID'])) { |
|
394 | + session_id(sanitize_text_field($_REQUEST['EESID'])); |
|
395 | 395 | } |
396 | 396 | // check that session has started |
397 | - if ( session_id() === '' ) { |
|
397 | + if (session_id() === '') { |
|
398 | 398 | //starts a new session if one doesn't already exist, or re-initiates an existing one |
399 | 399 | session_start(); |
400 | 400 | } |
@@ -403,31 +403,31 @@ discard block |
||
403 | 403 | // and the visitors IP |
404 | 404 | $this->_ip_address = $this->_visitor_ip(); |
405 | 405 | // set the "user agent" |
406 | - $this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE; |
|
406 | + $this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE; |
|
407 | 407 | // now let's retrieve what's in the db |
408 | 408 | // we're using WP's Transient API to store session data using the PHP session ID as the option name |
409 | - $session_data = get_transient( 'ee_ssn_' . $this->_sid ); |
|
410 | - if ( $session_data ) { |
|
409 | + $session_data = get_transient('ee_ssn_'.$this->_sid); |
|
410 | + if ($session_data) { |
|
411 | 411 | // un-encrypt the data |
412 | - $session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data; |
|
412 | + $session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data; |
|
413 | 413 | // unserialize |
414 | - $session_data = maybe_unserialize( $session_data ); |
|
414 | + $session_data = maybe_unserialize($session_data); |
|
415 | 415 | // just a check to make sure the session array is indeed an array |
416 | - if ( ! is_array( $session_data ) ) { |
|
416 | + if ( ! is_array($session_data)) { |
|
417 | 417 | // no?!?! then something is wrong |
418 | 418 | return FALSE; |
419 | 419 | } |
420 | 420 | // get the current time in UTC |
421 | - $this->_time = isset( $this->_time ) ? $this->_time : time(); |
|
421 | + $this->_time = isset($this->_time) ? $this->_time : time(); |
|
422 | 422 | // and reset the session expiration |
423 | - $this->_expiration = isset( $session_data['expiration'] ) ? |
|
423 | + $this->_expiration = isset($session_data['expiration']) ? |
|
424 | 424 | $session_data['expiration'] : $this->_time + $this->_lifespan; |
425 | 425 | |
426 | 426 | } else { |
427 | 427 | // set initial site access time and the session expiration |
428 | 428 | $this->_set_init_access_and_expiration(); |
429 | 429 | // set referer |
430 | - $this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : ''; |
|
430 | + $this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : ''; |
|
431 | 431 | // no previous session = go back and create one (on top of the data above) |
432 | 432 | return FALSE; |
433 | 433 | } |
@@ -435,21 +435,21 @@ discard block |
||
435 | 435 | // have we met before??? |
436 | 436 | // let's compare our stored session details with the current visitor |
437 | 437 | // first the ip address |
438 | - if ( $session_data['ip_address'] != $this->_ip_address ) { |
|
438 | + if ($session_data['ip_address'] != $this->_ip_address) { |
|
439 | 439 | return FALSE; |
440 | 440 | } |
441 | 441 | // now the user agent |
442 | - if ( $session_data['user_agent'] != $this->_user_agent ) { |
|
442 | + if ($session_data['user_agent'] != $this->_user_agent) { |
|
443 | 443 | return FALSE; |
444 | 444 | } |
445 | 445 | // wait a minute... how old are you? |
446 | - if ( $this->_time > $this->_expiration ) { |
|
446 | + if ($this->_time > $this->_expiration) { |
|
447 | 447 | // yer too old fer me! |
448 | 448 | // wipe out everything that isn't a default session datum |
449 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
449 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
450 | 450 | } |
451 | 451 | // make event espresso session data available to plugin |
452 | - $this->_session_data = array_merge( $this->_session_data, $session_data ); |
|
452 | + $this->_session_data = array_merge($this->_session_data, $session_data); |
|
453 | 453 | return TRUE; |
454 | 454 | |
455 | 455 | } |
@@ -477,20 +477,20 @@ discard block |
||
477 | 477 | * @param bool $new_session |
478 | 478 | * @return TRUE on success, FALSE on fail |
479 | 479 | */ |
480 | - public function update( $new_session = FALSE ) { |
|
481 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
482 | - $this->_session_data = isset( $this->_session_data ) |
|
483 | - && is_array( $this->_session_data ) |
|
484 | - && isset( $this->_session_data['id']) |
|
480 | + public function update($new_session = FALSE) { |
|
481 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
482 | + $this->_session_data = isset($this->_session_data) |
|
483 | + && is_array($this->_session_data) |
|
484 | + && isset($this->_session_data['id']) |
|
485 | 485 | ? $this->_session_data |
486 | 486 | : NULL; |
487 | - if ( empty( $this->_session_data )) { |
|
487 | + if (empty($this->_session_data)) { |
|
488 | 488 | $this->_set_defaults(); |
489 | 489 | } |
490 | 490 | $session_data = array(); |
491 | - foreach ( $this->_session_data as $key => $value ) { |
|
491 | + foreach ($this->_session_data as $key => $value) { |
|
492 | 492 | |
493 | - switch( $key ) { |
|
493 | + switch ($key) { |
|
494 | 494 | |
495 | 495 | case 'id' : |
496 | 496 | // session ID |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | break; |
509 | 509 | |
510 | 510 | case 'init_access' : |
511 | - $session_data['init_access'] = absint( $value ); |
|
511 | + $session_data['init_access'] = absint($value); |
|
512 | 512 | break; |
513 | 513 | |
514 | 514 | case 'last_access' : |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | case 'expiration' : |
520 | 520 | // when the session expires |
521 | - $session_data['expiration'] = ! empty( $this->_expiration ) |
|
521 | + $session_data['expiration'] = ! empty($this->_expiration) |
|
522 | 522 | ? $this->_expiration |
523 | 523 | : $session_data['init_access'] + $this->_lifespan; |
524 | 524 | break; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | case 'pages_visited' : |
532 | 532 | $page_visit = $this->_get_page_visit(); |
533 | - if ( $page_visit ) { |
|
533 | + if ($page_visit) { |
|
534 | 534 | // set pages visited where the first will be the http referrer |
535 | - $this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit; |
|
535 | + $this->_session_data['pages_visited'][$this->_time] = $page_visit; |
|
536 | 536 | // we'll only save the last 10 page visits. |
537 | - $session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 ); |
|
537 | + $session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10); |
|
538 | 538 | } |
539 | 539 | break; |
540 | 540 | |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | $this->_session_data = $session_data; |
551 | 551 | |
552 | 552 | // creating a new session does not require saving to the db just yet |
553 | - if ( ! $new_session ) { |
|
553 | + if ( ! $new_session) { |
|
554 | 554 | // ready? let's save |
555 | - if ( $this->_save_session_to_db() ) { |
|
555 | + if ($this->_save_session_to_db()) { |
|
556 | 556 | return TRUE; |
557 | 557 | } else { |
558 | 558 | return FALSE; |
@@ -573,9 +573,9 @@ discard block |
||
573 | 573 | * @return bool |
574 | 574 | */ |
575 | 575 | private function _create_espresso_session( ) { |
576 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
576 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
577 | 577 | // use the update function for now with $new_session arg set to TRUE |
578 | - return $this->update( TRUE ) ? TRUE : FALSE; |
|
578 | + return $this->update(TRUE) ? TRUE : FALSE; |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | * @return string |
589 | 589 | */ |
590 | 590 | private function _save_session_to_db() { |
591 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
591 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
592 | 592 | if ( |
593 | 593 | ! EE_Registry::instance()->REQ instanceof EE_Request_Handler |
594 | 594 | || ! ( |
@@ -599,11 +599,11 @@ discard block |
||
599 | 599 | return FALSE; |
600 | 600 | } |
601 | 601 | // first serialize all of our session data |
602 | - $session_data = serialize( $this->_session_data ); |
|
602 | + $session_data = serialize($this->_session_data); |
|
603 | 603 | // encrypt it if we are using encryption |
604 | - $session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data; |
|
604 | + $session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data; |
|
605 | 605 | // we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient( transient ID, data, expiry ) |
606 | - return set_transient( 'ee_ssn_' . $this->_sid, $session_data, $this->_lifespan ) ? TRUE : FALSE; |
|
606 | + return set_transient('ee_ssn_'.$this->_sid, $session_data, $this->_lifespan) ? TRUE : FALSE; |
|
607 | 607 | |
608 | 608 | } |
609 | 609 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @return string |
619 | 619 | */ |
620 | 620 | private function _visitor_ip() { |
621 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
621 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
622 | 622 | $visitor_ip = '0.0.0.0'; |
623 | 623 | $server_keys = array( |
624 | 624 | 'HTTP_CLIENT_IP', |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | 'HTTP_FORWARDED', |
630 | 630 | 'REMOTE_ADDR' |
631 | 631 | ); |
632 | - foreach ( $server_keys as $key ){ |
|
633 | - if ( isset( $_SERVER[ $key ] )) { |
|
634 | - foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) { |
|
635 | - if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) { |
|
632 | + foreach ($server_keys as $key) { |
|
633 | + if (isset($_SERVER[$key])) { |
|
634 | + foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { |
|
635 | + if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) { |
|
636 | 636 | $visitor_ip = $ip; |
637 | 637 | } |
638 | 638 | } |
@@ -652,47 +652,47 @@ discard block |
||
652 | 652 | */ |
653 | 653 | public function _get_page_visit() { |
654 | 654 | |
655 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
655 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
656 | 656 | // echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.' ( line no: ' . __LINE__ . ' )</h3>'; |
657 | - $page_visit = home_url('/') . 'wp-admin/admin-ajax.php'; |
|
657 | + $page_visit = home_url('/').'wp-admin/admin-ajax.php'; |
|
658 | 658 | |
659 | 659 | // check for request url |
660 | - if ( isset( $_SERVER['REQUEST_URI'] )) { |
|
660 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
661 | 661 | |
662 | - $request_uri = esc_url( $_SERVER['REQUEST_URI'] ); |
|
662 | + $request_uri = esc_url($_SERVER['REQUEST_URI']); |
|
663 | 663 | |
664 | - $ru_bits = explode( '?', $request_uri ); |
|
664 | + $ru_bits = explode('?', $request_uri); |
|
665 | 665 | $request_uri = $ru_bits[0]; |
666 | 666 | //echo '<h1>$request_uri ' . $request_uri . '</h1>'; |
667 | 667 | |
668 | 668 | // check for and grab host as well |
669 | - if ( isset( $_SERVER['HTTP_HOST'] )) { |
|
670 | - $http_host = esc_url( $_SERVER['HTTP_HOST'] ); |
|
669 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
670 | + $http_host = esc_url($_SERVER['HTTP_HOST']); |
|
671 | 671 | } else { |
672 | 672 | $http_host = ''; |
673 | 673 | } |
674 | 674 | //echo '<h1>$http_host ' . $http_host . '</h1>'; |
675 | 675 | |
676 | 676 | // check for page_id in SERVER REQUEST |
677 | - if ( isset( $_REQUEST['page_id'] )) { |
|
677 | + if (isset($_REQUEST['page_id'])) { |
|
678 | 678 | // rebuild $e_reg without any of the extra parameters |
679 | - $page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&'; |
|
679 | + $page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&'; |
|
680 | 680 | } else { |
681 | 681 | $page_id = '?'; |
682 | 682 | } |
683 | 683 | // check for $e_reg in SERVER REQUEST |
684 | - if ( isset( $_REQUEST['ee'] )) { |
|
684 | + if (isset($_REQUEST['ee'])) { |
|
685 | 685 | // rebuild $e_reg without any of the extra parameters |
686 | - $e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] ); |
|
686 | + $e_reg = 'ee='.esc_attr($_REQUEST['ee']); |
|
687 | 687 | } else { |
688 | 688 | $e_reg = ''; |
689 | 689 | } |
690 | 690 | |
691 | - $page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' ); |
|
691 | + $page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?'); |
|
692 | 692 | |
693 | 693 | } |
694 | 694 | |
695 | - return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : ''; |
|
695 | + return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : ''; |
|
696 | 696 | |
697 | 697 | } |
698 | 698 | |
@@ -721,10 +721,10 @@ discard block |
||
721 | 721 | * @param string $function |
722 | 722 | * @return void |
723 | 723 | */ |
724 | - public function clear_session( $class = '', $function = '' ) { |
|
725 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' . $function . '()' ); |
|
724 | + public function clear_session($class = '', $function = '') { |
|
725 | + do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()'); |
|
726 | 726 | // wipe out everything that isn't a default session datum |
727 | - $this->reset_data( array_keys( $this->_session_data )); |
|
727 | + $this->reset_data(array_keys($this->_session_data)); |
|
728 | 728 | // reset initial site access time and the session expiration |
729 | 729 | $this->_set_init_access_and_expiration(); |
730 | 730 | } |
@@ -738,42 +738,42 @@ discard block |
||
738 | 738 | * @param bool $show_all_notices |
739 | 739 | * @return TRUE on success, FALSE on fail |
740 | 740 | */ |
741 | - public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) { |
|
741 | + public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) { |
|
742 | 742 | // if $data_to_reset is not in an array, then put it in one |
743 | - if ( ! is_array( $data_to_reset ) ) { |
|
744 | - $data_to_reset = array ( $data_to_reset ); |
|
743 | + if ( ! is_array($data_to_reset)) { |
|
744 | + $data_to_reset = array($data_to_reset); |
|
745 | 745 | } |
746 | 746 | // nothing ??? go home! |
747 | - if ( empty( $data_to_reset )) { |
|
748 | - EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
747 | + if (empty($data_to_reset)) { |
|
748 | + EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
749 | 749 | return FALSE; |
750 | 750 | } |
751 | 751 | $return_value = TRUE; |
752 | 752 | // since $data_to_reset is an array, cycle through the values |
753 | - foreach ( $data_to_reset as $reset ) { |
|
753 | + foreach ($data_to_reset as $reset) { |
|
754 | 754 | |
755 | 755 | // first check to make sure it is a valid session var |
756 | - if ( isset( $this->_session_data[ $reset ] )) { |
|
756 | + if (isset($this->_session_data[$reset])) { |
|
757 | 757 | // then check to make sure it is not a default var |
758 | - if ( ! array_key_exists( $reset, $this->_default_session_vars )) { |
|
758 | + if ( ! array_key_exists($reset, $this->_default_session_vars)) { |
|
759 | 759 | // remove session var |
760 | - unset( $this->_session_data[ $reset ] ); |
|
761 | - if ( $show_all_notices ) { |
|
762 | - EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
760 | + unset($this->_session_data[$reset]); |
|
761 | + if ($show_all_notices) { |
|
762 | + EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
763 | 763 | } |
764 | - $return_value = !isset($return_value) ? TRUE : $return_value; |
|
764 | + $return_value = ! isset($return_value) ? TRUE : $return_value; |
|
765 | 765 | |
766 | 766 | } else { |
767 | 767 | // yeeeeeeeeerrrrrrrrrrr OUT !!!! |
768 | - if ( $show_all_notices ) { |
|
769 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
768 | + if ($show_all_notices) { |
|
769 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 770 | } |
771 | 771 | $return_value = FALSE; |
772 | 772 | } |
773 | 773 | |
774 | - } else if ( $show_all_notices ) { |
|
774 | + } else if ($show_all_notices) { |
|
775 | 775 | // oops! that session var does not exist! |
776 | - EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
776 | + EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
777 | 777 | $return_value = FALSE; |
778 | 778 | } |
779 | 779 | |
@@ -794,8 +794,8 @@ discard block |
||
794 | 794 | * @return string |
795 | 795 | */ |
796 | 796 | public function wp_loaded() { |
797 | - if ( isset( EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) { |
|
798 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
797 | + if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) { |
|
798 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
@@ -820,16 +820,16 @@ discard block |
||
820 | 820 | */ |
821 | 821 | public function garbage_collection() { |
822 | 822 | // only perform during regular requests |
823 | - if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) { |
|
823 | + if ( ! defined('DOING_AJAX') || ! DOING_AJAX) { |
|
824 | 824 | /** @type WPDB $wpdb */ |
825 | 825 | global $wpdb; |
826 | 826 | // since transient expiration timestamps are set in the future, we can compare against NOW |
827 | 827 | $expiration = time(); |
828 | - $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 ); |
|
828 | + $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2); |
|
829 | 829 | // filter the query limit. Set to 0 to turn off garbage collection |
830 | - $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 )); |
|
830 | + $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50)); |
|
831 | 831 | // non-zero LIMIT means take out the trash |
832 | - if ( $expired_session_transient_delete_query_limit ) { |
|
832 | + if ($expired_session_transient_delete_query_limit) { |
|
833 | 833 | $SQL = " |
834 | 834 | SELECT option_name |
835 | 835 | FROM {$wpdb->options} |
@@ -839,28 +839,28 @@ discard block |
||
839 | 839 | OR option_value > {$too_far_in_the_the_future} ) |
840 | 840 | LIMIT {$expired_session_transient_delete_query_limit} |
841 | 841 | "; |
842 | - $expired_sessions = $wpdb->get_col( $SQL ); |
|
842 | + $expired_sessions = $wpdb->get_col($SQL); |
|
843 | 843 | // valid results? |
844 | - if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions )) { |
|
844 | + if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) { |
|
845 | 845 | // format array of results into something usable within the actual DELETE query's IN clause |
846 | 846 | $expired = array(); |
847 | - foreach( $expired_sessions as $expired_session ) { |
|
848 | - $expired[] = "'" . $expired_session . "'"; |
|
849 | - $expired[] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'"; |
|
847 | + foreach ($expired_sessions as $expired_session) { |
|
848 | + $expired[] = "'".$expired_session."'"; |
|
849 | + $expired[] = "'".str_replace('timeout_', '', $expired_session)."'"; |
|
850 | 850 | } |
851 | - $expired = implode( ', ', $expired ); |
|
851 | + $expired = implode(', ', $expired); |
|
852 | 852 | $SQL = " |
853 | 853 | DELETE FROM {$wpdb->options} |
854 | 854 | WHERE option_name |
855 | 855 | IN ( $expired ); |
856 | 856 | "; |
857 | - $results = $wpdb->query( $SQL ); |
|
857 | + $results = $wpdb->query($SQL); |
|
858 | 858 | // if something went wrong, then notify the admin |
859 | - if ( $results instanceof WP_Error && is_admin() ) { |
|
860 | - EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
859 | + if ($results instanceof WP_Error && is_admin()) { |
|
860 | + EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
861 | 861 | } |
862 | 862 | } |
863 | - do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit ); |
|
863 | + do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit); |
|
864 | 864 | } |
865 | 865 | } |
866 | 866 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -578,7 +580,7 @@ discard block |
||
578 | 580 | $espresso_db_update = array( $espresso_db_update=>array() ); |
579 | 581 | update_option( 'espresso_db_update', $espresso_db_update ); |
580 | 582 | } |
581 | - }else{ |
|
583 | + } else{ |
|
582 | 584 | $corrected_db_update = array(); |
583 | 585 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
584 | 586 | foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
@@ -588,7 +590,7 @@ discard block |
||
588 | 590 | //fix it! |
589 | 591 | $version_string = $should_be_array; |
590 | 592 | $corrected_db_update[$version_string] = array('unknown-date'); |
591 | - }else{ |
|
593 | + } else{ |
|
592 | 594 | //ok it checks out |
593 | 595 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
594 | 596 | } |
@@ -633,7 +635,7 @@ discard block |
||
633 | 635 | $addon->initialize_db_if_no_migrations_required(); |
634 | 636 | } |
635 | 637 | } |
636 | - }else{ |
|
638 | + } else{ |
|
637 | 639 | EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
638 | 640 | } |
639 | 641 | if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
@@ -703,7 +705,7 @@ discard block |
||
703 | 705 | //it a version we haven't seen before |
704 | 706 | if( $version_is_higher === 1 ){ |
705 | 707 | $req_type = EE_System::req_type_upgrade; |
706 | - }else{ |
|
708 | + } else{ |
|
707 | 709 | $req_type = EE_System::req_type_downgrade; |
708 | 710 | } |
709 | 711 | delete_option( $activation_indicator_option_name ); |
@@ -712,10 +714,10 @@ discard block |
||
712 | 714 | if( get_option( $activation_indicator_option_name, FALSE ) ){ |
713 | 715 | if ( $version_is_higher === -1 ){ |
714 | 716 | $req_type = EE_System::req_type_downgrade; |
715 | - }elseif( $version_is_higher === 0 ){ |
|
717 | + } elseif( $version_is_higher === 0 ){ |
|
716 | 718 | //we've seen this version before, but it's an activation. must be a reactivation |
717 | 719 | $req_type = EE_System::req_type_reactivation; |
718 | - }else{//$version_is_higher === 1 |
|
720 | + } else{//$version_is_higher === 1 |
|
719 | 721 | $req_type = EE_System::req_type_upgrade; |
720 | 722 | } |
721 | 723 | delete_option( $activation_indicator_option_name ); |
@@ -723,10 +725,10 @@ discard block |
||
723 | 725 | //we've seen this version before and the activation indicate doesn't show it was just activated |
724 | 726 | if ( $version_is_higher === -1 ){ |
725 | 727 | $req_type = EE_System::req_type_downgrade; |
726 | - }elseif( $version_is_higher === 0 ){ |
|
728 | + } elseif( $version_is_higher === 0 ){ |
|
727 | 729 | //we've seen this version before and it's not an activation. its normal request |
728 | 730 | $req_type = EE_System::req_type_normal; |
729 | - }else{//$version_is_higher === 1 |
|
731 | + } else{//$version_is_higher === 1 |
|
730 | 732 | $req_type = EE_System::req_type_upgrade; |
731 | 733 | } |
732 | 734 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public static function instance() { |
91 | 91 | // check if class object is instantiated, and instantiated properly |
92 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_System )) { |
|
92 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_System)) { |
|
93 | 93 | self::$_instance = new self(); |
94 | 94 | } |
95 | 95 | return self::$_instance; |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * resets the instance and returns it |
99 | 99 | * @return EE_System |
100 | 100 | */ |
101 | - public static function reset(){ |
|
101 | + public static function reset() { |
|
102 | 102 | self::$_instance->_req_type = NULL; |
103 | 103 | //we need to reset the migration manager in order for it to detect DMSs properly |
104 | 104 | EE_Data_Migration_Manager::reset(); |
105 | 105 | //make sure none of the old hooks are left hanging around |
106 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
106 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
107 | 107 | self::instance()->detect_activations_or_upgrades(); |
108 | 108 | self::instance()->perform_activations_upgrades_and_migrations(); |
109 | 109 | return self::instance(); |
@@ -124,25 +124,25 @@ discard block |
||
124 | 124 | * @return \EE_System |
125 | 125 | */ |
126 | 126 | private function __construct() { |
127 | - do_action( 'AHEE__EE_System__construct__begin',$this ); |
|
127 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
128 | 128 | // check required WP version |
129 | - if ( ! $this->_minimum_wp_version_required() ) { |
|
130 | - unset( $_GET['activate'] ); |
|
131 | - add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 ); |
|
129 | + if ( ! $this->_minimum_wp_version_required()) { |
|
130 | + unset($_GET['activate']); |
|
131 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | // check required PHP version |
135 | - if ( ! $this->_minimum_php_version_required() ) { |
|
136 | - unset( $_GET['activate'] ); |
|
137 | - add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 ); |
|
135 | + if ( ! $this->_minimum_php_version_required()) { |
|
136 | + unset($_GET['activate']); |
|
137 | + add_action('admin_notices', array($this, 'minimum_php_version_error'), 1); |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | // check recommended WP version |
141 | - if ( ! $this->_minimum_wp_version_recommended() ) { |
|
141 | + if ( ! $this->_minimum_wp_version_recommended()) { |
|
142 | 142 | $this->_display_minimum_recommended_wp_version_notice(); |
143 | 143 | } |
144 | 144 | // check recommended PHP version |
145 | - if ( ! $this->_minimum_php_version_recommended() ) { |
|
145 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
146 | 146 | $this->_display_minimum_recommended_php_version_notice(); |
147 | 147 | } |
148 | 148 | // central repository for classes |
@@ -150,35 +150,35 @@ discard block |
||
150 | 150 | // workarounds for PHP < 5.3 |
151 | 151 | $this->_load_class_tools(); |
152 | 152 | // load a few helper files |
153 | - EE_Registry::instance()->load_helper( 'File' ); |
|
154 | - EE_Registry::instance()->load_helper( 'Autoloader', array(), FALSE ); |
|
155 | - require_once EE_CORE . 'EE_Deprecated.core.php'; |
|
153 | + EE_Registry::instance()->load_helper('File'); |
|
154 | + EE_Registry::instance()->load_helper('Autoloader', array(), FALSE); |
|
155 | + require_once EE_CORE.'EE_Deprecated.core.php'; |
|
156 | 156 | // load interfaces |
157 | - require_once EE_CORE . 'EEI_Interfaces.php'; |
|
158 | - require_once EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php'; |
|
157 | + require_once EE_CORE.'EEI_Interfaces.php'; |
|
158 | + require_once EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'; |
|
159 | 159 | // WP cron jobs |
160 | - EE_Registry::instance()->load_core( 'Cron_Tasks' ); |
|
160 | + EE_Registry::instance()->load_core('Cron_Tasks'); |
|
161 | 161 | |
162 | 162 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
163 | - add_action( 'plugins_loaded', array( $this, 'load_espresso_addons' ), 1 ); |
|
163 | + add_action('plugins_loaded', array($this, 'load_espresso_addons'), 1); |
|
164 | 164 | // when an ee addon is activated, we want to call the core hook(s) again |
165 | 165 | // because the newly-activated addon didn't get a chance to run at all |
166 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
166 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
167 | 167 | // detect whether install or upgrade |
168 | - add_action( 'plugins_loaded', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
168 | + add_action('plugins_loaded', array($this, 'detect_activations_or_upgrades'), 3); |
|
169 | 169 | // load EE_Config, EE_Textdomain, etc |
170 | - add_action( 'plugins_loaded', array( $this, 'load_core_configuration' ), 5 ); |
|
170 | + add_action('plugins_loaded', array($this, 'load_core_configuration'), 5); |
|
171 | 171 | // load EE_Config, EE_Textdomain, etc |
172 | - add_action( 'plugins_loaded', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
172 | + add_action('plugins_loaded', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
173 | 173 | // you wanna get going? I wanna get going... let's get going! |
174 | - add_action( 'plugins_loaded', array( $this, 'brew_espresso' ), 9 ); |
|
174 | + add_action('plugins_loaded', array($this, 'brew_espresso'), 9); |
|
175 | 175 | |
176 | 176 | //other housekeeping |
177 | 177 | //exclude EE critical pages from wp_list_pages |
178 | - add_filter('wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages'), 10 ); |
|
178 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
179 | 179 | // ALL EE Addons should use the following hook point to attach their initial setup too |
180 | 180 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
181 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
181 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * @param string $min_version |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) { |
|
193 | + private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) { |
|
194 | 194 | global $wp_version; |
195 | - return version_compare( $wp_version, $min_version, '>=' ) ? TRUE : FALSE; |
|
195 | + return version_compare($wp_version, $min_version, '>=') ? TRUE : FALSE; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return boolean |
203 | 203 | */ |
204 | 204 | private function _minimum_wp_version_required() { |
205 | - return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED ); |
|
205 | + return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @return boolean |
213 | 213 | */ |
214 | 214 | private function _minimum_wp_version_recommended() { |
215 | - return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED ); |
|
215 | + return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | * @param string $min_version |
225 | 225 | * @return boolean |
226 | 226 | */ |
227 | - private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) { |
|
228 | - return version_compare( PHP_VERSION, $min_version, '>=' ) ? TRUE : FALSE; |
|
227 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) { |
|
228 | + return version_compare(PHP_VERSION, $min_version, '>=') ? TRUE : FALSE; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @return boolean |
236 | 236 | */ |
237 | 237 | private function _minimum_php_version_required() { |
238 | - return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED ); |
|
238 | + return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return boolean |
246 | 246 | */ |
247 | 247 | private function _minimum_php_version_recommended() { |
248 | - return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED ); |
|
248 | + return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | <p> |
263 | 263 | <?php |
264 | 264 | printf( |
265 | - __( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
265 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
266 | 266 | EE_MIN_WP_VER_REQUIRED, |
267 | 267 | $wp_version, |
268 | 268 | '<br/>', |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | </p> |
273 | 273 | </div> |
274 | 274 | <?php |
275 | - EE_System::deactivate_plugin( EE_PLUGIN_BASENAME ); |
|
275 | + EE_System::deactivate_plugin(EE_PLUGIN_BASENAME); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | <p> |
289 | 289 | <?php |
290 | 290 | printf( |
291 | - __( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
291 | + __('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
292 | 292 | EE_MIN_PHP_VER_REQUIRED, |
293 | 293 | PHP_VERSION, |
294 | 294 | '<br/>', |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | </p> |
299 | 299 | </div> |
300 | 300 | <?php |
301 | - deactivate_plugins( EE_PLUGIN_BASENAME ); |
|
301 | + deactivate_plugins(EE_PLUGIN_BASENAME); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | private function _display_minimum_recommended_wp_version_notice() { |
313 | 313 | global $wp_version; |
314 | 314 | EE_Error::add_persistent_admin_notice( |
315 | - 'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended', |
|
315 | + 'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended', |
|
316 | 316 | sprintf( |
317 | - __( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
317 | + __('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
318 | 318 | EE_MIN_WP_VER_RECOMMENDED, |
319 | 319 | $wp_version, |
320 | 320 | '<br/>', |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | */ |
334 | 334 | private function _display_minimum_recommended_php_version_notice() { |
335 | 335 | EE_Error::add_persistent_admin_notice( |
336 | - 'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended', |
|
336 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
337 | 337 | sprintf( |
338 | - __( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
338 | + __('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
339 | 339 | EE_MIN_PHP_VER_RECOMMENDED, |
340 | 340 | PHP_VERSION, |
341 | 341 | '<br/>', |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | * @return void |
354 | 354 | */ |
355 | 355 | private function _load_registry() { |
356 | - if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
357 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
356 | + if (is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
357 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
358 | 358 | } else { |
359 | - $msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ); |
|
360 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
361 | - wp_die( EE_Error::get_notices() ); |
|
359 | + $msg = __('The EE_Registry core class could not be loaded.', 'event_espresso'); |
|
360 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
361 | + wp_die(EE_Error::get_notices()); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -370,11 +370,11 @@ discard block |
||
370 | 370 | * @return void |
371 | 371 | */ |
372 | 372 | private function _load_class_tools() { |
373 | - if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
374 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
373 | + if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
374 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
375 | 375 | } else { |
376 | - $msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ); |
|
377 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
376 | + $msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'); |
|
377 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | public function load_espresso_addons() { |
392 | 392 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
393 | 393 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
394 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
394 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
395 | 395 | //load and setup EE_Capabilities |
396 | - EE_Registry::instance()->load_core( 'Capabilities' ); |
|
397 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
396 | + EE_Registry::instance()->load_core('Capabilities'); |
|
397 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | * Checks for activation or upgrade of core first; then also checks if any registered |
403 | 403 | * addons have been activated or upgraded |
404 | 404 | */ |
405 | - public function detect_activations_or_upgrades(){ |
|
405 | + public function detect_activations_or_upgrades() { |
|
406 | 406 | //first off: let's make sure to handle core |
407 | 407 | $this->detect_if_activation_or_upgrade(); |
408 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
408 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
409 | 409 | //detect teh request type for that addon |
410 | 410 | $addon->detect_activation_or_upgrade(); |
411 | 411 | } |
@@ -423,44 +423,44 @@ discard block |
||
423 | 423 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
424 | 424 | |
425 | 425 | // load M-Mode class |
426 | - EE_Registry::instance()->load_core( 'Maintenance_Mode' ); |
|
426 | + EE_Registry::instance()->load_core('Maintenance_Mode'); |
|
427 | 427 | // check if db has been updated, or if its a brand-new installation |
428 | 428 | |
429 | 429 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
430 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
430 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
431 | 431 | // echo "request type:".$request_type; |
432 | - if( $request_type != EE_System::req_type_normal){ |
|
432 | + if ($request_type != EE_System::req_type_normal) { |
|
433 | 433 | EE_Registry::instance()->load_helper('Activation'); |
434 | 434 | } |
435 | 435 | |
436 | - switch($request_type){ |
|
436 | + switch ($request_type) { |
|
437 | 437 | case EE_System::req_type_new_activation: |
438 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
439 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
438 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
439 | + $this->_handle_core_version_change($espresso_db_update); |
|
440 | 440 | break; |
441 | 441 | case EE_System::req_type_reactivation: |
442 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
443 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
442 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
443 | + $this->_handle_core_version_change($espresso_db_update); |
|
444 | 444 | break; |
445 | 445 | case EE_System::req_type_upgrade: |
446 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
446 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
447 | 447 | //migrations may be required now that we've upgraded |
448 | 448 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
449 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
449 | + $this->_handle_core_version_change($espresso_db_update); |
|
450 | 450 | // echo "done upgrade";die; |
451 | 451 | break; |
452 | 452 | case EE_System::req_type_downgrade: |
453 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
453 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
454 | 454 | //its possible migrations are no longer required |
455 | 455 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
456 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
456 | + $this->_handle_core_version_change($espresso_db_update); |
|
457 | 457 | break; |
458 | 458 | case EE_System::req_type_normal: |
459 | 459 | default: |
460 | 460 | // $this->_maybe_redirect_to_ee_about(); |
461 | 461 | break; |
462 | 462 | } |
463 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
463 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -468,10 +468,10 @@ discard block |
||
468 | 468 | * initializing the database later during the request |
469 | 469 | * @param array $espresso_db_update |
470 | 470 | */ |
471 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
472 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
471 | + protected function _handle_core_version_change($espresso_db_update) { |
|
472 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
473 | 473 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
474 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
474 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -486,44 +486,44 @@ discard block |
||
486 | 486 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
487 | 487 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
488 | 488 | */ |
489 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
490 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
491 | - if( ! $espresso_db_update){ |
|
492 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
489 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
490 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
491 | + if ( ! $espresso_db_update) { |
|
492 | + $espresso_db_update = get_option('espresso_db_update'); |
|
493 | 493 | } |
494 | 494 | // check that option is an array |
495 | - if( ! is_array( $espresso_db_update )) { |
|
495 | + if ( ! is_array($espresso_db_update)) { |
|
496 | 496 | // if option is FALSE, then it never existed |
497 | - if ( $espresso_db_update === FALSE ) { |
|
497 | + if ($espresso_db_update === FALSE) { |
|
498 | 498 | // make $espresso_db_update an array and save option with autoload OFF |
499 | - $espresso_db_update = array(); |
|
500 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
499 | + $espresso_db_update = array(); |
|
500 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
501 | 501 | } else { |
502 | 502 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
503 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
504 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
503 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
504 | + update_option('espresso_db_update', $espresso_db_update); |
|
505 | 505 | } |
506 | - }else{ |
|
506 | + } else { |
|
507 | 507 | $corrected_db_update = array(); |
508 | 508 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
509 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
510 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
509 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
510 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
511 | 511 | //the key is an int, and the value IS NOT an array |
512 | 512 | //so it must be numerically-indexed, where values are versions installed... |
513 | 513 | //fix it! |
514 | 514 | $version_string = $should_be_array; |
515 | 515 | $corrected_db_update[$version_string] = array('unknown-date'); |
516 | - }else{ |
|
516 | + } else { |
|
517 | 517 | //ok it checks out |
518 | 518 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
519 | 519 | } |
520 | 520 | } |
521 | 521 | $espresso_db_update = $corrected_db_update; |
522 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
522 | + update_option('espresso_db_update', $espresso_db_update); |
|
523 | 523 | |
524 | 524 | } |
525 | 525 | |
526 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
526 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
527 | 527 | return $espresso_db_update; |
528 | 528 | } |
529 | 529 | |
@@ -540,25 +540,25 @@ discard block |
||
540 | 540 | * however, |
541 | 541 | * @return void |
542 | 542 | */ |
543 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE ){ |
|
543 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE) { |
|
544 | 544 | $request_type = $this->detect_req_type(); |
545 | 545 | //only initialize system if we're not in maintenance mode. |
546 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
547 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
546 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
547 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
548 | 548 | EEH_Activation::system_initialization(); |
549 | 549 | EEH_Activation::initialize_db_and_folders(); |
550 | 550 | EEH_Activation::initialize_db_content(); |
551 | - if( $initialize_addons_too ) { |
|
551 | + if ($initialize_addons_too) { |
|
552 | 552 | //foreach registered addon, make sure its db is up-to-date too |
553 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
553 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
554 | 554 | $addon->initialize_db_if_no_migrations_required(); |
555 | 555 | } |
556 | 556 | } |
557 | - }else{ |
|
558 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
557 | + } else { |
|
558 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
559 | 559 | } |
560 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
561 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
560 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
561 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -570,16 +570,16 @@ discard block |
||
570 | 570 | * @param string $current_version_to_add version to be added to the version history |
571 | 571 | * @return boolean success as to whether or not this option was changed |
572 | 572 | */ |
573 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
574 | - if( ! $version_history ) { |
|
573 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
574 | + if ( ! $version_history) { |
|
575 | 575 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
576 | 576 | } |
577 | - if( $current_version_to_add == NULL){ |
|
577 | + if ($current_version_to_add == NULL) { |
|
578 | 578 | $current_version_to_add = espresso_version(); |
579 | 579 | } |
580 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
580 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
581 | 581 | // re-save |
582 | - return update_option( 'espresso_db_update', $version_history ); |
|
582 | + return update_option('espresso_db_update', $version_history); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | * but still know if this is a new install or not |
597 | 597 | * @return int one of the constants on EE_System::req_type_ |
598 | 598 | */ |
599 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
600 | - if ( $this->_req_type === NULL ){ |
|
601 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
602 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
599 | + public function detect_req_type($espresso_db_update = NULL) { |
|
600 | + if ($this->_req_type === NULL) { |
|
601 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
602 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
603 | 603 | } |
604 | 604 | return $this->_req_type; |
605 | 605 | } |
@@ -615,39 +615,39 @@ discard block |
||
615 | 615 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
616 | 616 | * @return int one of the constants on EE_System::req_type_* |
617 | 617 | */ |
618 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
619 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
620 | - if( $activation_history_for_addon ){ |
|
618 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
619 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
620 | + if ($activation_history_for_addon) { |
|
621 | 621 | //it exists, so this isn't a completely new install |
622 | 622 | //check if this version already in that list of previously installed versions |
623 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
623 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
624 | 624 | //it a version we haven't seen before |
625 | - if( $version_is_higher === 1 ){ |
|
625 | + if ($version_is_higher === 1) { |
|
626 | 626 | $req_type = EE_System::req_type_upgrade; |
627 | - }else{ |
|
627 | + } else { |
|
628 | 628 | $req_type = EE_System::req_type_downgrade; |
629 | 629 | } |
630 | - delete_option( $activation_indicator_option_name ); |
|
630 | + delete_option($activation_indicator_option_name); |
|
631 | 631 | } else { |
632 | 632 | // its not an update. maybe a reactivation? |
633 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
634 | - if ( $version_is_higher === -1 ){ |
|
633 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
634 | + if ($version_is_higher === -1) { |
|
635 | 635 | $req_type = EE_System::req_type_downgrade; |
636 | - }elseif( $version_is_higher === 0 ){ |
|
636 | + }elseif ($version_is_higher === 0) { |
|
637 | 637 | //we've seen this version before, but it's an activation. must be a reactivation |
638 | 638 | $req_type = EE_System::req_type_reactivation; |
639 | - }else{//$version_is_higher === 1 |
|
639 | + } else {//$version_is_higher === 1 |
|
640 | 640 | $req_type = EE_System::req_type_upgrade; |
641 | 641 | } |
642 | - delete_option( $activation_indicator_option_name ); |
|
642 | + delete_option($activation_indicator_option_name); |
|
643 | 643 | } else { |
644 | 644 | //we've seen this version before and the activation indicate doesn't show it was just activated |
645 | - if ( $version_is_higher === -1 ){ |
|
645 | + if ($version_is_higher === -1) { |
|
646 | 646 | $req_type = EE_System::req_type_downgrade; |
647 | - }elseif( $version_is_higher === 0 ){ |
|
647 | + }elseif ($version_is_higher === 0) { |
|
648 | 648 | //we've seen this version before and it's not an activation. its normal request |
649 | 649 | $req_type = EE_System::req_type_normal; |
650 | - }else{//$version_is_higher === 1 |
|
650 | + } else {//$version_is_higher === 1 |
|
651 | 651 | $req_type = EE_System::req_type_upgrade; |
652 | 652 | } |
653 | 653 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | } else { |
656 | 656 | //brand new install |
657 | 657 | $req_type = EE_System::req_type_new_activation; |
658 | - delete_option( $activation_indicator_option_name ); |
|
658 | + delete_option($activation_indicator_option_name); |
|
659 | 659 | } |
660 | 660 | return $req_type; |
661 | 661 | } |
@@ -673,29 +673,29 @@ discard block |
||
673 | 673 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
674 | 674 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
675 | 675 | */ |
676 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
676 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
677 | 677 | //find the most recently-activated version |
678 | 678 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
679 | 679 | $most_recently_active_version = '0.0.0.dev.000'; |
680 | - if( is_array( $activation_history_for_addon ) ){ |
|
681 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
680 | + if (is_array($activation_history_for_addon)) { |
|
681 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
682 | 682 | //check there is a record of when this version was activated. Otherwise, |
683 | 683 | //mark it as unknown |
684 | - if( ! $times_activated ){ |
|
685 | - $times_activated = array( 'unknown-date'); |
|
684 | + if ( ! $times_activated) { |
|
685 | + $times_activated = array('unknown-date'); |
|
686 | 686 | } |
687 | - if( is_string( $times_activated ) ){ |
|
688 | - $times_activated = array( $times_activated ); |
|
687 | + if (is_string($times_activated)) { |
|
688 | + $times_activated = array($times_activated); |
|
689 | 689 | } |
690 | - foreach( $times_activated as $an_activation ){ |
|
691 | - if( $an_activation > $most_recently_active_version_activation ){ |
|
690 | + foreach ($times_activated as $an_activation) { |
|
691 | + if ($an_activation > $most_recently_active_version_activation) { |
|
692 | 692 | $most_recently_active_version = $version; |
693 | 693 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
694 | 694 | } |
695 | 695 | } |
696 | 696 | } |
697 | 697 | } |
698 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
698 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
@@ -705,20 +705,20 @@ discard block |
||
705 | 705 | * @return void |
706 | 706 | */ |
707 | 707 | public function redirect_to_about_ee() { |
708 | - $notices = EE_Error::get_notices( FALSE ); |
|
708 | + $notices = EE_Error::get_notices(FALSE); |
|
709 | 709 | //if current user is an admin and it's not an ajax request |
710 | - if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) && ! isset( $notices[ 'errors' ] ) ){ |
|
711 | - $query_params = array( 'page' => 'espresso_about' ); |
|
710 | + if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) { |
|
711 | + $query_params = array('page' => 'espresso_about'); |
|
712 | 712 | |
713 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
713 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
714 | 714 | $query_params['new_activation'] = TRUE; |
715 | 715 | } |
716 | 716 | |
717 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
717 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
718 | 718 | $query_params['reactivation'] = TRUE; |
719 | 719 | } |
720 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
721 | - wp_safe_redirect( $url ); |
|
720 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
721 | + wp_safe_redirect($url); |
|
722 | 722 | exit(); |
723 | 723 | } |
724 | 724 | } |
@@ -729,31 +729,31 @@ discard block |
||
729 | 729 | * |
730 | 730 | * @return void |
731 | 731 | */ |
732 | - public function load_core_configuration(){ |
|
733 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
732 | + public function load_core_configuration() { |
|
733 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
734 | 734 | // load and setup EE_Config and EE_Network_Config |
735 | - EE_Registry::instance()->load_core( 'Config' ); |
|
736 | - EE_Registry::instance()->load_core( 'Network_Config' ); |
|
735 | + EE_Registry::instance()->load_core('Config'); |
|
736 | + EE_Registry::instance()->load_core('Network_Config'); |
|
737 | 737 | // setup autoloaders |
738 | - EE_Registry::instance()->load_core( 'EE_Load_Textdomain' ); |
|
738 | + EE_Registry::instance()->load_core('EE_Load_Textdomain'); |
|
739 | 739 | //load textdomain |
740 | 740 | EE_Load_Textdomain::load_textdomain(); |
741 | 741 | // enable logging? |
742 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
743 | - EE_Registry::instance()->load_core( 'Log' ); |
|
742 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
743 | + EE_Registry::instance()->load_core('Log'); |
|
744 | 744 | } |
745 | 745 | // check for activation errors |
746 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
747 | - if ( $activation_errors ) { |
|
748 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
749 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
746 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
747 | + if ($activation_errors) { |
|
748 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
749 | + update_option('ee_plugin_activation_errors', FALSE); |
|
750 | 750 | } |
751 | 751 | // get model names |
752 | 752 | $this->_parse_model_names(); |
753 | 753 | |
754 | 754 | //load caf stuff a chance to play during the activation process too. |
755 | 755 | $this->_maybe_brew_regular(); |
756 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
756 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | |
@@ -762,23 +762,23 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @return void |
764 | 764 | */ |
765 | - private function _parse_model_names(){ |
|
765 | + private function _parse_model_names() { |
|
766 | 766 | //get all the files in the EE_MODELS folder that end in .model.php |
767 | - $models = glob( EE_MODELS.'*.model.php'); |
|
767 | + $models = glob(EE_MODELS.'*.model.php'); |
|
768 | 768 | $model_names = array(); |
769 | 769 | $non_abstract_db_models = array(); |
770 | - foreach( $models as $model ){ |
|
770 | + foreach ($models as $model) { |
|
771 | 771 | // get model classname |
772 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
773 | - $shortname = str_replace( 'EEM_', '', $classname ); |
|
772 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
773 | + $shortname = str_replace('EEM_', '', $classname); |
|
774 | 774 | $reflectionClass = new ReflectionClass($classname); |
775 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
775 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
776 | 776 | $non_abstract_db_models[$shortname] = $classname; |
777 | 777 | } |
778 | - $model_names[ $shortname ] = $classname; |
|
778 | + $model_names[$shortname] = $classname; |
|
779 | 779 | } |
780 | - EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
781 | - EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
780 | + EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
781 | + EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | * @return void |
789 | 789 | */ |
790 | 790 | private function _maybe_brew_regular() { |
791 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
792 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
791 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
792 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
793 | 793 | } |
794 | 794 | } |
795 | 795 | |
@@ -804,9 +804,9 @@ discard block |
||
804 | 804 | * @return void |
805 | 805 | */ |
806 | 806 | public function register_shortcodes_modules_and_widgets() { |
807 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
807 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
808 | 808 | // check for addons using old hookpoint |
809 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
809 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
810 | 810 | $this->_incompatible_addon_error(); |
811 | 811 | } |
812 | 812 | } |
@@ -820,19 +820,19 @@ discard block |
||
820 | 820 | */ |
821 | 821 | private function _incompatible_addon_error() { |
822 | 822 | // get array of classes hooking into here |
823 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
824 | - if ( ! empty( $class_names )) { |
|
825 | - $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' ); |
|
823 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
824 | + if ( ! empty($class_names)) { |
|
825 | + $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'); |
|
826 | 826 | $msg .= '<ul>'; |
827 | - foreach ( $class_names as $class_name ) { |
|
828 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
827 | + foreach ($class_names as $class_name) { |
|
828 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
829 | 829 | } |
830 | 830 | $msg .= '</ul>'; |
831 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
831 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
832 | 832 | // save list of incompatible addons to wp-options for later use |
833 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
834 | - if ( is_admin() ) { |
|
835 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
833 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
834 | + if (is_admin()) { |
|
835 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
@@ -848,25 +848,25 @@ discard block |
||
848 | 848 | * |
849 | 849 | * @return void |
850 | 850 | */ |
851 | - public function brew_espresso(){ |
|
852 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
851 | + public function brew_espresso() { |
|
852 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
853 | 853 | // load some final core systems |
854 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
855 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
856 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
857 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
858 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
859 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
860 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
861 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
862 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
863 | - |
|
864 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
854 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
855 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
856 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
857 | + add_action('init', array($this, 'load_controllers'), 7); |
|
858 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
859 | + add_action('init', array($this, 'initialize'), 10); |
|
860 | + add_action('init', array($this, 'initialize_last'), 100); |
|
861 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
862 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
863 | + |
|
864 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
865 | 865 | // pew pew pew |
866 | - EE_Registry::instance()->load_core( 'PUE' ); |
|
867 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
866 | + EE_Registry::instance()->load_core('PUE'); |
|
867 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
868 | 868 | } |
869 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
869 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | */ |
881 | 881 | public function set_hooks_for_core() { |
882 | 882 | $this->_deactivate_incompatible_addons(); |
883 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
883 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | |
@@ -889,15 +889,15 @@ discard block |
||
889 | 889 | * Using the information gathered in EE_System::_incompatible_addon_error, |
890 | 890 | * deactivates any addons considered incompatible with the current version of EE |
891 | 891 | */ |
892 | - private function _deactivate_incompatible_addons(){ |
|
893 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
894 | - if ( ! empty( $incompatible_addons )) { |
|
895 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
896 | - foreach ( $active_plugins as $active_plugin ) { |
|
897 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
898 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
899 | - unset( $_GET['activate'] ); |
|
900 | - EE_System::deactivate_plugin( $active_plugin ); |
|
892 | + private function _deactivate_incompatible_addons() { |
|
893 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
894 | + if ( ! empty($incompatible_addons)) { |
|
895 | + $active_plugins = get_option('active_plugins', array()); |
|
896 | + foreach ($active_plugins as $active_plugin) { |
|
897 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
898 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
899 | + unset($_GET['activate']); |
|
900 | + EE_System::deactivate_plugin($active_plugin); |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | } |
@@ -914,11 +914,11 @@ discard block |
||
914 | 914 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
915 | 915 | * @return void |
916 | 916 | */ |
917 | - public static function deactivate_plugin( $plugin_basename = '' ) { |
|
918 | - if ( ! function_exists( 'deactivate_plugins' )) { |
|
919 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
917 | + public static function deactivate_plugin($plugin_basename = '') { |
|
918 | + if ( ! function_exists('deactivate_plugins')) { |
|
919 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
920 | 920 | } |
921 | - deactivate_plugins( $plugin_basename ); |
|
921 | + deactivate_plugins($plugin_basename); |
|
922 | 922 | } |
923 | 923 | |
924 | 924 | |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | * @return void |
931 | 931 | */ |
932 | 932 | public function perform_activations_upgrades_and_migrations() { |
933 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
933 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
934 | 934 | } |
935 | 935 | |
936 | 936 | |
@@ -946,11 +946,11 @@ discard block |
||
946 | 946 | // EEM_Datetime::instance()->show_next_x_db_queries(); |
947 | 947 | // $ds = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time($e->ID(),false); |
948 | 948 | // |
949 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
949 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
950 | 950 | // register Custom Post Types |
951 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
951 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
952 | 952 | // EE_Registry::instance()->load_core( 'Session' ); |
953 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
953 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
954 | 954 | } |
955 | 955 | |
956 | 956 | |
@@ -965,16 +965,16 @@ discard block |
||
965 | 965 | * @return void |
966 | 966 | */ |
967 | 967 | public function load_controllers() { |
968 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
968 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
969 | 969 | // let's get it started |
970 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
971 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
972 | - EE_Registry::instance()->load_core( 'Front_Controller' ); |
|
973 | - } else if ( ! EE_FRONT_AJAX ) { |
|
974 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
975 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
970 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
971 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
972 | + EE_Registry::instance()->load_core('Front_Controller'); |
|
973 | + } else if ( ! EE_FRONT_AJAX) { |
|
974 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
975 | + EE_Registry::instance()->load_core('Admin'); |
|
976 | 976 | } |
977 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
977 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | |
@@ -988,10 +988,10 @@ discard block |
||
988 | 988 | * @return void |
989 | 989 | */ |
990 | 990 | public function core_loaded_and_ready() { |
991 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
992 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
991 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
992 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
993 | 993 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
994 | - EE_Registry::instance()->load_core( 'Session' ); |
|
994 | + EE_Registry::instance()->load_core('Session'); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | * @return void |
1006 | 1006 | */ |
1007 | 1007 | public function initialize() { |
1008 | - do_action( 'AHEE__EE_System__initialize' ); |
|
1008 | + do_action('AHEE__EE_System__initialize'); |
|
1009 | 1009 | // EE_Cron_Tasks::check_for_abandoned_transactions( 802 ); |
1010 | 1010 | } |
1011 | 1011 | |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | * @return void |
1021 | 1021 | */ |
1022 | 1022 | public function initialize_last() { |
1023 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
1023 | + do_action('AHEE__EE_System__initialize_last'); |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | |
@@ -1052,21 +1052,21 @@ discard block |
||
1052 | 1052 | */ |
1053 | 1053 | public static function do_not_cache() { |
1054 | 1054 | // set no cache constants |
1055 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
1056 | - define( 'DONOTCACHEPAGE', true ); |
|
1055 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
1056 | + define('DONOTCACHEPAGE', true); |
|
1057 | 1057 | } |
1058 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
1059 | - define( 'DONOTCACHCEOBJECT', true ); |
|
1058 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
1059 | + define('DONOTCACHCEOBJECT', true); |
|
1060 | 1060 | } |
1061 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
1062 | - define( 'DONOTCACHEDB', true ); |
|
1061 | + if ( ! defined('DONOTCACHEDB')) { |
|
1062 | + define('DONOTCACHEDB', true); |
|
1063 | 1063 | } |
1064 | 1064 | // add no cache headers |
1065 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
1065 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
1066 | 1066 | // plus a little extra for nginx |
1067 | - add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 ); |
|
1067 | + add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1); |
|
1068 | 1068 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
1069 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
1069 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | * @param $headers |
1079 | 1079 | * @return array |
1080 | 1080 | */ |
1081 | - public static function nocache_headers_nginx ( $headers ) { |
|
1081 | + public static function nocache_headers_nginx($headers) { |
|
1082 | 1082 | $headers['X-Accel-Expires'] = 0; |
1083 | 1083 | return $headers; |
1084 | 1084 | } |
@@ -1104,15 +1104,15 @@ discard block |
||
1104 | 1104 | * @param $admin_bar |
1105 | 1105 | * @return void |
1106 | 1106 | */ |
1107 | - public function espresso_toolbar_items( $admin_bar ) { |
|
1107 | + public function espresso_toolbar_items($admin_bar) { |
|
1108 | 1108 | |
1109 | 1109 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
1110 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
1110 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
1111 | 1111 | return; |
1112 | 1112 | } |
1113 | 1113 | |
1114 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1115 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
1114 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1115 | + EE_Registry::instance()->load_helper('URL'); |
|
1116 | 1116 | $menu_class = 'espresso_menu_item_class'; |
1117 | 1117 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
1118 | 1118 | //because they're only defined in each of their respective constructors |
@@ -1123,20 +1123,20 @@ discard block |
||
1123 | 1123 | //Top Level |
1124 | 1124 | $admin_bar->add_menu(array( |
1125 | 1125 | 'id' => 'espresso-toolbar', |
1126 | - '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>', |
|
1126 | + '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>', |
|
1127 | 1127 | 'href' => $events_admin_url, |
1128 | 1128 | 'meta' => array( |
1129 | 1129 | 'title' => __('Event Espresso', 'event_espresso'), |
1130 | - 'class' => $menu_class . 'first' |
|
1130 | + 'class' => $menu_class.'first' |
|
1131 | 1131 | ), |
1132 | 1132 | )); |
1133 | 1133 | |
1134 | 1134 | //Events |
1135 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
1135 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
1136 | 1136 | $admin_bar->add_menu(array( |
1137 | 1137 | 'id' => 'espresso-toolbar-events', |
1138 | 1138 | 'parent' => 'espresso-toolbar', |
1139 | - 'title' => __( 'Events', 'event_espresso' ), |
|
1139 | + 'title' => __('Events', 'event_espresso'), |
|
1140 | 1140 | 'href' => $events_admin_url, |
1141 | 1141 | 'meta' => array( |
1142 | 1142 | 'title' => __('Events', 'event_espresso'), |
@@ -1147,13 +1147,13 @@ discard block |
||
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | |
1150 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
1150 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
1151 | 1151 | //Events Add New |
1152 | 1152 | $admin_bar->add_menu(array( |
1153 | 1153 | 'id' => 'espresso-toolbar-events-new', |
1154 | 1154 | 'parent' => 'espresso-toolbar-events', |
1155 | 1155 | 'title' => __('Add New', 'event_espresso'), |
1156 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
1156 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
1157 | 1157 | 'meta' => array( |
1158 | 1158 | 'title' => __('Add New', 'event_espresso'), |
1159 | 1159 | 'target' => '', |
@@ -1163,11 +1163,11 @@ discard block |
||
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | //Events View |
1166 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
1166 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1167 | 1167 | $admin_bar->add_menu(array( |
1168 | 1168 | 'id' => 'espresso-toolbar-events-view', |
1169 | 1169 | 'parent' => 'espresso-toolbar-events', |
1170 | - 'title' => __( 'View', 'event_espresso' ), |
|
1170 | + 'title' => __('View', 'event_espresso'), |
|
1171 | 1171 | 'href' => $events_admin_url, |
1172 | 1172 | 'meta' => array( |
1173 | 1173 | 'title' => __('View', 'event_espresso'), |
@@ -1177,12 +1177,12 @@ discard block |
||
1177 | 1177 | )); |
1178 | 1178 | } |
1179 | 1179 | |
1180 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1180 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1181 | 1181 | //Events View All |
1182 | 1182 | $admin_bar->add_menu(array( |
1183 | 1183 | 'id' => 'espresso-toolbar-events-all', |
1184 | 1184 | 'parent' => 'espresso-toolbar-events-view', |
1185 | - 'title' => __( 'All', 'event_espresso' ), |
|
1185 | + 'title' => __('All', 'event_espresso'), |
|
1186 | 1186 | 'href' => $events_admin_url, |
1187 | 1187 | 'meta' => array( |
1188 | 1188 | 'title' => __('All', 'event_espresso'), |
@@ -1193,13 +1193,13 @@ discard block |
||
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | |
1196 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1196 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1197 | 1197 | //Events View Today |
1198 | 1198 | $admin_bar->add_menu(array( |
1199 | 1199 | 'id' => 'espresso-toolbar-events-today', |
1200 | 1200 | 'parent' => 'espresso-toolbar-events-view', |
1201 | 1201 | 'title' => __('Today', 'event_espresso'), |
1202 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1202 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1203 | 1203 | 'meta' => array( |
1204 | 1204 | 'title' => __('Today', 'event_espresso'), |
1205 | 1205 | 'target' => '', |
@@ -1209,13 +1209,13 @@ discard block |
||
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | |
1212 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1212 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1213 | 1213 | //Events View This Month |
1214 | 1214 | $admin_bar->add_menu(array( |
1215 | 1215 | 'id' => 'espresso-toolbar-events-month', |
1216 | 1216 | 'parent' => 'espresso-toolbar-events-view', |
1217 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1218 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1217 | + 'title' => __('This Month', 'event_espresso'), |
|
1218 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1219 | 1219 | 'meta' => array( |
1220 | 1220 | 'title' => __('This Month', 'event_espresso'), |
1221 | 1221 | 'target' => '', |
@@ -1225,11 +1225,11 @@ discard block |
||
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | //Registration Overview |
1228 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1228 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1229 | 1229 | $admin_bar->add_menu(array( |
1230 | 1230 | 'id' => 'espresso-toolbar-registrations', |
1231 | 1231 | 'parent' => 'espresso-toolbar', |
1232 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1232 | + 'title' => __('Registrations', 'event_espresso'), |
|
1233 | 1233 | 'href' => $reg_admin_url, |
1234 | 1234 | 'meta' => array( |
1235 | 1235 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1240,12 +1240,12 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | //Registration Overview Today |
1243 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1243 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1244 | 1244 | $admin_bar->add_menu(array( |
1245 | 1245 | 'id' => 'espresso-toolbar-registrations-today', |
1246 | 1246 | 'parent' => 'espresso-toolbar-registrations', |
1247 | - 'title' => __( 'Today', 'event_espresso'), |
|
1248 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1247 | + 'title' => __('Today', 'event_espresso'), |
|
1248 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1249 | 1249 | 'meta' => array( |
1250 | 1250 | 'title' => __('Today', 'event_espresso'), |
1251 | 1251 | 'target' => '', |
@@ -1255,14 +1255,14 @@ discard block |
||
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | //Registration Overview Today Completed |
1258 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1258 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1259 | 1259 | $admin_bar->add_menu(array( |
1260 | 1260 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1261 | 1261 | 'parent' => 'espresso-toolbar-registrations-today', |
1262 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1263 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1262 | + 'title' => __('Approved', 'event_espresso'), |
|
1263 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1264 | 1264 | 'meta' => array( |
1265 | - 'title' => __('Approved', 'event_espresso' ), |
|
1265 | + 'title' => __('Approved', 'event_espresso'), |
|
1266 | 1266 | 'target' => '', |
1267 | 1267 | 'class' => $menu_class |
1268 | 1268 | ), |
@@ -1270,14 +1270,14 @@ discard block |
||
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | //Registration Overview Today Pending\ |
1273 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1273 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1274 | 1274 | $admin_bar->add_menu(array( |
1275 | 1275 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1276 | 1276 | 'parent' => 'espresso-toolbar-registrations-today', |
1277 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1278 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1277 | + 'title' => __('Pending', 'event_espresso'), |
|
1278 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1279 | 1279 | 'meta' => array( |
1280 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1280 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1281 | 1281 | 'target' => '', |
1282 | 1282 | 'class' => $menu_class |
1283 | 1283 | ), |
@@ -1285,14 +1285,14 @@ discard block |
||
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | //Registration Overview Today Incomplete |
1288 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1288 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1289 | 1289 | $admin_bar->add_menu(array( |
1290 | 1290 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1291 | 1291 | 'parent' => 'espresso-toolbar-registrations-today', |
1292 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1293 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1292 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1293 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1294 | 1294 | 'meta' => array( |
1295 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1295 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1296 | 1296 | 'target' => '', |
1297 | 1297 | 'class' => $menu_class |
1298 | 1298 | ), |
@@ -1300,12 +1300,12 @@ discard block |
||
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | //Registration Overview Today Incomplete |
1303 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1303 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1304 | 1304 | $admin_bar->add_menu(array( |
1305 | 1305 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1306 | 1306 | 'parent' => 'espresso-toolbar-registrations-today', |
1307 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1308 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1307 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1308 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1309 | 1309 | 'meta' => array( |
1310 | 1310 | 'title' => __('Cancelled', 'event_espresso'), |
1311 | 1311 | 'target' => '', |
@@ -1315,12 +1315,12 @@ discard block |
||
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | //Registration Overview This Month |
1318 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1318 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1319 | 1319 | $admin_bar->add_menu(array( |
1320 | 1320 | 'id' => 'espresso-toolbar-registrations-month', |
1321 | 1321 | 'parent' => 'espresso-toolbar-registrations', |
1322 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1323 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1322 | + 'title' => __('This Month', 'event_espresso'), |
|
1323 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1324 | 1324 | 'meta' => array( |
1325 | 1325 | 'title' => __('This Month', 'event_espresso'), |
1326 | 1326 | 'target' => '', |
@@ -1330,12 +1330,12 @@ discard block |
||
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | //Registration Overview This Month Approved |
1333 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1333 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1334 | 1334 | $admin_bar->add_menu(array( |
1335 | 1335 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1336 | 1336 | 'parent' => 'espresso-toolbar-registrations-month', |
1337 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1338 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1337 | + 'title' => __('Approved', 'event_espresso'), |
|
1338 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1339 | 1339 | 'meta' => array( |
1340 | 1340 | 'title' => __('Approved', 'event_espresso'), |
1341 | 1341 | 'target' => '', |
@@ -1345,12 +1345,12 @@ discard block |
||
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | //Registration Overview This Month Pending |
1348 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1348 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1349 | 1349 | $admin_bar->add_menu(array( |
1350 | 1350 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1351 | 1351 | 'parent' => 'espresso-toolbar-registrations-month', |
1352 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1353 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1352 | + 'title' => __('Pending', 'event_espresso'), |
|
1353 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1354 | 1354 | 'meta' => array( |
1355 | 1355 | 'title' => __('Pending', 'event_espresso'), |
1356 | 1356 | 'target' => '', |
@@ -1360,14 +1360,14 @@ discard block |
||
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | //Registration Overview This Month Not Approved |
1363 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1363 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1364 | 1364 | $admin_bar->add_menu(array( |
1365 | 1365 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1366 | 1366 | 'parent' => 'espresso-toolbar-registrations-month', |
1367 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1368 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1367 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1368 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1369 | 1369 | 'meta' => array( |
1370 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1370 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1371 | 1371 | 'target' => '', |
1372 | 1372 | 'class' => $menu_class |
1373 | 1373 | ), |
@@ -1376,12 +1376,12 @@ discard block |
||
1376 | 1376 | |
1377 | 1377 | |
1378 | 1378 | //Registration Overview This Month Cancelled |
1379 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1379 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1380 | 1380 | $admin_bar->add_menu(array( |
1381 | 1381 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1382 | 1382 | 'parent' => 'espresso-toolbar-registrations-month', |
1383 | 1383 | 'title' => __('Cancelled', 'event_espresso'), |
1384 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1384 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1385 | 1385 | 'meta' => array( |
1386 | 1386 | 'title' => __('Cancelled', 'event_espresso'), |
1387 | 1387 | 'target' => '', |
@@ -1402,8 +1402,8 @@ discard block |
||
1402 | 1402 | * @param array $exclude_array any existing pages being excluded are in this array. |
1403 | 1403 | * @return array |
1404 | 1404 | */ |
1405 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1406 | - return array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() ); |
|
1405 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1406 | + return array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array()); |
|
1407 | 1407 | } |
1408 | 1408 | |
1409 | 1409 | |
@@ -1423,11 +1423,11 @@ discard block |
||
1423 | 1423 | */ |
1424 | 1424 | public function wp_enqueue_scripts() { |
1425 | 1425 | // 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' ); |
1426 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1426 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1427 | 1427 | // 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' ); |
1428 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1428 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1429 | 1429 | // register jQuery Validate |
1430 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE ); |
|
1430 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
1431 | 1431 | } |
1432 | 1432 | } |
1433 | 1433 | } |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | |
469 | 469 | |
470 | 470 | /** |
471 | - * load_espresso_addons |
|
472 | - * |
|
473 | - * allow addons to load first so that they can set hooks for running DMS's, etc |
|
474 | - * |
|
475 | - * @access public |
|
476 | - * @return void |
|
477 | - */ |
|
471 | + * load_espresso_addons |
|
472 | + * |
|
473 | + * allow addons to load first so that they can set hooks for running DMS's, etc |
|
474 | + * |
|
475 | + * @access public |
|
476 | + * @return void |
|
477 | + */ |
|
478 | 478 | public function load_espresso_addons() { |
479 | 479 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
480 | 480 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
@@ -498,14 +498,14 @@ discard block |
||
498 | 498 | } |
499 | 499 | } |
500 | 500 | /** |
501 | - * detect_if_activation_or_upgrade |
|
502 | - * |
|
503 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
504 | - * and either setting up the DB or setting up maintenance mode etc. |
|
505 | - * |
|
506 | - * @access private |
|
507 | - * @return void |
|
508 | - */ |
|
501 | + * detect_if_activation_or_upgrade |
|
502 | + * |
|
503 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
504 | + * and either setting up the DB or setting up maintenance mode etc. |
|
505 | + * |
|
506 | + * @access private |
|
507 | + * @return void |
|
508 | + */ |
|
509 | 509 | public function detect_if_activation_or_upgrade() { |
510 | 510 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
511 | 511 | |
@@ -803,11 +803,11 @@ discard block |
||
803 | 803 | $query_params = array( 'page' => 'espresso_about' ); |
804 | 804 | |
805 | 805 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
806 | - $query_params['new_activation'] = TRUE; |
|
806 | + $query_params['new_activation'] = TRUE; |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
810 | - $query_params['reactivation'] = TRUE; |
|
810 | + $query_params['reactivation'] = TRUE; |
|
811 | 811 | } |
812 | 812 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
813 | 813 | wp_safe_redirect( $url ); |
@@ -888,13 +888,13 @@ discard block |
||
888 | 888 | |
889 | 889 | |
890 | 890 | /** |
891 | - * register_shortcodes_modules_and_widgets |
|
892 | - * |
|
893 | - * generate lists of shortcodes and modules, then verify paths and classes |
|
894 | - * |
|
895 | - * @access public |
|
896 | - * @return void |
|
897 | - */ |
|
891 | + * register_shortcodes_modules_and_widgets |
|
892 | + * |
|
893 | + * generate lists of shortcodes and modules, then verify paths and classes |
|
894 | + * |
|
895 | + * @access public |
|
896 | + * @return void |
|
897 | + */ |
|
898 | 898 | public function register_shortcodes_modules_and_widgets() { |
899 | 899 | do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
900 | 900 | // check for addons using old hookpoint |
@@ -905,11 +905,11 @@ discard block |
||
905 | 905 | |
906 | 906 | |
907 | 907 | /** |
908 | - * _incompatible_addon_error |
|
909 | - * |
|
910 | - * @access public |
|
911 | - * @return void |
|
912 | - */ |
|
908 | + * _incompatible_addon_error |
|
909 | + * |
|
910 | + * @access public |
|
911 | + * @return void |
|
912 | + */ |
|
913 | 913 | private function _incompatible_addon_error() { |
914 | 914 | // get array of classes hooking into here |
915 | 915 | $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
@@ -1048,14 +1048,14 @@ discard block |
||
1048 | 1048 | |
1049 | 1049 | |
1050 | 1050 | /** |
1051 | - * load_controllers |
|
1052 | - * |
|
1053 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
1054 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
1055 | - * |
|
1056 | - * @access public |
|
1057 | - * @return void |
|
1058 | - */ |
|
1051 | + * load_controllers |
|
1052 | + * |
|
1053 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
1054 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
1055 | + * |
|
1056 | + * @access public |
|
1057 | + * @return void |
|
1058 | + */ |
|
1059 | 1059 | public function load_controllers() { |
1060 | 1060 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
1061 | 1061 | // let's get it started |
@@ -1072,13 +1072,13 @@ discard block |
||
1072 | 1072 | |
1073 | 1073 | |
1074 | 1074 | /** |
1075 | - * core_loaded_and_ready |
|
1076 | - * |
|
1077 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
1078 | - * |
|
1079 | - * @access public |
|
1080 | - * @return void |
|
1081 | - */ |
|
1075 | + * core_loaded_and_ready |
|
1076 | + * |
|
1077 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
1078 | + * |
|
1079 | + * @access public |
|
1080 | + * @return void |
|
1081 | + */ |
|
1082 | 1082 | public function core_loaded_and_ready() { |
1083 | 1083 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
1084 | 1084 | do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
@@ -1089,13 +1089,13 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | |
1091 | 1091 | /** |
1092 | - * initialize |
|
1093 | - * |
|
1094 | - * this is the best place to begin initializing client code |
|
1095 | - * |
|
1096 | - * @access public |
|
1097 | - * @return void |
|
1098 | - */ |
|
1092 | + * initialize |
|
1093 | + * |
|
1094 | + * this is the best place to begin initializing client code |
|
1095 | + * |
|
1096 | + * @access public |
|
1097 | + * @return void |
|
1098 | + */ |
|
1099 | 1099 | public function initialize() { |
1100 | 1100 | do_action( 'AHEE__EE_System__initialize' ); |
1101 | 1101 | // EE_Cron_Tasks::check_for_abandoned_transactions( 802 ); |
@@ -1104,13 +1104,13 @@ discard block |
||
1104 | 1104 | |
1105 | 1105 | |
1106 | 1106 | /** |
1107 | - * initialize_last |
|
1108 | - * |
|
1109 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
1110 | - * |
|
1111 | - * @access public |
|
1112 | - * @return void |
|
1113 | - */ |
|
1107 | + * initialize_last |
|
1108 | + * |
|
1109 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
1110 | + * |
|
1111 | + * @access public |
|
1112 | + * @return void |
|
1113 | + */ |
|
1114 | 1114 | public function initialize_last() { |
1115 | 1115 | do_action( 'AHEE__EE_System__initialize_last' ); |
1116 | 1116 | } |
@@ -1119,14 +1119,14 @@ discard block |
||
1119 | 1119 | |
1120 | 1120 | |
1121 | 1121 | /** |
1122 | - * set_hooks_for_shortcodes_modules_and_addons |
|
1123 | - * |
|
1124 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
1125 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
1126 | - * |
|
1127 | - * @access public |
|
1128 | - * @return void |
|
1129 | - */ |
|
1122 | + * set_hooks_for_shortcodes_modules_and_addons |
|
1123 | + * |
|
1124 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
1125 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
1126 | + * |
|
1127 | + * @access public |
|
1128 | + * @return void |
|
1129 | + */ |
|
1130 | 1130 | public function set_hooks_for_shortcodes_modules_and_addons() { |
1131 | 1131 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
1132 | 1132 | } |
@@ -1135,13 +1135,13 @@ discard block |
||
1135 | 1135 | |
1136 | 1136 | |
1137 | 1137 | /** |
1138 | - * do_not_cache |
|
1139 | - * |
|
1140 | - * sets no cache headers and defines no cache constants for WP plugins |
|
1141 | - * |
|
1142 | - * @access public |
|
1143 | - * @return void |
|
1144 | - */ |
|
1138 | + * do_not_cache |
|
1139 | + * |
|
1140 | + * sets no cache headers and defines no cache constants for WP plugins |
|
1141 | + * |
|
1142 | + * @access public |
|
1143 | + * @return void |
|
1144 | + */ |
|
1145 | 1145 | public static function do_not_cache() { |
1146 | 1146 | // set no cache constants |
1147 | 1147 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | final class EE_Admin { |
25 | 25 | |
26 | 26 | /** |
27 | - * EE_Admin Object |
|
28 | - * @private _instance |
|
29 | - * @private protected |
|
30 | - */ |
|
27 | + * EE_Admin Object |
|
28 | + * @private _instance |
|
29 | + * @private protected |
|
30 | + */ |
|
31 | 31 | private static $_instance = NULL; |
32 | 32 | |
33 | 33 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
59 | - * class constructor |
|
60 | - */ |
|
59 | + * class constructor |
|
60 | + */ |
|
61 | 61 | protected function __construct() { |
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | |
169 | 169 | |
170 | 170 | /** |
171 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | - * |
|
173 | - * @access public |
|
174 | - * @return void |
|
175 | - */ |
|
171 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | + * |
|
173 | + * @access public |
|
174 | + * @return void |
|
175 | + */ |
|
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
466 | - * admin_init |
|
467 | - * |
|
468 | - * @access public |
|
469 | - * @return void |
|
470 | - */ |
|
466 | + * admin_init |
|
467 | + * |
|
468 | + * @access public |
|
469 | + * @return void |
|
470 | + */ |
|
471 | 471 | public function admin_init() { |
472 | 472 | |
473 | 473 | /** |
@@ -624,11 +624,11 @@ discard block |
||
624 | 624 | |
625 | 625 | |
626 | 626 | /** |
627 | - * dismiss_persistent_admin_notice |
|
628 | - * |
|
629 | - * @access public |
|
630 | - * @return void |
|
631 | - */ |
|
627 | + * dismiss_persistent_admin_notice |
|
628 | + * |
|
629 | + * @access public |
|
630 | + * @return void |
|
631 | + */ |
|
632 | 632 | public function dismiss_ee_nag_notice_callback() { |
633 | 633 | EE_Error::dismiss_persistent_admin_notice(); |
634 | 634 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
103 | - define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' ); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | + define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,23 +113,23 @@ discard block |
||
113 | 113 | * @param string $plugin |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function filter_plugin_actions( $links, $plugin ) { |
|
116 | + public function filter_plugin_actions($links, $plugin) { |
|
117 | 117 | // set $main_file in stone |
118 | 118 | static $main_file; |
119 | 119 | // if $main_file is not set yet |
120 | - if ( ! $main_file ) { |
|
121 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
120 | + if ( ! $main_file) { |
|
121 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
122 | 122 | } |
123 | - if ( $plugin == $main_file ) { |
|
123 | + if ($plugin == $main_file) { |
|
124 | 124 | // compare current plugin to this one |
125 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
126 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
127 | - array_unshift( $links, $maintenance_link ); |
|
125 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
126 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
127 | + array_unshift($links, $maintenance_link); |
|
128 | 128 | } else { |
129 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
130 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
129 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
130 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
131 | 131 | // add before other links |
132 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
132 | + array_unshift($links, $org_settings_link, $events_link); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | return $links; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | public function get_request() { |
147 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
148 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
147 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
148 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param array $admin_page_folder_names |
158 | 158 | * @return array |
159 | 159 | */ |
160 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
160 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
161 | 161 | return array( |
162 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
163 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
164 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
162 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
163 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
164 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
@@ -176,36 +176,36 @@ discard block |
||
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
179 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
179 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
180 | 180 | //ok so we want to enable the entire admin |
181 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
182 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
183 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
184 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
185 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
186 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
182 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
183 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
184 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
185 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
187 | 187 | //at a glance dashboard widget |
188 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
188 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
189 | 189 | //filter for get_edit_post_link used on comments for custom post types |
190 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
190 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
194 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
194 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
195 | 195 | try { |
196 | 196 | //this loads the controller for the admin pages which will setup routing etc |
197 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
198 | - } catch ( EE_Error $e ) { |
|
197 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
198 | + } catch (EE_Error $e) { |
|
199 | 199 | $e->get_error(); |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
204 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
205 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
204 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
205 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
206 | 206 | |
207 | 207 | //exclude EE critical pages from all nav menus and wp_list_pages |
208 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
208 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * @param object $post_type WP post type object |
219 | 219 | * @return object WP post type object |
220 | 220 | */ |
221 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
221 | + public function remove_pages_from_nav_menu($post_type) { |
|
222 | 222 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
223 | + if ($post_type->name !== 'page') |
|
224 | 224 | return $post_type; |
225 | 225 | |
226 | 226 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function enable_hidden_ee_nav_menu_metaboxes() { |
242 | 242 | global $wp_meta_boxes, $pagenow; |
243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) |
|
243 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') |
|
244 | 244 | return; |
245 | 245 | |
246 | - $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories' ); |
|
246 | + $initial_meta_boxes = array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories'); |
|
247 | 247 | $hidden_meta_boxes = array(); |
248 | 248 | |
249 | - foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) { |
|
250 | - foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) { |
|
251 | - foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) { |
|
252 | - if ( in_array( $box['id'], $initial_meta_boxes ) ) { |
|
253 | - unset( $box['id'] ); |
|
249 | + foreach (array_keys($wp_meta_boxes['nav-menus']) as $context) { |
|
250 | + foreach (array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority) { |
|
251 | + foreach ($wp_meta_boxes['nav-menus'][$context][$priority] as $box) { |
|
252 | + if (in_array($box['id'], $initial_meta_boxes)) { |
|
253 | + unset($box['id']); |
|
254 | 254 | } else { |
255 | 255 | $hidden_meta_boxes[] = $box['id']; |
256 | 256 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | $user = wp_get_current_user(); |
262 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
262 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return void |
279 | 279 | */ |
280 | 280 | public function register_custom_nav_menu_boxes() { |
281 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
281 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return string the (maybe) modified link |
297 | 297 | */ |
298 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
299 | - if ( ! $post = get_post( $id ) ) |
|
298 | + public function modify_edit_post_link($link, $id, $context) { |
|
299 | + if ( ! $post = get_post($id)) |
|
300 | 300 | return $link; |
301 | 301 | |
302 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
302 | + if ($post->post_type == 'espresso_attendees') { |
|
303 | 303 | $query_args = array( |
304 | 304 | 'action' => 'edit_attendee', |
305 | 305 | 'post' => $id |
306 | 306 | ); |
307 | 307 | EE_Registry::instance()->load_helper('URL'); |
308 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
308 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
309 | 309 | } |
310 | 310 | return $link; |
311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | global $nav_menu_selected_id; |
318 | 318 | |
319 | 319 | $db_fields = false; |
320 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
320 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
321 | 321 | $current_tab = 'event-archives'; |
322 | 322 | |
323 | 323 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | ?> |
337 | 337 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
338 | 338 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
339 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
339 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
340 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
342 | 342 | </a> |
343 | 343 | </li> |
344 | 344 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | <?php */ ?> |
357 | 357 | |
358 | 358 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
359 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
359 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
360 | 360 | ?>"> |
361 | 361 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
362 | 362 | <?php |
363 | 363 | $pages = $this->_get_extra_nav_menu_pages_items(); |
364 | 364 | $args['walker'] = $walker; |
365 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
365 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
366 | 366 | ?> |
367 | 367 | </ul> |
368 | 368 | </div><!-- /.tabs-panel --> |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | <p class="button-controls"> |
371 | 371 | <span class="list-controls"> |
372 | 372 | <a href="<?php |
373 | - echo esc_url( add_query_arg( |
|
373 | + echo esc_url(add_query_arg( |
|
374 | 374 | array( |
375 | 375 | 'extra-nav-menu-pages-tab' => 'event-archives', |
376 | 376 | 'selectall' => 1, |
377 | 377 | ), |
378 | - remove_query_arg( $removed_args ) |
|
378 | + remove_query_arg($removed_args) |
|
379 | 379 | )); |
380 | 380 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
381 | 381 | </span> |
382 | 382 | |
383 | 383 | <span class="add-to-menu"> |
384 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
384 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
385 | 385 | <span class="spinner"></span> |
386 | 386 | </span> |
387 | 387 | </p> |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | private function _get_extra_nav_menu_pages_items() { |
403 | 403 | $menuitems[] = array( |
404 | 404 | 'title' => __('Event List', 'event_espresso'), |
405 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
405 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
406 | 406 | 'description' => __('Archive page for all events.', 'event_espresso') |
407 | 407 | ); |
408 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
408 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @param $menuitem |
418 | 418 | * @return stdClass |
419 | 419 | */ |
420 | - private function _setup_extra_nav_menu_pages_items( $menuitem ) { |
|
420 | + private function _setup_extra_nav_menu_pages_items($menuitem) { |
|
421 | 421 | $menu_item = new stdClass(); |
422 | 422 | $keys = array( |
423 | 423 | 'ID' => 0, |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'xfn' => '' |
438 | 438 | ); |
439 | 439 | |
440 | - foreach ( $keys as $key => $value) { |
|
440 | + foreach ($keys as $key => $value) { |
|
441 | 441 | $menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value; |
442 | 442 | } |
443 | 443 | return $menu_item; |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | * - check if doing post processing of one of EE CPTs |
478 | 478 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
479 | 479 | */ |
480 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
481 | - if ( isset( $_POST['post_type'] ) ) { |
|
482 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
483 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
480 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
481 | + if (isset($_POST['post_type'])) { |
|
482 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
483 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -496,37 +496,37 @@ discard block |
||
496 | 496 | public function enqueue_admin_scripts() { |
497 | 497 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
498 | 498 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
499 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
499 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
500 | 500 | // register cookie script for future dependencies |
501 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
501 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
502 | 502 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
503 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
503 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
504 | 504 | // register jQuery Validate |
505 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
505 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
506 | 506 | } |
507 | 507 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
508 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
508 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
509 | 509 | //joyride style |
510 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
511 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
512 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
510 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
511 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
512 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
513 | 513 | //joyride JS |
514 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
514 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
515 | 515 | // wanna go for a joyride? |
516 | 516 | wp_enqueue_style('ee-joyride-css'); |
517 | 517 | wp_enqueue_script('jquery-joyride'); |
518 | 518 | } |
519 | 519 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
520 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
520 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
521 | 521 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
522 | 522 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
523 | 523 | } |
524 | 524 | //accounting.js library |
525 | 525 | // @link http://josscrowcroft.github.io/accounting.js/ |
526 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
527 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
528 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
529 | - wp_enqueue_script( 'ee-accounting' ); |
|
526 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
527 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
528 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
529 | + wp_enqueue_script('ee-accounting'); |
|
530 | 530 | // array of settings to get converted to JSON array via wp_localize_script |
531 | 531 | $currency_config = array( |
532 | 532 | 'currency' => array( |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | public function get_persistent_admin_notices() { |
574 | 574 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
575 | 575 | $args = array( |
576 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
577 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
576 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
577 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
578 | 578 | ); |
579 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
580 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
579 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
580 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | |
@@ -598,20 +598,20 @@ discard block |
||
598 | 598 | * @param $elements |
599 | 599 | * @return array |
600 | 600 | */ |
601 | - public function dashboard_glance_items( $elements ) { |
|
601 | + public function dashboard_glance_items($elements) { |
|
602 | 602 | $events = EEM_Event::instance()->count(); |
603 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
604 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
603 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
604 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
605 | 605 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
606 | 606 | $registrations = EEM_Registration::instance()->count(); |
607 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
608 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
607 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
608 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
609 | 609 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
610 | 610 | |
611 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
611 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
612 | 612 | |
613 | - foreach ( $items as $item ) { |
|
614 | - $elements[] = sprintf( '<a href="%s" title="%s">%s</a>', $item['url'], $item['title'], $item['text'] ); |
|
613 | + foreach ($items as $item) { |
|
614 | + $elements[] = sprintf('<a href="%s" title="%s">%s</a>', $item['url'], $item['title'], $item['text']); |
|
615 | 615 | } |
616 | 616 | return $elements; |
617 | 617 | } |
@@ -630,14 +630,14 @@ discard block |
||
630 | 630 | * @param $post |
631 | 631 | * @return void |
632 | 632 | */ |
633 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
633 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
634 | 634 | // default post types |
635 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
635 | + $post_types = array('post' => 0, 'page' => 1); |
|
636 | 636 | // add CPTs |
637 | 637 | $CPTs = EE_Register_CPTs::get_CPTs(); |
638 | - $post_types = array_merge( $post_types, $CPTs ); |
|
638 | + $post_types = array_merge($post_types, $CPTs); |
|
639 | 639 | // for default or CPT posts... |
640 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
640 | + if (isset($post_types[$post->post_type])) { |
|
641 | 641 | // whether to proceed with update |
642 | 642 | $update_post_shortcodes = FALSE; |
643 | 643 | // post on frontpage ? |
@@ -645,32 +645,32 @@ discard block |
||
645 | 645 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
646 | 646 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
647 | 647 | // array of shortcodes indexed by post name |
648 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
648 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
649 | 649 | // empty both arrays |
650 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
650 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
651 | 651 | // loop thru shortcodes |
652 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
652 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
653 | 653 | // convert to UPPERCASE to get actual shortcode |
654 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
654 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
655 | 655 | // is the shortcode in the post_content ? |
656 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
656 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
657 | 657 | // map shortcode to post names and post IDs |
658 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
658 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
659 | 659 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
660 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
660 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
661 | 661 | // check that posts page is already being tracked |
662 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) { |
|
662 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
663 | 663 | // if not, then ensure that it is properly added |
664 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
664 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
665 | 665 | } |
666 | 666 | // add shortcode to "Posts page" tracking |
667 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
667 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
668 | 668 | } |
669 | 669 | $update_post_shortcodes = TRUE; |
670 | 670 | } |
671 | 671 | } |
672 | - if ( $update_post_shortcodes ) { |
|
673 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
672 | + if ($update_post_shortcodes) { |
|
673 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | } |
@@ -688,38 +688,38 @@ discard block |
||
688 | 688 | * @throws EE_Error |
689 | 689 | * @return string |
690 | 690 | */ |
691 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
691 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
692 | 692 | // check for date_format or time_format |
693 | - switch ( $option ) { |
|
693 | + switch ($option) { |
|
694 | 694 | case 'date_format' : |
695 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
695 | + $date_time_format = $value.' '.get_option('time_format'); |
|
696 | 696 | break; |
697 | 697 | case 'time_format' : |
698 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
698 | + $date_time_format = get_option('date_format').' '.$value; |
|
699 | 699 | break; |
700 | 700 | default : |
701 | 701 | $date_time_format = FALSE; |
702 | 702 | } |
703 | 703 | // do we have a date_time format to check ? |
704 | - if ( $date_time_format ) { |
|
704 | + if ($date_time_format) { |
|
705 | 705 | // because DateTime chokes on some formats, check first that strtotime can parse it |
706 | - $date_string = strtotime( date( $date_time_format )); |
|
706 | + $date_string = strtotime(date($date_time_format)); |
|
707 | 707 | // invalid date time formats will evaluate to either "0" or "" |
708 | - if ( empty( $date_string )) { |
|
708 | + if (empty($date_string)) { |
|
709 | 709 | // trigger WP settings error |
710 | 710 | add_settings_error( |
711 | 711 | 'date_format', |
712 | 712 | 'date_format', |
713 | 713 | sprintf( |
714 | - __('The following date time "%s" ( %s ) can not be properly parsed by PHP due to its format and may cause incompatibility issues with Event Espresso. You will need to choose a more standard date time format in order for everything to operate correctly. %sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), |
|
715 | - date( $date_time_format ), |
|
714 | + __('The following date time "%s" ( %s ) can not be properly parsed by PHP due to its format and may cause incompatibility issues with Event Espresso. You will need to choose a more standard date time format in order for everything to operate correctly. %sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), |
|
715 | + date($date_time_format), |
|
716 | 716 | $date_time_format, |
717 | 717 | '<br /><span style="color:#D54E21;">', |
718 | 718 | '</span>' |
719 | 719 | ) |
720 | 720 | ); |
721 | 721 | // set format to something valid |
722 | - switch ( $option ) { |
|
722 | + switch ($option) { |
|
723 | 723 | case 'date_format' : |
724 | 724 | $value = 'F j, Y'; |
725 | 725 | break; |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | * @param $value |
746 | 746 | * @return void |
747 | 747 | */ |
748 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
749 | - if ( $option == 'page_for_posts' ) { |
|
748 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
749 | + if ($option == 'page_for_posts') { |
|
750 | 750 | global $wpdb; |
751 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
752 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
753 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
754 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
755 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
751 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
752 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
753 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
754 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
755 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
@@ -765,8 +765,8 @@ discard block |
||
765 | 765 | * @param $content |
766 | 766 | * @return string |
767 | 767 | */ |
768 | - public function its_eSpresso( $content ) { |
|
769 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
768 | + public function its_eSpresso($content) { |
|
769 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | |
@@ -779,9 +779,9 @@ discard block |
||
779 | 779 | */ |
780 | 780 | public function espresso_admin_footer() { |
781 | 781 | return sprintf( |
782 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
782 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
783 | 783 | '<a href="http://eventespresso.com/" title="', |
784 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
784 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
785 | 785 | ); |
786 | 786 | } |
787 | 787 | |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | * @param array $config |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
805 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
806 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
804 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
805 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
806 | + if (class_exists('EE_Register_Admin_Page')) |
|
807 | 807 | $config['page_path'] = $page_path; |
808 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
808 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -220,8 +222,9 @@ discard block |
||
220 | 222 | */ |
221 | 223 | public function remove_pages_from_nav_menu( $post_type ) { |
222 | 224 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
224 | - return $post_type; |
|
225 | + if ( $post_type->name !== 'page' ) { |
|
226 | + return $post_type; |
|
227 | + } |
|
225 | 228 | |
226 | 229 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
227 | 230 | |
@@ -240,8 +243,9 @@ discard block |
||
240 | 243 | */ |
241 | 244 | public function enable_hidden_ee_nav_menu_metaboxes() { |
242 | 245 | global $wp_meta_boxes, $pagenow; |
243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) |
|
244 | - return; |
|
246 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
247 | + return; |
|
248 | + } |
|
245 | 249 | |
246 | 250 | $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories' ); |
247 | 251 | $hidden_meta_boxes = array(); |
@@ -296,8 +300,9 @@ discard block |
||
296 | 300 | * @return string the (maybe) modified link |
297 | 301 | */ |
298 | 302 | public function modify_edit_post_link( $link, $id, $context ) { |
299 | - if ( ! $post = get_post( $id ) ) |
|
300 | - return $link; |
|
303 | + if ( ! $post = get_post( $id ) ) { |
|
304 | + return $link; |
|
305 | + } |
|
301 | 306 | |
302 | 307 | if ( $post->post_type == 'espresso_attendees' ) { |
303 | 308 | $query_args = array( |
@@ -337,7 +342,10 @@ discard block |
||
337 | 342 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
338 | 343 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
339 | 344 | <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
345 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) { |
|
346 | + echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); |
|
347 | +} |
|
348 | +?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | 349 | <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
342 | 350 | </a> |
343 | 351 | </li> |
@@ -803,8 +811,9 @@ discard block |
||
803 | 811 | */ |
804 | 812 | public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
805 | 813 | EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
806 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
807 | - $config['page_path'] = $page_path; |
|
814 | + if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
815 | + $config['page_path'] = $page_path; |
|
816 | + } |
|
808 | 817 | EE_Register_Admin_Page::register( $page_basename, $config ); |
809 | 818 | } |
810 | 819 |