@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | 2 | /** |
| 3 | - * Event Espresso |
|
| 4 | - * |
|
| 5 | - * Event Registration and Management Plugin for WordPress |
|
| 6 | - * |
|
| 7 | - * @ package Event Espresso |
|
| 8 | - * @ author Seth Shoultes |
|
| 9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 11 | - * @ link http://www.eventespresso.com |
|
| 12 | - * @ version 4.0 |
|
| 13 | - * |
|
| 14 | - * ------------------------------------------------------------------------ |
|
| 15 | - * |
|
| 16 | - * EEH_Activation Helper |
|
| 17 | - * |
|
| 18 | - * @package Event Espresso |
|
| 19 | - * @subpackage /helpers/ |
|
| 20 | - * @author Brent Christensen |
|
| 21 | - * |
|
| 22 | - * ------------------------------------------------------------------------ |
|
| 23 | - */ |
|
| 3 | + * Event Espresso |
|
| 4 | + * |
|
| 5 | + * Event Registration and Management Plugin for WordPress |
|
| 6 | + * |
|
| 7 | + * @ package Event Espresso |
|
| 8 | + * @ author Seth Shoultes |
|
| 9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 11 | + * @ link http://www.eventespresso.com |
|
| 12 | + * @ version 4.0 |
|
| 13 | + * |
|
| 14 | + * ------------------------------------------------------------------------ |
|
| 15 | + * |
|
| 16 | + * EEH_Activation Helper |
|
| 17 | + * |
|
| 18 | + * @package Event Espresso |
|
| 19 | + * @subpackage /helpers/ |
|
| 20 | + * @author Brent Christensen |
|
| 21 | + * |
|
| 22 | + * ------------------------------------------------------------------------ |
|
| 23 | + */ |
|
| 24 | 24 | class EEH_Activation { |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -1085,14 +1085,14 @@ discard block |
||
| 1085 | 1085 | $QSG_ID = reset( $id_col ); |
| 1086 | 1086 | } else { |
| 1087 | 1087 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
| 1088 | - EE_Log::instance()->log( |
|
| 1089 | - __FILE__, |
|
| 1090 | - __FUNCTION__, |
|
| 1091 | - sprintf( |
|
| 1092 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
| 1093 | - $QST_ID ), |
|
| 1094 | - 'error' ); |
|
| 1095 | - continue; |
|
| 1088 | + EE_Log::instance()->log( |
|
| 1089 | + __FILE__, |
|
| 1090 | + __FUNCTION__, |
|
| 1091 | + sprintf( |
|
| 1092 | + __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
| 1093 | + $QST_ID ), |
|
| 1094 | + 'error' ); |
|
| 1095 | + continue; |
|
| 1096 | 1096 | } |
| 1097 | 1097 | } |
| 1098 | 1098 | |
@@ -1605,8 +1605,8 @@ discard block |
||
| 1605 | 1605 | } |
| 1606 | 1606 | } |
| 1607 | 1607 | } |
| 1608 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
| 1609 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
| 1608 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
| 1609 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
| 1610 | 1610 | |
| 1611 | 1611 | if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
| 1612 | 1612 | $db_update_sans_ee4 = array(); |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | * @param $table_name |
| 58 | 58 | * @return string |
| 59 | 59 | */ |
| 60 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
| 60 | + public static function ensure_table_name_has_prefix($table_name) { |
|
| 61 | 61 | global $wpdb; |
| 62 | - return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
| 62 | + return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * be called on plugin activation and reactivation |
| 86 | 86 | * @return boolean success, whether the database and folders are setup properly |
| 87 | 87 | */ |
| 88 | - public static function initialize_db_and_folders(){ |
|
| 88 | + public static function initialize_db_and_folders() { |
|
| 89 | 89 | $good_filesystem = EEH_Activation::create_upload_directories(); |
| 90 | 90 | $good_db = EEH_Activation::create_database_tables(); |
| 91 | 91 | return $good_filesystem && $good_db; |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * upon activation of a new plugin, reactivation, and at the end |
| 100 | 100 | * of running migration scripts |
| 101 | 101 | */ |
| 102 | - public static function initialize_db_content(){ |
|
| 102 | + public static function initialize_db_content() { |
|
| 103 | 103 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
| 104 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
| 104 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | EEH_Activation::remove_cron_tasks(); |
| 119 | 119 | EEH_Activation::create_cron_tasks(); |
| 120 | 120 | //also, check for CAF default db content |
| 121 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
| 121 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
| 122 | 122 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
| 123 | 123 | //which users really won't care about on initial activation |
| 124 | 124 | EE_Error::overwrite_success(); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @return array |
| 138 | 138 | * @throws \EE_Error |
| 139 | 139 | */ |
| 140 | - public static function get_cron_tasks( $which_to_include ) { |
|
| 140 | + public static function get_cron_tasks($which_to_include) { |
|
| 141 | 141 | $cron_tasks = apply_filters( |
| 142 | 142 | 'FHEE__EEH_Activation__get_cron_tasks', |
| 143 | 143 | array( |
@@ -146,17 +146,17 @@ discard block |
||
| 146 | 146 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
| 147 | 147 | ) |
| 148 | 148 | ); |
| 149 | - if( $which_to_include === 'all' ) { |
|
| 149 | + if ($which_to_include === 'all') { |
|
| 150 | 150 | //leave as-is |
| 151 | - }elseif( $which_to_include === 'old' ) { |
|
| 152 | - $cron_tasks = array_filter( $cron_tasks, function ( $value ) { |
|
| 151 | + }elseif ($which_to_include === 'old') { |
|
| 152 | + $cron_tasks = array_filter($cron_tasks, function($value) { |
|
| 153 | 153 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
| 154 | 154 | }); |
| 155 | - }elseif( $which_to_include === 'current' ) { |
|
| 156 | - $cron_tasks = array_filter( $cron_tasks ); |
|
| 157 | - }elseif( WP_DEBUG ) { |
|
| 158 | - throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) ); |
|
| 159 | - }else{ |
|
| 155 | + }elseif ($which_to_include === 'current') { |
|
| 156 | + $cron_tasks = array_filter($cron_tasks); |
|
| 157 | + }elseif (WP_DEBUG) { |
|
| 158 | + throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include)); |
|
| 159 | + } else { |
|
| 160 | 160 | //leave as-is |
| 161 | 161 | } |
| 162 | 162 | return $cron_tasks; |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public static function create_cron_tasks() { |
| 169 | 169 | |
| 170 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
| 171 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
| 172 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
| 170 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
| 171 | + if ( ! wp_next_scheduled($hook_name)) { |
|
| 172 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | * Remove the currently-existing and now-removed cron tasks. |
| 180 | 180 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
| 181 | 181 | */ |
| 182 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
| 182 | + public static function remove_cron_tasks($remove_all = true) { |
|
| 183 | 183 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
| 184 | 184 | $crons = _get_cron_array(); |
| 185 | - $crons = is_array( $crons ) ? $crons : array(); |
|
| 185 | + $crons = is_array($crons) ? $crons : array(); |
|
| 186 | 186 | /* reminder that $crons looks like: top-level keys are timestamps, |
| 187 | 187 | * and their values are arrays. |
| 188 | 188 | * The 2nd level arrays have keys with each of the cron task hooknames to run at that time |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | * ... |
| 201 | 201 | * ... |
| 202 | 202 | */ |
| 203 | - foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) { |
|
| 204 | - foreach( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
| 205 | - if ( array_key_exists( $hook_name, $hooks_to_fire_at_time ) ) { |
|
| 206 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
| 203 | + foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) { |
|
| 204 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
| 205 | + if (array_key_exists($hook_name, $hooks_to_fire_at_time)) { |
|
| 206 | + unset($crons[$timestamp][$hook_name]); |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | - _set_cron_array( $crons ); |
|
| 210 | + _set_cron_array($crons); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public static function CPT_initialization() { |
| 224 | 224 | // register Custom Post Types |
| 225 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
| 225 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
| 226 | 226 | flush_rewrite_rules(); |
| 227 | 227 | } |
| 228 | 228 | |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | * @return void |
| 241 | 241 | */ |
| 242 | 242 | public static function reset_and_update_config() { |
| 243 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
| 244 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
| 243 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
| 244 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
| 245 | 245 | //EE_Config::reset(); |
| 246 | 246 | } |
| 247 | 247 | |
@@ -254,23 +254,23 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public static function load_calendar_config() { |
| 256 | 256 | // grab array of all plugin folders and loop thru it |
| 257 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
| 258 | - if ( empty( $plugins ) ) { |
|
| 257 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
| 258 | + if (empty($plugins)) { |
|
| 259 | 259 | return; |
| 260 | 260 | } |
| 261 | - foreach ( $plugins as $plugin_path ) { |
|
| 261 | + foreach ($plugins as $plugin_path) { |
|
| 262 | 262 | // grab plugin folder name from path |
| 263 | - $plugin = basename( $plugin_path ); |
|
| 263 | + $plugin = basename($plugin_path); |
|
| 264 | 264 | // drill down to Espresso plugins |
| 265 | - if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) { |
|
| 265 | + if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) { |
|
| 266 | 266 | // then to calendar related plugins |
| 267 | - if ( strpos( $plugin, 'calendar' ) !== FALSE ) { |
|
| 267 | + if (strpos($plugin, 'calendar') !== FALSE) { |
|
| 268 | 268 | // this is what we are looking for |
| 269 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
| 269 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
| 270 | 270 | // does it exist in this folder ? |
| 271 | - if ( is_readable( $calendar_config )) { |
|
| 271 | + if (is_readable($calendar_config)) { |
|
| 272 | 272 | // YEAH! let's load it |
| 273 | - require_once( $calendar_config ); |
|
| 273 | + require_once($calendar_config); |
|
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -287,21 +287,21 @@ discard block |
||
| 287 | 287 | * @param \EE_Config $EE_Config |
| 288 | 288 | * @return \stdClass |
| 289 | 289 | */ |
| 290 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
| 291 | - $convert_from_array = array( 'addons' ); |
|
| 290 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
| 291 | + $convert_from_array = array('addons'); |
|
| 292 | 292 | // in case old settings were saved as an array |
| 293 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
| 293 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
| 294 | 294 | // convert existing settings to an object |
| 295 | 295 | $config_array = $settings; |
| 296 | 296 | $settings = new stdClass(); |
| 297 | - foreach ( $config_array as $key => $value ){ |
|
| 298 | - if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
| 299 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
| 297 | + foreach ($config_array as $key => $value) { |
|
| 298 | + if ($key == 'calendar' && class_exists('EE_Calendar_Config')) { |
|
| 299 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
| 300 | 300 | } else { |
| 301 | 301 | $settings->$key = $value; |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
| 304 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
| 305 | 305 | } |
| 306 | 306 | return $settings; |
| 307 | 307 | } |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public static function deactivate_event_espresso() { |
| 319 | 319 | // check permissions |
| 320 | - if ( current_user_can( 'activate_plugins' )) { |
|
| 321 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
| 320 | + if (current_user_can('activate_plugins')) { |
|
| 321 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -340,79 +340,79 @@ discard block |
||
| 340 | 340 | $critical_pages = array( |
| 341 | 341 | array( |
| 342 | 342 | 'id' =>'reg_page_id', |
| 343 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
| 343 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
| 344 | 344 | 'post' => NULL, |
| 345 | 345 | 'code' => 'ESPRESSO_CHECKOUT' |
| 346 | 346 | ), |
| 347 | 347 | array( |
| 348 | 348 | 'id' => 'txn_page_id', |
| 349 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
| 349 | + 'name' => __('Transactions', 'event_espresso'), |
|
| 350 | 350 | 'post' => NULL, |
| 351 | 351 | 'code' => 'ESPRESSO_TXN_PAGE' |
| 352 | 352 | ), |
| 353 | 353 | array( |
| 354 | 354 | 'id' => 'thank_you_page_id', |
| 355 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
| 355 | + 'name' => __('Thank You', 'event_espresso'), |
|
| 356 | 356 | 'post' => NULL, |
| 357 | 357 | 'code' => 'ESPRESSO_THANK_YOU' |
| 358 | 358 | ), |
| 359 | 359 | array( |
| 360 | 360 | 'id' => 'cancel_page_id', |
| 361 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
| 361 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
| 362 | 362 | 'post' => NULL, |
| 363 | 363 | 'code' => 'ESPRESSO_CANCELLED' |
| 364 | 364 | ), |
| 365 | 365 | ); |
| 366 | 366 | |
| 367 | - foreach ( $critical_pages as $critical_page ) { |
|
| 367 | + foreach ($critical_pages as $critical_page) { |
|
| 368 | 368 | // is critical page ID set in config ? |
| 369 | - if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) { |
|
| 369 | + if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) { |
|
| 370 | 370 | // attempt to find post by ID |
| 371 | - $critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] ); |
|
| 371 | + $critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']); |
|
| 372 | 372 | } |
| 373 | 373 | // no dice? |
| 374 | - if ( $critical_page['post'] == NULL ) { |
|
| 374 | + if ($critical_page['post'] == NULL) { |
|
| 375 | 375 | // attempt to find post by title |
| 376 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
| 376 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
| 377 | 377 | // still nothing? |
| 378 | - if ( $critical_page['post'] == NULL ) { |
|
| 379 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
| 378 | + if ($critical_page['post'] == NULL) { |
|
| 379 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
| 380 | 380 | // REALLY? Still nothing ??!?!? |
| 381 | - if ( $critical_page['post'] == NULL ) { |
|
| 382 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
| 383 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 381 | + if ($critical_page['post'] == NULL) { |
|
| 382 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
| 383 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 384 | 384 | break; |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | // track post_shortcodes |
| 389 | - if ( $critical_page['post'] ) { |
|
| 390 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
| 389 | + if ($critical_page['post']) { |
|
| 390 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
| 391 | 391 | } |
| 392 | 392 | // check that Post ID matches critical page ID in config |
| 393 | - if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) { |
|
| 393 | + if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) { |
|
| 394 | 394 | //update Config with post ID |
| 395 | 395 | EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID; |
| 396 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
| 397 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
| 398 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 396 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
| 397 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
| 398 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - $critical_page_problem = ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem; |
|
| 402 | + $critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem; |
|
| 403 | 403 | |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if ( $critical_page_problem ) { |
|
| 406 | + if ($critical_page_problem) { |
|
| 407 | 407 | $msg = sprintf( |
| 408 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
| 409 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
| 408 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
| 409 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
| 410 | 410 | ); |
| 411 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
| 411 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - if ( EE_Error::has_notices() ) { |
|
| 415 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
| 414 | + if (EE_Error::has_notices()) { |
|
| 415 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | } |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | * parameter to the shortcode |
| 426 | 426 | * @return WP_Post or NULl |
| 427 | 427 | */ |
| 428 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
| 428 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
| 429 | 429 | global $wpdb; |
| 430 | 430 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
| 431 | 431 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
| 432 | - if($post_id){ |
|
| 432 | + if ($post_id) { |
|
| 433 | 433 | return get_post($post_id); |
| 434 | - }else{ |
|
| 434 | + } else { |
|
| 435 | 435 | return NULL; |
| 436 | 436 | } |
| 437 | 437 | |
@@ -448,32 +448,32 @@ discard block |
||
| 448 | 448 | * @param array $critical_page |
| 449 | 449 | * @return array |
| 450 | 450 | */ |
| 451 | - public static function create_critical_page( $critical_page ) { |
|
| 451 | + public static function create_critical_page($critical_page) { |
|
| 452 | 452 | |
| 453 | 453 | $post_args = array( |
| 454 | 454 | 'post_title' => $critical_page['name'], |
| 455 | 455 | 'post_status' => 'publish', |
| 456 | 456 | 'post_type' => 'page', |
| 457 | 457 | 'comment_status' => 'closed', |
| 458 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
| 458 | + 'post_content' => '['.$critical_page['code'].']' |
|
| 459 | 459 | ); |
| 460 | 460 | |
| 461 | - $post_id = wp_insert_post( $post_args ); |
|
| 462 | - if ( ! $post_id ) { |
|
| 461 | + $post_id = wp_insert_post($post_args); |
|
| 462 | + if ( ! $post_id) { |
|
| 463 | 463 | $msg = sprintf( |
| 464 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
| 464 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
| 465 | 465 | $critical_page['name'] |
| 466 | 466 | ); |
| 467 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 467 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 468 | 468 | return $critical_page; |
| 469 | 469 | } |
| 470 | 470 | // get newly created post's details |
| 471 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
| 471 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
| 472 | 472 | $msg = sprintf( |
| 473 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
| 473 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
| 474 | 474 | $critical_page['name'] |
| 475 | 475 | ); |
| 476 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 476 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | return $critical_page; |
@@ -492,34 +492,34 @@ discard block |
||
| 492 | 492 | * @param array $critical_page |
| 493 | 493 | * @return void |
| 494 | 494 | */ |
| 495 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
| 495 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
| 496 | 496 | // check the goods |
| 497 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
| 497 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
| 498 | 498 | $msg = sprintf( |
| 499 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
| 499 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
| 500 | 500 | $critical_page['name'] |
| 501 | 501 | ); |
| 502 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 502 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 503 | 503 | return; |
| 504 | 504 | } |
| 505 | 505 | // map shortcode to post |
| 506 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
| 506 | + EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
| 507 | 507 | // and make sure it's NOT added to the WP "Posts Page" |
| 508 | 508 | // name of the WP Posts Page |
| 509 | 509 | $posts_page = EE_Registry::instance()->CFG->get_page_for_posts(); |
| 510 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) { |
|
| 511 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
| 510 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) { |
|
| 511 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]); |
|
| 512 | 512 | } |
| 513 | - if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) { |
|
| 514 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
| 513 | + if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) { |
|
| 514 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]); |
|
| 515 | 515 | } |
| 516 | 516 | // update post_shortcode CFG |
| 517 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
| 517 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
| 518 | 518 | $msg = sprintf( |
| 519 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
| 519 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
| 520 | 520 | $critical_page['name'] |
| 521 | 521 | ); |
| 522 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 522 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | |
@@ -537,24 +537,24 @@ discard block |
||
| 537 | 537 | public static function get_default_creator_id() { |
| 538 | 538 | global $wpdb; |
| 539 | 539 | |
| 540 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
| 540 | + if ( ! empty(self::$_default_creator_id)) { |
|
| 541 | 541 | return self::$_default_creator_id; |
| 542 | 542 | }/**/ |
| 543 | 543 | |
| 544 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
| 544 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
| 545 | 545 | |
| 546 | 546 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
| 547 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
| 548 | - if ( $pre_filtered_id !== false ) { |
|
| 547 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
| 548 | + if ($pre_filtered_id !== false) { |
|
| 549 | 549 | return (int) $pre_filtered_id; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
| 553 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
| 554 | - $user_id = $wpdb->get_var( $query ); |
|
| 555 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
| 556 | - if ( $user_id && intval( $user_id ) ) { |
|
| 557 | - self::$_default_creator_id = intval( $user_id ); |
|
| 552 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
| 553 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
| 554 | + $user_id = $wpdb->get_var($query); |
|
| 555 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
| 556 | + if ($user_id && intval($user_id)) { |
|
| 557 | + self::$_default_creator_id = intval($user_id); |
|
| 558 | 558 | return self::$_default_creator_id; |
| 559 | 559 | } else { |
| 560 | 560 | return NULL; |
@@ -581,29 +581,29 @@ discard block |
||
| 581 | 581 | * @return void |
| 582 | 582 | * @throws EE_Error if there are database errors |
| 583 | 583 | */ |
| 584 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
| 585 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
| 584 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
| 585 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
| 586 | 586 | return; |
| 587 | 587 | } |
| 588 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 589 | - if ( ! function_exists( 'dbDelta' )) { |
|
| 590 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 588 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 589 | + if ( ! function_exists('dbDelta')) { |
|
| 590 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
| 591 | 591 | } |
| 592 | 592 | /** @var WPDB $wpdb */ |
| 593 | 593 | global $wpdb; |
| 594 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
| 594 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
| 595 | 595 | // do we need to first delete an existing version of this table ? |
| 596 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
| 596 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
| 597 | 597 | // ok, delete the table... but ONLY if it's empty |
| 598 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
| 598 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
| 599 | 599 | // table is NOT empty, are you SURE you want to delete this table ??? |
| 600 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
| 601 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
| 602 | - } else if ( ! $deleted_safely ) { |
|
| 600 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
| 601 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
| 602 | + } else if ( ! $deleted_safely) { |
|
| 603 | 603 | // so we should be more cautious rather than just dropping tables so easily |
| 604 | 604 | EE_Error::add_persistent_admin_notice( |
| 605 | - 'bad_table_' . $wp_table_name . '_detected', |
|
| 606 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
| 605 | + 'bad_table_'.$wp_table_name.'_detected', |
|
| 606 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
| 607 | 607 | $wp_table_name, |
| 608 | 608 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
| 609 | 609 | '<b>wp-config.php</b>', |
@@ -612,25 +612,25 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
| 615 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
| 615 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
| 616 | 616 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
| 617 | 617 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
| 618 | 618 | //happened. And then we can choose to tell the end user |
| 619 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
| 620 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
| 619 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
| 620 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
| 621 | 621 | ob_start(); |
| 622 | - dbDelta( $SQL ); |
|
| 622 | + dbDelta($SQL); |
|
| 623 | 623 | $output = ob_get_contents(); |
| 624 | 624 | ob_end_clean(); |
| 625 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
| 626 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
| 627 | - if( ! empty( $output ) ){ |
|
| 628 | - throw new EE_Error( $output ); |
|
| 625 | + $wpdb->show_errors($old_show_errors_policy); |
|
| 626 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
| 627 | + if ( ! empty($output)) { |
|
| 628 | + throw new EE_Error($output); |
|
| 629 | 629 | } |
| 630 | 630 | } else { |
| 631 | 631 | throw new EE_Error( |
| 632 | 632 | sprintf( |
| 633 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
| 633 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
| 634 | 634 | '<br />', |
| 635 | 635 | $sql |
| 636 | 636 | ) |
@@ -652,15 +652,15 @@ discard block |
||
| 652 | 652 | * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)' |
| 653 | 653 | * @return bool|int |
| 654 | 654 | */ |
| 655 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
| 656 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
| 655 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
| 656 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
| 657 | 657 | return FALSE; |
| 658 | 658 | } |
| 659 | 659 | global $wpdb; |
| 660 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
| 660 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
| 661 | 661 | $fields = self::get_fields_on_table($table_name); |
| 662 | - if (!in_array($column_name, $fields)){ |
|
| 663 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
| 662 | + if ( ! in_array($column_name, $fields)) { |
|
| 663 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
| 664 | 664 | //echo "alter query:$alter_query"; |
| 665 | 665 | return $wpdb->query($alter_query); |
| 666 | 666 | } |
@@ -679,15 +679,15 @@ discard block |
||
| 679 | 679 | * @param string $table_name, without prefixed $wpdb->prefix |
| 680 | 680 | * @return array of database column names |
| 681 | 681 | */ |
| 682 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
| 682 | + public static function get_fields_on_table($table_name = NULL) { |
|
| 683 | 683 | global $wpdb; |
| 684 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
| 685 | - if ( ! empty( $table_name )) { |
|
| 684 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
| 685 | + if ( ! empty($table_name)) { |
|
| 686 | 686 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
| 687 | 687 | if ($columns !== FALSE) { |
| 688 | 688 | $field_array = array(); |
| 689 | - foreach($columns as $column ){ |
|
| 690 | - $field_array[] = $column->Field;; |
|
| 689 | + foreach ($columns as $column) { |
|
| 690 | + $field_array[] = $column->Field; ; |
|
| 691 | 691 | } |
| 692 | 692 | return $field_array; |
| 693 | 693 | } |
@@ -705,12 +705,12 @@ discard block |
||
| 705 | 705 | * @param string $table_name |
| 706 | 706 | * @return bool |
| 707 | 707 | */ |
| 708 | - public static function db_table_is_empty( $table_name ) { |
|
| 708 | + public static function db_table_is_empty($table_name) { |
|
| 709 | 709 | global $wpdb; |
| 710 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
| 711 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
| 712 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
| 713 | - return absint( $count ) === 0 ? true : false; |
|
| 710 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
| 711 | + if (EEH_Activation::table_exists($table_name)) { |
|
| 712 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
| 713 | + return absint($count) === 0 ? true : false; |
|
| 714 | 714 | } |
| 715 | 715 | return false; |
| 716 | 716 | } |
@@ -725,9 +725,9 @@ discard block |
||
| 725 | 725 | * @param string $table_name |
| 726 | 726 | * @return bool | int |
| 727 | 727 | */ |
| 728 | - public static function delete_db_table_if_empty( $table_name ) { |
|
| 729 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
| 730 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
| 728 | + public static function delete_db_table_if_empty($table_name) { |
|
| 729 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
| 730 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
| 731 | 731 | } |
| 732 | 732 | return false; |
| 733 | 733 | } |
@@ -742,11 +742,11 @@ discard block |
||
| 742 | 742 | * @param string $table_name |
| 743 | 743 | * @return bool | int |
| 744 | 744 | */ |
| 745 | - public static function delete_unused_db_table( $table_name ) { |
|
| 745 | + public static function delete_unused_db_table($table_name) { |
|
| 746 | 746 | global $wpdb; |
| 747 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
| 748 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
| 749 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
| 747 | + if (EEH_Activation::table_exists($table_name)) { |
|
| 748 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
| 749 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
| 750 | 750 | } |
| 751 | 751 | return false; |
| 752 | 752 | } |
@@ -762,18 +762,18 @@ discard block |
||
| 762 | 762 | * @param string $index_name |
| 763 | 763 | * @return bool | int |
| 764 | 764 | */ |
| 765 | - public static function drop_index( $table_name, $index_name ) { |
|
| 766 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
| 765 | + public static function drop_index($table_name, $index_name) { |
|
| 766 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
| 767 | 767 | return FALSE; |
| 768 | 768 | } |
| 769 | 769 | global $wpdb; |
| 770 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
| 770 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
| 771 | 771 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
| 772 | 772 | if ( |
| 773 | - $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name |
|
| 774 | - && $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
| 773 | + $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name |
|
| 774 | + && $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
| 775 | 775 | ) { |
| 776 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
| 776 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
| 777 | 777 | } |
| 778 | 778 | return TRUE; |
| 779 | 779 | } |
@@ -789,27 +789,27 @@ discard block |
||
| 789 | 789 | * @return boolean success (whether database is setup properly or not) |
| 790 | 790 | */ |
| 791 | 791 | public static function create_database_tables() { |
| 792 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
| 792 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
| 793 | 793 | //find the migration script that sets the database to be compatible with the code |
| 794 | 794 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
| 795 | - if( $dms_name ){ |
|
| 796 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
| 797 | - $current_data_migration_script->set_migrating( false ); |
|
| 795 | + if ($dms_name) { |
|
| 796 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
| 797 | + $current_data_migration_script->set_migrating(false); |
|
| 798 | 798 | $current_data_migration_script->schema_changes_before_migration(); |
| 799 | 799 | $current_data_migration_script->schema_changes_after_migration(); |
| 800 | - if( $current_data_migration_script->get_errors() ){ |
|
| 801 | - if( WP_DEBUG ){ |
|
| 802 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
| 803 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 800 | + if ($current_data_migration_script->get_errors()) { |
|
| 801 | + if (WP_DEBUG) { |
|
| 802 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
| 803 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
| 804 | 804 | } |
| 805 | - }else{ |
|
| 806 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
| 805 | + } else { |
|
| 806 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
| 807 | 807 | } |
| 808 | 808 | return false; |
| 809 | 809 | } |
| 810 | 810 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
| 811 | - }else{ |
|
| 812 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
| 811 | + } else { |
|
| 812 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 813 | 813 | return false; |
| 814 | 814 | } |
| 815 | 815 | return true; |
@@ -829,27 +829,27 @@ discard block |
||
| 829 | 829 | public static function initialize_system_questions() { |
| 830 | 830 | // QUESTION GROUPS |
| 831 | 831 | global $wpdb; |
| 832 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' ); |
|
| 832 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group'); |
|
| 833 | 833 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
| 834 | 834 | // what we have |
| 835 | - $question_groups = $wpdb->get_col( $SQL ); |
|
| 835 | + $question_groups = $wpdb->get_col($SQL); |
|
| 836 | 836 | // check the response |
| 837 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
| 837 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
| 838 | 838 | // what we should have |
| 839 | - $QSG_systems = array( 1, 2 ); |
|
| 839 | + $QSG_systems = array(1, 2); |
|
| 840 | 840 | // loop thru what we should have and compare to what we have |
| 841 | - foreach ( $QSG_systems as $QSG_system ) { |
|
| 841 | + foreach ($QSG_systems as $QSG_system) { |
|
| 842 | 842 | // reset values array |
| 843 | 843 | $QSG_values = array(); |
| 844 | 844 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
| 845 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
| 845 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
| 846 | 846 | // add it |
| 847 | - switch ( $QSG_system ) { |
|
| 847 | + switch ($QSG_system) { |
|
| 848 | 848 | |
| 849 | 849 | case 1: |
| 850 | 850 | $QSG_values = array( |
| 851 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
| 852 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
| 851 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
| 852 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
| 853 | 853 | 'QSG_desc' => '', |
| 854 | 854 | 'QSG_order' => 1, |
| 855 | 855 | 'QSG_show_group_name' => 1, |
@@ -861,8 +861,8 @@ discard block |
||
| 861 | 861 | |
| 862 | 862 | case 2: |
| 863 | 863 | $QSG_values = array( |
| 864 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
| 865 | - 'QSG_identifier' => 'address-information-' . time(), |
|
| 864 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
| 865 | + 'QSG_identifier' => 'address-information-'.time(), |
|
| 866 | 866 | 'QSG_desc' => '', |
| 867 | 867 | 'QSG_order' => 2, |
| 868 | 868 | 'QSG_show_group_name' => 1, |
@@ -874,14 +874,14 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | } |
| 876 | 876 | // make sure we have some values before inserting them |
| 877 | - if ( ! empty( $QSG_values )) { |
|
| 877 | + if ( ! empty($QSG_values)) { |
|
| 878 | 878 | // insert system question |
| 879 | 879 | $wpdb->insert( |
| 880 | 880 | $table_name, |
| 881 | 881 | $QSG_values, |
| 882 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
| 882 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
| 883 | 883 | ); |
| 884 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
| 884 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | } |
@@ -890,10 +890,10 @@ discard block |
||
| 890 | 890 | |
| 891 | 891 | // QUESTIONS |
| 892 | 892 | global $wpdb; |
| 893 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' ); |
|
| 893 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question'); |
|
| 894 | 894 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
| 895 | 895 | // what we have |
| 896 | - $questions = $wpdb->get_col( $SQL ); |
|
| 896 | + $questions = $wpdb->get_col($SQL); |
|
| 897 | 897 | // what we should have |
| 898 | 898 | $QST_systems = array( |
| 899 | 899 | 'fname', |
@@ -910,25 +910,25 @@ discard block |
||
| 910 | 910 | $order_for_group_1 = 1; |
| 911 | 911 | $order_for_group_2 = 1; |
| 912 | 912 | // loop thru what we should have and compare to what we have |
| 913 | - foreach ( $QST_systems as $QST_system ) { |
|
| 913 | + foreach ($QST_systems as $QST_system) { |
|
| 914 | 914 | // reset values array |
| 915 | 915 | $QST_values = array(); |
| 916 | 916 | // if we don't have what we should have |
| 917 | - if ( ! in_array( $QST_system, $questions )) { |
|
| 917 | + if ( ! in_array($QST_system, $questions)) { |
|
| 918 | 918 | // add it |
| 919 | - switch ( $QST_system ) { |
|
| 919 | + switch ($QST_system) { |
|
| 920 | 920 | |
| 921 | 921 | case 'fname': |
| 922 | 922 | $QST_values = array( |
| 923 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
| 924 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
| 923 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
| 924 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
| 925 | 925 | 'QST_system' => 'fname', |
| 926 | 926 | 'QST_type' => 'TEXT', |
| 927 | 927 | 'QST_required' => 1, |
| 928 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 928 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 929 | 929 | 'QST_order' => 1, |
| 930 | 930 | 'QST_admin_only' => 0, |
| 931 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 931 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 932 | 932 | 'QST_wp_user' => self::get_default_creator_id(), |
| 933 | 933 | 'QST_deleted' => 0 |
| 934 | 934 | ); |
@@ -936,15 +936,15 @@ discard block |
||
| 936 | 936 | |
| 937 | 937 | case 'lname': |
| 938 | 938 | $QST_values = array( |
| 939 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
| 940 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
| 939 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
| 940 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
| 941 | 941 | 'QST_system' => 'lname', |
| 942 | 942 | 'QST_type' => 'TEXT', |
| 943 | 943 | 'QST_required' => 1, |
| 944 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 944 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 945 | 945 | 'QST_order' => 2, |
| 946 | 946 | 'QST_admin_only' => 0, |
| 947 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 947 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 948 | 948 | 'QST_wp_user' => self::get_default_creator_id(), |
| 949 | 949 | 'QST_deleted' => 0 |
| 950 | 950 | ); |
@@ -952,15 +952,15 @@ discard block |
||
| 952 | 952 | |
| 953 | 953 | case 'email': |
| 954 | 954 | $QST_values = array( |
| 955 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
| 956 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
| 955 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
| 956 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
| 957 | 957 | 'QST_system' => 'email', |
| 958 | 958 | 'QST_type' => 'TEXT', |
| 959 | 959 | 'QST_required' => 1, |
| 960 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 960 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 961 | 961 | 'QST_order' => 3, |
| 962 | 962 | 'QST_admin_only' => 0, |
| 963 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 963 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 964 | 964 | 'QST_wp_user' => self::get_default_creator_id(), |
| 965 | 965 | 'QST_deleted' => 0 |
| 966 | 966 | ); |
@@ -968,15 +968,15 @@ discard block |
||
| 968 | 968 | |
| 969 | 969 | case 'address': |
| 970 | 970 | $QST_values = array( |
| 971 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
| 972 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
| 971 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
| 972 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
| 973 | 973 | 'QST_system' => 'address', |
| 974 | 974 | 'QST_type' => 'TEXT', |
| 975 | 975 | 'QST_required' => 0, |
| 976 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 976 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 977 | 977 | 'QST_order' => 4, |
| 978 | 978 | 'QST_admin_only' => 0, |
| 979 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 979 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 980 | 980 | 'QST_wp_user' => self::get_default_creator_id(), |
| 981 | 981 | 'QST_deleted' => 0 |
| 982 | 982 | ); |
@@ -984,15 +984,15 @@ discard block |
||
| 984 | 984 | |
| 985 | 985 | case 'address2': |
| 986 | 986 | $QST_values = array( |
| 987 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
| 988 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
| 987 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
| 988 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
| 989 | 989 | 'QST_system' => 'address2', |
| 990 | 990 | 'QST_type' => 'TEXT', |
| 991 | 991 | 'QST_required' => 0, |
| 992 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 992 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 993 | 993 | 'QST_order' => 5, |
| 994 | 994 | 'QST_admin_only' => 0, |
| 995 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 995 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 996 | 996 | 'QST_wp_user' => self::get_default_creator_id(), |
| 997 | 997 | 'QST_deleted' => 0 |
| 998 | 998 | ); |
@@ -1000,15 +1000,15 @@ discard block |
||
| 1000 | 1000 | |
| 1001 | 1001 | case 'city': |
| 1002 | 1002 | $QST_values = array( |
| 1003 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
| 1004 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
| 1003 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
| 1004 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
| 1005 | 1005 | 'QST_system' => 'city', |
| 1006 | 1006 | 'QST_type' => 'TEXT', |
| 1007 | 1007 | 'QST_required' => 0, |
| 1008 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 1008 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 1009 | 1009 | 'QST_order' => 6, |
| 1010 | 1010 | 'QST_admin_only' => 0, |
| 1011 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 1011 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 1012 | 1012 | 'QST_wp_user' => self::get_default_creator_id(), |
| 1013 | 1013 | 'QST_deleted' => 0 |
| 1014 | 1014 | ); |
@@ -1016,12 +1016,12 @@ discard block |
||
| 1016 | 1016 | |
| 1017 | 1017 | case 'state': |
| 1018 | 1018 | $QST_values = array( |
| 1019 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
| 1020 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
| 1019 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
| 1020 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
| 1021 | 1021 | 'QST_system' => 'state', |
| 1022 | 1022 | 'QST_type' => 'STATE', |
| 1023 | 1023 | 'QST_required' => 0, |
| 1024 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 1024 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 1025 | 1025 | 'QST_order' => 7, |
| 1026 | 1026 | 'QST_admin_only' => 0, |
| 1027 | 1027 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1031,12 +1031,12 @@ discard block |
||
| 1031 | 1031 | |
| 1032 | 1032 | case 'country' : |
| 1033 | 1033 | $QST_values = array( |
| 1034 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
| 1035 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
| 1034 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
| 1035 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
| 1036 | 1036 | 'QST_system' => 'country', |
| 1037 | 1037 | 'QST_type' => 'COUNTRY', |
| 1038 | 1038 | 'QST_required' => 0, |
| 1039 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 1039 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 1040 | 1040 | 'QST_order' => 8, |
| 1041 | 1041 | 'QST_admin_only' => 0, |
| 1042 | 1042 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1046,15 +1046,15 @@ discard block |
||
| 1046 | 1046 | |
| 1047 | 1047 | case 'zip': |
| 1048 | 1048 | $QST_values = array( |
| 1049 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
| 1050 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
| 1049 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
| 1050 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
| 1051 | 1051 | 'QST_system' => 'zip', |
| 1052 | 1052 | 'QST_type' => 'TEXT', |
| 1053 | 1053 | 'QST_required' => 0, |
| 1054 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 1054 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 1055 | 1055 | 'QST_order' => 9, |
| 1056 | 1056 | 'QST_admin_only' => 0, |
| 1057 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 1057 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 1058 | 1058 | 'QST_wp_user' => self::get_default_creator_id(), |
| 1059 | 1059 | 'QST_deleted' => 0 |
| 1060 | 1060 | ); |
@@ -1062,49 +1062,49 @@ discard block |
||
| 1062 | 1062 | |
| 1063 | 1063 | case 'phone': |
| 1064 | 1064 | $QST_values = array( |
| 1065 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
| 1066 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
| 1065 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
| 1066 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
| 1067 | 1067 | 'QST_system' => 'phone', |
| 1068 | 1068 | 'QST_type' => 'TEXT', |
| 1069 | 1069 | 'QST_required' => 0, |
| 1070 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 1070 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 1071 | 1071 | 'QST_order' => 10, |
| 1072 | 1072 | 'QST_admin_only' => 0, |
| 1073 | - 'QST_max' => EEM_Question::instance()->max_max_for_system_question( $QST_system ), |
|
| 1073 | + 'QST_max' => EEM_Question::instance()->max_max_for_system_question($QST_system), |
|
| 1074 | 1074 | 'QST_wp_user' => self::get_default_creator_id(), |
| 1075 | 1075 | 'QST_deleted' => 0 |
| 1076 | 1076 | ); |
| 1077 | 1077 | break; |
| 1078 | 1078 | |
| 1079 | 1079 | } |
| 1080 | - if ( ! empty( $QST_values )) { |
|
| 1080 | + if ( ! empty($QST_values)) { |
|
| 1081 | 1081 | // insert system question |
| 1082 | 1082 | $wpdb->insert( |
| 1083 | 1083 | $table_name, |
| 1084 | 1084 | $QST_values, |
| 1085 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
| 1085 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
| 1086 | 1086 | ); |
| 1087 | 1087 | $QST_ID = $wpdb->insert_id; |
| 1088 | 1088 | |
| 1089 | 1089 | // QUESTION GROUP QUESTIONS |
| 1090 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
| 1090 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
| 1091 | 1091 | $system_question_we_want = EEM_Question_Group::system_personal; |
| 1092 | 1092 | } else { |
| 1093 | 1093 | $system_question_we_want = EEM_Question_Group::system_address; |
| 1094 | 1094 | } |
| 1095 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
| 1096 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
| 1095 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
| 1096 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
| 1097 | 1097 | } else { |
| 1098 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
| 1099 | - if( is_array( $id_col ) ) { |
|
| 1100 | - $QSG_ID = reset( $id_col ); |
|
| 1098 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
| 1099 | + if (is_array($id_col)) { |
|
| 1100 | + $QSG_ID = reset($id_col); |
|
| 1101 | 1101 | } else { |
| 1102 | 1102 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
| 1103 | 1103 | EE_Log::instance()->log( |
| 1104 | 1104 | __FILE__, |
| 1105 | 1105 | __FUNCTION__, |
| 1106 | 1106 | sprintf( |
| 1107 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
| 1107 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
| 1108 | 1108 | $QST_ID ), |
| 1109 | 1109 | 'error' ); |
| 1110 | 1110 | continue; |
@@ -1113,9 +1113,9 @@ discard block |
||
| 1113 | 1113 | |
| 1114 | 1114 | // add system questions to groups |
| 1115 | 1115 | $wpdb->insert( |
| 1116 | - EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
|
| 1117 | - array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ), |
|
| 1118 | - array( '%d', '%d','%d' ) |
|
| 1116 | + EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'), |
|
| 1117 | + array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++), |
|
| 1118 | + array('%d', '%d', '%d') |
|
| 1119 | 1119 | ); |
| 1120 | 1120 | } |
| 1121 | 1121 | } |
@@ -1127,11 +1127,11 @@ discard block |
||
| 1127 | 1127 | * Makes sure the default payment method (Invoice) is active. |
| 1128 | 1128 | * This used to be done automatically as part of constructing the old gateways config |
| 1129 | 1129 | */ |
| 1130 | - public static function insert_default_payment_methods(){ |
|
| 1131 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
| 1132 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
| 1133 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
| 1134 | - }else{ |
|
| 1130 | + public static function insert_default_payment_methods() { |
|
| 1131 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
| 1132 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 1133 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
| 1134 | + } else { |
|
| 1135 | 1135 | EEM_Payment_Method::instance()->verify_button_urls(); |
| 1136 | 1136 | } |
| 1137 | 1137 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | |
| 1148 | 1148 | global $wpdb; |
| 1149 | 1149 | |
| 1150 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
| 1150 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
| 1151 | 1151 | |
| 1152 | 1152 | $table_name = EEM_Status::instance()->table(); |
| 1153 | 1153 | |
@@ -1213,38 +1213,38 @@ discard block |
||
| 1213 | 1213 | * @return boolean success of verifying upload directories exist |
| 1214 | 1214 | */ |
| 1215 | 1215 | public static function create_upload_directories() { |
| 1216 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 1216 | + EE_Registry::instance()->load_helper('File'); |
|
| 1217 | 1217 | // Create the required folders |
| 1218 | 1218 | $folders = array( |
| 1219 | 1219 | EVENT_ESPRESSO_TEMPLATE_DIR, |
| 1220 | 1220 | EVENT_ESPRESSO_GATEWAY_DIR, |
| 1221 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
| 1222 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
| 1223 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
| 1221 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
| 1222 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
| 1223 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
| 1224 | 1224 | ); |
| 1225 | - foreach ( $folders as $folder ) { |
|
| 1225 | + foreach ($folders as $folder) { |
|
| 1226 | 1226 | try { |
| 1227 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
| 1228 | - @ chmod( $folder, 0755 ); |
|
| 1229 | - } catch( EE_Error $e ){ |
|
| 1227 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
| 1228 | + @ chmod($folder, 0755); |
|
| 1229 | + } catch (EE_Error $e) { |
|
| 1230 | 1230 | EE_Error::add_error( |
| 1231 | 1231 | sprintf( |
| 1232 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
| 1232 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
| 1233 | 1233 | $folder, |
| 1234 | - '<br />' . $e->getMessage() |
|
| 1234 | + '<br />'.$e->getMessage() |
|
| 1235 | 1235 | ), |
| 1236 | 1236 | __FILE__, __FUNCTION__, __LINE__ |
| 1237 | 1237 | ); |
| 1238 | 1238 | //indicate we'll need to fix this later |
| 1239 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
| 1239 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
| 1240 | 1240 | return FALSE; |
| 1241 | 1241 | } |
| 1242 | 1242 | } |
| 1243 | 1243 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
| 1244 | 1244 | //is disabled, there might be activation errors recorded in there |
| 1245 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
| 1245 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
| 1246 | 1246 | //remember EE's folders are all good |
| 1247 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
| 1247 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
| 1248 | 1248 | return TRUE; |
| 1249 | 1249 | } |
| 1250 | 1250 | |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | * @return boolean |
| 1258 | 1258 | */ |
| 1259 | 1259 | public static function upload_directories_incomplete() { |
| 1260 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
| 1260 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | 1263 | |
@@ -1276,16 +1276,16 @@ discard block |
||
| 1276 | 1276 | $installed_messengers = $default_messengers = array(); |
| 1277 | 1277 | |
| 1278 | 1278 | //include our helper |
| 1279 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
| 1279 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 1280 | 1280 | |
| 1281 | 1281 | //get all installed messenger objects |
| 1282 | 1282 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
| 1283 | 1283 | |
| 1284 | 1284 | //let's setup the $installed messengers in an array AND the messengers that are set to be activated on install. |
| 1285 | - foreach ( $installed['messengers'] as $msgr ) { |
|
| 1286 | - if ( $msgr instanceof EE_messenger ) { |
|
| 1285 | + foreach ($installed['messengers'] as $msgr) { |
|
| 1286 | + if ($msgr instanceof EE_messenger) { |
|
| 1287 | 1287 | $installed_messengers[$msgr->name] = $msgr; |
| 1288 | - if ( $msgr->activate_on_install ) { |
|
| 1288 | + if ($msgr->activate_on_install) { |
|
| 1289 | 1289 | $default_messengers[] = $msgr->name; |
| 1290 | 1290 | } |
| 1291 | 1291 | } |
@@ -1295,36 +1295,36 @@ discard block |
||
| 1295 | 1295 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
| 1296 | 1296 | |
| 1297 | 1297 | //things that have already been activated before |
| 1298 | - $has_activated = get_option( 'ee_has_activated_messenger' ); |
|
| 1298 | + $has_activated = get_option('ee_has_activated_messenger'); |
|
| 1299 | 1299 | |
| 1300 | 1300 | //do an initial loop to determine if we need to continue |
| 1301 | 1301 | $def_ms = array(); |
| 1302 | - foreach ( $default_messengers as $msgr ) { |
|
| 1303 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
| 1302 | + foreach ($default_messengers as $msgr) { |
|
| 1303 | + if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue; |
|
| 1304 | 1304 | $def_ms[] = $msgr; |
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | //setup the $installed_mts in an array |
| 1308 | - foreach ( $installed['message_types'] as $imt ) { |
|
| 1309 | - if ( $imt instanceof EE_message_type ) { |
|
| 1308 | + foreach ($installed['message_types'] as $imt) { |
|
| 1309 | + if ($imt instanceof EE_message_type) { |
|
| 1310 | 1310 | $installed_mts[$imt->name] = $imt; |
| 1311 | 1311 | } |
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | 1314 | //loop through default array for default messengers (if present) |
| 1315 | - if ( ! empty( $def_ms ) ) { |
|
| 1316 | - foreach ( $def_ms as $messenger ) { |
|
| 1315 | + if ( ! empty($def_ms)) { |
|
| 1316 | + foreach ($def_ms as $messenger) { |
|
| 1317 | 1317 | //all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger. |
| 1318 | - if ( ! isset( $installed_messengers[$messenger] )) { |
|
| 1318 | + if ( ! isset($installed_messengers[$messenger])) { |
|
| 1319 | 1319 | continue; |
| 1320 | 1320 | } |
| 1321 | 1321 | /** @var EE_messenger[] $installed_messengers */ |
| 1322 | 1322 | $default_mts = $installed_messengers[$messenger]->get_default_message_types(); |
| 1323 | 1323 | $active_messengers[$messenger]['obj'] = $installed_messengers[$messenger]; |
| 1324 | - foreach ( $default_mts as $index => $mt ) { |
|
| 1324 | + foreach ($default_mts as $index => $mt) { |
|
| 1325 | 1325 | //is there an installed_mt matching the default string? If not then nothing to do here. |
| 1326 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
| 1327 | - unset( $default_mts[$index] ); |
|
| 1326 | + if ( ! isset($installed_mts[$mt])) { |
|
| 1327 | + unset($default_mts[$index]); |
|
| 1328 | 1328 | continue; |
| 1329 | 1329 | } |
| 1330 | 1330 | |
@@ -1333,41 +1333,41 @@ discard block |
||
| 1333 | 1333 | /** @var EE_message_type[] $installed_mts */ |
| 1334 | 1334 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
| 1335 | 1335 | $settings = array(); |
| 1336 | - if ( is_array( $settings_fields ) ) { |
|
| 1337 | - foreach ( $settings_fields as $field => $values ) { |
|
| 1338 | - if ( isset( $values['default'] ) ) { |
|
| 1336 | + if (is_array($settings_fields)) { |
|
| 1337 | + foreach ($settings_fields as $field => $values) { |
|
| 1338 | + if (isset($values['default'])) { |
|
| 1339 | 1339 | $settings[$field] = $values['default']; |
| 1340 | 1340 | } |
| 1341 | 1341 | } |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
| 1344 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
| 1345 | 1345 | $has_activated[$messenger][] = $mt; |
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | //setup any initial settings for the messenger |
| 1349 | 1349 | $msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields(); |
| 1350 | 1350 | |
| 1351 | - if ( !empty( $msgr_settings ) ) { |
|
| 1352 | - foreach ( $msgr_settings as $field => $value ) { |
|
| 1351 | + if ( ! empty($msgr_settings)) { |
|
| 1352 | + foreach ($msgr_settings as $field => $value) { |
|
| 1353 | 1353 | $active_messengers[$messenger]['settings'][$field] = $value; |
| 1354 | 1354 | } |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | //now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate. |
| 1358 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
| 1358 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
| 1359 | 1359 | |
| 1360 | 1360 | //let's generate all the templates but only if the messenger has default_mts (otherwise its just activated). |
| 1361 | - if ( !empty( $default_mts ) ) { |
|
| 1362 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE ); |
|
| 1361 | + if ( ! empty($default_mts)) { |
|
| 1362 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE); |
|
| 1363 | 1363 | } |
| 1364 | 1364 | } |
| 1365 | 1365 | } //end check for empty( $def_ms ) |
| 1366 | 1366 | |
| 1367 | 1367 | //still need to see if there are any message types to activate for active messengers |
| 1368 | - foreach ( $active_messengers as $messenger => $settings ) { |
|
| 1368 | + foreach ($active_messengers as $messenger => $settings) { |
|
| 1369 | 1369 | $msg_obj = $settings['obj']; |
| 1370 | - if ( ! $msg_obj instanceof EE_messenger ) { |
|
| 1370 | + if ( ! $msg_obj instanceof EE_messenger) { |
|
| 1371 | 1371 | continue; |
| 1372 | 1372 | } |
| 1373 | 1373 | |
@@ -1375,45 +1375,45 @@ discard block |
||
| 1375 | 1375 | $new_default_mts = array(); |
| 1376 | 1376 | |
| 1377 | 1377 | //loop through each default mt reported by the messenger and make sure its set in its active db entry. |
| 1378 | - foreach( $all_default_mts as $index => $mt ) { |
|
| 1378 | + foreach ($all_default_mts as $index => $mt) { |
|
| 1379 | 1379 | //already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated). |
| 1380 | - if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) || EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) { |
|
| 1380 | + if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) { |
|
| 1381 | 1381 | continue; |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | //is there an installed_mt matching the default string? If not then nothing to do here. |
| 1385 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
| 1386 | - unset( $all_default_mts[$mt] ); |
|
| 1385 | + if ( ! isset($installed_mts[$mt])) { |
|
| 1386 | + unset($all_default_mts[$mt]); |
|
| 1387 | 1387 | continue; |
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
| 1391 | 1391 | $settings = array(); |
| 1392 | - if ( is_array( $settings_fields ) ) { |
|
| 1393 | - foreach ( $settings_fields as $field => $values ) { |
|
| 1394 | - if ( isset( $values['default'] ) ) { |
|
| 1392 | + if (is_array($settings_fields)) { |
|
| 1393 | + foreach ($settings_fields as $field => $values) { |
|
| 1394 | + if (isset($values['default'])) { |
|
| 1395 | 1395 | $settings[$field] = $values['default']; |
| 1396 | 1396 | } |
| 1397 | 1397 | } |
| 1398 | 1398 | } |
| 1399 | 1399 | |
| 1400 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
| 1400 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
| 1401 | 1401 | $new_default_mts[] = $mt; |
| 1402 | 1402 | $has_activated[$messenger][] = $mt; |
| 1403 | 1403 | } |
| 1404 | 1404 | |
| 1405 | 1405 | |
| 1406 | - if ( ! empty( $new_default_mts ) ) { |
|
| 1407 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE ); |
|
| 1406 | + if ( ! empty($new_default_mts)) { |
|
| 1407 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE); |
|
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | 1412 | //now let's save the settings for this messenger! |
| 1413 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
| 1413 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
| 1414 | 1414 | |
| 1415 | 1415 | //update $has_activated record |
| 1416 | - update_option( 'ee_has_activated_messenger', $has_activated ); |
|
| 1416 | + update_option('ee_has_activated_messenger', $has_activated); |
|
| 1417 | 1417 | |
| 1418 | 1418 | //that's it! |
| 1419 | 1419 | return $success; |
@@ -1433,47 +1433,47 @@ discard block |
||
| 1433 | 1433 | */ |
| 1434 | 1434 | public static function validate_messages_system() { |
| 1435 | 1435 | //include our helper |
| 1436 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
| 1436 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 1437 | 1437 | |
| 1438 | 1438 | //get active and installed messengers/message types. |
| 1439 | 1439 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
| 1440 | 1440 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
| 1441 | 1441 | $installed_messengers = $installed_mts = array(); |
| 1442 | 1442 | //set up the arrays so they can be handled easier. |
| 1443 | - foreach( $installed['messengers'] as $im ) { |
|
| 1444 | - if ( $im instanceof EE_messenger ) { |
|
| 1443 | + foreach ($installed['messengers'] as $im) { |
|
| 1444 | + if ($im instanceof EE_messenger) { |
|
| 1445 | 1445 | $installed_messengers[$im->name] = $im; |
| 1446 | 1446 | } |
| 1447 | 1447 | } |
| 1448 | - foreach( $installed['message_types'] as $imt ) { |
|
| 1449 | - if ( $imt instanceof EE_message_type ) { |
|
| 1448 | + foreach ($installed['message_types'] as $imt) { |
|
| 1449 | + if ($imt instanceof EE_message_type) { |
|
| 1450 | 1450 | $installed_mts[$imt->name] = $imt; |
| 1451 | 1451 | } |
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | //now let's loop through the active array and validate |
| 1455 | - foreach( $active_messengers as $messenger => $active_details ) { |
|
| 1455 | + foreach ($active_messengers as $messenger => $active_details) { |
|
| 1456 | 1456 | //first let's see if this messenger is installed. |
| 1457 | - if ( ! isset( $installed_messengers[$messenger] ) ) { |
|
| 1457 | + if ( ! isset($installed_messengers[$messenger])) { |
|
| 1458 | 1458 | //not set so let's just remove from actives and make sure templates are inactive. |
| 1459 | - unset( $active_messengers[$messenger] ); |
|
| 1460 | - EEH_MSG_Template::update_to_inactive( $messenger ); |
|
| 1459 | + unset($active_messengers[$messenger]); |
|
| 1460 | + EEH_MSG_Template::update_to_inactive($messenger); |
|
| 1461 | 1461 | continue; |
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | //messenger is active, so let's just make sure that any active message types not installed are deactivated. |
| 1465 | - $mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array(); |
|
| 1466 | - foreach ( $mts as $mt_name => $mt ) { |
|
| 1467 | - if ( ! isset( $installed_mts[$mt_name] ) ) { |
|
| 1468 | - unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] ); |
|
| 1469 | - EEH_MSG_Template::update_to_inactive( $messenger, $mt_name ); |
|
| 1465 | + $mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array(); |
|
| 1466 | + foreach ($mts as $mt_name => $mt) { |
|
| 1467 | + if ( ! isset($installed_mts[$mt_name])) { |
|
| 1468 | + unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]); |
|
| 1469 | + EEH_MSG_Template::update_to_inactive($messenger, $mt_name); |
|
| 1470 | 1470 | } |
| 1471 | 1471 | } |
| 1472 | 1472 | } |
| 1473 | 1473 | |
| 1474 | 1474 | //all done! let's update the active_messengers. |
| 1475 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
| 1476 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
| 1475 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
| 1476 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
| 1477 | 1477 | return; |
| 1478 | 1478 | } |
| 1479 | 1479 | |
@@ -1487,12 +1487,12 @@ discard block |
||
| 1487 | 1487 | * @static |
| 1488 | 1488 | * @return void |
| 1489 | 1489 | */ |
| 1490 | - public static function create_no_ticket_prices_array(){ |
|
| 1490 | + public static function create_no_ticket_prices_array() { |
|
| 1491 | 1491 | // this creates an array for tracking events that have no active ticket prices created |
| 1492 | 1492 | // this allows us to warn admins of the situation so that it can be corrected |
| 1493 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
| 1494 | - if ( ! $espresso_no_ticket_prices ) { |
|
| 1495 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
| 1493 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
| 1494 | + if ( ! $espresso_no_ticket_prices) { |
|
| 1495 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
| 1496 | 1496 | } |
| 1497 | 1497 | } |
| 1498 | 1498 | |
@@ -1514,24 +1514,24 @@ discard block |
||
| 1514 | 1514 | * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/ |
| 1515 | 1515 | * @global wpdb $wpdb |
| 1516 | 1516 | */ |
| 1517 | - public static function delete_all_espresso_cpt_data(){ |
|
| 1517 | + public static function delete_all_espresso_cpt_data() { |
|
| 1518 | 1518 | global $wpdb; |
| 1519 | 1519 | //get all the CPT post_types |
| 1520 | 1520 | $ee_post_types = array(); |
| 1521 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
| 1522 | - if ( method_exists( $model_name, 'instance' )) { |
|
| 1523 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
| 1524 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
| 1525 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
| 1521 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
| 1522 | + if (method_exists($model_name, 'instance')) { |
|
| 1523 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
| 1524 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
| 1525 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
| 1526 | 1526 | } |
| 1527 | 1527 | } |
| 1528 | 1528 | } |
| 1529 | 1529 | //get all our CPTs |
| 1530 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
| 1530 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
| 1531 | 1531 | $cpt_ids = $wpdb->get_col($query); |
| 1532 | 1532 | //delete each post meta and term relations too |
| 1533 | - foreach($cpt_ids as $post_id){ |
|
| 1534 | - wp_delete_post($post_id,true); |
|
| 1533 | + foreach ($cpt_ids as $post_id) { |
|
| 1534 | + wp_delete_post($post_id, true); |
|
| 1535 | 1535 | } |
| 1536 | 1536 | } |
| 1537 | 1537 | |
@@ -1545,18 +1545,18 @@ discard block |
||
| 1545 | 1545 | * @param bool $remove_all |
| 1546 | 1546 | * @return void |
| 1547 | 1547 | */ |
| 1548 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
| 1548 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
| 1549 | 1549 | global $wpdb; |
| 1550 | 1550 | $undeleted_tables = array(); |
| 1551 | 1551 | |
| 1552 | 1552 | // load registry |
| 1553 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
| 1554 | - if ( method_exists( $model_name, 'instance' )) { |
|
| 1555 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
| 1556 | - if ( $model_obj instanceof EEM_Base ) { |
|
| 1557 | - foreach ( $model_obj->get_tables() as $table ) { |
|
| 1558 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
| 1559 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
| 1553 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
| 1554 | + if (method_exists($model_name, 'instance')) { |
|
| 1555 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
| 1556 | + if ($model_obj instanceof EEM_Base) { |
|
| 1557 | + foreach ($model_obj->get_tables() as $table) { |
|
| 1558 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
| 1559 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
| 1560 | 1560 | case false : |
| 1561 | 1561 | $undeleted_tables[] = $table->get_table_name(); |
| 1562 | 1562 | break; |
@@ -1581,8 +1581,8 @@ discard block |
||
| 1581 | 1581 | 'esp_promotion_rule', |
| 1582 | 1582 | 'esp_rule' |
| 1583 | 1583 | ); |
| 1584 | - foreach( $tables_without_models as $table ){ |
|
| 1585 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
| 1584 | + foreach ($tables_without_models as $table) { |
|
| 1585 | + EEH_Activation::delete_db_table_if_empty($table); |
|
| 1586 | 1586 | } |
| 1587 | 1587 | |
| 1588 | 1588 | |
@@ -1619,58 +1619,58 @@ discard block |
||
| 1619 | 1619 | 'ee_pers_admin_notices' => true, |
| 1620 | 1620 | 'ee_upload_directories_incomplete' => true, |
| 1621 | 1621 | ); |
| 1622 | - if( is_main_site() ) { |
|
| 1623 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
| 1622 | + if (is_main_site()) { |
|
| 1623 | + $wp_options_to_delete['ee_network_config'] = true; |
|
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | $undeleted_options = array(); |
| 1627 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
| 1627 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
| 1628 | 1628 | |
| 1629 | - if( $no_wildcard ){ |
|
| 1630 | - if( ! delete_option( $option_name ) ){ |
|
| 1629 | + if ($no_wildcard) { |
|
| 1630 | + if ( ! delete_option($option_name)) { |
|
| 1631 | 1631 | $undeleted_options[] = $option_name; |
| 1632 | 1632 | } |
| 1633 | - }else{ |
|
| 1634 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
| 1635 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
| 1636 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
| 1633 | + } else { |
|
| 1634 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
| 1635 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
| 1636 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
| 1637 | 1637 | $undeleted_options[] = $option_name_from_wildcard; |
| 1638 | 1638 | } |
| 1639 | 1639 | } |
| 1640 | 1640 | } |
| 1641 | 1641 | } |
| 1642 | 1642 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
| 1643 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
| 1643 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
| 1644 | 1644 | |
| 1645 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
| 1645 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
| 1646 | 1646 | $db_update_sans_ee4 = array(); |
| 1647 | - foreach($espresso_db_update as $version => $times_activated){ |
|
| 1648 | - if( $version[0] =='3'){//if its NON EE4 |
|
| 1647 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
| 1648 | + if ($version[0] == '3') {//if its NON EE4 |
|
| 1649 | 1649 | $db_update_sans_ee4[$version] = $times_activated; |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
| 1652 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
| 1652 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | 1655 | $errors = ''; |
| 1656 | - if ( ! empty( $undeleted_tables )) { |
|
| 1656 | + if ( ! empty($undeleted_tables)) { |
|
| 1657 | 1657 | $errors .= sprintf( |
| 1658 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
| 1658 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
| 1659 | 1659 | '<br/>', |
| 1660 | - implode( ',<br/>', $undeleted_tables ) |
|
| 1660 | + implode(',<br/>', $undeleted_tables) |
|
| 1661 | 1661 | ); |
| 1662 | 1662 | } |
| 1663 | - if ( ! empty( $undeleted_options )) { |
|
| 1664 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
| 1663 | + if ( ! empty($undeleted_options)) { |
|
| 1664 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
| 1665 | 1665 | $errors .= sprintf( |
| 1666 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
| 1666 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
| 1667 | 1667 | '<br/>', |
| 1668 | - implode( ',<br/>', $undeleted_options ) |
|
| 1668 | + implode(',<br/>', $undeleted_options) |
|
| 1669 | 1669 | ); |
| 1670 | 1670 | |
| 1671 | 1671 | } |
| 1672 | - if ( $errors != '' ) { |
|
| 1673 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1672 | + if ($errors != '') { |
|
| 1673 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
| 1674 | 1674 | } |
| 1675 | 1675 | } |
| 1676 | 1676 | |
@@ -1680,23 +1680,23 @@ discard block |
||
| 1680 | 1680 | * @param string $table_name with or without $wpdb->prefix |
| 1681 | 1681 | * @return boolean |
| 1682 | 1682 | */ |
| 1683 | - public static function table_exists( $table_name ){ |
|
| 1683 | + public static function table_exists($table_name) { |
|
| 1684 | 1684 | global $wpdb, $EZSQL_ERROR; |
| 1685 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
| 1685 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
| 1686 | 1686 | //ignore if this causes an sql error |
| 1687 | 1687 | $old_error = $wpdb->last_error; |
| 1688 | 1688 | $old_suppress_errors = $wpdb->suppress_errors(); |
| 1689 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
| 1689 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
| 1690 | 1690 | $ezsql_error_cache = $EZSQL_ERROR; |
| 1691 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
| 1692 | - $wpdb->show_errors( $old_show_errors_value ); |
|
| 1693 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
| 1691 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
| 1692 | + $wpdb->show_errors($old_show_errors_value); |
|
| 1693 | + $wpdb->suppress_errors($old_suppress_errors); |
|
| 1694 | 1694 | $new_error = $wpdb->last_error; |
| 1695 | 1695 | $wpdb->last_error = $old_error; |
| 1696 | 1696 | $EZSQL_ERROR = $ezsql_error_cache; |
| 1697 | - if( empty( $new_error ) ){ |
|
| 1697 | + if (empty($new_error)) { |
|
| 1698 | 1698 | return TRUE; |
| 1699 | - }else{ |
|
| 1699 | + } else { |
|
| 1700 | 1700 | return FALSE; |
| 1701 | 1701 | } |
| 1702 | 1702 | } |
@@ -1704,7 +1704,7 @@ discard block |
||
| 1704 | 1704 | /** |
| 1705 | 1705 | * Resets the cache on EEH_Activation |
| 1706 | 1706 | */ |
| 1707 | - public static function reset(){ |
|
| 1707 | + public static function reset() { |
|
| 1708 | 1708 | self::$_default_creator_id = NULL; |
| 1709 | 1709 | self::$_initialized_db_content_already_in_this_request = false; |
| 1710 | 1710 | } |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | public $map_settings = null; |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * |
|
| 93 | - * @deprecated |
|
| 94 | - * @var EE_Gateway_Config |
|
| 95 | - */ |
|
| 92 | + * |
|
| 93 | + * @deprecated |
|
| 94 | + * @var EE_Gateway_Config |
|
| 95 | + */ |
|
| 96 | 96 | public $gateway = null; |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | |
| 583 | 583 | /** |
| 584 | 584 | * update_config |
| 585 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
| 585 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
| 586 | 586 | * |
| 587 | 587 | * @access public |
| 588 | 588 | * @param string $section |
@@ -1606,51 +1606,51 @@ discard block |
||
| 1606 | 1606 | class EE_Organization_Config extends EE_Config_Base { |
| 1607 | 1607 | |
| 1608 | 1608 | /** |
| 1609 | - * @var string $name |
|
| 1610 | - * eg EE4.1 |
|
| 1611 | - */ |
|
| 1609 | + * @var string $name |
|
| 1610 | + * eg EE4.1 |
|
| 1611 | + */ |
|
| 1612 | 1612 | public $name; |
| 1613 | 1613 | |
| 1614 | 1614 | /** |
| 1615 | - * @var string $address_1 |
|
| 1616 | - * eg 123 Onna Road |
|
| 1617 | - */ |
|
| 1615 | + * @var string $address_1 |
|
| 1616 | + * eg 123 Onna Road |
|
| 1617 | + */ |
|
| 1618 | 1618 | public $address_1; |
| 1619 | 1619 | |
| 1620 | 1620 | /** |
| 1621 | - * @var string $address_2 |
|
| 1622 | - * eg PO Box 123 |
|
| 1623 | - */ |
|
| 1621 | + * @var string $address_2 |
|
| 1622 | + * eg PO Box 123 |
|
| 1623 | + */ |
|
| 1624 | 1624 | public $address_2; |
| 1625 | 1625 | |
| 1626 | 1626 | /** |
| 1627 | - * @var string $city |
|
| 1628 | - * eg Inna City |
|
| 1629 | - */ |
|
| 1627 | + * @var string $city |
|
| 1628 | + * eg Inna City |
|
| 1629 | + */ |
|
| 1630 | 1630 | public $city; |
| 1631 | 1631 | |
| 1632 | 1632 | /** |
| 1633 | - * @var int $STA_ID |
|
| 1634 | - * eg 4 |
|
| 1635 | - */ |
|
| 1633 | + * @var int $STA_ID |
|
| 1634 | + * eg 4 |
|
| 1635 | + */ |
|
| 1636 | 1636 | public $STA_ID; |
| 1637 | 1637 | |
| 1638 | 1638 | /** |
| 1639 | - * @var string $CNT_ISO |
|
| 1640 | - * eg US |
|
| 1641 | - */ |
|
| 1639 | + * @var string $CNT_ISO |
|
| 1640 | + * eg US |
|
| 1641 | + */ |
|
| 1642 | 1642 | public $CNT_ISO; |
| 1643 | 1643 | |
| 1644 | 1644 | /** |
| 1645 | - * @var string $zip |
|
| 1646 | - * eg 12345 or V1A 2B3 |
|
| 1647 | - */ |
|
| 1645 | + * @var string $zip |
|
| 1646 | + * eg 12345 or V1A 2B3 |
|
| 1647 | + */ |
|
| 1648 | 1648 | public $zip; |
| 1649 | 1649 | |
| 1650 | 1650 | /** |
| 1651 | - * @var string $email |
|
| 1652 | - * eg [email protected] |
|
| 1653 | - */ |
|
| 1651 | + * @var string $email |
|
| 1652 | + * eg [email protected] |
|
| 1653 | + */ |
|
| 1654 | 1654 | public $email; |
| 1655 | 1655 | |
| 1656 | 1656 | |
@@ -1669,9 +1669,9 @@ discard block |
||
| 1669 | 1669 | public $vat; |
| 1670 | 1670 | |
| 1671 | 1671 | /** |
| 1672 | - * @var string $logo_url |
|
| 1673 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
| 1674 | - */ |
|
| 1672 | + * @var string $logo_url |
|
| 1673 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
| 1674 | + */ |
|
| 1675 | 1675 | public $logo_url; |
| 1676 | 1676 | |
| 1677 | 1677 | |
@@ -1765,55 +1765,55 @@ discard block |
||
| 1765 | 1765 | class EE_Currency_Config extends EE_Config_Base { |
| 1766 | 1766 | |
| 1767 | 1767 | /** |
| 1768 | - * @var string $code |
|
| 1769 | - * eg 'US' |
|
| 1770 | - */ |
|
| 1768 | + * @var string $code |
|
| 1769 | + * eg 'US' |
|
| 1770 | + */ |
|
| 1771 | 1771 | public $code; |
| 1772 | 1772 | |
| 1773 | 1773 | /** |
| 1774 | - * @var string $name |
|
| 1775 | - * eg 'Dollar' |
|
| 1776 | - */ |
|
| 1774 | + * @var string $name |
|
| 1775 | + * eg 'Dollar' |
|
| 1776 | + */ |
|
| 1777 | 1777 | public $name; |
| 1778 | 1778 | |
| 1779 | 1779 | /** |
| 1780 | - * plural name |
|
| 1781 | - * @var string $plural |
|
| 1782 | - * eg 'Dollars' |
|
| 1783 | - */ |
|
| 1780 | + * plural name |
|
| 1781 | + * @var string $plural |
|
| 1782 | + * eg 'Dollars' |
|
| 1783 | + */ |
|
| 1784 | 1784 | public $plural; |
| 1785 | 1785 | |
| 1786 | 1786 | /** |
| 1787 | - * currency sign |
|
| 1788 | - * @var string $sign |
|
| 1789 | - * eg '$' |
|
| 1790 | - */ |
|
| 1787 | + * currency sign |
|
| 1788 | + * @var string $sign |
|
| 1789 | + * eg '$' |
|
| 1790 | + */ |
|
| 1791 | 1791 | public $sign; |
| 1792 | 1792 | |
| 1793 | 1793 | /** |
| 1794 | - * Whether the currency sign should come before the number or not |
|
| 1795 | - * @var boolean $sign_b4 |
|
| 1796 | - */ |
|
| 1794 | + * Whether the currency sign should come before the number or not |
|
| 1795 | + * @var boolean $sign_b4 |
|
| 1796 | + */ |
|
| 1797 | 1797 | public $sign_b4; |
| 1798 | 1798 | |
| 1799 | 1799 | /** |
| 1800 | - * How many digits should come after the decimal place |
|
| 1801 | - * @var int $dec_plc |
|
| 1802 | - */ |
|
| 1800 | + * How many digits should come after the decimal place |
|
| 1801 | + * @var int $dec_plc |
|
| 1802 | + */ |
|
| 1803 | 1803 | public $dec_plc; |
| 1804 | 1804 | |
| 1805 | 1805 | /** |
| 1806 | - * Symbol to use for decimal mark |
|
| 1807 | - * @var string $dec_mrk |
|
| 1808 | - * eg '.' |
|
| 1809 | - */ |
|
| 1806 | + * Symbol to use for decimal mark |
|
| 1807 | + * @var string $dec_mrk |
|
| 1808 | + * eg '.' |
|
| 1809 | + */ |
|
| 1810 | 1810 | public $dec_mrk; |
| 1811 | 1811 | |
| 1812 | 1812 | /** |
| 1813 | - * Symbol to use for thousands |
|
| 1814 | - * @var string $thsnds |
|
| 1815 | - * eg ',' |
|
| 1816 | - */ |
|
| 1813 | + * Symbol to use for thousands |
|
| 1814 | + * @var string $thsnds |
|
| 1815 | + * eg ',' |
|
| 1816 | + */ |
|
| 1817 | 1817 | public $thsnds; |
| 1818 | 1818 | |
| 1819 | 1819 | |
@@ -1881,13 +1881,13 @@ discard block |
||
| 1881 | 1881 | * whether or not to show alternate payment options during the reg process if payment status is pending |
| 1882 | 1882 | * @var boolean $show_pending_payment_options |
| 1883 | 1883 | */ |
| 1884 | - public $show_pending_payment_options; |
|
| 1884 | + public $show_pending_payment_options; |
|
| 1885 | 1885 | |
| 1886 | 1886 | /** |
| 1887 | 1887 | * Whether to skip the registration confirmation page |
| 1888 | 1888 | * @var boolean $skip_reg_confirmation |
| 1889 | 1889 | */ |
| 1890 | - public $skip_reg_confirmation; |
|
| 1890 | + public $skip_reg_confirmation; |
|
| 1891 | 1891 | |
| 1892 | 1892 | /** |
| 1893 | 1893 | * an array of SPCO reg steps where: |
@@ -1898,64 +1898,64 @@ discard block |
||
| 1898 | 1898 | * "slug" => the URL param used to trigger the reg step |
| 1899 | 1899 | * @var array $reg_steps |
| 1900 | 1900 | */ |
| 1901 | - public $reg_steps; |
|
| 1901 | + public $reg_steps; |
|
| 1902 | 1902 | |
| 1903 | 1903 | /** |
| 1904 | 1904 | * Whether registration confirmation should be the last page of SPCO |
| 1905 | 1905 | * @var boolean $reg_confirmation_last |
| 1906 | 1906 | */ |
| 1907 | - public $reg_confirmation_last; |
|
| 1907 | + public $reg_confirmation_last; |
|
| 1908 | 1908 | |
| 1909 | 1909 | /** |
| 1910 | 1910 | * Whether or not to enable the EE Bot Trap |
| 1911 | 1911 | * @var boolean $use_bot_trap |
| 1912 | 1912 | */ |
| 1913 | - public $use_bot_trap; |
|
| 1913 | + public $use_bot_trap; |
|
| 1914 | 1914 | |
| 1915 | 1915 | /** |
| 1916 | 1916 | * Whether or not to encrypt some data sent by the EE Bot Trap |
| 1917 | 1917 | * @var boolean $use_encryption |
| 1918 | 1918 | */ |
| 1919 | - public $use_encryption; |
|
| 1919 | + public $use_encryption; |
|
| 1920 | 1920 | |
| 1921 | 1921 | /** |
| 1922 | 1922 | * Whether or not to use ReCaptcha |
| 1923 | 1923 | * @var boolean $use_captcha |
| 1924 | 1924 | */ |
| 1925 | - public $use_captcha; |
|
| 1925 | + public $use_captcha; |
|
| 1926 | 1926 | |
| 1927 | 1927 | /** |
| 1928 | 1928 | * ReCaptcha Theme |
| 1929 | 1929 | * @var string $recaptcha_theme |
| 1930 | 1930 | * options: 'dark ', 'light' |
| 1931 | 1931 | */ |
| 1932 | - public $recaptcha_theme; |
|
| 1932 | + public $recaptcha_theme; |
|
| 1933 | 1933 | |
| 1934 | 1934 | /** |
| 1935 | 1935 | * ReCaptcha Type |
| 1936 | 1936 | * @var string $recaptcha_type |
| 1937 | 1937 | * options: 'audio', 'image' |
| 1938 | 1938 | */ |
| 1939 | - public $recaptcha_type; |
|
| 1939 | + public $recaptcha_type; |
|
| 1940 | 1940 | |
| 1941 | 1941 | /** |
| 1942 | 1942 | * ReCaptcha language |
| 1943 | 1943 | * @var string $recaptcha_language |
| 1944 | 1944 | * eg 'en' |
| 1945 | 1945 | */ |
| 1946 | - public $recaptcha_language; |
|
| 1946 | + public $recaptcha_language; |
|
| 1947 | 1947 | |
| 1948 | 1948 | /** |
| 1949 | 1949 | * ReCaptcha public key |
| 1950 | 1950 | * @var string $recaptcha_publickey |
| 1951 | 1951 | */ |
| 1952 | - public $recaptcha_publickey; |
|
| 1952 | + public $recaptcha_publickey; |
|
| 1953 | 1953 | |
| 1954 | 1954 | /** |
| 1955 | 1955 | * ReCaptcha private key |
| 1956 | 1956 | * @var string $recaptcha_privatekey |
| 1957 | 1957 | */ |
| 1958 | - public $recaptcha_privatekey; |
|
| 1958 | + public $recaptcha_privatekey; |
|
| 1959 | 1959 | |
| 1960 | 1960 | /** |
| 1961 | 1961 | * ReCaptcha width |
@@ -2021,58 +2021,58 @@ discard block |
||
| 2021 | 2021 | class EE_Admin_Config extends EE_Config_Base { |
| 2022 | 2022 | |
| 2023 | 2023 | /** |
| 2024 | - * @var boolean $use_personnel_manager |
|
| 2025 | - */ |
|
| 2024 | + * @var boolean $use_personnel_manager |
|
| 2025 | + */ |
|
| 2026 | 2026 | public $use_personnel_manager; |
| 2027 | 2027 | |
| 2028 | 2028 | /** |
| 2029 | - * @var boolean $use_dashboard_widget |
|
| 2030 | - */ |
|
| 2029 | + * @var boolean $use_dashboard_widget |
|
| 2030 | + */ |
|
| 2031 | 2031 | public $use_dashboard_widget; |
| 2032 | 2032 | |
| 2033 | 2033 | /** |
| 2034 | - * @var int $events_in_dashboard |
|
| 2035 | - */ |
|
| 2034 | + * @var int $events_in_dashboard |
|
| 2035 | + */ |
|
| 2036 | 2036 | public $events_in_dashboard; |
| 2037 | 2037 | |
| 2038 | 2038 | /** |
| 2039 | - * @var boolean $use_event_timezones |
|
| 2040 | - */ |
|
| 2039 | + * @var boolean $use_event_timezones |
|
| 2040 | + */ |
|
| 2041 | 2041 | public $use_event_timezones; |
| 2042 | 2042 | |
| 2043 | 2043 | /** |
| 2044 | - * @var boolean $use_full_logging |
|
| 2045 | - */ |
|
| 2044 | + * @var boolean $use_full_logging |
|
| 2045 | + */ |
|
| 2046 | 2046 | public $use_full_logging; |
| 2047 | 2047 | |
| 2048 | 2048 | /** |
| 2049 | - * @var string $log_file_name |
|
| 2050 | - */ |
|
| 2049 | + * @var string $log_file_name |
|
| 2050 | + */ |
|
| 2051 | 2051 | public $log_file_name; |
| 2052 | 2052 | |
| 2053 | 2053 | /** |
| 2054 | - * @var string $debug_file_name |
|
| 2055 | - */ |
|
| 2054 | + * @var string $debug_file_name |
|
| 2055 | + */ |
|
| 2056 | 2056 | public $debug_file_name; |
| 2057 | 2057 | |
| 2058 | 2058 | /** |
| 2059 | - * @var boolean $use_remote_logging |
|
| 2060 | - */ |
|
| 2059 | + * @var boolean $use_remote_logging |
|
| 2060 | + */ |
|
| 2061 | 2061 | public $use_remote_logging; |
| 2062 | 2062 | |
| 2063 | 2063 | /** |
| 2064 | - * @var string $remote_logging_url |
|
| 2065 | - */ |
|
| 2064 | + * @var string $remote_logging_url |
|
| 2065 | + */ |
|
| 2066 | 2066 | public $remote_logging_url; |
| 2067 | 2067 | |
| 2068 | 2068 | /** |
| 2069 | - * @var boolean $show_reg_footer |
|
| 2070 | - */ |
|
| 2069 | + * @var boolean $show_reg_footer |
|
| 2070 | + */ |
|
| 2071 | 2071 | public $show_reg_footer; |
| 2072 | 2072 | |
| 2073 | 2073 | /** |
| 2074 | - * @var string $affiliate_id |
|
| 2075 | - */ |
|
| 2074 | + * @var string $affiliate_id |
|
| 2075 | + */ |
|
| 2076 | 2076 | public $affiliate_id; |
| 2077 | 2077 | |
| 2078 | 2078 | |
@@ -2146,43 +2146,43 @@ discard block |
||
| 2146 | 2146 | class EE_Template_Config extends EE_Config_Base { |
| 2147 | 2147 | |
| 2148 | 2148 | /** |
| 2149 | - * @var boolean $enable_default_style |
|
| 2150 | - */ |
|
| 2149 | + * @var boolean $enable_default_style |
|
| 2150 | + */ |
|
| 2151 | 2151 | public $enable_default_style; |
| 2152 | 2152 | |
| 2153 | 2153 | /** |
| 2154 | - * @var string $custom_style_sheet |
|
| 2155 | - */ |
|
| 2154 | + * @var string $custom_style_sheet |
|
| 2155 | + */ |
|
| 2156 | 2156 | public $custom_style_sheet; |
| 2157 | 2157 | |
| 2158 | 2158 | /** |
| 2159 | - * @var boolean $display_address_in_regform |
|
| 2160 | - */ |
|
| 2159 | + * @var boolean $display_address_in_regform |
|
| 2160 | + */ |
|
| 2161 | 2161 | public $display_address_in_regform; |
| 2162 | 2162 | |
| 2163 | 2163 | /** |
| 2164 | - * @var int $display_description_on_multi_reg_page |
|
| 2165 | - */ |
|
| 2164 | + * @var int $display_description_on_multi_reg_page |
|
| 2165 | + */ |
|
| 2166 | 2166 | public $display_description_on_multi_reg_page; |
| 2167 | 2167 | |
| 2168 | 2168 | /** |
| 2169 | - * @var boolean $use_custom_templates |
|
| 2170 | - */ |
|
| 2169 | + * @var boolean $use_custom_templates |
|
| 2170 | + */ |
|
| 2171 | 2171 | public $use_custom_templates; |
| 2172 | 2172 | |
| 2173 | 2173 | /** |
| 2174 | - * @var string $current_espresso_theme |
|
| 2175 | - */ |
|
| 2174 | + * @var string $current_espresso_theme |
|
| 2175 | + */ |
|
| 2176 | 2176 | public $current_espresso_theme; |
| 2177 | 2177 | |
| 2178 | 2178 | /** |
| 2179 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
| 2180 | - */ |
|
| 2179 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
| 2180 | + */ |
|
| 2181 | 2181 | public $EED_Event_Single; |
| 2182 | 2182 | |
| 2183 | 2183 | /** |
| 2184 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
| 2185 | - */ |
|
| 2184 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
| 2185 | + */ |
|
| 2186 | 2186 | public $EED_Events_Archive; |
| 2187 | 2187 | |
| 2188 | 2188 | |
@@ -2215,78 +2215,78 @@ discard block |
||
| 2215 | 2215 | class EE_Map_Config extends EE_Config_Base { |
| 2216 | 2216 | |
| 2217 | 2217 | /** |
| 2218 | - * @var boolean $use_google_maps |
|
| 2219 | - */ |
|
| 2218 | + * @var boolean $use_google_maps |
|
| 2219 | + */ |
|
| 2220 | 2220 | public $use_google_maps; |
| 2221 | 2221 | |
| 2222 | 2222 | /** |
| 2223 | - * @var int $event_details_map_width |
|
| 2224 | - */ |
|
| 2223 | + * @var int $event_details_map_width |
|
| 2224 | + */ |
|
| 2225 | 2225 | public $event_details_map_width; |
| 2226 | 2226 | |
| 2227 | 2227 | /** |
| 2228 | - * @var int $event_details_map_height |
|
| 2229 | - */ |
|
| 2228 | + * @var int $event_details_map_height |
|
| 2229 | + */ |
|
| 2230 | 2230 | public $event_details_map_height; |
| 2231 | 2231 | |
| 2232 | 2232 | /** |
| 2233 | - * @var int $event_details_map_zoom |
|
| 2234 | - */ |
|
| 2233 | + * @var int $event_details_map_zoom |
|
| 2234 | + */ |
|
| 2235 | 2235 | public $event_details_map_zoom; |
| 2236 | 2236 | |
| 2237 | 2237 | /** |
| 2238 | - * @var boolean $event_details_display_nav |
|
| 2239 | - */ |
|
| 2238 | + * @var boolean $event_details_display_nav |
|
| 2239 | + */ |
|
| 2240 | 2240 | public $event_details_display_nav; |
| 2241 | 2241 | |
| 2242 | 2242 | /** |
| 2243 | - * @var boolean $event_details_nav_size |
|
| 2244 | - */ |
|
| 2243 | + * @var boolean $event_details_nav_size |
|
| 2244 | + */ |
|
| 2245 | 2245 | public $event_details_nav_size; |
| 2246 | 2246 | |
| 2247 | 2247 | /** |
| 2248 | - * @var string $event_details_control_type |
|
| 2249 | - */ |
|
| 2248 | + * @var string $event_details_control_type |
|
| 2249 | + */ |
|
| 2250 | 2250 | public $event_details_control_type; |
| 2251 | 2251 | |
| 2252 | 2252 | /** |
| 2253 | - * @var string $event_details_map_align |
|
| 2254 | - */ |
|
| 2253 | + * @var string $event_details_map_align |
|
| 2254 | + */ |
|
| 2255 | 2255 | public $event_details_map_align; |
| 2256 | 2256 | |
| 2257 | 2257 | /** |
| 2258 | - * @var int $event_list_map_width |
|
| 2259 | - */ |
|
| 2258 | + * @var int $event_list_map_width |
|
| 2259 | + */ |
|
| 2260 | 2260 | public $event_list_map_width; |
| 2261 | 2261 | |
| 2262 | 2262 | /** |
| 2263 | - * @var int $event_list_map_height |
|
| 2264 | - */ |
|
| 2263 | + * @var int $event_list_map_height |
|
| 2264 | + */ |
|
| 2265 | 2265 | public $event_list_map_height; |
| 2266 | 2266 | |
| 2267 | 2267 | /** |
| 2268 | - * @var int $event_list_map_zoom |
|
| 2269 | - */ |
|
| 2268 | + * @var int $event_list_map_zoom |
|
| 2269 | + */ |
|
| 2270 | 2270 | public $event_list_map_zoom; |
| 2271 | 2271 | |
| 2272 | 2272 | /** |
| 2273 | - * @var boolean $event_list_display_nav |
|
| 2274 | - */ |
|
| 2273 | + * @var boolean $event_list_display_nav |
|
| 2274 | + */ |
|
| 2275 | 2275 | public $event_list_display_nav; |
| 2276 | 2276 | |
| 2277 | 2277 | /** |
| 2278 | - * @var boolean $event_list_nav_size |
|
| 2279 | - */ |
|
| 2278 | + * @var boolean $event_list_nav_size |
|
| 2279 | + */ |
|
| 2280 | 2280 | public $event_list_nav_size; |
| 2281 | 2281 | |
| 2282 | 2282 | /** |
| 2283 | - * @var string $event_list_control_type |
|
| 2284 | - */ |
|
| 2283 | + * @var string $event_list_control_type |
|
| 2284 | + */ |
|
| 2285 | 2285 | public $event_list_control_type; |
| 2286 | 2286 | |
| 2287 | 2287 | /** |
| 2288 | - * @var string $event_list_map_align |
|
| 2289 | - */ |
|
| 2288 | + * @var string $event_list_map_align |
|
| 2289 | + */ |
|
| 2290 | 2290 | public $event_list_map_align; |
| 2291 | 2291 | |
| 2292 | 2292 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public static function instance() { |
| 130 | 130 | // check if class object is instantiated, and instantiated properly |
| 131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
| 131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
| 132 | 132 | self::$_instance = new self(); |
| 133 | 133 | } |
| 134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
| 145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
| 146 | 146 | * @return EE_Config |
| 147 | 147 | */ |
| 148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
| 149 | - if ( $hard_reset ) { |
|
| 148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
| 149 | + if ($hard_reset) { |
|
| 150 | 150 | self::$_instance->_config_option_names = array(); |
| 151 | 151 | self::$_instance->_initialize_config(); |
| 152 | 152 | self::$_instance->update_espresso_config(); |
| 153 | 153 | } |
| 154 | - if( self::$_instance instanceof EE_Config ){ |
|
| 154 | + if (self::$_instance instanceof EE_Config) { |
|
| 155 | 155 | self::$_instance->shutdown(); |
| 156 | 156 | } |
| 157 | 157 | self::$_instance = NULL; |
| 158 | 158 | //we don't need to reset the static properties imo because those should |
| 159 | 159 | //only change when a module is added or removed. Currently we don't |
| 160 | 160 | //support removing a module during a request when it previously existed |
| 161 | - if( $reinstantiate ){ |
|
| 161 | + if ($reinstantiate) { |
|
| 162 | 162 | return self::instance(); |
| 163 | - }else{ |
|
| 163 | + } else { |
|
| 164 | 164 | return NULL; |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | * @return \EE_Config |
| 175 | 175 | */ |
| 176 | 176 | private function __construct() { |
| 177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
| 178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
| 177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
| 178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
| 179 | 179 | // setup empty config classes |
| 180 | 180 | $this->_initialize_config(); |
| 181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
| 183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
| 184 | 184 | $this->_verify_config(); |
| 185 | 185 | // register shortcodes and modules |
| 186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
| 186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
| 187 | 187 | // initialize shortcodes and modules |
| 188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
| 188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
| 189 | 189 | // register widgets |
| 190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
| 190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
| 191 | 191 | // shutdown |
| 192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
| 192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
| 193 | 193 | // construct__end hook |
| 194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
| 194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
| 195 | 195 | // hardcoded hack |
| 196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
| 197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return string current theme set. |
| 205 | 205 | */ |
| 206 | 206 | public static function get_current_theme() { |
| 207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | private function _load_core_config() { |
| 240 | 240 | // load_core_config__start hook |
| 241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
| 241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
| 242 | 242 | $espresso_config = $this->get_espresso_config(); |
| 243 | - foreach ( $espresso_config as $config => $settings ) { |
|
| 243 | + foreach ($espresso_config as $config => $settings) { |
|
| 244 | 244 | // load_core_config__start hook |
| 245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
| 246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
| 247 | - $this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
| 245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
| 246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
| 247 | + $this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
| 248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
| 249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
| 249 | + if (method_exists($settings, 'populate')) { |
|
| 250 | 250 | $this->$config->populate(); |
| 251 | 251 | } |
| 252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
| 252 | + if (method_exists($settings, 'do_hooks')) { |
|
| 253 | 253 | $this->$config->do_hooks(); |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
| 257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
| 258 | 258 | $this->update_espresso_config(); |
| 259 | 259 | } |
| 260 | 260 | // load_core_config__end hook |
| 261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
| 261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
| 272 | 272 | protected function _verify_config() { |
| 273 | 273 | |
| 274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
| 275 | - ? $this->core : new EE_Core_Config(); |
|
| 276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
| 275 | + ? $this->core : new EE_Core_Config(); |
|
| 276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
| 277 | 277 | |
| 278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
| 279 | - ? $this->organization : new EE_Organization_Config(); |
|
| 280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
| 279 | + ? $this->organization : new EE_Organization_Config(); |
|
| 280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
| 281 | 281 | |
| 282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
| 283 | 283 | ? $this->currency : new EE_Currency_Config(); |
| 284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
| 284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
| 285 | 285 | |
| 286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
| 287 | 287 | ? $this->registration : new EE_Registration_Config(); |
| 288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
| 288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
| 289 | 289 | |
| 290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
| 291 | 291 | ? $this->admin : new EE_Admin_Config(); |
| 292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
| 292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
| 293 | 293 | |
| 294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
| 295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
| 296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
| 296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
| 297 | 297 | |
| 298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
| 299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
| 300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
| 300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
| 301 | 301 | |
| 302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
| 303 | 303 | ? $this->environment : new EE_Environment_Config(); |
| 304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
| 304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
| 305 | 305 | |
| 306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
| 307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
| 308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
| 308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
| 309 | 309 | |
| 310 | 310 | } |
| 311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | */ |
| 320 | 320 | public function get_espresso_config() { |
| 321 | 321 | // grab espresso configuration |
| 322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
| 322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | * @param $old_value |
| 333 | 333 | * @param $value |
| 334 | 334 | */ |
| 335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
| 335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
| 336 | 336 | // make sure we're checking the ee config |
| 337 | - if ( $option == 'ee_config' ) { |
|
| 337 | + if ($option == 'ee_config') { |
|
| 338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
| 339 | 339 | // but NOT exact instance like WP update_option does |
| 340 | - if ( $value != $old_value ) { |
|
| 340 | + if ($value != $old_value) { |
|
| 341 | 341 | // if they are NOT the same, then remove the hook, |
| 342 | 342 | // which means the subsequent update results will be based solely on the update query results |
| 343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
| 353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
| 354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
| 355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
| 355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | protected function _reset_espresso_addon_config() { |
| 369 | 369 | $this->_config_option_names = array(); |
| 370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
| 371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
| 372 | - $config_class = get_class( $addon_config_obj ); |
|
| 373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
| 374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
| 370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
| 371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
| 372 | + $config_class = get_class($addon_config_obj); |
|
| 373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
| 374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
| 375 | 375 | } |
| 376 | 376 | $this->addons->$addon_name = NULL; |
| 377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
| 387 | 387 | * @param bool $add_error |
| 388 | 388 | * @return bool |
| 389 | 389 | */ |
| 390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
| 390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
| 391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
| 392 | 392 | //$clone = clone( self::$_instance ); |
| 393 | 393 | //self::$_instance = NULL; |
| 394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
| 394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
| 395 | 395 | $this->_reset_espresso_addon_config(); |
| 396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
| 397 | 397 | // but BEFORE the actual update occurs |
| 398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
| 398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
| 399 | 399 | // now update "ee_config" |
| 400 | - $saved = update_option( 'ee_config', $this ); |
|
| 400 | + $saved = update_option('ee_config', $this); |
|
| 401 | 401 | // if not saved... check if the hook we just added still exists; |
| 402 | 402 | // if it does, it means one of two things: |
| 403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
| 408 | 408 | // but just means no update occurred, so don't display an error to the user. |
| 409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
| 410 | 410 | // then it means that something truly went wrong |
| 411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
| 411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
| 412 | 412 | // remove our action since we don't want it in the system anymore |
| 413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
| 414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
| 413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
| 414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
| 415 | 415 | //self::$_instance = $clone; |
| 416 | 416 | //unset( $clone ); |
| 417 | 417 | // if config remains the same or was updated successfully |
| 418 | - if ( $saved ) { |
|
| 419 | - if ( $add_success ) { |
|
| 418 | + if ($saved) { |
|
| 419 | + if ($add_success) { |
|
| 420 | 420 | EE_Error::add_success( |
| 421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
| 421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
| 422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
| 423 | 423 | ); |
| 424 | 424 | } |
| 425 | 425 | return TRUE; |
| 426 | 426 | } else { |
| 427 | - if ( $add_error ) { |
|
| 427 | + if ($add_error) { |
|
| 428 | 428 | EE_Error::add_error( |
| 429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
| 429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
| 430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
| 431 | 431 | ); |
| 432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
| 452 | 452 | $name = '', |
| 453 | 453 | $config_class = '', |
| 454 | 454 | $config_obj = NULL, |
| 455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
| 455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
| 456 | 456 | $display_errors = TRUE |
| 457 | 457 | ) { |
| 458 | 458 | try { |
| 459 | - foreach ( $tests_to_run as $test ) { |
|
| 460 | - switch ( $test ) { |
|
| 459 | + foreach ($tests_to_run as $test) { |
|
| 460 | + switch ($test) { |
|
| 461 | 461 | |
| 462 | 462 | // TEST #1 : check that section was set |
| 463 | 463 | case 1 : |
| 464 | - if ( empty( $section ) ) { |
|
| 465 | - if ( $display_errors ) { |
|
| 464 | + if (empty($section)) { |
|
| 465 | + if ($display_errors) { |
|
| 466 | 466 | throw new EE_Error( |
| 467 | 467 | sprintf( |
| 468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
| 468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
| 469 | 469 | $config_class |
| 470 | 470 | ) |
| 471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | // TEST #2 : check that settings section exists |
| 478 | 478 | case 2 : |
| 479 | - if ( ! isset( $this->{$section} ) ) { |
|
| 480 | - if ( $display_errors ) { |
|
| 479 | + if ( ! isset($this->{$section} )) { |
|
| 480 | + if ($display_errors) { |
|
| 481 | 481 | throw new EE_Error( |
| 482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
| 483 | - $section ) |
|
| 482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
| 483 | + $section) |
|
| 484 | 484 | ); |
| 485 | 485 | } |
| 486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
| 490 | 490 | // TEST #3 : check that section is the proper format |
| 491 | 491 | case 3 : |
| 492 | 492 | if ( |
| 493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
| 493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
| 494 | 494 | ) { |
| 495 | - if ( $display_errors ) { |
|
| 495 | + if ($display_errors) { |
|
| 496 | 496 | throw new EE_Error( |
| 497 | 497 | sprintf( |
| 498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
| 498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
| 499 | 499 | $section |
| 500 | 500 | ) |
| 501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | // TEST #4 : check that config section name has been set |
| 508 | 508 | case 4 : |
| 509 | - if ( empty( $name ) ) { |
|
| 510 | - if ( $display_errors ) { |
|
| 509 | + if (empty($name)) { |
|
| 510 | + if ($display_errors) { |
|
| 511 | 511 | throw new EE_Error( |
| 512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
| 513 | 513 | ); |
| 514 | 514 | } |
| 515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | // TEST #5 : check that a config class name has been set |
| 520 | 520 | case 5 : |
| 521 | - if ( empty( $config_class ) ) { |
|
| 522 | - if ( $display_errors ) { |
|
| 521 | + if (empty($config_class)) { |
|
| 522 | + if ($display_errors) { |
|
| 523 | 523 | throw new EE_Error( |
| 524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
| 524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
| 525 | 525 | ); |
| 526 | 526 | } |
| 527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | // TEST #6 : verify config class is accessible |
| 532 | 532 | case 6 : |
| 533 | - if ( ! class_exists( $config_class ) ) { |
|
| 534 | - if ( $display_errors ) { |
|
| 533 | + if ( ! class_exists($config_class)) { |
|
| 534 | + if ($display_errors) { |
|
| 535 | 535 | throw new EE_Error( |
| 536 | 536 | sprintf( |
| 537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
| 537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
| 538 | 538 | $config_class |
| 539 | 539 | ) |
| 540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | // TEST #7 : check that config has even been set |
| 547 | 547 | case 7 : |
| 548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
| 549 | - if ( $display_errors ) { |
|
| 548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
| 549 | + if ($display_errors) { |
|
| 550 | 550 | throw new EE_Error( |
| 551 | 551 | sprintf( |
| 552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
| 552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
| 553 | 553 | $section, |
| 554 | 554 | $name |
| 555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
| 558 | 558 | return false; |
| 559 | 559 | } else { |
| 560 | 560 | // and make sure it's not serialized |
| 561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
| 561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
| 562 | 562 | } |
| 563 | 563 | break; |
| 564 | 564 | |
| 565 | 565 | // TEST #8 : check that config is the requested type |
| 566 | 566 | case 8 : |
| 567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
| 568 | - if ( $display_errors ) { |
|
| 567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
| 568 | + if ($display_errors) { |
|
| 569 | 569 | throw new EE_Error( |
| 570 | 570 | sprintf( |
| 571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
| 571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
| 572 | 572 | $section, |
| 573 | 573 | $name, |
| 574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | // TEST #9 : verify config object |
| 583 | 583 | case 9 : |
| 584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
| 585 | - if ( $display_errors ) { |
|
| 584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
| 585 | + if ($display_errors) { |
|
| 586 | 586 | throw new EE_Error( |
| 587 | 587 | sprintf( |
| 588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
| 589 | - print_r( $config_obj, true ) |
|
| 588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
| 589 | + print_r($config_obj, true) |
|
| 590 | 590 | ) |
| 591 | 591 | ); |
| 592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - } catch( EE_Error $e ) { |
|
| 600 | + } catch (EE_Error $e) { |
|
| 601 | 601 | $e->get_error(); |
| 602 | 602 | } |
| 603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
| 614 | 614 | * @param string $name |
| 615 | 615 | * @return string |
| 616 | 616 | */ |
| 617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
| 618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
| 617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
| 618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
| 629 | 629 | * @param string $name |
| 630 | 630 | * @return string |
| 631 | 631 | */ |
| 632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
| 633 | - return ! empty( $config_class ) |
|
| 632 | + private function _set_config_class($config_class = '', $name = '') { |
|
| 633 | + return ! empty($config_class) |
|
| 634 | 634 | ? $config_class |
| 635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
| 635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
| 646 | 646 | * @param EE_Config_Base $config_obj |
| 647 | 647 | * @return EE_Config_Base |
| 648 | 648 | */ |
| 649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
| 649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
| 650 | 650 | // ensure config class is set to something |
| 651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
| 653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
| 654 | 654 | return null; |
| 655 | 655 | } |
| 656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
| 658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
| 658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
| 660 | 660 | } |
| 661 | 661 | // verify the incoming config object but suppress errors |
| 662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
| 662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
| 663 | 663 | $config_obj = new $config_class(); |
| 664 | 664 | } |
| 665 | - if ( get_option( $config_option_name ) ) { |
|
| 666 | - update_option( $config_option_name, $config_obj ); |
|
| 665 | + if (get_option($config_option_name)) { |
|
| 666 | + update_option($config_option_name, $config_obj); |
|
| 667 | 667 | $this->{$section}->{$name} = $config_obj; |
| 668 | 668 | return $this->{$section}->{$name}; |
| 669 | 669 | } else { |
| 670 | 670 | // create a wp-option for this config |
| 671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
| 672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
| 671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
| 672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
| 673 | 673 | return $this->{$section}->{$name}; |
| 674 | 674 | } else { |
| 675 | 675 | EE_Error::add_error( |
| 676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
| 676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
| 677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
| 678 | 678 | ); |
| 679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
| 694 | 694 | * @param bool $throw_errors |
| 695 | 695 | * @return bool |
| 696 | 696 | */ |
| 697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
| 698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
| 697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
| 698 | + $config_obj = maybe_unserialize($config_obj); |
|
| 699 | 699 | // get class name of the incoming object |
| 700 | - $config_class = get_class( $config_obj ); |
|
| 700 | + $config_class = get_class($config_obj); |
|
| 701 | 701 | // run tests 1-5 and 9 to verify config |
| 702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
| 702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
| 703 | 703 | return false; |
| 704 | 704 | } |
| 705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
| 705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
| 706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
| 707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
| 707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
| 708 | 708 | // save new config to db |
| 709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
| 709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
| 710 | 710 | } else { |
| 711 | 711 | // first check if the record already exists |
| 712 | - $existing_config = get_option( $config_option_name ); |
|
| 713 | - $config_obj = serialize( $config_obj ); |
|
| 712 | + $existing_config = get_option($config_option_name); |
|
| 713 | + $config_obj = serialize($config_obj); |
|
| 714 | 714 | // just return if db record is already up to date |
| 715 | - if ( $existing_config == $config_obj ) { |
|
| 715 | + if ($existing_config == $config_obj) { |
|
| 716 | 716 | $this->{$section}->{$name} = $config_obj; |
| 717 | 717 | return true; |
| 718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
| 718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
| 719 | 719 | // update wp-option for this config class |
| 720 | 720 | $this->{$section}->{$name} = $config_obj; |
| 721 | 721 | return true; |
| 722 | - } elseif ( $throw_errors ) { |
|
| 722 | + } elseif ($throw_errors) { |
|
| 723 | 723 | EE_Error::add_error( |
| 724 | 724 | sprintf( |
| 725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
| 725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
| 726 | 726 | $config_class, |
| 727 | - 'EE_Config->' . $section . '->' . $name |
|
| 727 | + 'EE_Config->'.$section.'->'.$name |
|
| 728 | 728 | ), |
| 729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
| 730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
| 744 | 744 | * @param string $config_class |
| 745 | 745 | * @return mixed EE_Config_Base | NULL |
| 746 | 746 | */ |
| 747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
| 747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
| 748 | 748 | // ensure config class is set to something |
| 749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
| 749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
| 750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
| 751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
| 751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
| 752 | 752 | return NULL; |
| 753 | 753 | } |
| 754 | 754 | // now test if the requested config object exists, but suppress errors |
| 755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
| 755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
| 756 | 756 | // config already exists, so pass it back |
| 757 | 757 | return $this->{$section}->{$name}; |
| 758 | 758 | } |
| 759 | 759 | // load config option from db if it exists |
| 760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
| 760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
| 761 | 761 | // verify the newly retrieved config object, but suppress errors |
| 762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
| 762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
| 763 | 763 | // config is good, so set it and pass it back |
| 764 | 764 | $this->{$section}->{$name} = $config_obj; |
| 765 | 765 | return $this->{$section}->{$name}; |
| 766 | 766 | } |
| 767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
| 768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
| 768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
| 769 | 769 | // verify the newly created config object |
| 770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
| 770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
| 771 | 771 | return $this->{$section}->{$name}; |
| 772 | 772 | } else { |
| 773 | 773 | EE_Error::add_error( |
| 774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
| 774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
| 775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
| 776 | 776 | ); |
| 777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
| 786 | 786 | * @param string $config_option_name |
| 787 | 787 | * @return mixed EE_Config_Base | FALSE |
| 788 | 788 | */ |
| 789 | - public function get_config_option( $config_option_name = '' ) { |
|
| 789 | + public function get_config_option($config_option_name = '') { |
|
| 790 | 790 | // retrieve the wp-option for this config class. |
| 791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
| 791 | + return maybe_unserialize(get_option($config_option_name)); |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
| 801 | 801 | * @param $page_for_posts |
| 802 | 802 | * @return void |
| 803 | 803 | */ |
| 804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
| 804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
| 805 | 805 | // make sure page_for_posts is set |
| 806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
| 806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
| 807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
| 808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
| 809 | 809 | // allow others to mess stuff up :D |
| 810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
| 810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
| 811 | 811 | // verify that post_shortcodes is set |
| 812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
| 812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
| 813 | 813 | // cycle thru post_shortcodes |
| 814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
| 814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
| 815 | 815 | // are there any shortcodes to track ? |
| 816 | - if ( ! empty( $shortcodes )) { |
|
| 816 | + if ( ! empty($shortcodes)) { |
|
| 817 | 817 | // loop thru list of tracked shortcodes |
| 818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
| 818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
| 819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
| 820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
| 820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
| 821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
| 822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
| 822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
| 823 | 823 | } |
| 824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
| 825 | - if ( $post_name == $page_for_posts ) { |
|
| 825 | + if ($post_name == $page_for_posts) { |
|
| 826 | 826 | continue; |
| 827 | 827 | } |
| 828 | 828 | // make sure post still exists |
| 829 | - $post = get_post( $post_id ); |
|
| 830 | - if ( $post ) { |
|
| 829 | + $post = get_post($post_id); |
|
| 830 | + if ($post) { |
|
| 831 | 831 | // check that the post name matches what we have saved |
| 832 | - if ( $post->post_name == $post_name ) { |
|
| 832 | + if ($post->post_name == $post_name) { |
|
| 833 | 833 | // if so, then break before hitting the unset below |
| 834 | 834 | continue; |
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | 837 | // we don't like missing posts around here >:( |
| 838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
| 838 | + unset($this->core->post_shortcodes[$post_name]); |
|
| 839 | 839 | } |
| 840 | 840 | } else { |
| 841 | 841 | // you got no shortcodes to keep track of ! |
| 842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
| 842 | + unset($this->core->post_shortcodes[$post_name]); |
|
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
| 858 | 858 | * @return string |
| 859 | 859 | */ |
| 860 | 860 | public static function get_page_for_posts() { |
| 861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
| 862 | - if ( ! $page_for_posts ) { |
|
| 861 | + $page_for_posts = get_option('page_for_posts'); |
|
| 862 | + if ( ! $page_for_posts) { |
|
| 863 | 863 | return 'posts'; |
| 864 | 864 | } |
| 865 | 865 | /** @type WPDB $wpdb */ |
| 866 | 866 | global $wpdb; |
| 867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
| 868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
| 868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | |
@@ -881,11 +881,11 @@ discard block |
||
| 881 | 881 | * @return void |
| 882 | 882 | */ |
| 883 | 883 | public function register_shortcodes_and_modules() { |
| 884 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
| 884 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
| 885 | 885 | return; |
| 886 | 886 | } |
| 887 | 887 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
| 888 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
| 888 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
| 889 | 889 | // allow modules to set hooks for the rest of the system |
| 890 | 890 | EE_Registry::instance()->modules = $this->_register_modules(); |
| 891 | 891 | } |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | * @return void |
| 900 | 900 | */ |
| 901 | 901 | public function initialize_shortcodes_and_modules() { |
| 902 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
| 902 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
| 903 | 903 | return; |
| 904 | 904 | } |
| 905 | 905 | // allow shortcodes to set hooks for the rest of the system |
@@ -918,26 +918,26 @@ discard block |
||
| 918 | 918 | * @return void |
| 919 | 919 | */ |
| 920 | 920 | public function widgets_init() { |
| 921 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
| 921 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
| 922 | 922 | return; |
| 923 | 923 | } |
| 924 | 924 | //only init widgets on admin pages when not in complete maintenance, and |
| 925 | 925 | //on frontend when not in any maintenance mode |
| 926 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
| 926 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
| 927 | 927 | // grab list of installed widgets |
| 928 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
| 928 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
| 929 | 929 | // filter list of modules to register |
| 930 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
| 930 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
| 931 | 931 | |
| 932 | - if ( ! empty( $widgets_to_register ) ) { |
|
| 932 | + if ( ! empty($widgets_to_register)) { |
|
| 933 | 933 | // cycle thru widget folders |
| 934 | - foreach ( $widgets_to_register as $widget_path ) { |
|
| 934 | + foreach ($widgets_to_register as $widget_path) { |
|
| 935 | 935 | // add to list of installed widget modules |
| 936 | - EE_Config::register_ee_widget( $widget_path ); |
|
| 936 | + EE_Config::register_ee_widget($widget_path); |
|
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | 939 | // filter list of installed modules |
| 940 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
| 940 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
| 941 | 941 | } |
| 942 | 942 | } |
| 943 | 943 | |
@@ -950,54 +950,54 @@ discard block |
||
| 950 | 950 | * @param string $widget_path - full path up to and including widget folder |
| 951 | 951 | * @return void |
| 952 | 952 | */ |
| 953 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
| 954 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
| 953 | + public static function register_ee_widget($widget_path = NULL) { |
|
| 954 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
| 955 | 955 | $widget_ext = '.widget.php'; |
| 956 | 956 | // make all separators match |
| 957 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
| 957 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
| 958 | 958 | // does the file path INCLUDE the actual file name as part of the path ? |
| 959 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
| 959 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
| 960 | 960 | // grab and shortcode file name from directory name and break apart at dots |
| 961 | - $file_name = explode( '.', basename( $widget_path )); |
|
| 961 | + $file_name = explode('.', basename($widget_path)); |
|
| 962 | 962 | // take first segment from file name pieces and remove class prefix if it exists |
| 963 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
| 963 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
| 964 | 964 | // sanitize shortcode directory name |
| 965 | - $widget = sanitize_key( $widget ); |
|
| 965 | + $widget = sanitize_key($widget); |
|
| 966 | 966 | // now we need to rebuild the shortcode path |
| 967 | - $widget_path = explode( DS, $widget_path ); |
|
| 967 | + $widget_path = explode(DS, $widget_path); |
|
| 968 | 968 | // remove last segment |
| 969 | - array_pop( $widget_path ); |
|
| 969 | + array_pop($widget_path); |
|
| 970 | 970 | // glue it back together |
| 971 | - $widget_path = implode( DS, $widget_path ); |
|
| 971 | + $widget_path = implode(DS, $widget_path); |
|
| 972 | 972 | } else { |
| 973 | 973 | // grab and sanitize widget directory name |
| 974 | - $widget = sanitize_key( basename( $widget_path )); |
|
| 974 | + $widget = sanitize_key(basename($widget_path)); |
|
| 975 | 975 | } |
| 976 | 976 | // create classname from widget directory name |
| 977 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
| 977 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
| 978 | 978 | // add class prefix |
| 979 | - $widget_class = 'EEW_' . $widget; |
|
| 979 | + $widget_class = 'EEW_'.$widget; |
|
| 980 | 980 | // does the widget exist ? |
| 981 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
| 981 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
| 982 | 982 | $msg = sprintf( |
| 983 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
| 983 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
| 984 | 984 | $widget_class, |
| 985 | - $widget_path . DS . $widget_class . $widget_ext |
|
| 985 | + $widget_path.DS.$widget_class.$widget_ext |
|
| 986 | 986 | ); |
| 987 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 987 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 988 | 988 | return; |
| 989 | 989 | } |
| 990 | 990 | // load the widget class file |
| 991 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
| 991 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
| 992 | 992 | // verify that class exists |
| 993 | - if ( ! class_exists( $widget_class )) { |
|
| 994 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
| 995 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 993 | + if ( ! class_exists($widget_class)) { |
|
| 994 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
| 995 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 996 | 996 | return; |
| 997 | 997 | } |
| 998 | - register_widget( $widget_class ); |
|
| 998 | + register_widget($widget_class); |
|
| 999 | 999 | // add to array of registered widgets |
| 1000 | - EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext; |
|
| 1000 | + EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext; |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | |
@@ -1010,18 +1010,18 @@ discard block |
||
| 1010 | 1010 | */ |
| 1011 | 1011 | private function _register_shortcodes() { |
| 1012 | 1012 | // grab list of installed shortcodes |
| 1013 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
| 1013 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
| 1014 | 1014 | // filter list of modules to register |
| 1015 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
| 1016 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
| 1015 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
| 1016 | + if ( ! empty($shortcodes_to_register)) { |
|
| 1017 | 1017 | // cycle thru shortcode folders |
| 1018 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
| 1018 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
| 1019 | 1019 | // add to list of installed shortcode modules |
| 1020 | - EE_Config::register_shortcode( $shortcode_path ); |
|
| 1020 | + EE_Config::register_shortcode($shortcode_path); |
|
| 1021 | 1021 | } |
| 1022 | 1022 | } |
| 1023 | 1023 | // filter list of installed modules |
| 1024 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
| 1024 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | 1027 | |
@@ -1033,56 +1033,56 @@ discard block |
||
| 1033 | 1033 | * @param string $shortcode_path - full path up to and including shortcode folder |
| 1034 | 1034 | * @return bool |
| 1035 | 1035 | */ |
| 1036 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
| 1037 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
| 1036 | + public static function register_shortcode($shortcode_path = NULL) { |
|
| 1037 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
| 1038 | 1038 | $shortcode_ext = '.shortcode.php'; |
| 1039 | 1039 | // make all separators match |
| 1040 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
| 1040 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
| 1041 | 1041 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1042 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
| 1042 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
| 1043 | 1043 | // grab shortcode file name from directory name and break apart at dots |
| 1044 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
| 1044 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
| 1045 | 1045 | // take first segment from file name pieces and remove class prefix if it exists |
| 1046 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
| 1046 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
| 1047 | 1047 | // sanitize shortcode directory name |
| 1048 | - $shortcode = sanitize_key( $shortcode ); |
|
| 1048 | + $shortcode = sanitize_key($shortcode); |
|
| 1049 | 1049 | // now we need to rebuild the shortcode path |
| 1050 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
| 1050 | + $shortcode_path = explode(DS, $shortcode_path); |
|
| 1051 | 1051 | // remove last segment |
| 1052 | - array_pop( $shortcode_path ); |
|
| 1052 | + array_pop($shortcode_path); |
|
| 1053 | 1053 | // glue it back together |
| 1054 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
| 1054 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
| 1055 | 1055 | } else { |
| 1056 | 1056 | // we need to generate the filename based off of the folder name |
| 1057 | 1057 | // grab and sanitize shortcode directory name |
| 1058 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
| 1059 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
| 1058 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
| 1059 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
| 1060 | 1060 | } |
| 1061 | 1061 | // create classname from shortcode directory or file name |
| 1062 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
| 1062 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
| 1063 | 1063 | // add class prefix |
| 1064 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1064 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1065 | 1065 | // does the shortcode exist ? |
| 1066 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
| 1066 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
| 1067 | 1067 | $msg = sprintf( |
| 1068 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
| 1068 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
| 1069 | 1069 | $shortcode_class, |
| 1070 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
| 1070 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
| 1071 | 1071 | ); |
| 1072 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1072 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1073 | 1073 | return FALSE; |
| 1074 | 1074 | } |
| 1075 | 1075 | // load the shortcode class file |
| 1076 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
| 1076 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
| 1077 | 1077 | // verify that class exists |
| 1078 | - if ( ! class_exists( $shortcode_class )) { |
|
| 1079 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
| 1080 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1078 | + if ( ! class_exists($shortcode_class)) { |
|
| 1079 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
| 1080 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1081 | 1081 | return FALSE; |
| 1082 | 1082 | } |
| 1083 | - $shortcode = strtoupper( $shortcode ); |
|
| 1083 | + $shortcode = strtoupper($shortcode); |
|
| 1084 | 1084 | // add to array of registered shortcodes |
| 1085 | - EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
| 1085 | + EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
| 1086 | 1086 | return TRUE; |
| 1087 | 1087 | } |
| 1088 | 1088 | |
@@ -1097,23 +1097,23 @@ discard block |
||
| 1097 | 1097 | */ |
| 1098 | 1098 | private function _register_modules() { |
| 1099 | 1099 | // grab list of installed modules |
| 1100 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
| 1100 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
| 1101 | 1101 | // filter list of modules to register |
| 1102 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
| 1102 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
| 1103 | 1103 | |
| 1104 | 1104 | |
| 1105 | - if ( ! empty( $modules_to_register ) ) { |
|
| 1105 | + if ( ! empty($modules_to_register)) { |
|
| 1106 | 1106 | // loop through folders |
| 1107 | - foreach ( $modules_to_register as $module_path ) { |
|
| 1107 | + foreach ($modules_to_register as $module_path) { |
|
| 1108 | 1108 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
| 1109 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
| 1109 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
| 1110 | 1110 | // add to list of installed modules |
| 1111 | - EE_Config::register_module( $module_path ); |
|
| 1111 | + EE_Config::register_module($module_path); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | // filter list of installed modules |
| 1116 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
| 1116 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | |
@@ -1126,54 +1126,54 @@ discard block |
||
| 1126 | 1126 | * @param string $module_path - full path up to and including module folder |
| 1127 | 1127 | * @return bool |
| 1128 | 1128 | */ |
| 1129 | - public static function register_module( $module_path = NULL ) { |
|
| 1130 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
| 1129 | + public static function register_module($module_path = NULL) { |
|
| 1130 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
| 1131 | 1131 | $module_ext = '.module.php'; |
| 1132 | 1132 | // make all separators match |
| 1133 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
| 1133 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
| 1134 | 1134 | // does the file path INCLUDE the actual file name as part of the path ? |
| 1135 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
| 1135 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
| 1136 | 1136 | // grab and shortcode file name from directory name and break apart at dots |
| 1137 | - $module_file = explode( '.', basename( $module_path )); |
|
| 1137 | + $module_file = explode('.', basename($module_path)); |
|
| 1138 | 1138 | // now we need to rebuild the shortcode path |
| 1139 | - $module_path = explode( DS, $module_path ); |
|
| 1139 | + $module_path = explode(DS, $module_path); |
|
| 1140 | 1140 | // remove last segment |
| 1141 | - array_pop( $module_path ); |
|
| 1141 | + array_pop($module_path); |
|
| 1142 | 1142 | // glue it back together |
| 1143 | - $module_path = implode( DS, $module_path ) . DS; |
|
| 1143 | + $module_path = implode(DS, $module_path).DS; |
|
| 1144 | 1144 | // take first segment from file name pieces and sanitize it |
| 1145 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
| 1145 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
| 1146 | 1146 | // ensure class prefix is added |
| 1147 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
| 1147 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
| 1148 | 1148 | } else { |
| 1149 | 1149 | // we need to generate the filename based off of the folder name |
| 1150 | 1150 | // grab and sanitize module name |
| 1151 | - $module = strtolower( basename( $module_path )); |
|
| 1152 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
| 1151 | + $module = strtolower(basename($module_path)); |
|
| 1152 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
| 1153 | 1153 | // like trailingslashit() |
| 1154 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
| 1154 | + $module_path = rtrim($module_path, DS).DS; |
|
| 1155 | 1155 | // create classname from module directory name |
| 1156 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
| 1156 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
| 1157 | 1157 | // add class prefix |
| 1158 | - $module_class = 'EED_' . $module; |
|
| 1158 | + $module_class = 'EED_'.$module; |
|
| 1159 | 1159 | } |
| 1160 | 1160 | // does the module exist ? |
| 1161 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
| 1162 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
| 1163 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1161 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
| 1162 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
| 1163 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1164 | 1164 | return FALSE; |
| 1165 | 1165 | } |
| 1166 | 1166 | // load the module class file |
| 1167 | - require_once( $module_path . $module_class . $module_ext ); |
|
| 1167 | + require_once($module_path.$module_class.$module_ext); |
|
| 1168 | 1168 | // verify that class exists |
| 1169 | - if ( ! class_exists( $module_class )) { |
|
| 1170 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
| 1171 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1169 | + if ( ! class_exists($module_class)) { |
|
| 1170 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
| 1171 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1172 | 1172 | return FALSE; |
| 1173 | 1173 | } |
| 1174 | 1174 | // add to array of registered modules |
| 1175 | - EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext; |
|
| 1176 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class ); |
|
| 1175 | + EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext; |
|
| 1176 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class); |
|
| 1177 | 1177 | return TRUE; |
| 1178 | 1178 | } |
| 1179 | 1179 | |
@@ -1187,23 +1187,23 @@ discard block |
||
| 1187 | 1187 | */ |
| 1188 | 1188 | private function _initialize_shortcodes() { |
| 1189 | 1189 | // cycle thru shortcode folders |
| 1190 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
| 1190 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
| 1191 | 1191 | // add class prefix |
| 1192 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 1192 | + $shortcode_class = 'EES_'.$shortcode; |
|
| 1193 | 1193 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1194 | 1194 | // which set hooks ? |
| 1195 | - if ( is_admin() ) { |
|
| 1195 | + if (is_admin()) { |
|
| 1196 | 1196 | // fire immediately |
| 1197 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
| 1197 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
| 1198 | 1198 | } else { |
| 1199 | 1199 | // delay until other systems are online |
| 1200 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
| 1200 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
| 1201 | 1201 | // convert classname to UPPERCASE and create WP shortcode. |
| 1202 | - $shortcode_tag = strtoupper( $shortcode ); |
|
| 1202 | + $shortcode_tag = strtoupper($shortcode); |
|
| 1203 | 1203 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
| 1204 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
| 1204 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
| 1205 | 1205 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
| 1206 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
| 1206 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
| 1207 | 1207 | } |
| 1208 | 1208 | } |
| 1209 | 1209 | } |
@@ -1220,15 +1220,15 @@ discard block |
||
| 1220 | 1220 | */ |
| 1221 | 1221 | private function _initialize_modules() { |
| 1222 | 1222 | // cycle thru shortcode folders |
| 1223 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
| 1223 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
| 1224 | 1224 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
| 1225 | 1225 | // which set hooks ? |
| 1226 | - if ( is_admin() ) { |
|
| 1226 | + if (is_admin()) { |
|
| 1227 | 1227 | // fire immediately |
| 1228 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
| 1228 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
| 1229 | 1229 | } else { |
| 1230 | 1230 | // delay until other systems are online |
| 1231 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
| 1231 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
| 1232 | 1232 | } |
| 1233 | 1233 | } |
| 1234 | 1234 | } |
@@ -1246,26 +1246,26 @@ discard block |
||
| 1246 | 1246 | * @param string $key - url param key indicating a route is being called |
| 1247 | 1247 | * @return bool |
| 1248 | 1248 | */ |
| 1249 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
| 1250 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
| 1251 | - $module = str_replace( 'EED_', '', $module ); |
|
| 1252 | - $module_class = 'EED_' . $module; |
|
| 1253 | - if ( ! isset( EE_Registry::instance()->modules->$module_class )) { |
|
| 1254 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
| 1255 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1249 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
| 1250 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
| 1251 | + $module = str_replace('EED_', '', $module); |
|
| 1252 | + $module_class = 'EED_'.$module; |
|
| 1253 | + if ( ! isset(EE_Registry::instance()->modules->$module_class)) { |
|
| 1254 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
| 1255 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1256 | 1256 | return FALSE; |
| 1257 | 1257 | } |
| 1258 | - if ( empty( $route )) { |
|
| 1259 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
| 1260 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1258 | + if (empty($route)) { |
|
| 1259 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
| 1260 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1261 | 1261 | return FALSE; |
| 1262 | 1262 | } |
| 1263 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
| 1264 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1265 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1263 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
| 1264 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
| 1265 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1266 | 1266 | return FALSE; |
| 1267 | 1267 | } |
| 1268 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
| 1268 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
| 1269 | 1269 | return TRUE; |
| 1270 | 1270 | } |
| 1271 | 1271 | |
@@ -1279,11 +1279,11 @@ discard block |
||
| 1279 | 1279 | * @param string $key - url param key indicating a route is being called |
| 1280 | 1280 | * @return string |
| 1281 | 1281 | */ |
| 1282 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
| 1283 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
| 1284 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
| 1285 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
| 1286 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
| 1282 | + public static function get_route($route = NULL, $key = 'ee') { |
|
| 1283 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
| 1284 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
| 1285 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
| 1286 | + return EE_Config::$_module_route_map[$key][$route]; |
|
| 1287 | 1287 | } |
| 1288 | 1288 | return NULL; |
| 1289 | 1289 | } |
@@ -1312,35 +1312,35 @@ discard block |
||
| 1312 | 1312 | * @param string $key - url param key indicating a route is being called |
| 1313 | 1313 | * @return bool |
| 1314 | 1314 | */ |
| 1315 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
| 1316 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
| 1317 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1318 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
| 1319 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1315 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
| 1316 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
| 1317 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1318 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
| 1319 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1320 | 1320 | return FALSE; |
| 1321 | 1321 | } |
| 1322 | - if ( empty( $forward )) { |
|
| 1323 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
| 1324 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1322 | + if (empty($forward)) { |
|
| 1323 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
| 1324 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1325 | 1325 | return FALSE; |
| 1326 | 1326 | } |
| 1327 | - if ( is_array( $forward )) { |
|
| 1328 | - if ( ! isset( $forward[1] )) { |
|
| 1329 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
| 1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1327 | + if (is_array($forward)) { |
|
| 1328 | + if ( ! isset($forward[1])) { |
|
| 1329 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
| 1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1331 | 1331 | return FALSE; |
| 1332 | 1332 | } |
| 1333 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
| 1334 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
| 1335 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1333 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
| 1334 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
| 1335 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1336 | 1336 | return FALSE; |
| 1337 | 1337 | } |
| 1338 | - } else if ( ! function_exists( $forward )) { |
|
| 1339 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
| 1340 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1338 | + } else if ( ! function_exists($forward)) { |
|
| 1339 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
| 1340 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1341 | 1341 | return FALSE; |
| 1342 | 1342 | } |
| 1343 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
| 1343 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
| 1344 | 1344 | return TRUE; |
| 1345 | 1345 | } |
| 1346 | 1346 | |
@@ -1355,10 +1355,10 @@ discard block |
||
| 1355 | 1355 | * @param string $key - url param key indicating a route is being called |
| 1356 | 1356 | * @return string |
| 1357 | 1357 | */ |
| 1358 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1359 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
| 1360 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
| 1361 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1358 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
| 1359 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
| 1360 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
| 1361 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
| 1362 | 1362 | } |
| 1363 | 1363 | return NULL; |
| 1364 | 1364 | } |
@@ -1375,19 +1375,19 @@ discard block |
||
| 1375 | 1375 | * @param string $key - url param key indicating a route is being called |
| 1376 | 1376 | * @return bool |
| 1377 | 1377 | */ |
| 1378 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
| 1379 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
| 1380 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
| 1381 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
| 1382 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1378 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
| 1379 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
| 1380 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
| 1381 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
| 1382 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1383 | 1383 | return FALSE; |
| 1384 | 1384 | } |
| 1385 | - if ( ! is_readable( $view )) { |
|
| 1386 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
| 1387 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1385 | + if ( ! is_readable($view)) { |
|
| 1386 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
| 1387 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1388 | 1388 | return FALSE; |
| 1389 | 1389 | } |
| 1390 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
| 1390 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
| 1391 | 1391 | return TRUE; |
| 1392 | 1392 | } |
| 1393 | 1393 | |
@@ -1404,10 +1404,10 @@ discard block |
||
| 1404 | 1404 | * @param string $key - url param key indicating a route is being called |
| 1405 | 1405 | * @return string |
| 1406 | 1406 | */ |
| 1407 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
| 1408 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
| 1409 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
| 1410 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
| 1407 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
| 1408 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
| 1409 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
| 1410 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
| 1411 | 1411 | } |
| 1412 | 1412 | return NULL; |
| 1413 | 1413 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | |
| 1416 | 1416 | |
| 1417 | 1417 | public function shutdown() { |
| 1418 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
| 1418 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | * magic functions in use, except we'll allow them to magically set and get stuff... |
| 1432 | 1432 | * basically, they should just be well-defined stdClasses |
| 1433 | 1433 | */ |
| 1434 | -class EE_Config_Base{ |
|
| 1434 | +class EE_Config_Base { |
|
| 1435 | 1435 | |
| 1436 | 1436 | /** |
| 1437 | 1437 | * Utility function for escaping the value of a property and returning. |
@@ -1440,13 +1440,13 @@ discard block |
||
| 1440 | 1440 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
| 1441 | 1441 | * @throws \EE_Error |
| 1442 | 1442 | */ |
| 1443 | - public function get_pretty( $property ) { |
|
| 1444 | - if ( ! property_exists( $this, $property ) ) { |
|
| 1445 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
| 1443 | + public function get_pretty($property) { |
|
| 1444 | + if ( ! property_exists($this, $property)) { |
|
| 1445 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
| 1446 | 1446 | } |
| 1447 | 1447 | //just handling escaping of strings for now. |
| 1448 | - if ( is_string( $this->$property ) ) { |
|
| 1449 | - return stripslashes( $this->$property ); |
|
| 1448 | + if (is_string($this->$property)) { |
|
| 1449 | + return stripslashes($this->$property); |
|
| 1450 | 1450 | } |
| 1451 | 1451 | return $this->$property; |
| 1452 | 1452 | } |
@@ -1455,19 +1455,19 @@ discard block |
||
| 1455 | 1455 | |
| 1456 | 1456 | public function populate() { |
| 1457 | 1457 | //grab defaults via a new instance of this class. |
| 1458 | - $class_name = get_class( $this ); |
|
| 1458 | + $class_name = get_class($this); |
|
| 1459 | 1459 | $defaults = new $class_name; |
| 1460 | 1460 | |
| 1461 | 1461 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
| 1462 | 1462 | //default from our $defaults object. |
| 1463 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
| 1464 | - if ( is_null( $this->$property ) ) { |
|
| 1463 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
| 1464 | + if (is_null($this->$property)) { |
|
| 1465 | 1465 | $this->$property = $value; |
| 1466 | 1466 | } |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | //cleanup |
| 1470 | - unset( $defaults ); |
|
| 1470 | + unset($defaults); |
|
| 1471 | 1471 | } |
| 1472 | 1472 | |
| 1473 | 1473 | |
@@ -1559,12 +1559,12 @@ discard block |
||
| 1559 | 1559 | */ |
| 1560 | 1560 | public function __construct() { |
| 1561 | 1561 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
| 1562 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
| 1562 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
| 1563 | 1563 | // set default organization settings |
| 1564 | 1564 | $this->current_blog_id = get_current_blog_id(); |
| 1565 | 1565 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
| 1566 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
| 1567 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
| 1566 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
| 1567 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
| 1568 | 1568 | $this->post_shortcodes = array(); |
| 1569 | 1569 | $this->module_route_map = array(); |
| 1570 | 1570 | $this->module_forward_map = array(); |
@@ -1583,7 +1583,7 @@ discard block |
||
| 1583 | 1583 | $this->event_cpt_slug = __('events', 'event_espresso'); |
| 1584 | 1584 | |
| 1585 | 1585 | //ueip constant check |
| 1586 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
| 1586 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
| 1587 | 1587 | $this->ee_ueip_optin = FALSE; |
| 1588 | 1588 | $this->ee_ueip_has_notified = TRUE; |
| 1589 | 1589 | } |
@@ -1623,8 +1623,8 @@ discard block |
||
| 1623 | 1623 | * @return string |
| 1624 | 1624 | */ |
| 1625 | 1625 | public function reg_page_url() { |
| 1626 | - if ( ! $this->reg_page_url ) { |
|
| 1627 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
| 1626 | + if ( ! $this->reg_page_url) { |
|
| 1627 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
| 1628 | 1628 | } |
| 1629 | 1629 | return $this->reg_page_url; |
| 1630 | 1630 | } |
@@ -1637,12 +1637,12 @@ discard block |
||
| 1637 | 1637 | * @return string |
| 1638 | 1638 | */ |
| 1639 | 1639 | public function txn_page_url($query_args = array()) { |
| 1640 | - if ( ! $this->txn_page_url ) { |
|
| 1641 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
| 1640 | + if ( ! $this->txn_page_url) { |
|
| 1641 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
| 1642 | 1642 | } |
| 1643 | - if($query_args){ |
|
| 1644 | - return add_query_arg($query_args,$this->txn_page_url); |
|
| 1645 | - }else{ |
|
| 1643 | + if ($query_args) { |
|
| 1644 | + return add_query_arg($query_args, $this->txn_page_url); |
|
| 1645 | + } else { |
|
| 1646 | 1646 | return $this->txn_page_url; |
| 1647 | 1647 | } |
| 1648 | 1648 | } |
@@ -1654,12 +1654,12 @@ discard block |
||
| 1654 | 1654 | * @return string |
| 1655 | 1655 | */ |
| 1656 | 1656 | public function thank_you_page_url($query_args = array()) { |
| 1657 | - if ( ! $this->thank_you_page_url ) { |
|
| 1658 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
| 1657 | + if ( ! $this->thank_you_page_url) { |
|
| 1658 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
| 1659 | 1659 | } |
| 1660 | - if($query_args){ |
|
| 1661 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
| 1662 | - }else{ |
|
| 1660 | + if ($query_args) { |
|
| 1661 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
| 1662 | + } else { |
|
| 1663 | 1663 | return $this->thank_you_page_url; |
| 1664 | 1664 | } |
| 1665 | 1665 | } |
@@ -1670,8 +1670,8 @@ discard block |
||
| 1670 | 1670 | * @return string |
| 1671 | 1671 | */ |
| 1672 | 1672 | public function cancel_page_url() { |
| 1673 | - if ( ! $this->cancel_page_url ) { |
|
| 1674 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
| 1673 | + if ( ! $this->cancel_page_url) { |
|
| 1674 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
| 1675 | 1675 | } |
| 1676 | 1676 | return $this->cancel_page_url; |
| 1677 | 1677 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
| 1699 | 1699 | //reset all url properties |
| 1700 | 1700 | $this->_reset_urls(); |
| 1701 | 1701 | //return what to save to db |
| 1702 | - return array_keys( get_object_vars( $this ) ); |
|
| 1702 | + return array_keys(get_object_vars($this)); |
|
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | 1705 | } |
@@ -1931,39 +1931,39 @@ discard block |
||
| 1931 | 1931 | * @param null $CNT_ISO |
| 1932 | 1932 | * @return \EE_Currency_Config |
| 1933 | 1933 | */ |
| 1934 | - public function __construct( $CNT_ISO = NULL ) { |
|
| 1934 | + public function __construct($CNT_ISO = NULL) { |
|
| 1935 | 1935 | |
| 1936 | 1936 | // get country code from organization settings or use default |
| 1937 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1937 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
| 1938 | 1938 | // but override if requested |
| 1939 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
| 1940 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
| 1939 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
| 1940 | + EE_Registry::instance()->load_helper('Activation'); |
|
| 1941 | 1941 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
| 1942 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
| 1942 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
| 1943 | 1943 | // retrieve the country settings from the db, just in case they have been customized |
| 1944 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
| 1945 | - if ( $country instanceof EE_Country ) { |
|
| 1946 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1947 | - $this->name = $country->currency_name_single(); // Dollar |
|
| 1948 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1949 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1950 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1951 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1952 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1953 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1944 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
| 1945 | + if ($country instanceof EE_Country) { |
|
| 1946 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
| 1947 | + $this->name = $country->currency_name_single(); // Dollar |
|
| 1948 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
| 1949 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
| 1950 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
| 1951 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1952 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1953 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1954 | 1954 | } |
| 1955 | 1955 | } |
| 1956 | 1956 | // fallback to hardcoded defaults, in case the above failed |
| 1957 | - if ( empty( $this->code )) { |
|
| 1957 | + if (empty($this->code)) { |
|
| 1958 | 1958 | // set default currency settings |
| 1959 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1960 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
| 1961 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
| 1962 | - $this->sign = '$'; // currency sign: $ |
|
| 1963 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1964 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1965 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1966 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1959 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
| 1960 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
| 1961 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
| 1962 | + $this->sign = '$'; // currency sign: $ |
|
| 1963 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
| 1964 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
| 1965 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
| 1966 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
| 1967 | 1967 | } |
| 1968 | 1968 | } |
| 1969 | 1969 | } |
@@ -2103,7 +2103,7 @@ discard block |
||
| 2103 | 2103 | * @since 4.8.8.rc.019 |
| 2104 | 2104 | */ |
| 2105 | 2105 | public function do_hooks() { |
| 2106 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
| 2106 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
| 2107 | 2107 | } |
| 2108 | 2108 | |
| 2109 | 2109 | |
@@ -2111,7 +2111,7 @@ discard block |
||
| 2111 | 2111 | * @return void |
| 2112 | 2112 | */ |
| 2113 | 2113 | public function set_default_reg_status_on_EEM_Event() { |
| 2114 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
| 2114 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
| 2115 | 2115 | } |
| 2116 | 2116 | |
| 2117 | 2117 | |
@@ -2216,10 +2216,10 @@ discard block |
||
| 2216 | 2216 | * @param bool $reset |
| 2217 | 2217 | * @return string |
| 2218 | 2218 | */ |
| 2219 | - public function log_file_name( $reset = FALSE ) { |
|
| 2220 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
| 2221 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2222 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2219 | + public function log_file_name($reset = FALSE) { |
|
| 2220 | + if (empty($this->log_file_name) || $reset) { |
|
| 2221 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2222 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2223 | 2223 | } |
| 2224 | 2224 | return $this->log_file_name; |
| 2225 | 2225 | } |
@@ -2231,10 +2231,10 @@ discard block |
||
| 2231 | 2231 | * @param bool $reset |
| 2232 | 2232 | * @return string |
| 2233 | 2233 | */ |
| 2234 | - public function debug_file_name( $reset = FALSE ) { |
|
| 2235 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
| 2236 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
| 2237 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
| 2234 | + public function debug_file_name($reset = FALSE) { |
|
| 2235 | + if (empty($this->debug_file_name) || $reset) { |
|
| 2236 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
| 2237 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
| 2238 | 2238 | } |
| 2239 | 2239 | return $this->debug_file_name; |
| 2240 | 2240 | } |
@@ -2407,21 +2407,21 @@ discard block |
||
| 2407 | 2407 | // set default map settings |
| 2408 | 2408 | $this->use_google_maps = TRUE; |
| 2409 | 2409 | // for event details pages (reg page) |
| 2410 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2411 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2412 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2413 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2414 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2415 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2416 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2410 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
| 2411 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
| 2412 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 2413 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 2414 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 2415 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 2416 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
| 2417 | 2417 | // for event list pages |
| 2418 | - $this->event_list_map_width = 300; // ee_map_width |
|
| 2419 | - $this->event_list_map_height = 185; // ee_map_height |
|
| 2420 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2421 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2422 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2423 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2424 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2418 | + $this->event_list_map_width = 300; // ee_map_width |
|
| 2419 | + $this->event_list_map_height = 185; // ee_map_height |
|
| 2420 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
| 2421 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 2422 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 2423 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 2424 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
| 2425 | 2425 | } |
| 2426 | 2426 | |
| 2427 | 2427 | } |
@@ -2432,7 +2432,7 @@ discard block |
||
| 2432 | 2432 | /** |
| 2433 | 2433 | * stores Events_Archive settings |
| 2434 | 2434 | */ |
| 2435 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
| 2435 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
| 2436 | 2436 | |
| 2437 | 2437 | public $display_status_banner; |
| 2438 | 2438 | public $display_description; |
@@ -2451,7 +2451,7 @@ discard block |
||
| 2451 | 2451 | /** |
| 2452 | 2452 | * class constructor |
| 2453 | 2453 | */ |
| 2454 | - public function __construct(){ |
|
| 2454 | + public function __construct() { |
|
| 2455 | 2455 | $this->display_status_banner = 0; |
| 2456 | 2456 | $this->display_description = 1; |
| 2457 | 2457 | $this->display_ticket_selector = 0; |
@@ -2471,7 +2471,7 @@ discard block |
||
| 2471 | 2471 | /** |
| 2472 | 2472 | * Stores Event_Single_Config settings |
| 2473 | 2473 | */ |
| 2474 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
| 2474 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
| 2475 | 2475 | |
| 2476 | 2476 | public $display_status_banner_single; |
| 2477 | 2477 | public $display_venue; |
@@ -2500,7 +2500,7 @@ discard block |
||
| 2500 | 2500 | /** |
| 2501 | 2501 | * Stores Ticket_Selector_Config settings |
| 2502 | 2502 | */ |
| 2503 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
| 2503 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
| 2504 | 2504 | public $show_ticket_sale_columns; |
| 2505 | 2505 | public $show_ticket_details; |
| 2506 | 2506 | public $show_expired_tickets; |
@@ -2554,7 +2554,7 @@ discard block |
||
| 2554 | 2554 | * @return void |
| 2555 | 2555 | */ |
| 2556 | 2556 | protected function _set_php_values() { |
| 2557 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
| 2557 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
| 2558 | 2558 | $this->php->version = phpversion(); |
| 2559 | 2559 | } |
| 2560 | 2560 | |
@@ -2573,8 +2573,8 @@ discard block |
||
| 2573 | 2573 | * @type string $msg Any message to be displayed. |
| 2574 | 2574 | * } |
| 2575 | 2575 | */ |
| 2576 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
| 2577 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
| 2576 | + public function max_input_vars_limit_check($input_count = 0) { |
|
| 2577 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
| 2578 | 2578 | return __('The number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso'); |
| 2579 | 2579 | } else { |
| 2580 | 2580 | return ''; |
@@ -2610,7 +2610,7 @@ discard block |
||
| 2610 | 2610 | * stores payment gateway info |
| 2611 | 2611 | * @deprecated |
| 2612 | 2612 | */ |
| 2613 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
| 2613 | +class EE_Gateway_Config extends EE_Config_Base { |
|
| 2614 | 2614 | |
| 2615 | 2615 | /** |
| 2616 | 2616 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2632,9 +2632,9 @@ discard block |
||
| 2632 | 2632 | * class constructor |
| 2633 | 2633 | * @deprecated |
| 2634 | 2634 | */ |
| 2635 | - public function __construct(){ |
|
| 2635 | + public function __construct() { |
|
| 2636 | 2636 | $this->payment_settings = array(); |
| 2637 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
| 2637 | + $this->active_gateways = array('Invoice' => FALSE); |
|
| 2638 | 2638 | } |
| 2639 | 2639 | } |
| 2640 | 2640 | |
@@ -42,24 +42,24 @@ discard block |
||
| 42 | 42 | * } |
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | - public static function register( $config_class = NULL, $setup_args = array() ) { |
|
| 45 | + public static function register($config_class = NULL, $setup_args = array()) { |
|
| 46 | 46 | |
| 47 | - $setup_args['config_name'] = isset( $setup_args['config_name'] ) && ! empty( $setup_args['config_name'] ) ? $setup_args['config_name'] : $config_class; |
|
| 48 | - $setup_args['config_section'] = isset( $setup_args['config_section'] ) && ! empty( $setup_args['config_section'] ) ? $setup_args['config_section'] : 'addons'; |
|
| 47 | + $setup_args['config_name'] = isset($setup_args['config_name']) && ! empty($setup_args['config_name']) ? $setup_args['config_name'] : $config_class; |
|
| 48 | + $setup_args['config_section'] = isset($setup_args['config_section']) && ! empty($setup_args['config_section']) ? $setup_args['config_section'] : 'addons'; |
|
| 49 | 49 | |
| 50 | 50 | //required fields MUST be present, so let's make sure they are. |
| 51 | - if ( empty( $config_class ) || ! is_array( $setup_args ) || empty( $setup_args['config_name'] )) { |
|
| 52 | - throw new EE_Error( __( 'In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})', 'event_espresso' )); |
|
| 51 | + if (empty($config_class) || ! is_array($setup_args) || empty($setup_args['config_name'])) { |
|
| 52 | + throw new EE_Error(__('In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})', 'event_espresso')); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //make sure we don't register twice |
| 56 | - if( isset( self::$_ee_config_registry[ $config_class ] ) ){ |
|
| 56 | + if (isset(self::$_ee_config_registry[$config_class])) { |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | //first find out if this happened too late. |
| 62 | - if ( did_action( 'AHEE__EE_System__load_core_configuration__begin' ) ) { |
|
| 62 | + if (did_action('AHEE__EE_System__load_core_configuration__begin')) { |
|
| 63 | 63 | EE_Error::doing_it_wrong( |
| 64 | 64 | __METHOD__, |
| 65 | 65 | sprintf( |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | ); |
| 71 | 71 | } |
| 72 | 72 | //add incoming stuff to our registry property |
| 73 | - self::$_ee_config_registry[ $config_class ] = array( |
|
| 73 | + self::$_ee_config_registry[$config_class] = array( |
|
| 74 | 74 | 'section' => $setup_args['config_section'], |
| 75 | 75 | 'name' => $setup_args['config_name'] |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( 'EE_Register_Config', 'set_config' ), 15, 1 ); |
|
| 79 | - add_action( 'AHEE__EE_Config__update_espresso_config__end', array( 'EE_Register_Config', 'set_config' ), 15, 1 ); |
|
| 78 | + add_action('AHEE__EE_Config___load_core_config__end', array('EE_Register_Config', 'set_config'), 15, 1); |
|
| 79 | + add_action('AHEE__EE_Config__update_espresso_config__end', array('EE_Register_Config', 'set_config'), 15, 1); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -90,18 +90,18 @@ discard block |
||
| 90 | 90 | * @param \EE_Config $EE_Config |
| 91 | 91 | * @return \StdClass |
| 92 | 92 | */ |
| 93 | - public static function set_config( EE_Config $EE_Config ) { |
|
| 94 | - foreach ( self::$_ee_config_registry as $config_class => $settings ) { |
|
| 93 | + public static function set_config(EE_Config $EE_Config) { |
|
| 94 | + foreach (self::$_ee_config_registry as $config_class => $settings) { |
|
| 95 | 95 | //first some validation of our incoming class_name. We'll throw an error early if its' not registered correctly |
| 96 | - if ( ! class_exists( $config_class )) { |
|
| 96 | + if ( ! class_exists($config_class)) { |
|
| 97 | 97 | throw new EE_Error( |
| 98 | 98 | sprintf( |
| 99 | - __( 'The "%s" config class can not be registered with EE_Config because it does not exist. Verify that an autoloader has been set for this class', 'event_espresso' ), |
|
| 99 | + __('The "%s" config class can not be registered with EE_Config because it does not exist. Verify that an autoloader has been set for this class', 'event_espresso'), |
|
| 100 | 100 | $config_class |
| 101 | 101 | ) |
| 102 | 102 | ); |
| 103 | 103 | } |
| 104 | - $EE_Config->get_config( $settings['section'], $settings['name'], $config_class ); |
|
| 104 | + $EE_Config->get_config($settings['section'], $settings['name'], $config_class); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * @param mixed $config_class_name |
| 113 | 113 | */ |
| 114 | - public static function deregister( $config_class_name = NULL ) { |
|
| 115 | - if ( ! empty( self::$_ee_config_registry[ $config_class_name ] )) |
|
| 116 | - unset( self::$_ee_config_registry[ $config_class_name ] ); |
|
| 114 | + public static function deregister($config_class_name = NULL) { |
|
| 115 | + if ( ! empty(self::$_ee_config_registry[$config_class_name])) |
|
| 116 | + unset(self::$_ee_config_registry[$config_class_name]); |
|
| 117 | 117 | } |
| 118 | 118 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | /** |
| 185 | 185 | * returns the text for displaying the question to users |
| 186 | 186 | * @access public |
| 187 | - * @return string |
|
| 187 | + * @return boolean |
|
| 188 | 188 | */ |
| 189 | 189 | public function display_text() { |
| 190 | 190 | return $this->get( 'QST_display_text' ); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * returns the text for the administrative label |
| 197 | 197 | * @access public |
| 198 | - * @return string |
|
| 198 | + * @return boolean |
|
| 199 | 199 | */ |
| 200 | 200 | public function admin_label() { |
| 201 | 201 | return $this->get( 'QST_admin_label' ); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | /** |
| 207 | 207 | * returns the attendee column name for this question |
| 208 | 208 | * @access public |
| 209 | - * @return string |
|
| 209 | + * @return boolean |
|
| 210 | 210 | */ |
| 211 | 211 | public function system_ID() { |
| 212 | 212 | return $this->get( 'QST_system' ); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * returns the text which should be displayed when a user |
| 230 | 230 | * doesn't answer this question in a form |
| 231 | 231 | * @access public |
| 232 | - * @return string |
|
| 232 | + * @return boolean |
|
| 233 | 233 | */ |
| 234 | 234 | public function required_text() { |
| 235 | 235 | return $this->get( 'QST_required_text' ); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | /** |
| 241 | 241 | * returns the type of this question |
| 242 | 242 | * @access public |
| 243 | - * @return string |
|
| 243 | + * @return boolean |
|
| 244 | 244 | */ |
| 245 | 245 | public function type() { |
| 246 | 246 | return $this->get( 'QST_type' ); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * returns an integer showing where this question should |
| 253 | 253 | * be placed in a sequence of questions |
| 254 | 254 | * @access public |
| 255 | - * @return int |
|
| 255 | + * @return boolean |
|
| 256 | 256 | */ |
| 257 | 257 | public function order() { |
| 258 | 258 | return $this->get( 'QST_order' ); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | /** |
| 276 | 276 | * returns the id the wordpress user who created this question |
| 277 | 277 | * @access public |
| 278 | - * @return int |
|
| 278 | + * @return boolean |
|
| 279 | 279 | */ |
| 280 | 280 | public function wp_user() { |
| 281 | 281 | return $this->get( 'QST_wp_user' ); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | * Adds an option for this question. Note: if the option were previously associated with a different |
| 370 | 370 | * Question, that relationship will be overwritten. |
| 371 | 371 | * @param EE_Question_Option $option |
| 372 | - * @return boolean success |
|
| 372 | + * @return EE_Base_Class success |
|
| 373 | 373 | */ |
| 374 | 374 | public function add_option( EE_Question_Option $option ) { |
| 375 | 375 | return $this->_add_relation_to( $option, 'Question_Option' ); |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | /** |
| 393 | 393 | * Marks the option as deleted. |
| 394 | 394 | * @param EE_Question_Option $option |
| 395 | - * @return boolean success |
|
| 395 | + * @return EE_Base_Class success |
|
| 396 | 396 | */ |
| 397 | 397 | public function remove_option( EE_Question_Option $option ) { |
| 398 | 398 | return $this->_remove_relation_to( $option, 'Question_Option' ); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | /** |
| 463 | 463 | * Returns the question's maximum allowed response size |
| 464 | - * @return int|float |
|
| 464 | + * @return boolean |
|
| 465 | 465 | */ |
| 466 | 466 | public function max() { |
| 467 | 467 | return $this->get( 'QST_max' ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | * date_format and the second value is the time format |
| 38 | 38 | * @return EE_Question |
| 39 | 39 | */ |
| 40 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 41 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
| 42 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 40 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 41 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 42 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | * the website will be used. |
| 51 | 51 | * @return EE_Question |
| 52 | 52 | */ |
| 53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 54 | + return new self($props_n_values, TRUE, $timezone); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @access public |
| 63 | 63 | * @param string $QST_display_text |
| 64 | 64 | */ |
| 65 | - public function set_display_text( $QST_display_text = '' ) { |
|
| 66 | - $this->set( 'QST_display_text', $QST_display_text ); |
|
| 65 | + public function set_display_text($QST_display_text = '') { |
|
| 66 | + $this->set('QST_display_text', $QST_display_text); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | * @access public |
| 75 | 75 | * @param string $QST_admin_label |
| 76 | 76 | */ |
| 77 | - public function set_admin_label( $QST_admin_label = '' ) { |
|
| 78 | - $this->set( 'QST_admin_label', $QST_admin_label ); |
|
| 77 | + public function set_admin_label($QST_admin_label = '') { |
|
| 78 | + $this->set('QST_admin_label', $QST_admin_label); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | * @access public |
| 87 | 87 | * @param mixed $QST_system |
| 88 | 88 | */ |
| 89 | - public function set_system_ID( $QST_system = '' ) { |
|
| 90 | - $this->set( 'QST_system', $QST_system ); |
|
| 89 | + public function set_system_ID($QST_system = '') { |
|
| 90 | + $this->set('QST_system', $QST_system); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | * @access public |
| 99 | 99 | * @param string $QST_type |
| 100 | 100 | */ |
| 101 | - public function set_question_type( $QST_type = '' ) { |
|
| 102 | - $this->set( 'QST_type', $QST_type ); |
|
| 101 | + public function set_question_type($QST_type = '') { |
|
| 102 | + $this->set('QST_type', $QST_type); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | * @access public |
| 111 | 111 | * @param bool $QST_required |
| 112 | 112 | */ |
| 113 | - public function set_required( $QST_required = FALSE ) { |
|
| 114 | - $this->set( 'QST_required', $QST_required ); |
|
| 113 | + public function set_required($QST_required = FALSE) { |
|
| 114 | + $this->set('QST_required', $QST_required); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | * @access public |
| 123 | 123 | * @param string $QST_required_text |
| 124 | 124 | */ |
| 125 | - public function set_required_text( $QST_required_text = '' ) { |
|
| 126 | - $this->set( 'QST_required_text', $QST_required_text ); |
|
| 125 | + public function set_required_text($QST_required_text = '') { |
|
| 126 | + $this->set('QST_required_text', $QST_required_text); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | * @access public |
| 135 | 135 | * @param int $QST_order |
| 136 | 136 | */ |
| 137 | - public function set_order( $QST_order = 0 ) { |
|
| 138 | - $this->set( 'QST_order', $QST_order ); |
|
| 137 | + public function set_order($QST_order = 0) { |
|
| 138 | + $this->set('QST_order', $QST_order); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | * @access public |
| 147 | 147 | * @param bool $QST_admin_only |
| 148 | 148 | */ |
| 149 | - public function set_admin_only( $QST_admin_only = FALSE ) { |
|
| 150 | - $this->set( 'QST_admin_only', $QST_admin_only ); |
|
| 149 | + public function set_admin_only($QST_admin_only = FALSE) { |
|
| 150 | + $this->set('QST_admin_only', $QST_admin_only); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | * @access public |
| 159 | 159 | * @param int $QST_wp_user |
| 160 | 160 | */ |
| 161 | - public function set_wp_user( $QST_wp_user = 1 ) { |
|
| 162 | - $this->set( 'QST_wp_user', $QST_wp_user ); |
|
| 161 | + public function set_wp_user($QST_wp_user = 1) { |
|
| 162 | + $this->set('QST_wp_user', $QST_wp_user); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | * @access public |
| 176 | 176 | * @param bool $QST_deleted |
| 177 | 177 | */ |
| 178 | - public function set_deleted( $QST_deleted = FALSE ) { |
|
| 179 | - $this->set( 'QST_deleted', $QST_deleted ); |
|
| 178 | + public function set_deleted($QST_deleted = FALSE) { |
|
| 179 | + $this->set('QST_deleted', $QST_deleted); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @return string |
| 188 | 188 | */ |
| 189 | 189 | public function display_text() { |
| 190 | - return $this->get( 'QST_display_text' ); |
|
| 190 | + return $this->get('QST_display_text'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return string |
| 199 | 199 | */ |
| 200 | 200 | public function admin_label() { |
| 201 | - return $this->get( 'QST_admin_label' ); |
|
| 201 | + return $this->get('QST_admin_label'); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return string |
| 210 | 210 | */ |
| 211 | 211 | public function system_ID() { |
| 212 | - return $this->get( 'QST_system' ); |
|
| 212 | + return $this->get('QST_system'); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @return boolean |
| 221 | 221 | */ |
| 222 | 222 | public function required() { |
| 223 | - return $this->get( 'QST_required' ); |
|
| 223 | + return $this->get('QST_required'); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @return string |
| 233 | 233 | */ |
| 234 | 234 | public function required_text() { |
| 235 | - return $this->get( 'QST_required_text' ); |
|
| 235 | + return $this->get('QST_required_text'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @return string |
| 244 | 244 | */ |
| 245 | 245 | public function type() { |
| 246 | - return $this->get( 'QST_type' ); |
|
| 246 | + return $this->get('QST_type'); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @return int |
| 256 | 256 | */ |
| 257 | 257 | public function order() { |
| 258 | - return $this->get( 'QST_order' ); |
|
| 258 | + return $this->get('QST_order'); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * @return boolean |
| 268 | 268 | */ |
| 269 | 269 | public function admin_only() { |
| 270 | - return $this->get( 'QST_admin_only' ); |
|
| 270 | + return $this->get('QST_admin_only'); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @return int |
| 279 | 279 | */ |
| 280 | 280 | public function wp_user() { |
| 281 | - return $this->get( 'QST_wp_user' ); |
|
| 281 | + return $this->get('QST_wp_user'); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * @return boolean |
| 290 | 290 | */ |
| 291 | 291 | public function deleted() { |
| 292 | - return $this->get( 'QST_deleted' ); |
|
| 292 | + return $this->get('QST_deleted'); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @return EE_Answer[] |
| 300 | 300 | */ |
| 301 | 301 | public function answers() { |
| 302 | - return $this->get_many_related( 'Answer' ); |
|
| 302 | + return $this->get_many_related('Answer'); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @return boolean true = has answers, false = no answers. |
| 310 | 310 | */ |
| 311 | 311 | public function has_answers() { |
| 312 | - return $this->count_related( 'Answer' ) > 0 ? TRUE : FALSE; |
|
| 312 | + return $this->count_related('Answer') > 0 ? TRUE : FALSE; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @return EE_Question_Group[] |
| 320 | 320 | */ |
| 321 | 321 | public function question_groups() { |
| 322 | - return $this->get_many_related( 'Question_Group' ); |
|
| 322 | + return $this->get_many_related('Question_Group'); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | |
@@ -333,24 +333,24 @@ discard block |
||
| 333 | 333 | * whether it was trashed or not. |
| 334 | 334 | * @return EE_Question_Option[] |
| 335 | 335 | */ |
| 336 | - public function options( $notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL ) { |
|
| 337 | - if ( ! $this->ID() ) { |
|
| 336 | + public function options($notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL) { |
|
| 337 | + if ( ! $this->ID()) { |
|
| 338 | 338 | return array(); |
| 339 | 339 | } |
| 340 | 340 | $query_params = array(); |
| 341 | - if ( $selected_value_to_always_include ) { |
|
| 342 | - if ( is_array( $selected_value_to_always_include ) ) { |
|
| 343 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = array( 'IN', $selected_value_to_always_include ); |
|
| 341 | + if ($selected_value_to_always_include) { |
|
| 342 | + if (is_array($selected_value_to_always_include)) { |
|
| 343 | + $query_params[0]['OR*options-query']['QSO_value'] = array('IN', $selected_value_to_always_include); |
|
| 344 | 344 | } else { |
| 345 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = $selected_value_to_always_include; |
|
| 345 | + $query_params[0]['OR*options-query']['QSO_value'] = $selected_value_to_always_include; |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | - if ( $notDeletedOptionsOnly ) { |
|
| 349 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_deleted' ] = FALSE; |
|
| 348 | + if ($notDeletedOptionsOnly) { |
|
| 349 | + $query_params[0]['OR*options-query']['QSO_deleted'] = FALSE; |
|
| 350 | 350 | } |
| 351 | 351 | //order by QSO_order |
| 352 | - $query_params[ 'order_by' ] = array( 'QSO_order' => 'ASC' ); |
|
| 353 | - return $this->get_many_related( 'Question_Option', $query_params ); |
|
| 352 | + $query_params['order_by'] = array('QSO_order' => 'ASC'); |
|
| 353 | + return $this->get_many_related('Question_Option', $query_params); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * @return \EE_Question_Option[] |
| 361 | 361 | */ |
| 362 | 362 | public function temp_options() { |
| 363 | - return $this->_model_relations[ 'Question_Option' ]; |
|
| 363 | + return $this->_model_relations['Question_Option']; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | * @param EE_Question_Option $option |
| 372 | 372 | * @return boolean success |
| 373 | 373 | */ |
| 374 | - public function add_option( EE_Question_Option $option ) { |
|
| 375 | - return $this->_add_relation_to( $option, 'Question_Option' ); |
|
| 374 | + public function add_option(EE_Question_Option $option) { |
|
| 375 | + return $this->_add_relation_to($option, 'Question_Option'); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | * @param EE_Question_Option $option |
| 383 | 383 | * @return boolean success |
| 384 | 384 | */ |
| 385 | - public function add_temp_option( EE_Question_Option $option ) { |
|
| 386 | - $this->_model_relations[ 'Question_Option' ][ ] = $option; |
|
| 385 | + public function add_temp_option(EE_Question_Option $option) { |
|
| 386 | + $this->_model_relations['Question_Option'][] = $option; |
|
| 387 | 387 | return TRUE; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | * @param EE_Question_Option $option |
| 395 | 395 | * @return boolean success |
| 396 | 396 | */ |
| 397 | - public function remove_option( EE_Question_Option $option ) { |
|
| 398 | - return $this->_remove_relation_to( $option, 'Question_Option' ); |
|
| 397 | + public function remove_option(EE_Question_Option $option) { |
|
| 398 | + return $this->_remove_relation_to($option, 'Question_Option'); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | |
@@ -404,8 +404,8 @@ discard block |
||
| 404 | 404 | * @return bool |
| 405 | 405 | */ |
| 406 | 406 | public function is_system_question() { |
| 407 | - $system_ID = $this->get( 'QST_system' ); |
|
| 408 | - return ! empty( $system_ID ) ? TRUE : FALSE; |
|
| 407 | + $system_ID = $this->get('QST_system'); |
|
| 408 | + return ! empty($system_ID) ? TRUE : FALSE; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | |
@@ -418,8 +418,8 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | public function set_order_to_latest() { |
| 420 | 420 | $latest_order = $this->get_model()->get_latest_question_order(); |
| 421 | - $latest_order ++; |
|
| 422 | - $this->set( 'QST_order', $latest_order ); |
|
| 421 | + $latest_order++; |
|
| 422 | + $this->set('QST_order', $latest_order); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | |
@@ -438,20 +438,20 @@ discard block |
||
| 438 | 438 | * Duplicates this question and its question options |
| 439 | 439 | * @return \EE_Question |
| 440 | 440 | */ |
| 441 | - public function duplicate( $options = array() ) { |
|
| 441 | + public function duplicate($options = array()) { |
|
| 442 | 442 | $new_question = clone $this; |
| 443 | - $new_question->set( 'QST_ID', null ); |
|
| 444 | - $new_question->set_display_text( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->display_text() ) ); |
|
| 445 | - $new_question->set_admin_label( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->admin_label() ) ); |
|
| 446 | - $new_question->set_system_ID( null ); |
|
| 447 | - $new_question->set_wp_user( get_current_user_id() ); |
|
| 443 | + $new_question->set('QST_ID', null); |
|
| 444 | + $new_question->set_display_text(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->display_text())); |
|
| 445 | + $new_question->set_admin_label(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->admin_label())); |
|
| 446 | + $new_question->set_system_ID(null); |
|
| 447 | + $new_question->set_wp_user(get_current_user_id()); |
|
| 448 | 448 | //if we're duplicating a trashed question, assume we don't want the new one to be trashed |
| 449 | - $new_question->set_deleted( false ); |
|
| 449 | + $new_question->set_deleted(false); |
|
| 450 | 450 | $success = $new_question->save(); |
| 451 | - if( $success ) { |
|
| 451 | + if ($success) { |
|
| 452 | 452 | //we don't totally want to duplicate the question options, because we want them to be for the NEW question |
| 453 | - foreach( $this->options() as $question_option ) { |
|
| 454 | - $question_option->duplicate( array( 'QST_ID' => $new_question->ID() ) ); |
|
| 453 | + foreach ($this->options() as $question_option) { |
|
| 454 | + $question_option->duplicate(array('QST_ID' => $new_question->ID())); |
|
| 455 | 455 | } |
| 456 | 456 | return $new_question; |
| 457 | 457 | } else { |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | * @return int|float |
| 465 | 465 | */ |
| 466 | 466 | public function max() { |
| 467 | - return $this->get( 'QST_max' ); |
|
| 467 | + return $this->get('QST_max'); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | /** |
@@ -472,8 +472,8 @@ discard block |
||
| 472 | 472 | * @param int|float $new_max |
| 473 | 473 | * @return int|float |
| 474 | 474 | */ |
| 475 | - public function set_max( $new_max ) { |
|
| 476 | - return $this->set( 'QST_max', $new_max ); |
|
| 475 | + public function set_max($new_max) { |
|
| 476 | + return $this->set('QST_max', $new_max); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - public function __construct( $routing = TRUE ) { |
|
| 62 | - require_once( EE_MODELS . 'EEM_Question.model.php' ); |
|
| 63 | - require_once( EE_MODELS . 'EEM_Question_Group.model.php' ); |
|
| 64 | - $this->_question_model= EEM_Question::instance(); |
|
| 65 | - $this->_question_group_model=EEM_Question_Group::instance(); |
|
| 66 | - parent::__construct( $routing ); |
|
| 61 | + public function __construct($routing = TRUE) { |
|
| 62 | + require_once(EE_MODELS.'EEM_Question.model.php'); |
|
| 63 | + require_once(EE_MODELS.'EEM_Question_Group.model.php'); |
|
| 64 | + $this->_question_model = EEM_Question::instance(); |
|
| 65 | + $this->_question_group_model = EEM_Question_Group::instance(); |
|
| 66 | + parent::__construct($routing); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | protected function _set_page_routes() { |
| 100 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
| 100 | + $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
| 101 | 101 | $this->_page_routes = array( |
| 102 | 102 | 'default' => array( |
| 103 | 103 | 'func' => '_questions_overview_list_table', |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | 'update_question' => array( |
| 120 | 120 | 'func' => '_insert_or_update_question', |
| 121 | - 'args' => array('new_question' => FALSE ), |
|
| 121 | + 'args' => array('new_question' => FALSE), |
|
| 122 | 122 | 'capability' => 'ee_edit_question', |
| 123 | 123 | 'obj_id' => $qst_id, |
| 124 | 124 | 'noheader' => TRUE, |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | 'filename' => 'registration_form_questions_overview_views_bulk_actions_search' |
| 154 | 154 | ) |
| 155 | 155 | ), |
| 156 | - 'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'), |
|
| 156 | + 'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'), |
|
| 157 | 157 | 'require_nonce' => FALSE, |
| 158 | 158 | 'qtips' => array( |
| 159 | 159 | 'EE_Registration_Form_Tips' |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | 'filename' => 'registration_form_question_groups' |
| 173 | 173 | ), |
| 174 | 174 | ), |
| 175 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
| 175 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
| 176 | 176 | 'require_nonce' => FALSE |
| 177 | 177 | ), |
| 178 | 178 | |
@@ -181,16 +181,16 @@ discard block |
||
| 181 | 181 | 'label' => __('Edit Question', 'event_espresso'), |
| 182 | 182 | 'order' => 15, |
| 183 | 183 | 'persistent' => FALSE, |
| 184 | - 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
| 184 | + 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
| 185 | 185 | ), |
| 186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
| 186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 187 | 187 | 'help_tabs' => array( |
| 188 | 188 | 'registration_form_edit_question_group_help_tab' => array( |
| 189 | 189 | 'title' => __('Edit Question', 'event_espresso'), |
| 190 | 190 | 'filename' => 'registration_form_edit_question' |
| 191 | 191 | ), |
| 192 | 192 | ), |
| 193 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
| 193 | + 'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'), |
|
| 194 | 194 | 'require_nonce' => FALSE |
| 195 | 195 | ), |
| 196 | 196 | ); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | //none of the below group are currently used for Event Categories |
| 219 | 219 | protected function _add_feature_pointers() {} |
| 220 | 220 | public function load_scripts_styles() { |
| 221 | - wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 221 | + wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 222 | 222 | wp_enqueue_style('espresso_registration'); |
| 223 | 223 | } |
| 224 | 224 | public function admin_init() {} |
@@ -234,20 +234,20 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | public function load_scripts_styles_add_question() { |
| 236 | 236 | $this->load_scripts_styles_forms(); |
| 237 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 238 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
| 237 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 238 | + wp_enqueue_script('espresso_registration_form_single'); |
|
| 239 | 239 | } |
| 240 | 240 | public function load_scripts_styles_edit_question() { |
| 241 | 241 | $this->load_scripts_styles_forms(); |
| 242 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 243 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
| 242 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 243 | + wp_enqueue_script('espresso_registration_form_single'); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | public function recaptcha_info_help_tab() { |
| 250 | - $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php'; |
|
| 250 | + $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php'; |
|
| 251 | 251 | EEH_Template::display_template($template, array()); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
| 282 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
| 283 | 283 | $this->_views['trash'] = array( |
| 284 | 284 | 'slug' => 'trash', |
| 285 | 285 | 'label' => __('Trash', 'event_espresso'), |
@@ -297,9 +297,9 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function _questions_groups_preview() { |
| 299 | 299 | $this->_admin_page_title = __('Question Groups (Preview)', 'event_espresso'); |
| 300 | - $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />'; |
|
| 301 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>'; |
|
| 302 | - $this->display_admin_caf_preview_page( 'question_groups_tab' ); |
|
| 300 | + $this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />'; |
|
| 301 | + $this->_template_args['preview_text'] = '<strong>'.__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>'; |
|
| 302 | + $this->display_admin_caf_preview_page('question_groups_tab'); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
@@ -308,58 +308,58 @@ discard block |
||
| 308 | 308 | * Extracts the question field's values from the POST request to update or insert them |
| 309 | 309 | * @return array where each key is the name of a model's field/db column, and each value is its value. |
| 310 | 310 | */ |
| 311 | - protected function _set_column_values_for(EEM_Base $model){ |
|
| 312 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 313 | - $set_column_values=array(); |
|
| 311 | + protected function _set_column_values_for(EEM_Base $model) { |
|
| 312 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 313 | + $set_column_values = array(); |
|
| 314 | 314 | |
| 315 | 315 | //some initial checks for proper values. |
| 316 | 316 | //if QST_admin_only, then no matter what QST_required is we disable. |
| 317 | - if ( !empty( $this->_req_data['QST_admin_only'] ) ) { |
|
| 317 | + if ( ! empty($this->_req_data['QST_admin_only'])) { |
|
| 318 | 318 | $this->_req_data['QST_required'] = 0; |
| 319 | 319 | } |
| 320 | - foreach($model->field_settings() as $fieldName=>$settings){ |
|
| 320 | + foreach ($model->field_settings() as $fieldName=>$settings) { |
|
| 321 | 321 | // basically if QSG_identifier is empty or not set |
| 322 | - if ( $fieldName == 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) { |
|
| 323 | - $QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ; |
|
| 324 | - $set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid(); |
|
| 322 | + if ($fieldName == 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) { |
|
| 323 | + $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : ''; |
|
| 324 | + $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid(); |
|
| 325 | 325 | // dd($set_column_values); |
| 326 | 326 | } |
| 327 | 327 | //if the admin label is blank, use a slug version of the question text |
| 328 | - else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
|
| 329 | - $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
|
| 330 | - $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
|
| 328 | + else if ($fieldName == 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) { |
|
| 329 | + $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : ''; |
|
| 330 | + $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10)); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
| 334 | - else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
| 334 | + else if ($fieldName == 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) { |
|
| 335 | 335 | $set_column_values[$fieldName] = 0; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - else if ( $fieldName == 'QST_max' ) { |
|
| 338 | + else if ($fieldName == 'QST_max') { |
|
| 339 | 339 | $qst_system = EEM_Question::instance()->get_var( |
| 340 | 340 | array( |
| 341 | 341 | array( |
| 342 | - 'QST_ID' => $this->_req_data[ 'QST_ID' ] |
|
| 342 | + 'QST_ID' => $this->_req_data['QST_ID'] |
|
| 343 | 343 | ) |
| 344 | 344 | ), |
| 345 | 345 | 'QST_system' ); |
| 346 | - $max_max = EEM_Question::instance()->max_max_for_system_question( $qst_system ); |
|
| 347 | - if( empty( $this->_req_data[ 'QST_max' ] ) || |
|
| 348 | - $this->_req_data[ 'QST_max' ] > $max_max ) { |
|
| 349 | - $set_column_values[ $fieldName ] = $max_max; |
|
| 346 | + $max_max = EEM_Question::instance()->max_max_for_system_question($qst_system); |
|
| 347 | + if (empty($this->_req_data['QST_max']) || |
|
| 348 | + $this->_req_data['QST_max'] > $max_max) { |
|
| 349 | + $set_column_values[$fieldName] = $max_max; |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
| 354 | 354 | //only add a property to the array if it's not null (otherwise the model should just use the default value) |
| 355 | - if( |
|
| 356 | - ! isset( $set_column_values[ $fieldName ] ) && |
|
| 357 | - isset($this->_req_data[$fieldName] ) ){ |
|
| 358 | - $set_column_values[$fieldName]=$this->_req_data[$fieldName]; |
|
| 355 | + if ( |
|
| 356 | + ! isset($set_column_values[$fieldName]) && |
|
| 357 | + isset($this->_req_data[$fieldName]) ) { |
|
| 358 | + $set_column_values[$fieldName] = $this->_req_data[$fieldName]; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | } |
| 362 | - return $set_column_values;//validation fo this data to be performed by the model before insertion. |
|
| 362 | + return $set_column_values; //validation fo this data to be performed by the model before insertion. |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | |
@@ -372,87 +372,87 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | |
| 374 | 374 | |
| 375 | - protected function _edit_question( $action= 'add' ) { |
|
| 376 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 377 | - $ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE; |
|
| 375 | + protected function _edit_question($action = 'add') { |
|
| 376 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 377 | + $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE; |
|
| 378 | 378 | |
| 379 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
| 379 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
| 380 | 380 | // add PRC_ID to title if editing |
| 381 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
| 382 | - if($ID){ |
|
| 383 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
| 384 | - $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
| 381 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
| 382 | + if ($ID) { |
|
| 383 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
| 384 | + $additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
| 385 | 385 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
| 386 | - }else{ |
|
| 387 | - $question= EE_Question::new_instance(); |
|
| 386 | + } else { |
|
| 387 | + $question = EE_Question::new_instance(); |
|
| 388 | 388 | $question->set_order_to_latest(); |
| 389 | 389 | $this->_set_add_edit_form_tags('insert_question'); |
| 390 | 390 | } |
| 391 | - $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types(); |
|
| 392 | - $this->_template_args['QST_ID']=$ID; |
|
| 393 | - $this->_template_args['question']=$question; |
|
| 394 | - $this->_template_args['question_types']= $question_types; |
|
| 395 | - $this->_template_args['max_max'] = EEM_Question::instance()->max_max_for_system_question( $question->system_ID() ); |
|
| 391 | + $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types(); |
|
| 392 | + $this->_template_args['QST_ID'] = $ID; |
|
| 393 | + $this->_template_args['question'] = $question; |
|
| 394 | + $this->_template_args['question_types'] = $question_types; |
|
| 395 | + $this->_template_args['max_max'] = EEM_Question::instance()->max_max_for_system_question($question->system_ID()); |
|
| 396 | 396 | |
| 397 | - $this->_set_publish_post_box_vars( 'id', $ID ); |
|
| 398 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
| 397 | + $this->_set_publish_post_box_vars('id', $ID); |
|
| 398 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE); |
|
| 399 | 399 | |
| 400 | 400 | // the details template wrapper |
| 401 | 401 | $this->display_admin_page_with_sidebar(); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | protected function _insert_or_update_question($new_question = TRUE) { |
| 405 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 406 | - $set_column_values=$this->_set_column_values_for($this->_question_model); |
|
| 407 | - if($new_question){ |
|
| 408 | - $ID=$this->_question_model->insert($set_column_values); |
|
| 405 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 406 | + $set_column_values = $this->_set_column_values_for($this->_question_model); |
|
| 407 | + if ($new_question) { |
|
| 408 | + $ID = $this->_question_model->insert($set_column_values); |
|
| 409 | 409 | $success = $ID ? true : false; |
| 410 | 410 | $action_desc = 'added'; |
| 411 | - }else{ |
|
| 412 | - $ID=absint($this->_req_data['QST_ID']); |
|
| 413 | - $pk=$this->_question_model->primary_key_name(); |
|
| 414 | - $wheres=array($pk=>$ID); |
|
| 411 | + } else { |
|
| 412 | + $ID = absint($this->_req_data['QST_ID']); |
|
| 413 | + $pk = $this->_question_model->primary_key_name(); |
|
| 414 | + $wheres = array($pk=>$ID); |
|
| 415 | 415 | unset($set_column_values[$pk]); |
| 416 | - $success= $this->_question_model->update($set_column_values,array($wheres)); |
|
| 417 | - $action_desc='updated'; |
|
| 416 | + $success = $this->_question_model->update($set_column_values, array($wheres)); |
|
| 417 | + $action_desc = 'updated'; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - if ($ID){ |
|
| 420 | + if ($ID) { |
|
| 421 | 421 | //save the related options |
| 422 | 422 | //trash removed options, save old ones |
| 423 | 423 | //get list of all options |
| 424 | 424 | /** @type EE_Question $question */ |
| 425 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
| 426 | - $options=$question->options(); |
|
| 427 | - if(! empty($options)){ |
|
| 428 | - foreach($options as $option_ID=>$option){ |
|
| 429 | - $option_req_index=$this->_get_option_req_data_index($option_ID); |
|
| 430 | - if($option_req_index!==FALSE){ |
|
| 425 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
| 426 | + $options = $question->options(); |
|
| 427 | + if ( ! empty($options)) { |
|
| 428 | + foreach ($options as $option_ID=>$option) { |
|
| 429 | + $option_req_index = $this->_get_option_req_data_index($option_ID); |
|
| 430 | + if ($option_req_index !== FALSE) { |
|
| 431 | 431 | $option->save($this->_req_data['question_options'][$option_req_index]); |
| 432 | - }else{ |
|
| 432 | + } else { |
|
| 433 | 433 | //not found, remove it |
| 434 | 434 | $option->delete(); |
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | //save new related options |
| 439 | - foreach($this->_req_data['question_options'] as $index=>$option_req_data){ |
|
| 440 | - if( empty($option_req_data['QSO_ID'] ) && ( ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it! |
|
| 441 | - if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === '' ){ |
|
| 442 | - $option_req_data['QSO_value']=$option_req_data['QSO_desc']; |
|
| 439 | + foreach ($this->_req_data['question_options'] as $index=>$option_req_data) { |
|
| 440 | + if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it! |
|
| 441 | + if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') { |
|
| 442 | + $option_req_data['QSO_value'] = $option_req_data['QSO_desc']; |
|
| 443 | 443 | } |
| 444 | - $new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
| 444 | + $new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
| 445 | 445 | $new_option->save(); |
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | - $query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID ); |
|
| 450 | - if ( $success !== FALSE ) { |
|
| 451 | - $msg = $new_question ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() ); |
|
| 452 | - EE_Error::add_success( $msg ); |
|
| 449 | + $query_args = array('action' => 'edit_question', 'QST_ID' => $ID); |
|
| 450 | + if ($success !== FALSE) { |
|
| 451 | + $msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name()); |
|
| 452 | + EE_Error::add_success($msg); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - $this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE); |
|
| 455 | + $this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | |
@@ -465,10 +465,10 @@ discard block |
||
| 465 | 465 | * @param int $ID of the question option to find |
| 466 | 466 | * @return int index in question_options array if successful, FALSE if unsuccessful |
| 467 | 467 | */ |
| 468 | - protected function _get_option_req_data_index($ID){ |
|
| 469 | - $req_data_for_question_options=$this->_req_data['question_options']; |
|
| 470 | - foreach($req_data_for_question_options as $num=>$option_data){ |
|
| 471 | - if(array_key_exists('QSO_ID',$option_data) && intval($option_data['QSO_ID'])==$ID){ |
|
| 468 | + protected function _get_option_req_data_index($ID) { |
|
| 469 | + $req_data_for_question_options = $this->_req_data['question_options']; |
|
| 470 | + foreach ($req_data_for_question_options as $num=>$option_data) { |
|
| 471 | + if (array_key_exists('QSO_ID', $option_data) && intval($option_data['QSO_ID']) == $ID) { |
|
| 472 | 472 | return $num; |
| 473 | 473 | } |
| 474 | 474 | } |
@@ -489,25 +489,25 @@ discard block |
||
| 489 | 489 | * @param EEM_Base $model either EEM_Question or EEM_Question_Group |
| 490 | 490 | * @return array lik EEM_Base::get_all's $query_params parameter |
| 491 | 491 | */ |
| 492 | - protected function get_query_params($model, $per_page=10,$current_page=10){ |
|
| 492 | + protected function get_query_params($model, $per_page = 10, $current_page = 10) { |
|
| 493 | 493 | $query_params = array(); |
| 494 | - $offset=($current_page-1)*$per_page; |
|
| 495 | - $query_params['limit']=array($offset,$per_page); |
|
| 496 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
| 494 | + $offset = ($current_page - 1) * $per_page; |
|
| 495 | + $query_params['limit'] = array($offset, $per_page); |
|
| 496 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
| 497 | 497 | $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order'; |
| 498 | 498 | $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby']; |
| 499 | - $query_params['order_by']=array( $field_to_order_by => $order ); |
|
| 500 | - $search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null; |
|
| 501 | - if(! empty($search_string)){ |
|
| 502 | - if($model instanceof EEM_Question_Group){ |
|
| 503 | - $query_params[0]=array( |
|
| 499 | + $query_params['order_by'] = array($field_to_order_by => $order); |
|
| 500 | + $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null; |
|
| 501 | + if ( ! empty($search_string)) { |
|
| 502 | + if ($model instanceof EEM_Question_Group) { |
|
| 503 | + $query_params[0] = array( |
|
| 504 | 504 | 'OR'=>array( |
| 505 | - 'QSG_name'=>array('LIKE',"%$search_string%"), |
|
| 506 | - 'QSG_desc'=>array('LIKE',"%$search_string%")) |
|
| 505 | + 'QSG_name'=>array('LIKE', "%$search_string%"), |
|
| 506 | + 'QSG_desc'=>array('LIKE', "%$search_string%")) |
|
| 507 | 507 | ); |
| 508 | - }else{ |
|
| 509 | - $query_params[0]=array( |
|
| 510 | - 'QST_display_text'=>array('LIKE',"%$search_string%") |
|
| 508 | + } else { |
|
| 509 | + $query_params[0] = array( |
|
| 510 | + 'QST_display_text'=>array('LIKE', "%$search_string%") |
|
| 511 | 511 | ); |
| 512 | 512 | } |
| 513 | 513 | } |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | |
| 551 | 551 | |
| 552 | - public function get_questions( $per_page=10,$current_page = 1, $count = FALSE ) { |
|
| 552 | + public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) { |
|
| 553 | 553 | $QST = EEM_Question::instance(); |
| 554 | 554 | $query_params = $this->get_query_params($QST, $per_page, $current_page); |
| 555 | - if ($count){ |
|
| 556 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
| 555 | + if ($count) { |
|
| 556 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
| 557 | 557 | $results = $QST->count($where); |
| 558 | - }else{ |
|
| 558 | + } else { |
|
| 559 | 559 | $results = $QST->get_all($query_params); |
| 560 | 560 | } |
| 561 | 561 | return $results; |
@@ -564,20 +564,20 @@ discard block |
||
| 564 | 564 | |
| 565 | 565 | |
| 566 | 566 | |
| 567 | - public function get_trashed_questions( $per_page,$current_page = 1, $count = FALSE ) { |
|
| 568 | - $query_params=$this->get_query_params(EEM_Question::instance(),$per_page,$current_page); |
|
| 569 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
| 570 | - $questions=$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
| 567 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
| 568 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
|
| 569 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
| 570 | + $questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
| 571 | 571 | return $questions; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | |
| 575 | 575 | |
| 576 | - public function get_question_groups( $per_page,$current_page = 1, $count = FALSE ) { |
|
| 576 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
| 577 | 577 | /** @type EEM_Question_Group $questionGroupModel */ |
| 578 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
| 579 | - $query_params=$this->get_query_params( $questionGroupModel, $per_page, $current_page ); |
|
| 580 | - $questionGroups=$questionGroupModel->get_all($query_params);//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
|
| 578 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
| 579 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
| 580 | + $questionGroups = $questionGroupModel->get_all($query_params); //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
|
| 581 | 581 | return $questionGroups; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -594,36 +594,36 @@ discard block |
||
| 594 | 594 | |
| 595 | 595 | $this->_template_args['values'] = $this->_yes_no_values; |
| 596 | 596 | |
| 597 | - $this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
| 598 | - $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': ''; |
|
| 597 | + $this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
| 598 | + $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : ''; |
|
| 599 | 599 | |
| 600 | - $this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''; |
|
| 601 | - $this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''; |
|
| 602 | - $this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500; |
|
| 600 | + $this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''; |
|
| 601 | + $this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''; |
|
| 602 | + $this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500; |
|
| 603 | 603 | |
| 604 | 604 | $this->_template_args['recaptcha_theme_options'] = array( |
| 605 | - array('id' => 'red','text'=> __('Red', 'event_espresso')), |
|
| 606 | - array('id' => 'white','text'=> __('White', 'event_espresso')), |
|
| 607 | - array('id' => 'blackglass','text'=> __('Blackglass', 'event_espresso')), |
|
| 608 | - array('id' => 'clean','text'=> __('Clean', 'event_espresso')) |
|
| 605 | + array('id' => 'red', 'text'=> __('Red', 'event_espresso')), |
|
| 606 | + array('id' => 'white', 'text'=> __('White', 'event_espresso')), |
|
| 607 | + array('id' => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')), |
|
| 608 | + array('id' => 'clean', 'text'=> __('Clean', 'event_espresso')) |
|
| 609 | 609 | ); |
| 610 | - $this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean'; |
|
| 610 | + $this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean'; |
|
| 611 | 611 | |
| 612 | 612 | $this->_template_args['recaptcha_language_options'] = array( |
| 613 | - array('id' => 'en','text'=> __('English', 'event_espresso')), |
|
| 614 | - array('id' => 'es','text'=> __('Spanish', 'event_espresso')), |
|
| 615 | - array('id' => 'nl','text'=> __('Dutch', 'event_espresso')), |
|
| 616 | - array('id' => 'fr','text'=> __('French', 'event_espresso')), |
|
| 617 | - array('id' => 'de','text'=> __('German', 'event_espresso')), |
|
| 618 | - array('id' => 'pt','text'=> __('Portuguese', 'event_espresso')), |
|
| 619 | - array('id' => 'ru','text'=> __('Russian', 'event_espresso')), |
|
| 620 | - array('id' => 'tr','text'=> __('Turkish', 'event_espresso')) |
|
| 613 | + array('id' => 'en', 'text'=> __('English', 'event_espresso')), |
|
| 614 | + array('id' => 'es', 'text'=> __('Spanish', 'event_espresso')), |
|
| 615 | + array('id' => 'nl', 'text'=> __('Dutch', 'event_espresso')), |
|
| 616 | + array('id' => 'fr', 'text'=> __('French', 'event_espresso')), |
|
| 617 | + array('id' => 'de', 'text'=> __('German', 'event_espresso')), |
|
| 618 | + array('id' => 'pt', 'text'=> __('Portuguese', 'event_espresso')), |
|
| 619 | + array('id' => 'ru', 'text'=> __('Russian', 'event_espresso')), |
|
| 620 | + array('id' => 'tr', 'text'=> __('Turkish', 'event_espresso')) |
|
| 621 | 621 | ); |
| 622 | - $this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
| 622 | + $this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
| 623 | 623 | |
| 624 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
| 625 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 626 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
| 624 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
| 625 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 626 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
| 627 | 627 | $this->display_admin_page_with_sidebar(); |
| 628 | 628 | } |
| 629 | 629 | |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -328,14 +329,9 @@ discard block |
||
| 328 | 329 | else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
| 329 | 330 | $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
| 330 | 331 | $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
| 331 | - } |
|
| 332 | - |
|
| 333 | - |
|
| 334 | - else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
| 332 | + } else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
| 335 | 333 | $set_column_values[$fieldName] = 0; |
| 336 | - } |
|
| 337 | - |
|
| 338 | - else if ( $fieldName == 'QST_max' ) { |
|
| 334 | + } else if ( $fieldName == 'QST_max' ) { |
|
| 339 | 335 | $qst_system = EEM_Question::instance()->get_var( |
| 340 | 336 | array( |
| 341 | 337 | array( |
@@ -383,7 +379,7 @@ discard block |
||
| 383 | 379 | $question=$this->_question_model->get_one_by_ID($ID); |
| 384 | 380 | $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
| 385 | 381 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
| 386 | - }else{ |
|
| 382 | + } else{ |
|
| 387 | 383 | $question= EE_Question::new_instance(); |
| 388 | 384 | $question->set_order_to_latest(); |
| 389 | 385 | $this->_set_add_edit_form_tags('insert_question'); |
@@ -408,7 +404,7 @@ discard block |
||
| 408 | 404 | $ID=$this->_question_model->insert($set_column_values); |
| 409 | 405 | $success = $ID ? true : false; |
| 410 | 406 | $action_desc = 'added'; |
| 411 | - }else{ |
|
| 407 | + } else{ |
|
| 412 | 408 | $ID=absint($this->_req_data['QST_ID']); |
| 413 | 409 | $pk=$this->_question_model->primary_key_name(); |
| 414 | 410 | $wheres=array($pk=>$ID); |
@@ -429,7 +425,7 @@ discard block |
||
| 429 | 425 | $option_req_index=$this->_get_option_req_data_index($option_ID); |
| 430 | 426 | if($option_req_index!==FALSE){ |
| 431 | 427 | $option->save($this->_req_data['question_options'][$option_req_index]); |
| 432 | - }else{ |
|
| 428 | + } else{ |
|
| 433 | 429 | //not found, remove it |
| 434 | 430 | $option->delete(); |
| 435 | 431 | } |
@@ -505,7 +501,7 @@ discard block |
||
| 505 | 501 | 'QSG_name'=>array('LIKE',"%$search_string%"), |
| 506 | 502 | 'QSG_desc'=>array('LIKE',"%$search_string%")) |
| 507 | 503 | ); |
| 508 | - }else{ |
|
| 504 | + } else{ |
|
| 509 | 505 | $query_params[0]=array( |
| 510 | 506 | 'QST_display_text'=>array('LIKE',"%$search_string%") |
| 511 | 507 | ); |
@@ -555,7 +551,7 @@ discard block |
||
| 555 | 551 | if ($count){ |
| 556 | 552 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
| 557 | 553 | $results = $QST->count($where); |
| 558 | - }else{ |
|
| 554 | + } else{ |
|
| 559 | 555 | $results = $QST->get_all($query_params); |
| 560 | 556 | } |
| 561 | 557 | return $results; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | <tbody> |
| 22 | 22 | <tr> |
| 23 | 23 | <th> |
| 24 | - <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?> |
|
| 24 | + <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?> |
|
| 25 | 25 | </th> |
| 26 | 26 | <td> |
| 27 | 27 | <input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/> |
@@ -31,23 +31,23 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | <tr> |
| 33 | 33 | <th> |
| 34 | - <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?> |
|
| 34 | + <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?> |
|
| 35 | 35 | </th> |
| 36 | 36 | <td> |
| 37 | 37 | <?php |
| 38 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
| 39 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
| 38 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 39 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 40 | 40 | ?> |
| 41 | 41 | <input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/> |
| 42 | 42 | <input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" /> |
| 43 | - <?php if ( ! empty( $QST_system )) { ?> |
|
| 43 | + <?php if ( ! empty($QST_system)) { ?> |
|
| 44 | 44 | <input type="hidden" id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/> |
| 45 | 45 | <?php } ?> |
| 46 | 46 | <br/> |
| 47 | 47 | <p class="description"> |
| 48 | - <?php if ( ! empty( $QST_system )) { ?> |
|
| 48 | + <?php if ( ! empty($QST_system)) { ?> |
|
| 49 | 49 | <span class="description" style="color:#D54E21;"> |
| 50 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
| 50 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
| 51 | 51 | </span> |
| 52 | 52 | <?php } ?> |
| 53 | 53 | |
@@ -57,21 +57,21 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | <tr> |
| 59 | 59 | <th> |
| 60 | - <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?> |
|
| 60 | + <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?> |
|
| 61 | 61 | </th> |
| 62 | 62 | <td> |
| 63 | 63 | <?php |
| 64 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
| 65 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
| 64 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 65 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 66 | 66 | $admin_only = $question->get('QST_admin_only'); |
| 67 | - $checked = !empty( $admin_only ) ? ' checked="checked"' : ''; |
|
| 67 | + $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
| 68 | 68 | ?> |
| 69 | 69 | <input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/> |
| 70 | 70 | <br/> |
| 71 | 71 | <p class="description"> |
| 72 | - <?php if ( ! empty( $QST_system )) { ?> |
|
| 72 | + <?php if ( ! empty($QST_system)) { ?> |
|
| 73 | 73 | <span class="description" style="color:#D54E21;"> |
| 74 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
| 74 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
| 75 | 75 | </span> |
| 76 | 76 | <?php } ?> |
| 77 | 77 | |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | <tr> |
| 83 | 83 | <th> |
| 84 | - <label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?> |
|
| 84 | + <label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?> |
|
| 85 | 85 | </th> |
| 86 | 86 | <td> |
| 87 | 87 | <?php |
| 88 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
| 89 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
| 90 | - echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled ); |
|
| 91 | - if( ! empty( $QST_system ) ) { ?> |
|
| 88 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 89 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 90 | + echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled); |
|
| 91 | + if ( ! empty($QST_system)) { ?> |
|
| 92 | 92 | <input type="hidden" id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/> |
| 93 | 93 | <?php |
| 94 | - $explanatory_text = __('System question! This field cannot be changed.','event_espresso'); |
|
| 95 | - }else{ |
|
| 96 | - $explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso'); |
|
| 94 | + $explanatory_text = __('System question! This field cannot be changed.', 'event_espresso'); |
|
| 95 | + } else { |
|
| 96 | + $explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso'); |
|
| 97 | 97 | } |
| 98 | - if ( ! empty( $QST_system ) || $has_answers ) { ?> |
|
| 98 | + if ( ! empty($QST_system) || $has_answers) { ?> |
|
| 99 | 99 | <p><span class="description" style="color:#D54E21;"> |
| 100 | 100 | <?php echo $explanatory_text; ?> |
| 101 | 101 | </span></p> |
@@ -108,21 +108,21 @@ discard block |
||
| 108 | 108 | <tr id="text_input_question_options"> |
| 109 | 109 | <th> |
| 110 | 110 | <label> |
| 111 | - <?php _e( 'Maximum Allowed Response Size', 'event_espresso' );?> |
|
| 111 | + <?php _e('Maximum Allowed Response Size', 'event_espresso'); ?> |
|
| 112 | 112 | </label> |
| 113 | 113 | </th> |
| 114 | 114 | <td> |
| 115 | - <input id="QST_max" name="QST_max" type="number" <?php echo $max_max == EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>"> |
|
| 115 | + <input id="QST_max" name="QST_max" type="number" <?php echo $max_max == EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>"> |
|
| 116 | 116 | <p> |
| 117 | 117 | <span class="description"> |
| 118 | - <?php _e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?> |
|
| 118 | + <?php _e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?> |
|
| 119 | 119 | </span> |
| 120 | 120 | </p> |
| 121 | 121 | <p> |
| 122 | 122 | <span class="description" style="color:#D54E21;"> |
| 123 | 123 | <?php printf( |
| 124 | - __( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ), |
|
| 125 | - $max_max );?> |
|
| 124 | + __('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'), |
|
| 125 | + $max_max ); ?> |
|
| 126 | 126 | </span> |
| 127 | 127 | </p> |
| 128 | 128 | </td> |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | <tr id="question_options"> |
| 131 | 131 | <th> |
| 132 | 132 | <label> |
| 133 | - <?php _e('Answer Options','event_espresso')?> |
|
| 133 | + <?php _e('Answer Options', 'event_espresso')?> |
|
| 134 | 134 | </label> |
| 135 | 135 | </th> |
| 136 | 136 | <td> |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | <thead> |
| 140 | 140 | <tr> |
| 141 | 141 | <th class="option-value-header"> |
| 142 | - <?php _e('Value','event_espresso')?> |
|
| 142 | + <?php _e('Value', 'event_espresso')?> |
|
| 143 | 143 | </th> |
| 144 | 144 | <th class="option-desc-header"> |
| 145 | - <?php _e('Description (optional, only shown on registration form)','event_espresso')?> |
|
| 145 | + <?php _e('Description (optional, only shown on registration form)', 'event_espresso')?> |
|
| 146 | 146 | </th> |
| 147 | 147 | <th> |
| 148 | 148 | </th> |
@@ -165,17 +165,17 @@ discard block |
||
| 165 | 165 | </tr> |
| 166 | 166 | |
| 167 | 167 | <?php |
| 168 | - $count=0; |
|
| 168 | + $count = 0; |
|
| 169 | 169 | $question_options = $question->options(); |
| 170 | - if ( ! empty( $question_options )) { |
|
| 171 | - foreach( $question_options as $option_id => $option ) { |
|
| 172 | - $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
| 170 | + if ( ! empty($question_options)) { |
|
| 171 | + foreach ($question_options as $option_id => $option) { |
|
| 172 | + $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
| 173 | 173 | ?> |
| 174 | 174 | <tr class="question-option ee-options-sortable"> |
| 175 | 175 | <td class="option-value-cell"> |
| 176 | 176 | <input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>"> |
| 177 | 177 | <input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php $option->f('QSO_value')?>"<?php echo $disabled; ?>> |
| 178 | - <?php if ( $has_answers ) : ?> |
|
| 178 | + <?php if ($has_answers) : ?> |
|
| 179 | 179 | <input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" > |
| 180 | 180 | <?php endif; ?> |
| 181 | 181 | </td> |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | <input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>"> |
| 184 | 184 | </td> |
| 185 | 185 | <td> |
| 186 | - <?php if ( ! $option->system() ) { ?> |
|
| 186 | + <?php if ( ! $option->system()) { ?> |
|
| 187 | 187 | <span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span> |
| 188 | 188 | <?php } ?> |
| 189 | 189 | <span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span> |
@@ -222,13 +222,13 @@ discard block |
||
| 222 | 222 | </table> |
| 223 | 223 | |
| 224 | 224 | <a id="new-question-option" class="button" style="margin:0 0 1em 3px;"> |
| 225 | - <?php _e('Add Another Answer Option','event_espresso')?> |
|
| 225 | + <?php _e('Add Another Answer Option', 'event_espresso')?> |
|
| 226 | 226 | </a><br/> |
| 227 | 227 | |
| 228 | 228 | <p class="description"> |
| 229 | - <?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?> |
|
| 229 | + <?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?> |
|
| 230 | 230 | </p> |
| 231 | - <?php if ( $has_answers ) : ?> |
|
| 231 | + <?php if ($has_answers) : ?> |
|
| 232 | 232 | <p class="description" style="color:#D54E21;"> |
| 233 | 233 | <?php _e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?> |
| 234 | 234 | </p> |
@@ -239,32 +239,32 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | <tr> |
| 241 | 241 | <th> |
| 242 | - <label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?> |
|
| 242 | + <label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?> |
|
| 243 | 243 | </th> |
| 244 | 244 | <td> |
| 245 | 245 | <?php |
| 246 | - $system_required = array( 'fname', 'email' ); |
|
| 247 | - $disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : ''; |
|
| 246 | + $system_required = array('fname', 'email'); |
|
| 247 | + $disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
| 248 | 248 | $required_on = $question->get('QST_admin_only'); |
| 249 | 249 | $show_required_msg = $required_on ? '' : ' display:none;'; |
| 250 | - $disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : ''; |
|
| 251 | - $id = ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : ''; |
|
| 252 | - $requiredOptions=array( |
|
| 253 | - array('text'=>'Optional','id'=>0), |
|
| 254 | - array('text'=>'Required','id'=>1) |
|
| 250 | + $disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : ''; |
|
| 251 | + $id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
| 252 | + $requiredOptions = array( |
|
| 253 | + array('text'=>'Optional', 'id'=>0), |
|
| 254 | + array('text'=>'Required', 'id'=>1) |
|
| 255 | 255 | ); |
| 256 | - echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled ); |
|
| 256 | + echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled); |
|
| 257 | 257 | ?> |
| 258 | 258 | <p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>"> |
| 259 | - <?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?> |
|
| 259 | + <?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?> |
|
| 260 | 260 | </span></p> |
| 261 | 261 | <p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
| 262 | - <?php _e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?> |
|
| 262 | + <?php _e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?> |
|
| 263 | 263 | </span></p> |
| 264 | - <?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?> |
|
| 264 | + <?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?> |
|
| 265 | 265 | <input type="hidden" id="QST_required" name="QST_required" value="1"/> |
| 266 | 266 | <p><span class="description" style="color:#D54E21;"> |
| 267 | - <?php _e('System question! This field cannot be changed.','event_espresso')?> |
|
| 267 | + <?php _e('System question! This field cannot be changed.', 'event_espresso')?> |
|
| 268 | 268 | </span></p> |
| 269 | 269 | <?php } ?> |
| 270 | 270 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | <tr> |
| 275 | 275 | <th> |
| 276 | - <label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?> |
|
| 276 | + <label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
| 277 | 277 | </th> |
| 278 | 278 | <td> |
| 279 | 279 | <input type="text" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php $question->f('QST_required_text')?>"/> |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | //(all other times it gets resurrected from a wordpress option) |
| 14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
| 15 | 15 | $class_to_filepath = array(); |
| 16 | -foreach($stages as $filepath){ |
|
| 16 | +foreach ($stages as $filepath) { |
|
| 17 | 17 | $matches = array(); |
| 18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
| 18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
| 20 | 20 | } |
| 21 | 21 | //give addons a chance to autoload their stages too |
| 22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
| 22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
| 23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
| 24 | 24 | |
| 25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @since 4.6.0 |
| 36 | 36 | * |
| 37 | 37 | */ |
| 38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
| 38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function can_migrate_from_version($version_array) { |
| 64 | 64 | $version_string = $version_array['Core']; |
| 65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
| 65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
| 66 | 66 | // echo "$version_string can be migrated from"; |
| 67 | 67 | return true; |
| 68 | - }elseif( ! $version_string ){ |
|
| 68 | + }elseif ( ! $version_string) { |
|
| 69 | 69 | // echo "no version string provided: $version_string"; |
| 70 | 70 | //no version string provided... this must be pre 4.3 |
| 71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
| 72 | - }else{ |
|
| 71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
| 72 | + } else { |
|
| 73 | 73 | // echo "$version_string doesnt apply"; |
| 74 | 74 | return false; |
| 75 | 75 | } |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | * @return bool |
| 91 | 91 | */ |
| 92 | 92 | public function schema_changes_before_migration() { |
| 93 | - $now_in_mysql = current_time( 'mysql', true ); |
|
| 93 | + $now_in_mysql = current_time('mysql', true); |
|
| 94 | 94 | |
| 95 | - $table_name='esp_answer'; |
|
| 96 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 95 | + $table_name = 'esp_answer'; |
|
| 96 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 97 | 97 | REG_ID INT UNSIGNED NOT NULL, |
| 98 | 98 | QST_ID INT UNSIGNED NOT NULL, |
| 99 | 99 | ANS_value TEXT NOT NULL, |
| 100 | 100 | PRIMARY KEY (ANS_ID)"; |
| 101 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 101 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 102 | 102 | |
| 103 | 103 | $table_name = 'esp_attendee_meta'; |
| 104 | 104 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | CNT_is_EU TINYINT(1) DEFAULT '0', |
| 138 | 138 | CNT_active TINYINT(1) DEFAULT '0', |
| 139 | 139 | PRIMARY KEY (CNT_ISO)"; |
| 140 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
| 140 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 141 | 141 | |
| 142 | 142 | $table_name = 'esp_currency'; |
| 143 | 143 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
| 148 | 148 | CUR_active TINYINT(1) DEFAULT '0', |
| 149 | 149 | PRIMARY KEY (CUR_code)"; |
| 150 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
| 150 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | $table_name = 'esp_currency_payment_method'; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | |
| 179 | 179 | |
| 180 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
| 180 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 181 | 181 | $table_name = 'esp_event_meta'; |
| 182 | 182 | $sql = " |
| 183 | 183 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -194,41 +194,41 @@ discard block |
||
| 194 | 194 | EVT_external_URL VARCHAR(200) NULL, |
| 195 | 195 | EVT_donations TINYINT(1) NULL, |
| 196 | 196 | PRIMARY KEY (EVTM_ID)"; |
| 197 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 197 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | |
| 201 | - $table_name='esp_event_question_group'; |
|
| 202 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 201 | + $table_name = 'esp_event_question_group'; |
|
| 202 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 203 | 203 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
| 204 | 204 | QSG_ID INT UNSIGNED NOT NULL, |
| 205 | 205 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
| 206 | 206 | PRIMARY KEY (EQG_ID)"; |
| 207 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 207 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 208 | 208 | |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - $table_name='esp_event_venue'; |
|
| 212 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
| 211 | + $table_name = 'esp_event_venue'; |
|
| 212 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
| 213 | 213 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
| 214 | 214 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
| 215 | 215 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
| 216 | 216 | PRIMARY KEY (EVV_ID)"; |
| 217 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 217 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | |
| 221 | - $table_name='esp_extra_meta'; |
|
| 222 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
| 221 | + $table_name = 'esp_extra_meta'; |
|
| 222 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
| 223 | 223 | OBJ_ID INT(11) DEFAULT NULL, |
| 224 | 224 | EXM_type VARCHAR(45) DEFAULT NULL, |
| 225 | 225 | EXM_key VARCHAR(45) DEFAULT NULL, |
| 226 | 226 | EXM_value TEXT, |
| 227 | 227 | PRIMARY KEY (EXM_ID)"; |
| 228 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 228 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 229 | 229 | |
| 230 | - $table_name='esp_line_item'; |
|
| 231 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
| 230 | + $table_name = 'esp_line_item'; |
|
| 231 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
| 232 | 232 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
| 233 | 233 | TXN_ID INT(11) DEFAULT NULL, |
| 234 | 234 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | OBJ_type VARCHAR(45)DEFAULT NULL, |
| 246 | 246 | LIN_timestamp DATETIME NOT NULL DEFAULT '$now_in_mysql', |
| 247 | 247 | PRIMARY KEY (LIN_ID)"; |
| 248 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
| 248 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 249 | 249 | |
| 250 | 250 | $table_name = 'esp_log'; |
| 251 | 251 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | KEY GRP_ID (GRP_ID)"; |
| 269 | 269 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
| 270 | 270 | |
| 271 | - EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' ); |
|
| 271 | + EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID'); |
|
| 272 | 272 | |
| 273 | 273 | $table_name = 'esp_message_template_group'; |
| 274 | 274 | $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
| 284 | 284 | PRIMARY KEY (GRP_ID), |
| 285 | 285 | KEY MTP_user_id (MTP_user_id)"; |
| 286 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
| 286 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 287 | 287 | |
| 288 | 288 | $table_name = 'esp_event_message_template'; |
| 289 | 289 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | PRIMARY KEY (EMT_ID), |
| 293 | 293 | KEY EVT_ID (EVT_ID), |
| 294 | 294 | KEY GRP_ID (GRP_ID)"; |
| 295 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
| 295 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 296 | 296 | |
| 297 | 297 | |
| 298 | 298 | $table_name = 'esp_payment'; |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | PRIMARY KEY (TTM_ID)"; |
| 361 | 361 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
| 362 | 362 | |
| 363 | - $table_name='esp_question'; |
|
| 364 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 363 | + $table_name = 'esp_question'; |
|
| 364 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 365 | 365 | QST_display_text TEXT NOT NULL, |
| 366 | 366 | QST_admin_label VARCHAR(255) NOT NULL, |
| 367 | 367 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -374,20 +374,20 @@ discard block |
||
| 374 | 374 | QST_wp_user BIGINT UNSIGNED NULL, |
| 375 | 375 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
| 376 | 376 | PRIMARY KEY (QST_ID)'; |
| 377 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 377 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 378 | 378 | |
| 379 | - $table_name='esp_question_group_question'; |
|
| 380 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 379 | + $table_name = 'esp_question_group_question'; |
|
| 380 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 381 | 381 | QSG_ID INT UNSIGNED NOT NULL, |
| 382 | 382 | QST_ID INT UNSIGNED NOT NULL, |
| 383 | 383 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
| 384 | 384 | PRIMARY KEY (QGQ_ID) "; |
| 385 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 385 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 386 | 386 | |
| 387 | 387 | |
| 388 | 388 | |
| 389 | - $table_name='esp_question_option'; |
|
| 390 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 389 | + $table_name = 'esp_question_option'; |
|
| 390 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 391 | 391 | QSO_value VARCHAR(255) NOT NULL, |
| 392 | 392 | QSO_desc TEXT NOT NULL, |
| 393 | 393 | QST_ID INT UNSIGNED NOT NULL, |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | QSO_system VARCHAR(25) DEFAULT NULL, |
| 396 | 396 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
| 397 | 397 | PRIMARY KEY (QSO_ID)"; |
| 398 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 398 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 399 | 399 | |
| 400 | 400 | |
| 401 | 401 | |
@@ -441,8 +441,8 @@ discard block |
||
| 441 | 441 | |
| 442 | 442 | |
| 443 | 443 | |
| 444 | - $table_name='esp_checkin'; |
|
| 445 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 444 | + $table_name = 'esp_checkin'; |
|
| 445 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 446 | 446 | REG_ID INT(10) UNSIGNED NOT NULL, |
| 447 | 447 | DTT_ID INT(10) UNSIGNED NOT NULL, |
| 448 | 448 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | PRC_wp_user BIGINT UNSIGNED NULL, |
| 532 | 532 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
| 533 | 533 | PRIMARY KEY (PRC_ID)"; |
| 534 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
| 534 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 535 | 535 | |
| 536 | 536 | $table_name = "esp_price_type"; |
| 537 | 537 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -568,12 +568,12 @@ discard block |
||
| 568 | 568 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
| 569 | 569 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
| 570 | 570 | PRIMARY KEY (TKT_ID)"; |
| 571 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
| 571 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 572 | 572 | |
| 573 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
| 573 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
| 574 | 574 | |
| 575 | 575 | $table_name = 'esp_question_group'; |
| 576 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 576 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
| 577 | 577 | QSG_name VARCHAR(255) NOT NULL, |
| 578 | 578 | QSG_identifier VARCHAR(100) NOT NULL, |
| 579 | 579 | QSG_desc TEXT NULL, |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | QSG_wp_user BIGINT UNSIGNED NULL, |
| 586 | 586 | PRIMARY KEY (QSG_ID), |
| 587 | 587 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
| 588 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
| 588 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 589 | 589 | |
| 590 | 590 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
| 591 | 591 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | return $script_4_7_defaults->schema_changes_after_migration(); |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - public function migration_page_hooks(){ |
|
| 624 | + public function migration_page_hooks() { |
|
| 625 | 625 | |
| 626 | 626 | } |
| 627 | 627 | |
@@ -635,19 +635,19 @@ discard block |
||
| 635 | 635 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
| 636 | 636 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
| 637 | 637 | $newer_countries = array( |
| 638 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
| 639 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
| 640 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
| 641 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
| 642 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
| 643 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
| 644 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
| 645 | - array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
| 646 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
| 647 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
| 648 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
| 649 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
| 650 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
| 638 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
| 639 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
| 640 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
| 641 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
| 642 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
| 643 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
| 644 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
| 645 | + array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
| 646 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
| 647 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
| 648 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
| 649 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
| 650 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
| 651 | 651 | ); |
| 652 | 652 | global $wpdb; |
| 653 | 653 | $country_table = $wpdb->prefix."esp_country"; |
@@ -666,14 +666,14 @@ discard block |
||
| 666 | 666 | "CNT_is_EU" => '%d', |
| 667 | 667 | "CNT_active" => '%d', |
| 668 | 668 | ); |
| 669 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) { |
|
| 670 | - foreach( $newer_countries as $country ) { |
|
| 671 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
| 669 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) { |
|
| 670 | + foreach ($newer_countries as $country) { |
|
| 671 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
| 672 | 672 | $countries = $wpdb->get_var($SQL); |
| 673 | - if ( ! $countries ) { |
|
| 673 | + if ( ! $countries) { |
|
| 674 | 674 | |
| 675 | - $wpdb->insert( $country_table, |
|
| 676 | - array_combine( array_keys( $country_format), $country ), |
|
| 675 | + $wpdb->insert($country_table, |
|
| 676 | + array_combine(array_keys($country_format), $country), |
|
| 677 | 677 | $country_format |
| 678 | 678 | ); |
| 679 | 679 | } |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
| 692 | 692 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
| 693 | 693 | $newer_currencies = array( |
| 694 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
| 694 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
| 695 | 695 | ); |
| 696 | 696 | global $wpdb; |
| 697 | 697 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -703,14 +703,14 @@ discard block |
||
| 703 | 703 | "CUR_dec_plc" => '%d', |
| 704 | 704 | "CUR_active" => '%d', |
| 705 | 705 | ); |
| 706 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) { |
|
| 707 | - foreach( $newer_currencies as $currency ) { |
|
| 708 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
| 706 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) { |
|
| 707 | + foreach ($newer_currencies as $currency) { |
|
| 708 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
| 709 | 709 | $countries = $wpdb->get_var($SQL); |
| 710 | - if ( ! $countries ) { |
|
| 710 | + if ( ! $countries) { |
|
| 711 | 711 | |
| 712 | - $wpdb->insert( $currency_table, |
|
| 713 | - array_combine( array_keys( $currency_format), $currency ), |
|
| 712 | + $wpdb->insert($currency_table, |
|
| 713 | + array_combine(array_keys($currency_format), $currency), |
|
| 714 | 714 | $currency_format |
| 715 | 715 | ); |
| 716 | 716 | } |
@@ -722,9 +722,9 @@ discard block |
||
| 722 | 722 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
| 723 | 723 | * we should be able to stop doing this in 4.9 |
| 724 | 724 | */ |
| 725 | - public function fix_non_default_taxes(){ |
|
| 725 | + public function fix_non_default_taxes() { |
|
| 726 | 726 | global $wpdb; |
| 727 | - $query = $wpdb->prepare( "UPDATE |
|
| 727 | + $query = $wpdb->prepare("UPDATE |
|
| 728 | 728 | {$wpdb->prefix}esp_price p INNER JOIN |
| 729 | 729 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
| 730 | 730 | SET |
@@ -732,8 +732,8 @@ discard block |
||
| 732 | 732 | WHERE |
| 733 | 733 | p.PRC_is_default = 0 AND |
| 734 | 734 | pt.PBT_ID = %d |
| 735 | - ", EEM_Price_Type::base_type_tax ); |
|
| 736 | - $wpdb->query( $query ); |
|
| 735 | + ", EEM_Price_Type::base_type_tax); |
|
| 736 | + $wpdb->query($query); |
|
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | 739 | |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * ------------------------------------------------------------------------ |
| 23 | 23 | */ |
| 24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
| 25 | -require_once( EE_CLASSES . 'EE_Question.class.php'); |
|
| 24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
| 25 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
| 26 | 26 | |
| 27 | 27 | class EEM_Question extends EEM_Soft_Delete_Base { |
| 28 | 28 | |
@@ -69,21 +69,21 @@ discard block |
||
| 69 | 69 | // private instance of the Attendee object |
| 70 | 70 | protected static $_instance = NULL; |
| 71 | 71 | |
| 72 | - protected function __construct( $timezone = NULL ) { |
|
| 73 | - $this->singular_item = __('Question','event_espresso'); |
|
| 74 | - $this->plural_item = __('Questions','event_espresso'); |
|
| 75 | - $this->_allowed_question_types=apply_filters( |
|
| 72 | + protected function __construct($timezone = NULL) { |
|
| 73 | + $this->singular_item = __('Question', 'event_espresso'); |
|
| 74 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
| 75 | + $this->_allowed_question_types = apply_filters( |
|
| 76 | 76 | 'FHEE__EEM_Question__construct__allowed_question_types', |
| 77 | 77 | array( |
| 78 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
| 79 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
| 80 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
| 81 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
| 82 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
| 83 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
| 84 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
| 85 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
| 86 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
| 78 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
| 79 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
| 80 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
| 81 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
| 82 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
| 83 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
| 84 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
| 85 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
| 86 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
| 87 | 87 | ) |
| 88 | 88 | ); |
| 89 | 89 | $this->_question_type_categories = apply_filters( |
@@ -102,22 +102,22 @@ discard block |
||
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | 104 | $this->_tables = array( |
| 105 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
| 105 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
| 106 | 106 | ); |
| 107 | 107 | $this->_fields = array( |
| 108 | 108 | 'Question'=>array( |
| 109 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
| 110 | - 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
| 111 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
| 112 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ), |
|
| 113 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
| 114 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
| 115 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
| 116 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
| 117 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
| 118 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
| 119 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
| 120 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
| 109 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
| 110 | + 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
| 111 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
| 112 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL), |
|
| 113 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
| 114 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
| 115 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
| 116 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
| 117 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
| 118 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
| 119 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
| 120 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
| 121 | 121 | ) |
| 122 | 122 | ); |
| 123 | 123 | $this->_model_relations = array( |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
| 130 | 130 | ); |
| 131 | 131 | //this model is generally available for reading |
| 132 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
| 133 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
| 134 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
| 135 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
| 136 | - parent::__construct( $timezone ); |
|
| 132 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
| 133 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
| 134 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
| 135 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
| 136 | + parent::__construct($timezone); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * but they can be extended |
| 142 | 142 | * @return string[] |
| 143 | 143 | */ |
| 144 | - public function allowed_question_types(){ |
|
| 144 | + public function allowed_question_types() { |
|
| 145 | 145 | return $this->_allowed_question_types; |
| 146 | 146 | } |
| 147 | 147 | /** |
@@ -149,16 +149,16 @@ discard block |
||
| 149 | 149 | * @param string $question_type one of EEM_Question::allowed_question_types( |
| 150 | 150 | * @return string[] like EEM_Question::allowed_question_types() |
| 151 | 151 | */ |
| 152 | - public function question_types_in_same_category( $question_type ) { |
|
| 153 | - $question_types = array( $question_type ); |
|
| 154 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
| 155 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
| 152 | + public function question_types_in_same_category($question_type) { |
|
| 153 | + $question_types = array($question_type); |
|
| 154 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
| 155 | + if (in_array($question_type, $question_types_in_category)) { |
|
| 156 | 156 | $question_types = $question_types_in_category; |
| 157 | 157 | break; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
| 161 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
| 168 | 168 | * @return boolean |
| 169 | 169 | */ |
| 170 | - public function question_type_is_in_category( $question_type, $category ) { |
|
| 171 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
| 170 | + public function question_type_is_in_category($question_type, $category) { |
|
| 171 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
| 174 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | * @param string $system_question_group_id QSG_system |
| 189 | 189 | * @return array of system question names (QST_system) |
| 190 | 190 | */ |
| 191 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
| 191 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
| 192 | 192 | $question_system_ids = array(); |
| 193 | - switch( $system_question_group_id ) { |
|
| 193 | + switch ($system_question_group_id) { |
|
| 194 | 194 | case EEM_Question_Group::system_personal: |
| 195 | 195 | $question_system_ids = array( |
| 196 | 196 | EEM_Attendee::system_question_fname, |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | ); |
| 212 | 212 | break; |
| 213 | 213 | } |
| 214 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
| 214 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | * @param string $system_question_group_id QSG_system |
| 221 | 221 | * @return array of system question names (QST_system) |
| 222 | 222 | */ |
| 223 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
| 223 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
| 224 | 224 | $question_system_ids = null; |
| 225 | - switch( $system_question_group_id ) { |
|
| 225 | + switch ($system_question_group_id) { |
|
| 226 | 226 | case EEM_Question_Group::system_personal: |
| 227 | - $question_system_ids = array( |
|
| 227 | + $question_system_ids = array( |
|
| 228 | 228 | EEM_Attendee::system_question_fname, |
| 229 | 229 | EEM_Attendee::system_question_email, |
| 230 | 230 | ); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | default: |
| 233 | 233 | $question_system_ids = array(); |
| 234 | 234 | } |
| 235 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
| 235 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | * @param $QST_system |
| 244 | 244 | * @return int of QST_ID for the question that corresponds to that QST_system |
| 245 | 245 | */ |
| 246 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
| 247 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
| 246 | + public function get_Question_ID_from_system_string($QST_system) { |
|
| 247 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public function get_latest_question_order() { |
| 258 | 258 | $columns_to_select = array( |
| 259 | - 'max_order' => array("MAX(QST_order)","%d") |
|
| 259 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
| 260 | 260 | ); |
| 261 | - $max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
| 261 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
| 262 | 262 | return $max[0]['max_order']; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -288,10 +288,10 @@ discard block |
||
| 288 | 288 | * @param string $system_question_value |
| 289 | 289 | * @return int|float |
| 290 | 290 | */ |
| 291 | - public function max_max_for_system_question( $system_question_value ) { |
|
| 291 | + public function max_max_for_system_question($system_question_value) { |
|
| 292 | 292 | $maxes = $this->system_question_maxes(); |
| 293 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
| 294 | - return $maxes[ $system_question_value ]; |
|
| 293 | + if (isset($maxes[$system_question_value])) { |
|
| 294 | + return $maxes[$system_question_value]; |
|
| 295 | 295 | } else { |
| 296 | 296 | return EE_INF; |
| 297 | 297 | } |
@@ -8,36 +8,36 @@ |
||
| 8 | 8 | * @subpackage Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php. |
| 9 | 9 | * @author Mike Nelson |
| 10 | 10 | */ |
| 11 | -class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
| 11 | +class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
| 12 | 12 | |
| 13 | 13 | protected $_max_length; |
| 14 | 14 | |
| 15 | - public function __construct( $validation_error_message = NULL, $max_length = EE_INF ) { |
|
| 15 | + public function __construct($validation_error_message = NULL, $max_length = EE_INF) { |
|
| 16 | 16 | $this->_max_length = $max_length; |
| 17 | - if( $validation_error_message === null ) { |
|
| 18 | - $validation_error_message = sprintf( __( 'Input is too long. Maximum number of characters is %1$s', 'event_espresso' ), $max_length ); |
|
| 17 | + if ($validation_error_message === null) { |
|
| 18 | + $validation_error_message = sprintf(__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length); |
|
| 19 | 19 | } |
| 20 | - parent::__construct( $validation_error_message ); |
|
| 20 | + parent::__construct($validation_error_message); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @param $normalized_value |
| 25 | 25 | */ |
| 26 | 26 | public function validate($normalized_value) { |
| 27 | - if( $this->_max_length !== EE_INF && |
|
| 27 | + if ($this->_max_length !== EE_INF && |
|
| 28 | 28 | $normalized_value && |
| 29 | - is_string( $normalized_value ) && |
|
| 30 | - strlen( $normalized_value ) > $this->_max_length){ |
|
| 31 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'maxlength' ); |
|
| 29 | + is_string($normalized_value) && |
|
| 30 | + strlen($normalized_value) > $this->_max_length) { |
|
| 31 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength'); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @return array |
| 37 | 37 | */ |
| 38 | - function get_jquery_validation_rule_array(){ |
|
| 39 | - if( $this->_max_length !== EE_INF ) { |
|
| 40 | - return array( 'maxlength'=> $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) ); |
|
| 38 | + function get_jquery_validation_rule_array() { |
|
| 39 | + if ($this->_max_length !== EE_INF) { |
|
| 40 | + return array('maxlength'=> $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message())); |
|
| 41 | 41 | } else { |
| 42 | 42 | return array(); |
| 43 | 43 | } |