@@ -102,8 +102,8 @@ |
||
| 102 | 102 | // use_captcha ? |
| 103 | 103 | if ( |
| 104 | 104 | EE_Registry::instance()->CFG->registration->use_captcha |
| 105 | - && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
| 106 | - && ! ( |
|
| 105 | + && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
| 106 | + && ! ( |
|
| 107 | 107 | EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
| 108 | 108 | && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
| 109 | 109 | ) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return EED_Recaptcha |
| 44 | 44 | */ |
| 45 | 45 | public static function instance() { |
| 46 | - return parent::get_instance( __CLASS__ ); |
|
| 46 | + return parent::get_instance(__CLASS__); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -59,32 +59,32 @@ discard block |
||
| 59 | 59 | if ( |
| 60 | 60 | EE_Registry::instance()->CFG->registration->use_captcha |
| 61 | 61 | && ! ( |
| 62 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
| 63 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
| 62 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
| 63 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
| 64 | 64 | ) |
| 65 | 65 | ) { |
| 66 | 66 | EED_Recaptcha::set_definitions(); |
| 67 | 67 | EED_Recaptcha::enqueue_styles_and_scripts(); |
| 68 | - add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
|
| 68 | + add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
| 69 | 69 | add_action( |
| 70 | 70 | 'AHEE__before_spco_whats_next_buttons', |
| 71 | - array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 |
|
| 71 | + array('EED_Recaptcha', 'display_recaptcha'), 10, 0 |
|
| 72 | 72 | ); |
| 73 | 73 | add_filter( |
| 74 | 74 | 'FHEE__EED_Single_Page_Checkout__init___continue_reg', |
| 75 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
| 75 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
| 76 | 76 | ); |
| 77 | 77 | add_filter( |
| 78 | 78 | 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', |
| 79 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
| 79 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
| 80 | 80 | ); |
| 81 | 81 | add_filter( |
| 82 | 82 | 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', |
| 83 | - array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 |
|
| 83 | + array('EED_Recaptcha', 'recaptcha_response'), 10, 1 |
|
| 84 | 84 | ); |
| 85 | 85 | add_filter( |
| 86 | 86 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
| 87 | - array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 |
|
| 87 | + array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1 |
|
| 88 | 88 | ); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -102,20 +102,20 @@ discard block |
||
| 102 | 102 | // use_captcha ? |
| 103 | 103 | if ( |
| 104 | 104 | EE_Registry::instance()->CFG->registration->use_captcha |
| 105 | - && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
| 105 | + && EE_Registry::instance()->REQ->get('step', '') !== '' |
|
| 106 | 106 | && ! ( |
| 107 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
| 108 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
| 107 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
| 108 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
| 109 | 109 | ) |
| 110 | 110 | ) { |
| 111 | 111 | EED_Recaptcha::enqueue_styles_and_scripts(); |
| 112 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 113 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 114 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
| 112 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 113 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 114 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
| 115 | 115 | } |
| 116 | 116 | // admin settings |
| 117 | - add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
|
| 118 | - add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
|
| 117 | + add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
| 118 | + add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | * @return void |
| 128 | 128 | */ |
| 129 | 129 | public static function set_definitions() { |
| 130 | - if ( is_user_logged_in() ) { |
|
| 130 | + if (is_user_logged_in()) { |
|
| 131 | 131 | EED_Recaptcha::$_not_a_robot = true; |
| 132 | 132 | } |
| 133 | - define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
| 134 | - define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
| 133 | + define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
| 134 | + define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public static function set_late_hooks() { |
| 146 | 146 | add_filter( |
| 147 | 147 | 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
| 148 | - array( 'EED_Recaptcha', 'not_a_robot' ) |
|
| 148 | + array('EED_Recaptcha', 'not_a_robot') |
|
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | * @return void |
| 159 | 159 | */ |
| 160 | 160 | public static function enqueue_styles_and_scripts() { |
| 161 | - wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 162 | - wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 163 | - EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
| 164 | - EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
| 165 | - EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
| 161 | + wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 162 | + wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 163 | + EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
| 164 | + EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
| 165 | + EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @access public |
| 174 | 174 | * @param \WP $WP |
| 175 | 175 | */ |
| 176 | - public function run( $WP ) { |
|
| 176 | + public function run($WP) { |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -183,8 +183,7 @@ discard block |
||
| 183 | 183 | * @return boolean |
| 184 | 184 | */ |
| 185 | 185 | public static function not_a_robot() { |
| 186 | - $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
|
| 187 | - EED_Recaptcha::recaptcha_passed(); |
|
| 186 | + $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
|
| 188 | 187 | return $not_a_robot; |
| 189 | 188 | } |
| 190 | 189 | |
@@ -200,22 +199,22 @@ discard block |
||
| 200 | 199 | */ |
| 201 | 200 | public static function display_recaptcha() { |
| 202 | 201 | // logged in means you have already passed a turing test of sorts |
| 203 | - if ( is_user_logged_in() ) { |
|
| 202 | + if (is_user_logged_in()) { |
|
| 204 | 203 | return; |
| 205 | 204 | } |
| 206 | 205 | // don't display if not using recaptcha or user is logged in |
| 207 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
| 206 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
| 208 | 207 | // only display if they have NOT passed the test yet |
| 209 | - if ( ! EED_Recaptcha::$_not_a_robot ) { |
|
| 208 | + if ( ! EED_Recaptcha::$_not_a_robot) { |
|
| 210 | 209 | EEH_Template::display_template( |
| 211 | - RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
| 210 | + RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
|
| 212 | 211 | array( |
| 213 | 212 | 'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
| 214 | 213 | 'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
| 215 | 214 | 'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
| 216 | 215 | ) |
| 217 | 216 | ); |
| 218 | - wp_enqueue_script( 'google_recaptcha' ); |
|
| 217 | + wp_enqueue_script('google_recaptcha'); |
|
| 219 | 218 | } |
| 220 | 219 | } |
| 221 | 220 | } |
@@ -246,17 +245,17 @@ discard block |
||
| 246 | 245 | */ |
| 247 | 246 | public static function recaptcha_passed() { |
| 248 | 247 | // logged in means you have already passed a turing test of sorts |
| 249 | - if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
| 248 | + if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
|
| 250 | 249 | return TRUE; |
| 251 | 250 | } |
| 252 | 251 | // was test already passed? |
| 253 | - $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
|
| 254 | - $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
| 252 | + $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
| 253 | + $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
|
| 255 | 254 | // verify recaptcha |
| 256 | 255 | EED_Recaptcha::_get_recaptcha_response(); |
| 257 | - if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
| 256 | + if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
|
| 258 | 257 | $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
| 259 | - EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
| 258 | + EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
|
| 260 | 259 | } |
| 261 | 260 | EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
| 262 | 261 | return $recaptcha_passed; |
@@ -271,8 +270,8 @@ discard block |
||
| 271 | 270 | * @param array $recaptcha_response |
| 272 | 271 | * @return boolean |
| 273 | 272 | */ |
| 274 | - public static function recaptcha_response( $recaptcha_response = array() ) { |
|
| 275 | - if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
| 273 | + public static function recaptcha_response($recaptcha_response = array()) { |
|
| 274 | + if (EED_Recaptcha::_bypass_recaptcha()) { |
|
| 276 | 275 | $recaptcha_response['bypass_recaptcha'] = TRUE; |
| 277 | 276 | $recaptcha_response['recaptcha_passed'] = TRUE; |
| 278 | 277 | } else { |
@@ -292,16 +291,16 @@ discard block |
||
| 292 | 291 | */ |
| 293 | 292 | private static function _bypass_recaptcha() { |
| 294 | 293 | // an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
| 295 | - $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
| 294 | + $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
|
| 296 | 295 | // does $bypass_request_params_array have any values ? |
| 297 | - if ( empty( $bypass_request_params_array )) { |
|
| 296 | + if (empty($bypass_request_params_array)) { |
|
| 298 | 297 | return FALSE; |
| 299 | 298 | } |
| 300 | 299 | // initially set bypass to TRUE |
| 301 | 300 | $bypass_recaptcha = TRUE; |
| 302 | - foreach ( $bypass_request_params_array as $key => $value ) { |
|
| 301 | + foreach ($bypass_request_params_array as $key => $value) { |
|
| 303 | 302 | // if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass |
| 304 | - $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
| 303 | + $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
|
| 305 | 304 | } |
| 306 | 305 | return $bypass_recaptcha; |
| 307 | 306 | } |
@@ -316,7 +315,7 @@ discard block |
||
| 316 | 315 | * @return boolean |
| 317 | 316 | */ |
| 318 | 317 | private static function _get_recaptcha_response() { |
| 319 | - EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
| 318 | + EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
|
| 320 | 319 | } |
| 321 | 320 | |
| 322 | 321 | |
@@ -330,26 +329,26 @@ discard block |
||
| 330 | 329 | */ |
| 331 | 330 | private static function _process_recaptcha_response() { |
| 332 | 331 | // verify library is loaded |
| 333 | - if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) { |
|
| 334 | - require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' ); |
|
| 332 | + if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) { |
|
| 333 | + require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php'); |
|
| 335 | 334 | } |
| 336 | 335 | // The response from reCAPTCHA |
| 337 | 336 | EED_Recaptcha::_get_recaptcha_response(); |
| 338 | 337 | $recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
| 339 | 338 | // Was there a reCAPTCHA response? |
| 340 | - if ( $recaptcha_response ) { |
|
| 339 | + if ($recaptcha_response) { |
|
| 341 | 340 | // if allow_url_fopen is Off, then set a different request method |
| 342 | - $request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
| 341 | + $request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
| 343 | 342 | $recaptcha = new \ReCaptcha\ReCaptcha( |
| 344 | 343 | EE_Registry::instance()->CFG->registration->recaptcha_privatekey, |
| 345 | 344 | $request_method |
| 346 | 345 | ); |
| 347 | 346 | $recaptcha_response = $recaptcha->verify( |
| 348 | 347 | EED_Recaptcha::$_recaptcha_response, |
| 349 | - $_SERVER[ 'REMOTE_ADDR' ] |
|
| 348 | + $_SERVER['REMOTE_ADDR'] |
|
| 350 | 349 | ); |
| 351 | 350 | } |
| 352 | - if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) { |
|
| 351 | + if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) { |
|
| 353 | 352 | return TRUE; |
| 354 | 353 | } |
| 355 | 354 | // sorry... it appears you can't don't know what soup or hamburgers are !!! |
@@ -393,12 +392,12 @@ discard block |
||
| 393 | 392 | 'subsections' => apply_filters( |
| 394 | 393 | 'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
| 395 | 394 | array( |
| 396 | - 'main_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))), |
|
| 395 | + 'main_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))), |
|
| 397 | 396 | 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
| 398 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
| 397 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))), |
|
| 399 | 398 | 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
| 400 | 399 | // 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
| 401 | - 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
| 400 | + 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
|
| 402 | 401 | ) |
| 403 | 402 | ) |
| 404 | 403 | ) |
@@ -425,28 +424,28 @@ discard block |
||
| 425 | 424 | array( |
| 426 | 425 | 'use_captcha' => new EE_Yes_No_Input( |
| 427 | 426 | array( |
| 428 | - 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
| 427 | + 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
|
| 429 | 428 | 'html_help_text' => sprintf( |
| 430 | - __( 'reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ), |
|
| 429 | + __('reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'), |
|
| 431 | 430 | '<a href="https://www.google.com/recaptcha/intro/index.html">', |
| 432 | 431 | '</a>' |
| 433 | 432 | ), |
| 434 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
| 433 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
| 435 | 434 | 'display_html_label_text' => FALSE |
| 436 | 435 | ) |
| 437 | 436 | ), |
| 438 | 437 | 'recaptcha_publickey' => new EE_Text_Input( |
| 439 | 438 | array( |
| 440 | - 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
|
| 441 | - 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
|
| 442 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
| 439 | + 'html_label_text' => __('Site Key', 'event_espresso'), |
|
| 440 | + 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
| 441 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
|
| 443 | 442 | ) |
| 444 | 443 | ), |
| 445 | 444 | 'recaptcha_privatekey' => new EE_Text_Input( |
| 446 | 445 | array( |
| 447 | - 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
|
| 448 | - 'html_help_text' => __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ), |
|
| 449 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
| 446 | + 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
| 447 | + 'html_help_text' => __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'), |
|
| 448 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
|
| 450 | 449 | ) |
| 451 | 450 | ) |
| 452 | 451 | ) |
@@ -478,81 +477,81 @@ discard block |
||
| 478 | 477 | array( |
| 479 | 478 | 'recaptcha_theme' => new EE_Radio_Button_Input( |
| 480 | 479 | array( |
| 481 | - 'light' => __( 'Light', 'event_espresso' ), |
|
| 482 | - 'dark' => __( 'Dark', 'event_espresso' ) |
|
| 480 | + 'light' => __('Light', 'event_espresso'), |
|
| 481 | + 'dark' => __('Dark', 'event_espresso') |
|
| 483 | 482 | ), |
| 484 | 483 | array( |
| 485 | - 'html_label_text' => __( 'Theme', 'event_espresso' ), |
|
| 486 | - 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
|
| 487 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
| 484 | + 'html_label_text' => __('Theme', 'event_espresso'), |
|
| 485 | + 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
| 486 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
| 488 | 487 | 'display_html_label_text' => FALSE |
| 489 | 488 | ) |
| 490 | 489 | ), |
| 491 | 490 | 'recaptcha_type' => new EE_Radio_Button_Input( |
| 492 | 491 | array( |
| 493 | - 'image' => __( 'Image', 'event_espresso' ), |
|
| 494 | - 'audio' => __( 'Audio', 'event_espresso' ) |
|
| 492 | + 'image' => __('Image', 'event_espresso'), |
|
| 493 | + 'audio' => __('Audio', 'event_espresso') |
|
| 495 | 494 | ), |
| 496 | 495 | array( |
| 497 | - 'html_label_text' => __( 'Type', 'event_espresso' ), |
|
| 498 | - 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
|
| 499 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
| 496 | + 'html_label_text' => __('Type', 'event_espresso'), |
|
| 497 | + 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
| 498 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
| 500 | 499 | 'display_html_label_text' =>FALSE |
| 501 | 500 | ) |
| 502 | 501 | ), |
| 503 | 502 | 'recaptcha_language' => new EE_Select_Input( |
| 504 | 503 | array( |
| 505 | - 'ar' => __( 'Arabic', 'event_espresso' ), |
|
| 506 | - 'bg' => __( 'Bulgarian', 'event_espresso' ), |
|
| 507 | - 'ca' => __( 'Catalan', 'event_espresso' ), |
|
| 508 | - 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
|
| 509 | - 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
|
| 510 | - 'hr' => __( 'Croatian', 'event_espresso' ), |
|
| 511 | - 'cs' => __( 'Czech', 'event_espresso' ), |
|
| 512 | - 'da' => __( 'Danish', 'event_espresso' ), |
|
| 513 | - 'nl' => __( 'Dutch', 'event_espresso' ), |
|
| 514 | - 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
|
| 515 | - 'en' => __( 'English (US)', 'event_espresso' ), |
|
| 516 | - 'fil' => __( 'Filipino', 'event_espresso' ), |
|
| 517 | - 'fi' => __( 'Finnish', 'event_espresso' ), |
|
| 518 | - 'fr' => __( 'French', 'event_espresso' ), |
|
| 519 | - 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
|
| 520 | - 'de' => __( 'German', 'event_espresso' ), |
|
| 521 | - 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
|
| 522 | - 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
|
| 523 | - 'el' => __( 'Greek', 'event_espresso' ), |
|
| 524 | - 'iw' => __( 'Hebrew', 'event_espresso' ), |
|
| 525 | - 'hi' => __( 'Hindi', 'event_espresso' ), |
|
| 526 | - 'hu' => __( 'Hungarian', 'event_espresso' ), |
|
| 527 | - 'id' => __( 'Indonesian', 'event_espresso' ), |
|
| 528 | - 'it' => __( 'Italian', 'event_espresso' ), |
|
| 529 | - 'ja' => __( 'Japanese', 'event_espresso' ), |
|
| 530 | - 'ko' => __( 'Korean', 'event_espresso' ), |
|
| 531 | - 'lv' => __( 'Latvian', 'event_espresso' ), |
|
| 532 | - 'lt' => __( 'Lithuanian', 'event_espresso' ), |
|
| 533 | - 'no' => __( 'Norwegian', 'event_espresso' ), |
|
| 534 | - 'fa' => __( 'Persian', 'event_espresso' ), |
|
| 535 | - 'pl' => __( 'Polish', 'event_espresso' ), |
|
| 536 | - 'pt' => __( 'Portuguese', 'event_espresso' ), |
|
| 537 | - 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
|
| 538 | - 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
|
| 539 | - 'ro' => __( 'Romanian', 'event_espresso' ), |
|
| 540 | - 'ru' => __( 'Russian', 'event_espresso' ), |
|
| 541 | - 'sr' => __( 'Serbian', 'event_espresso' ), |
|
| 542 | - 'sk' => __( 'Slovak', 'event_espresso' ), |
|
| 543 | - 'sl' => __( 'Slovenian', 'event_espresso' ), |
|
| 544 | - 'es' => __( 'Spanish', 'event_espresso' ), |
|
| 545 | - 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
|
| 546 | - 'sv' => __( 'Swedish', 'event_espresso' ), |
|
| 547 | - 'th' => __( 'Thai', 'event_espresso' ), |
|
| 548 | - 'tr' => __( 'Turkish', 'event_espresso' ), |
|
| 549 | - 'uk' => __( 'Ukrainian', 'event_espresso' ), |
|
| 550 | - 'vi' => __( 'Vietnamese', 'event_espresso') |
|
| 504 | + 'ar' => __('Arabic', 'event_espresso'), |
|
| 505 | + 'bg' => __('Bulgarian', 'event_espresso'), |
|
| 506 | + 'ca' => __('Catalan', 'event_espresso'), |
|
| 507 | + 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
| 508 | + 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
| 509 | + 'hr' => __('Croatian', 'event_espresso'), |
|
| 510 | + 'cs' => __('Czech', 'event_espresso'), |
|
| 511 | + 'da' => __('Danish', 'event_espresso'), |
|
| 512 | + 'nl' => __('Dutch', 'event_espresso'), |
|
| 513 | + 'en-GB' => __('English (UK)', 'event_espresso'), |
|
| 514 | + 'en' => __('English (US)', 'event_espresso'), |
|
| 515 | + 'fil' => __('Filipino', 'event_espresso'), |
|
| 516 | + 'fi' => __('Finnish', 'event_espresso'), |
|
| 517 | + 'fr' => __('French', 'event_espresso'), |
|
| 518 | + 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
| 519 | + 'de' => __('German', 'event_espresso'), |
|
| 520 | + 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
| 521 | + 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
| 522 | + 'el' => __('Greek', 'event_espresso'), |
|
| 523 | + 'iw' => __('Hebrew', 'event_espresso'), |
|
| 524 | + 'hi' => __('Hindi', 'event_espresso'), |
|
| 525 | + 'hu' => __('Hungarian', 'event_espresso'), |
|
| 526 | + 'id' => __('Indonesian', 'event_espresso'), |
|
| 527 | + 'it' => __('Italian', 'event_espresso'), |
|
| 528 | + 'ja' => __('Japanese', 'event_espresso'), |
|
| 529 | + 'ko' => __('Korean', 'event_espresso'), |
|
| 530 | + 'lv' => __('Latvian', 'event_espresso'), |
|
| 531 | + 'lt' => __('Lithuanian', 'event_espresso'), |
|
| 532 | + 'no' => __('Norwegian', 'event_espresso'), |
|
| 533 | + 'fa' => __('Persian', 'event_espresso'), |
|
| 534 | + 'pl' => __('Polish', 'event_espresso'), |
|
| 535 | + 'pt' => __('Portuguese', 'event_espresso'), |
|
| 536 | + 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
| 537 | + 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
| 538 | + 'ro' => __('Romanian', 'event_espresso'), |
|
| 539 | + 'ru' => __('Russian', 'event_espresso'), |
|
| 540 | + 'sr' => __('Serbian', 'event_espresso'), |
|
| 541 | + 'sk' => __('Slovak', 'event_espresso'), |
|
| 542 | + 'sl' => __('Slovenian', 'event_espresso'), |
|
| 543 | + 'es' => __('Spanish', 'event_espresso'), |
|
| 544 | + 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
| 545 | + 'sv' => __('Swedish', 'event_espresso'), |
|
| 546 | + 'th' => __('Thai', 'event_espresso'), |
|
| 547 | + 'tr' => __('Turkish', 'event_espresso'), |
|
| 548 | + 'uk' => __('Ukrainian', 'event_espresso'), |
|
| 549 | + 'vi' => __('Vietnamese', 'event_espresso') |
|
| 551 | 550 | ), |
| 552 | 551 | array( |
| 553 | - 'html_label_text' => __( 'Language', 'event_espresso' ), |
|
| 554 | - 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
|
| 555 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
| 552 | + 'html_label_text' => __('Language', 'event_espresso'), |
|
| 553 | + 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
| 554 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
| 556 | 555 | ) |
| 557 | 556 | ) |
| 558 | 557 | ) |
@@ -600,25 +599,25 @@ discard block |
||
| 600 | 599 | * @param EE_Registration_Config $EE_Registration_Config |
| 601 | 600 | * @return array |
| 602 | 601 | */ |
| 603 | - public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
| 602 | + public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
|
| 604 | 603 | try { |
| 605 | 604 | $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
| 606 | 605 | // if not displaying a form, then check for form submission |
| 607 | - if ( $recaptcha_settings_form->was_submitted() ) { |
|
| 606 | + if ($recaptcha_settings_form->was_submitted()) { |
|
| 608 | 607 | // capture form data |
| 609 | 608 | $recaptcha_settings_form->receive_form_submission(); |
| 610 | 609 | // validate form data |
| 611 | - if ( $recaptcha_settings_form->is_valid() ) { |
|
| 610 | + if ($recaptcha_settings_form->is_valid()) { |
|
| 612 | 611 | // grab validated data from form |
| 613 | 612 | $valid_data = $recaptcha_settings_form->valid_data(); |
| 614 | 613 | // user proofing recaptcha: If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message. |
| 615 | 614 | if ( |
| 616 | - apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
| 615 | + apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
|
| 617 | 616 | && $valid_data['main_settings']['use_captcha'] |
| 618 | - && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
| 617 | + && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
|
| 619 | 618 | ) { |
| 620 | 619 | $valid_data['main_settings']['use_captcha'] = FALSE; |
| 621 | - EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 620 | + EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 622 | 621 | } |
| 623 | 622 | $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
| 624 | 623 | $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
@@ -627,12 +626,12 @@ discard block |
||
| 627 | 626 | $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
| 628 | 627 | $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
| 629 | 628 | } else { |
| 630 | - if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
|
| 631 | - EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 629 | + if ($recaptcha_settings_form->submission_error_message() != '') { |
|
| 630 | + EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
| 632 | 631 | } |
| 633 | 632 | } |
| 634 | 633 | } |
| 635 | - } catch( EE_Error $e ) { |
|
| 634 | + } catch (EE_Error $e) { |
|
| 636 | 635 | $e->get_error(); |
| 637 | 636 | } |
| 638 | 637 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -17,27 +17,27 @@ |
||
| 17 | 17 | class TicketSelectorIframeEmbedButton extends IframeEmbedButton |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * TicketSelectorIframeEmbedButton constructor. |
|
| 22 | - */ |
|
| 23 | - public function __construct() |
|
| 24 | - { |
|
| 25 | - parent::__construct( |
|
| 26 | - esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
| 27 | - 'ticket_selector' |
|
| 28 | - ); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Adds an iframe embed code button to the Event editor. |
|
| 35 | - */ |
|
| 36 | - public function addEventEditorIframeEmbedButton() |
|
| 37 | - { |
|
| 38 | - // add button for iframe code to event editor. |
|
| 39 | - $this->addEventEditorIframeEmbedButtonFilter(); |
|
| 40 | - } |
|
| 20 | + /** |
|
| 21 | + * TicketSelectorIframeEmbedButton constructor. |
|
| 22 | + */ |
|
| 23 | + public function __construct() |
|
| 24 | + { |
|
| 25 | + parent::__construct( |
|
| 26 | + esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
| 27 | + 'ticket_selector' |
|
| 28 | + ); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Adds an iframe embed code button to the Event editor. |
|
| 35 | + */ |
|
| 36 | + public function addEventEditorIframeEmbedButton() |
|
| 37 | + { |
|
| 38 | + // add button for iframe code to event editor. |
|
| 39 | + $this->addEventEditorIframeEmbedButtonFilter(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | use EventEspresso\core\libraries\iframe_display\IframeEmbedButton; |
| 5 | 5 | |
| 6 | -defined( 'ABSPATH' ) || exit; |
|
| 6 | +defined('ABSPATH') || exit; |
|
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function __construct() |
| 24 | 24 | { |
| 25 | 25 | parent::__construct( |
| 26 | - esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
| 26 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
| 27 | 27 | 'ticket_selector' |
| 28 | 28 | ); |
| 29 | 29 | } |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | use EventEspresso\core\libraries\iframe_display\Iframe; |
| 5 | 5 | |
| 6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 7 | - exit( 'No direct script access allowed' ); |
|
| 6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 7 | + exit('No direct script access allowed'); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | * @return mixed|null |
| 27 | 27 | * @throws \EE_Error |
| 28 | 28 | */ |
| 29 | - public static function create( $class_name, $arguments = array() ) { |
|
| 30 | - if ( empty( $class_name ) ) { |
|
| 29 | + public static function create($class_name, $arguments = array()) { |
|
| 30 | + if (empty($class_name)) { |
|
| 31 | 31 | throw new \EE_Error( |
| 32 | - __( 'You must provide a class name in order to instantiate it.', 'event_espresso' ) |
|
| 32 | + __('You must provide a class name in order to instantiate it.', 'event_espresso') |
|
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | 35 | // if ( ! class_exists( $class_name ) ) { |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | // ); |
| 42 | 42 | // } |
| 43 | 43 | $object = null; |
| 44 | - switch ( $class_name ) { |
|
| 44 | + switch ($class_name) { |
|
| 45 | 45 | |
| 46 | 46 | case 'EE_Request' : |
| 47 | - $object = new \EE_Request( $_GET, $_POST, $_COOKIE ); |
|
| 47 | + $object = new \EE_Request($_GET, $_POST, $_COOKIE); |
|
| 48 | 48 | break; |
| 49 | 49 | |
| 50 | 50 | case 'Iframe' : |
| 51 | - $title = isset( $arguments['title'] ) ? $arguments['title'] : null; |
|
| 52 | - $content = isset( $arguments['content'] ) ? $arguments['content'] : null; |
|
| 53 | - $object = new Iframe( $title, $content ); |
|
| 51 | + $title = isset($arguments['title']) ? $arguments['title'] : null; |
|
| 52 | + $content = isset($arguments['content']) ? $arguments['content'] : null; |
|
| 53 | + $object = new Iframe($title, $content); |
|
| 54 | 54 | break; |
| 55 | 55 | |
| 56 | 56 | default : |
| 57 | - $object = new $class_name( $arguments ); |
|
| 57 | + $object = new $class_name($arguments); |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | /** |
| 6 | 6 | * ************************************************************************ |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | $action_or_filter = 'action' |
| 44 | 44 | ) { |
| 45 | 45 | $action_or_filter = $action_or_filter === 'action' |
| 46 | - ? esc_html__( 'action', 'event_espresso' ) |
|
| 47 | - : esc_html__( 'filter', 'event_espresso' ); |
|
| 46 | + ? esc_html__('action', 'event_espresso') |
|
| 47 | + : esc_html__('filter', 'event_espresso'); |
|
| 48 | 48 | EE_Error::doing_it_wrong( |
| 49 | 49 | $deprecated_filter, |
| 50 | 50 | sprintf( |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param \EE_Checkout $checkout |
| 69 | 69 | * @return string |
| 70 | 70 | */ |
| 71 | -function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) { |
|
| 71 | +function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) { |
|
| 72 | 72 | // list of old filters |
| 73 | 73 | $deprecated_filters = array( |
| 74 | 74 | 'update_registration_details' => true, |
@@ -78,16 +78,16 @@ discard block |
||
| 78 | 78 | 'proceed_to' => true, |
| 79 | 79 | ); |
| 80 | 80 | // loop thru and call doing_it_wrong() or remove any that aren't being used |
| 81 | - foreach ( $deprecated_filters as $deprecated_filter => $on ) { |
|
| 81 | + foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
| 82 | 82 | // was this filter called ? |
| 83 | - if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) { |
|
| 83 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) { |
|
| 84 | 84 | // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
| 85 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) { |
|
| 85 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) { |
|
| 86 | 86 | EE_Error::doing_it_wrong( |
| 87 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
| 87 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
| 88 | 88 | sprintf( |
| 89 | - __( 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ), |
|
| 90 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
| 89 | + __('The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'), |
|
| 90 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
| 91 | 91 | '<br />', |
| 92 | 92 | 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
| 93 | 93 | '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
@@ -96,24 +96,24 @@ discard block |
||
| 96 | 96 | ); |
| 97 | 97 | } |
| 98 | 98 | } else { |
| 99 | - unset( $deprecated_filters[ $deprecated_filter ] ); |
|
| 99 | + unset($deprecated_filters[$deprecated_filter]); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | - if ( ! empty( $deprecated_filters )) { |
|
| 103 | - |
|
| 104 | - if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) { |
|
| 105 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text ); |
|
| 106 | - } else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) { |
|
| 107 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text ); |
|
| 108 | - } else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) { |
|
| 109 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text ); |
|
| 102 | + if ( ! empty($deprecated_filters)) { |
|
| 103 | + |
|
| 104 | + if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
| 105 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text); |
|
| 106 | + } else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
| 107 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text); |
|
| 108 | + } else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
| 109 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text); |
|
| 110 | 110 | } |
| 111 | - if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
| 112 | - if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) { |
|
| 113 | - $submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text ); |
|
| 111 | + if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
| 112 | + if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
| 113 | + $submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text); |
|
| 114 | 114 | } |
| 115 | - if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) { |
|
| 116 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name(); |
|
| 115 | + if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
| 116 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name(); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return $submit_button_text; |
| 122 | 122 | |
| 123 | 123 | } |
| 124 | -add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 ); |
|
| 124 | +add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2); |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | |
@@ -132,16 +132,16 @@ discard block |
||
| 132 | 132 | * @param \EE_Checkout $checkout |
| 133 | 133 | * @param boolean $status_updates |
| 134 | 134 | */ |
| 135 | -function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) { |
|
| 135 | +function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) { |
|
| 136 | 136 | $action_ref = NULL; |
| 137 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
| 138 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
| 139 | - if ( $action_ref ) { |
|
| 137 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
| 138 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
| 139 | + if ($action_ref) { |
|
| 140 | 140 | |
| 141 | 141 | EE_Error::doing_it_wrong( |
| 142 | 142 | $action_ref, |
| 143 | 143 | sprintf( |
| 144 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ), |
|
| 144 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'), |
|
| 145 | 145 | '<br />', |
| 146 | 146 | '/core/business/EE_Transaction_Processor.class.php', |
| 147 | 147 | 'AHEE__EE_Transaction_Processor__finalize', |
@@ -151,39 +151,39 @@ discard block |
||
| 151 | 151 | ), |
| 152 | 152 | '4.6.0' |
| 153 | 153 | ); |
| 154 | - switch ( $action_ref ) { |
|
| 154 | + switch ($action_ref) { |
|
| 155 | 155 | case 'AHEE__EE_Transaction__finalize__new_transaction' : |
| 156 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request ); |
|
| 156 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request); |
|
| 157 | 157 | break; |
| 158 | 158 | case 'AHEE__EE_Transaction__finalize__all_transaction' : |
| 159 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request ); |
|
| 159 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request); |
|
| 160 | 160 | break; |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | -add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 ); |
|
| 164 | +add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2); |
|
| 165 | 165 | /** |
| 166 | 166 | * ee_deprecated_finalize_registration |
| 167 | 167 | * |
| 168 | 168 | * @param EE_Registration $registration |
| 169 | 169 | */ |
| 170 | -function ee_deprecated_finalize_registration( EE_Registration $registration ) { |
|
| 171 | - $action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
| 172 | - if ( $action_ref ) { |
|
| 170 | +function ee_deprecated_finalize_registration(EE_Registration $registration) { |
|
| 171 | + $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
| 172 | + if ($action_ref) { |
|
| 173 | 173 | EE_Error::doing_it_wrong( |
| 174 | 174 | $action_ref, |
| 175 | 175 | sprintf( |
| 176 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ), |
|
| 176 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'), |
|
| 177 | 177 | '<br />', |
| 178 | 178 | '/core/business/EE_Registration_Processor.class.php', |
| 179 | 179 | 'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook' |
| 180 | 180 | ), |
| 181 | 181 | '4.6.0' |
| 182 | 182 | ); |
| 183 | - do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ))); |
|
| 183 | + do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | -add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 ); |
|
| 186 | +add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1); |
|
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called. |
| 192 | 192 | * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately. |
| 193 | 193 | */ |
| 194 | -function ee_deprecated_hooks(){ |
|
| 194 | +function ee_deprecated_hooks() { |
|
| 195 | 195 | /** |
| 196 | 196 | * @var $hooks array where keys are hook names, and their values are array{ |
| 197 | 197 | * @type string $version when deprecated |
@@ -202,25 +202,25 @@ discard block |
||
| 202 | 202 | $hooks = array( |
| 203 | 203 | 'AHEE__EE_System___do_setup_validations' => array( |
| 204 | 204 | 'version' => '4.6.0', |
| 205 | - 'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ), |
|
| 205 | + 'alternative' => __('Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso'), |
|
| 206 | 206 | 'still_works' => FALSE |
| 207 | 207 | ) |
| 208 | 208 | ); |
| 209 | - foreach( $hooks as $name => $deprecation_info ){ |
|
| 210 | - if( has_action( $name ) ){ |
|
| 209 | + foreach ($hooks as $name => $deprecation_info) { |
|
| 210 | + if (has_action($name)) { |
|
| 211 | 211 | EE_Error::doing_it_wrong( |
| 212 | 212 | $name, |
| 213 | 213 | sprintf( |
| 214 | - __('This filter is deprecated. %1$s%2$s','event_espresso'), |
|
| 215 | - $deprecation_info[ 'still_works' ] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ), |
|
| 216 | - isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' ) |
|
| 214 | + __('This filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
| 215 | + $deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'), |
|
| 216 | + isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso') |
|
| 217 | 217 | ), |
| 218 | - isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' ) |
|
| 218 | + isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso') |
|
| 219 | 219 | ); |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | -add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' ); |
|
| 223 | +add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks'); |
|
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | * @return boolean |
| 232 | 232 | */ |
| 233 | 233 | function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() { |
| 234 | - $in_use = has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' ) |
|
| 235 | - || has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' ); |
|
| 236 | - if( $in_use ) { |
|
| 234 | + $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
| 235 | + || has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'); |
|
| 236 | + if ($in_use) { |
|
| 237 | 237 | $msg = __( |
| 238 | 238 | 'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.' |
| 239 | 239 | . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,' |
@@ -242,18 +242,18 @@ discard block |
||
| 242 | 242 | 'event_espresso' ) |
| 243 | 243 | ; |
| 244 | 244 | EE_Error::doing_it_wrong( |
| 245 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 245 | + __CLASS__.'::'.__FUNCTION__, |
|
| 246 | 246 | $msg, |
| 247 | 247 | '4.8.32.rc.000' |
| 248 | 248 | ); |
| 249 | 249 | //it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
| 250 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
| 251 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 250 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
| 251 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | return $in_use; |
| 255 | 255 | } |
| 256 | -add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' ); |
|
| 256 | +add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'); |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
@@ -262,34 +262,34 @@ discard block |
||
| 262 | 262 | * @param EE_Admin_Page $admin_page |
| 263 | 263 | * @return void |
| 264 | 264 | */ |
| 265 | -function ee_deprecated_update_attendee_registration_form_old( $admin_page ) { |
|
| 265 | +function ee_deprecated_update_attendee_registration_form_old($admin_page) { |
|
| 266 | 266 | //check if the old hooks are in use. If not, do the default |
| 267 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
| 268 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
| 267 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
| 268 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
| 269 | 269 | return; |
| 270 | 270 | } |
| 271 | 271 | $req_data = $admin_page->get_request_data(); |
| 272 | - $qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE; |
|
| 273 | - $REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE; |
|
| 274 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
| 275 | - if ( ! $REG_ID || ! $qstns ) { |
|
| 276 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 272 | + $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE; |
|
| 273 | + $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE; |
|
| 274 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
| 275 | + if ( ! $REG_ID || ! $qstns) { |
|
| 276 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 277 | 277 | } |
| 278 | 278 | $success = TRUE; |
| 279 | 279 | |
| 280 | 280 | // allow others to get in on this awesome fun :D |
| 281 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
| 281 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
| 282 | 282 | // loop thru questions... FINALLY!!! |
| 283 | 283 | |
| 284 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
| 284 | + foreach ($qstns as $QST_ID => $qstn) { |
|
| 285 | 285 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
| 286 | - if ( !is_array($qstn) ) { |
|
| 287 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
| 286 | + if ( ! is_array($qstn)) { |
|
| 287 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
| 288 | 288 | continue; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | |
| 292 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
| 292 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
| 293 | 293 | //get answer |
| 294 | 294 | $query_params = array( |
| 295 | 295 | 0 => array( |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | ); |
| 301 | 301 | $answer = EEM_Answer::instance()->get_one($query_params); |
| 302 | 302 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
| 303 | - if ( ! $answer instanceof EE_Answer ) { |
|
| 303 | + if ( ! $answer instanceof EE_Answer) { |
|
| 304 | 304 | $set_values = array( |
| 305 | 305 | 'QST_ID' => $QST_ID, |
| 306 | 306 | 'REG_ID' => $REG_ID, |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | $what = __('Registration Form', 'event_espresso'); |
| 318 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
| 319 | - $admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
| 318 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
| 319 | + $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
| 320 | 320 | exit; |
| 321 | 321 | } |
| 322 | -add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 ); |
|
| 322 | +add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1); |
|
| 323 | 323 | /** |
| 324 | 324 | * Render the registration admin page's custom questions area in the old fashion |
| 325 | 325 | * and firing the old hooks. When this method is removed, we can probably also |
@@ -332,31 +332,31 @@ discard block |
||
| 332 | 332 | * @return bool |
| 333 | 333 | * @throws \EE_Error |
| 334 | 334 | */ |
| 335 | -function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) { |
|
| 335 | +function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) { |
|
| 336 | 336 | //check if the old hooks are in use. If not, do the default |
| 337 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
| 338 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
| 337 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
| 338 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
| 339 | 339 | return $do_default_action; |
| 340 | 340 | } |
| 341 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 ); |
|
| 342 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 ); |
|
| 343 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 ); |
|
| 344 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 ); |
|
| 341 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1); |
|
| 342 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1); |
|
| 343 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
| 344 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
| 345 | 345 | |
| 346 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') ); |
|
| 346 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID')); |
|
| 347 | 347 | |
| 348 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
| 348 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
| 349 | 349 | $template_args = array( |
| 350 | - 'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ), |
|
| 350 | + 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
| 351 | 351 | 'reg_questions_form_action' => 'edit_registration', |
| 352 | 352 | 'REG_ID' => $registration->ID() |
| 353 | 353 | ); |
| 354 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
| 355 | - echo EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
| 354 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
| 355 | + echo EEH_Template::display_template($template_path, $template_args, TRUE); |
|
| 356 | 356 | //indicate that we should not do the default admin page code |
| 357 | 357 | return false; |
| 358 | 358 | } |
| 359 | -add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 ); |
|
| 359 | +add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3); |
|
| 360 | 360 | |
| 361 | 361 | |
| 362 | 362 | |
@@ -397,9 +397,9 @@ discard block |
||
| 397 | 397 | '4.9.0' |
| 398 | 398 | ); |
| 399 | 399 | /** @var EE_Message_Resource_Manager $message_resource_manager */ |
| 400 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
| 401 | - $messenger = $message_resource_manager->get_messenger( $messenger_name ); |
|
| 402 | - $message_type = $message_resource_manager->get_message_type( $message_type_name ); |
|
| 400 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
| 401 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
| 402 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
| 403 | 403 | return EE_Registry::instance()->load_lib( |
| 404 | 404 | 'Messages_Template_Defaults', |
| 405 | 405 | array( |
@@ -464,15 +464,15 @@ discard block |
||
| 464 | 464 | /** |
| 465 | 465 | * @param string $method |
| 466 | 466 | */ |
| 467 | - public function _class_is_deprecated( $method ) { |
|
| 467 | + public function _class_is_deprecated($method) { |
|
| 468 | 468 | EE_Error::doing_it_wrong( |
| 469 | - 'EE_messages::' . $method, |
|
| 470 | - __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
|
| 469 | + 'EE_messages::'.$method, |
|
| 470 | + __('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
| 471 | 471 | '4.9.0', |
| 472 | 472 | '4.10.0.p' |
| 473 | 473 | ); |
| 474 | 474 | // Please use EE_Message_Resource_Manager instead |
| 475 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
| 475 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | |
@@ -482,10 +482,10 @@ discard block |
||
| 482 | 482 | * @param string $messenger_name |
| 483 | 483 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
| 484 | 484 | */ |
| 485 | - public function ensure_messenger_is_active( $messenger_name ) { |
|
| 485 | + public function ensure_messenger_is_active($messenger_name) { |
|
| 486 | 486 | // EE_messages has been deprecated |
| 487 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 488 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
| 487 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 488 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | |
@@ -497,10 +497,10 @@ discard block |
||
| 497 | 497 | * @return bool true if it got activated (or was active) and false if not. |
| 498 | 498 | * @throws \EE_Error |
| 499 | 499 | */ |
| 500 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
| 500 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
| 501 | 501 | // EE_messages has been deprecated |
| 502 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 503 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
| 502 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 503 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | |
@@ -513,10 +513,10 @@ discard block |
||
| 513 | 513 | * they are already setup.) |
| 514 | 514 | * @return boolean an array of generated templates or false if nothing generated/activated. |
| 515 | 515 | */ |
| 516 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
|
| 516 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
| 517 | 517 | // EE_messages has been deprecated |
| 518 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 519 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
| 518 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 519 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
@@ -528,10 +528,10 @@ discard block |
||
| 528 | 528 | * |
| 529 | 529 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
| 530 | 530 | */ |
| 531 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
| 531 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
| 532 | 532 | // EE_messages has been deprecated |
| 533 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 534 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
| 533 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 534 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | |
@@ -541,10 +541,10 @@ discard block |
||
| 541 | 541 | * @param string $messenger |
| 542 | 542 | * @return EE_messenger | null |
| 543 | 543 | */ |
| 544 | - public function get_messenger_if_active( $messenger ) { |
|
| 544 | + public function get_messenger_if_active($messenger) { |
|
| 545 | 545 | // EE_messages has been deprecated |
| 546 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 547 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
| 546 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 547 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | |
@@ -565,9 +565,9 @@ discard block |
||
| 565 | 565 | * 'message_type' => null |
| 566 | 566 | * ) |
| 567 | 567 | */ |
| 568 | - public function validate_for_use( EE_Message $message ) { |
|
| 568 | + public function validate_for_use(EE_Message $message) { |
|
| 569 | 569 | // EE_messages has been deprecated |
| 570 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 570 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 571 | 571 | return array( |
| 572 | 572 | 'messenger' => $message->messenger_object(), |
| 573 | 573 | 'message_type' => $message->message_type_object(), |
@@ -595,41 +595,41 @@ discard block |
||
| 595 | 595 | $send = true |
| 596 | 596 | ) { |
| 597 | 597 | // EE_messages has been deprecated |
| 598 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 598 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 599 | 599 | /** @type EE_Messages_Processor $processor */ |
| 600 | - $processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
| 600 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
| 601 | 601 | $error = false; |
| 602 | 602 | //try to intelligently determine what method we'll call based on the incoming data. |
| 603 | 603 | //if generating and sending are different then generate and send immediately. |
| 604 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
| 604 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
| 605 | 605 | //in the legacy system, when generating and sending were different, that means all the |
| 606 | 606 | //vars are already in the request object. So let's just use that. |
| 607 | 607 | try { |
| 608 | 608 | /** @type EE_Message_To_Generate_From_Request $mtg */ |
| 609 | - $mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
| 610 | - $processor->generate_and_send_now( $mtg ); |
|
| 611 | - } catch ( EE_Error $e ) { |
|
| 609 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
| 610 | + $processor->generate_and_send_now($mtg); |
|
| 611 | + } catch (EE_Error $e) { |
|
| 612 | 612 | $error_msg = __( |
| 613 | 613 | 'Please note that a system message failed to send due to a technical issue.', |
| 614 | 614 | 'event_espresso' |
| 615 | 615 | ); |
| 616 | 616 | // add specific message for developers if WP_DEBUG in on |
| 617 | - $error_msg .= '||' . $e->getMessage(); |
|
| 618 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 617 | + $error_msg .= '||'.$e->getMessage(); |
|
| 618 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 619 | 619 | $error = true; |
| 620 | 620 | } |
| 621 | 621 | } else { |
| 622 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
| 622 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
| 623 | 623 | //let's find out if there were any errors and how many successfully were queued. |
| 624 | 624 | $count_errors = $processor->get_queue()->count_STS_in_queue( |
| 625 | - array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
|
| 625 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
| 626 | 626 | ); |
| 627 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
| 628 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
| 627 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
| 628 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
| 629 | 629 | $count_errors = $count_errors + $count_retry; |
| 630 | - if ( $count_errors > 0 ) { |
|
| 630 | + if ($count_errors > 0) { |
|
| 631 | 631 | $error = true; |
| 632 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
| 632 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
| 633 | 633 | $message = sprintf( |
| 634 | 634 | __( |
| 635 | 635 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | $count_errors, |
| 639 | 639 | $count_queued |
| 640 | 640 | ); |
| 641 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
| 641 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
| 642 | 642 | $message = sprintf( |
| 643 | 643 | __( |
| 644 | 644 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | $count_errors, |
| 648 | 648 | $count_queued |
| 649 | 649 | ); |
| 650 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
| 650 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
| 651 | 651 | $message = sprintf( |
| 652 | 652 | __( |
| 653 | 653 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -665,9 +665,9 @@ discard block |
||
| 665 | 665 | $count_errors |
| 666 | 666 | ); |
| 667 | 667 | } |
| 668 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 668 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
| 669 | 669 | } else { |
| 670 | - if ( $count_queued === 1 ) { |
|
| 670 | + if ($count_queued === 1) { |
|
| 671 | 671 | $message = sprintf( |
| 672 | 672 | __( |
| 673 | 673 | '%d message successfully queued for generation.', |
@@ -684,18 +684,18 @@ discard block |
||
| 684 | 684 | $count_queued |
| 685 | 685 | ); |
| 686 | 686 | } |
| 687 | - EE_Error::add_success( $message ); |
|
| 687 | + EE_Error::add_success($message); |
|
| 688 | 688 | } |
| 689 | 689 | } |
| 690 | 690 | //if no error then return the generated message(s). |
| 691 | - if ( ! $error && ! $send ) { |
|
| 692 | - $generated_queue = $processor->generate_queue( false ); |
|
| 691 | + if ( ! $error && ! $send) { |
|
| 692 | + $generated_queue = $processor->generate_queue(false); |
|
| 693 | 693 | //get message and return. |
| 694 | 694 | $generated_queue->get_message_repository()->rewind(); |
| 695 | 695 | $messages = array(); |
| 696 | - while ( $generated_queue->get_message_repository()->valid() ) { |
|
| 696 | + while ($generated_queue->get_message_repository()->valid()) { |
|
| 697 | 697 | $message = $generated_queue->get_message_repository()->current(); |
| 698 | - if ( $message instanceof EE_Message ) { |
|
| 698 | + if ($message instanceof EE_Message) { |
|
| 699 | 699 | //set properties that might be expected by add-ons (backward compat) |
| 700 | 700 | $message->content = $message->content(); |
| 701 | 701 | $message->template_pack = $message->get_template_pack(); |
@@ -720,10 +720,10 @@ discard block |
||
| 720 | 720 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
| 721 | 721 | * @return string The body of the message. |
| 722 | 722 | */ |
| 723 | - public function preview_message( $type, $context, $messenger, $send = false ) { |
|
| 723 | + public function preview_message($type, $context, $messenger, $send = false) { |
|
| 724 | 724 | // EE_messages has been deprecated |
| 725 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 726 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
| 725 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 726 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | |
@@ -737,14 +737,14 @@ discard block |
||
| 737 | 737 | * |
| 738 | 738 | * @return bool success or fail. |
| 739 | 739 | */ |
| 740 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
| 740 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
| 741 | 741 | // EE_messages has been deprecated |
| 742 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 742 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 743 | 743 | //setup for sending to new method. |
| 744 | 744 | /** @type EE_Messages_Queue $queue */ |
| 745 | - $queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
|
| 745 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
| 746 | 746 | //make sure we have a proper message object |
| 747 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
| 747 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
| 748 | 748 | $msg = EE_Message_Factory::create( |
| 749 | 749 | array( |
| 750 | 750 | 'MSG_messenger' => $messenger, |
@@ -756,15 +756,15 @@ discard block |
||
| 756 | 756 | } else { |
| 757 | 757 | $msg = $message; |
| 758 | 758 | } |
| 759 | - if ( ! $msg instanceof EE_Message ) { |
|
| 759 | + if ( ! $msg instanceof EE_Message) { |
|
| 760 | 760 | return false; |
| 761 | 761 | } |
| 762 | 762 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
| 763 | - if ( ! empty( $msg->content ) ) { |
|
| 764 | - $msg->set( 'MSG_content', $msg->content ); |
|
| 763 | + if ( ! empty($msg->content)) { |
|
| 764 | + $msg->set('MSG_content', $msg->content); |
|
| 765 | 765 | } |
| 766 | - $queue->add( $msg ); |
|
| 767 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
| 766 | + $queue->add($msg); |
|
| 767 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | |
@@ -778,11 +778,11 @@ discard block |
||
| 778 | 778 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
| 779 | 779 | * @throws \EE_Error |
| 780 | 780 | */ |
| 781 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
| 781 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
| 782 | 782 | // EE_messages has been deprecated |
| 783 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 784 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
| 785 | - return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
| 783 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 784 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 785 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | |
@@ -793,11 +793,11 @@ discard block |
||
| 793 | 793 | * @param string $message_type_name name of EE_message_type |
| 794 | 794 | * @return array |
| 795 | 795 | */ |
| 796 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
| 796 | + public function get_fields($messenger_name, $message_type_name) { |
|
| 797 | 797 | // EE_messages has been deprecated |
| 798 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 799 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
| 800 | - return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
|
| 798 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 799 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 800 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | |
@@ -811,13 +811,13 @@ discard block |
||
| 811 | 811 | * @return array multidimensional array of messenger and message_type objects |
| 812 | 812 | * (messengers index, and message_type index); |
| 813 | 813 | */ |
| 814 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
| 814 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
| 815 | 815 | // EE_messages has been deprecated |
| 816 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 817 | - if ( $skip_cache ) { |
|
| 816 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 817 | + if ($skip_cache) { |
|
| 818 | 818 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
| 819 | 819 | } |
| 820 | - switch ( $type ) { |
|
| 820 | + switch ($type) { |
|
| 821 | 821 | case 'messengers' : |
| 822 | 822 | return array( |
| 823 | 823 | 'messenger' => $this->_message_resource_manager->installed_messengers(), |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | */ |
| 847 | 847 | public function get_active_messengers() { |
| 848 | 848 | // EE_messages has been deprecated |
| 849 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 849 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 850 | 850 | return $this->_message_resource_manager->active_messengers(); |
| 851 | 851 | } |
| 852 | 852 | |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | */ |
| 859 | 859 | public function get_active_message_types() { |
| 860 | 860 | // EE_messages has been deprecated |
| 861 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 861 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 862 | 862 | return $this->_message_resource_manager->list_of_active_message_types(); |
| 863 | 863 | } |
| 864 | 864 | |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | */ |
| 871 | 871 | public function get_active_message_type_objects() { |
| 872 | 872 | // EE_messages has been deprecated |
| 873 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 873 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 874 | 874 | return $this->_message_resource_manager->get_active_message_type_objects(); |
| 875 | 875 | } |
| 876 | 876 | |
@@ -882,10 +882,10 @@ discard block |
||
| 882 | 882 | * @param string $messenger The messenger being checked |
| 883 | 883 | * @return EE_message_type[] (or empty array if none present) |
| 884 | 884 | */ |
| 885 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
| 885 | + public function get_active_message_types_per_messenger($messenger) { |
|
| 886 | 886 | // EE_messages has been deprecated |
| 887 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 888 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
| 887 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 888 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | |
@@ -896,10 +896,10 @@ discard block |
||
| 896 | 896 | * @param string $message_type The string should correspond to a message type. |
| 897 | 897 | * @return EE_message_type|null |
| 898 | 898 | */ |
| 899 | - public function get_active_message_type( $messenger, $message_type ) { |
|
| 899 | + public function get_active_message_type($messenger, $message_type) { |
|
| 900 | 900 | // EE_messages has been deprecated |
| 901 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 902 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
| 901 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 902 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | */ |
| 911 | 911 | public function get_installed_message_types() { |
| 912 | 912 | // EE_messages has been deprecated |
| 913 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 913 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 914 | 914 | return $this->_message_resource_manager->installed_message_types(); |
| 915 | 915 | } |
| 916 | 916 | |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | */ |
| 923 | 923 | public function get_installed_messengers() { |
| 924 | 924 | // EE_messages has been deprecated |
| 925 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 925 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 926 | 926 | return $this->_message_resource_manager->installed_messengers(); |
| 927 | 927 | } |
| 928 | 928 | |
@@ -933,10 +933,10 @@ discard block |
||
| 933 | 933 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
| 934 | 934 | * @return array |
| 935 | 935 | */ |
| 936 | - public function get_all_contexts( $slugs_only = true ) { |
|
| 936 | + public function get_all_contexts($slugs_only = true) { |
|
| 937 | 937 | // EE_messages has been deprecated |
| 938 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
| 939 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
| 938 | + $this->_class_is_deprecated(__FUNCTION__); |
|
| 939 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | add_filter( |
| 996 | 996 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
| 997 | 997 | function($event_list_iframe_css) { |
| 998 | - if ( ! has_filter( 'FHEE__EventsArchiveIframe__event_list_iframe__css' )) { |
|
| 998 | + if ( ! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) { |
|
| 999 | 999 | return $event_list_iframe_css; |
| 1000 | 1000 | } |
| 1001 | 1001 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | add_filter( |
| 1016 | 1016 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
| 1017 | 1017 | function($event_list_iframe_js) { |
| 1018 | - if ( ! has_filter( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js' )) { |
|
| 1018 | + if ( ! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) { |
|
| 1019 | 1019 | return $event_list_iframe_js; |
| 1020 | 1020 | } |
| 1021 | 1021 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -239,7 +239,7 @@ |
||
| 239 | 239 | * setTicketMinAndMax |
| 240 | 240 | * |
| 241 | 241 | * @param int $remaining |
| 242 | - * @return array |
|
| 242 | + * @return integer[] |
|
| 243 | 243 | */ |
| 244 | 244 | protected function setTicketMinAndMax($remaining) |
| 245 | 245 | { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | $ticket_selector_row_html = \EEH_HTML::tr( |
| 184 | 184 | '', '', |
| 185 | - "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
| 185 | + "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} ".espresso_get_object_css_class($this->ticket) |
|
| 186 | 186 | ); |
| 187 | 187 | /** |
| 188 | 188 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $status_class |
| 207 | 207 | ); |
| 208 | 208 | if ($new_row_cells_content !== false) { |
| 209 | - return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
| 209 | + return $ticket_selector_row_html.$new_row_cells_content.\EEH_HTML::trx(); |
|
| 210 | 210 | } |
| 211 | 211 | $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
| 212 | 212 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
| 375 | 375 | $html .= \EEH_Template::format_currency($ticket_price); |
| 376 | 376 | $html .= $this->ticket->taxable() |
| 377 | - ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
| 377 | + ? \EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
| 378 | 378 | : ''; |
| 379 | 379 | $html .= ' '; |
| 380 | 380 | $html .= \EEH_HTML::span( |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | // display submit button since we have tickets available |
| 409 | 409 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
| 410 | 410 | $this->hidden_input_qty = false; |
| 411 | - $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 412 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 413 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 411 | + $html = '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"'; |
|
| 412 | + $html .= ' id="ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row.'"'; |
|
| 413 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"'; |
|
| 414 | 414 | $html .= $this->row === 1 ? ' checked="checked"' : ''; |
| 415 | 415 | $html .= ' title=""/>'; |
| 416 | 416 | return $html; |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | // display submit button since we have tickets available |
| 431 | 431 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
| 432 | 432 | $this->hidden_input_qty = false; |
| 433 | - $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 434 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 433 | + $html = '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"'; |
|
| 434 | + $html .= ' id="ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row.'"'; |
|
| 435 | 435 | $html .= ' class="ticket-selector-tbl-qty-slct">'; |
| 436 | 436 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
| 437 | 437 | if ($min !== 0 && ! $this->ticket->required()) { |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | // offer ticket quantities from the min to the max |
| 441 | 441 | for ($i = $min; $i <= $max; $i++) { |
| 442 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 442 | + $html .= '<option value="'.$i.'"> '.$i.' </option>'; |
|
| 443 | 443 | } |
| 444 | 444 | $html .= '</select>'; |
| 445 | 445 | return $html; |
@@ -457,10 +457,10 @@ discard block |
||
| 457 | 457 | $html = ''; |
| 458 | 458 | // depending on group reg we need to change the format for qty |
| 459 | 459 | if ($this->hidden_input_qty) { |
| 460 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 460 | + $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>'; |
|
| 461 | 461 | } |
| 462 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 463 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 462 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"'; |
|
| 463 | + $html .= ' value="'.$this->ticket->ID().'"/>'; |
|
| 464 | 464 | return $html; |
| 465 | 465 | } |
| 466 | 466 | |
@@ -16,458 +16,458 @@ |
||
| 16 | 16 | class TicketSelectorRowStandard extends TicketSelectorRow |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var TicketDetails $ticket_details |
|
| 21 | - */ |
|
| 22 | - protected $ticket_details; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
| 26 | - */ |
|
| 27 | - protected $template_settings; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var \EE_Tax_Config $tax_settings |
|
| 31 | - */ |
|
| 32 | - protected $tax_settings; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var boolean $required_ticket_sold_out |
|
| 36 | - */ |
|
| 37 | - protected $required_ticket_sold_out; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var boolean $prices_displayed_including_taxes |
|
| 41 | - */ |
|
| 42 | - protected $prices_displayed_including_taxes; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @var string $event_status |
|
| 46 | - */ |
|
| 47 | - protected $event_status; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @var int $row |
|
| 51 | - */ |
|
| 52 | - protected $row; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @var int $cols |
|
| 56 | - */ |
|
| 57 | - protected $cols; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @var boolean $hidden_input_qty |
|
| 61 | - */ |
|
| 62 | - protected $hidden_input_qty; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @var string $ticket_datetime_classes |
|
| 66 | - */ |
|
| 67 | - protected $ticket_datetime_classes; |
|
| 68 | - |
|
| 69 | - |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * TicketDetails constructor. |
|
| 73 | - * |
|
| 74 | - * @param \EE_Ticket $ticket |
|
| 75 | - * @param TicketDetails $ticket_details |
|
| 76 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
| 77 | - * @param \EE_Tax_Config $tax_settings |
|
| 78 | - * @param int $max_atndz |
|
| 79 | - * @param int $row |
|
| 80 | - * @param int $cols |
|
| 81 | - * @param boolean $required_ticket_sold_out |
|
| 82 | - * @param string $event_status |
|
| 83 | - * @param string $date_format |
|
| 84 | - * @param string $ticket_datetime_classes |
|
| 85 | - */ |
|
| 86 | - public function __construct( |
|
| 87 | - \EE_Ticket $ticket, |
|
| 88 | - TicketDetails $ticket_details, |
|
| 89 | - \EE_Ticket_Selector_Config $template_settings, |
|
| 90 | - \EE_Tax_Config $tax_settings, |
|
| 91 | - $max_atndz, |
|
| 92 | - $row, |
|
| 93 | - $cols, |
|
| 94 | - $required_ticket_sold_out, |
|
| 95 | - $event_status, |
|
| 96 | - $date_format, |
|
| 97 | - $ticket_datetime_classes |
|
| 98 | - ) { |
|
| 99 | - $this->ticket = $ticket; |
|
| 100 | - $this->ticket_details = $ticket_details; |
|
| 101 | - $this->template_settings = $template_settings; |
|
| 102 | - $this->tax_settings = $tax_settings; |
|
| 103 | - $this->max_atndz = $max_atndz; |
|
| 104 | - $this->row = $row; |
|
| 105 | - $this->cols = $cols; |
|
| 106 | - $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
| 107 | - $this->event_status = $event_status; |
|
| 108 | - $this->date_format = $date_format; |
|
| 109 | - $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
| 110 | - parent::__construct($ticket, $max_atndz, $date_format); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * other ticket rows will need to know if a required ticket is sold out, |
|
| 117 | - * so that they are not offered for sale |
|
| 118 | - * |
|
| 119 | - * @return boolean |
|
| 120 | - */ |
|
| 121 | - public function getRequiredTicketSoldOut() |
|
| 122 | - { |
|
| 123 | - return $this->required_ticket_sold_out; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * @return int |
|
| 130 | - */ |
|
| 131 | - public function getCols() |
|
| 132 | - { |
|
| 133 | - return $this->cols; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * getHtml |
|
| 140 | - * |
|
| 141 | - * @return string |
|
| 142 | - * @throws \EE_Error |
|
| 143 | - */ |
|
| 144 | - public function getHtml() |
|
| 145 | - { |
|
| 146 | - $min = 0; |
|
| 147 | - $max = $this->ticket->max(); |
|
| 148 | - $remaining = $this->ticket->remaining(); |
|
| 149 | - if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) { |
|
| 150 | - list($min, $max) = $this->setTicketMinAndMax($remaining); |
|
| 151 | - } else { |
|
| 152 | - // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
| 153 | - $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
| 154 | - ? $this->ticket->start_date() |
|
| 155 | - : $this->required_ticket_sold_out; |
|
| 156 | - } |
|
| 157 | - list($ticket_price, $ticket_bundle) = $this->getTicketPriceDetails(); |
|
| 158 | - list($tkt_status, $ticket_status, $status_class) = $this->getTicketStatusClasses($remaining); |
|
| 159 | - /** |
|
| 160 | - * Allow plugins to hook in and abort the generation and display of this row to do |
|
| 161 | - * something else if they want. |
|
| 162 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 163 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 164 | - * current row. |
|
| 165 | - * |
|
| 166 | - * @var string|bool |
|
| 167 | - */ |
|
| 168 | - $ticket_selector_row_html = apply_filters( |
|
| 169 | - 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
| 170 | - false, |
|
| 171 | - $this->ticket, |
|
| 172 | - $max, |
|
| 173 | - $min, |
|
| 174 | - $this->required_ticket_sold_out, |
|
| 175 | - $ticket_price, |
|
| 176 | - $ticket_bundle, |
|
| 177 | - $ticket_status, |
|
| 178 | - $status_class |
|
| 179 | - ); |
|
| 180 | - if ($ticket_selector_row_html !== false) { |
|
| 181 | - return $ticket_selector_row_html; |
|
| 182 | - } |
|
| 183 | - $ticket_selector_row_html = \EEH_HTML::tr( |
|
| 184 | - '', '', |
|
| 185 | - "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
| 186 | - ); |
|
| 187 | - /** |
|
| 188 | - * Allow plugins to hook in and abort the generation and display of the contents of this |
|
| 189 | - * row to do something else if they want. |
|
| 190 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 191 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 192 | - * current row. |
|
| 193 | - * |
|
| 194 | - * @var string|bool |
|
| 195 | - */ |
|
| 196 | - $new_row_cells_content = apply_filters( |
|
| 197 | - 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
| 198 | - false, |
|
| 199 | - $this->ticket, |
|
| 200 | - $max, |
|
| 201 | - $min, |
|
| 202 | - $this->required_ticket_sold_out, |
|
| 203 | - $ticket_price, |
|
| 204 | - $ticket_bundle, |
|
| 205 | - $ticket_status, |
|
| 206 | - $status_class |
|
| 207 | - ); |
|
| 208 | - if ($new_row_cells_content !== false) { |
|
| 209 | - return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
| 210 | - } |
|
| 211 | - $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
|
| 212 | - |
|
| 213 | - $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
| 214 | - $ticket_selector_row_html .= $this->ticketPriceTableCell($ticket_price, $ticket_bundle); |
|
| 215 | - $ticket_selector_row_html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-qty cntr'); |
|
| 216 | - $this->setTicketStatusDisplay($tkt_status, $ticket_status, $remaining); |
|
| 217 | - if (empty($this->ticket_status_display)) { |
|
| 218 | - if ($this->max_atndz === 1) { |
|
| 219 | - // only ONE attendee is allowed to register at a time |
|
| 220 | - $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
| 221 | - } else if ($max > 0) { |
|
| 222 | - $ticket_selector_row_html .= $this->ticketQuantitySelector($min, $max); |
|
| 223 | - } |
|
| 224 | - } |
|
| 225 | - $ticket_selector_row_html .= $this->ticket_status_display; |
|
| 226 | - $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
| 227 | - $ticket_selector_row_html .= $this->ticket_details->display($ticket_price, $remaining, $this->cols); |
|
| 228 | - $ticket_selector_row_html .= \EEH_HTML::tdx(); |
|
| 229 | - $ticket_selector_row_html .= \EEH_HTML::trx(); |
|
| 230 | - |
|
| 231 | - |
|
| 232 | - $this->row++; |
|
| 233 | - return $ticket_selector_row_html; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * setTicketMinAndMax |
|
| 240 | - * |
|
| 241 | - * @param int $remaining |
|
| 242 | - * @return array |
|
| 243 | - */ |
|
| 244 | - protected function setTicketMinAndMax($remaining) |
|
| 245 | - { |
|
| 246 | - // offer the number of $tickets_remaining or $this->max_atndz, whichever is smaller |
|
| 247 | - $max = min($remaining, $this->max_atndz); |
|
| 248 | - // but... we also want to restrict the number of tickets by the ticket max setting, |
|
| 249 | - // however, the max still can't be higher than what was just set above |
|
| 250 | - $max = $this->ticket->max() > 0 ? min($this->ticket->max(), $max) : $max; |
|
| 251 | - // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
| 252 | - $min = $this->ticket->min() > 0 ? $this->ticket->min() : 0; |
|
| 253 | - // and if the ticket is required, then make sure that min qty is at least 1 |
|
| 254 | - $min = $this->ticket->required() ? max($min, 1) : $min; |
|
| 255 | - return array($min, $max); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * getTicketPriceDetails |
|
| 261 | - * |
|
| 262 | - * @return array |
|
| 263 | - */ |
|
| 264 | - protected function getTicketPriceDetails() |
|
| 265 | - { |
|
| 266 | - $ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
| 267 | - ? $this->ticket->get_ticket_total_with_taxes() |
|
| 268 | - : $this->ticket->get_ticket_subtotal(); |
|
| 269 | - $ticket_bundle = false; |
|
| 270 | - $ticket_min = $this->ticket->min(); |
|
| 271 | - // for ticket bundles, set min and max qty the same |
|
| 272 | - if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
| 273 | - $ticket_price *= $ticket_min; |
|
| 274 | - $ticket_bundle = true; |
|
| 275 | - } |
|
| 276 | - $ticket_price = apply_filters( |
|
| 277 | - 'FHEE__ticket_selector_chart_template__ticket_price', |
|
| 278 | - $ticket_price, |
|
| 279 | - $this->ticket |
|
| 280 | - ); |
|
| 281 | - return array($ticket_price, $ticket_bundle); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * getTicketStatusClasses |
|
| 288 | - * |
|
| 289 | - * @param int $remaining |
|
| 290 | - * @return array |
|
| 291 | - * @throws \EE_Error |
|
| 292 | - */ |
|
| 293 | - protected function getTicketStatusClasses($remaining = 0) |
|
| 294 | - { |
|
| 295 | - // if a previous required ticket with the same sale start date is sold out, |
|
| 296 | - // then mark this ticket as sold out as well. |
|
| 297 | - // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
| 298 | - $tkt_status = $this->required_ticket_sold_out !== false |
|
| 299 | - && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
| 300 | - ? \EE_Ticket::sold_out |
|
| 301 | - : $this->ticket->ticket_status(); |
|
| 302 | - $tkt_status = $this->event_status === \EE_Datetime::sold_out |
|
| 303 | - ? \EE_Ticket::sold_out |
|
| 304 | - : $tkt_status; |
|
| 305 | - // check ticket status |
|
| 306 | - switch ($tkt_status) { |
|
| 307 | - // sold_out |
|
| 308 | - case \EE_Ticket::sold_out : |
|
| 309 | - $ticket_status = 'ticket-sales-sold-out'; |
|
| 310 | - $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 311 | - break; |
|
| 312 | - // expired |
|
| 313 | - case \EE_Ticket::expired : |
|
| 314 | - $ticket_status = 'ticket-sales-expired'; |
|
| 315 | - $status_class = 'ticket-sales-expired lt-grey-text'; |
|
| 316 | - break; |
|
| 317 | - // archived |
|
| 318 | - case \EE_Ticket::archived : |
|
| 319 | - $ticket_status = 'archived-ticket'; |
|
| 320 | - $status_class = 'archived-ticket hidden'; |
|
| 321 | - break; |
|
| 322 | - // pending |
|
| 323 | - case \EE_Ticket::pending : |
|
| 324 | - $ticket_status = 'ticket-pending'; |
|
| 325 | - $status_class = 'ticket-pending'; |
|
| 326 | - break; |
|
| 327 | - // onsale |
|
| 328 | - case \EE_Ticket::onsale : |
|
| 329 | - default : |
|
| 330 | - $ticket_status = 'ticket-on-sale'; |
|
| 331 | - $status_class = 'ticket-on-sale'; |
|
| 332 | - break; |
|
| 333 | - } |
|
| 334 | - $ticket_status = \EEH_HTML::span($this->ticket->ticket_status(true, ($remaining > 0)), '', $ticket_status); |
|
| 335 | - return array($tkt_status, $ticket_status, $status_class); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * ticketNameTableCell |
|
| 342 | - * |
|
| 343 | - * @return string |
|
| 344 | - * @throws \EE_Error |
|
| 345 | - */ |
|
| 346 | - protected function ticketNameTableCell() |
|
| 347 | - { |
|
| 348 | - $html = \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-name'); |
|
| 349 | - $html .= \EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
| 350 | - $html .= $this->ticket_details->getShowHideLinks(); |
|
| 351 | - if ($this->ticket->required()) { |
|
| 352 | - $html .= \EEH_HTML::p( |
|
| 353 | - apply_filters( |
|
| 354 | - 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
| 355 | - esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
| 356 | - ), |
|
| 357 | - '', 'ticket-required-pg' |
|
| 358 | - ); |
|
| 359 | - } |
|
| 360 | - $html .= \EEH_HTML::tdx(); |
|
| 361 | - return $html; |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * ticketPriceTableCell |
|
| 368 | - * |
|
| 369 | - * @param float $ticket_price |
|
| 370 | - * @param bool $ticket_bundle |
|
| 371 | - * @return string |
|
| 372 | - * @throws \EE_Error |
|
| 373 | - */ |
|
| 374 | - protected function ticketPriceTableCell($ticket_price, $ticket_bundle) |
|
| 375 | - { |
|
| 376 | - $html = ''; |
|
| 377 | - if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
| 378 | - $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
|
| 379 | - $html .= \EEH_Template::format_currency($ticket_price); |
|
| 380 | - $html .= $this->ticket->taxable() |
|
| 381 | - ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
| 382 | - : ''; |
|
| 383 | - $html .= ' '; |
|
| 384 | - $html .= \EEH_HTML::span( |
|
| 385 | - $ticket_bundle |
|
| 386 | - ? apply_filters( |
|
| 387 | - 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
| 388 | - __(' / bundle', 'event_espresso') |
|
| 389 | - ) |
|
| 390 | - : apply_filters( |
|
| 391 | - 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
| 392 | - __('', 'event_espresso') |
|
| 393 | - ), |
|
| 394 | - '', 'smaller-text no-bold' |
|
| 395 | - ); |
|
| 396 | - $html .= ' '; |
|
| 397 | - $html .= \EEH_HTML::tdx(); |
|
| 398 | - $this->cols++; |
|
| 399 | - } |
|
| 400 | - return $html; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * onlyOneAttendeeCanRegister |
|
| 407 | - * |
|
| 408 | - * @return string |
|
| 409 | - */ |
|
| 410 | - protected function onlyOneAttendeeCanRegister() |
|
| 411 | - { |
|
| 412 | - // display submit button since we have tickets available |
|
| 413 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 414 | - $this->hidden_input_qty = false; |
|
| 415 | - $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 416 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 417 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 418 | - $html .= $this->row === 1 ? ' checked="checked"' : ''; |
|
| 419 | - $html .= ' title=""/>'; |
|
| 420 | - return $html; |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * ticketQuantitySelector |
|
| 427 | - * |
|
| 428 | - * @param int $min |
|
| 429 | - * @param int $max |
|
| 430 | - * @return string |
|
| 431 | - */ |
|
| 432 | - protected function ticketQuantitySelector($min = 0, $max = 0) |
|
| 433 | - { |
|
| 434 | - // display submit button since we have tickets available |
|
| 435 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 436 | - $this->hidden_input_qty = false; |
|
| 437 | - $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 438 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 439 | - $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
| 440 | - // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
| 441 | - if ($min !== 0 && ! $this->ticket->required()) { |
|
| 442 | - $html .= '<option value="0"> 0 </option>'; |
|
| 443 | - } |
|
| 444 | - // offer ticket quantities from the min to the max |
|
| 445 | - for ($i = $min; $i <= $max; $i++) { |
|
| 446 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 447 | - } |
|
| 448 | - $html .= '</select>'; |
|
| 449 | - return $html; |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - |
|
| 453 | - |
|
| 454 | - /** |
|
| 455 | - * getHiddenInputs |
|
| 456 | - * |
|
| 457 | - * @return string |
|
| 458 | - * @throws \EE_Error |
|
| 459 | - */ |
|
| 460 | - protected function ticketQtyAndIdHiddenInputs() |
|
| 461 | - { |
|
| 462 | - $html = ''; |
|
| 463 | - // depending on group reg we need to change the format for qty |
|
| 464 | - if ($this->hidden_input_qty) { |
|
| 465 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 466 | - } |
|
| 467 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 468 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 469 | - return $html; |
|
| 470 | - } |
|
| 19 | + /** |
|
| 20 | + * @var TicketDetails $ticket_details |
|
| 21 | + */ |
|
| 22 | + protected $ticket_details; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
| 26 | + */ |
|
| 27 | + protected $template_settings; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var \EE_Tax_Config $tax_settings |
|
| 31 | + */ |
|
| 32 | + protected $tax_settings; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var boolean $required_ticket_sold_out |
|
| 36 | + */ |
|
| 37 | + protected $required_ticket_sold_out; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var boolean $prices_displayed_including_taxes |
|
| 41 | + */ |
|
| 42 | + protected $prices_displayed_including_taxes; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @var string $event_status |
|
| 46 | + */ |
|
| 47 | + protected $event_status; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @var int $row |
|
| 51 | + */ |
|
| 52 | + protected $row; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @var int $cols |
|
| 56 | + */ |
|
| 57 | + protected $cols; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @var boolean $hidden_input_qty |
|
| 61 | + */ |
|
| 62 | + protected $hidden_input_qty; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @var string $ticket_datetime_classes |
|
| 66 | + */ |
|
| 67 | + protected $ticket_datetime_classes; |
|
| 68 | + |
|
| 69 | + |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * TicketDetails constructor. |
|
| 73 | + * |
|
| 74 | + * @param \EE_Ticket $ticket |
|
| 75 | + * @param TicketDetails $ticket_details |
|
| 76 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
| 77 | + * @param \EE_Tax_Config $tax_settings |
|
| 78 | + * @param int $max_atndz |
|
| 79 | + * @param int $row |
|
| 80 | + * @param int $cols |
|
| 81 | + * @param boolean $required_ticket_sold_out |
|
| 82 | + * @param string $event_status |
|
| 83 | + * @param string $date_format |
|
| 84 | + * @param string $ticket_datetime_classes |
|
| 85 | + */ |
|
| 86 | + public function __construct( |
|
| 87 | + \EE_Ticket $ticket, |
|
| 88 | + TicketDetails $ticket_details, |
|
| 89 | + \EE_Ticket_Selector_Config $template_settings, |
|
| 90 | + \EE_Tax_Config $tax_settings, |
|
| 91 | + $max_atndz, |
|
| 92 | + $row, |
|
| 93 | + $cols, |
|
| 94 | + $required_ticket_sold_out, |
|
| 95 | + $event_status, |
|
| 96 | + $date_format, |
|
| 97 | + $ticket_datetime_classes |
|
| 98 | + ) { |
|
| 99 | + $this->ticket = $ticket; |
|
| 100 | + $this->ticket_details = $ticket_details; |
|
| 101 | + $this->template_settings = $template_settings; |
|
| 102 | + $this->tax_settings = $tax_settings; |
|
| 103 | + $this->max_atndz = $max_atndz; |
|
| 104 | + $this->row = $row; |
|
| 105 | + $this->cols = $cols; |
|
| 106 | + $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
| 107 | + $this->event_status = $event_status; |
|
| 108 | + $this->date_format = $date_format; |
|
| 109 | + $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
| 110 | + parent::__construct($ticket, $max_atndz, $date_format); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * other ticket rows will need to know if a required ticket is sold out, |
|
| 117 | + * so that they are not offered for sale |
|
| 118 | + * |
|
| 119 | + * @return boolean |
|
| 120 | + */ |
|
| 121 | + public function getRequiredTicketSoldOut() |
|
| 122 | + { |
|
| 123 | + return $this->required_ticket_sold_out; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * @return int |
|
| 130 | + */ |
|
| 131 | + public function getCols() |
|
| 132 | + { |
|
| 133 | + return $this->cols; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * getHtml |
|
| 140 | + * |
|
| 141 | + * @return string |
|
| 142 | + * @throws \EE_Error |
|
| 143 | + */ |
|
| 144 | + public function getHtml() |
|
| 145 | + { |
|
| 146 | + $min = 0; |
|
| 147 | + $max = $this->ticket->max(); |
|
| 148 | + $remaining = $this->ticket->remaining(); |
|
| 149 | + if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) { |
|
| 150 | + list($min, $max) = $this->setTicketMinAndMax($remaining); |
|
| 151 | + } else { |
|
| 152 | + // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
| 153 | + $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
| 154 | + ? $this->ticket->start_date() |
|
| 155 | + : $this->required_ticket_sold_out; |
|
| 156 | + } |
|
| 157 | + list($ticket_price, $ticket_bundle) = $this->getTicketPriceDetails(); |
|
| 158 | + list($tkt_status, $ticket_status, $status_class) = $this->getTicketStatusClasses($remaining); |
|
| 159 | + /** |
|
| 160 | + * Allow plugins to hook in and abort the generation and display of this row to do |
|
| 161 | + * something else if they want. |
|
| 162 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 163 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 164 | + * current row. |
|
| 165 | + * |
|
| 166 | + * @var string|bool |
|
| 167 | + */ |
|
| 168 | + $ticket_selector_row_html = apply_filters( |
|
| 169 | + 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
| 170 | + false, |
|
| 171 | + $this->ticket, |
|
| 172 | + $max, |
|
| 173 | + $min, |
|
| 174 | + $this->required_ticket_sold_out, |
|
| 175 | + $ticket_price, |
|
| 176 | + $ticket_bundle, |
|
| 177 | + $ticket_status, |
|
| 178 | + $status_class |
|
| 179 | + ); |
|
| 180 | + if ($ticket_selector_row_html !== false) { |
|
| 181 | + return $ticket_selector_row_html; |
|
| 182 | + } |
|
| 183 | + $ticket_selector_row_html = \EEH_HTML::tr( |
|
| 184 | + '', '', |
|
| 185 | + "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
| 186 | + ); |
|
| 187 | + /** |
|
| 188 | + * Allow plugins to hook in and abort the generation and display of the contents of this |
|
| 189 | + * row to do something else if they want. |
|
| 190 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 191 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 192 | + * current row. |
|
| 193 | + * |
|
| 194 | + * @var string|bool |
|
| 195 | + */ |
|
| 196 | + $new_row_cells_content = apply_filters( |
|
| 197 | + 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
| 198 | + false, |
|
| 199 | + $this->ticket, |
|
| 200 | + $max, |
|
| 201 | + $min, |
|
| 202 | + $this->required_ticket_sold_out, |
|
| 203 | + $ticket_price, |
|
| 204 | + $ticket_bundle, |
|
| 205 | + $ticket_status, |
|
| 206 | + $status_class |
|
| 207 | + ); |
|
| 208 | + if ($new_row_cells_content !== false) { |
|
| 209 | + return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
| 210 | + } |
|
| 211 | + $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
|
| 212 | + |
|
| 213 | + $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
| 214 | + $ticket_selector_row_html .= $this->ticketPriceTableCell($ticket_price, $ticket_bundle); |
|
| 215 | + $ticket_selector_row_html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-qty cntr'); |
|
| 216 | + $this->setTicketStatusDisplay($tkt_status, $ticket_status, $remaining); |
|
| 217 | + if (empty($this->ticket_status_display)) { |
|
| 218 | + if ($this->max_atndz === 1) { |
|
| 219 | + // only ONE attendee is allowed to register at a time |
|
| 220 | + $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
| 221 | + } else if ($max > 0) { |
|
| 222 | + $ticket_selector_row_html .= $this->ticketQuantitySelector($min, $max); |
|
| 223 | + } |
|
| 224 | + } |
|
| 225 | + $ticket_selector_row_html .= $this->ticket_status_display; |
|
| 226 | + $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
| 227 | + $ticket_selector_row_html .= $this->ticket_details->display($ticket_price, $remaining, $this->cols); |
|
| 228 | + $ticket_selector_row_html .= \EEH_HTML::tdx(); |
|
| 229 | + $ticket_selector_row_html .= \EEH_HTML::trx(); |
|
| 230 | + |
|
| 231 | + |
|
| 232 | + $this->row++; |
|
| 233 | + return $ticket_selector_row_html; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * setTicketMinAndMax |
|
| 240 | + * |
|
| 241 | + * @param int $remaining |
|
| 242 | + * @return array |
|
| 243 | + */ |
|
| 244 | + protected function setTicketMinAndMax($remaining) |
|
| 245 | + { |
|
| 246 | + // offer the number of $tickets_remaining or $this->max_atndz, whichever is smaller |
|
| 247 | + $max = min($remaining, $this->max_atndz); |
|
| 248 | + // but... we also want to restrict the number of tickets by the ticket max setting, |
|
| 249 | + // however, the max still can't be higher than what was just set above |
|
| 250 | + $max = $this->ticket->max() > 0 ? min($this->ticket->max(), $max) : $max; |
|
| 251 | + // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
| 252 | + $min = $this->ticket->min() > 0 ? $this->ticket->min() : 0; |
|
| 253 | + // and if the ticket is required, then make sure that min qty is at least 1 |
|
| 254 | + $min = $this->ticket->required() ? max($min, 1) : $min; |
|
| 255 | + return array($min, $max); |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * getTicketPriceDetails |
|
| 261 | + * |
|
| 262 | + * @return array |
|
| 263 | + */ |
|
| 264 | + protected function getTicketPriceDetails() |
|
| 265 | + { |
|
| 266 | + $ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
| 267 | + ? $this->ticket->get_ticket_total_with_taxes() |
|
| 268 | + : $this->ticket->get_ticket_subtotal(); |
|
| 269 | + $ticket_bundle = false; |
|
| 270 | + $ticket_min = $this->ticket->min(); |
|
| 271 | + // for ticket bundles, set min and max qty the same |
|
| 272 | + if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
| 273 | + $ticket_price *= $ticket_min; |
|
| 274 | + $ticket_bundle = true; |
|
| 275 | + } |
|
| 276 | + $ticket_price = apply_filters( |
|
| 277 | + 'FHEE__ticket_selector_chart_template__ticket_price', |
|
| 278 | + $ticket_price, |
|
| 279 | + $this->ticket |
|
| 280 | + ); |
|
| 281 | + return array($ticket_price, $ticket_bundle); |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * getTicketStatusClasses |
|
| 288 | + * |
|
| 289 | + * @param int $remaining |
|
| 290 | + * @return array |
|
| 291 | + * @throws \EE_Error |
|
| 292 | + */ |
|
| 293 | + protected function getTicketStatusClasses($remaining = 0) |
|
| 294 | + { |
|
| 295 | + // if a previous required ticket with the same sale start date is sold out, |
|
| 296 | + // then mark this ticket as sold out as well. |
|
| 297 | + // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
| 298 | + $tkt_status = $this->required_ticket_sold_out !== false |
|
| 299 | + && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
| 300 | + ? \EE_Ticket::sold_out |
|
| 301 | + : $this->ticket->ticket_status(); |
|
| 302 | + $tkt_status = $this->event_status === \EE_Datetime::sold_out |
|
| 303 | + ? \EE_Ticket::sold_out |
|
| 304 | + : $tkt_status; |
|
| 305 | + // check ticket status |
|
| 306 | + switch ($tkt_status) { |
|
| 307 | + // sold_out |
|
| 308 | + case \EE_Ticket::sold_out : |
|
| 309 | + $ticket_status = 'ticket-sales-sold-out'; |
|
| 310 | + $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 311 | + break; |
|
| 312 | + // expired |
|
| 313 | + case \EE_Ticket::expired : |
|
| 314 | + $ticket_status = 'ticket-sales-expired'; |
|
| 315 | + $status_class = 'ticket-sales-expired lt-grey-text'; |
|
| 316 | + break; |
|
| 317 | + // archived |
|
| 318 | + case \EE_Ticket::archived : |
|
| 319 | + $ticket_status = 'archived-ticket'; |
|
| 320 | + $status_class = 'archived-ticket hidden'; |
|
| 321 | + break; |
|
| 322 | + // pending |
|
| 323 | + case \EE_Ticket::pending : |
|
| 324 | + $ticket_status = 'ticket-pending'; |
|
| 325 | + $status_class = 'ticket-pending'; |
|
| 326 | + break; |
|
| 327 | + // onsale |
|
| 328 | + case \EE_Ticket::onsale : |
|
| 329 | + default : |
|
| 330 | + $ticket_status = 'ticket-on-sale'; |
|
| 331 | + $status_class = 'ticket-on-sale'; |
|
| 332 | + break; |
|
| 333 | + } |
|
| 334 | + $ticket_status = \EEH_HTML::span($this->ticket->ticket_status(true, ($remaining > 0)), '', $ticket_status); |
|
| 335 | + return array($tkt_status, $ticket_status, $status_class); |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * ticketNameTableCell |
|
| 342 | + * |
|
| 343 | + * @return string |
|
| 344 | + * @throws \EE_Error |
|
| 345 | + */ |
|
| 346 | + protected function ticketNameTableCell() |
|
| 347 | + { |
|
| 348 | + $html = \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-name'); |
|
| 349 | + $html .= \EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
| 350 | + $html .= $this->ticket_details->getShowHideLinks(); |
|
| 351 | + if ($this->ticket->required()) { |
|
| 352 | + $html .= \EEH_HTML::p( |
|
| 353 | + apply_filters( |
|
| 354 | + 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
| 355 | + esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
| 356 | + ), |
|
| 357 | + '', 'ticket-required-pg' |
|
| 358 | + ); |
|
| 359 | + } |
|
| 360 | + $html .= \EEH_HTML::tdx(); |
|
| 361 | + return $html; |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * ticketPriceTableCell |
|
| 368 | + * |
|
| 369 | + * @param float $ticket_price |
|
| 370 | + * @param bool $ticket_bundle |
|
| 371 | + * @return string |
|
| 372 | + * @throws \EE_Error |
|
| 373 | + */ |
|
| 374 | + protected function ticketPriceTableCell($ticket_price, $ticket_bundle) |
|
| 375 | + { |
|
| 376 | + $html = ''; |
|
| 377 | + if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
| 378 | + $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
|
| 379 | + $html .= \EEH_Template::format_currency($ticket_price); |
|
| 380 | + $html .= $this->ticket->taxable() |
|
| 381 | + ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
| 382 | + : ''; |
|
| 383 | + $html .= ' '; |
|
| 384 | + $html .= \EEH_HTML::span( |
|
| 385 | + $ticket_bundle |
|
| 386 | + ? apply_filters( |
|
| 387 | + 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
| 388 | + __(' / bundle', 'event_espresso') |
|
| 389 | + ) |
|
| 390 | + : apply_filters( |
|
| 391 | + 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
| 392 | + __('', 'event_espresso') |
|
| 393 | + ), |
|
| 394 | + '', 'smaller-text no-bold' |
|
| 395 | + ); |
|
| 396 | + $html .= ' '; |
|
| 397 | + $html .= \EEH_HTML::tdx(); |
|
| 398 | + $this->cols++; |
|
| 399 | + } |
|
| 400 | + return $html; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * onlyOneAttendeeCanRegister |
|
| 407 | + * |
|
| 408 | + * @return string |
|
| 409 | + */ |
|
| 410 | + protected function onlyOneAttendeeCanRegister() |
|
| 411 | + { |
|
| 412 | + // display submit button since we have tickets available |
|
| 413 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 414 | + $this->hidden_input_qty = false; |
|
| 415 | + $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 416 | + $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 417 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 418 | + $html .= $this->row === 1 ? ' checked="checked"' : ''; |
|
| 419 | + $html .= ' title=""/>'; |
|
| 420 | + return $html; |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * ticketQuantitySelector |
|
| 427 | + * |
|
| 428 | + * @param int $min |
|
| 429 | + * @param int $max |
|
| 430 | + * @return string |
|
| 431 | + */ |
|
| 432 | + protected function ticketQuantitySelector($min = 0, $max = 0) |
|
| 433 | + { |
|
| 434 | + // display submit button since we have tickets available |
|
| 435 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 436 | + $this->hidden_input_qty = false; |
|
| 437 | + $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 438 | + $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 439 | + $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
| 440 | + // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
| 441 | + if ($min !== 0 && ! $this->ticket->required()) { |
|
| 442 | + $html .= '<option value="0"> 0 </option>'; |
|
| 443 | + } |
|
| 444 | + // offer ticket quantities from the min to the max |
|
| 445 | + for ($i = $min; $i <= $max; $i++) { |
|
| 446 | + $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 447 | + } |
|
| 448 | + $html .= '</select>'; |
|
| 449 | + return $html; |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + |
|
| 453 | + |
|
| 454 | + /** |
|
| 455 | + * getHiddenInputs |
|
| 456 | + * |
|
| 457 | + * @return string |
|
| 458 | + * @throws \EE_Error |
|
| 459 | + */ |
|
| 460 | + protected function ticketQtyAndIdHiddenInputs() |
|
| 461 | + { |
|
| 462 | + $html = ''; |
|
| 463 | + // depending on group reg we need to change the format for qty |
|
| 464 | + if ($this->hidden_input_qty) { |
|
| 465 | + $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 466 | + } |
|
| 467 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 468 | + $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 469 | + return $html; |
|
| 470 | + } |
|
| 471 | 471 | |
| 472 | 472 | } |
| 473 | 473 | // End of file TicketSelectorRowStandard.php |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public static function instance() { |
| 43 | 43 | // check if class object is instantiated, and instantiated properly |
| 44 | - if ( ! self::$_instance instanceof EEH_HTML ) { |
|
| 44 | + if ( ! self::$_instance instanceof EEH_HTML) { |
|
| 45 | 45 | self::$_instance = new EEH_HTML(); |
| 46 | 46 | } |
| 47 | 47 | return self::$_instance; |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | $other_attributes = '', |
| 103 | 103 | $force_close = false |
| 104 | 104 | ) { |
| 105 | - $attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 106 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 107 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 108 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 109 | - $html = EEH_HTML::nl( 0, $tag ) . '<' . $tag . $attributes . '>'; |
|
| 110 | - $html .= ! empty( $content ) ? EEH_HTML::nl( 1, $tag ) . $content : ''; |
|
| 111 | - $indent = ! empty( $content ) || $force_close ? TRUE : FALSE; |
|
| 112 | - $html .= ! empty( $content ) || $force_close ? EEH_HTML::_close_tag( $tag, $id, $class, $indent ) : ''; |
|
| 105 | + $attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 106 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 107 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 108 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 109 | + $html = EEH_HTML::nl(0, $tag).'<'.$tag.$attributes.'>'; |
|
| 110 | + $html .= ! empty($content) ? EEH_HTML::nl(1, $tag).$content : ''; |
|
| 111 | + $indent = ! empty($content) || $force_close ? TRUE : FALSE; |
|
| 112 | + $html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : ''; |
|
| 113 | 113 | return $html; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | * @param bool $indent |
| 127 | 127 | * @return string |
| 128 | 128 | */ |
| 129 | - protected static function _close_tag( $tag = 'div', $id = '', $class = '', $indent = TRUE ) { |
|
| 129 | + protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = TRUE) { |
|
| 130 | 130 | $comment = ''; |
| 131 | - if ( $id ) { |
|
| 132 | - $comment = EEH_HTML::comment( 'close ' . $id ) . EEH_HTML::nl( 0, $tag ); |
|
| 133 | - } else if ( $class ) { |
|
| 134 | - $comment = EEH_HTML::comment( 'close ' . $class ) . EEH_HTML::nl( 0, $tag ); |
|
| 131 | + if ($id) { |
|
| 132 | + $comment = EEH_HTML::comment('close '.$id).EEH_HTML::nl(0, $tag); |
|
| 133 | + } else if ($class) { |
|
| 134 | + $comment = EEH_HTML::comment('close '.$class).EEH_HTML::nl(0, $tag); |
|
| 135 | 135 | } |
| 136 | 136 | $html = $indent ? EEH_HTML::nl( -1, $tag ) : ''; |
| 137 | - $html .= '</' . $tag . '>' . $comment; |
|
| 137 | + $html .= '</'.$tag.'>'.$comment; |
|
| 138 | 138 | return $html; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 154 | 154 | * @return string |
| 155 | 155 | */ |
| 156 | - public static function div( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 157 | - return EEH_HTML::_open_tag( 'div', $content, $id, $class, $style, $other_attributes ); |
|
| 156 | + public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 157 | + return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | * @param string $class - html class attribute |
| 168 | 168 | * @return string |
| 169 | 169 | */ |
| 170 | - public static function divx( $id = '', $class = '' ) { |
|
| 171 | - return EEH_HTML::_close_tag( 'div', $id, $class ); |
|
| 170 | + public static function divx($id = '', $class = '') { |
|
| 171 | + return EEH_HTML::_close_tag('div', $id, $class); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 185 | 185 | * @return string |
| 186 | 186 | */ |
| 187 | - public static function h1( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 188 | - return EEH_HTML::_open_tag( 'h1', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 187 | + public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 188 | + return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 202 | 202 | * @return string |
| 203 | 203 | */ |
| 204 | - public static function h2( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 205 | - return EEH_HTML::_open_tag( 'h2', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 204 | + public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 205 | + return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 219 | 219 | * @return string |
| 220 | 220 | */ |
| 221 | - public static function h3( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 222 | - return EEH_HTML::_open_tag( 'h3', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 221 | + public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 222 | + return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 236 | 236 | * @return string |
| 237 | 237 | */ |
| 238 | - public static function h4( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 239 | - return EEH_HTML::_open_tag( 'h4', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 238 | + public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 239 | + return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | - public static function h5( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 256 | - return EEH_HTML::_open_tag( 'h5', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 255 | + public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 256 | + return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
| 272 | - public static function h6( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 273 | - return EEH_HTML::_open_tag( 'h6', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 272 | + public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 273 | + return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 287 | 287 | * @return string |
| 288 | 288 | */ |
| 289 | - public static function p( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 290 | - return EEH_HTML::_open_tag( 'p', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 289 | + public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 290 | + return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 303 | 303 | * @return string |
| 304 | 304 | */ |
| 305 | - public static function ul( $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 306 | - return EEH_HTML::_open_tag( 'ul', '', $id, $class, $style, $other_attributes ); |
|
| 305 | + public static function ul($id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 306 | + return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | * @param string $class - html class attribute |
| 317 | 317 | * @return string |
| 318 | 318 | */ |
| 319 | - public static function ulx( $id = '', $class = '' ) { |
|
| 320 | - return EEH_HTML::_close_tag( 'ul', $id, $class ); |
|
| 319 | + public static function ulx($id = '', $class = '') { |
|
| 320 | + return EEH_HTML::_close_tag('ul', $id, $class); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 335 | 335 | * @return string |
| 336 | 336 | */ |
| 337 | - public static function li( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 338 | - return EEH_HTML::_open_tag( 'li', $content, $id, $class, $style, $other_attributes ); |
|
| 337 | + public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 338 | + return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | |
@@ -348,8 +348,8 @@ discard block |
||
| 348 | 348 | * @param string $class - html class attribute |
| 349 | 349 | * @return string |
| 350 | 350 | */ |
| 351 | - public static function lix( $id = '', $class = '' ) { |
|
| 352 | - return EEH_HTML::_close_tag( 'li', $id, $class ); |
|
| 351 | + public static function lix($id = '', $class = '') { |
|
| 352 | + return EEH_HTML::_close_tag('li', $id, $class); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 366 | 366 | * @return string |
| 367 | 367 | */ |
| 368 | - public static function table( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 369 | - return EEH_HTML::_open_tag( 'table', $content, $id, $class, $style, $other_attributes ); |
|
| 368 | + public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 369 | + return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | * @param string $class - html class attribute |
| 379 | 379 | * @return string |
| 380 | 380 | */ |
| 381 | - public static function tablex( $id = '', $class = '' ) { |
|
| 382 | - return EEH_HTML::_close_tag( 'table', $id, $class ); |
|
| 381 | + public static function tablex($id = '', $class = '') { |
|
| 382 | + return EEH_HTML::_close_tag('table', $id, $class); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 396 | 396 | * @return string |
| 397 | 397 | */ |
| 398 | - public static function thead( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 399 | - return EEH_HTML::_open_tag( 'thead', $content, $id, $class, $style, $other_attributes ); |
|
| 398 | + public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 399 | + return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | * @param string $class - html class attribute |
| 409 | 409 | * @return string |
| 410 | 410 | */ |
| 411 | - public static function theadx( $id = '', $class = '' ) { |
|
| 412 | - return EEH_HTML::_close_tag( 'thead', $id, $class ); |
|
| 411 | + public static function theadx($id = '', $class = '') { |
|
| 412 | + return EEH_HTML::_close_tag('thead', $id, $class); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | |
@@ -425,8 +425,8 @@ discard block |
||
| 425 | 425 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 426 | 426 | * @return string |
| 427 | 427 | */ |
| 428 | - public static function tbody( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 429 | - return EEH_HTML::_open_tag( 'tbody', $content, $id, $class, $style, $other_attributes ); |
|
| 428 | + public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 429 | + return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes); |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | * @param string $class - html class attribute |
| 439 | 439 | * @return string |
| 440 | 440 | */ |
| 441 | - public static function tbodyx( $id = '', $class = '' ) { |
|
| 442 | - return EEH_HTML::_close_tag( 'tbody', $id, $class ); |
|
| 441 | + public static function tbodyx($id = '', $class = '') { |
|
| 442 | + return EEH_HTML::_close_tag('tbody', $id, $class); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 456 | 456 | * @return string |
| 457 | 457 | */ |
| 458 | - public static function tr( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 459 | - return EEH_HTML::_open_tag( 'tr', $content, $id, $class, $style, $other_attributes ); |
|
| 458 | + public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 459 | + return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | |
@@ -468,8 +468,8 @@ discard block |
||
| 468 | 468 | * @param string $class - html class attribute |
| 469 | 469 | * @return string |
| 470 | 470 | */ |
| 471 | - public static function trx( $id = '', $class = '' ) { |
|
| 472 | - return EEH_HTML::_close_tag( 'tr', $id, $class ); |
|
| 471 | + public static function trx($id = '', $class = '') { |
|
| 472 | + return EEH_HTML::_close_tag('tr', $id, $class); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | |
@@ -485,8 +485,8 @@ discard block |
||
| 485 | 485 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 486 | 486 | * @return string |
| 487 | 487 | */ |
| 488 | - public static function th( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 489 | - return EEH_HTML::_open_tag( 'th', $content, $id, $class, $style, $other_attributes ); |
|
| 488 | + public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 489 | + return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | |
@@ -498,8 +498,8 @@ discard block |
||
| 498 | 498 | * @param string $class - html class attribute |
| 499 | 499 | * @return string |
| 500 | 500 | */ |
| 501 | - public static function thx( $id = '', $class = '' ) { |
|
| 502 | - return EEH_HTML::_close_tag( 'th', $id, $class ); |
|
| 501 | + public static function thx($id = '', $class = '') { |
|
| 502 | + return EEH_HTML::_close_tag('th', $id, $class); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 516 | 516 | * @return string |
| 517 | 517 | */ |
| 518 | - public static function td( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 519 | - return EEH_HTML::_open_tag( 'td', $content, $id, $class, $style, $other_attributes ); |
|
| 518 | + public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 519 | + return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
@@ -528,8 +528,8 @@ discard block |
||
| 528 | 528 | * @param string $class - html class attribute |
| 529 | 529 | * @return string |
| 530 | 530 | */ |
| 531 | - public static function tdx( $id = '', $class = '' ) { |
|
| 532 | - return EEH_HTML::_close_tag( 'td', $id, $class ); |
|
| 531 | + public static function tdx($id = '', $class = '') { |
|
| 532 | + return EEH_HTML::_close_tag('td', $id, $class); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | |
@@ -543,10 +543,10 @@ discard block |
||
| 543 | 543 | * @param int $colspan |
| 544 | 544 | * @return string |
| 545 | 545 | */ |
| 546 | - public static function no_row( $content = '', $colspan = 2 ) { |
|
| 546 | + public static function no_row($content = '', $colspan = 2) { |
|
| 547 | 547 | return EEH_HTML::tr( |
| 548 | - EEH_HTML::td( $content, '', '', 'padding:0; border:none;', 'colspan="' . $colspan . '"' ), |
|
| 549 | - '', '', 'padding:0; border:none;' |
|
| 548 | + EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="'.$colspan.'"'), |
|
| 549 | + '', '', 'padding:0; border:none;' |
|
| 550 | 550 | ); |
| 551 | 551 | } |
| 552 | 552 | |
@@ -566,14 +566,14 @@ discard block |
||
| 566 | 566 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 567 | 567 | * @return string |
| 568 | 568 | */ |
| 569 | - public static function link( $href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 570 | - $link_text = ! empty( $link_text ) ? $link_text : $href; |
|
| 571 | - $attributes = ! empty($href ) ? ' href="' . $href . '"' : ''; |
|
| 572 | - $attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 573 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 574 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 575 | - $attributes .= ! empty( $title ) ? ' title="' . esc_attr( $title ) . '"' : ''; |
|
| 576 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 569 | + public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 570 | + $link_text = ! empty($link_text) ? $link_text : $href; |
|
| 571 | + $attributes = ! empty($href) ? ' href="'.$href.'"' : ''; |
|
| 572 | + $attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 573 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 574 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 575 | + $attributes .= ! empty($title) ? ' title="'.esc_attr($title).'"' : ''; |
|
| 576 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 577 | 577 | return "<a{$attributes}>{$link_text}</a>"; |
| 578 | 578 | } |
| 579 | 579 | |
@@ -591,14 +591,14 @@ discard block |
||
| 591 | 591 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 592 | 592 | * @return string |
| 593 | 593 | */ |
| 594 | - public static function img( $src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 595 | - $attributes = ! empty( $src ) ? ' src="' . esc_url_raw( $src ) . '"' : ''; |
|
| 596 | - $attributes .= ! empty( $alt ) ? ' alt="' . esc_attr( $alt ) . '"' : ''; |
|
| 597 | - $attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 598 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 599 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 600 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 601 | - return '<img' . $attributes . '/>'; |
|
| 594 | + public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 595 | + $attributes = ! empty($src) ? ' src="'.esc_url_raw($src).'"' : ''; |
|
| 596 | + $attributes .= ! empty($alt) ? ' alt="'.esc_attr($alt).'"' : ''; |
|
| 597 | + $attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 598 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 599 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 600 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 601 | + return '<img'.$attributes.'/>'; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | |
@@ -616,12 +616,12 @@ discard block |
||
| 616 | 616 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 617 | 617 | * @return string |
| 618 | 618 | */ |
| 619 | - protected static function _inline_tag( $tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 620 | - $attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 621 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 622 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 623 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 624 | - return '<' . $tag . ' ' . $attributes . '>' . $content . '</' . $tag . '>'; |
|
| 619 | + protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 620 | + $attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 621 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 622 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 623 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 624 | + return '<'.$tag.' '.$attributes.'>'.$content.'</'.$tag.'>'; |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 638 | 638 | * @return string |
| 639 | 639 | */ |
| 640 | - public static function label( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 641 | - return EEH_HTML::_inline_tag( 'label', $content, $id, $class, $style, $other_attributes ); |
|
| 640 | + public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 641 | + return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | |
@@ -654,8 +654,8 @@ discard block |
||
| 654 | 654 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 655 | 655 | * @return string |
| 656 | 656 | */ |
| 657 | - public static function span( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 658 | - return EEH_HTML::_inline_tag( 'span', $content, $id, $class, $style, $other_attributes ); |
|
| 657 | + public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 658 | + return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | |
@@ -671,8 +671,8 @@ discard block |
||
| 671 | 671 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 672 | 672 | * @return string |
| 673 | 673 | */ |
| 674 | - public static function strong( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 675 | - return EEH_HTML::_inline_tag( 'strong', $content, $id, $class, $style, $other_attributes ); |
|
| 674 | + public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 675 | + return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | |
@@ -684,8 +684,8 @@ discard block |
||
| 684 | 684 | * @param string $comment |
| 685 | 685 | * @return string |
| 686 | 686 | */ |
| 687 | - public static function comment( $comment = '' ) { |
|
| 688 | - return ! empty( $comment ) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : ''; |
|
| 687 | + public static function comment($comment = '') { |
|
| 688 | + return ! empty($comment) ? EEH_HTML::nl().'<!-- '.$comment.' -->' : ''; |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | |
@@ -696,8 +696,8 @@ discard block |
||
| 696 | 696 | * @param int $nmbr - the number of line breaks to return |
| 697 | 697 | * @return string |
| 698 | 698 | */ |
| 699 | - public static function br( $nmbr = 1 ) { |
|
| 700 | - return str_repeat( '<br />', $nmbr ); |
|
| 699 | + public static function br($nmbr = 1) { |
|
| 700 | + return str_repeat('<br />', $nmbr); |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | |
@@ -708,8 +708,8 @@ discard block |
||
| 708 | 708 | * @param int $nmbr - the number of non-breaking spaces to return |
| 709 | 709 | * @return string |
| 710 | 710 | */ |
| 711 | - public static function nbsp( $nmbr = 1 ) { |
|
| 712 | - return str_repeat( ' ', $nmbr ); |
|
| 711 | + public static function nbsp($nmbr = 1) { |
|
| 712 | + return str_repeat(' ', $nmbr); |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | |
@@ -723,9 +723,9 @@ discard block |
||
| 723 | 723 | * @param string $id |
| 724 | 724 | * @return string |
| 725 | 725 | */ |
| 726 | - public static function sanitize_id( $id = '' ) { |
|
| 727 | - $key = str_replace( ' ', '-', trim( $id ) ); |
|
| 728 | - return preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key ); |
|
| 726 | + public static function sanitize_id($id = '') { |
|
| 727 | + $key = str_replace(' ', '-', trim($id)); |
|
| 728 | + return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key); |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | |
@@ -737,10 +737,10 @@ discard block |
||
| 737 | 737 | * @param string $tag |
| 738 | 738 | * @return string - newline character plus # of indents passed (can be + or -) |
| 739 | 739 | */ |
| 740 | - public static function nl( $indent = 0, $tag = 'none' ) { |
|
| 740 | + public static function nl($indent = 0, $tag = 'none') { |
|
| 741 | 741 | $html = "\n"; |
| 742 | - EEH_HTML::indent( $indent, $tag ); |
|
| 743 | - for ( $x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++ ) { |
|
| 742 | + EEH_HTML::indent($indent, $tag); |
|
| 743 | + for ($x = 0; $x < EEH_HTML::$_indent[$tag]; $x++) { |
|
| 744 | 744 | $html .= "\t"; |
| 745 | 745 | } |
| 746 | 746 | return $html; |
@@ -755,17 +755,17 @@ discard block |
||
| 755 | 755 | * @param int $indent can be negative to decrease the indentation level |
| 756 | 756 | * @param string $tag |
| 757 | 757 | */ |
| 758 | - public static function indent( $indent, $tag = 'none' ){ |
|
| 758 | + public static function indent($indent, $tag = 'none') { |
|
| 759 | 759 | static $default_indentation = FALSE; |
| 760 | - if ( ! $default_indentation ) { |
|
| 760 | + if ( ! $default_indentation) { |
|
| 761 | 761 | EEH_HTML::_set_default_indentation(); |
| 762 | 762 | $default_indentation = TRUE; |
| 763 | 763 | } |
| 764 | - if ( ! isset( EEH_HTML::$_indent[ $tag ] )) { |
|
| 765 | - EEH_HTML::$_indent[ $tag ] = 0; |
|
| 764 | + if ( ! isset(EEH_HTML::$_indent[$tag])) { |
|
| 765 | + EEH_HTML::$_indent[$tag] = 0; |
|
| 766 | 766 | } |
| 767 | - EEH_HTML::$_indent[ $tag ] += (int)$indent; |
|
| 768 | - EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0; |
|
| 767 | + EEH_HTML::$_indent[$tag] += (int) $indent; |
|
| 768 | + EEH_HTML::$_indent[$tag] = EEH_HTML::$_indent[$tag] >= 0 ? EEH_HTML::$_indent[$tag] : 0; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -811,15 +811,15 @@ discard block |
||
| 811 | 811 | * @global array $allowedtags |
| 812 | 812 | * @return array |
| 813 | 813 | */ |
| 814 | - public static function get_simple_tags(){ |
|
| 814 | + public static function get_simple_tags() { |
|
| 815 | 815 | global $allowedtags; |
| 816 | 816 | $tags_we_allow = $allowedtags; |
| 817 | - $tags_we_allow['ol']=array(); |
|
| 818 | - $tags_we_allow['ul']=array(); |
|
| 819 | - $tags_we_allow['li']=array(); |
|
| 820 | - $tags_we_allow['br']=array(); |
|
| 821 | - $tags_we_allow['p']=array(); |
|
| 822 | - return apply_filters( 'FHEE__EEH_HTML__get_simple_tags', $tags_we_allow ); |
|
| 817 | + $tags_we_allow['ol'] = array(); |
|
| 818 | + $tags_we_allow['ul'] = array(); |
|
| 819 | + $tags_we_allow['li'] = array(); |
|
| 820 | + $tags_we_allow['br'] = array(); |
|
| 821 | + $tags_we_allow['p'] = array(); |
|
| 822 | + return apply_filters('FHEE__EEH_HTML__get_simple_tags', $tags_we_allow); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | |
@@ -17,158 +17,158 @@ |
||
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var \EE_Ticket $ticket |
|
| 22 | - */ |
|
| 23 | - protected $ticket; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
| 27 | - */ |
|
| 28 | - protected $template_settings; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @var string $date_format |
|
| 32 | - */ |
|
| 33 | - protected $date_format; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var string $time_format |
|
| 37 | - */ |
|
| 38 | - protected $time_format; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var boolean $event_is_expired |
|
| 42 | - */ |
|
| 43 | - protected $event_is_expired; |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * TicketDetails constructor. |
|
| 49 | - * |
|
| 50 | - * @param \EE_Ticket $ticket |
|
| 51 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
| 52 | - * @param array $template_args |
|
| 53 | - */ |
|
| 54 | - public function __construct( |
|
| 55 | - \EE_Ticket $ticket, |
|
| 56 | - \EE_Ticket_Selector_Config $template_settings, |
|
| 57 | - array $template_args |
|
| 58 | - ) |
|
| 59 | - { |
|
| 60 | - $this->ticket = $ticket; |
|
| 61 | - $this->template_settings = $template_settings; |
|
| 62 | - $this->date_format = $template_args['date_format']; |
|
| 63 | - $this->time_format = $template_args['time_format']; |
|
| 64 | - $this->event_is_expired = $template_args['event_is_expired']; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 72 | - public function showTicketDetails() |
|
| 73 | - { |
|
| 74 | - return $this->template_settings->show_ticket_details; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 82 | - public function getShowHideLinks() |
|
| 83 | - { |
|
| 84 | - if ( ! $this->showTicketDetails()) { |
|
| 85 | - return ''; |
|
| 86 | - } |
|
| 87 | - return \EEH_HTML::link( |
|
| 88 | - '', |
|
| 89 | - sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 90 | - esc_attr( |
|
| 91 | - apply_filters( |
|
| 92 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 93 | - __('click to show additional ticket details', 'event_espresso') |
|
| 94 | - ) |
|
| 95 | - ), |
|
| 96 | - "display-{$this->cssId()}", |
|
| 97 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 98 | - '', |
|
| 99 | - 'rel="' . $this->cssId() . '"' |
|
| 100 | - ) . \EEH_HTML::link( |
|
| 101 | - '', |
|
| 102 | - sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 103 | - esc_attr( |
|
| 104 | - apply_filters( |
|
| 105 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 106 | - __('click to hide additional ticket details', 'event_espresso') |
|
| 107 | - ) |
|
| 108 | - ), |
|
| 109 | - "hide-{$this->cssId()}", |
|
| 110 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 111 | - 'display:none;', |
|
| 112 | - 'rel="' . $this->cssId() . '"' |
|
| 113 | - ); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * @return string |
|
| 120 | - */ |
|
| 121 | - public function cssId() |
|
| 122 | - { |
|
| 123 | - return apply_filters( |
|
| 124 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 125 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 126 | - ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * @param float $ticket_price |
|
| 133 | - * @param int $remaining |
|
| 134 | - * @param int $cols |
|
| 135 | - * @return string |
|
| 136 | - */ |
|
| 137 | - public function display( |
|
| 138 | - $ticket_price = 0.00, |
|
| 139 | - $remaining, |
|
| 140 | - $cols = 2 |
|
| 141 | - ) { |
|
| 142 | - $template_args = array(); |
|
| 143 | - $template_args['ticket'] = $this->ticket; |
|
| 144 | - $template_args['ticket_price'] = $ticket_price; |
|
| 145 | - $template_args['remaining'] = $remaining; |
|
| 146 | - $template_args['cols'] = $cols; |
|
| 147 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 148 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 149 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 150 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 151 | - $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
| 152 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 153 | - true |
|
| 154 | - ); |
|
| 155 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
| 156 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 157 | - esc_html__('Price', 'event_espresso') |
|
| 158 | - ); |
|
| 159 | - $template_args['date_format'] = $this->date_format; |
|
| 160 | - $template_args['time_format'] = $this->time_format; |
|
| 161 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 162 | - |
|
| 163 | - return \EEH_Template::locate_template( |
|
| 164 | - apply_filters( |
|
| 165 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 166 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 167 | - $this->ticket |
|
| 168 | - ), |
|
| 169 | - $template_args |
|
| 170 | - ); |
|
| 171 | - } |
|
| 20 | + /** |
|
| 21 | + * @var \EE_Ticket $ticket |
|
| 22 | + */ |
|
| 23 | + protected $ticket; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
| 27 | + */ |
|
| 28 | + protected $template_settings; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @var string $date_format |
|
| 32 | + */ |
|
| 33 | + protected $date_format; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var string $time_format |
|
| 37 | + */ |
|
| 38 | + protected $time_format; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var boolean $event_is_expired |
|
| 42 | + */ |
|
| 43 | + protected $event_is_expired; |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * TicketDetails constructor. |
|
| 49 | + * |
|
| 50 | + * @param \EE_Ticket $ticket |
|
| 51 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
| 52 | + * @param array $template_args |
|
| 53 | + */ |
|
| 54 | + public function __construct( |
|
| 55 | + \EE_Ticket $ticket, |
|
| 56 | + \EE_Ticket_Selector_Config $template_settings, |
|
| 57 | + array $template_args |
|
| 58 | + ) |
|
| 59 | + { |
|
| 60 | + $this->ticket = $ticket; |
|
| 61 | + $this->template_settings = $template_settings; |
|
| 62 | + $this->date_format = $template_args['date_format']; |
|
| 63 | + $this->time_format = $template_args['time_format']; |
|
| 64 | + $this->event_is_expired = $template_args['event_is_expired']; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | + public function showTicketDetails() |
|
| 73 | + { |
|
| 74 | + return $this->template_settings->show_ticket_details; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | + public function getShowHideLinks() |
|
| 83 | + { |
|
| 84 | + if ( ! $this->showTicketDetails()) { |
|
| 85 | + return ''; |
|
| 86 | + } |
|
| 87 | + return \EEH_HTML::link( |
|
| 88 | + '', |
|
| 89 | + sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 90 | + esc_attr( |
|
| 91 | + apply_filters( |
|
| 92 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 93 | + __('click to show additional ticket details', 'event_espresso') |
|
| 94 | + ) |
|
| 95 | + ), |
|
| 96 | + "display-{$this->cssId()}", |
|
| 97 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 98 | + '', |
|
| 99 | + 'rel="' . $this->cssId() . '"' |
|
| 100 | + ) . \EEH_HTML::link( |
|
| 101 | + '', |
|
| 102 | + sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 103 | + esc_attr( |
|
| 104 | + apply_filters( |
|
| 105 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 106 | + __('click to hide additional ticket details', 'event_espresso') |
|
| 107 | + ) |
|
| 108 | + ), |
|
| 109 | + "hide-{$this->cssId()}", |
|
| 110 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 111 | + 'display:none;', |
|
| 112 | + 'rel="' . $this->cssId() . '"' |
|
| 113 | + ); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * @return string |
|
| 120 | + */ |
|
| 121 | + public function cssId() |
|
| 122 | + { |
|
| 123 | + return apply_filters( |
|
| 124 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 125 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 126 | + ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * @param float $ticket_price |
|
| 133 | + * @param int $remaining |
|
| 134 | + * @param int $cols |
|
| 135 | + * @return string |
|
| 136 | + */ |
|
| 137 | + public function display( |
|
| 138 | + $ticket_price = 0.00, |
|
| 139 | + $remaining, |
|
| 140 | + $cols = 2 |
|
| 141 | + ) { |
|
| 142 | + $template_args = array(); |
|
| 143 | + $template_args['ticket'] = $this->ticket; |
|
| 144 | + $template_args['ticket_price'] = $ticket_price; |
|
| 145 | + $template_args['remaining'] = $remaining; |
|
| 146 | + $template_args['cols'] = $cols; |
|
| 147 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 148 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 149 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 150 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 151 | + $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
| 152 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 153 | + true |
|
| 154 | + ); |
|
| 155 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
| 156 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 157 | + esc_html__('Price', 'event_espresso') |
|
| 158 | + ); |
|
| 159 | + $template_args['date_format'] = $this->date_format; |
|
| 160 | + $template_args['time_format'] = $this->time_format; |
|
| 161 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 162 | + |
|
| 163 | + return \EEH_Template::locate_template( |
|
| 164 | + apply_filters( |
|
| 165 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 166 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 167 | + $this->ticket |
|
| 168 | + ), |
|
| 169 | + $template_args |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | 173 | } |
| 174 | 174 | // End of file TicketDetails.php |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | "display-{$this->cssId()}", |
| 97 | 97 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
| 98 | 98 | '', |
| 99 | - 'rel="' . $this->cssId() . '"' |
|
| 100 | - ) . \EEH_HTML::link( |
|
| 99 | + 'rel="'.$this->cssId().'"' |
|
| 100 | + ).\EEH_HTML::link( |
|
| 101 | 101 | '', |
| 102 | 102 | sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
| 103 | 103 | esc_attr( |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | "hide-{$this->cssId()}", |
| 110 | 110 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
| 111 | 111 | 'display:none;', |
| 112 | - 'rel="' . $this->cssId() . '"' |
|
| 112 | + 'rel="'.$this->cssId().'"' |
|
| 113 | 113 | ); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return \EEH_Template::locate_template( |
| 164 | 164 | apply_filters( |
| 165 | 165 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
| 166 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 166 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
| 167 | 167 | $this->ticket |
| 168 | 168 | ), |
| 169 | 169 | $template_args |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
| 7 | 7 | <?php |
| 8 | 8 | if ( $ticket instanceof EE_Ticket ) { |
| 9 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
| 10 | - $ticket_description = $ticket->description(); |
|
| 11 | - $ticket_description .= ! empty( $ticket_description ) |
|
| 12 | - ? '<br />' . $ticket_status_display |
|
| 13 | - : $ticket_status_display; |
|
| 14 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
| 15 | - $ticket_description = "<p>{$ticket_description}</p>"; |
|
| 16 | - } |
|
| 9 | + do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
| 10 | + $ticket_description = $ticket->description(); |
|
| 11 | + $ticket_description .= ! empty( $ticket_description ) |
|
| 12 | + ? '<br />' . $ticket_status_display |
|
| 13 | + : $ticket_status_display; |
|
| 14 | + if ( ! strpos( $ticket_description, '<div' ) ) { |
|
| 15 | + $ticket_description = "<p>{$ticket_description}</p>"; |
|
| 16 | + } |
|
| 17 | 17 | ?> |
| 18 | 18 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
| 19 | 19 | <div class="no-tkt-slctr-ticket-content-dv"> |
@@ -23,6 +23,6 @@ discard block |
||
| 23 | 23 | <?php } ?> |
| 24 | 24 | </div> |
| 25 | 25 | <?php |
| 26 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
| 26 | + do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
| 27 | 27 | } |
| 28 | 28 | ?> |
@@ -5,24 +5,24 @@ |
||
| 5 | 5 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
| 6 | 6 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
| 7 | 7 | <?php |
| 8 | -if ( $ticket instanceof EE_Ticket ) { |
|
| 9 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
| 8 | +if ($ticket instanceof EE_Ticket) { |
|
| 9 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
| 10 | 10 | $ticket_description = $ticket->description(); |
| 11 | - $ticket_description .= ! empty( $ticket_description ) |
|
| 12 | - ? '<br />' . $ticket_status_display |
|
| 11 | + $ticket_description .= ! empty($ticket_description) |
|
| 12 | + ? '<br />'.$ticket_status_display |
|
| 13 | 13 | : $ticket_status_display; |
| 14 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
| 14 | + if ( ! strpos($ticket_description, '<div')) { |
|
| 15 | 15 | $ticket_description = "<p>{$ticket_description}</p>"; |
| 16 | 16 | } |
| 17 | 17 | ?> |
| 18 | 18 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
| 19 | 19 | <div class="no-tkt-slctr-ticket-content-dv"> |
| 20 | 20 | <h5><?php echo $ticket->name(); ?></h5> |
| 21 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
| 21 | + <?php if ( ! empty($ticket_description)) { ?> |
|
| 22 | 22 | <?php echo $ticket_description; ?> |
| 23 | 23 | <?php } ?> |
| 24 | 24 | </div> |
| 25 | 25 | <?php |
| 26 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
| 26 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
| 27 | 27 | } |
| 28 | 28 | ?> |
@@ -18,46 +18,46 @@ |
||
| 18 | 18 | class TicketSelectorSimple extends TicketSelector |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var \EE_Ticket $ticket |
|
| 23 | - */ |
|
| 24 | - protected $ticket; |
|
| 21 | + /** |
|
| 22 | + * @var \EE_Ticket $ticket |
|
| 23 | + */ |
|
| 24 | + protected $ticket; |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * TicketSelectorSimple constructor. |
|
| 30 | - * |
|
| 31 | - * @param \EE_Event $event |
|
| 32 | - * @param \EE_Ticket $ticket |
|
| 33 | - * @param int $max_attendees |
|
| 34 | - * @param array $template_args |
|
| 35 | - */ |
|
| 36 | - public function __construct(\EE_Event $event, \EE_Ticket $ticket, $max_attendees, array $template_args) |
|
| 37 | - { |
|
| 38 | - $this->ticket = $ticket; |
|
| 39 | - parent::__construct($event, array($this->ticket), $max_attendees, $template_args); |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * TicketSelectorSimple constructor. |
|
| 30 | + * |
|
| 31 | + * @param \EE_Event $event |
|
| 32 | + * @param \EE_Ticket $ticket |
|
| 33 | + * @param int $max_attendees |
|
| 34 | + * @param array $template_args |
|
| 35 | + */ |
|
| 36 | + public function __construct(\EE_Event $event, \EE_Ticket $ticket, $max_attendees, array $template_args) |
|
| 37 | + { |
|
| 38 | + $this->ticket = $ticket; |
|
| 39 | + parent::__construct($event, array($this->ticket), $max_attendees, $template_args); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * sets any and all template args that are required for this Ticket Selector |
|
| 46 | - * |
|
| 47 | - * @return void |
|
| 48 | - */ |
|
| 49 | - protected function addTemplateArgs() |
|
| 50 | - { |
|
| 51 | - unset($this->template_args['tickets']); |
|
| 52 | - $this->template_args['ticket'] = $this->ticket; |
|
| 53 | - $ticket_selector_row = new TicketSelectorRowSimple( |
|
| 54 | - $this->ticket, |
|
| 55 | - $this->max_attendees, |
|
| 56 | - $this->template_args['date_format'] |
|
| 57 | - ); |
|
| 58 | - $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
| 59 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 60 | - } |
|
| 44 | + /** |
|
| 45 | + * sets any and all template args that are required for this Ticket Selector |
|
| 46 | + * |
|
| 47 | + * @return void |
|
| 48 | + */ |
|
| 49 | + protected function addTemplateArgs() |
|
| 50 | + { |
|
| 51 | + unset($this->template_args['tickets']); |
|
| 52 | + $this->template_args['ticket'] = $this->ticket; |
|
| 53 | + $ticket_selector_row = new TicketSelectorRowSimple( |
|
| 54 | + $this->ticket, |
|
| 55 | + $this->max_attendees, |
|
| 56 | + $this->template_args['date_format'] |
|
| 57 | + ); |
|
| 58 | + $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
| 59 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $this->template_args['date_format'] |
| 57 | 57 | ); |
| 58 | 58 | $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
| 59 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 59 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'simple_ticket_selector.template.php'; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |