@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * process_recaptcha |
| 288 | 288 | * |
| 289 | 289 | * @access private |
| 290 | - * @return boolean |
|
| 290 | + * @return boolean|null |
|
| 291 | 291 | */ |
| 292 | 292 | private static function _get_recaptcha_response() { |
| 293 | 293 | EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | * |
| 575 | 575 | * @access public |
| 576 | 576 | * @param EE_Registration_Config $EE_Registration_Config |
| 577 | - * @return array |
|
| 577 | + * @return EE_Registration_Config |
|
| 578 | 578 | */ |
| 579 | 579 | public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
| 580 | 580 | try { |
@@ -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 | * |
@@ -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 | |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public static function set_hooks() { |
| 58 | 58 | // use_captcha ? |
| 59 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
| 59 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
| 60 | 60 | EED_Recaptcha::set_definitions(); |
| 61 | 61 | EED_Recaptcha::enqueue_styles_and_scripts(); |
| 62 | - add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
|
| 63 | - add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 ); |
|
| 64 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 65 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 66 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
| 67 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 ); |
|
| 62 | + add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
| 63 | + add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0); |
|
| 64 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 65 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 66 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
| 67 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
@@ -79,15 +79,15 @@ discard block |
||
| 79 | 79 | public static function set_hooks_admin() { |
| 80 | 80 | EED_Recaptcha::set_definitions(); |
| 81 | 81 | // use_captcha ? |
| 82 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
| 82 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
| 83 | 83 | EED_Recaptcha::enqueue_styles_and_scripts(); |
| 84 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 85 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 86 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
| 84 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 85 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 86 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
| 87 | 87 | } |
| 88 | 88 | // admin settings |
| 89 | - add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
|
| 90 | - add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
|
| 89 | + add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
| 90 | + add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | 101 | public static function set_definitions() { |
| 102 | - if ( is_user_logged_in() ) { |
|
| 102 | + if (is_user_logged_in()) { |
|
| 103 | 103 | EED_Recaptcha::$_not_a_robot = true; |
| 104 | 104 | } |
| 105 | - define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
| 106 | - define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
| 105 | + define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
| 106 | + define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public static function set_late_hooks() { |
| 118 | 118 | add_filter( |
| 119 | 119 | 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
| 120 | - array( 'EED_Recaptcha', 'not_a_robot' ) |
|
| 120 | + array('EED_Recaptcha', 'not_a_robot') |
|
| 121 | 121 | ); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | * @return void |
| 131 | 131 | */ |
| 132 | 132 | public static function enqueue_styles_and_scripts() { |
| 133 | - wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 134 | - 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 ); |
|
| 135 | - 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' ); |
|
| 136 | - 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' ); |
|
| 137 | - EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
| 133 | + wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 134 | + 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); |
|
| 135 | + 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'); |
|
| 136 | + 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'); |
|
| 137 | + EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @access public |
| 146 | 146 | * @param \WP $WP |
| 147 | 147 | */ |
| 148 | - public function run( $WP ) { |
|
| 148 | + public function run($WP) { |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -155,8 +155,7 @@ discard block |
||
| 155 | 155 | * @return boolean |
| 156 | 156 | */ |
| 157 | 157 | public static function not_a_robot() { |
| 158 | - $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
|
| 159 | - EED_Recaptcha::recaptcha_passed(); |
|
| 158 | + $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
|
| 160 | 159 | return $not_a_robot; |
| 161 | 160 | } |
| 162 | 161 | |
@@ -172,23 +171,23 @@ discard block |
||
| 172 | 171 | */ |
| 173 | 172 | public static function display_recaptcha() { |
| 174 | 173 | // logged in means you have already passed a turing test of sorts |
| 175 | - if ( is_user_logged_in() ) { |
|
| 174 | + if (is_user_logged_in()) { |
|
| 176 | 175 | return; |
| 177 | 176 | } |
| 178 | 177 | // don't display if not using recaptcha or user is logged in |
| 179 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
| 178 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
| 180 | 179 | // only display if they have NOT passed the test yet |
| 181 | - if ( ! EED_Recaptcha::$_not_a_robot ) { |
|
| 182 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 180 | + if ( ! EED_Recaptcha::$_not_a_robot) { |
|
| 181 | + EE_Registry::instance()->load_helper('Template'); |
|
| 183 | 182 | EEH_Template::display_template( |
| 184 | - RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
| 183 | + RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
|
| 185 | 184 | array( |
| 186 | 185 | 'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
| 187 | 186 | 'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
| 188 | 187 | 'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
| 189 | 188 | ) |
| 190 | 189 | ); |
| 191 | - wp_enqueue_script( 'google_recaptcha' ); |
|
| 190 | + wp_enqueue_script('google_recaptcha'); |
|
| 192 | 191 | } |
| 193 | 192 | } |
| 194 | 193 | } |
@@ -219,17 +218,17 @@ discard block |
||
| 219 | 218 | */ |
| 220 | 219 | public static function recaptcha_passed() { |
| 221 | 220 | // logged in means you have already passed a turing test of sorts |
| 222 | - if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
| 221 | + if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
|
| 223 | 222 | return TRUE; |
| 224 | 223 | } |
| 225 | 224 | // was test already passed? |
| 226 | - $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
|
| 227 | - $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
| 225 | + $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
| 226 | + $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
|
| 228 | 227 | // verify recaptcha |
| 229 | 228 | EED_Recaptcha::_get_recaptcha_response(); |
| 230 | - if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
| 229 | + if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
|
| 231 | 230 | $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
| 232 | - EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
| 231 | + EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
|
| 233 | 232 | EE_Registry::instance()->SSN->update(); |
| 234 | 233 | } |
| 235 | 234 | EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
@@ -245,8 +244,8 @@ discard block |
||
| 245 | 244 | * @param array $recaptcha_response |
| 246 | 245 | * @return boolean |
| 247 | 246 | */ |
| 248 | - public static function recaptcha_response( $recaptcha_response = array() ) { |
|
| 249 | - if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
| 247 | + public static function recaptcha_response($recaptcha_response = array()) { |
|
| 248 | + if (EED_Recaptcha::_bypass_recaptcha()) { |
|
| 250 | 249 | $recaptcha_response['bypass_recaptcha'] = TRUE; |
| 251 | 250 | $recaptcha_response['recaptcha_passed'] = TRUE; |
| 252 | 251 | } else { |
@@ -266,16 +265,16 @@ discard block |
||
| 266 | 265 | */ |
| 267 | 266 | private static function _bypass_recaptcha() { |
| 268 | 267 | // an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
| 269 | - $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
| 268 | + $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
|
| 270 | 269 | // does $bypass_request_params_array have any values ? |
| 271 | - if ( empty( $bypass_request_params_array )) { |
|
| 270 | + if (empty($bypass_request_params_array)) { |
|
| 272 | 271 | return FALSE; |
| 273 | 272 | } |
| 274 | 273 | // initially set bypass to TRUE |
| 275 | 274 | $bypass_recaptcha = TRUE; |
| 276 | - foreach ( $bypass_request_params_array as $key => $value ) { |
|
| 275 | + foreach ($bypass_request_params_array as $key => $value) { |
|
| 277 | 276 | // 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 |
| 278 | - $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
| 277 | + $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
|
| 279 | 278 | } |
| 280 | 279 | return $bypass_recaptcha; |
| 281 | 280 | } |
@@ -290,7 +289,7 @@ discard block |
||
| 290 | 289 | * @return boolean |
| 291 | 290 | */ |
| 292 | 291 | private static function _get_recaptcha_response() { |
| 293 | - EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
| 292 | + EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
|
| 294 | 293 | } |
| 295 | 294 | |
| 296 | 295 | |
@@ -304,26 +303,26 @@ discard block |
||
| 304 | 303 | */ |
| 305 | 304 | private static function _process_recaptcha_response() { |
| 306 | 305 | // verify library is loaded |
| 307 | - if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) { |
|
| 308 | - require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' ); |
|
| 306 | + if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) { |
|
| 307 | + require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php'); |
|
| 309 | 308 | } |
| 310 | 309 | // The response from reCAPTCHA |
| 311 | 310 | EED_Recaptcha::_get_recaptcha_response(); |
| 312 | 311 | $recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
| 313 | 312 | // Was there a reCAPTCHA response? |
| 314 | - if ( $recaptcha_response ) { |
|
| 313 | + if ($recaptcha_response) { |
|
| 315 | 314 | // if allow_url_fopen is Off, then set a different request method |
| 316 | - $request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
| 315 | + $request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
| 317 | 316 | $recaptcha = new \ReCaptcha\ReCaptcha( |
| 318 | 317 | EE_Registry::instance()->CFG->registration->recaptcha_privatekey, |
| 319 | 318 | $request_method |
| 320 | 319 | ); |
| 321 | 320 | $recaptcha_response = $recaptcha->verify( |
| 322 | 321 | EED_Recaptcha::$_recaptcha_response, |
| 323 | - $_SERVER[ 'REMOTE_ADDR' ] |
|
| 322 | + $_SERVER['REMOTE_ADDR'] |
|
| 324 | 323 | ); |
| 325 | 324 | } |
| 326 | - if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) { |
|
| 325 | + if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) { |
|
| 327 | 326 | return TRUE; |
| 328 | 327 | } |
| 329 | 328 | // sorry... it appears you can't don't know what soup or hamburgers are !!! |
@@ -358,8 +357,8 @@ discard block |
||
| 358 | 357 | */ |
| 359 | 358 | protected static function _recaptcha_settings_form() { |
| 360 | 359 | |
| 361 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
| 362 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 360 | + EE_Registry::instance()->load_helper('HTML'); |
|
| 361 | + EE_Registry::instance()->load_helper('Template'); |
|
| 363 | 362 | |
| 364 | 363 | return new EE_Form_Section_Proper( |
| 365 | 364 | array( |
@@ -369,12 +368,12 @@ discard block |
||
| 369 | 368 | 'subsections' => apply_filters( |
| 370 | 369 | 'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
| 371 | 370 | array( |
| 372 | - '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' ))), |
|
| 371 | + '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'))), |
|
| 373 | 372 | 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
| 374 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
| 373 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))), |
|
| 375 | 374 | 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
| 376 | 375 | // 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
| 377 | - 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
| 376 | + 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
|
| 378 | 377 | ) |
| 379 | 378 | ) |
| 380 | 379 | ) |
@@ -401,28 +400,28 @@ discard block |
||
| 401 | 400 | array( |
| 402 | 401 | 'use_captcha' => new EE_Yes_No_Input( |
| 403 | 402 | array( |
| 404 | - 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
| 403 | + 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
|
| 405 | 404 | 'html_help_text' => sprintf( |
| 406 | - __( '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' ), |
|
| 405 | + __('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'), |
|
| 407 | 406 | '<a href="https://www.google.com/recaptcha/intro/index.html">', |
| 408 | 407 | '</a>' |
| 409 | 408 | ), |
| 410 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
| 409 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
| 411 | 410 | 'display_html_label_text' => FALSE |
| 412 | 411 | ) |
| 413 | 412 | ), |
| 414 | 413 | 'recaptcha_publickey' => new EE_Text_Input( |
| 415 | 414 | array( |
| 416 | - 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
|
| 417 | - 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
|
| 418 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
| 415 | + 'html_label_text' => __('Site Key', 'event_espresso'), |
|
| 416 | + 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
| 417 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
|
| 419 | 418 | ) |
| 420 | 419 | ), |
| 421 | 420 | 'recaptcha_privatekey' => new EE_Text_Input( |
| 422 | 421 | array( |
| 423 | - 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
|
| 424 | - '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' ), |
|
| 425 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
| 422 | + 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
| 423 | + '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'), |
|
| 424 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
|
| 426 | 425 | ) |
| 427 | 426 | ) |
| 428 | 427 | ) |
@@ -454,81 +453,81 @@ discard block |
||
| 454 | 453 | array( |
| 455 | 454 | 'recaptcha_theme' => new EE_Radio_Button_Input( |
| 456 | 455 | array( |
| 457 | - 'light' => __( 'Light', 'event_espresso' ), |
|
| 458 | - 'dark' => __( 'Dark', 'event_espresso' ) |
|
| 456 | + 'light' => __('Light', 'event_espresso'), |
|
| 457 | + 'dark' => __('Dark', 'event_espresso') |
|
| 459 | 458 | ), |
| 460 | 459 | array( |
| 461 | - 'html_label_text' => __( 'Theme', 'event_espresso' ), |
|
| 462 | - 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
|
| 463 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
| 460 | + 'html_label_text' => __('Theme', 'event_espresso'), |
|
| 461 | + 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
| 462 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
| 464 | 463 | 'display_html_label_text' => FALSE |
| 465 | 464 | ) |
| 466 | 465 | ), |
| 467 | 466 | 'recaptcha_type' => new EE_Radio_Button_Input( |
| 468 | 467 | array( |
| 469 | - 'image' => __( 'Image', 'event_espresso' ), |
|
| 470 | - 'audio' => __( 'Audio', 'event_espresso' ) |
|
| 468 | + 'image' => __('Image', 'event_espresso'), |
|
| 469 | + 'audio' => __('Audio', 'event_espresso') |
|
| 471 | 470 | ), |
| 472 | 471 | array( |
| 473 | - 'html_label_text' => __( 'Type', 'event_espresso' ), |
|
| 474 | - 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
|
| 475 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
| 472 | + 'html_label_text' => __('Type', 'event_espresso'), |
|
| 473 | + 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
| 474 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
| 476 | 475 | 'display_html_label_text' =>FALSE |
| 477 | 476 | ) |
| 478 | 477 | ), |
| 479 | 478 | 'recaptcha_language' => new EE_Select_Input( |
| 480 | 479 | array( |
| 481 | - 'ar' => __( 'Arabic', 'event_espresso' ), |
|
| 482 | - 'bg' => __( 'Bulgarian', 'event_espresso' ), |
|
| 483 | - 'ca' => __( 'Catalan', 'event_espresso' ), |
|
| 484 | - 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
|
| 485 | - 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
|
| 486 | - 'hr' => __( 'Croatian', 'event_espresso' ), |
|
| 487 | - 'cs' => __( 'Czech', 'event_espresso' ), |
|
| 488 | - 'da' => __( 'Danish', 'event_espresso' ), |
|
| 489 | - 'nl' => __( 'Dutch', 'event_espresso' ), |
|
| 490 | - 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
|
| 491 | - 'en' => __( 'English (US)', 'event_espresso' ), |
|
| 492 | - 'fil' => __( 'Filipino', 'event_espresso' ), |
|
| 493 | - 'fi' => __( 'Finnish', 'event_espresso' ), |
|
| 494 | - 'fr' => __( 'French', 'event_espresso' ), |
|
| 495 | - 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
|
| 496 | - 'de' => __( 'German', 'event_espresso' ), |
|
| 497 | - 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
|
| 498 | - 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
|
| 499 | - 'el' => __( 'Greek', 'event_espresso' ), |
|
| 500 | - 'iw' => __( 'Hebrew', 'event_espresso' ), |
|
| 501 | - 'hi' => __( 'Hindi', 'event_espresso' ), |
|
| 502 | - 'hu' => __( 'Hungarian', 'event_espresso' ), |
|
| 503 | - 'id' => __( 'Indonesian', 'event_espresso' ), |
|
| 504 | - 'it' => __( 'Italian', 'event_espresso' ), |
|
| 505 | - 'ja' => __( 'Japanese', 'event_espresso' ), |
|
| 506 | - 'ko' => __( 'Korean', 'event_espresso' ), |
|
| 507 | - 'lv' => __( 'Latvian', 'event_espresso' ), |
|
| 508 | - 'lt' => __( 'Lithuanian', 'event_espresso' ), |
|
| 509 | - 'no' => __( 'Norwegian', 'event_espresso' ), |
|
| 510 | - 'fa' => __( 'Persian', 'event_espresso' ), |
|
| 511 | - 'pl' => __( 'Polish', 'event_espresso' ), |
|
| 512 | - 'pt' => __( 'Portuguese', 'event_espresso' ), |
|
| 513 | - 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
|
| 514 | - 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
|
| 515 | - 'ro' => __( 'Romanian', 'event_espresso' ), |
|
| 516 | - 'ru' => __( 'Russian', 'event_espresso' ), |
|
| 517 | - 'sr' => __( 'Serbian', 'event_espresso' ), |
|
| 518 | - 'sk' => __( 'Slovak', 'event_espresso' ), |
|
| 519 | - 'sl' => __( 'Slovenian', 'event_espresso' ), |
|
| 520 | - 'es' => __( 'Spanish', 'event_espresso' ), |
|
| 521 | - 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
|
| 522 | - 'sv' => __( 'Swedish', 'event_espresso' ), |
|
| 523 | - 'th' => __( 'Thai', 'event_espresso' ), |
|
| 524 | - 'tr' => __( 'Turkish', 'event_espresso' ), |
|
| 525 | - 'uk' => __( 'Ukrainian', 'event_espresso' ), |
|
| 526 | - 'vi' => __( 'Vietnamese', 'event_espresso') |
|
| 480 | + 'ar' => __('Arabic', 'event_espresso'), |
|
| 481 | + 'bg' => __('Bulgarian', 'event_espresso'), |
|
| 482 | + 'ca' => __('Catalan', 'event_espresso'), |
|
| 483 | + 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
| 484 | + 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
| 485 | + 'hr' => __('Croatian', 'event_espresso'), |
|
| 486 | + 'cs' => __('Czech', 'event_espresso'), |
|
| 487 | + 'da' => __('Danish', 'event_espresso'), |
|
| 488 | + 'nl' => __('Dutch', 'event_espresso'), |
|
| 489 | + 'en-GB' => __('English (UK)', 'event_espresso'), |
|
| 490 | + 'en' => __('English (US)', 'event_espresso'), |
|
| 491 | + 'fil' => __('Filipino', 'event_espresso'), |
|
| 492 | + 'fi' => __('Finnish', 'event_espresso'), |
|
| 493 | + 'fr' => __('French', 'event_espresso'), |
|
| 494 | + 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
| 495 | + 'de' => __('German', 'event_espresso'), |
|
| 496 | + 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
| 497 | + 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
| 498 | + 'el' => __('Greek', 'event_espresso'), |
|
| 499 | + 'iw' => __('Hebrew', 'event_espresso'), |
|
| 500 | + 'hi' => __('Hindi', 'event_espresso'), |
|
| 501 | + 'hu' => __('Hungarian', 'event_espresso'), |
|
| 502 | + 'id' => __('Indonesian', 'event_espresso'), |
|
| 503 | + 'it' => __('Italian', 'event_espresso'), |
|
| 504 | + 'ja' => __('Japanese', 'event_espresso'), |
|
| 505 | + 'ko' => __('Korean', 'event_espresso'), |
|
| 506 | + 'lv' => __('Latvian', 'event_espresso'), |
|
| 507 | + 'lt' => __('Lithuanian', 'event_espresso'), |
|
| 508 | + 'no' => __('Norwegian', 'event_espresso'), |
|
| 509 | + 'fa' => __('Persian', 'event_espresso'), |
|
| 510 | + 'pl' => __('Polish', 'event_espresso'), |
|
| 511 | + 'pt' => __('Portuguese', 'event_espresso'), |
|
| 512 | + 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
| 513 | + 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
| 514 | + 'ro' => __('Romanian', 'event_espresso'), |
|
| 515 | + 'ru' => __('Russian', 'event_espresso'), |
|
| 516 | + 'sr' => __('Serbian', 'event_espresso'), |
|
| 517 | + 'sk' => __('Slovak', 'event_espresso'), |
|
| 518 | + 'sl' => __('Slovenian', 'event_espresso'), |
|
| 519 | + 'es' => __('Spanish', 'event_espresso'), |
|
| 520 | + 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
| 521 | + 'sv' => __('Swedish', 'event_espresso'), |
|
| 522 | + 'th' => __('Thai', 'event_espresso'), |
|
| 523 | + 'tr' => __('Turkish', 'event_espresso'), |
|
| 524 | + 'uk' => __('Ukrainian', 'event_espresso'), |
|
| 525 | + 'vi' => __('Vietnamese', 'event_espresso') |
|
| 527 | 526 | ), |
| 528 | 527 | array( |
| 529 | - 'html_label_text' => __( 'Language', 'event_espresso' ), |
|
| 530 | - 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
|
| 531 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
| 528 | + 'html_label_text' => __('Language', 'event_espresso'), |
|
| 529 | + 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
| 530 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
| 532 | 531 | ) |
| 533 | 532 | ) |
| 534 | 533 | ) |
@@ -576,25 +575,25 @@ discard block |
||
| 576 | 575 | * @param EE_Registration_Config $EE_Registration_Config |
| 577 | 576 | * @return array |
| 578 | 577 | */ |
| 579 | - public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
| 578 | + public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
|
| 580 | 579 | try { |
| 581 | 580 | $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
| 582 | 581 | // if not displaying a form, then check for form submission |
| 583 | - if ( $recaptcha_settings_form->was_submitted() ) { |
|
| 582 | + if ($recaptcha_settings_form->was_submitted()) { |
|
| 584 | 583 | // capture form data |
| 585 | 584 | $recaptcha_settings_form->receive_form_submission(); |
| 586 | 585 | // validate form data |
| 587 | - if ( $recaptcha_settings_form->is_valid() ) { |
|
| 586 | + if ($recaptcha_settings_form->is_valid()) { |
|
| 588 | 587 | // grab validated data from form |
| 589 | 588 | $valid_data = $recaptcha_settings_form->valid_data(); |
| 590 | 589 | // 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. |
| 591 | 590 | if ( |
| 592 | - apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
| 591 | + apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
|
| 593 | 592 | && $valid_data['main_settings']['use_captcha'] |
| 594 | - && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
| 593 | + && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
|
| 595 | 594 | ) { |
| 596 | 595 | $valid_data['main_settings']['use_captcha'] = FALSE; |
| 597 | - 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__ ); |
|
| 596 | + 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__); |
|
| 598 | 597 | } |
| 599 | 598 | $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
| 600 | 599 | $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
@@ -603,12 +602,12 @@ discard block |
||
| 603 | 602 | $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
| 604 | 603 | $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
| 605 | 604 | } else { |
| 606 | - if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
|
| 607 | - EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 605 | + if ($recaptcha_settings_form->submission_error_message() != '') { |
|
| 606 | + EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
| 608 | 607 | } |
| 609 | 608 | } |
| 610 | 609 | } |
| 611 | - } catch( EE_Error $e ) { |
|
| 610 | + } catch (EE_Error $e) { |
|
| 612 | 611 | $e->get_error(); |
| 613 | 612 | } |
| 614 | 613 | |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | * @param EE_Template_Config $CFG |
| 151 | 151 | * @param array $REQ incoming request |
| 152 | 152 | * |
| 153 | - * @return void |
|
| 153 | + * @return EE_Template_Config |
|
| 154 | 154 | */ |
| 155 | 155 | public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
| 156 | 156 | if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
@@ -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 | * |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @return EED_Ticket_Selector_Caff |
| 17 | 17 | */ |
| 18 | 18 | public static function instance() { |
| 19 | - return parent::get_instance( __CLASS__ ); |
|
| 19 | + return parent::get_instance(__CLASS__); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
@@ -37,24 +37,24 @@ discard block |
||
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | 39 | public static function set_hooks_admin() { |
| 40 | - define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
| 41 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 ); |
|
| 42 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 ); |
|
| 40 | + define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
| 41 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10); |
|
| 42 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | //just required because of abstract declaration |
| 47 | - public function run( $WP ) { |
|
| 47 | + public function run($WP) { |
|
| 48 | 48 | $this->set_config(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - protected function set_config(){ |
|
| 55 | - $this->set_config_section( 'template_settings' ); |
|
| 56 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
| 57 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
| 54 | + protected function set_config() { |
|
| 55 | + $this->set_config_section('template_settings'); |
|
| 56 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
| 57 | + $this->set_config_name('EED_Ticket_Selector'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', |
| 90 | 90 | array( |
| 91 | 91 | 'appearance_settings_hdr' => new EE_Form_Section_HTML( |
| 92 | - EEH_HTML::br(2) . |
|
| 93 | - EEH_HTML::h2( __( 'Ticket Selector Template Settings', 'event_espresso' )) |
|
| 92 | + EEH_HTML::br(2). |
|
| 93 | + EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso')) |
|
| 94 | 94 | ), |
| 95 | 95 | 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings() |
| 96 | 96 | ) |
@@ -114,25 +114,25 @@ discard block |
||
| 114 | 114 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array( |
| 115 | 115 | 'show_ticket_details' => new EE_Yes_No_Input( |
| 116 | 116 | array( |
| 117 | - 'html_label_text' => __('Show Ticket Details?', 'event_espresso' ), |
|
| 118 | - 'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
| 119 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
| 117 | + 'html_label_text' => __('Show Ticket Details?', 'event_espresso'), |
|
| 118 | + 'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
| 119 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
| 120 | 120 | 'display_html_label_text' => false |
| 121 | 121 | ) |
| 122 | 122 | ), |
| 123 | 123 | 'show_ticket_sale_columns' => new EE_Yes_No_Input( |
| 124 | 124 | array( |
| 125 | - 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ), |
|
| 126 | - 'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
| 127 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
| 125 | + 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'), |
|
| 126 | + 'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
| 127 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
| 128 | 128 | 'display_html_label_text' => false |
| 129 | 129 | ) |
| 130 | 130 | ), |
| 131 | 131 | 'show_expired_tickets' => new EE_Yes_No_Input( |
| 132 | 132 | array( |
| 133 | - 'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ), |
|
| 134 | - 'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ), |
|
| 135 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
| 133 | + 'html_label_text' => __('Show Expired Tickets?', 'event_espresso'), |
|
| 134 | + 'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'), |
|
| 135 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
| 136 | 136 | 'display_html_label_text' => false |
| 137 | 137 | ) |
| 138 | 138 | ) |
@@ -155,21 +155,21 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return void |
| 157 | 157 | */ |
| 158 | - public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
|
| 159 | - if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
|
| 158 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
| 159 | + if ( ! isset($CFG->EED_Ticket_Selector)) { |
|
| 160 | 160 | $CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
| 161 | 161 | } |
| 162 | 162 | try { |
| 163 | 163 | $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form(); |
| 164 | 164 | |
| 165 | 165 | //check for form submission |
| 166 | - if ( $ticket_selector_form->was_submitted() ) { |
|
| 166 | + if ($ticket_selector_form->was_submitted()) { |
|
| 167 | 167 | |
| 168 | 168 | //capture form data |
| 169 | 169 | $ticket_selector_form->receive_form_submission(); |
| 170 | 170 | |
| 171 | 171 | //validate form data |
| 172 | - if ( $ticket_selector_form->is_valid() ) { |
|
| 172 | + if ($ticket_selector_form->is_valid()) { |
|
| 173 | 173 | |
| 174 | 174 | //grab validated data from form |
| 175 | 175 | $valid_data = $ticket_selector_form->valid_data(); |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details']; |
| 180 | 180 | $CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets']; |
| 181 | 181 | } else { |
| 182 | - if ( $ticket_selector_form->submission_error_message() != '' ) { |
|
| 183 | - EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 182 | + if ($ticket_selector_form->submission_error_message() != '') { |
|
| 183 | + EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | } |
| 188 | - } catch( EE_Error $e ) { |
|
| 188 | + } catch (EE_Error $e) { |
|
| 189 | 189 | $e->get_error(); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -206,7 +206,8 @@ discard block |
||
| 206 | 206 | /** |
| 207 | 207 | * Posts the request to AuthorizeNet & returns response. |
| 208 | 208 | * |
| 209 | - * @return AuthorizeNetARB_Response The response. |
|
| 209 | + * @param EEI_Payment $payment |
|
| 210 | + * @return EE_AuthorizeNetAIM_Response The response. |
|
| 210 | 211 | */ |
| 211 | 212 | private function _sendRequest($payment) { |
| 212 | 213 | $this->_x_post_fields['login'] = $this->_login_id; |
@@ -353,9 +354,6 @@ discard block |
||
| 353 | 354 | * Constructor. Parses the AuthorizeNet response string. |
| 354 | 355 | * |
| 355 | 356 | * @param string $response The response from the AuthNet server. |
| 356 | - * @param string $delimiter The delimiter used (default is ",") |
|
| 357 | - * @param string $encap_char The encap_char used (default is "|") |
|
| 358 | - * @param array $custom_fields Any custom fields set in the request. |
|
| 359 | 357 | */ |
| 360 | 358 | |
| 361 | 359 | public function __construct($response) { |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | //in which case, we need to generate teh invoice num per request right here... |
| 136 | 136 | $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
| 137 | 137 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
| 138 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
| 138 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | if ($this->_test_transactions) { |
@@ -1,7 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | /** |
| 7 | 8 | * Event Espresso |
@@ -107,7 +108,7 @@ discard block |
||
| 107 | 108 | foreach($total_line_item->tax_descendants() as $tax_line_item){ |
| 108 | 109 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
| 109 | 110 | } |
| 110 | - }else{//partial payment |
|
| 111 | + } else{//partial payment |
|
| 111 | 112 | $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
| 112 | 113 | } |
| 113 | 114 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * ------------------------------------------------------------------------ |
| 27 | 27 | */ |
| 28 | -class EEG_Aim extends EE_Onsite_Gateway{ |
|
| 28 | +class EEG_Aim extends EE_Onsite_Gateway { |
|
| 29 | 29 | protected $_login_id; |
| 30 | 30 | protected $_transaction_key; |
| 31 | 31 | protected $_currencies_supported = array( |
@@ -98,21 +98,21 @@ discard block |
||
| 98 | 98 | $primary_registrant = $transaction->primary_registration(); |
| 99 | 99 | //if we're are charging for the full amount, show the normal line items |
| 100 | 100 | //and the itemized total adds up properly |
| 101 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
| 101 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
| 102 | 102 | $total_line_item = $transaction->total_line_item(); |
| 103 | 103 | foreach ($total_line_item->get_items() as $line_item) { |
| 104 | 104 | //ignore line items with a quantity of 0 |
| 105 | - if( $line_item->quantity() == 0 ){ |
|
| 105 | + if ($line_item->quantity() == 0) { |
|
| 106 | 106 | continue; |
| 107 | 107 | } |
| 108 | 108 | $this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N'); |
| 109 | 109 | $order_description .= $line_item->desc().', '; |
| 110 | 110 | } |
| 111 | - foreach($total_line_item->tax_descendants() as $tax_line_item){ |
|
| 111 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
| 112 | 112 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
| 113 | 113 | } |
| 114 | - }else{//partial payment |
|
| 115 | - $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
| 114 | + } else {//partial payment |
|
| 115 | + $order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | //start transaction |
| 122 | 122 | $this->setField('amount', $this->format_currency($payment->amount())); |
| 123 | - $this->setField('description',substr(rtrim($order_description, ', '), 0, 255)); |
|
| 123 | + $this->setField('description', substr(rtrim($order_description, ', '), 0, 255)); |
|
| 124 | 124 | $this->setField('card_num', $billing_info['credit_card']); |
| 125 | 125 | $this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']); |
| 126 | 126 | $this->setField('card_code', $billing_info['cvv']); |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | $this->setField('company', $billing_info['company']); |
| 131 | 131 | $this->setField('address', $billing_info['address'].' '.$billing_info['address2']); |
| 132 | 132 | $this->setField('city', $billing_info['city']); |
| 133 | - $this->setField('state', $billing_info['state'] ); |
|
| 134 | - $this->setField('country', $billing_info['country'] ); |
|
| 133 | + $this->setField('state', $billing_info['state']); |
|
| 134 | + $this->setField('country', $billing_info['country']); |
|
| 135 | 135 | $this->setField('zip', $billing_info['zip']); |
| 136 | 136 | $this->setField('fax', $billing_info['fax']); |
| 137 | 137 | $this->setField('cust_id', $primary_registrant->ID()); |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | //invoice_num would be nice to have itbe unique per SPCO page-load, taht way if users |
| 140 | 140 | //press back, they don't submit a duplicate. However, we may be keepin gthe user on teh same spco page |
| 141 | 141 | //in which case, we need to generate teh invoice num per request right here... |
| 142 | - $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
| 142 | + $this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
| 143 | 143 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
| 144 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
| 144 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS); |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | if ($this->_test_transactions) { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | //Capture response |
| 152 | 152 | $this->type = "AUTH_CAPTURE"; |
| 153 | 153 | $response = $this->_sendRequest($payment); |
| 154 | - if (!empty($response)){ |
|
| 154 | + if ( ! empty($response)) { |
|
| 155 | 155 | if ($this->_debug_mode) { |
| 156 | 156 | $txn_id = $response->invoice_number; |
| 157 | 157 | } else { |
@@ -160,15 +160,15 @@ discard block |
||
| 160 | 160 | $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status(); |
| 161 | 161 | $payment->set_status($payment_status); |
| 162 | 162 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators) |
| 163 | - $payment->set_amount( floatval( $response->amount ) ); |
|
| 164 | - $payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code)); |
|
| 165 | - $payment->set_txn_id_chq_nmbr( $txn_id ); |
|
| 163 | + $payment->set_amount(floatval($response->amount)); |
|
| 164 | + $payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code)); |
|
| 165 | + $payment->set_txn_id_chq_nmbr($txn_id); |
|
| 166 | 166 | $payment->set_extra_accntng($primary_registrant->reg_code()); |
| 167 | - $payment->set_details(print_r($response,true)); |
|
| 167 | + $payment->set_details(print_r($response, true)); |
|
| 168 | 168 | } else { |
| 169 | 169 | $payment->set_status($this->_pay_model->failed_status()); |
| 170 | 170 | $payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso')); |
| 171 | - $payment->set_details(print_r($response,true)); |
|
| 171 | + $payment->set_details(print_r($response, true)); |
|
| 172 | 172 | } |
| 173 | 173 | return $payment; |
| 174 | 174 | } |
@@ -219,22 +219,22 @@ discard block |
||
| 219 | 219 | $this->_x_post_fields['tran_key'] = $this->_transaction_key; |
| 220 | 220 | $x_keys = array(); |
| 221 | 221 | foreach ($this->_x_post_fields as $key => $value) { |
| 222 | - $x_keys[] = "x_$key=" . urlencode($value); |
|
| 222 | + $x_keys[] = "x_$key=".urlencode($value); |
|
| 223 | 223 | } |
| 224 | 224 | // Add line items |
| 225 | 225 | foreach ($this->_additional_line_items as $key => $value) { |
| 226 | - $x_keys[] = "x_line_item=" . urlencode($value); |
|
| 226 | + $x_keys[] = "x_line_item=".urlencode($value); |
|
| 227 | 227 | } |
| 228 | 228 | $this->_log_clean_request($x_keys, $payment); |
| 229 | 229 | $post_url = ($this->_debug_mode ? self::SANDBOX_URL : self::LIVE_URL); |
| 230 | 230 | $curl_request = curl_init($post_url); |
| 231 | - curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys)); |
|
| 231 | + curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys)); |
|
| 232 | 232 | curl_setopt($curl_request, CURLOPT_HEADER, 0); |
| 233 | 233 | curl_setopt($curl_request, CURLOPT_TIMEOUT, 45); |
| 234 | 234 | curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); |
| 235 | 235 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2); |
| 236 | 236 | if ($this->VERIFY_PEER) { |
| 237 | - curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem'); |
|
| 237 | + curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)).'/ssl/cert.pem'); |
|
| 238 | 238 | } else { |
| 239 | 239 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
| 240 | 240 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $response = curl_exec($curl_request); |
| 247 | 247 | |
| 248 | 248 | curl_close($curl_request); |
| 249 | - $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
| 249 | + $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
| 250 | 250 | |
| 251 | 251 | return $this->_log_and_clean_response($response_obj, $payment); |
| 252 | 252 | } |
@@ -255,18 +255,18 @@ discard block |
||
| 255 | 255 | * @param array $request_array |
| 256 | 256 | * @param EEI_Payment $payment |
| 257 | 257 | */ |
| 258 | - private function _log_clean_request($request_array,$payment){ |
|
| 259 | - $keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' ); |
|
| 260 | - foreach($request_array as $index => $keyvaltogether ) { |
|
| 261 | - foreach( $keys_to_filter_out as $key ) { |
|
| 262 | - if( strpos( $keyvaltogether, $key ) === 0 ){ |
|
| 258 | + private function _log_clean_request($request_array, $payment) { |
|
| 259 | + $keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date'); |
|
| 260 | + foreach ($request_array as $index => $keyvaltogether) { |
|
| 261 | + foreach ($keys_to_filter_out as $key) { |
|
| 262 | + if (strpos($keyvaltogether, $key) === 0) { |
|
| 263 | 263 | //found it at the first character |
| 264 | 264 | //so its one of them |
| 265 | - unset( $request_array[ $index ] ); |
|
| 265 | + unset($request_array[$index]); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | - $this->log(array('AIM Request sent:'=>$request_array),$payment); |
|
| 269 | + $this->log(array('AIM Request sent:'=>$request_array), $payment); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | * @param EE_AuthorizeNetAIM_Response $response_obj |
| 275 | 275 | * @param EE_Payment $payment |
| 276 | 276 | */ |
| 277 | - private function _log_and_clean_response($response_obj,$payment){ |
|
| 277 | + private function _log_and_clean_response($response_obj, $payment) { |
|
| 278 | 278 | $response_obj->account_number = ''; |
| 279 | - $this->log(array('AIM Response received:'=>$response_obj),$payment); |
|
| 279 | + $this->log(array('AIM Response received:'=>$response_obj), $payment); |
|
| 280 | 280 | return $response_obj; |
| 281 | 281 | } |
| 282 | 282 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | // Split Array |
| 373 | 373 | $this->response = $response; |
| 374 | 374 | if ($encap_char) { |
| 375 | - $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
| 375 | + $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
| 376 | 376 | } else { |
| 377 | 377 | $this->_response_array = explode($delimiter, $response); |
| 378 | 378 | } |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $this->held = ($this->response_code == self::HELD); |
| 443 | 443 | |
| 444 | 444 | if ($this->error || $this->declined || $this->held) { |
| 445 | - $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
| 445 | + $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
| 446 | 446 | |
| 447 | 447 | |
| 448 | 448 | /* $this->error_message = "AuthorizeNet Error: |
@@ -392,7 +392,7 @@ |
||
| 392 | 392 | |
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | - * @param $Request |
|
| 395 | + * @param string $Request |
|
| 396 | 396 | * @return mixed |
| 397 | 397 | */ |
| 398 | 398 | private function _CURLRequest($Request) { |
@@ -1,7 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | /** |
| 7 | 8 | * Event Espresso |
@@ -123,7 +124,7 @@ discard block |
||
| 123 | 124 | } |
| 124 | 125 | $item_amount = $total_line_item->get_items_total(); |
| 125 | 126 | $tax_amount = $total_line_item->get_total_tax(); |
| 126 | - }else{ |
|
| 127 | + } else{ |
|
| 127 | 128 | $order_items = array(); |
| 128 | 129 | $item_amount = $payment->amount(); |
| 129 | 130 | $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
@@ -248,10 +249,10 @@ discard block |
||
| 248 | 249 | $payment->set_status( $this->_pay_model->failed_status() ) ; |
| 249 | 250 | $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
| 250 | 251 | $payment->set_details($PayPalResult); |
| 251 | - }else{ |
|
| 252 | + } else{ |
|
| 252 | 253 | if($this->_APICallSuccessful($PayPalResult)){ |
| 253 | 254 | $payment->set_status($this->_pay_model->approved_status()); |
| 254 | - }else{ |
|
| 255 | + } else{ |
|
| 255 | 256 | $payment->set_status($this->_pay_model->declined_status()); |
| 256 | 257 | } |
| 257 | 258 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
@@ -263,7 +264,7 @@ discard block |
||
| 263 | 264 | $payment->set_extra_accntng($primary_registration_code); |
| 264 | 265 | $payment->set_details($PayPalResult); |
| 265 | 266 | } |
| 266 | - }catch(Exception $e){ |
|
| 267 | + } catch(Exception $e){ |
|
| 267 | 268 | $payment->set_status($this->_pay_model->failed_status()); |
| 268 | 269 | $payment->set_gateway_response($e->getMessage()); |
| 269 | 270 | } |
@@ -325,53 +326,62 @@ discard block |
||
| 325 | 326 | |
| 326 | 327 | // DP Fields |
| 327 | 328 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
| 328 | - foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
|
| 329 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
| 329 | + foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) { |
|
| 330 | + $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
| 331 | + } |
|
| 330 | 332 | |
| 331 | 333 | // CC Details Fields |
| 332 | 334 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
| 333 | - foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
|
| 334 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
| 335 | + foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) { |
|
| 336 | + $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
| 337 | + } |
|
| 335 | 338 | |
| 336 | 339 | // PayerInfo Type Fields |
| 337 | 340 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
| 338 | - foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
|
| 339 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
| 341 | + foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) { |
|
| 342 | + $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
| 343 | + } |
|
| 340 | 344 | |
| 341 | 345 | // Payer Name Fields |
| 342 | 346 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
| 343 | - foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
|
| 344 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
| 347 | + foreach ($PayerName as $PayerNameVar => $PayerNameVal) { |
|
| 348 | + $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
| 349 | + } |
|
| 345 | 350 | |
| 346 | 351 | // Address Fields (Billing) |
| 347 | 352 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
| 348 | - foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
|
| 349 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
| 353 | + foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) { |
|
| 354 | + $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
| 355 | + } |
|
| 350 | 356 | |
| 351 | 357 | // Payment Details Type Fields |
| 352 | 358 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
| 353 | - foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
|
| 354 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
| 359 | + foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) { |
|
| 360 | + $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
| 361 | + } |
|
| 355 | 362 | |
| 356 | 363 | // Payment Details Item Type Fields |
| 357 | 364 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
| 358 | 365 | $n = 0; |
| 359 | 366 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
| 360 | 367 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
| 361 | - foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
|
| 362 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
| 368 | + foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) { |
|
| 369 | + $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
| 370 | + } |
|
| 363 | 371 | $n++; |
| 364 | 372 | } |
| 365 | 373 | |
| 366 | 374 | // Ship To Address Fields |
| 367 | 375 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
| 368 | - foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
|
| 369 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
| 376 | + foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) { |
|
| 377 | + $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
| 378 | + } |
|
| 370 | 379 | |
| 371 | 380 | // 3D Secure Fields |
| 372 | 381 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
| 373 | - foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
|
| 374 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
| 382 | + foreach ($Secure3D as $Secure3DVar => $Secure3DVal) { |
|
| 383 | + $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
| 384 | + } |
|
| 375 | 385 | |
| 376 | 386 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
| 377 | 387 | $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
@@ -500,14 +510,15 @@ discard block |
||
| 500 | 510 | $CurrentError = $Errors[$ErrorVar]; |
| 501 | 511 | foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) { |
| 502 | 512 | $CurrentVarName = ''; |
| 503 | - if ($CurrentErrorVar == 'L_ERRORCODE') |
|
| 504 | - $CurrentVarName = 'Error Code'; |
|
| 505 | - elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') |
|
| 506 | - $CurrentVarName = 'Short Message'; |
|
| 507 | - elseif ($CurrentErrorVar == 'L_LONGMESSAGE') |
|
| 508 | - $CurrentVarName = 'Long Message'; |
|
| 509 | - elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
|
| 510 | - $CurrentVarName = 'Severity Code'; |
|
| 513 | + if ($CurrentErrorVar == 'L_ERRORCODE') { |
|
| 514 | + $CurrentVarName = 'Error Code'; |
|
| 515 | + } elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') { |
|
| 516 | + $CurrentVarName = 'Short Message'; |
|
| 517 | + } elseif ($CurrentErrorVar == 'L_LONGMESSAGE') { |
|
| 518 | + $CurrentVarName = 'Long Message'; |
|
| 519 | + } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') { |
|
| 520 | + $CurrentVarName = 'Severity Code'; |
|
| 521 | + } |
|
| 511 | 522 | |
| 512 | 523 | $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
| 513 | 524 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * ------------------------------------------------------------------------ |
| 27 | 27 | */ |
| 28 | -class EEG_Paypal_Pro extends EE_Onsite_Gateway{ |
|
| 28 | +class EEG_Paypal_Pro extends EE_Onsite_Gateway { |
|
| 29 | 29 | /** |
| 30 | 30 | * |
| 31 | 31 | * @var $_paypal_api_username string |
@@ -88,25 +88,25 @@ discard block |
||
| 88 | 88 | * } @see parent::do_direct_payment for more info |
| 89 | 89 | * @return \EE_Payment|\EEI_Payment |
| 90 | 90 | */ |
| 91 | - public function do_direct_payment($payment,$billing_info = null){ |
|
| 91 | + public function do_direct_payment($payment, $billing_info = null) { |
|
| 92 | 92 | $transaction = $payment->transaction(); |
| 93 | 93 | $primary_registrant = $transaction->primary_registration(); |
| 94 | - $order_description = sprintf(__("'Event Registrations from %s", "event_espresso"),get_bloginfo('name')); |
|
| 94 | + $order_description = sprintf(__("'Event Registrations from %s", "event_espresso"), get_bloginfo('name')); |
|
| 95 | 95 | //charge for the full amount. Show itemized list |
| 96 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
| 96 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
| 97 | 97 | $item_num = 1; |
| 98 | 98 | $total_line_item = $transaction->total_line_item(); |
| 99 | 99 | $order_items = array(); |
| 100 | 100 | foreach ($total_line_item->get_items() as $line_item) { |
| 101 | 101 | //ignore line items with a quantity of 0 |
| 102 | - if( $line_item->quantity() == 0 ) { |
|
| 102 | + if ($line_item->quantity() == 0) { |
|
| 103 | 103 | continue; |
| 104 | 104 | } |
| 105 | 105 | $item = array( |
| 106 | 106 | // Item Name. 127 char max. |
| 107 | - 'l_name' => substr($line_item->name(),0,127), |
|
| 107 | + 'l_name' => substr($line_item->name(), 0, 127), |
|
| 108 | 108 | // Item description. 127 char max. |
| 109 | - 'l_desc' => substr($line_item->desc(),0,127), |
|
| 109 | + 'l_desc' => substr($line_item->desc(), 0, 127), |
|
| 110 | 110 | // Cost of individual item. |
| 111 | 111 | 'l_amt' => $line_item->unit_price(), |
| 112 | 112 | // Item Number. 127 char max. |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | $item_amount = $total_line_item->get_items_total(); |
| 129 | 129 | $tax_amount = $total_line_item->get_total_tax(); |
| 130 | - }else{ |
|
| 130 | + } else { |
|
| 131 | 131 | $order_items = array(); |
| 132 | 132 | $item_amount = $payment->amount(); |
| 133 | - $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
| 133 | + $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
| 134 | 134 | $tax_amount = 0; |
| 135 | - array_push($order_items,array( |
|
| 135 | + array_push($order_items, array( |
|
| 136 | 136 | // Item Name. 127 char max. |
| 137 | - 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()), |
|
| 137 | + 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()), |
|
| 138 | 138 | // Item description. 127 char max. |
| 139 | 139 | 'l_desc' => $single_item_desc, |
| 140 | 140 | // Cost of individual item. |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | // Payer's salutation. 20 char max. |
| 182 | 182 | 'salutation' => '', |
| 183 | 183 | // Payer's first name. 25 char max. |
| 184 | - 'firstname' => substr($billing_info['first_name'],0,25), |
|
| 184 | + 'firstname' => substr($billing_info['first_name'], 0, 25), |
|
| 185 | 185 | // Payer's middle name. 25 char max. |
| 186 | 186 | 'middlename' => '', |
| 187 | 187 | // Payer's last name. 25 char max. |
| 188 | - 'lastname' => substr($billing_info['last_name'],0,25), |
|
| 188 | + 'lastname' => substr($billing_info['last_name'], 0, 25), |
|
| 189 | 189 | // Payer's suffix. 12 char max. |
| 190 | 190 | 'suffix' => '' |
| 191 | 191 | ); |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | // Required. Name of City. |
| 199 | 199 | 'city' => $billing_info['city'], |
| 200 | 200 | // Required. Name of State or Province. |
| 201 | - 'state' => substr( $billing_info['state'], 0, 40 ), |
|
| 201 | + 'state' => substr($billing_info['state'], 0, 40), |
|
| 202 | 202 | // Required. Country code. |
| 203 | 203 | 'countrycode' => $billing_info['country'], |
| 204 | 204 | // Required. Postal code of payer. |
| 205 | 205 | 'zip' => $billing_info['zip'], |
| 206 | 206 | // Phone Number of payer. 20 char max. |
| 207 | - 'shiptophonenum' => substr($billing_info['phone'],0,20) |
|
| 207 | + 'shiptophonenum' => substr($billing_info['phone'], 0, 20) |
|
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | 210 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // Required. Three-letter currency code. Default is USD. |
| 215 | 215 | 'currencycode' => $payment->currency_code(), |
| 216 | 216 | // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax. |
| 217 | - 'itemamt' => $this->format_currency($item_amount),// |
|
| 217 | + 'itemamt' => $this->format_currency($item_amount), // |
|
| 218 | 218 | // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
| 219 | 219 | 'shippingamt' => '', |
| 220 | 220 | // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | // Free-form field for your own use. 256 char max. |
| 227 | 227 | 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
| 228 | 228 | // Your own invoice or tracking number |
| 229 | - 'invnum' => wp_generate_password(12,false),//$transaction->ID(), |
|
| 229 | + 'invnum' => wp_generate_password(12, false), //$transaction->ID(), |
|
| 230 | 230 | // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
| 231 | 231 | 'notifyurl' => '', |
| 232 | - 'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this |
|
| 232 | + 'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this |
|
| 233 | 233 | ); |
| 234 | 234 | // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
| 235 | 235 | $PayPalRequestData = array( |
@@ -242,32 +242,32 @@ discard block |
||
| 242 | 242 | 'OrderItems' => $order_items, |
| 243 | 243 | ); |
| 244 | 244 | $this->_log_clean_request($PayPalRequestData, $payment); |
| 245 | - try{ |
|
| 245 | + try { |
|
| 246 | 246 | $PayPalResult = $this->prep_and_curl_request($PayPalRequestData); |
| 247 | 247 | //remove PCI-sensitive data so it doesn't get stored |
| 248 | - $PayPalResult = $this->_log_clean_response($PayPalResult,$payment); |
|
| 248 | + $PayPalResult = $this->_log_clean_response($PayPalResult, $payment); |
|
| 249 | 249 | |
| 250 | 250 | $message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK']; |
| 251 | - if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) { |
|
| 252 | - $payment->set_status( $this->_pay_model->failed_status() ) ; |
|
| 253 | - $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
|
| 251 | + if (empty($PayPalResult['RAWRESPONSE'])) { |
|
| 252 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 253 | + $payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso')); |
|
| 254 | 254 | $payment->set_details($PayPalResult); |
| 255 | - }else{ |
|
| 256 | - if($this->_APICallSuccessful($PayPalResult)){ |
|
| 255 | + } else { |
|
| 256 | + if ($this->_APICallSuccessful($PayPalResult)) { |
|
| 257 | 257 | $payment->set_status($this->_pay_model->approved_status()); |
| 258 | - }else{ |
|
| 258 | + } else { |
|
| 259 | 259 | $payment->set_status($this->_pay_model->declined_status()); |
| 260 | 260 | } |
| 261 | 261 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
| 262 | - $payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0); |
|
| 262 | + $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0); |
|
| 263 | 263 | $payment->set_gateway_response($message); |
| 264 | - $payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null); |
|
| 264 | + $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null); |
|
| 265 | 265 | |
| 266 | 266 | $primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : ''; |
| 267 | 267 | $payment->set_extra_accntng($primary_registration_code); |
| 268 | 268 | $payment->set_details($PayPalResult); |
| 269 | 269 | } |
| 270 | - }catch(Exception $e){ |
|
| 270 | + } catch (Exception $e) { |
|
| 271 | 271 | $payment->set_status($this->_pay_model->failed_status()); |
| 272 | 272 | $payment->set_gateway_response($e->getMessage()); |
| 273 | 273 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @param EEI_Payment $payment |
| 285 | 285 | * @return array |
| 286 | 286 | */ |
| 287 | - private function _log_clean_request($request,$payment){ |
|
| 287 | + private function _log_clean_request($request, $payment) { |
|
| 288 | 288 | $cleaned_request_data = $request; |
| 289 | 289 | unset($cleaned_request_data['CCDetails']['acct']); |
| 290 | 290 | unset($cleaned_request_data['CCDetails']['cvv2']); |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | * @param EEI_Payment $payment |
| 301 | 301 | * @return array cleaned |
| 302 | 302 | */ |
| 303 | - private function _log_clean_response($response,$payment){ |
|
| 303 | + private function _log_clean_response($response, $payment) { |
|
| 304 | 304 | unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
| 305 | 305 | unset($response['REQUESTDATA']['ACCT']); |
| 306 | 306 | unset($response['REQUESTDATA']['EXPDATE']); |
| 307 | 307 | unset($response['REQUESTDATA']['CVV2']); |
| 308 | 308 | unset($response['RAWREQUEST']); |
| 309 | - $this->log(array('Paypal Response'=>$response),$payment); |
|
| 309 | + $this->log(array('Paypal Response'=>$response), $payment); |
|
| 310 | 310 | return $response; |
| 311 | 311 | } |
| 312 | 312 | |
@@ -331,32 +331,32 @@ discard block |
||
| 331 | 331 | // DP Fields |
| 332 | 332 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
| 333 | 333 | foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
| 334 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
| 334 | + $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal); |
|
| 335 | 335 | |
| 336 | 336 | // CC Details Fields |
| 337 | 337 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
| 338 | 338 | foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
| 339 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
| 339 | + $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal); |
|
| 340 | 340 | |
| 341 | 341 | // PayerInfo Type Fields |
| 342 | 342 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
| 343 | 343 | foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
| 344 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
| 344 | + $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal); |
|
| 345 | 345 | |
| 346 | 346 | // Payer Name Fields |
| 347 | 347 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
| 348 | 348 | foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
| 349 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
| 349 | + $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal); |
|
| 350 | 350 | |
| 351 | 351 | // Address Fields (Billing) |
| 352 | 352 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
| 353 | 353 | foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
| 354 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
| 354 | + $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal); |
|
| 355 | 355 | |
| 356 | 356 | // Payment Details Type Fields |
| 357 | 357 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
| 358 | 358 | foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
| 359 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
| 359 | + $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal); |
|
| 360 | 360 | |
| 361 | 361 | // Payment Details Item Type Fields |
| 362 | 362 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
@@ -364,22 +364,22 @@ discard block |
||
| 364 | 364 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
| 365 | 365 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
| 366 | 366 | foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
| 367 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
| 367 | + $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal); |
|
| 368 | 368 | $n++; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // Ship To Address Fields |
| 372 | 372 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
| 373 | 373 | foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
| 374 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
| 374 | + $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal); |
|
| 375 | 375 | |
| 376 | 376 | // 3D Secure Fields |
| 377 | 377 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
| 378 | 378 | foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
| 379 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
| 379 | + $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal); |
|
| 380 | 380 | |
| 381 | 381 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
| 382 | - $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
|
| 382 | + $NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP; |
|
| 383 | 383 | $NVPResponse = $this->_CURLRequest($NVPRequest); |
| 384 | 384 | $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
| 385 | 385 | $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | private function _CURLRequest($Request) { |
| 404 | 404 | $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
| 405 | 405 | $curl = curl_init(); |
| 406 | - curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) ); |
|
| 406 | + curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE)); |
|
| 407 | 407 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); |
| 408 | 408 | curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
| 409 | 409 | curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
@@ -452,9 +452,9 @@ discard block |
||
| 452 | 452 | private function _APICallSuccessful($PayPalResult) { |
| 453 | 453 | $approved = false; |
| 454 | 454 | // check main response message from PayPal |
| 455 | - if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) { |
|
| 455 | + if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
| 456 | 456 | $ack = strtoupper($PayPalResult['ACK']); |
| 457 | - $approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false; |
|
| 457 | + $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false; |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return $approved; |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | |
| 471 | 471 | $Errors = array(); |
| 472 | 472 | $n = 0; |
| 473 | - while (isset($DataArray['L_ERRORCODE' . $n . ''])) { |
|
| 474 | - $LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : ''; |
|
| 475 | - $LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : ''; |
|
| 476 | - $LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : ''; |
|
| 477 | - $LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : ''; |
|
| 473 | + while (isset($DataArray['L_ERRORCODE'.$n.''])) { |
|
| 474 | + $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : ''; |
|
| 475 | + $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : ''; |
|
| 476 | + $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : ''; |
|
| 477 | + $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : ''; |
|
| 478 | 478 | |
| 479 | 479 | $CurrentItem = array( |
| 480 | 480 | 'L_ERRORCODE' => $LErrorCode, |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
| 515 | 515 | $CurrentVarName = 'Severity Code'; |
| 516 | 516 | |
| 517 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
| 517 | + $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal; |
|
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | return $error; |
@@ -207,7 +207,7 @@ |
||
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * constructor |
| 210 | - * @param EE_Admin_Page $admin_page the calling admin_page_object |
|
| 210 | + * @param EE_Admin_Page $adminpage the calling admin_page_object |
|
| 211 | 211 | */ |
| 212 | 212 | public function __construct( EE_Admin_Page $adminpage ) { |
| 213 | 213 | |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -217,12 +218,15 @@ discard block |
||
| 217 | 218 | $this->_set_hooks_properties(); |
| 218 | 219 | |
| 219 | 220 | //first let's verify we're on the right page |
| 220 | - if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) |
|
| 221 | - return; //get out nothing more to be done here. |
|
| 221 | + if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) { |
|
| 222 | + return; |
|
| 223 | + } |
|
| 224 | + //get out nothing more to be done here. |
|
| 222 | 225 | |
| 223 | 226 | //allow for extends to modify properties |
| 224 | - if ( method_exists( $this, '_extend_properties' ) ) |
|
| 225 | - $this->_extend_properties(); |
|
| 227 | + if ( method_exists( $this, '_extend_properties' ) ) { |
|
| 228 | + $this->_extend_properties(); |
|
| 229 | + } |
|
| 226 | 230 | |
| 227 | 231 | $this->_set_page_object(); |
| 228 | 232 | $this->_init_hooks(); |
@@ -305,8 +309,10 @@ discard block |
||
| 305 | 309 | } |
| 306 | 310 | |
| 307 | 311 | //k now lets do the enqueues |
| 308 | - if( !isset( $this->_scripts_styles['enqueues'] ) ) |
|
| 309 | - return; //not sure if we should throw an error here or not. |
|
| 312 | + if( !isset( $this->_scripts_styles['enqueues'] ) ) { |
|
| 313 | + return; |
|
| 314 | + } |
|
| 315 | + //not sure if we should throw an error here or not. |
|
| 310 | 316 | foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) { |
| 311 | 317 | //make sure $routes is an array |
| 312 | 318 | $routes = (array) $routes; |
@@ -323,8 +329,9 @@ discard block |
||
| 323 | 329 | } |
| 324 | 330 | |
| 325 | 331 | //let's do the deregisters |
| 326 | - if ( !isset( $this->_scripts_styles['deregisters'] ) ) |
|
| 327 | - return; |
|
| 332 | + if ( !isset( $this->_scripts_styles['deregisters'] ) ) { |
|
| 333 | + return; |
|
| 334 | + } |
|
| 328 | 335 | foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) { |
| 329 | 336 | $defaults = array( |
| 330 | 337 | 'type' => 'js' |
@@ -376,8 +383,9 @@ discard block |
||
| 376 | 383 | |
| 377 | 384 | //first default file (if exists) |
| 378 | 385 | $decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php'; |
| 379 | - if ( is_readable( $decaf_file ) ) |
|
| 380 | - require_once( $decaf_file ); |
|
| 386 | + if ( is_readable( $decaf_file ) ) { |
|
| 387 | + require_once( $decaf_file ); |
|
| 388 | + } |
|
| 381 | 389 | |
| 382 | 390 | //now we have to do require for extended file (if needed) |
| 383 | 391 | if ( $this->_extend ) { |
@@ -486,12 +494,14 @@ discard block |
||
| 486 | 494 | |
| 487 | 495 | foreach ( $hook_filter_array as $hook => $args ) { |
| 488 | 496 | if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) { |
| 489 | - if ( isset( $this->_wp_action_filters_priority[$hook] ) ) |
|
| 490 | - $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
|
| 491 | - if ( $args['type'] == 'action' ) |
|
| 492 | - add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
| 493 | - else |
|
| 494 | - add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
| 497 | + if ( isset( $this->_wp_action_filters_priority[$hook] ) ) { |
|
| 498 | + $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
|
| 499 | + } |
|
| 500 | + if ( $args['type'] == 'action' ) { |
|
| 501 | + add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
| 502 | + } else { |
|
| 503 | + add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
| 504 | + } |
|
| 495 | 505 | } |
| 496 | 506 | } |
| 497 | 507 | |
@@ -504,8 +514,10 @@ discard block |
||
| 504 | 514 | */ |
| 505 | 515 | private function _ajax_hooks() { |
| 506 | 516 | |
| 507 | - if ( empty( $this->_ajax_func) ) |
|
| 508 | - return; //get out there's nothing to take care of. |
|
| 517 | + if ( empty( $this->_ajax_func) ) { |
|
| 518 | + return; |
|
| 519 | + } |
|
| 520 | + //get out there's nothing to take care of. |
|
| 509 | 521 | |
| 510 | 522 | foreach ( $this->_ajax_func as $action => $method ) { |
| 511 | 523 | //make sure method exists |
@@ -528,8 +540,10 @@ discard block |
||
| 528 | 540 | * @return void |
| 529 | 541 | */ |
| 530 | 542 | protected function _init_hooks() { |
| 531 | - if ( empty( $this->_init_func) ) |
|
| 532 | - return; //get out there's nothing to take care of. |
|
| 543 | + if ( empty( $this->_init_func) ) { |
|
| 544 | + return; |
|
| 545 | + } |
|
| 546 | + //get out there's nothing to take care of. |
|
| 533 | 547 | |
| 534 | 548 | //We need to determine what page_route we are on! |
| 535 | 549 | $current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
@@ -541,8 +555,9 @@ discard block |
||
| 541 | 555 | $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
| 542 | 556 | throw new EE_Error( implode('||', $msg ) ); |
| 543 | 557 | } |
| 544 | - if ( $route == $this->_current_route ) |
|
| 545 | - add_action('admin_init', array( $this, $method ) ); |
|
| 558 | + if ( $route == $this->_current_route ) { |
|
| 559 | + add_action('admin_init', array( $this, $method ) ); |
|
| 560 | + } |
|
| 546 | 561 | } |
| 547 | 562 | |
| 548 | 563 | } |
@@ -557,8 +572,10 @@ discard block |
||
| 557 | 572 | * @return void |
| 558 | 573 | */ |
| 559 | 574 | public function add_metaboxes() { |
| 560 | - if ( empty( $this->_metaboxes ) ) |
|
| 561 | - return; //get out we don't have any metaboxes to set for this connection |
|
| 575 | + if ( empty( $this->_metaboxes ) ) { |
|
| 576 | + return; |
|
| 577 | + } |
|
| 578 | + //get out we don't have any metaboxes to set for this connection |
|
| 562 | 579 | |
| 563 | 580 | $this->_handle_metabox_array( $this->_metaboxes ); |
| 564 | 581 | |
@@ -569,19 +586,24 @@ discard block |
||
| 569 | 586 | private function _handle_metabox_array( $boxes, $add = TRUE ) { |
| 570 | 587 | |
| 571 | 588 | foreach ( $boxes as $box ) { |
| 572 | - if ( !isset($box['page_route']) ) |
|
| 573 | - continue; //we dont' have a valid array |
|
| 589 | + if ( !isset($box['page_route']) ) { |
|
| 590 | + continue; |
|
| 591 | + } |
|
| 592 | + //we dont' have a valid array |
|
| 574 | 593 | |
| 575 | 594 | //let's make sure $box['page_route'] is an array so the "foreach" will work. |
| 576 | 595 | $box['page_route'] = (array) $box['page_route']; |
| 577 | 596 | |
| 578 | 597 | foreach ( $box['page_route'] as $route ) { |
| 579 | - if ( $route != $this->_current_route ) |
|
| 580 | - continue; //get out we only add metaboxes for set route. |
|
| 581 | - if ( $add ) |
|
| 582 | - $this->_add_metabox($box); |
|
| 583 | - else |
|
| 584 | - $this->_remove_metabox($box); |
|
| 598 | + if ( $route != $this->_current_route ) { |
|
| 599 | + continue; |
|
| 600 | + } |
|
| 601 | + //get out we only add metaboxes for set route. |
|
| 602 | + if ( $add ) { |
|
| 603 | + $this->_add_metabox($box); |
|
| 604 | + } else { |
|
| 605 | + $this->_remove_metabox($box); |
|
| 606 | + } |
|
| 585 | 607 | } |
| 586 | 608 | } |
| 587 | 609 | } |
@@ -596,8 +618,10 @@ discard block |
||
| 596 | 618 | */ |
| 597 | 619 | public function remove_metaboxes() { |
| 598 | 620 | |
| 599 | - if ( empty( $this->_remove_metaboxes ) ) |
|
| 600 | - return; //get out there are no metaboxes to remove |
|
| 621 | + if ( empty( $this->_remove_metaboxes ) ) { |
|
| 622 | + return; |
|
| 623 | + } |
|
| 624 | + //get out there are no metaboxes to remove |
|
| 601 | 625 | |
| 602 | 626 | $this->_handle_metabox_array( $this->_remove_metaboxes, FALSE ); |
| 603 | 627 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * constructor |
| 210 | 210 | * @param EE_Admin_Page $admin_page the calling admin_page_object |
| 211 | 211 | */ |
| 212 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
| 212 | + public function __construct(EE_Admin_Page $adminpage) { |
|
| 213 | 213 | |
| 214 | 214 | $this->_adminpage_obj = $adminpage; |
| 215 | 215 | $this->_req_data = array_merge($_GET, $_POST); |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | $this->_set_hooks_properties(); |
| 218 | 218 | |
| 219 | 219 | //first let's verify we're on the right page |
| 220 | - if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) |
|
| 220 | + if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page'])) |
|
| 221 | 221 | return; //get out nothing more to be done here. |
| 222 | 222 | |
| 223 | 223 | //allow for extends to modify properties |
| 224 | - if ( method_exists( $this, '_extend_properties' ) ) |
|
| 224 | + if (method_exists($this, '_extend_properties')) |
|
| 225 | 225 | $this->_extend_properties(); |
| 226 | 226 | |
| 227 | 227 | $this->_set_page_object(); |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | $this->_load_custom_methods(); |
| 230 | 230 | $this->_load_routed_hooks(); |
| 231 | 231 | |
| 232 | - add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) ); |
|
| 233 | - add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 ); |
|
| 234 | - add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 ); |
|
| 232 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
| 233 | + add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20); |
|
| 234 | + add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15); |
|
| 235 | 235 | |
| 236 | 236 | $this->_ajax_hooks(); |
| 237 | 237 | |
@@ -272,15 +272,15 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function enqueue_scripts_styles() { |
| 274 | 274 | |
| 275 | - if ( !empty( $this->_scripts_styles ) ) { |
|
| 275 | + if ( ! empty($this->_scripts_styles)) { |
|
| 276 | 276 | //first let's do all the registrations |
| 277 | - if ( !isset($this->_scripts_styles['registers'] ) ) { |
|
| 277 | + if ( ! isset($this->_scripts_styles['registers'])) { |
|
| 278 | 278 | $msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso'); |
| 279 | - $msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' ); |
|
| 280 | - throw new EE_Error( implode( '||', $msg ) ); |
|
| 279 | + $msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>'); |
|
| 280 | + throw new EE_Error(implode('||', $msg)); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - foreach( $this->_scripts_styles['registers'] as $ref => $details ) { |
|
| 283 | + foreach ($this->_scripts_styles['registers'] as $ref => $details) { |
|
| 284 | 284 | $defaults = array( |
| 285 | 285 | 'type' => 'js', |
| 286 | 286 | 'url' => '', |
@@ -289,48 +289,48 @@ discard block |
||
| 289 | 289 | 'footer' => TRUE |
| 290 | 290 | ); |
| 291 | 291 | $details = wp_parse_args($details, $defaults); |
| 292 | - extract( $details ); |
|
| 292 | + extract($details); |
|
| 293 | 293 | |
| 294 | 294 | //let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do |
| 295 | 295 | $this->_scripts_styles['registers'][$ref]['type'] = $type; |
| 296 | 296 | |
| 297 | 297 | //let's make sure we're not missing any REQUIRED parameters |
| 298 | - if ( empty($url) ) { |
|
| 299 | - $msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' ); |
|
| 300 | - $msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref ); |
|
| 301 | - throw new EE_Error( implode( '||', $msg ) ); |
|
| 298 | + if (empty($url)) { |
|
| 299 | + $msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet'); |
|
| 300 | + $msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref); |
|
| 301 | + throw new EE_Error(implode('||', $msg)); |
|
| 302 | 302 | } |
| 303 | 303 | //made it here so let's do the appropriate registration |
| 304 | - $type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version ); |
|
| 304 | + $type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | //k now lets do the enqueues |
| 308 | - if( !isset( $this->_scripts_styles['enqueues'] ) ) |
|
| 309 | - return; //not sure if we should throw an error here or not. |
|
| 310 | - foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) { |
|
| 308 | + if ( ! isset($this->_scripts_styles['enqueues'])) |
|
| 309 | + return; //not sure if we should throw an error here or not. |
|
| 310 | + foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) { |
|
| 311 | 311 | //make sure $routes is an array |
| 312 | 312 | $routes = (array) $routes; |
| 313 | 313 | |
| 314 | - if ( in_array($this->_current_route, $routes ) ) { |
|
| 314 | + if (in_array($this->_current_route, $routes)) { |
|
| 315 | 315 | $this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref); |
| 316 | 316 | //if we have a localization for the script let's do that too. |
| 317 | - if ( isset( $this->_scripts_styles['localize'][$ref] ) ) { |
|
| 318 | - foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) { |
|
| 319 | - wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] ); |
|
| 317 | + if (isset($this->_scripts_styles['localize'][$ref])) { |
|
| 318 | + foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) { |
|
| 319 | + wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | //let's do the deregisters |
| 326 | - if ( !isset( $this->_scripts_styles['deregisters'] ) ) |
|
| 326 | + if ( ! isset($this->_scripts_styles['deregisters'])) |
|
| 327 | 327 | return; |
| 328 | - foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) { |
|
| 328 | + foreach ($this->_scripts_styles['deregisters'] as $ref => $details) { |
|
| 329 | 329 | $defaults = array( |
| 330 | 330 | 'type' => 'js' |
| 331 | 331 | ); |
| 332 | - $details = wp_parse_args( $details, $defaults ); |
|
| 333 | - extract( $details ); |
|
| 332 | + $details = wp_parse_args($details, $defaults); |
|
| 333 | + extract($details); |
|
| 334 | 334 | |
| 335 | 335 | $type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref); |
| 336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | private function _set_defaults() { |
| 351 | 351 | $this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array(); |
| 352 | - $this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
| 352 | + $this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
| 353 | 353 | $this->caller = get_class($this); |
| 354 | 354 | $this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE; |
| 355 | 355 | } |
@@ -364,34 +364,34 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | protected function _set_page_object() { |
| 366 | 366 | //first make sure $this->_name is set |
| 367 | - if ( empty( $this->_name ) ) { |
|
| 367 | + if (empty($this->_name)) { |
|
| 368 | 368 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
| 369 | - $msg[] = sprintf( __("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller ); |
|
| 370 | - throw new EE_Error( implode( '||', $msg ) ); |
|
| 369 | + $msg[] = sprintf(__("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller); |
|
| 370 | + throw new EE_Error(implode('||', $msg)); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - $ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message |
|
| 374 | - $ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message |
|
| 373 | + $ref = str_replace('_', ' ', $this->_name); //take the_message -> the message |
|
| 374 | + $ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message |
|
| 375 | 375 | |
| 376 | 376 | //first default file (if exists) |
| 377 | - $decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php'; |
|
| 378 | - if ( is_readable( $decaf_file ) ) |
|
| 379 | - require_once( $decaf_file ); |
|
| 377 | + $decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php'; |
|
| 378 | + if (is_readable($decaf_file)) |
|
| 379 | + require_once($decaf_file); |
|
| 380 | 380 | |
| 381 | 381 | //now we have to do require for extended file (if needed) |
| 382 | - if ( $this->_extend ) { |
|
| 383 | - require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' ); |
|
| 382 | + if ($this->_extend) { |
|
| 383 | + require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php'); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | |
| 387 | 387 | //if we've got an extended class we use that! |
| 388 | - $ref = $this->_extend ? 'Extend_' . $ref : $ref; |
|
| 388 | + $ref = $this->_extend ? 'Extend_'.$ref : $ref; |
|
| 389 | 389 | |
| 390 | 390 | //let's make sure the class exists |
| 391 | - if ( !class_exists( $ref ) ) { |
|
| 391 | + if ( ! class_exists($ref)) { |
|
| 392 | 392 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
| 393 | - $msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref ); |
|
| 394 | - throw new EE_Error( implode( '||', $msg ) ); |
|
| 393 | + $msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref); |
|
| 394 | + throw new EE_Error(implode('||', $msg)); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | $a = new ReflectionClass($ref); |
@@ -416,27 +416,27 @@ discard block |
||
| 416 | 416 | $method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route; |
| 417 | 417 | |
| 418 | 418 | //these run before the Admin_Page route executes. |
| 419 | - if ( method_exists( $this, $method_callback ) ) { |
|
| 420 | - call_user_func( array( $this, $method_callback) ); |
|
| 419 | + if (method_exists($this, $method_callback)) { |
|
| 420 | + call_user_func(array($this, $method_callback)); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | |
| 424 | 424 | //these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes. There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens. |
| 425 | 425 | //first the actions |
| 426 | 426 | //note that these action hooks will have the $query_args value available. |
| 427 | - $admin_class_name = get_class( $this->_adminpage_obj ); |
|
| 427 | + $admin_class_name = get_class($this->_adminpage_obj); |
|
| 428 | 428 | |
| 429 | - if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) { |
|
| 430 | - add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 ); |
|
| 429 | + if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) { |
|
| 430 | + add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) { |
|
| 434 | - add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 ); |
|
| 433 | + if (method_exists($this, '_redirect_action_'.$this->_current_route)) { |
|
| 434 | + add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | //let's hook into the _redirect itself and allow for changing where the user goes after redirect. This will have $query_args and $redirect_url available. |
| 438 | - if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) { |
|
| 439 | - add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 ); |
|
| 438 | + if (method_exists($this, '_redirect_filter_'.$this->_current_route)) { |
|
| 439 | + add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | } |
@@ -459,12 +459,12 @@ discard block |
||
| 459 | 459 | 'argnum' => 1, |
| 460 | 460 | 'priority' => 10 |
| 461 | 461 | ), |
| 462 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array( |
|
| 462 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array( |
|
| 463 | 463 | 'type' => 'filter', |
| 464 | 464 | 'argnum' => 1, |
| 465 | 465 | 'priority' => 10 |
| 466 | 466 | ), |
| 467 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array( |
|
| 467 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array( |
|
| 468 | 468 | 'type' => 'filter', |
| 469 | 469 | 'argnum' => 1, |
| 470 | 470 | 'priority' => 10 |
@@ -483,14 +483,14 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | |
| 485 | 485 | |
| 486 | - foreach ( $hook_filter_array as $hook => $args ) { |
|
| 487 | - if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) { |
|
| 488 | - if ( isset( $this->_wp_action_filters_priority[$hook] ) ) |
|
| 486 | + foreach ($hook_filter_array as $hook => $args) { |
|
| 487 | + if (method_exists($this, $this->_current_route.'_'.$hook)) { |
|
| 488 | + if (isset($this->_wp_action_filters_priority[$hook])) |
|
| 489 | 489 | $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
| 490 | - if ( $args['type'] == 'action' ) |
|
| 491 | - add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
| 490 | + if ($args['type'] == 'action') |
|
| 491 | + add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
| 492 | 492 | else |
| 493 | - add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
| 493 | + add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | 496 | |
@@ -503,18 +503,18 @@ discard block |
||
| 503 | 503 | */ |
| 504 | 504 | private function _ajax_hooks() { |
| 505 | 505 | |
| 506 | - if ( empty( $this->_ajax_func) ) |
|
| 506 | + if (empty($this->_ajax_func)) |
|
| 507 | 507 | return; //get out there's nothing to take care of. |
| 508 | 508 | |
| 509 | - foreach ( $this->_ajax_func as $action => $method ) { |
|
| 509 | + foreach ($this->_ajax_func as $action => $method) { |
|
| 510 | 510 | //make sure method exists |
| 511 | - if ( !method_exists($this, $method) ) { |
|
| 512 | - $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />'; |
|
| 513 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
| 514 | - throw new EE_Error( implode('||', $msg ) ); |
|
| 511 | + if ( ! method_exists($this, $method)) { |
|
| 512 | + $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />'; |
|
| 513 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
| 514 | + throw new EE_Error(implode('||', $msg)); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - add_action('wp_ajax_' . $action, array( $this, $method ) ); |
|
| 517 | + add_action('wp_ajax_'.$action, array($this, $method)); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | } |
@@ -527,21 +527,21 @@ discard block |
||
| 527 | 527 | * @return void |
| 528 | 528 | */ |
| 529 | 529 | protected function _init_hooks() { |
| 530 | - if ( empty( $this->_init_func) ) |
|
| 530 | + if (empty($this->_init_func)) |
|
| 531 | 531 | return; //get out there's nothing to take care of. |
| 532 | 532 | |
| 533 | 533 | //We need to determine what page_route we are on! |
| 534 | - $current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
| 534 | + $current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
| 535 | 535 | |
| 536 | - foreach ( $this->_init_func as $route => $method ) { |
|
| 536 | + foreach ($this->_init_func as $route => $method) { |
|
| 537 | 537 | //make sure method exists |
| 538 | - if ( !method_exists($this, $method) ) { |
|
| 539 | - $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />'; |
|
| 540 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
| 541 | - throw new EE_Error( implode('||', $msg ) ); |
|
| 538 | + if ( ! method_exists($this, $method)) { |
|
| 539 | + $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />'; |
|
| 540 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
| 541 | + throw new EE_Error(implode('||', $msg)); |
|
| 542 | 542 | } |
| 543 | - if ( $route == $this->_current_route ) |
|
| 544 | - add_action('admin_init', array( $this, $method ) ); |
|
| 543 | + if ($route == $this->_current_route) |
|
| 544 | + add_action('admin_init', array($this, $method)); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | } |
@@ -556,28 +556,28 @@ discard block |
||
| 556 | 556 | * @return void |
| 557 | 557 | */ |
| 558 | 558 | public function add_metaboxes() { |
| 559 | - if ( empty( $this->_metaboxes ) ) |
|
| 559 | + if (empty($this->_metaboxes)) |
|
| 560 | 560 | return; //get out we don't have any metaboxes to set for this connection |
| 561 | 561 | |
| 562 | - $this->_handle_metabox_array( $this->_metaboxes ); |
|
| 562 | + $this->_handle_metabox_array($this->_metaboxes); |
|
| 563 | 563 | |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | |
| 567 | 567 | |
| 568 | - private function _handle_metabox_array( $boxes, $add = TRUE ) { |
|
| 568 | + private function _handle_metabox_array($boxes, $add = TRUE) { |
|
| 569 | 569 | |
| 570 | - foreach ( $boxes as $box ) { |
|
| 571 | - if ( !isset($box['page_route']) ) |
|
| 570 | + foreach ($boxes as $box) { |
|
| 571 | + if ( ! isset($box['page_route'])) |
|
| 572 | 572 | continue; //we dont' have a valid array |
| 573 | 573 | |
| 574 | 574 | //let's make sure $box['page_route'] is an array so the "foreach" will work. |
| 575 | 575 | $box['page_route'] = (array) $box['page_route']; |
| 576 | 576 | |
| 577 | - foreach ( $box['page_route'] as $route ) { |
|
| 578 | - if ( $route != $this->_current_route ) |
|
| 577 | + foreach ($box['page_route'] as $route) { |
|
| 578 | + if ($route != $this->_current_route) |
|
| 579 | 579 | continue; //get out we only add metaboxes for set route. |
| 580 | - if ( $add ) |
|
| 580 | + if ($add) |
|
| 581 | 581 | $this->_add_metabox($box); |
| 582 | 582 | else |
| 583 | 583 | $this->_remove_metabox($box); |
@@ -595,10 +595,10 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function remove_metaboxes() { |
| 597 | 597 | |
| 598 | - if ( empty( $this->_remove_metaboxes ) ) |
|
| 598 | + if (empty($this->_remove_metaboxes)) |
|
| 599 | 599 | return; //get out there are no metaboxes to remove |
| 600 | 600 | |
| 601 | - $this->_handle_metabox_array( $this->_remove_metaboxes, FALSE ); |
|
| 601 | + $this->_handle_metabox_array($this->_remove_metaboxes, FALSE); |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | |
@@ -608,53 +608,53 @@ discard block |
||
| 608 | 608 | * @access private |
| 609 | 609 | * @param array $args an array of args that have been set for this metabox by the child class |
| 610 | 610 | */ |
| 611 | - private function _add_metabox( $args ) { |
|
| 611 | + private function _add_metabox($args) { |
|
| 612 | 612 | $current_screen = get_current_screen(); |
| 613 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
| 614 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
| 613 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
| 614 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
| 615 | 615 | |
| 616 | 616 | //set defaults |
| 617 | 617 | $defaults = array( |
| 618 | 618 | 'func' => $func, |
| 619 | - 'id' => $this->caller . '_' . $func . '_metabox', |
|
| 619 | + 'id' => $this->caller.'_'.$func.'_metabox', |
|
| 620 | 620 | 'priority' => 'default', |
| 621 | 621 | 'label' => $this->caller, |
| 622 | 622 | 'context' => 'advanced', |
| 623 | 623 | 'callback_args' => array(), |
| 624 | - 'page' => isset( $args['page'] ) ? $args['page'] : $screen_id |
|
| 624 | + 'page' => isset($args['page']) ? $args['page'] : $screen_id |
|
| 625 | 625 | ); |
| 626 | 626 | |
| 627 | - $args = wp_parse_args( $args, $defaults ); |
|
| 627 | + $args = wp_parse_args($args, $defaults); |
|
| 628 | 628 | extract($args); |
| 629 | 629 | |
| 630 | 630 | |
| 631 | 631 | //make sure method exists |
| 632 | - if ( !method_exists($this, $func) ) { |
|
| 633 | - $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />'; |
|
| 634 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller ); |
|
| 635 | - throw new EE_Error( implode('||', $msg ) ); |
|
| 632 | + if ( ! method_exists($this, $func)) { |
|
| 633 | + $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />'; |
|
| 634 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller); |
|
| 635 | + throw new EE_Error(implode('||', $msg)); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | //everything checks out so lets add the metabox |
| 639 | - add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args); |
|
| 639 | + add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | |
| 643 | 643 | |
| 644 | - private function _remove_metabox( $args ) { |
|
| 644 | + private function _remove_metabox($args) { |
|
| 645 | 645 | $current_screen = get_current_screen(); |
| 646 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
| 647 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
| 646 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
| 647 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
| 648 | 648 | |
| 649 | 649 | //set defaults |
| 650 | 650 | $defaults = array( |
| 651 | - 'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox', |
|
| 651 | + 'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox', |
|
| 652 | 652 | 'context' => 'default', |
| 653 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id |
|
| 653 | + 'screen' => isset($args['screen']) ? $args['screen'] : $screen_id |
|
| 654 | 654 | ); |
| 655 | 655 | |
| 656 | - $args = wp_parse_args( $args, $defaults ); |
|
| 657 | - extract( $args ); |
|
| 656 | + $args = wp_parse_args($args, $defaults); |
|
| 657 | + extract($args); |
|
| 658 | 658 | |
| 659 | 659 | //everything checks out so lets remove the box! |
| 660 | 660 | remove_meta_box($id, $screen, $context); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * _get_hidden_fields |
| 306 | 306 | * returns a html string of hidden fields so if any table filters are used the current view will be respected. |
| 307 | - * @return html string |
|
| 307 | + * @return string string |
|
| 308 | 308 | */ |
| 309 | 309 | protected function _get_hidden_fields() { |
| 310 | 310 | $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | * @since 4.1 |
| 513 | 513 | * @access public |
| 514 | 514 | * |
| 515 | - * @param object $item The current item |
|
| 515 | + * @param EE_Message_Template_Group $item The current item |
|
| 516 | 516 | */ |
| 517 | 517 | public function single_row( $item ) { |
| 518 | 518 | $row_class = $this->_get_row_class( $item ); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | if ( ! class_exists( 'WP_List_Table' )) { |
| 35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 35 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | |
| 6 | 7 | /** |
@@ -362,8 +363,9 @@ discard block |
||
| 362 | 363 | |
| 363 | 364 | $sortable = array(); |
| 364 | 365 | foreach ( $_sortable as $id => $data ) { |
| 365 | - if ( empty( $data ) ) |
|
| 366 | - continue; |
|
| 366 | + if ( empty( $data ) ) { |
|
| 367 | + continue; |
|
| 368 | + } |
|
| 367 | 369 | |
| 368 | 370 | //fix for offset errors with WP_List_Table default get_columninfo() |
| 369 | 371 | if ( is_array($data) ) { |
@@ -375,8 +377,9 @@ discard block |
||
| 375 | 377 | |
| 376 | 378 | $data = (array) $data; |
| 377 | 379 | |
| 378 | - if ( !isset( $data[1] ) ) |
|
| 379 | - $_data[1] = false; |
|
| 380 | + if ( !isset( $data[1] ) ) { |
|
| 381 | + $_data[1] = false; |
|
| 382 | + } |
|
| 380 | 383 | |
| 381 | 384 | |
| 382 | 385 | $sortable[$id] = $_data; |
@@ -399,11 +402,12 @@ discard block |
||
| 399 | 402 | $actions = array(); |
| 400 | 403 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
| 401 | 404 | foreach ( $this->_views as $view => $args) { |
| 402 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
| 403 | - //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
| 405 | + if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) { |
|
| 406 | + //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
|
| 404 | 407 | foreach ( $args['bulk_action'] as $route =>$label ) { |
| 405 | 408 | if ( $this->_admin_page->check_user_access( $route, true ) ) { |
| 406 | 409 | $actions[$route] = $label; |
| 410 | + } |
|
| 407 | 411 | } |
| 408 | 412 | } |
| 409 | 413 | } |
@@ -633,14 +637,12 @@ discard block |
||
| 633 | 637 | echo '<th scope="row" class="check-column">'; |
| 634 | 638 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
| 635 | 639 | echo '</th>'; |
| 636 | - } |
|
| 637 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
| 640 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
| 638 | 641 | echo "<td $attributes>"; |
| 639 | 642 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
| 640 | 643 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
| 641 | 644 | echo "</td>"; |
| 642 | - } |
|
| 643 | - else { |
|
| 645 | + } else { |
|
| 644 | 646 | echo "<td $attributes>"; |
| 645 | 647 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
| 646 | 648 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
@@ -656,7 +658,7 @@ discard block |
||
| 656 | 658 | $this->_filters(); |
| 657 | 659 | echo $this->_get_hidden_fields(); |
| 658 | 660 | echo '<br class="clear">'; |
| 659 | - }else{ |
|
| 661 | + } else{ |
|
| 660 | 662 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
| 661 | 663 | foreach($this->_bottom_buttons as $type => $action){ |
| 662 | 664 | $route = isset( $action['route'] ) ? $action['route'] : ''; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | * ------------------------------------------------------------------------ |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | -if ( ! class_exists( 'WP_List_Table' )) { |
|
| 35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 34 | +if ( ! class_exists('WP_List_Table')) { |
|
| 35 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -234,16 +234,16 @@ discard block |
||
| 234 | 234 | * constructor |
| 235 | 235 | * @param EE_Admin_Page object $admin_page we use this for obtaining everything we need in the list table. |
| 236 | 236 | */ |
| 237 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
| 237 | + public function __construct(EE_Admin_Page $admin_page) { |
|
| 238 | 238 | $this->_admin_page = $admin_page; |
| 239 | 239 | $this->_req_data = $this->_admin_page->get_request_data(); |
| 240 | 240 | $this->_view = $this->_admin_page->get_view(); |
| 241 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
| 241 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
| 242 | 242 | $this->_current_page = $this->get_pagenum(); |
| 243 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
| 244 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
| 243 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
| 244 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
| 245 | 245 | |
| 246 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
| 246 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
| 247 | 247 | |
| 248 | 248 | $this->_setup_data(); |
| 249 | 249 | $this->_add_view_counts(); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $this->_set_properties(); |
| 254 | 254 | |
| 255 | 255 | //set primary column |
| 256 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
| 256 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
| 257 | 257 | |
| 258 | 258 | //set parent defaults |
| 259 | 259 | parent::__construct($this->_wp_list_args); |
@@ -329,17 +329,17 @@ discard block |
||
| 329 | 329 | * @return html string |
| 330 | 330 | */ |
| 331 | 331 | protected function _get_hidden_fields() { |
| 332 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
| 333 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
| 332 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
| 333 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
| 334 | 334 | //if action is STILL empty, then we set it to default |
| 335 | - $action = empty( $action ) ? 'default' : $action; |
|
| 336 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
| 337 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
| 338 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
| 335 | + $action = empty($action) ? 'default' : $action; |
|
| 336 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
| 337 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
| 338 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
| 339 | 339 | |
| 340 | 340 | $bulk_actions = $this->_get_bulk_actions(); |
| 341 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
| 342 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
| 341 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
| 342 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | return $field; |
@@ -369,15 +369,15 @@ discard block |
||
| 369 | 369 | * |
| 370 | 370 | * @var array |
| 371 | 371 | */ |
| 372 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
| 372 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
| 373 | 373 | |
| 374 | 374 | $sortable = array(); |
| 375 | - foreach ( $_sortable as $id => $data ) { |
|
| 376 | - if ( empty( $data ) ) |
|
| 375 | + foreach ($_sortable as $id => $data) { |
|
| 376 | + if (empty($data)) |
|
| 377 | 377 | continue; |
| 378 | 378 | |
| 379 | 379 | //fix for offset errors with WP_List_Table default get_columninfo() |
| 380 | - if ( is_array($data) ) { |
|
| 380 | + if (is_array($data)) { |
|
| 381 | 381 | $_data[0] = key($data); |
| 382 | 382 | $_data[1] = isset($data[1]) ? $data[1] : false; |
| 383 | 383 | } else { |
@@ -386,14 +386,14 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $data = (array) $data; |
| 388 | 388 | |
| 389 | - if ( !isset( $data[1] ) ) |
|
| 389 | + if ( ! isset($data[1])) |
|
| 390 | 390 | $_data[1] = false; |
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | $sortable[$id] = $_data; |
| 394 | 394 | } |
| 395 | 395 | $primary = $this->get_primary_column_name(); |
| 396 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
| 396 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | * @return string |
| 403 | 403 | */ |
| 404 | 404 | protected function get_primary_column_name() { |
| 405 | - foreach( class_parents( $this ) as $parent ) { |
|
| 406 | - if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) { |
|
| 405 | + foreach (class_parents($this) as $parent) { |
|
| 406 | + if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') { |
|
| 407 | 407 | return parent::get_primary_column_name(); |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -415,10 +415,10 @@ discard block |
||
| 415 | 415 | * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814) |
| 416 | 416 | * @return string |
| 417 | 417 | */ |
| 418 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
| 419 | - foreach( class_parents( $this ) as $parent ) { |
|
| 420 | - if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) { |
|
| 421 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
| 418 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
| 419 | + foreach (class_parents($this) as $parent) { |
|
| 420 | + if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') { |
|
| 421 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | ''; |
@@ -436,11 +436,11 @@ discard block |
||
| 436 | 436 | protected function _get_bulk_actions() { |
| 437 | 437 | $actions = array(); |
| 438 | 438 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
| 439 | - foreach ( $this->_views as $view => $args) { |
|
| 440 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
| 439 | + foreach ($this->_views as $view => $args) { |
|
| 440 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view) |
|
| 441 | 441 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
| 442 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
| 443 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
| 442 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
| 443 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
| 444 | 444 | $actions[$route] = $label; |
| 445 | 445 | } |
| 446 | 446 | } |
@@ -458,18 +458,18 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | private function _filters() { |
| 460 | 460 | $classname = get_class($this); |
| 461 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
| 461 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
| 462 | 462 | |
| 463 | - if ( empty( $filters )) { |
|
| 463 | + if (empty($filters)) { |
|
| 464 | 464 | return; |
| 465 | 465 | } |
| 466 | - foreach ( $filters as $filter ) { |
|
| 466 | + foreach ($filters as $filter) { |
|
| 467 | 467 | echo $filter; |
| 468 | 468 | } |
| 469 | 469 | //add filter button at end |
| 470 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
| 470 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
| 471 | 471 | //add reset filters button at end |
| 472 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
| 472 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | |
@@ -483,8 +483,8 @@ discard block |
||
| 483 | 483 | * @param string $column_name |
| 484 | 484 | * @return string |
| 485 | 485 | */ |
| 486 | - public function set_primary_column( $column_name ) { |
|
| 487 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
| 486 | + public function set_primary_column($column_name) { |
|
| 487 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | array( |
| 504 | 504 | 'total_items' => $total_items, |
| 505 | 505 | 'per_page' => $this->_per_page, |
| 506 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
| 506 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
| 507 | 507 | ) |
| 508 | 508 | ); |
| 509 | 509 | } |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | * |
| 520 | 520 | * @return string html content for the column |
| 521 | 521 | */ |
| 522 | - public function column_default( $item, $column_name ) { |
|
| 522 | + public function column_default($item, $column_name) { |
|
| 523 | 523 | /** |
| 524 | 524 | * Dynamic hook allowing for adding additional column content in this list table. |
| 525 | 525 | * Note that $this->screen->id is in the format |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | * hook prefix ("event-espresso") will be different. |
| 530 | 530 | * |
| 531 | 531 | */ |
| 532 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
| 532 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | * |
| 546 | 546 | * @var array |
| 547 | 547 | */ |
| 548 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
| 548 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
| 549 | 549 | return $columns; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -557,18 +557,18 @@ discard block |
||
| 557 | 557 | $views = $this->get_views(); |
| 558 | 558 | $assembled_views = ''; |
| 559 | 559 | |
| 560 | - if ( empty( $views )) { |
|
| 560 | + if (empty($views)) { |
|
| 561 | 561 | return; |
| 562 | 562 | } |
| 563 | 563 | echo "<ul class='subsubsub'>\n"; |
| 564 | - foreach ( $views as $view ) { |
|
| 565 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
| 566 | - if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { |
|
| 567 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
| 564 | + foreach ($views as $view) { |
|
| 565 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
| 566 | + if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { |
|
| 567 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
| 571 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
| 572 | 572 | echo "</ul>"; |
| 573 | 573 | } |
| 574 | 574 | |
@@ -581,10 +581,10 @@ discard block |
||
| 581 | 581 | * |
| 582 | 582 | * @param object $item The current item |
| 583 | 583 | */ |
| 584 | - public function single_row( $item ) { |
|
| 585 | - $row_class = $this->_get_row_class( $item ); |
|
| 586 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
| 587 | - $this->single_row_columns( $item ); |
|
| 584 | + public function single_row($item) { |
|
| 585 | + $row_class = $this->_get_row_class($item); |
|
| 586 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
| 587 | + $this->single_row_columns($item); |
|
| 588 | 588 | echo '</tr>'; |
| 589 | 589 | } |
| 590 | 590 | |
@@ -595,13 +595,13 @@ discard block |
||
| 595 | 595 | * @param object $item the current item |
| 596 | 596 | * @return string |
| 597 | 597 | */ |
| 598 | - protected function _get_row_class( $item ) { |
|
| 598 | + protected function _get_row_class($item) { |
|
| 599 | 599 | static $row_class = ''; |
| 600 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
| 600 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
| 601 | 601 | |
| 602 | 602 | $new_row_class = $row_class; |
| 603 | 603 | |
| 604 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
| 604 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
| 605 | 605 | $new_row_class .= ' rowsortable'; |
| 606 | 606 | } |
| 607 | 607 | |
@@ -620,13 +620,13 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | public function get_hidden_columns() { |
| 622 | 622 | $user_id = get_current_user_id(); |
| 623 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
| 624 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
| 625 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
| 626 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
| 623 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
| 624 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
| 625 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
| 626 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
| 627 | 627 | } |
| 628 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
| 629 | - $saved_columns = (array) get_user_option( $ref, $user_id ); |
|
| 628 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
| 629 | + $saved_columns = (array) get_user_option($ref, $user_id); |
|
| 630 | 630 | return $saved_columns; |
| 631 | 631 | } |
| 632 | 632 | |
@@ -641,47 +641,47 @@ discard block |
||
| 641 | 641 | * |
| 642 | 642 | * @param object $item The current item |
| 643 | 643 | */ |
| 644 | - public function single_row_columns( $item ) { |
|
| 645 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
| 644 | + public function single_row_columns($item) { |
|
| 645 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
| 646 | 646 | |
| 647 | 647 | global $wp_version; |
| 648 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
| 648 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
| 649 | 649 | |
| 650 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
| 650 | + foreach ($columns as $column_name => $column_display_name) { |
|
| 651 | 651 | |
| 652 | 652 | /** |
| 653 | 653 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
| 654 | 654 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
| 655 | 655 | */ |
| 656 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
| 657 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
| 656 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
| 657 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
| 658 | 658 | |
| 659 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
| 660 | - if ( $primary == $column_name ) { |
|
| 659 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
| 660 | + if ($primary == $column_name) { |
|
| 661 | 661 | $classes .= ' has-row-actions column-primary'; |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
| 664 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
| 665 | 665 | |
| 666 | 666 | $class = "class='$classes'"; |
| 667 | 667 | |
| 668 | 668 | $attributes = "$class$style$data"; |
| 669 | 669 | |
| 670 | - if ( 'cb' === $column_name ) { |
|
| 670 | + if ('cb' === $column_name) { |
|
| 671 | 671 | echo '<th scope="row" class="check-column">'; |
| 672 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
| 672 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
| 673 | 673 | echo '</th>'; |
| 674 | 674 | } |
| 675 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
| 675 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
| 676 | 676 | echo "<td $attributes>"; |
| 677 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
| 678 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
| 677 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
| 678 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
| 679 | 679 | echo "</td>"; |
| 680 | 680 | } |
| 681 | 681 | else { |
| 682 | 682 | echo "<td $attributes>"; |
| 683 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
| 684 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
| 683 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
| 684 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
| 685 | 685 | echo "</td>"; |
| 686 | 686 | } |
| 687 | 687 | } |
@@ -689,19 +689,19 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | |
| 691 | 691 | |
| 692 | - public function extra_tablenav( $which ) { |
|
| 693 | - if ( $which == 'top' ) { |
|
| 692 | + public function extra_tablenav($which) { |
|
| 693 | + if ($which == 'top') { |
|
| 694 | 694 | $this->_filters(); |
| 695 | 695 | echo $this->_get_hidden_fields(); |
| 696 | 696 | echo '<br class="clear">'; |
| 697 | - }else{ |
|
| 697 | + } else { |
|
| 698 | 698 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
| 699 | - foreach($this->_bottom_buttons as $type => $action){ |
|
| 700 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
| 701 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
| 699 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
| 700 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
| 701 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
| 702 | 702 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request); |
| 703 | 703 | } |
| 704 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
| 704 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
| 705 | 705 | echo '</div>'; |
| 706 | 706 | } |
| 707 | 707 | //echo $this->_entries_per_page_dropdown; |
@@ -751,13 +751,13 @@ discard block |
||
| 751 | 751 | * |
| 752 | 752 | * @return string The assembled action elements container. |
| 753 | 753 | */ |
| 754 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
| 754 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
| 755 | 755 | $content = ''; |
| 756 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
| 757 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
| 758 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
| 759 | - $content .= apply_filters( 'FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this ); |
|
| 760 | - $content .= ! empty( $container ) ? '</' . $container . '>' : ''; |
|
| 756 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
| 757 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
| 758 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
| 759 | + $content .= apply_filters('FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this); |
|
| 760 | + $content .= ! empty($container) ? '</'.$container.'>' : ''; |
|
| 761 | 761 | return $content; |
| 762 | 762 | } |
| 763 | 763 | } |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | * |
| 151 | 151 | * @param array $menu_args An array of arguments used to setup the menu |
| 152 | 152 | * properties on construct. |
| 153 | - * @param array $required An array of keys that should be in the $menu_args, this |
|
| 153 | + * @param string[] $required An array of keys that should be in the $menu_args, this |
|
| 154 | 154 | * is used to validate that the items that should be defined |
| 155 | 155 | * are present. |
| 156 | 156 | * @return void |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package Event Espresso |
| 16 | 16 | * @subpackage admin |
| 17 | 17 | */ |
| 18 | -abstract class EE_Admin_Page_Menu_Map { |
|
| 18 | +abstract class EE_Admin_Page_Menu_Map { |
|
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -155,28 +155,28 @@ discard block |
||
| 155 | 155 | * are present. |
| 156 | 156 | * @return void |
| 157 | 157 | */ |
| 158 | - public function __construct( $menu_args, $required ) { |
|
| 158 | + public function __construct($menu_args, $required) { |
|
| 159 | 159 | //filter all args before processing so plugins can manipulate various settings for menus. |
| 160 | - $menu_args = apply_filters( 'FHEE__EE_Admin_Page_Menu_Map__construct__menu_args', $menu_args, $required, get_class( $this ) ); |
|
| 160 | + $menu_args = apply_filters('FHEE__EE_Admin_Page_Menu_Map__construct__menu_args', $menu_args, $required, get_class($this)); |
|
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | //verify that required keys are present in the incoming array. |
| 164 | - $missing = array_diff( (array) $required, array_keys( (array) $menu_args ) ); |
|
| 164 | + $missing = array_diff((array) $required, array_keys((array) $menu_args)); |
|
| 165 | 165 | |
| 166 | - if ( !empty( $missing ) ) { |
|
| 167 | - throw new EE_Error( sprintf( __('%s is missing some expected keys in the argument array. The following keys are missing: %s', 'event_espresso'), get_class( $this ), implode(', ', $missing ) ) ); |
|
| 166 | + if ( ! empty($missing)) { |
|
| 167 | + throw new EE_Error(sprintf(__('%s is missing some expected keys in the argument array. The following keys are missing: %s', 'event_espresso'), get_class($this), implode(', ', $missing))); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | //made it here okay, so let's set the properties! |
| 171 | - foreach ( $menu_args as $prop => $value ) { |
|
| 171 | + foreach ($menu_args as $prop => $value) { |
|
| 172 | 172 | |
| 173 | - switch ( $prop ) { |
|
| 173 | + switch ($prop) { |
|
| 174 | 174 | case 'show_on_menu' : |
| 175 | 175 | $value = (int) $value; |
| 176 | 176 | break; |
| 177 | 177 | case 'admin_init_page' : |
| 178 | - if ( in_array( 'admin_init_page', $required ) && ! $value instanceof EE_Admin_Page_Init ) { |
|
| 179 | - throw new EE_Error( sprintf( __('The value for the "admin_init_page" argument must be an instance of an EE_Admin_Page_Init object. Instead %s was given as the value.', 'event_espresso'), print_r($value, TRUE) ) ); |
|
| 178 | + if (in_array('admin_init_page', $required) && ! $value instanceof EE_Admin_Page_Init) { |
|
| 179 | + throw new EE_Error(sprintf(__('The value for the "admin_init_page" argument must be an instance of an EE_Admin_Page_Init object. Instead %s was given as the value.', 'event_espresso'), print_r($value, TRUE))); |
|
| 180 | 180 | } |
| 181 | 181 | break; |
| 182 | 182 | case 'menu_callback' : |
@@ -187,24 +187,24 @@ discard block |
||
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | } |
| 190 | - if ( ! EEH_Class_Tools::has_property( $this, $prop ) ) |
|
| 191 | - throw new EE_Error( sprintf( __('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class( $this ), $prop ) ); |
|
| 190 | + if ( ! EEH_Class_Tools::has_property($this, $prop)) |
|
| 191 | + throw new EE_Error(sprintf(__('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class($this), $prop)); |
|
| 192 | 192 | $this->{$prop} = $value; |
| 193 | 193 | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | //filter capabilities (both static and dynamic) |
| 197 | - $this->capability = apply_filters( 'FHEE_management_capability', $this->capability, NULL ); |
|
| 198 | - $this->capability = apply_filters( 'FHEE_' . $this->menu_slug . '_capability', $this->capability, NULL ); |
|
| 197 | + $this->capability = apply_filters('FHEE_management_capability', $this->capability, NULL); |
|
| 198 | + $this->capability = apply_filters('FHEE_'.$this->menu_slug.'_capability', $this->capability, NULL); |
|
| 199 | 199 | |
| 200 | 200 | //Might need to change parent slug depending on maintenance mode. |
| 201 | - if ( ! empty( $this->maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
| 201 | + if ( ! empty($this->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
| 202 | 202 | $this->parent_slug = $this->maintenance_mode_parent; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | //if empty menu_callback let's set default (but only if we have admin page init object) |
| 206 | - if ( empty( $this->menu_callback ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) |
|
| 207 | - $this->menu_callback = array( $this->admin_init_page, 'initialize_admin_page' ); |
|
| 206 | + if (empty($this->menu_callback) && $this->admin_init_page instanceof EE_Admin_Page_Init) |
|
| 207 | + $this->menu_callback = array($this->admin_init_page, 'initialize_admin_page'); |
|
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | |
@@ -226,21 +226,21 @@ discard block |
||
| 226 | 226 | * @param boolean $network_admin whether this is being added to the network admin page or not |
| 227 | 227 | * @since 4.4.0 |
| 228 | 228 | */ |
| 229 | - public function add_menu_page( $network_admin = FALSE ) { |
|
| 229 | + public function add_menu_page($network_admin = FALSE) { |
|
| 230 | 230 | |
| 231 | 231 | $show_on_menu_int = (int) $this->show_on_menu; |
| 232 | - if( ( $network_admin && in_array( $show_on_menu_int, array( self::BLOG_AND_NETWORK_ADMIN, self::NETWORK_ADMIN_ONLY ), TRUE ) ) |
|
| 232 | + if (($network_admin && in_array($show_on_menu_int, array(self::BLOG_AND_NETWORK_ADMIN, self::NETWORK_ADMIN_ONLY), TRUE)) |
|
| 233 | 233 | || |
| 234 | - ( ! $network_admin && in_array( $show_on_menu_int, array( self::BLOG_AND_NETWORK_ADMIN, self::BLOG_ADMIN_ONLY ), TRUE )) ){ |
|
| 234 | + ( ! $network_admin && in_array($show_on_menu_int, array(self::BLOG_AND_NETWORK_ADMIN, self::BLOG_ADMIN_ONLY), TRUE))) { |
|
| 235 | 235 | $wp_page_slug = $this->_add_menu_page(); |
| 236 | - }else{ |
|
| 236 | + } else { |
|
| 237 | 237 | $wp_page_slug = ''; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if ( !empty( $wp_page_slug ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) { |
|
| 240 | + if ( ! empty($wp_page_slug) && $this->admin_init_page instanceof EE_Admin_Page_Init) { |
|
| 241 | 241 | try { |
| 242 | - $this->admin_init_page->set_page_dependencies( $wp_page_slug ); |
|
| 243 | - } catch( EE_Error $e ) { |
|
| 242 | + $this->admin_init_page->set_page_dependencies($wp_page_slug); |
|
| 243 | + } catch (EE_Error $e) { |
|
| 244 | 244 | $e->get_error(); |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | public $position; |
| 294 | 294 | |
| 295 | 295 | |
| 296 | - public function __construct( $menu_args ) { |
|
| 297 | - $required = array( 'menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page'); |
|
| 296 | + public function __construct($menu_args) { |
|
| 297 | + $required = array('menu_label', 'parent_slug', 'menu_slug', 'menu_group', 'menu_order', 'admin_init_page'); |
|
| 298 | 298 | |
| 299 | - parent::__construct( $menu_args, $required ); |
|
| 299 | + parent::__construct($menu_args, $required); |
|
| 300 | 300 | |
| 301 | - $this->position = ! empty( $this->position ) ? (int) $this->position : $this->position; |
|
| 301 | + $this->position = ! empty($this->position) ? (int) $this->position : $this->position; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | * Uses the proper WP utility for registering a menu page for the main WP pages. |
| 307 | 307 | */ |
| 308 | 308 | protected function _add_menu_page() { |
| 309 | - $main = add_menu_page( $this->title, $this->menu_label, $this->capability, $this->parent_slug, $this->menu_callback, $this->icon_url, $this->position ); |
|
| 310 | - if ( ! empty( $this->subtitle ) ) { |
|
| 311 | - add_submenu_page( $this->parent_slug, $this->subtitle, $this->subtitle, $this->capability, $this->menu_slug, $this->menu_callback ); |
|
| 309 | + $main = add_menu_page($this->title, $this->menu_label, $this->capability, $this->parent_slug, $this->menu_callback, $this->icon_url, $this->position); |
|
| 310 | + if ( ! empty($this->subtitle)) { |
|
| 311 | + add_submenu_page($this->parent_slug, $this->subtitle, $this->subtitle, $this->capability, $this->menu_slug, $this->menu_callback); |
|
| 312 | 312 | } |
| 313 | 313 | return $main; |
| 314 | 314 | } |
@@ -325,13 +325,13 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | class EE_Admin_Page_Sub_Menu extends EE_Admin_Page_Main_Menu { |
| 327 | 327 | |
| 328 | - public function __construct( $menu_args ) { |
|
| 329 | - parent::__construct( $menu_args ); |
|
| 328 | + public function __construct($menu_args) { |
|
| 329 | + parent::__construct($menu_args); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
| 333 | 333 | protected function _add_menu_page() { |
| 334 | - return add_submenu_page( $this->parent_slug, $this->title, $this->menu_label, $this->capability, $this->menu_slug, $this->menu_callback ); |
|
| 334 | + return add_submenu_page($this->parent_slug, $this->title, $this->menu_label, $this->capability, $this->menu_slug, $this->menu_callback); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | } //end class EE_Admin_Page_Menu_Map |
@@ -352,18 +352,18 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | |
| 354 | 354 | |
| 355 | - public function __construct( $menu_args = array() ) { |
|
| 356 | - $required = array( 'menu_label', 'menu_slug', 'menu_order', 'parent_slug' ); |
|
| 357 | - parent::__construct( $menu_args, $required ); |
|
| 355 | + public function __construct($menu_args = array()) { |
|
| 356 | + $required = array('menu_label', 'menu_slug', 'menu_order', 'parent_slug'); |
|
| 357 | + parent::__construct($menu_args, $required); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | |
| 361 | 361 | protected function _add_menu_page() { |
| 362 | - return add_submenu_page( $this->parent_slug, $this->menu_label, $this->_group_link(), $this->capability, $this->menu_slug, '__return_false' ); |
|
| 362 | + return add_submenu_page($this->parent_slug, $this->menu_label, $this->_group_link(), $this->capability, $this->menu_slug, '__return_false'); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | |
| 366 | 366 | private function _group_link() { |
| 367 | - return '<span class="ee_menu_group" onclick="return false;">' . $this->menu_label . '</span>'; |
|
| 367 | + return '<span class="ee_menu_group" onclick="return false;">'.$this->menu_label.'</span>'; |
|
| 368 | 368 | } |
| 369 | 369 | } //end EE_Admin_Page_Menu_Group |
@@ -187,8 +187,9 @@ discard block |
||
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | } |
| 190 | - if ( ! EEH_Class_Tools::has_property( $this, $prop ) ) |
|
| 191 | - throw new EE_Error( sprintf( __('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class( $this ), $prop ) ); |
|
| 190 | + if ( ! EEH_Class_Tools::has_property( $this, $prop ) ) { |
|
| 191 | + throw new EE_Error( sprintf( __('The $menu_args coming into %s has a index key (%s) representing a property that is not defined by the class. Perhaps there is a typo?', 'event_espresso'), get_class( $this ), $prop ) ); |
|
| 192 | + } |
|
| 192 | 193 | $this->{$prop} = $value; |
| 193 | 194 | |
| 194 | 195 | } |
@@ -203,8 +204,9 @@ discard block |
||
| 203 | 204 | } |
| 204 | 205 | |
| 205 | 206 | //if empty menu_callback let's set default (but only if we have admin page init object) |
| 206 | - if ( empty( $this->menu_callback ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) |
|
| 207 | - $this->menu_callback = array( $this->admin_init_page, 'initialize_admin_page' ); |
|
| 207 | + if ( empty( $this->menu_callback ) && $this->admin_init_page instanceof EE_Admin_Page_Init ) { |
|
| 208 | + $this->menu_callback = array( $this->admin_init_page, 'initialize_admin_page' ); |
|
| 209 | + } |
|
| 208 | 210 | |
| 209 | 211 | } |
| 210 | 212 | |
@@ -233,7 +235,7 @@ discard block |
||
| 233 | 235 | || |
| 234 | 236 | ( ! $network_admin && in_array( $show_on_menu_int, array( self::BLOG_AND_NETWORK_ADMIN, self::BLOG_ADMIN_ONLY ), TRUE )) ){ |
| 235 | 237 | $wp_page_slug = $this->_add_menu_page(); |
| 236 | - }else{ |
|
| 238 | + } else{ |
|
| 237 | 239 | $wp_page_slug = ''; |
| 238 | 240 | } |
| 239 | 241 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | * |
| 112 | 112 | * @access public |
| 113 | 113 | * @param boolean $caf used to indicate if this tour is happening on caf install or not. |
| 114 | - * @return void |
|
| 114 | + * @return EE_Help_Tour |
|
| 115 | 115 | */ |
| 116 | 116 | public function __construct($caf = FALSE) { |
| 117 | 117 | $this->_is_caf = $caf; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function __construct($caf = FALSE) { |
| 117 | 117 | $this->_is_caf = $caf; |
| 118 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
| 118 | + $this->_req_data = array_merge($_GET, $_POST); |
|
| 119 | 119 | $this->_set_tour_properties(); |
| 120 | 120 | $this->_set_tour_stops(); |
| 121 | 121 | $this->_set_tour_options(); |
@@ -158,36 +158,36 @@ discard block |
||
| 158 | 158 | * @access protected |
| 159 | 159 | * @return void |
| 160 | 160 | */ |
| 161 | - protected function _set_tour_options( $options = array() ) { |
|
| 161 | + protected function _set_tour_options($options = array()) { |
|
| 162 | 162 | $defaults = array( |
| 163 | - 'tipLocation' => 'bottom', // 'top', 'bottom', 'right', 'left' in relation to parent |
|
| 164 | - 'nubPosition' => 'auto', // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
| 165 | - 'tipAdjustmentY' => 0, //allow for adjustment of tip |
|
| 166 | - 'tipAdjustmentX' => 0, //allow for adjustment of tip |
|
| 163 | + 'tipLocation' => 'bottom', // 'top', 'bottom', 'right', 'left' in relation to parent |
|
| 164 | + 'nubPosition' => 'auto', // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left" |
|
| 165 | + 'tipAdjustmentY' => 0, //allow for adjustment of tip |
|
| 166 | + 'tipAdjustmentX' => 0, //allow for adjustment of tip |
|
| 167 | 167 | 'scroll' => true, //whether to scrollTo the next step or not |
| 168 | - 'scrollSpeed' => 300, // Page scrolling speed in ms |
|
| 169 | - 'timer' => 0, // 0 = off, all other numbers = time(ms) |
|
| 170 | - 'autoStart' => true, // true or false - false tour starts when restart called |
|
| 171 | - 'startTimerOnClick' => true, // true/false to start timer on first click |
|
| 172 | - 'nextButton' => true, // true/false for next button visibility |
|
| 168 | + 'scrollSpeed' => 300, // Page scrolling speed in ms |
|
| 169 | + 'timer' => 0, // 0 = off, all other numbers = time(ms) |
|
| 170 | + 'autoStart' => true, // true or false - false tour starts when restart called |
|
| 171 | + 'startTimerOnClick' => true, // true/false to start timer on first click |
|
| 172 | + 'nextButton' => true, // true/false for next button visibility |
|
| 173 | 173 | 'button_text' => __('Next', 'event_espresso'), |
| 174 | - 'tipAnimation' => 'fade', // 'pop' or 'fade' in each tip |
|
| 175 | - 'pauseAfter' => array(), // array of indexes where to pause the tour after |
|
| 176 | - 'tipAnimationFadeSpeed' => 300, // if 'fade'- speed in ms of transition |
|
| 177 | - 'cookieMonster' => true, // true/false for whether cookies are used |
|
| 178 | - 'cookieName' => $this->get_slug(), // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
| 179 | - 'cookieDomain' => false, // set to false or yoursite.com |
|
| 174 | + 'tipAnimation' => 'fade', // 'pop' or 'fade' in each tip |
|
| 175 | + 'pauseAfter' => array(), // array of indexes where to pause the tour after |
|
| 176 | + 'tipAnimationFadeSpeed' => 300, // if 'fade'- speed in ms of transition |
|
| 177 | + 'cookieMonster' => true, // true/false for whether cookies are used |
|
| 178 | + 'cookieName' => $this->get_slug(), // choose your own cookie name (setup will add the prefix for the specific page joyride) |
|
| 179 | + 'cookieDomain' => false, // set to false or yoursite.com |
|
| 180 | 180 | //'tipContainer' => 'body', // Where the tip be attached if not inline |
| 181 | - 'modal' => false, // Whether to cover page with modal during the tour |
|
| 182 | - 'expose' => false, // Whether to expose the elements at each step in the tour (requires modal:true), |
|
| 183 | - 'postExposeCallback' => 'EEHelpTour.postExposeCallback', // A method to call after an element has been exposed |
|
| 184 | - 'preRideCallback' => 'EEHelpTour_preRideCallback', // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
| 185 | - 'postRideCallback' => 'EEHelpTour_postRideCallback', // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
| 186 | - 'preStepCallback' => 'EEHelpTour_preStepCallback', // A method to call before each step |
|
| 187 | - 'postStepCallback' => 'EEHelpTour_postStepCallback', // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
| 181 | + 'modal' => false, // Whether to cover page with modal during the tour |
|
| 182 | + 'expose' => false, // Whether to expose the elements at each step in the tour (requires modal:true), |
|
| 183 | + 'postExposeCallback' => 'EEHelpTour.postExposeCallback', // A method to call after an element has been exposed |
|
| 184 | + 'preRideCallback' => 'EEHelpTour_preRideCallback', // A method to call before the tour starts (passed index, tip, and cloned exposed element) |
|
| 185 | + 'postRideCallback' => 'EEHelpTour_postRideCallback', // a method to call once the tour closes. This will correspond to the name of a js method that will have to be defined in loaded js. |
|
| 186 | + 'preStepCallback' => 'EEHelpTour_preStepCallback', // A method to call before each step |
|
| 187 | + 'postStepCallback' => 'EEHelpTour_postStepCallback', // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/ |
|
| 188 | 188 | ); |
| 189 | 189 | |
| 190 | - $options = !empty( $options ) && is_array($options) ? array_merge( $defaults, $options ) : $defaults; |
|
| 190 | + $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults; |
|
| 191 | 191 | $this->_options = $options; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | * @return string slug for the tour |
| 203 | 203 | */ |
| 204 | 204 | public function get_slug() { |
| 205 | - if ( empty( $this->_slug ) ) |
|
| 206 | - throw new EE_Error( sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
| 205 | + if (empty($this->_slug)) |
|
| 206 | + throw new EE_Error(sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this))); |
|
| 207 | 207 | return $this->_slug; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | * @return string |
| 216 | 216 | */ |
| 217 | 217 | public function get_label() { |
| 218 | - if ( empty( $this->_label ) ) |
|
| 219 | - throw new EE_Error( sprintf( __('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
| 218 | + if (empty($this->_label)) |
|
| 219 | + throw new EE_Error(sprintf(__('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this))); |
|
| 220 | 220 | return $this->_label; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -227,8 +227,8 @@ discard block |
||
| 227 | 227 | * @return array |
| 228 | 228 | */ |
| 229 | 229 | public function get_stops() { |
| 230 | - foreach( $this->_stops as $ind => $stop ) { |
|
| 231 | - if ( ! isset( $stop['button_text'] ) ) { |
|
| 230 | + foreach ($this->_stops as $ind => $stop) { |
|
| 231 | + if ( ! isset($stop['button_text'])) { |
|
| 232 | 232 | $this->_stops[$ind]['button_text'] = $this->_options['button_text']; |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function get_options() { |
| 245 | 245 | //let's make sure there are not pauses set |
| 246 | - foreach ( $this->_stops as $ind => $stop ) { |
|
| 247 | - if ( isset( $stop['pause_after'] ) && $stop['pause_after'] ) { |
|
| 246 | + foreach ($this->_stops as $ind => $stop) { |
|
| 247 | + if (isset($stop['pause_after']) && $stop['pause_after']) { |
|
| 248 | 248 | $this->_options['pauseAfter'][] = $ind; |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | - return apply_filters( 'FHEE__' . get_class($this) . '__get_options', $this->_options, $this ); |
|
| 251 | + return apply_filters('FHEE__'.get_class($this).'__get_options', $this->_options, $this); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | } |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -202,8 +203,9 @@ discard block |
||
| 202 | 203 | * @return string slug for the tour |
| 203 | 204 | */ |
| 204 | 205 | public function get_slug() { |
| 205 | - if ( empty( $this->_slug ) ) |
|
| 206 | - throw new EE_Error( sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
| 206 | + if ( empty( $this->_slug ) ) { |
|
| 207 | + throw new EE_Error( sprintf(__('There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
| 208 | + } |
|
| 207 | 209 | return $this->_slug; |
| 208 | 210 | } |
| 209 | 211 | |
@@ -215,8 +217,9 @@ discard block |
||
| 215 | 217 | * @return string |
| 216 | 218 | */ |
| 217 | 219 | public function get_label() { |
| 218 | - if ( empty( $this->_label ) ) |
|
| 219 | - throw new EE_Error( sprintf( __('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
| 220 | + if ( empty( $this->_label ) ) { |
|
| 221 | + throw new EE_Error( sprintf( __('There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor', 'event_espresso'), get_class($this) ) ); |
|
| 222 | + } |
|
| 220 | 223 | return $this->_label; |
| 221 | 224 | } |
| 222 | 225 | |
@@ -161,6 +161,7 @@ |
||
| 161 | 161 | * |
| 162 | 162 | * @param int $att_nmbr |
| 163 | 163 | * @param EE_Line_Item | string $item |
| 164 | + * @param EE_Line_Item $item |
|
| 164 | 165 | * @return string |
| 165 | 166 | */ |
| 166 | 167 | public function generate_reg_url_link( $att_nmbr, $item ) { |
@@ -742,11 +742,11 @@ |
||
| 742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
| 743 | 743 | if( $pm instanceof EE_Payment_Method ){ |
| 744 | 744 | return $pm; |
| 745 | - }else{ |
|
| 745 | + } else{ |
|
| 746 | 746 | $last_payment = $this->last_payment(); |
| 747 | 747 | if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
| 748 | 748 | return $last_payment->payment_method(); |
| 749 | - }else{ |
|
| 749 | + } else{ |
|
| 750 | 750 | return NULL; |
| 751 | 751 | } |
| 752 | 752 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
| 2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Class EE_Registration_Processor |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public static function instance() { |
| 62 | 62 | // check if class object is instantiated |
| 63 | - if ( ! self::$_instance instanceof EE_Registration_Processor ) { |
|
| 63 | + if ( ! self::$_instance instanceof EE_Registration_Processor) { |
|
| 64 | 64 | self::$_instance = new self(); |
| 65 | 65 | } |
| 66 | 66 | return self::$_instance; |
@@ -96,37 +96,37 @@ discard block |
||
| 96 | 96 | * @return \EE_Registration | null |
| 97 | 97 | * @throws \EE_Error |
| 98 | 98 | */ |
| 99 | - public function generate_ONE_registration_from_line_item( EE_Line_Item $line_item, EE_Transaction $transaction, $att_nmbr = 1, $total_ticket_count = 1 ) { |
|
| 99 | + public function generate_ONE_registration_from_line_item(EE_Line_Item $line_item, EE_Transaction $transaction, $att_nmbr = 1, $total_ticket_count = 1) { |
|
| 100 | 100 | // grab the related ticket object for this line_item |
| 101 | 101 | $ticket = $line_item->ticket(); |
| 102 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
| 103 | - EE_Error::add_error( sprintf( __( "Line item %s did not contain a valid ticket", "event_espresso" ), $line_item->ID() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 102 | + if ( ! $ticket instanceof EE_Ticket) { |
|
| 103 | + EE_Error::add_error(sprintf(__("Line item %s did not contain a valid ticket", "event_espresso"), $line_item->ID()), __FILE__, __FUNCTION__, __LINE__); |
|
| 104 | 104 | return null; |
| 105 | 105 | } |
| 106 | - $first_datetime = $ticket->get_first_related( 'Datetime' ); |
|
| 107 | - if ( ! $first_datetime instanceof EE_Datetime ) { |
|
| 108 | - EE_Error::add_error( sprintf( __( "The ticket (%s) is not associated with any valid datetimes.", "event_espresso" ), $ticket->name() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 106 | + $first_datetime = $ticket->get_first_related('Datetime'); |
|
| 107 | + if ( ! $first_datetime instanceof EE_Datetime) { |
|
| 108 | + EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__); |
|
| 109 | 109 | return null; |
| 110 | 110 | } |
| 111 | - $event = $first_datetime->get_first_related( 'Event' ); |
|
| 112 | - if ( ! $event instanceof EE_Event ) { |
|
| 113 | - EE_Error::add_error( sprintf( __( "The ticket (%s) is not associated with a valid event.", "event_espresso" ), $ticket->name() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 111 | + $event = $first_datetime->get_first_related('Event'); |
|
| 112 | + if ( ! $event instanceof EE_Event) { |
|
| 113 | + EE_Error::add_error(sprintf(__("The ticket (%s) is not associated with a valid event.", "event_espresso"), $ticket->name()), __FILE__, __FUNCTION__, __LINE__); |
|
| 114 | 114 | return null; |
| 115 | 115 | } |
| 116 | - $reg_url_link = $this->generate_reg_url_link( $att_nmbr, $line_item ); |
|
| 116 | + $reg_url_link = $this->generate_reg_url_link($att_nmbr, $line_item); |
|
| 117 | 117 | |
| 118 | - if( $this->_reg_final_price_per_tkt_line_item === null ) { |
|
| 119 | - $this->_reg_final_price_per_tkt_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() ); |
|
| 118 | + if ($this->_reg_final_price_per_tkt_line_item === null) { |
|
| 119 | + $this->_reg_final_price_per_tkt_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item()); |
|
| 120 | 120 | } |
| 121 | 121 | //ok now find this new registration's final price |
| 122 | - if( isset( $this->_reg_final_price_per_tkt_line_item[ $line_item->ID() ] ) ) { |
|
| 123 | - $final_price = $this->_reg_final_price_per_tkt_line_item[ $line_item->ID() ] ; |
|
| 124 | - }else{ |
|
| 125 | - $message = sprintf( __( 'The ticket line item (ID:%1$d) had no entry in the reg_final_price_per_tkt_line_item array.', 'event_espresso' ), $line_item->ID() ); |
|
| 126 | - if( WP_DEBUG ){ |
|
| 127 | - throw new EE_Error( $message ); |
|
| 128 | - }else{ |
|
| 129 | - EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message ); |
|
| 122 | + if (isset($this->_reg_final_price_per_tkt_line_item[$line_item->ID()])) { |
|
| 123 | + $final_price = $this->_reg_final_price_per_tkt_line_item[$line_item->ID()]; |
|
| 124 | + } else { |
|
| 125 | + $message = sprintf(__('The ticket line item (ID:%1$d) had no entry in the reg_final_price_per_tkt_line_item array.', 'event_espresso'), $line_item->ID()); |
|
| 126 | + if (WP_DEBUG) { |
|
| 127 | + throw new EE_Error($message); |
|
| 128 | + } else { |
|
| 129 | + EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message); |
|
| 130 | 130 | } |
| 131 | 131 | $final_price = $ticket->get_ticket_total_with_taxes(); |
| 132 | 132 | |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | 'REG_url_link' => $reg_url_link |
| 147 | 147 | ) |
| 148 | 148 | ); |
| 149 | - $registration->set_reg_code( $this->generate_reg_code( $registration ) ); |
|
| 149 | + $registration->set_reg_code($this->generate_reg_code($registration)); |
|
| 150 | 150 | $registration->save(); |
| 151 | - $registration->_add_relation_to( $event, 'Event', array(), $event->ID() ); |
|
| 152 | - $registration->_add_relation_to( $line_item->ticket(), 'Ticket', array(), $line_item->ticket()->ID() ); |
|
| 153 | - $transaction->_add_relation_to( $registration, 'Registration' ); |
|
| 151 | + $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
| 152 | + $registration->_add_relation_to($line_item->ticket(), 'Ticket', array(), $line_item->ticket()->ID()); |
|
| 153 | + $transaction->_add_relation_to($registration, 'Registration'); |
|
| 154 | 154 | return $registration; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | * @param EE_Line_Item | string $item |
| 164 | 164 | * @return string |
| 165 | 165 | */ |
| 166 | - public function generate_reg_url_link( $att_nmbr, $item ) { |
|
| 166 | + public function generate_reg_url_link($att_nmbr, $item) { |
|
| 167 | 167 | $reg_url_link = $item instanceof EE_Line_Item ? $item->code() : $item; |
| 168 | - $reg_url_link = $att_nmbr . '-' . md5( $reg_url_link . microtime() ); |
|
| 168 | + $reg_url_link = $att_nmbr.'-'.md5($reg_url_link.microtime()); |
|
| 169 | 169 | return $reg_url_link; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -177,18 +177,18 @@ discard block |
||
| 177 | 177 | * @param \EE_Registration $registration |
| 178 | 178 | * @return string |
| 179 | 179 | */ |
| 180 | - public function generate_reg_code( EE_Registration $registration ) { |
|
| 180 | + public function generate_reg_code(EE_Registration $registration) { |
|
| 181 | 181 | // figure out where to start parsing the reg code |
| 182 | - $chars = strpos( $registration->reg_url_link(), '-' ) + 5; |
|
| 182 | + $chars = strpos($registration->reg_url_link(), '-') + 5; |
|
| 183 | 183 | // TXN_ID + TKT_ID + first 3 and last 3 chars of reg_url_link |
| 184 | 184 | $new_reg_code = array( |
| 185 | 185 | $registration->transaction_ID(), |
| 186 | 186 | $registration->ticket_ID(), |
| 187 | - substr( $registration->reg_url_link(), 0, $chars ) |
|
| 187 | + substr($registration->reg_url_link(), 0, $chars) |
|
| 188 | 188 | ); |
| 189 | 189 | // now put it all together |
| 190 | - $new_reg_code = implode( '-', $new_reg_code ); |
|
| 191 | - return apply_filters( 'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', $new_reg_code, $registration ); |
|
| 190 | + $new_reg_code = implode('-', $new_reg_code); |
|
| 191 | + return apply_filters('FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', $new_reg_code, $registration); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | * @param int $REG_ID |
| 198 | 198 | * @return string |
| 199 | 199 | */ |
| 200 | - public function old_reg_status( $REG_ID ) { |
|
| 201 | - return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null; |
|
| 200 | + public function old_reg_status($REG_ID) { |
|
| 201 | + return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | * @param int $REG_ID |
| 208 | 208 | * @param string $old_reg_status |
| 209 | 209 | */ |
| 210 | - public function set_old_reg_status( $REG_ID, $old_reg_status ) { |
|
| 210 | + public function set_old_reg_status($REG_ID, $old_reg_status) { |
|
| 211 | 211 | // only set the first time |
| 212 | - if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) { |
|
| 213 | - $this->_old_reg_status[ $REG_ID ] = $old_reg_status; |
|
| 212 | + if ( ! isset($this->_old_reg_status[$REG_ID])) { |
|
| 213 | + $this->_old_reg_status[$REG_ID] = $old_reg_status; |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | * @param int $REG_ID |
| 221 | 221 | * @return string |
| 222 | 222 | */ |
| 223 | - public function new_reg_status( $REG_ID ) { |
|
| 224 | - return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null; |
|
| 223 | + public function new_reg_status($REG_ID) { |
|
| 224 | + return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | * @param int $REG_ID |
| 231 | 231 | * @param string $new_reg_status |
| 232 | 232 | */ |
| 233 | - public function set_new_reg_status( $REG_ID, $new_reg_status ) { |
|
| 234 | - $this->_new_reg_status[ $REG_ID ] = $new_reg_status; |
|
| 233 | + public function set_new_reg_status($REG_ID, $new_reg_status) { |
|
| 234 | + $this->_new_reg_status[$REG_ID] = $new_reg_status; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | * @param int $REG_ID |
| 243 | 243 | * @return bool |
| 244 | 244 | */ |
| 245 | - public function reg_status_updated( $REG_ID ) { |
|
| 246 | - return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false; |
|
| 245 | + public function reg_status_updated($REG_ID) { |
|
| 246 | + return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
@@ -257,19 +257,19 @@ discard block |
||
| 257 | 257 | * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code |
| 258 | 258 | * @return boolean |
| 259 | 259 | */ |
| 260 | - public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) { |
|
| 260 | + public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) { |
|
| 261 | 261 | // set initial REG_Status |
| 262 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 262 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 263 | 263 | // set incoming REG_Status |
| 264 | - $this->set_new_reg_status( $registration->ID(), $new_reg_status ); |
|
| 264 | + $this->set_new_reg_status($registration->ID(), $new_reg_status); |
|
| 265 | 265 | // toggle reg status but only if it has changed and the user can do so |
| 266 | 266 | if ( |
| 267 | - $this->reg_status_updated( $registration->ID() ) && |
|
| 268 | - EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registration', 'toggle_registration_status', $registration->ID() ) |
|
| 267 | + $this->reg_status_updated($registration->ID()) && |
|
| 268 | + EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'toggle_registration_status', $registration->ID()) |
|
| 269 | 269 | ) { |
| 270 | 270 | // change status to new value |
| 271 | - if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) )) { |
|
| 272 | - if ( $save ) { |
|
| 271 | + if ($registration->set_status($this->new_reg_status($registration->ID()))) { |
|
| 272 | + if ($save) { |
|
| 273 | 273 | $registration->save(); |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -290,27 +290,27 @@ discard block |
||
| 290 | 290 | * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code |
| 291 | 291 | * @return void |
| 292 | 292 | */ |
| 293 | - public function toggle_incomplete_registration_status_to_default( EE_Registration $registration, $save = TRUE ) { |
|
| 293 | + public function toggle_incomplete_registration_status_to_default(EE_Registration $registration, $save = TRUE) { |
|
| 294 | 294 | // set initial REG_Status |
| 295 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 295 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 296 | 296 | // is the registration currently incomplete ? |
| 297 | - if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) { |
|
| 297 | + if ($registration->status_ID() === EEM_Registration::status_id_incomplete) { |
|
| 298 | 298 | // grab default reg status for the event, if set |
| 299 | 299 | $event_default_registration_status = $registration->event()->default_registration_status(); |
| 300 | 300 | // if no default reg status is set for the event, then use the global value |
| 301 | - $STS_ID = ! empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
| 301 | + $STS_ID = ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
| 302 | 302 | // if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered |
| 303 | 303 | $STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID; |
| 304 | 304 | // set incoming REG_Status |
| 305 | - $this->set_new_reg_status( $registration->ID(), $STS_ID ); |
|
| 306 | - $registration->set_status( $STS_ID ); |
|
| 307 | - if ( $save ) { |
|
| 305 | + $this->set_new_reg_status($registration->ID(), $STS_ID); |
|
| 306 | + $registration->set_status($STS_ID); |
|
| 307 | + if ($save) { |
|
| 308 | 308 | $registration->save(); |
| 309 | 309 | } |
| 310 | 310 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
| 311 | - if ( ! EE_Processor_Base::$IPN ) { |
|
| 311 | + if ( ! EE_Processor_Base::$IPN) { |
|
| 312 | 312 | // otherwise, send out notifications |
| 313 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
| 313 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 314 | 314 | } |
| 315 | 315 | // DEBUG LOG |
| 316 | 316 | //$this->log( |
@@ -334,25 +334,25 @@ discard block |
||
| 334 | 334 | * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code |
| 335 | 335 | * @return boolean |
| 336 | 336 | */ |
| 337 | - public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) { |
|
| 337 | + public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) { |
|
| 338 | 338 | // set initial REG_Status |
| 339 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 339 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 340 | 340 | // if not already, toggle reg status to approved IF the event default reg status is approved |
| 341 | 341 | if ( |
| 342 | 342 | $registration->status_ID() !== EEM_Registration::status_id_approved && |
| 343 | 343 | $registration->event()->default_registration_status() == EEM_Registration::status_id_approved |
| 344 | 344 | ) { |
| 345 | 345 | // set incoming REG_Status |
| 346 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
| 346 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
| 347 | 347 | // toggle status to approved |
| 348 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
| 349 | - if ( $save ) { |
|
| 348 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
| 349 | + if ($save) { |
|
| 350 | 350 | $registration->save(); |
| 351 | 351 | } |
| 352 | 352 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
| 353 | - if ( ! EE_Processor_Base::$IPN ) { |
|
| 353 | + if ( ! EE_Processor_Base::$IPN) { |
|
| 354 | 354 | // otherwise, send out notifications |
| 355 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
| 355 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 356 | 356 | } |
| 357 | 357 | // DEBUG LOG |
| 358 | 358 | //$this->log( |
@@ -380,19 +380,19 @@ discard block |
||
| 380 | 380 | * @return bool |
| 381 | 381 | * @throws \EE_Error |
| 382 | 382 | */ |
| 383 | - public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE, $additional_details = array() ) { |
|
| 383 | + public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE, $additional_details = array()) { |
|
| 384 | 384 | // set initial REG_Status |
| 385 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 385 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 386 | 386 | //EEH_Debug_Tools::printr( $additional_details, '$additional_details', __FILE__, __LINE__ ); |
| 387 | 387 | // was a payment just made ? |
| 388 | 388 | if ( |
| 389 | - isset( $additional_details[ 'payment_updates' ], $additional_details[ 'last_payment' ] ) && |
|
| 390 | - $additional_details[ 'payment_updates' ] && |
|
| 391 | - $additional_details[ 'last_payment' ] instanceof EE_Payment |
|
| 389 | + isset($additional_details['payment_updates'], $additional_details['last_payment']) && |
|
| 390 | + $additional_details['payment_updates'] && |
|
| 391 | + $additional_details['last_payment'] instanceof EE_Payment |
|
| 392 | 392 | ) { |
| 393 | - $payment = $additional_details[ 'last_payment' ]; |
|
| 393 | + $payment = $additional_details['last_payment']; |
|
| 394 | 394 | $total_paid = 0; |
| 395 | - foreach ( self::$_amount_paid as $reg => $amount_paid ) { |
|
| 395 | + foreach (self::$_amount_paid as $reg => $amount_paid) { |
|
| 396 | 396 | $total_paid += $amount_paid; |
| 397 | 397 | } |
| 398 | 398 | } else { |
@@ -416,30 +416,30 @@ discard block |
||
| 416 | 416 | $registration->transaction()->is_completed() || |
| 417 | 417 | $registration->transaction()->is_overpaid() || |
| 418 | 418 | $registration->transaction()->is_free() || |
| 419 | - apply_filters( 'FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration ) |
|
| 419 | + apply_filters('FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration) |
|
| 420 | 420 | ) || ( |
| 421 | 421 | $payment instanceof EE_Payment && |
| 422 | 422 | $payment->is_approved() && |
| 423 | 423 | // this specific registration has not yet been paid for |
| 424 | - ! isset( self::$_amount_paid[ $registration->ID() ] ) && |
|
| 424 | + ! isset(self::$_amount_paid[$registration->ID()]) && |
|
| 425 | 425 | // payment amount, less what we have already attributed to other registrations, is greater than this reg's final price |
| 426 | 426 | $payment->amount() - $total_paid >= $registration->final_price() |
| 427 | 427 | ) |
| 428 | 428 | ) |
| 429 | 429 | ) { |
| 430 | 430 | // mark as paid |
| 431 | - self::$_amount_paid[ $registration->ID() ] = $registration->final_price(); |
|
| 431 | + self::$_amount_paid[$registration->ID()] = $registration->final_price(); |
|
| 432 | 432 | // track new REG_Status |
| 433 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
| 433 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
| 434 | 434 | // toggle status to approved |
| 435 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
| 436 | - if ( $save ) { |
|
| 435 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
| 436 | + if ($save) { |
|
| 437 | 437 | $registration->save(); |
| 438 | 438 | } |
| 439 | 439 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
| 440 | - if ( ! EE_Processor_Base::$IPN ) { |
|
| 440 | + if ( ! EE_Processor_Base::$IPN) { |
|
| 441 | 441 | // otherwise, send out notifications |
| 442 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
| 442 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 443 | 443 | } |
| 444 | 444 | // DEBUG LOG |
| 445 | 445 | //$this->log( |
@@ -465,27 +465,27 @@ discard block |
||
| 465 | 465 | * @param array $additional_details |
| 466 | 466 | * @return void |
| 467 | 467 | */ |
| 468 | - public function trigger_registration_update_notifications( $registration, $additional_details = array() ) { |
|
| 468 | + public function trigger_registration_update_notifications($registration, $additional_details = array()) { |
|
| 469 | 469 | try { |
| 470 | - if ( ! $registration instanceof EE_Registration ) { |
|
| 471 | - throw new EE_Error( __( 'An invalid registration was received.', 'event_espresso' ) ); |
|
| 470 | + if ( ! $registration instanceof EE_Registration) { |
|
| 471 | + throw new EE_Error(__('An invalid registration was received.', 'event_espresso')); |
|
| 472 | 472 | } |
| 473 | - EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
|
| 473 | + EE_Registry::instance()->load_helper('Debug_Tools'); |
|
| 474 | 474 | EEH_Debug_Tools::log( |
| 475 | 475 | __CLASS__, |
| 476 | 476 | __FUNCTION__, |
| 477 | 477 | __LINE__, |
| 478 | - array( $registration->transaction(), $additional_details ), |
|
| 478 | + array($registration->transaction(), $additional_details), |
|
| 479 | 479 | false, |
| 480 | - 'EE_Transaction: ' . $registration->transaction()->ID() |
|
| 480 | + 'EE_Transaction: '.$registration->transaction()->ID() |
|
| 481 | 481 | ); |
| 482 | 482 | do_action( |
| 483 | 483 | 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', |
| 484 | 484 | $registration, |
| 485 | 485 | $additional_details |
| 486 | 486 | ); |
| 487 | - } catch( Exception $e ) { |
|
| 488 | - EE_Error::add_error( $e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine() ); |
|
| 487 | + } catch (Exception $e) { |
|
| 488 | + EE_Error::add_error($e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine()); |
|
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | |
@@ -498,22 +498,22 @@ discard block |
||
| 498 | 498 | * @param array $additional_details |
| 499 | 499 | * @return bool |
| 500 | 500 | */ |
| 501 | - public function update_registration_after_checkout_or_payment( EE_Registration $registration, $additional_details = array() ) { |
|
| 501 | + public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) { |
|
| 502 | 502 | // set initial REG_Status |
| 503 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 503 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 504 | 504 | |
| 505 | 505 | // if the registration status gets updated, then save the registration |
| 506 | 506 | if ( |
| 507 | - $this->toggle_registration_status_for_default_approved_events( $registration, false ) |
|
| 508 | - || $this->toggle_registration_status_if_no_monies_owing( $registration, false, $additional_details ) |
|
| 507 | + $this->toggle_registration_status_for_default_approved_events($registration, false) |
|
| 508 | + || $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details) |
|
| 509 | 509 | ) { |
| 510 | 510 | $registration->save(); |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | // set new REG_Status |
| 514 | - $this->set_new_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 515 | - return $this->reg_status_updated( $registration->ID() ) |
|
| 516 | - && $this->new_reg_status( $registration->ID() ) == EEM_Registration::status_id_approved |
|
| 514 | + $this->set_new_reg_status($registration->ID(), $registration->status_ID()); |
|
| 515 | + return $this->reg_status_updated($registration->ID()) |
|
| 516 | + && $this->new_reg_status($registration->ID()) == EEM_Registration::status_id_approved |
|
| 517 | 517 | ? true |
| 518 | 518 | : false; |
| 519 | 519 | } |
@@ -527,19 +527,19 @@ discard block |
||
| 527 | 527 | * @param boolean $save_regs whether to immediately save registrations in this function or not |
| 528 | 528 | * @return void |
| 529 | 529 | */ |
| 530 | - public function update_registration_final_prices( $transaction, $save_regs = true ) { |
|
| 531 | - $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() ); |
|
| 532 | - foreach( $transaction->registrations() as $registration ) { |
|
| 533 | - $line_item = EEM_Line_Item::instance()->get_line_item_for_registration( $registration ); |
|
| 534 | - if( isset( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ) ) { |
|
| 535 | - $registration->set_final_price( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ); |
|
| 536 | - if( $save_regs ) { |
|
| 530 | + public function update_registration_final_prices($transaction, $save_regs = true) { |
|
| 531 | + $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item()); |
|
| 532 | + foreach ($transaction->registrations() as $registration) { |
|
| 533 | + $line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration); |
|
| 534 | + if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) { |
|
| 535 | + $registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]); |
|
| 536 | + if ($save_regs) { |
|
| 537 | 537 | $registration->save(); |
| 538 | 538 | } |
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | //and make sure there's no rounding problem |
| 542 | - $this->fix_reg_final_price_rounding_issue( $transaction ); |
|
| 542 | + $this->fix_reg_final_price_rounding_issue($transaction); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | * @param EE_Transaction $transaction |
| 558 | 558 | * @return boolean success verifying that there is NO difference after this method is done |
| 559 | 559 | */ |
| 560 | - public function fix_reg_final_price_rounding_issue( $transaction ) { |
|
| 560 | + public function fix_reg_final_price_rounding_issue($transaction) { |
|
| 561 | 561 | $reg_final_price_sum = EEM_Registration::instance()->sum( |
| 562 | 562 | array( |
| 563 | 563 | array( |
@@ -566,9 +566,9 @@ discard block |
||
| 566 | 566 | ), |
| 567 | 567 | 'REG_final_price' |
| 568 | 568 | ); |
| 569 | - $diff = $transaction->total() - floatval( $reg_final_price_sum ); |
|
| 569 | + $diff = $transaction->total() - floatval($reg_final_price_sum); |
|
| 570 | 570 | //ok then, just grab one of the registrations |
| 571 | - if( $diff != 0 ) { |
|
| 571 | + if ($diff != 0) { |
|
| 572 | 572 | $a_reg = EEM_Registration::instance()->get_one( |
| 573 | 573 | array( |
| 574 | 574 | array( |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | )); |
| 578 | 578 | $success = $a_reg instanceof EE_Registration ? $a_reg->save( |
| 579 | 579 | array( |
| 580 | - 'REG_final_price' => ( $a_reg->final_price() + $diff ) |
|
| 580 | + 'REG_final_price' => ($a_reg->final_price() + $diff) |
|
| 581 | 581 | ) |
| 582 | 582 | ) : false; |
| 583 | 583 | return $success ? true : false; |
@@ -602,13 +602,13 @@ discard block |
||
| 602 | 602 | $update_reg = true |
| 603 | 603 | ) { |
| 604 | 604 | // these reg statuses should not be considered in any calculations involving monies owing |
| 605 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
| 605 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
| 606 | 606 | : EEM_Registration::closed_reg_statuses(); |
| 607 | - if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
| 607 | + if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
| 608 | 608 | return false; |
| 609 | 609 | } |
| 610 | 610 | $registration->set_final_price(0); |
| 611 | - if ( $update_reg ) { |
|
| 611 | + if ($update_reg) { |
|
| 612 | 612 | $registration->save(); |
| 613 | 613 | } |
| 614 | 614 | return true; |
@@ -631,23 +631,23 @@ discard block |
||
| 631 | 631 | $update_reg = true |
| 632 | 632 | ) { |
| 633 | 633 | // these reg statuses should not be considered in any calculations involving monies owing |
| 634 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
| 634 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
| 635 | 635 | : EEM_Registration::closed_reg_statuses(); |
| 636 | - if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
| 636 | + if (in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
| 637 | 637 | return false; |
| 638 | 638 | } |
| 639 | 639 | $ticket = $registration->ticket(); |
| 640 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
| 640 | + if ( ! $ticket instanceof EE_Ticket) { |
|
| 641 | 641 | throw new EE_Error( |
| 642 | 642 | sprintf( |
| 643 | - __( 'The Ticket for Registration %1$d was not found or is invalid.', |
|
| 644 | - 'event_espresso' ), |
|
| 643 | + __('The Ticket for Registration %1$d was not found or is invalid.', |
|
| 644 | + 'event_espresso'), |
|
| 645 | 645 | $registration->ticket_ID() |
| 646 | 646 | ) |
| 647 | 647 | ); |
| 648 | 648 | } |
| 649 | - $registration->set_final_price( $ticket->price() ); |
|
| 650 | - if ( $update_reg ) { |
|
| 649 | + $registration->set_final_price($ticket->price()); |
|
| 650 | + if ($update_reg) { |
|
| 651 | 651 | $registration->save(); |
| 652 | 652 | } |
| 653 | 653 | return true; |