@@ -6,21 +6,21 @@ discard block |
||
| 6 | 6 | * @subpackage |
| 7 | 7 | * @author Mike Nelson |
| 8 | 8 | */ |
| 9 | -class EE_Datepicker_Input extends EE_Form_Input_Base{ |
|
| 9 | +class EE_Datepicker_Input extends EE_Form_Input_Base { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @param array $input_settings |
| 13 | 13 | */ |
| 14 | - function __construct( $input_settings = array() ){ |
|
| 15 | - $this->_set_display_strategy( new EE_Text_Input_Display_Strategy( 'datepicker' ) ); |
|
| 16 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
| 14 | + function __construct($input_settings = array()) { |
|
| 15 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker')); |
|
| 16 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
| 17 | 17 | //we could do better for validation, but at least verify its plaintext |
| 18 | - $this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ); |
|
| 19 | - parent::__construct( $input_settings ); |
|
| 20 | - $this->set_html_class( $this->html_class() . ' datepicker' ); |
|
| 18 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)); |
|
| 19 | + parent::__construct($input_settings); |
|
| 20 | + $this->set_html_class($this->html_class().' datepicker'); |
|
| 21 | 21 | // add some style and make it dance |
| 22 | - add_action( 'wp_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' )); |
|
| 23 | - add_action( 'admin_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' )); |
|
| 22 | + add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
| 23 | + add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function enqueue_styles_and_scripts() { |
| 35 | 35 | // load css |
| 36 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 37 | - wp_enqueue_style( 'espresso-ui-theme'); |
|
| 36 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 37 | + wp_enqueue_style('espresso-ui-theme'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('ABSPATH')) { |
| 2 | - exit('No direct script access allowed'); |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /* |
| 5 | 5 | Plugin Name: Event Espresso |
@@ -40,243 +40,243 @@ discard block |
||
| 40 | 40 | * @since 4.0 |
| 41 | 41 | */ |
| 42 | 42 | if (function_exists('espresso_version')) { |
| 43 | - /** |
|
| 44 | - * espresso_duplicate_plugin_error |
|
| 45 | - * displays if more than one version of EE is activated at the same time |
|
| 46 | - */ |
|
| 47 | - function espresso_duplicate_plugin_error() |
|
| 48 | - { |
|
| 49 | - ?> |
|
| 43 | + /** |
|
| 44 | + * espresso_duplicate_plugin_error |
|
| 45 | + * displays if more than one version of EE is activated at the same time |
|
| 46 | + */ |
|
| 47 | + function espresso_duplicate_plugin_error() |
|
| 48 | + { |
|
| 49 | + ?> |
|
| 50 | 50 | <div class="error"> |
| 51 | 51 | <p> |
| 52 | 52 | <?php echo esc_html__( |
| 53 | - '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.', |
|
| 54 | - 'event_espresso' |
|
| 55 | - ); ?> |
|
| 53 | + '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.', |
|
| 54 | + 'event_espresso' |
|
| 55 | + ); ?> |
|
| 56 | 56 | </p> |
| 57 | 57 | </div> |
| 58 | 58 | <?php |
| 59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 60 | - } |
|
| 59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 63 | 63 | } else { |
| 64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
| 65 | - if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 66 | - /** |
|
| 67 | - * espresso_minimum_php_version_error |
|
| 68 | - * |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - function espresso_minimum_php_version_error() |
|
| 72 | - { |
|
| 73 | - ?> |
|
| 64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
| 65 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 66 | + /** |
|
| 67 | + * espresso_minimum_php_version_error |
|
| 68 | + * |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | + function espresso_minimum_php_version_error() |
|
| 72 | + { |
|
| 73 | + ?> |
|
| 74 | 74 | <div class="error"> |
| 75 | 75 | <p> |
| 76 | 76 | <?php |
| 77 | - printf( |
|
| 78 | - esc_html__( |
|
| 79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 80 | - 'event_espresso' |
|
| 81 | - ), |
|
| 82 | - EE_MIN_PHP_VER_REQUIRED, |
|
| 83 | - PHP_VERSION, |
|
| 84 | - '<br/>', |
|
| 85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 86 | - ); |
|
| 87 | - ?> |
|
| 77 | + printf( |
|
| 78 | + esc_html__( |
|
| 79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 80 | + 'event_espresso' |
|
| 81 | + ), |
|
| 82 | + EE_MIN_PHP_VER_REQUIRED, |
|
| 83 | + PHP_VERSION, |
|
| 84 | + '<br/>', |
|
| 85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 86 | + ); |
|
| 87 | + ?> |
|
| 88 | 88 | </p> |
| 89 | 89 | </div> |
| 90 | 90 | <?php |
| 91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 92 | - } |
|
| 91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 95 | - } else { |
|
| 96 | - /** |
|
| 97 | - * espresso_version |
|
| 98 | - * Returns the plugin version |
|
| 99 | - * |
|
| 100 | - * @return string |
|
| 101 | - */ |
|
| 102 | - function espresso_version() |
|
| 103 | - { |
|
| 104 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.35.rc.000'); |
|
| 105 | - } |
|
| 94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 95 | + } else { |
|
| 96 | + /** |
|
| 97 | + * espresso_version |
|
| 98 | + * Returns the plugin version |
|
| 99 | + * |
|
| 100 | + * @return string |
|
| 101 | + */ |
|
| 102 | + function espresso_version() |
|
| 103 | + { |
|
| 104 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.35.rc.000'); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - // define versions |
|
| 108 | - define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
| 109 | - define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
| 110 | - define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
| 111 | - define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
| 112 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 113 | - //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
| 114 | - if ( ! defined('DS')) { |
|
| 115 | - define('DS', '/'); |
|
| 116 | - } |
|
| 117 | - if ( ! defined('PS')) { |
|
| 118 | - define('PS', PATH_SEPARATOR); |
|
| 119 | - } |
|
| 120 | - if ( ! defined('SP')) { |
|
| 121 | - define('SP', ' '); |
|
| 122 | - } |
|
| 123 | - if ( ! defined('EENL')) { |
|
| 124 | - define('EENL', "\n"); |
|
| 125 | - } |
|
| 126 | - define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
| 127 | - // define the plugin directory and URL |
|
| 128 | - define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 129 | - define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 130 | - define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 131 | - // main root folder paths |
|
| 132 | - define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
| 133 | - define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
| 134 | - define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
| 135 | - define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
| 136 | - define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
| 137 | - define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
| 138 | - define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
| 139 | - define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
| 140 | - // core system paths |
|
| 141 | - define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
| 142 | - define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
| 143 | - define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
| 144 | - define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
| 145 | - define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
| 146 | - define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
| 147 | - define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
| 148 | - define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
| 149 | - define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
| 150 | - define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
| 151 | - define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
| 152 | - define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
| 153 | - // gateways |
|
| 154 | - define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
| 155 | - define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
| 156 | - // asset URL paths |
|
| 157 | - define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
| 158 | - define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
| 159 | - define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
| 160 | - define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
| 161 | - define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
| 162 | - define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
| 163 | - // define upload paths |
|
| 164 | - $uploads = wp_upload_dir(); |
|
| 165 | - // define the uploads directory and URL |
|
| 166 | - define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
| 167 | - define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
| 168 | - // define the templates directory and URL |
|
| 169 | - define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
| 170 | - define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
| 171 | - // define the gateway directory and URL |
|
| 172 | - define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
| 173 | - define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
| 174 | - // languages folder/path |
|
| 175 | - define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
| 176 | - define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
| 177 | - //check for dompdf fonts in uploads |
|
| 178 | - if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
| 179 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
| 180 | - } |
|
| 181 | - //ajax constants |
|
| 182 | - define( |
|
| 183 | - 'EE_FRONT_AJAX', |
|
| 184 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
| 185 | - ); |
|
| 186 | - define( |
|
| 187 | - 'EE_ADMIN_AJAX', |
|
| 188 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
| 189 | - ); |
|
| 190 | - //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
| 191 | - //you're better to use this than its straight value (currently -1) in case you ever |
|
| 192 | - //want to change its default value! or find when -1 means infinity |
|
| 193 | - define('EE_INF_IN_DB', -1); |
|
| 194 | - define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
| 195 | - define('EE_DEBUG', false); |
|
| 196 | - // for older WP versions |
|
| 197 | - if ( ! defined('MONTH_IN_SECONDS')) { |
|
| 198 | - define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
| 199 | - } |
|
| 200 | - /** |
|
| 201 | - * espresso_plugin_activation |
|
| 202 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 203 | - */ |
|
| 204 | - function espresso_plugin_activation() |
|
| 205 | - { |
|
| 206 | - update_option('ee_espresso_activation', true); |
|
| 207 | - } |
|
| 107 | + // define versions |
|
| 108 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
| 109 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
| 110 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
| 111 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
| 112 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 113 | + //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
| 114 | + if ( ! defined('DS')) { |
|
| 115 | + define('DS', '/'); |
|
| 116 | + } |
|
| 117 | + if ( ! defined('PS')) { |
|
| 118 | + define('PS', PATH_SEPARATOR); |
|
| 119 | + } |
|
| 120 | + if ( ! defined('SP')) { |
|
| 121 | + define('SP', ' '); |
|
| 122 | + } |
|
| 123 | + if ( ! defined('EENL')) { |
|
| 124 | + define('EENL', "\n"); |
|
| 125 | + } |
|
| 126 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
| 127 | + // define the plugin directory and URL |
|
| 128 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 129 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 130 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 131 | + // main root folder paths |
|
| 132 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
| 133 | + define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
| 134 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
| 135 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
| 136 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
| 137 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
| 138 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
| 139 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
| 140 | + // core system paths |
|
| 141 | + define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
| 142 | + define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
| 143 | + define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
| 144 | + define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
| 145 | + define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
| 146 | + define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
| 147 | + define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
| 148 | + define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
| 149 | + define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
| 150 | + define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
| 151 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
| 152 | + define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
| 153 | + // gateways |
|
| 154 | + define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
| 155 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
| 156 | + // asset URL paths |
|
| 157 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
| 158 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
| 159 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
| 160 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
| 161 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
| 162 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
| 163 | + // define upload paths |
|
| 164 | + $uploads = wp_upload_dir(); |
|
| 165 | + // define the uploads directory and URL |
|
| 166 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
| 167 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
| 168 | + // define the templates directory and URL |
|
| 169 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
| 170 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
| 171 | + // define the gateway directory and URL |
|
| 172 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
| 173 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
| 174 | + // languages folder/path |
|
| 175 | + define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
| 176 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
| 177 | + //check for dompdf fonts in uploads |
|
| 178 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
| 179 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
| 180 | + } |
|
| 181 | + //ajax constants |
|
| 182 | + define( |
|
| 183 | + 'EE_FRONT_AJAX', |
|
| 184 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
| 185 | + ); |
|
| 186 | + define( |
|
| 187 | + 'EE_ADMIN_AJAX', |
|
| 188 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
| 189 | + ); |
|
| 190 | + //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
| 191 | + //you're better to use this than its straight value (currently -1) in case you ever |
|
| 192 | + //want to change its default value! or find when -1 means infinity |
|
| 193 | + define('EE_INF_IN_DB', -1); |
|
| 194 | + define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
| 195 | + define('EE_DEBUG', false); |
|
| 196 | + // for older WP versions |
|
| 197 | + if ( ! defined('MONTH_IN_SECONDS')) { |
|
| 198 | + define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
| 199 | + } |
|
| 200 | + /** |
|
| 201 | + * espresso_plugin_activation |
|
| 202 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 203 | + */ |
|
| 204 | + function espresso_plugin_activation() |
|
| 205 | + { |
|
| 206 | + update_option('ee_espresso_activation', true); |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 210 | - /** |
|
| 211 | - * espresso_load_error_handling |
|
| 212 | - * this function loads EE's class for handling exceptions and errors |
|
| 213 | - */ |
|
| 214 | - function espresso_load_error_handling() |
|
| 215 | - { |
|
| 216 | - // load debugging tools |
|
| 217 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
| 218 | - require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
| 219 | - EEH_Debug_Tools::instance(); |
|
| 220 | - } |
|
| 221 | - // load error handling |
|
| 222 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
| 223 | - require_once(EE_CORE . 'EE_Error.core.php'); |
|
| 224 | - } else { |
|
| 225 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
| 226 | - } |
|
| 227 | - } |
|
| 209 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 210 | + /** |
|
| 211 | + * espresso_load_error_handling |
|
| 212 | + * this function loads EE's class for handling exceptions and errors |
|
| 213 | + */ |
|
| 214 | + function espresso_load_error_handling() |
|
| 215 | + { |
|
| 216 | + // load debugging tools |
|
| 217 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
| 218 | + require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
| 219 | + EEH_Debug_Tools::instance(); |
|
| 220 | + } |
|
| 221 | + // load error handling |
|
| 222 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
| 223 | + require_once(EE_CORE . 'EE_Error.core.php'); |
|
| 224 | + } else { |
|
| 225 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - /** |
|
| 230 | - * espresso_load_required |
|
| 231 | - * given a class name and path, this function will load that file or throw an exception |
|
| 232 | - * |
|
| 233 | - * @param string $classname |
|
| 234 | - * @param string $full_path_to_file |
|
| 235 | - * @throws EE_Error |
|
| 236 | - */ |
|
| 237 | - function espresso_load_required($classname, $full_path_to_file) |
|
| 238 | - { |
|
| 239 | - static $error_handling_loaded = false; |
|
| 240 | - if ( ! $error_handling_loaded) { |
|
| 241 | - espresso_load_error_handling(); |
|
| 242 | - $error_handling_loaded = true; |
|
| 243 | - } |
|
| 244 | - if (is_readable($full_path_to_file)) { |
|
| 245 | - require_once($full_path_to_file); |
|
| 246 | - } else { |
|
| 247 | - throw new EE_Error ( |
|
| 248 | - sprintf( |
|
| 249 | - esc_html__( |
|
| 250 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
| 251 | - 'event_espresso' |
|
| 252 | - ), |
|
| 253 | - $classname |
|
| 254 | - ) |
|
| 255 | - ); |
|
| 256 | - } |
|
| 257 | - } |
|
| 229 | + /** |
|
| 230 | + * espresso_load_required |
|
| 231 | + * given a class name and path, this function will load that file or throw an exception |
|
| 232 | + * |
|
| 233 | + * @param string $classname |
|
| 234 | + * @param string $full_path_to_file |
|
| 235 | + * @throws EE_Error |
|
| 236 | + */ |
|
| 237 | + function espresso_load_required($classname, $full_path_to_file) |
|
| 238 | + { |
|
| 239 | + static $error_handling_loaded = false; |
|
| 240 | + if ( ! $error_handling_loaded) { |
|
| 241 | + espresso_load_error_handling(); |
|
| 242 | + $error_handling_loaded = true; |
|
| 243 | + } |
|
| 244 | + if (is_readable($full_path_to_file)) { |
|
| 245 | + require_once($full_path_to_file); |
|
| 246 | + } else { |
|
| 247 | + throw new EE_Error ( |
|
| 248 | + sprintf( |
|
| 249 | + esc_html__( |
|
| 250 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
| 251 | + 'event_espresso' |
|
| 252 | + ), |
|
| 253 | + $classname |
|
| 254 | + ) |
|
| 255 | + ); |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
| 260 | - espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
| 261 | - espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
| 262 | - new EE_Bootstrap(); |
|
| 263 | - } |
|
| 259 | + espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
| 260 | + espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
| 261 | + espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
| 262 | + new EE_Bootstrap(); |
|
| 263 | + } |
|
| 264 | 264 | } |
| 265 | 265 | if ( ! function_exists('espresso_deactivate_plugin')) { |
| 266 | - /** |
|
| 267 | - * deactivate_plugin |
|
| 268 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 269 | - * |
|
| 270 | - * @access public |
|
| 271 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 272 | - * @return void |
|
| 273 | - */ |
|
| 274 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
| 275 | - { |
|
| 276 | - if ( ! function_exists('deactivate_plugins')) { |
|
| 277 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 278 | - } |
|
| 279 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
| 280 | - deactivate_plugins($plugin_basename); |
|
| 281 | - } |
|
| 266 | + /** |
|
| 267 | + * deactivate_plugin |
|
| 268 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 269 | + * |
|
| 270 | + * @access public |
|
| 271 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 272 | + * @return void |
|
| 273 | + */ |
|
| 274 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
| 275 | + { |
|
| 276 | + if ( ! function_exists('deactivate_plugins')) { |
|
| 277 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
| 278 | + } |
|
| 279 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
| 280 | + deactivate_plugins($plugin_basename); |
|
| 281 | + } |
|
| 282 | 282 | } |
| 283 | 283 | \ No newline at end of file |
@@ -7,8 +7,7 @@ discard block |
||
| 7 | 7 | * the interaction of EE_Transaction and EE_Registration model objects |
| 8 | 8 | * Provides methods for manipulating and processing changes to an EE_Transaction |
| 9 | 9 | * and it's related EE_Registrations with regards to the checkout/registration process |
| 10 | - |
|
| 11 | -* |
|
| 10 | + * |
|
| 12 | 11 | *@package Event Espresso |
| 13 | 12 | * @subpackage core |
| 14 | 13 | * @author Brent Christensen |
@@ -177,24 +176,24 @@ discard block |
||
| 177 | 176 | |
| 178 | 177 | |
| 179 | 178 | |
| 180 | - /** |
|
| 181 | - * update_transaction_and_registrations_after_checkout_or_payment |
|
| 182 | - * cycles thru related registrations and calls update_registration_after_checkout_or_payment() on each |
|
| 183 | - * |
|
| 184 | - * @param EE_Transaction $transaction |
|
| 185 | - * @param \EE_Payment | NULL $payment |
|
| 186 | - * @param array $registration_query_params array of query WHERE params to use |
|
| 187 | - * when retrieving cached registrations from a transaction |
|
| 188 | - * @param bool $trigger_notifications whether or not to call |
|
| 189 | - * \EE_Registration_Processor::trigger_registration_update_notifications() |
|
| 190 | - * @return array |
|
| 191 | - * @throws \EE_Error |
|
| 192 | - */ |
|
| 179 | + /** |
|
| 180 | + * update_transaction_and_registrations_after_checkout_or_payment |
|
| 181 | + * cycles thru related registrations and calls update_registration_after_checkout_or_payment() on each |
|
| 182 | + * |
|
| 183 | + * @param EE_Transaction $transaction |
|
| 184 | + * @param \EE_Payment | NULL $payment |
|
| 185 | + * @param array $registration_query_params array of query WHERE params to use |
|
| 186 | + * when retrieving cached registrations from a transaction |
|
| 187 | + * @param bool $trigger_notifications whether or not to call |
|
| 188 | + * \EE_Registration_Processor::trigger_registration_update_notifications() |
|
| 189 | + * @return array |
|
| 190 | + * @throws \EE_Error |
|
| 191 | + */ |
|
| 193 | 192 | public function update_transaction_and_registrations_after_checkout_or_payment( |
| 194 | 193 | EE_Transaction $transaction, |
| 195 | 194 | $payment = null, |
| 196 | 195 | $registration_query_params = array(), |
| 197 | - $trigger_notifications = true |
|
| 196 | + $trigger_notifications = true |
|
| 198 | 197 | ) { |
| 199 | 198 | // make sure some query params are set for retrieving registrations |
| 200 | 199 | $this->_set_registration_query_params( $registration_query_params ); |
@@ -224,15 +223,15 @@ discard block |
||
| 224 | 223 | $update_params |
| 225 | 224 | ); |
| 226 | 225 | if ($trigger_notifications) { |
| 227 | - // send messages |
|
| 228 | - /** @type EE_Registration_Processor $registration_processor */ |
|
| 229 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 230 | - $registration_processor->trigger_registration_update_notifications( |
|
| 231 | - $transaction->primary_registration(), |
|
| 232 | - $update_params |
|
| 233 | - ); |
|
| 234 | - } |
|
| 235 | - do_action( |
|
| 226 | + // send messages |
|
| 227 | + /** @type EE_Registration_Processor $registration_processor */ |
|
| 228 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 229 | + $registration_processor->trigger_registration_update_notifications( |
|
| 230 | + $transaction->primary_registration(), |
|
| 231 | + $update_params |
|
| 232 | + ); |
|
| 233 | + } |
|
| 234 | + do_action( |
|
| 236 | 235 | 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', |
| 237 | 236 | $transaction, |
| 238 | 237 | $update_params |
@@ -242,17 +241,17 @@ discard block |
||
| 242 | 241 | |
| 243 | 242 | |
| 244 | 243 | |
| 245 | - /** |
|
| 246 | - * update_transaction_after_registration_reopened |
|
| 247 | - * readjusts TXN and Line Item totals after a registration is changed from |
|
| 248 | - * cancelled or declined to another reg status such as pending payment or approved |
|
| 249 | - * |
|
| 250 | - * @param \EE_Registration $registration |
|
| 251 | - * @param array $closed_reg_statuses |
|
| 252 | - * @param bool $update_txn |
|
| 253 | - * @return bool |
|
| 254 | - * @throws \EE_Error |
|
| 255 | - */ |
|
| 244 | + /** |
|
| 245 | + * update_transaction_after_registration_reopened |
|
| 246 | + * readjusts TXN and Line Item totals after a registration is changed from |
|
| 247 | + * cancelled or declined to another reg status such as pending payment or approved |
|
| 248 | + * |
|
| 249 | + * @param \EE_Registration $registration |
|
| 250 | + * @param array $closed_reg_statuses |
|
| 251 | + * @param bool $update_txn |
|
| 252 | + * @return bool |
|
| 253 | + * @throws \EE_Error |
|
| 254 | + */ |
|
| 256 | 255 | public function update_transaction_after_reinstating_canceled_registration( |
| 257 | 256 | EE_Registration $registration, |
| 258 | 257 | $closed_reg_statuses = array(), |
@@ -314,15 +313,15 @@ discard block |
||
| 314 | 313 | try { |
| 315 | 314 | $transaction = $this->get_transaction_for_registration( $registration ); |
| 316 | 315 | if ( |
| 317 | - apply_filters( |
|
| 318 | - 'FHEE__EE_Transaction_Processor__update_transaction_after_canceled_or_declined_registration__cancel_ticket_line_item', |
|
| 319 | - true, |
|
| 320 | - $registration, |
|
| 321 | - $transaction |
|
| 322 | - ) |
|
| 323 | - ){ |
|
| 324 | - $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration ); |
|
| 325 | - EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item ); |
|
| 316 | + apply_filters( |
|
| 317 | + 'FHEE__EE_Transaction_Processor__update_transaction_after_canceled_or_declined_registration__cancel_ticket_line_item', |
|
| 318 | + true, |
|
| 319 | + $registration, |
|
| 320 | + $transaction |
|
| 321 | + ) |
|
| 322 | + ){ |
|
| 323 | + $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration ); |
|
| 324 | + EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item ); |
|
| 326 | 325 | } |
| 327 | 326 | } catch ( EE_Error $e ) { |
| 328 | 327 | EE_Error::add_error( |
@@ -532,7 +531,7 @@ discard block |
||
| 532 | 531 | foreach ( $available_payment_methods as $available_payment_method ) { |
| 533 | 532 | if ( |
| 534 | 533 | $available_payment_method instanceof EE_Payment_Method |
| 535 | - && $available_payment_method->open_by_default() |
|
| 534 | + && $available_payment_method->open_by_default() |
|
| 536 | 535 | ) { |
| 537 | 536 | $PMD_ID = $available_payment_method->ID(); |
| 538 | 537 | break; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
| 2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Class EE_Transaction_Processor |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | * @param array $registration_query_params |
| 51 | 51 | *@return EE_Transaction_Processor instance |
| 52 | 52 | */ |
| 53 | - public static function instance( $registration_query_params = array() ) { |
|
| 53 | + public static function instance($registration_query_params = array()) { |
|
| 54 | 54 | // check if class object is instantiated |
| 55 | - if ( ! self::$_instance instanceof EE_Transaction_Processor ) { |
|
| 56 | - self::$_instance = new self( $registration_query_params ); |
|
| 55 | + if ( ! self::$_instance instanceof EE_Transaction_Processor) { |
|
| 56 | + self::$_instance = new self($registration_query_params); |
|
| 57 | 57 | } |
| 58 | 58 | return self::$_instance; |
| 59 | 59 | } |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * @param array $registration_query_params |
| 65 | 65 | */ |
| 66 | - private function __construct( $registration_query_params = array() ) { |
|
| 66 | + private function __construct($registration_query_params = array()) { |
|
| 67 | 67 | // make sure some query params are set for retrieving registrations |
| 68 | - $this->_set_registration_query_params( $registration_query_params ); |
|
| 68 | + $this->_set_registration_query_params($registration_query_params); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | * @access private |
| 75 | 75 | * @param array $registration_query_params |
| 76 | 76 | */ |
| 77 | - private function _set_registration_query_params( $registration_query_params ) { |
|
| 78 | - $this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
| 77 | + private function _set_registration_query_params($registration_query_params) { |
|
| 78 | + $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC')); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | ); |
| 105 | 105 | // send messages |
| 106 | 106 | /** @type EE_Registration_Processor $registration_processor */ |
| 107 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
| 107 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 108 | 108 | $registration_processor->trigger_registration_update_notifications( |
| 109 | 109 | $transaction->primary_registration(), |
| 110 | - array( 'manually_updated' => true ) |
|
| 110 | + array('manually_updated' => true) |
|
| 111 | 111 | ); |
| 112 | 112 | do_action( |
| 113 | 113 | 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | $trigger_notifications = true |
| 198 | 198 | ) { |
| 199 | 199 | // make sure some query params are set for retrieving registrations |
| 200 | - $this->_set_registration_query_params( $registration_query_params ); |
|
| 200 | + $this->_set_registration_query_params($registration_query_params); |
|
| 201 | 201 | // get final reg step status |
| 202 | 202 | $finalized = $transaction->final_reg_step_completed(); |
| 203 | 203 | // if the 'finalize_registration' step has been initiated (has a timestamp) |
| 204 | 204 | // but has not yet been fully completed (TRUE) |
| 205 | - if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) { |
|
| 206 | - $transaction->set_reg_step_completed( 'finalize_registration' ); |
|
| 205 | + if (is_int($finalized) && $finalized !== false && $finalized !== true) { |
|
| 206 | + $transaction->set_reg_step_completed('finalize_registration'); |
|
| 207 | 207 | $finalized = true; |
| 208 | 208 | } |
| 209 | 209 | $transaction->save(); |
@@ -259,22 +259,22 @@ discard block |
||
| 259 | 259 | $update_txn = true |
| 260 | 260 | ) { |
| 261 | 261 | // these reg statuses should not be considered in any calculations involving monies owing |
| 262 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
| 263 | - if ( in_array( $registration->status_ID(), $closed_reg_statuses, true ) ) { |
|
| 262 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
| 263 | + if (in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
| 264 | 264 | return false; |
| 265 | 265 | } |
| 266 | 266 | try { |
| 267 | - $transaction = $this->get_transaction_for_registration( $registration ); |
|
| 267 | + $transaction = $this->get_transaction_for_registration($registration); |
|
| 268 | 268 | $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( |
| 269 | 269 | $transaction, |
| 270 | 270 | $registration |
| 271 | 271 | ); |
| 272 | 272 | // un-cancel the ticket |
| 273 | - $success = EEH_Line_Item::reinstate_canceled_ticket_line_item( $ticket_line_item ); |
|
| 274 | - } catch ( EE_Error $e ) { |
|
| 273 | + $success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item); |
|
| 274 | + } catch (EE_Error $e) { |
|
| 275 | 275 | EE_Error::add_error( |
| 276 | 276 | sprintf( |
| 277 | - __( 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso' ), |
|
| 277 | + __('The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso'), |
|
| 278 | 278 | $registration->ID(), |
| 279 | 279 | '<br />', |
| 280 | 280 | $e->getMessage() |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | ); |
| 284 | 284 | return false; |
| 285 | 285 | } |
| 286 | - if ( $update_txn ) { |
|
| 286 | + if ($update_txn) { |
|
| 287 | 287 | return $transaction->save() ? $success : false; |
| 288 | 288 | } |
| 289 | 289 | return $success; |
@@ -307,12 +307,12 @@ discard block |
||
| 307 | 307 | $update_txn = true |
| 308 | 308 | ) { |
| 309 | 309 | // these reg statuses should not be considered in any calculations involving monies owing |
| 310 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
| 311 | - if ( ! in_array( $registration->status_ID(), $closed_reg_statuses, true ) ) { |
|
| 310 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
| 311 | + if ( ! in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
| 312 | 312 | return false; |
| 313 | 313 | } |
| 314 | 314 | try { |
| 315 | - $transaction = $this->get_transaction_for_registration( $registration ); |
|
| 315 | + $transaction = $this->get_transaction_for_registration($registration); |
|
| 316 | 316 | if ( |
| 317 | 317 | apply_filters( |
| 318 | 318 | 'FHEE__EE_Transaction_Processor__update_transaction_after_canceled_or_declined_registration__cancel_ticket_line_item', |
@@ -320,14 +320,14 @@ discard block |
||
| 320 | 320 | $registration, |
| 321 | 321 | $transaction |
| 322 | 322 | ) |
| 323 | - ){ |
|
| 324 | - $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration ); |
|
| 325 | - EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item ); |
|
| 323 | + ) { |
|
| 324 | + $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration($transaction, $registration); |
|
| 325 | + EEH_Line_Item::cancel_ticket_line_item($ticket_line_item); |
|
| 326 | 326 | } |
| 327 | - } catch ( EE_Error $e ) { |
|
| 327 | + } catch (EE_Error $e) { |
|
| 328 | 328 | EE_Error::add_error( |
| 329 | 329 | sprintf( |
| 330 | - __( 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso' ), |
|
| 330 | + __('The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso'), |
|
| 331 | 331 | $registration->ID(), |
| 332 | 332 | '<br />', |
| 333 | 333 | $e->getMessage() |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | ); |
| 337 | 337 | return false; |
| 338 | 338 | } |
| 339 | - if ( $update_txn ) { |
|
| 339 | + if ($update_txn) { |
|
| 340 | 340 | return $transaction->save() ? true : false; |
| 341 | 341 | } |
| 342 | 342 | return true; |
@@ -352,12 +352,12 @@ discard block |
||
| 352 | 352 | * @return EE_Transaction |
| 353 | 353 | * @throws EE_Error |
| 354 | 354 | */ |
| 355 | - public function get_transaction_for_registration( EE_Registration $registration ) { |
|
| 355 | + public function get_transaction_for_registration(EE_Registration $registration) { |
|
| 356 | 356 | $transaction = $registration->transaction(); |
| 357 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
| 357 | + if ( ! $transaction instanceof EE_Transaction) { |
|
| 358 | 358 | throw new EE_Error( |
| 359 | 359 | sprintf( |
| 360 | - __( 'The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso' ), |
|
| 360 | + __('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'), |
|
| 361 | 361 | $registration->ID() |
| 362 | 362 | ) |
| 363 | 363 | ); |
@@ -380,16 +380,16 @@ discard block |
||
| 380 | 380 | EE_Transaction $transaction, |
| 381 | 381 | EE_Registration $registration |
| 382 | 382 | ) { |
| 383 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
| 383 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 384 | 384 | $ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction( |
| 385 | 385 | $transaction->ID(), |
| 386 | 386 | $registration->ticket_ID() |
| 387 | 387 | ); |
| 388 | - if ( ! $ticket_line_item instanceof EE_Line_Item ) { |
|
| 388 | + if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
| 389 | 389 | throw new EE_Error( |
| 390 | 390 | sprintf( |
| 391 | - __( 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.', |
|
| 392 | - 'event_espresso' ), |
|
| 391 | + __('The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.', |
|
| 392 | + 'event_espresso'), |
|
| 393 | 393 | $transaction->ID(), |
| 394 | 394 | $registration->ticket_ID() |
| 395 | 395 | ) |
@@ -422,22 +422,22 @@ discard block |
||
| 422 | 422 | $update_txn = true |
| 423 | 423 | ) { |
| 424 | 424 | // make sure some query params are set for retrieving registrations |
| 425 | - $this->_set_registration_query_params( $registration_query_params ); |
|
| 425 | + $this->_set_registration_query_params($registration_query_params); |
|
| 426 | 426 | // these reg statuses should not be considered in any calculations involving monies owing |
| 427 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
| 427 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses(); |
|
| 428 | 428 | // loop through cached registrations |
| 429 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
| 429 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
| 430 | 430 | if ( |
| 431 | 431 | $registration instanceof EE_Registration |
| 432 | - && ! in_array( $registration->status_ID(), $closed_reg_statuses ) |
|
| 432 | + && ! in_array($registration->status_ID(), $closed_reg_statuses) |
|
| 433 | 433 | ) { |
| 434 | 434 | return false; |
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | - if ( in_array( $new_TXN_status, EEM_Transaction::txn_status_array() ) ) { |
|
| 438 | - $transaction->set_status( $new_TXN_status ); |
|
| 437 | + if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) { |
|
| 438 | + $transaction->set_status($new_TXN_status); |
|
| 439 | 439 | } |
| 440 | - if ( $update_txn ) { |
|
| 440 | + if ($update_txn) { |
|
| 441 | 441 | return $transaction->save() ? true : false; |
| 442 | 442 | } |
| 443 | 443 | return true; |
@@ -466,22 +466,22 @@ discard block |
||
| 466 | 466 | ) { |
| 467 | 467 | $response = false; |
| 468 | 468 | /** @type EE_Registration_Processor $registration_processor */ |
| 469 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
| 469 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
| 470 | 470 | // check that method exists |
| 471 | - if ( ! method_exists( $registration_processor, $method_name )) { |
|
| 472 | - throw new EE_Error( __( 'Method does not exist.', 'event_espresso' )); |
|
| 471 | + if ( ! method_exists($registration_processor, $method_name)) { |
|
| 472 | + throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
| 473 | 473 | } |
| 474 | 474 | // make sure some query params are set for retrieving registrations |
| 475 | - $this->_set_registration_query_params( $registration_query_params ); |
|
| 475 | + $this->_set_registration_query_params($registration_query_params); |
|
| 476 | 476 | // loop through cached registrations |
| 477 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
| 478 | - if ( $registration instanceof EE_Registration ) { |
|
| 479 | - if ( $additional_param ) { |
|
| 480 | - $response = $registration_processor->{$method_name}( $registration, $additional_param ) |
|
| 477 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
| 478 | + if ($registration instanceof EE_Registration) { |
|
| 479 | + if ($additional_param) { |
|
| 480 | + $response = $registration_processor->{$method_name}($registration, $additional_param) |
|
| 481 | 481 | ? true |
| 482 | 482 | : $response; |
| 483 | 483 | } else { |
| 484 | - $response = $registration_processor->{$method_name}( $registration ) |
|
| 484 | + $response = $registration_processor->{$method_name}($registration) |
|
| 485 | 485 | ? true |
| 486 | 486 | : $response; |
| 487 | 487 | } |
@@ -508,28 +508,28 @@ discard block |
||
| 508 | 508 | public function set_transaction_payment_method_based_on_registration_statuses( |
| 509 | 509 | EE_Registration $edited_registration |
| 510 | 510 | ) { |
| 511 | - if ( $edited_registration instanceof EE_Registration ) { |
|
| 511 | + if ($edited_registration instanceof EE_Registration) { |
|
| 512 | 512 | $transaction = $edited_registration->transaction(); |
| 513 | - if ( $transaction instanceof EE_Transaction ) { |
|
| 513 | + if ($transaction instanceof EE_Transaction) { |
|
| 514 | 514 | $all_not_approved = true; |
| 515 | - foreach ( $transaction->registrations() as $registration ) { |
|
| 516 | - if ( $registration instanceof EE_Registration ) { |
|
| 515 | + foreach ($transaction->registrations() as $registration) { |
|
| 516 | + if ($registration instanceof EE_Registration) { |
|
| 517 | 517 | // if any REG != "Not Approved" then toggle to false |
| 518 | 518 | $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | // if ALL Registrations are "Not Approved" |
| 522 | - if ( $all_not_approved ) { |
|
| 523 | - $transaction->set_payment_method_ID( null ); |
|
| 522 | + if ($all_not_approved) { |
|
| 523 | + $transaction->set_payment_method_ID(null); |
|
| 524 | 524 | $transaction->save(); |
| 525 | 525 | } else { |
| 526 | 526 | $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
| 527 | 527 | $transaction, |
| 528 | 528 | EEM_Payment_Method::scope_cart |
| 529 | 529 | ); |
| 530 | - if ( ! empty( $available_payment_methods ) ) { |
|
| 530 | + if ( ! empty($available_payment_methods)) { |
|
| 531 | 531 | $PMD_ID = 0; |
| 532 | - foreach ( $available_payment_methods as $available_payment_method ) { |
|
| 532 | + foreach ($available_payment_methods as $available_payment_method) { |
|
| 533 | 533 | if ( |
| 534 | 534 | $available_payment_method instanceof EE_Payment_Method |
| 535 | 535 | && $available_payment_method->open_by_default() |
@@ -538,22 +538,22 @@ discard block |
||
| 538 | 538 | break; |
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | - if ( ! $PMD_ID ) { |
|
| 542 | - $first_payment_method = reset( $available_payment_methods ); |
|
| 543 | - if ( $first_payment_method instanceof EE_Payment_Method ) { |
|
| 541 | + if ( ! $PMD_ID) { |
|
| 542 | + $first_payment_method = reset($available_payment_methods); |
|
| 543 | + if ($first_payment_method instanceof EE_Payment_Method) { |
|
| 544 | 544 | $PMD_ID = $first_payment_method->ID(); |
| 545 | 545 | } else { |
| 546 | 546 | EE_Error::add_error( |
| 547 | - __( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ), |
|
| 547 | + __('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'), |
|
| 548 | 548 | __FILE__, __LINE__, __FUNCTION__ |
| 549 | 549 | ); |
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | - $transaction->set_payment_method_ID( $PMD_ID ); |
|
| 552 | + $transaction->set_payment_method_ID($PMD_ID); |
|
| 553 | 553 | $transaction->save(); |
| 554 | 554 | } else { |
| 555 | 555 | EE_Error::add_error( |
| 556 | - __( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ), |
|
| 556 | + __('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'), |
|
| 557 | 557 | __FILE__, __LINE__, __FUNCTION__ |
| 558 | 558 | ); |
| 559 | 559 | } |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | * @deprecated 4.9.12 |
| 591 | 591 | * @param string $old_txn_status |
| 592 | 592 | */ |
| 593 | - public function set_old_txn_status( $old_txn_status ) { |
|
| 593 | + public function set_old_txn_status($old_txn_status) { |
|
| 594 | 594 | EE_Error::doing_it_wrong( |
| 595 | 595 | __METHOD__, |
| 596 | 596 | esc_html__( |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | '4.9.12' |
| 601 | 601 | ); |
| 602 | 602 | // only set the first time |
| 603 | - if ( $this->_old_txn_status === null ) { |
|
| 603 | + if ($this->_old_txn_status === null) { |
|
| 604 | 604 | $this->_old_txn_status = $old_txn_status; |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | * @deprecated 4.9.12 |
| 630 | 630 | * @param string $new_txn_status |
| 631 | 631 | */ |
| 632 | - public function set_new_txn_status( $new_txn_status ) { |
|
| 632 | + public function set_new_txn_status($new_txn_status) { |
|
| 633 | 633 | EE_Error::doing_it_wrong( |
| 634 | 634 | __METHOD__, |
| 635 | 635 | esc_html__( |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | * @param EE_Transaction $transaction |
| 674 | 674 | * @return boolean |
| 675 | 675 | */ |
| 676 | - public function all_reg_steps_completed( EE_Transaction $transaction ) { |
|
| 676 | + public function all_reg_steps_completed(EE_Transaction $transaction) { |
|
| 677 | 677 | EE_Error::doing_it_wrong( |
| 678 | 678 | __METHOD__, |
| 679 | 679 | esc_html__( |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | * @param string $exception |
| 701 | 701 | * @return boolean |
| 702 | 702 | */ |
| 703 | - public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) { |
|
| 703 | + public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') { |
|
| 704 | 704 | EE_Error::doing_it_wrong( |
| 705 | 705 | __METHOD__, |
| 706 | 706 | esc_html__( |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | '4.9.12', |
| 711 | 711 | '5.0.0' |
| 712 | 712 | ); |
| 713 | - return $transaction->all_reg_steps_completed_except( $exception ); |
|
| 713 | + return $transaction->all_reg_steps_completed_except($exception); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | * @param EE_Transaction $transaction |
| 727 | 727 | * @return boolean |
| 728 | 728 | */ |
| 729 | - public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) { |
|
| 729 | + public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) { |
|
| 730 | 730 | EE_Error::doing_it_wrong( |
| 731 | 731 | __METHOD__, |
| 732 | 732 | esc_html__( |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | * @param string $reg_step_slug |
| 754 | 754 | * @return boolean | int |
| 755 | 755 | */ |
| 756 | - public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
| 756 | + public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
| 757 | 757 | EE_Error::doing_it_wrong( |
| 758 | 758 | __METHOD__, |
| 759 | 759 | esc_html__( |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | '4.9.12', |
| 764 | 764 | '5.0.0' |
| 765 | 765 | ); |
| 766 | - return $transaction->reg_step_completed( $reg_step_slug ); |
|
| 766 | + return $transaction->reg_step_completed($reg_step_slug); |
|
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | * @param EE_Transaction $transaction |
| 780 | 780 | * @return boolean | int |
| 781 | 781 | */ |
| 782 | - public function final_reg_step_completed( EE_Transaction $transaction ) { |
|
| 782 | + public function final_reg_step_completed(EE_Transaction $transaction) { |
|
| 783 | 783 | EE_Error::doing_it_wrong( |
| 784 | 784 | __METHOD__, |
| 785 | 785 | esc_html__( |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | * @return boolean |
| 806 | 806 | * @throws \EE_Error |
| 807 | 807 | */ |
| 808 | - public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) { |
|
| 808 | + public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) { |
|
| 809 | 809 | EE_Error::doing_it_wrong( |
| 810 | 810 | __METHOD__, |
| 811 | 811 | esc_html__( |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | '4.9.12', |
| 816 | 816 | '5.0.0' |
| 817 | 817 | ); |
| 818 | - return $transaction->set_reg_step_initiated( $reg_step_slug ); |
|
| 818 | + return $transaction->set_reg_step_initiated($reg_step_slug); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | * @return boolean |
| 832 | 832 | * @throws \EE_Error |
| 833 | 833 | */ |
| 834 | - public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
| 834 | + public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
| 835 | 835 | EE_Error::doing_it_wrong( |
| 836 | 836 | __METHOD__, |
| 837 | 837 | esc_html__( |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | '4.9.12', |
| 842 | 842 | '5.0.0' |
| 843 | 843 | ); |
| 844 | - return $transaction->set_reg_step_completed( $reg_step_slug ); |
|
| 844 | + return $transaction->set_reg_step_completed($reg_step_slug); |
|
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | * @return boolean |
| 858 | 858 | * @throws \EE_Error |
| 859 | 859 | */ |
| 860 | - public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
| 860 | + public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
| 861 | 861 | EE_Error::doing_it_wrong( |
| 862 | 862 | __METHOD__, |
| 863 | 863 | esc_html__( |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | '4.9.12', |
| 868 | 868 | '5.0.0' |
| 869 | 869 | ); |
| 870 | - return $transaction->set_reg_step_not_completed( $reg_step_slug ); |
|
| 870 | + return $transaction->set_reg_step_not_completed($reg_step_slug); |
|
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | * @param string $reg_step_slug |
| 885 | 885 | * @return void |
| 886 | 886 | */ |
| 887 | - public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) { |
|
| 887 | + public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) { |
|
| 888 | 888 | EE_Error::doing_it_wrong( |
| 889 | 889 | __METHOD__, |
| 890 | 890 | esc_html__( |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | '4.9.12', |
| 895 | 895 | '5.0.0' |
| 896 | 896 | ); |
| 897 | - $transaction->remove_reg_step( $reg_step_slug ); |
|
| 897 | + $transaction->remove_reg_step($reg_step_slug); |
|
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | * @return boolean |
| 911 | 911 | * @throws \EE_Error |
| 912 | 912 | */ |
| 913 | - public function toggle_failed_transaction_status( EE_Transaction $transaction ) { |
|
| 913 | + public function toggle_failed_transaction_status(EE_Transaction $transaction) { |
|
| 914 | 914 | EE_Error::doing_it_wrong( |
| 915 | 915 | __METHOD__, |
| 916 | 916 | esc_html__( |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | * @param EE_Transaction $transaction |
| 935 | 935 | * @return boolean |
| 936 | 936 | */ |
| 937 | - public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) { |
|
| 937 | + public function toggle_abandoned_transaction_status(EE_Transaction $transaction) { |
|
| 938 | 938 | EE_Error::doing_it_wrong( |
| 939 | 939 | __METHOD__, |
| 940 | 940 | esc_html__( |