@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('ABSPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /* |
| 5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | -if ( function_exists( 'espresso_version' ) ) { |
|
| 45 | +if (function_exists('espresso_version')) { |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | function espresso_duplicate_plugin_error() { |
| 52 | 52 | ?> |
| 53 | 53 | <div class="error"> |
| 54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
| 54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
| 55 | 55 | </div> |
| 56 | 56 | <?php |
| 57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
| 57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 58 | 58 | } |
| 59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
| 59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 60 | 60 | |
| 61 | 61 | } else { |
| 62 | 62 | |
@@ -67,103 +67,103 @@ discard block |
||
| 67 | 67 | * @return string |
| 68 | 68 | */ |
| 69 | 69 | function espresso_version() { |
| 70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.13.rc.014' ); |
|
| 70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.13.rc.014'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // define versions |
| 74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
| 75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
| 76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
| 77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
| 78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
| 79 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
| 80 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
| 74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
| 75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
| 76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
| 77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
| 78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
| 79 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
| 80 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 81 | 81 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
| 82 | - if ( ! defined( 'DS' ) ) { |
|
| 83 | - define( 'DS', '/' ); |
|
| 82 | + if ( ! defined('DS')) { |
|
| 83 | + define('DS', '/'); |
|
| 84 | 84 | } |
| 85 | - if ( ! defined( 'PS' ) ) { |
|
| 86 | - define( 'PS', PATH_SEPARATOR ); |
|
| 85 | + if ( ! defined('PS')) { |
|
| 86 | + define('PS', PATH_SEPARATOR); |
|
| 87 | 87 | } |
| 88 | - if ( ! defined( 'SP' ) ) { |
|
| 89 | - define( 'SP', ' ' ); |
|
| 88 | + if ( ! defined('SP')) { |
|
| 89 | + define('SP', ' '); |
|
| 90 | 90 | } |
| 91 | - if ( ! defined( 'EENL' ) ) { |
|
| 92 | - define( 'EENL', "\n" ); |
|
| 91 | + if ( ! defined('EENL')) { |
|
| 92 | + define('EENL', "\n"); |
|
| 93 | 93 | } |
| 94 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
| 94 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
| 95 | 95 | // define the plugin directory and URL |
| 96 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 97 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 98 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 96 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 97 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 98 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 99 | 99 | // main root folder paths |
| 100 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
| 101 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
| 102 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
| 103 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
| 104 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
| 105 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
| 106 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
| 107 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
| 100 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
| 101 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
| 102 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
| 103 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
| 104 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
| 105 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
| 106 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
| 107 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
| 108 | 108 | // core system paths |
| 109 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
| 110 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
| 111 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
| 112 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
| 113 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
| 114 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
| 115 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
| 116 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
| 117 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
| 118 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
| 119 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
| 120 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
| 109 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
| 110 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
| 111 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
| 112 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
| 113 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
| 114 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
| 115 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
| 116 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
| 117 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
| 118 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
| 119 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
| 120 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
| 121 | 121 | // gateways |
| 122 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
| 123 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
| 122 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
| 123 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
| 124 | 124 | // asset URL paths |
| 125 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
| 126 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
| 127 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
| 128 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
| 129 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
| 130 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
| 125 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
| 126 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
| 127 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
| 128 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
| 129 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
| 130 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
| 131 | 131 | // define upload paths |
| 132 | 132 | $uploads = wp_upload_dir(); |
| 133 | 133 | // define the uploads directory and URL |
| 134 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
| 135 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
| 134 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
| 135 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
| 136 | 136 | // define the templates directory and URL |
| 137 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
| 138 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
| 137 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
| 138 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
| 139 | 139 | // define the gateway directory and URL |
| 140 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
| 141 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
| 140 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
| 141 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
| 142 | 142 | // languages folder/path |
| 143 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
| 144 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
| 143 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
| 144 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
| 145 | 145 | //check for dompdf fonts in uploads |
| 146 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
| 147 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
| 146 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
| 147 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
| 148 | 148 | } |
| 149 | 149 | //ajax constants |
| 150 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
| 151 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
| 150 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
| 151 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
| 152 | 152 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
| 153 | 153 | //you're better to use this than its straight value (currently -1) in case you ever |
| 154 | 154 | //want to change its default value! or find when -1 means infinity |
| 155 | - define( 'EE_INF_IN_DB', -1 ); |
|
| 156 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
| 157 | - define( 'EE_DEBUG', false ); |
|
| 155 | + define('EE_INF_IN_DB', -1); |
|
| 156 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
| 157 | + define('EE_DEBUG', false); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * espresso_plugin_activation |
| 161 | 161 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
| 162 | 162 | */ |
| 163 | 163 | function espresso_plugin_activation() { |
| 164 | - update_option( 'ee_espresso_activation', true ); |
|
| 164 | + update_option('ee_espresso_activation', true); |
|
| 165 | 165 | } |
| 166 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
| 166 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // } |
| 178 | 178 | // |
| 179 | 179 | } |
| 180 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
| 180 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | |
@@ -187,15 +187,15 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function espresso_load_error_handling() { |
| 189 | 189 | // load debugging tools |
| 190 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
| 191 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
| 190 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
| 191 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
| 192 | 192 | EEH_Debug_Tools::instance(); |
| 193 | 193 | } |
| 194 | 194 | // load error handling |
| 195 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
| 196 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
| 195 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
| 196 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
| 197 | 197 | } else { |
| 198 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
| 198 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -209,25 +209,25 @@ discard block |
||
| 209 | 209 | * @param string $full_path_to_file |
| 210 | 210 | * @throws EE_Error |
| 211 | 211 | */ |
| 212 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
| 212 | + function espresso_load_required($classname, $full_path_to_file) { |
|
| 213 | 213 | static $error_handling_loaded = false; |
| 214 | - if ( ! $error_handling_loaded ) { |
|
| 214 | + if ( ! $error_handling_loaded) { |
|
| 215 | 215 | espresso_load_error_handling(); |
| 216 | 216 | $error_handling_loaded = true; |
| 217 | 217 | } |
| 218 | - if ( is_readable( $full_path_to_file ) ) { |
|
| 219 | - require_once( $full_path_to_file ); |
|
| 218 | + if (is_readable($full_path_to_file)) { |
|
| 219 | + require_once($full_path_to_file); |
|
| 220 | 220 | } else { |
| 221 | - throw new EE_Error ( sprintf( |
|
| 222 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
| 221 | + throw new EE_Error(sprintf( |
|
| 222 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
| 223 | 223 | $classname |
| 224 | - ) ); |
|
| 224 | + )); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
| 229 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
| 230 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
| 228 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
| 229 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
| 230 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
| 231 | 231 | new EE_Bootstrap(); |
| 232 | 232 | |
| 233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | |
| 239 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
| 239 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
| 240 | 240 | /** |
| 241 | 241 | * deactivate_plugin |
| 242 | 242 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
| 246 | 246 | * @return void |
| 247 | 247 | */ |
| 248 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
| 249 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
| 250 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
| 248 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
| 249 | + if ( ! function_exists('deactivate_plugins')) { |
|
| 250 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 251 | 251 | } |
| 252 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
| 253 | - deactivate_plugins( $plugin_basename ); |
|
| 252 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
| 253 | + deactivate_plugins($plugin_basename); |
|
| 254 | 254 | } |
| 255 | 255 | } |
@@ -65,15 +65,15 @@ discard block |
||
| 65 | 65 | * @return EED_Ticket_Selector |
| 66 | 66 | */ |
| 67 | 67 | public static function instance() { |
| 68 | - return parent::get_instance( __CLASS__ ); |
|
| 68 | + return parent::get_instance(__CLASS__); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | - protected function set_config(){ |
|
| 74 | - $this->set_config_section( 'template_settings' ); |
|
| 75 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
| 76 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
| 73 | + protected function set_config() { |
|
| 74 | + $this->set_config_section('template_settings'); |
|
| 75 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
| 76 | + $this->set_config_name('EED_Ticket_Selector'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public static function set_hooks() { |
| 90 | 90 | // routing |
| 91 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
| 92 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
| 93 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
| 91 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
| 92 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
| 93 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
| 94 | 94 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
| 95 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
| 95 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
| 96 | 96 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
| 97 | 97 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
| 98 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
| 98 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | * @return void |
| 108 | 108 | */ |
| 109 | 109 | public static function set_hooks_admin() { |
| 110 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
| 110 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
| 111 | 111 | //add button for iframe code to event editor. |
| 112 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
| 113 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
| 112 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
| 113 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -122,15 +122,15 @@ discard block |
||
| 122 | 122 | * @return void |
| 123 | 123 | */ |
| 124 | 124 | public static function set_definitions() { |
| 125 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
| 126 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
| 125 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
| 126 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
| 127 | 127 | |
| 128 | 128 | //if config is not set, initialize |
| 129 | 129 | //If config is not set, set it. |
| 130 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
| 130 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
| 131 | 131 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
| 132 | 132 | } |
| 133 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
| 133 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @param object $WP |
| 142 | 142 | * @return void |
| 143 | 143 | */ |
| 144 | - public function run( $WP ) {} |
|
| 144 | + public function run($WP) {} |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -153,23 +153,23 @@ discard block |
||
| 153 | 153 | public function ticket_selector_iframe() { |
| 154 | 154 | self::$_in_iframe = true; |
| 155 | 155 | /** @type EEM_Event $EEM_Event */ |
| 156 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
| 156 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
| 157 | 157 | $event = $EEM_Event->get_one_by_ID( |
| 158 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
| 158 | + EE_Registry::instance()->REQ->get('event', 0) |
|
| 159 | 159 | ); |
| 160 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
| 161 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
| 160 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
| 161 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
| 162 | 162 | $template_args['css'] = apply_filters( |
| 163 | 163 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
| 164 | 164 | array( |
| 165 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
| 166 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
| 167 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
| 168 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
| 165 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
| 166 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
| 167 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
| 168 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
| 169 | 169 | ) |
| 170 | 170 | ); |
| 171 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
| 172 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = esc_html__( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
| 171 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
| 172 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = esc_html__('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
| 173 | 173 | $template_args['eei18n'] = apply_filters( |
| 174 | 174 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
| 175 | 175 | EE_Registry::localize_i18n_js_strings() |
@@ -178,18 +178,18 @@ discard block |
||
| 178 | 178 | $template_args['js'] = apply_filters( |
| 179 | 179 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
| 180 | 180 | array( |
| 181 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
| 182 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
| 183 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
| 181 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
| 182 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
| 183 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
| 184 | 184 | ) |
| 185 | 185 | ); |
| 186 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
| 187 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
| 186 | + $template_args['notices'] = EEH_Template::display_template( |
|
| 187 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
| 188 | 188 | array(), |
| 189 | 189 | true |
| 190 | 190 | ); |
| 191 | 191 | EEH_Template::display_template( |
| 192 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
| 192 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
| 193 | 193 | $template_args |
| 194 | 194 | ); |
| 195 | 195 | exit; |
@@ -208,25 +208,25 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return string The new html string for the permalink area. |
| 210 | 210 | */ |
| 211 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
| 211 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
| 212 | 212 | //make sure this is ONLY when editing and the event id has been set. |
| 213 | - if ( ! empty( $id ) ) { |
|
| 214 | - $post = get_post( $id ); |
|
| 213 | + if ( ! empty($id)) { |
|
| 214 | + $post = get_post($id); |
|
| 215 | 215 | //if NOT event then let's get out. |
| 216 | - if ( $post->post_type !== 'espresso_events' ) { |
|
| 216 | + if ($post->post_type !== 'espresso_events') { |
|
| 217 | 217 | return $permalink_string; |
| 218 | 218 | } |
| 219 | 219 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
| 220 | - . __( 'Embed', 'event_espresso' ) |
|
| 220 | + . __('Embed', 'event_espresso') |
|
| 221 | 221 | . '</a> '; |
| 222 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
| 222 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
| 223 | 223 | $iframe_string = esc_html( |
| 224 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
| 224 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
| 225 | 225 | ); |
| 226 | 226 | $permalink_string .= ' |
| 227 | 227 | <div id="js-ts-iframe" style="display:none"> |
| 228 | 228 | <div style="width:100%; height: 500px;"> |
| 229 | - ' . $iframe_string . ' |
|
| 229 | + ' . $iframe_string.' |
|
| 230 | 230 | </div> |
| 231 | 231 | </div>'; |
| 232 | 232 | } |
@@ -245,22 +245,22 @@ discard block |
||
| 245 | 245 | * @param mixed $event |
| 246 | 246 | * @return bool |
| 247 | 247 | */ |
| 248 | - protected static function set_event( $event = null ) { |
|
| 249 | - if( $event === null ) { |
|
| 248 | + protected static function set_event($event = null) { |
|
| 249 | + if ($event === null) { |
|
| 250 | 250 | global $post; |
| 251 | 251 | $event = $post; |
| 252 | 252 | } |
| 253 | - if ( $event instanceof EE_Event ) { |
|
| 253 | + if ($event instanceof EE_Event) { |
|
| 254 | 254 | self::$_event = $event; |
| 255 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
| 255 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
| 256 | 256 | self::$_event = $event->EE_Event; |
| 257 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
| 258 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
| 257 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
| 258 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
| 259 | 259 | self::$_event = $event->EE_Event; |
| 260 | 260 | } else { |
| 261 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
| 262 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
| 263 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 261 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
| 262 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
| 263 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 264 | 264 | return false; |
| 265 | 265 | } |
| 266 | 266 | return true; |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | * @param bool $view_details |
| 280 | 280 | * @return string |
| 281 | 281 | */ |
| 282 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
| 282 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
| 283 | 283 | // reset filter for displaying submit button |
| 284 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
| 284 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 285 | 285 | // poke and prod incoming event till it tells us what it is |
| 286 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
| 286 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | && ( |
| 295 | 295 | ! self::$_event->display_ticket_selector() |
| 296 | 296 | || $view_details |
| 297 | - || post_password_required( $event_post ) |
|
| 297 | + || post_password_required($event_post) |
|
| 298 | 298 | || ( |
| 299 | 299 | $_event_active_status != EE_Datetime::active |
| 300 | 300 | && $_event_active_status != EE_Datetime::upcoming |
@@ -312,34 +312,34 @@ discard block |
||
| 312 | 312 | $template_args = array(); |
| 313 | 313 | $template_args['event_status'] = $_event_active_status; |
| 314 | 314 | |
| 315 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
| 316 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
| 315 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
| 316 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
| 317 | 317 | |
| 318 | 318 | $template_args['EVT_ID'] = self::$_event->ID(); |
| 319 | 319 | $template_args['event'] = self::$_event; |
| 320 | 320 | |
| 321 | 321 | // is the event expired ? |
| 322 | 322 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
| 323 | - if ( $template_args['event_is_expired'] ) { |
|
| 324 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
| 323 | + if ($template_args['event_is_expired']) { |
|
| 324 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | $ticket_query_args = array( |
| 328 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
| 329 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
| 328 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
| 329 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
| 330 | 330 | ); |
| 331 | 331 | |
| 332 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
| 332 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
| 333 | 333 | //use the correct applicable time query depending on what version of core is being run. |
| 334 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
| 335 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
| 334 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
| 335 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | // get all tickets for this event ordered by the datetime |
| 339 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
| 339 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
| 340 | 340 | |
| 341 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
| 342 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
| 341 | + if (count($template_args['tickets']) < 1) { |
|
| 342 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
@@ -348,36 +348,36 @@ discard block |
||
| 348 | 348 | self::$_event->additional_limit() |
| 349 | 349 | ); |
| 350 | 350 | $template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz; |
| 351 | - if ( $template_args['max_atndz'] < 1 ) { |
|
| 352 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
| 353 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
| 354 | - $sales_closed_msg .= sprintf( |
|
| 355 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
| 351 | + if ($template_args['max_atndz'] < 1) { |
|
| 352 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
| 353 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
| 354 | + $sales_closed_msg .= sprintf( |
|
| 355 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
| 356 | 356 | '<div class="ee-attention" style="text-align: left;"><b>', |
| 357 | 357 | '</b><br />', |
| 358 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
| 358 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
| 359 | 359 | '</a></span></div>' |
| 360 | 360 | ); |
| 361 | 361 | } |
| 362 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
| 362 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
| 366 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
| 365 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
| 366 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
| 367 | 367 | |
| 368 | 368 | // redirecting to another site for registration ?? |
| 369 | 369 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
| 370 | 370 | // set up the form (but not for the admin) |
| 371 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
| 371 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
| 372 | 372 | // if not redirecting to another site for registration |
| 373 | - if ( ! $external_url ) { |
|
| 373 | + if ( ! $external_url) { |
|
| 374 | 374 | // then display the ticket selector |
| 375 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
| 375 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
| 376 | 376 | } else { |
| 377 | 377 | // if not we still need to trigger the display of the submit button |
| 378 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
| 378 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 379 | 379 | //display notice to admin that registration is external |
| 380 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
| 380 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
| 381 | 381 | } |
| 382 | 382 | // submit button and form close tag |
| 383 | 383 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -397,25 +397,25 @@ discard block |
||
| 397 | 397 | * @param string $external_url |
| 398 | 398 | * @return string |
| 399 | 399 | */ |
| 400 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
| 400 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
| 401 | 401 | // if redirecting, we don't need any anything else |
| 402 | - if ( $external_url ) { |
|
| 403 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
| 404 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
| 405 | - foreach ( $query_args as $query_arg => $value ) { |
|
| 406 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
| 402 | + if ($external_url) { |
|
| 403 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
| 404 | + $query_args = EEH_URL::get_query_string($external_url); |
|
| 405 | + foreach ($query_args as $query_arg => $value) { |
|
| 406 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
| 407 | 407 | } |
| 408 | 408 | return $html; |
| 409 | 409 | } |
| 410 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
| 411 | - if ( ! $checkout_url ) { |
|
| 412 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 410 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
| 411 | + if ( ! $checkout_url) { |
|
| 412 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 413 | 413 | } |
| 414 | 414 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
| 415 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
| 416 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
| 415 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
| 416 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
| 417 | 417 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
| 418 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
| 418 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
| 419 | 419 | return $html; |
| 420 | 420 | } |
| 421 | 421 | |
@@ -430,18 +430,18 @@ discard block |
||
| 430 | 430 | * @return string |
| 431 | 431 | */ |
| 432 | 432 | public static function display_ticket_selector_submit() { |
| 433 | - if ( ! is_admin() ) { |
|
| 434 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
| 433 | + if ( ! is_admin()) { |
|
| 434 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
| 435 | 435 | $btn_text = apply_filters( |
| 436 | 436 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
| 437 | - __('Register Now', 'event_espresso' ), |
|
| 437 | + __('Register Now', 'event_espresso'), |
|
| 438 | 438 | EED_Ticket_Selector::$_event |
| 439 | 439 | ); |
| 440 | 440 | $external_url = EED_Ticket_Selector::$_event->external_url(); |
| 441 | - $html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"'; |
|
| 441 | + $html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"'; |
|
| 442 | 442 | $html .= ' class="ticket-selector-submit-btn '; |
| 443 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
| 444 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
| 443 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
| 444 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
| 445 | 445 | $html .= apply_filters( |
| 446 | 446 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
| 447 | 447 | '', |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | ); |
| 450 | 450 | $html .= '<div class="clear"><br/></div></form>'; |
| 451 | 451 | return $html; |
| 452 | - } else if ( is_archive() ) { |
|
| 453 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
| 452 | + } else if (is_archive()) { |
|
| 453 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
| 454 | 454 | } else if ( |
| 455 | 455 | EED_Ticket_Selector::$_event instanceof EE_Event |
| 456 | 456 | // if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event) |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $html = apply_filters( |
| 463 | 463 | 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', |
| 464 | 464 | sprintf( |
| 465 | - __( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ), |
|
| 465 | + __('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'), |
|
| 466 | 466 | '<p class="no-ticket-selector-msg important-notice">', |
| 467 | 467 | EED_Ticket_Selector::$_event->name(), |
| 468 | 468 | '</p>' |
@@ -504,13 +504,13 @@ discard block |
||
| 504 | 504 | * @return string |
| 505 | 505 | */ |
| 506 | 506 | public static function display_view_details_btn() { |
| 507 | - if ( ! self::$_event->get_permalink() ) { |
|
| 508 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 507 | + if ( ! self::$_event->get_permalink()) { |
|
| 508 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 509 | 509 | } |
| 510 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
| 511 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
| 512 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
| 513 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
| 510 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
| 511 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
| 512 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
| 513 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
| 514 | 514 | $view_details_btn .= '<div class="clear"><br/></div>'; |
| 515 | 515 | $view_details_btn .= '</form>'; |
| 516 | 516 | return $view_details_btn; |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | * @return array|boolean |
| 529 | 529 | */ |
| 530 | 530 | public function process_ticket_selections() { |
| 531 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
| 531 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
| 532 | 532 | // check nonce |
| 533 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
| 533 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
| 534 | 534 | EE_Error::add_error( |
| 535 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
| 535 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
| 536 | 536 | __FILE__, __FUNCTION__, __LINE__ |
| 537 | 537 | ); |
| 538 | 538 | return FALSE; |
@@ -546,16 +546,16 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
| 548 | 548 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
| 549 | - EE_Registry::instance()->load_core( 'Session' ); |
|
| 549 | + EE_Registry::instance()->load_core('Session'); |
|
| 550 | 550 | // unless otherwise requested, clear the session |
| 551 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
| 552 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
| 551 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
| 552 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
| 553 | 553 | } |
| 554 | 554 | //d( EE_Registry::instance()->SSN ); |
| 555 | 555 | |
| 556 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 556 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 557 | 557 | // do we have an event id? |
| 558 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
| 558 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
| 559 | 559 | // validate/sanitize data |
| 560 | 560 | $valid = self::_validate_post_data(); |
| 561 | 561 | |
@@ -565,41 +565,41 @@ discard block |
||
| 565 | 565 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
| 566 | 566 | |
| 567 | 567 | //check total tickets ordered vs max number of attendees that can register |
| 568 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
| 568 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
| 569 | 569 | |
| 570 | 570 | // ordering too many tickets !!! |
| 571 | 571 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
| 572 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
| 572 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
| 573 | 573 | // dev only message |
| 574 | 574 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
| 575 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
| 576 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 575 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
| 576 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
| 577 | 577 | } else { |
| 578 | 578 | |
| 579 | 579 | // all data appears to be valid |
| 580 | 580 | $tckts_slctd = FALSE; |
| 581 | 581 | $success = TRUE; |
| 582 | 582 | // load cart |
| 583 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
| 583 | + EE_Registry::instance()->load_core('Cart'); |
|
| 584 | 584 | |
| 585 | 585 | // cycle thru the number of data rows sent from the event listing |
| 586 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
| 586 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
| 587 | 587 | // does this row actually contain a ticket quantity? |
| 588 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
| 588 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
| 589 | 589 | // YES we have a ticket quantity |
| 590 | 590 | $tckts_slctd = TRUE; |
| 591 | 591 | // d( $valid['ticket_obj'][$x] ); |
| 592 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
| 592 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
| 593 | 593 | // then add ticket to cart |
| 594 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
| 594 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
| 595 | 595 | $success = ! $ticket_added ? FALSE : $success; |
| 596 | - if ( EE_Error::has_error() ) { |
|
| 596 | + if (EE_Error::has_error()) { |
|
| 597 | 597 | break; |
| 598 | 598 | } |
| 599 | 599 | } else { |
| 600 | 600 | // nothing added to cart retrieved |
| 601 | 601 | EE_Error::add_error( |
| 602 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
| 602 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
| 603 | 603 | __FILE__, __FUNCTION__, __LINE__ |
| 604 | 604 | ); |
| 605 | 605 | } |
@@ -608,45 +608,45 @@ discard block |
||
| 608 | 608 | //d( EE_Registry::instance()->CART ); |
| 609 | 609 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
| 610 | 610 | |
| 611 | - if ( $tckts_slctd ) { |
|
| 612 | - if ( $success ) { |
|
| 613 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
| 611 | + if ($tckts_slctd) { |
|
| 612 | + if ($success) { |
|
| 613 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
| 614 | 614 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
| 615 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
| 615 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
| 616 | 616 | EE_Registry::instance()->SSN->update(); |
| 617 | 617 | //d( EE_Registry::instance()->CART ); |
| 618 | 618 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
| 619 | 619 | // just return TRUE for registrations being made from admin |
| 620 | - if ( is_admin() ) { |
|
| 620 | + if (is_admin()) { |
|
| 621 | 621 | return TRUE; |
| 622 | 622 | } |
| 623 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
| 623 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
| 624 | 624 | exit(); |
| 625 | 625 | |
| 626 | 626 | } else { |
| 627 | - if ( ! EE_Error::has_error() ) { |
|
| 627 | + if ( ! EE_Error::has_error()) { |
|
| 628 | 628 | // nothing added to cart |
| 629 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 629 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 630 | 630 | } |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | } else { |
| 634 | 634 | // no ticket quantities were selected |
| 635 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 635 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
| 639 | 639 | // at this point, just return if registration is being made from admin |
| 640 | - if ( is_admin() ) { |
|
| 640 | + if (is_admin()) { |
|
| 641 | 641 | return FALSE; |
| 642 | 642 | } |
| 643 | - if ( $valid['return_url'] ) { |
|
| 644 | - EE_Error::get_notices( FALSE, TRUE ); |
|
| 645 | - wp_safe_redirect( $valid['return_url'] ); |
|
| 643 | + if ($valid['return_url']) { |
|
| 644 | + EE_Error::get_notices(FALSE, TRUE); |
|
| 645 | + wp_safe_redirect($valid['return_url']); |
|
| 646 | 646 | exit(); |
| 647 | - } elseif ( isset( $event_to_add['id'] )) { |
|
| 648 | - EE_Error::get_notices( FALSE, TRUE ); |
|
| 649 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
| 647 | + } elseif (isset($event_to_add['id'])) { |
|
| 648 | + EE_Error::get_notices(FALSE, TRUE); |
|
| 649 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
| 650 | 650 | exit(); |
| 651 | 651 | } else { |
| 652 | 652 | echo EE_Error::get_notices(); |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | } else { |
| 656 | 656 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
| 657 | 657 | EE_Error::add_error( |
| 658 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
| 658 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
| 659 | 659 | __FILE__, __FUNCTION__, __LINE__ |
| 660 | 660 | ); |
| 661 | 661 | } |
@@ -673,18 +673,18 @@ discard block |
||
| 673 | 673 | * @return array or FALSE |
| 674 | 674 | */ |
| 675 | 675 | private static function _validate_post_data() { |
| 676 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 676 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 677 | 677 | |
| 678 | 678 | // start with an empty array() |
| 679 | 679 | $valid_data = array(); |
| 680 | 680 | // d( $_POST ); |
| 681 | 681 | //if event id is valid |
| 682 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
| 683 | - if ( $id ) { |
|
| 682 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
| 683 | + if ($id) { |
|
| 684 | 684 | // grab valid id |
| 685 | 685 | $valid_data['id'] = $id; |
| 686 | 686 | // grab and sanitize return-url |
| 687 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
| 687 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
| 688 | 688 | // array of other form names |
| 689 | 689 | $inputs_to_clean = array( |
| 690 | 690 | 'event_id' => 'tkt-slctr-event-id', |
@@ -697,22 +697,22 @@ discard block |
||
| 697 | 697 | // let's track the total number of tickets ordered.' |
| 698 | 698 | $valid_data['total_tickets'] = 0; |
| 699 | 699 | // cycle through $inputs_to_clean array |
| 700 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
| 700 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
| 701 | 701 | // check for POST data |
| 702 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
| 702 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
| 703 | 703 | // grab value |
| 704 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
| 704 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
| 705 | 705 | switch ($what) { |
| 706 | 706 | |
| 707 | 707 | // integers |
| 708 | 708 | case 'event_id': |
| 709 | - $valid_data[$what] = absint( $input_value ); |
|
| 709 | + $valid_data[$what] = absint($input_value); |
|
| 710 | 710 | // get event via the event id we put in the form |
| 711 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
| 711 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
| 712 | 712 | break; |
| 713 | 713 | case 'rows': |
| 714 | 714 | case 'max_atndz': |
| 715 | - $valid_data[$what] = absint( $input_value ); |
|
| 715 | + $valid_data[$what] = absint($input_value); |
|
| 716 | 716 | break; |
| 717 | 717 | |
| 718 | 718 | // arrays of integers |
@@ -720,27 +720,27 @@ discard block |
||
| 720 | 720 | // d( $input_value ); |
| 721 | 721 | $row_qty = $input_value; |
| 722 | 722 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
| 723 | - if( ! is_array( $row_qty )) { |
|
| 723 | + if ( ! is_array($row_qty)) { |
|
| 724 | 724 | // get number of rows |
| 725 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
| 725 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
| 726 | 726 | // d( $rows ); |
| 727 | 727 | // explode ints by the dash |
| 728 | - $row_qty = explode( '-', $row_qty ); |
|
| 729 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
| 730 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
| 731 | - $row_qty = array( $row => $qty ); |
|
| 728 | + $row_qty = explode('-', $row_qty); |
|
| 729 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
| 730 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
| 731 | + $row_qty = array($row => $qty); |
|
| 732 | 732 | // d( $row_qty ); |
| 733 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
| 734 | - if ( ! isset( $row_qty[$x] )) { |
|
| 733 | + for ($x = 1; $x <= $rows; $x++) { |
|
| 734 | + if ( ! isset($row_qty[$x])) { |
|
| 735 | 735 | $row_qty[$x] = 0; |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | - ksort( $row_qty ); |
|
| 739 | + ksort($row_qty); |
|
| 740 | 740 | // d( $row_qty ); |
| 741 | 741 | // cycle thru values |
| 742 | - foreach ( $row_qty as $qty ) { |
|
| 743 | - $qty = absint( $qty ); |
|
| 742 | + foreach ($row_qty as $qty) { |
|
| 743 | + $qty = absint($qty); |
|
| 744 | 744 | // sanitize as integers |
| 745 | 745 | $valid_data[$what][] = $qty; |
| 746 | 746 | $valid_data['total_tickets'] += $qty; |
@@ -751,19 +751,19 @@ discard block |
||
| 751 | 751 | case 'ticket_id': |
| 752 | 752 | $value_array = array(); |
| 753 | 753 | // cycle thru values |
| 754 | - foreach ( $input_value as $key=>$value ) { |
|
| 754 | + foreach ($input_value as $key=>$value) { |
|
| 755 | 755 | // allow only numbers, letters, spaces, commas and dashes |
| 756 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
| 756 | + $value_array[$key] = wp_strip_all_tags($value); |
|
| 757 | 757 | // get ticket via the ticket id we put in the form |
| 758 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
| 759 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
| 758 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
| 759 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
| 760 | 760 | } |
| 761 | - $valid_data[ $what ] = $value_array; |
|
| 761 | + $valid_data[$what] = $value_array; |
|
| 762 | 762 | break; |
| 763 | 763 | |
| 764 | 764 | case 'return_url' : |
| 765 | 765 | // grab and sanitize return-url |
| 766 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
| 766 | + $valid_data[$what] = esc_url_raw($input_value); |
|
| 767 | 767 | break; |
| 768 | 768 | |
| 769 | 769 | } // end switch $what |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | } // end foreach $inputs_to_clean |
| 772 | 772 | |
| 773 | 773 | } else { |
| 774 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 774 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 775 | 775 | return FALSE; |
| 776 | 776 | } |
| 777 | 777 | |
@@ -789,28 +789,28 @@ discard block |
||
| 789 | 789 | * @param int $qty |
| 790 | 790 | * @return TRUE on success, FALSE on fail |
| 791 | 791 | */ |
| 792 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
| 793 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 792 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
| 793 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 794 | 794 | // get the number of spaces left for this datetime ticket |
| 795 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
| 795 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
| 796 | 796 | // compare available spaces against the number of tickets being purchased |
| 797 | - if ( $available_spaces >= $qty ) { |
|
| 797 | + if ($available_spaces >= $qty) { |
|
| 798 | 798 | // allow addons to prevent a ticket from being added to cart |
| 799 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
| 799 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
| 800 | 800 | return false; |
| 801 | 801 | } |
| 802 | 802 | // add event to cart |
| 803 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
| 804 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
| 803 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
| 804 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
| 805 | 805 | return true; |
| 806 | 806 | } else { |
| 807 | 807 | return false; |
| 808 | 808 | } |
| 809 | 809 | } else { |
| 810 | 810 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
| 811 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
| 811 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
| 812 | 812 | // greedy greedy greedy eh? |
| 813 | - if ( $available_spaces > 0 ) { |
|
| 813 | + if ($available_spaces > 0) { |
|
| 814 | 814 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
| 815 | 815 | EE_Error::add_error( |
| 816 | 816 | sprintf( |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | __FILE__, __FUNCTION__, __LINE__ |
| 827 | 827 | ); |
| 828 | 828 | } else { |
| 829 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 829 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 830 | 830 | } |
| 831 | 831 | return false; |
| 832 | 832 | } |
@@ -844,22 +844,22 @@ discard block |
||
| 844 | 844 | * @param bool $get_original_ticket_spaces |
| 845 | 845 | * @return int |
| 846 | 846 | */ |
| 847 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
| 847 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
| 848 | 848 | // if the $_available_spaces array has not been set up yet... |
| 849 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
| 850 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
| 849 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
| 850 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
| 851 | 851 | } |
| 852 | 852 | $available_spaces = $ticket->qty() - $ticket->sold(); |
| 853 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
| 853 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
| 854 | 854 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
| 855 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
| 855 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
| 856 | 856 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
| 857 | - if ( $get_original_ticket_spaces ) { |
|
| 857 | + if ($get_original_ticket_spaces) { |
|
| 858 | 858 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
| 859 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
| 859 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
| 860 | 860 | } else { |
| 861 | 861 | // we want the updated ticket availability as stored in the "datetimes" array |
| 862 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
| 862 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
| 863 | 863 | } |
| 864 | 864 | } |
| 865 | 865 | } |
@@ -875,23 +875,23 @@ discard block |
||
| 875 | 875 | * @param EE_Ticket $ticket |
| 876 | 876 | * @return int |
| 877 | 877 | */ |
| 878 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
| 878 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
| 879 | 879 | // first, get all of the datetimes that are available to this ticket |
| 880 | 880 | $datetimes = $ticket->get_many_related( |
| 881 | 881 | 'Datetime', |
| 882 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
| 882 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
| 883 | 883 | ); |
| 884 | - if ( ! empty( $datetimes )) { |
|
| 884 | + if ( ! empty($datetimes)) { |
|
| 885 | 885 | // now loop thru all of the datetimes |
| 886 | - foreach ( $datetimes as $datetime ) { |
|
| 887 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 886 | + foreach ($datetimes as $datetime) { |
|
| 887 | + if ($datetime instanceof EE_Datetime) { |
|
| 888 | 888 | // the number of spaces available for the datetime without considering individual ticket quantities |
| 889 | 889 | $spaces_remaining = $datetime->spaces_remaining(); |
| 890 | 890 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
| 891 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
| 891 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
| 892 | 892 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
| 893 | 893 | // else just take the datetime spaces remaining, and assign to the datetimes array |
| 894 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
| 894 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
| 895 | 895 | } |
| 896 | 896 | } |
| 897 | 897 | } |
@@ -907,12 +907,12 @@ discard block |
||
| 907 | 907 | * @param int $qty |
| 908 | 908 | * @return int |
| 909 | 909 | */ |
| 910 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
| 911 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
| 910 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
| 911 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
| 912 | 912 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
| 913 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
| 913 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
| 914 | 914 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
| 915 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
| 915 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
| 916 | 916 | } |
| 917 | 917 | } |
| 918 | 918 | } |
@@ -929,8 +929,8 @@ discard block |
||
| 929 | 929 | */ |
| 930 | 930 | public static function load_tckt_slctr_assets() { |
| 931 | 931 | // add some style |
| 932 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
| 933 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
| 932 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
| 933 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
| 934 | 934 | wp_enqueue_style('ticket_selector'); |
| 935 | 935 | // make it dance |
| 936 | 936 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -944,9 +944,9 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | public static function load_tckt_slctr_assets_admin() { |
| 946 | 946 | //iframe button js on admin event editor page |
| 947 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
| 948 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
| 949 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
| 947 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
| 948 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
| 949 | + wp_enqueue_script('ticket_selector_embed'); |
|
| 950 | 950 | } |
| 951 | 951 | } |
| 952 | 952 | |