@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | use EventEspressoBatchRequest\Helpers\JobParameters; |
| 20 | 20 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
| 21 | 21 | |
| 22 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 23 | - exit( 'No direct script access allowed' ); |
|
| 22 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 23 | + exit('No direct script access allowed'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
@@ -35,35 +35,35 @@ discard block |
||
| 35 | 35 | * @throws BatchRequestException |
| 36 | 36 | * @return JobStepResponse |
| 37 | 37 | */ |
| 38 | - public function create_job( JobParameters $job_parameters ) { |
|
| 39 | - $event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) ); |
|
| 40 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) { |
|
| 38 | + public function create_job(JobParameters $job_parameters) { |
|
| 39 | + $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
| 40 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
| 41 | 41 | throw new BatchRequestException( |
| 42 | - __( 'You do not have permission to view registrations', 'event_espresso') |
|
| 42 | + __('You do not have permission to view registrations', 'event_espresso') |
|
| 43 | 43 | ); |
| 44 | 44 | } |
| 45 | 45 | $filepath = $this->create_file_from_job_with_name( |
| 46 | 46 | $job_parameters->job_id(), |
| 47 | - $this->get_filename_from_event( $event_id ) |
|
| 47 | + $this->get_filename_from_event($event_id) |
|
| 48 | 48 | ); |
| 49 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
| 50 | - $question_data_for_columns = $this->_get_questions_for_report( $event_id ); |
|
| 51 | - $job_parameters->add_extra_data( 'questions_data', $question_data_for_columns ); |
|
| 52 | - $job_parameters->set_job_size( $this->count_units_to_process( $event_id ) ); |
|
| 49 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
| 50 | + $question_data_for_columns = $this->_get_questions_for_report($event_id); |
|
| 51 | + $job_parameters->add_extra_data('questions_data', $question_data_for_columns); |
|
| 52 | + $job_parameters->set_job_size($this->count_units_to_process($event_id)); |
|
| 53 | 53 | //we should also set the header columns |
| 54 | 54 | $csv_data_for_row = $this->get_csv_data_for( |
| 55 | 55 | $event_id, |
| 56 | 56 | 0, |
| 57 | 57 | 1, |
| 58 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
| 59 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
| 58 | + $job_parameters->extra_datum('questions_data') ); |
|
| 59 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
| 60 | 60 | //if we actually processed a row there, record it |
| 61 | - if( $job_parameters->job_size() ) { |
|
| 62 | - $job_parameters->mark_processed( 1 ); |
|
| 61 | + if ($job_parameters->job_size()) { |
|
| 62 | + $job_parameters->mark_processed(1); |
|
| 63 | 63 | } |
| 64 | 64 | return new JobStepResponse( |
| 65 | 65 | $job_parameters, |
| 66 | - __( 'Registrations report started successfully...', 'event_espresso' ) |
|
| 66 | + __('Registrations report started successfully...', 'event_espresso') |
|
| 67 | 67 | ); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -74,16 +74,16 @@ discard block |
||
| 74 | 74 | * @param int $event_id |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - protected function get_filename_from_event( $event_id ) { |
|
| 78 | - if( $event_id ){ |
|
| 79 | - $event_slug = \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' ); |
|
| 80 | - if( ! $event_slug ) { |
|
| 81 | - $event_slug = __( 'unknown', 'event_espresso' ); |
|
| 77 | + protected function get_filename_from_event($event_id) { |
|
| 78 | + if ($event_id) { |
|
| 79 | + $event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug'); |
|
| 80 | + if ( ! $event_slug) { |
|
| 81 | + $event_slug = __('unknown', 'event_espresso'); |
|
| 82 | 82 | } |
| 83 | - }else{ |
|
| 84 | - $event_slug = __( 'all', 'event_espresso' ); |
|
| 83 | + } else { |
|
| 84 | + $event_slug = __('all', 'event_espresso'); |
|
| 85 | 85 | } |
| 86 | - return sprintf( "registrations-for-%s.csv", $event_slug ); |
|
| 86 | + return sprintf("registrations-for-%s.csv", $event_slug); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | * @param int|null $event_id |
| 93 | 93 | * @return array of wpdb results for questions which are to be used for this report |
| 94 | 94 | */ |
| 95 | - protected function _get_questions_for_report( $event_id ) { |
|
| 95 | + protected function _get_questions_for_report($event_id) { |
|
| 96 | 96 | $question_query_params = array( |
| 97 | 97 | array( |
| 98 | - 'Answer.ANS_ID' => array( 'IS_NOT_NULL' ), |
|
| 98 | + 'Answer.ANS_ID' => array('IS_NOT_NULL'), |
|
| 99 | 99 | ), |
| 100 | - 'group_by' => array( 'QST_ID' ) |
|
| 100 | + 'group_by' => array('QST_ID') |
|
| 101 | 101 | ); |
| 102 | - if( $event_id ) { |
|
| 102 | + if ($event_id) { |
|
| 103 | 103 | $question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id; |
| 104 | 104 | } |
| 105 | - return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params ); |
|
| 105 | + return \EEM_Question::instance()->get_all_wpdb_results($question_query_params); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -115,27 +115,27 @@ discard block |
||
| 115 | 115 | * @return JobStepResponse |
| 116 | 116 | * @throws \EE_Error |
| 117 | 117 | */ |
| 118 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) { |
|
| 118 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
|
| 119 | 119 | $csv_data = $this->get_csv_data_for( |
| 120 | - $job_parameters->request_datum( 'EVT_ID', '0'), |
|
| 120 | + $job_parameters->request_datum('EVT_ID', '0'), |
|
| 121 | 121 | $job_parameters->units_processed(), |
| 122 | 122 | $batch_size, |
| 123 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
| 124 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
| 125 | - $units_processed = count( $csv_data ); |
|
| 126 | - $job_parameters->mark_processed( $units_processed ); |
|
| 123 | + $job_parameters->extra_datum('questions_data') ); |
|
| 124 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
| 125 | + $units_processed = count($csv_data); |
|
| 126 | + $job_parameters->mark_processed($units_processed); |
|
| 127 | 127 | $extra_response_data = array( |
| 128 | 128 | 'file_url' => '' |
| 129 | 129 | ); |
| 130 | - if( $units_processed < $batch_size ) { |
|
| 131 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
| 132 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
| 130 | + if ($units_processed < $batch_size) { |
|
| 131 | + $job_parameters->set_status(JobParameters::status_complete); |
|
| 132 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
| 133 | 133 | } |
| 134 | 134 | return new JobStepResponse( |
| 135 | 135 | $job_parameters, |
| 136 | 136 | sprintf( |
| 137 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
| 138 | - count( $csv_data ) ), |
|
| 137 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
| 138 | + count($csv_data) ), |
|
| 139 | 139 | $extra_response_data ); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @return array top-level keys are numeric, next-level keys are column headers |
| 149 | 149 | * |
| 150 | 150 | */ |
| 151 | - function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) { |
|
| 151 | + function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) { |
|
| 152 | 152 | $reg_fields_to_include = array( |
| 153 | 153 | 'TXN_ID', |
| 154 | 154 | 'ATT_ID', |
@@ -179,166 +179,166 @@ discard block |
||
| 179 | 179 | array( |
| 180 | 180 | 'OR' => array( |
| 181 | 181 | //don't include registrations from failed or abandoned transactions... |
| 182 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
| 182 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
| 183 | 183 | //unless the registration is approved, in which case include it regardless of transaction status |
| 184 | 184 | 'STS_ID' => \EEM_Registration::status_id_approved |
| 185 | 185 | ), |
| 186 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
| 186 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
| 187 | 187 | ), |
| 188 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
| 189 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
| 190 | - 'limit' => array( $offset, $limit ), |
|
| 188 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
| 189 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
| 190 | + 'limit' => array($offset, $limit), |
|
| 191 | 191 | 'caps' => \EEM_Base::caps_read_admin |
| 192 | 192 | ), |
| 193 | 193 | $event_id |
| 194 | 194 | ); |
| 195 | - if( $event_id ){ |
|
| 196 | - $query_params[0]['EVT_ID'] = $event_id; |
|
| 197 | - }else{ |
|
| 198 | - $query_params[ 'force_join' ][] = 'Event'; |
|
| 195 | + if ($event_id) { |
|
| 196 | + $query_params[0]['EVT_ID'] = $event_id; |
|
| 197 | + } else { |
|
| 198 | + $query_params['force_join'][] = 'Event'; |
|
| 199 | 199 | } |
| 200 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
| 200 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
| 201 | 201 | //get all questions which relate to someone in this group |
| 202 | 202 | $registration_ids = array(); |
| 203 | - foreach( $registration_rows as $reg_row ) { |
|
| 204 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
| 203 | + foreach ($registration_rows as $reg_row) { |
|
| 204 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - foreach($registration_rows as $reg_row){ |
|
| 208 | - if ( is_array( $reg_row ) ) { |
|
| 207 | + foreach ($registration_rows as $reg_row) { |
|
| 208 | + if (is_array($reg_row)) { |
|
| 209 | 209 | $reg_csv_array = array(); |
| 210 | - if( ! $event_id ){ |
|
| 210 | + if ( ! $event_id) { |
|
| 211 | 211 | //get the event's name and Id |
| 212 | - $reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] ); |
|
| 212 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
| 213 | 213 | } |
| 214 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
| 214 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
| 215 | 215 | /*@var $reg_row EE_Registration */ |
| 216 | - foreach($reg_fields_to_include as $field_name){ |
|
| 216 | + foreach ($reg_fields_to_include as $field_name) { |
|
| 217 | 217 | $field = $reg_model->field_settings_for($field_name); |
| 218 | - if($field_name == 'REG_final_price'){ |
|
| 219 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
| 220 | - }elseif( $field_name == 'REG_count' ){ |
|
| 221 | - $value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) ); |
|
| 222 | - }elseif( $field_name == 'REG_date' ) { |
|
| 223 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
| 224 | - }else{ |
|
| 225 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
| 218 | + if ($field_name == 'REG_final_price') { |
|
| 219 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
| 220 | + }elseif ($field_name == 'REG_count') { |
|
| 221 | + $value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size'])); |
|
| 222 | + }elseif ($field_name == 'REG_date') { |
|
| 223 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
| 224 | + } else { |
|
| 225 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
| 226 | 226 | } |
| 227 | 227 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
| 228 | - if($field_name == 'REG_final_price'){ |
|
| 228 | + if ($field_name == 'REG_final_price') { |
|
| 229 | 229 | //add a column named Currency after the final price |
| 230 | 230 | $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | //get pretty status |
| 234 | - $stati = \EEM_Status::instance()->localized_status( array( |
|
| 235 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
| 236 | - $reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
| 234 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
| 235 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
| 236 | + $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ), |
|
| 237 | 237 | FALSE, |
| 238 | - 'sentence' ); |
|
| 239 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
| 238 | + 'sentence'); |
|
| 239 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
| 240 | 240 | //get pretty transaction status |
| 241 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ]; |
|
| 242 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00'; |
|
| 243 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
| 241 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
| 242 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
| 243 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
| 244 | 244 | $payment_methods = array(); |
| 245 | 245 | $gateway_txn_ids_etc = array(); |
| 246 | 246 | $payment_times = array(); |
| 247 | - if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){ |
|
| 247 | + if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
| 248 | 248 | $payments_info = \EEM_Payment::instance()->get_all_wpdb_results( |
| 249 | 249 | array( |
| 250 | 250 | array( |
| 251 | - 'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ], |
|
| 251 | + 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
| 252 | 252 | 'STS_ID' => \EEM_Payment::status_id_approved |
| 253 | 253 | ), |
| 254 | - 'force_join' => array( 'Payment_Method' ), |
|
| 254 | + 'force_join' => array('Payment_Method'), |
|
| 255 | 255 | |
| 256 | 256 | ), |
| 257 | 257 | ARRAY_A, |
| 258 | 258 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
| 259 | 259 | |
| 260 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
| 261 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
| 262 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
| 263 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
| 260 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
| 261 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
| 262 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
| 263 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | } |
| 267 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
| 268 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
| 269 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
| 267 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
| 268 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
| 269 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
| 270 | 270 | |
| 271 | 271 | //get whether or not the user has checked in |
| 272 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
| 272 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
| 273 | 273 | //get ticket of registration and its price |
| 274 | 274 | $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
| 275 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
| 276 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
| 275 | + if ($reg_row['Ticket.TKT_ID']) { |
|
| 276 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
| 277 | 277 | $datetimes_strings = array(); |
| 278 | - foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){ |
|
| 279 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
| 278 | + foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) { |
|
| 279 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | } else { |
| 283 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
| 284 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
| 283 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
| 284 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
| 285 | 285 | } |
| 286 | 286 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
| 287 | 287 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
| 288 | 288 | //get datetime(s) of registration |
| 289 | 289 | |
| 290 | 290 | //add attendee columns |
| 291 | - foreach($att_fields_to_include as $att_field_name){ |
|
| 291 | + foreach ($att_fields_to_include as $att_field_name) { |
|
| 292 | 292 | $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
| 293 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
| 294 | - if($att_field_name == 'STA_ID'){ |
|
| 295 | - $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
| 296 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
| 297 | - $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
| 298 | - }else{ |
|
| 299 | - $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
| 293 | + if ($reg_row['Attendee_CPT.ID']) { |
|
| 294 | + if ($att_field_name == 'STA_ID') { |
|
| 295 | + $value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
| 296 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
| 297 | + $value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
| 298 | + } else { |
|
| 299 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
| 300 | 300 | } |
| 301 | - }else{ |
|
| 301 | + } else { |
|
| 302 | 302 | $value = ''; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value; |
|
| 305 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | //make sure each registration has the same questions in the same order |
| 309 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
| 310 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
| 311 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
| 309 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
| 310 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
| 311 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | $answers = \EEM_Answer::instance()->get_all_wpdb_results( |
| 315 | 315 | array( |
| 316 | - array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), |
|
| 317 | - 'force_join' => array( 'Question' ) |
|
| 316 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
| 317 | + 'force_join' => array('Question') |
|
| 318 | 318 | ) |
| 319 | 319 | ); |
| 320 | 320 | //now fill out the questions THEY answered |
| 321 | - foreach( $answers as $answer_row ){ |
|
| 322 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
| 321 | + foreach ($answers as $answer_row) { |
|
| 322 | + if ($answer_row['Question.QST_ID']) { |
|
| 323 | 323 | $question_label = \EEH_Export::prepare_value_from_db_for_display( |
| 324 | 324 | \EEM_Question::instance(), |
| 325 | 325 | 'QST_admin_label', |
| 326 | - $answer_row[ 'Question.QST_admin_label' ] |
|
| 326 | + $answer_row['Question.QST_admin_label'] |
|
| 327 | 327 | ); |
| 328 | 328 | } else { |
| 329 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
| 329 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
| 330 | 330 | } |
| 331 | - if ( isset( $answer_row[ 'Question.QST_type' ] ) |
|
| 332 | - && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state |
|
| 331 | + if (isset($answer_row['Question.QST_type']) |
|
| 332 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
| 333 | 333 | ) { |
| 334 | - $reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID( |
|
| 335 | - $answer_row[ 'Answer.ANS_value' ] |
|
| 334 | + $reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID( |
|
| 335 | + $answer_row['Answer.ANS_value'] |
|
| 336 | 336 | ); |
| 337 | 337 | } else { |
| 338 | - $reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display( |
|
| 338 | + $reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display( |
|
| 339 | 339 | \EEM_Answer::instance(), |
| 340 | 340 | 'ANS_value', |
| 341 | - $answer_row[ 'Answer.ANS_value' ] |
|
| 341 | + $answer_row['Answer.ANS_value'] |
|
| 342 | 342 | ); |
| 343 | 343 | } |
| 344 | 344 | } |
@@ -349,17 +349,17 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | //if we couldn't export anything, we want to at least show the column headers |
| 352 | - if ( empty( $registrations_csv_ready_array ) ) { |
|
| 352 | + if (empty($registrations_csv_ready_array)) { |
|
| 353 | 353 | $reg_csv_array = array(); |
| 354 | 354 | $model_and_fields_to_include = array( |
| 355 | 355 | 'Registration' => $reg_fields_to_include, |
| 356 | 356 | 'Attendee' => $att_fields_to_include |
| 357 | 357 | ); |
| 358 | - foreach ( $model_and_fields_to_include as $model_name => $field_list ) { |
|
| 359 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
| 360 | - foreach ( $field_list as $field_name ) { |
|
| 361 | - $field = $model->field_settings_for( $field_name ); |
|
| 362 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null; |
|
| 358 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
| 359 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
| 360 | + foreach ($field_list as $field_name) { |
|
| 361 | + $field = $model->field_settings_for($field_name); |
|
| 362 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | $registrations_csv_ready_array[] = $reg_csv_array; |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | * @param int $event_id |
| 376 | 376 | * @return int |
| 377 | 377 | */ |
| 378 | - public function count_units_to_process( $event_id ) { |
|
| 378 | + public function count_units_to_process($event_id) { |
|
| 379 | 379 | //use the legacy filter |
| 380 | 380 | $query_params = apply_filters( |
| 381 | 381 | 'FHEE__EE_Export__report_registration_for_event', |
@@ -383,24 +383,24 @@ discard block |
||
| 383 | 383 | array( |
| 384 | 384 | 'OR' => array( |
| 385 | 385 | //don't include registrations from failed or abandoned transactions... |
| 386 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
| 386 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
| 387 | 387 | //unless the registration is approved, in which case include it regardless of transaction status |
| 388 | 388 | 'STS_ID' => \EEM_Registration::status_id_approved |
| 389 | 389 | ), |
| 390 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
| 390 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
| 391 | 391 | ), |
| 392 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
| 393 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
| 392 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
| 393 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
| 394 | 394 | 'caps' => \EEM_Base::caps_read_admin |
| 395 | 395 | ), |
| 396 | 396 | $event_id |
| 397 | 397 | ); |
| 398 | - if( $event_id ){ |
|
| 399 | - $query_params[0]['EVT_ID'] = $event_id; |
|
| 398 | + if ($event_id) { |
|
| 399 | + $query_params[0]['EVT_ID'] = $event_id; |
|
| 400 | 400 | } else { |
| 401 | - $query_params[ 'force_join' ][] = 'Event'; |
|
| 401 | + $query_params['force_join'][] = 'Event'; |
|
| 402 | 402 | } |
| 403 | - return \EEM_Registration::instance()->count( $query_params ); |
|
| 403 | + return \EEM_Registration::instance()->count($query_params); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | * @param JobParameters $job_parameters |
| 412 | 412 | * @return boolean |
| 413 | 413 | */ |
| 414 | - public function cleanup_job( JobParameters $job_parameters ){ |
|
| 414 | + public function cleanup_job(JobParameters $job_parameters) { |
|
| 415 | 415 | $this->_file_helper->delete( |
| 416 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
| 416 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
| 417 | 417 | true, |
| 418 | 418 | 'd' |
| 419 | 419 | ); |
| 420 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
| 420 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
| 2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
| 2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 3 | 3 | /** |
| 4 | 4 | * |
| 5 | 5 | * Transaction Model |
@@ -67,36 +67,36 @@ discard block |
||
| 67 | 67 | * @return EEM_Transaction |
| 68 | 68 | * @throws \EE_Error |
| 69 | 69 | */ |
| 70 | - protected function __construct( $timezone ) { |
|
| 71 | - $this->singular_item = __('Transaction','event_espresso'); |
|
| 72 | - $this->plural_item = __('Transactions','event_espresso'); |
|
| 70 | + protected function __construct($timezone) { |
|
| 71 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
| 72 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
| 73 | 73 | |
| 74 | 74 | $this->_tables = array( |
| 75 | - 'TransactionTable'=>new EE_Primary_Table('esp_transaction','TXN_ID') |
|
| 75 | + 'TransactionTable'=>new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
| 76 | 76 | ); |
| 77 | 77 | $this->_fields = array( |
| 78 | 78 | 'TransactionTable'=>array( |
| 79 | - 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')), |
|
| 80 | - 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ), |
|
| 81 | - 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0), |
|
| 82 | - 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0), |
|
| 83 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
| 84 | - 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''), |
|
| 85 | - 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''), |
|
| 79 | + 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
| 80 | + 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone), |
|
| 81 | + 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0), |
|
| 82 | + 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
| 83 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
| 84 | + 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''), |
|
| 85 | + 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
| 86 | 86 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'), |
| 87 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ), |
|
| 87 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()), |
|
| 88 | 88 | ) |
| 89 | 89 | ); |
| 90 | 90 | $this->_model_relations = array( |
| 91 | 91 | 'Registration'=>new EE_Has_Many_Relation(), |
| 92 | 92 | 'Payment'=>new EE_Has_Many_Relation(), |
| 93 | 93 | 'Status'=>new EE_Belongs_To_Relation(), |
| 94 | - 'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items |
|
| 94 | + 'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items |
|
| 95 | 95 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
| 96 | 96 | 'Message' => new EE_Has_Many_Relation() |
| 97 | 97 | ); |
| 98 | 98 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
| 99 | - parent::__construct( $timezone ); |
|
| 99 | + parent::__construct($timezone); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,22 +107,22 @@ discard block |
||
| 107 | 107 | * @param string $period |
| 108 | 108 | * @return \stdClass[] |
| 109 | 109 | */ |
| 110 | - public function get_revenue_per_day_report( $period = '-1 month' ) { |
|
| 111 | - $sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', strtotime( $period ) ), 'Y-m-d H:i:s', 'UTC' ); |
|
| 110 | + public function get_revenue_per_day_report($period = '-1 month') { |
|
| 111 | + $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
| 112 | 112 | |
| 113 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'TXN_timestamp' ); |
|
| 113 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
| 114 | 114 | return $this->_get_all_wpdb_results( |
| 115 | 115 | array( |
| 116 | 116 | array( |
| 117 | - 'TXN_timestamp' => array( '>=', $sql_date ) |
|
| 117 | + 'TXN_timestamp' => array('>=', $sql_date) |
|
| 118 | 118 | ), |
| 119 | 119 | 'group_by' => 'txnDate', |
| 120 | - 'order_by' => array( 'TXN_timestamp' => 'ASC' ) |
|
| 120 | + 'order_by' => array('TXN_timestamp' => 'ASC') |
|
| 121 | 121 | ), |
| 122 | 122 | OBJECT, |
| 123 | 123 | array( |
| 124 | - 'txnDate' => array( 'DATE(' . $query_interval . ')', '%s' ), |
|
| 125 | - 'revenue' => array( 'SUM(TransactionTable.TXN_paid)', '%d' ) |
|
| 124 | + 'txnDate' => array('DATE('.$query_interval.')', '%s'), |
|
| 125 | + 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
| 126 | 126 | ) |
| 127 | 127 | ); |
| 128 | 128 | } |
@@ -137,18 +137,18 @@ discard block |
||
| 137 | 137 | * @throws \EE_Error |
| 138 | 138 | * @return mixed |
| 139 | 139 | */ |
| 140 | - public function get_revenue_per_event_report( $period = '-1 month' ) { |
|
| 140 | + public function get_revenue_per_event_report($period = '-1 month') { |
|
| 141 | 141 | global $wpdb; |
| 142 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
| 143 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
| 142 | + $transaction_table = $wpdb->prefix.'esp_transaction'; |
|
| 143 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
| 144 | 144 | $event_table = $wpdb->posts; |
| 145 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
| 146 | - $sql_date = date( 'Y-m-d H:i:s', strtotime( $period ) ); |
|
| 145 | + $payment_table = $wpdb->prefix.'esp_payment'; |
|
| 146 | + $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
| 147 | 147 | $approved_payment_status = EEM_Payment::status_id_approved; |
| 148 | 148 | $extra_event_on_join = ''; |
| 149 | 149 | //exclude events not authored by user if permissions in effect |
| 150 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
| 151 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
| 150 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
| 151 | + $extra_event_on_join = ' AND Event.post_author = '.get_current_user_id(); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | return $wpdb->get_results( |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | * @param string $reg_url_link |
| 189 | 189 | * @return EE_Transaction |
| 190 | 190 | */ |
| 191 | - public function get_transaction_from_reg_url_link( $reg_url_link = '' ){ |
|
| 192 | - return $this->get_one( array( |
|
| 191 | + public function get_transaction_from_reg_url_link($reg_url_link = '') { |
|
| 192 | + return $this->get_one(array( |
|
| 193 | 193 | array( |
| 194 | - 'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) |
|
| 194 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '') |
|
| 195 | 195 | ) |
| 196 | 196 | )); |
| 197 | 197 | } |
@@ -208,16 +208,16 @@ discard block |
||
| 208 | 208 | * @return boolean |
| 209 | 209 | * @throws \EE_Error |
| 210 | 210 | */ |
| 211 | - public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){ |
|
| 211 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) { |
|
| 212 | 212 | EE_Error::doing_it_wrong( |
| 213 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 214 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
| 213 | + __CLASS__.'::'.__FUNCTION__, |
|
| 214 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
| 215 | 215 | '4.6.0' |
| 216 | 216 | ); |
| 217 | 217 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 218 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 218 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 219 | 219 | return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
| 220 | - $this->ensure_is_obj( $transaction_obj_or_id ) |
|
| 220 | + $this->ensure_is_obj($transaction_obj_or_id) |
|
| 221 | 221 | ); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | array( |
| 250 | 250 | 0 => array( |
| 251 | 251 | 'STS_ID' => EEM_Transaction::failed_status_code, |
| 252 | - 'TXN_timestamp' => array( '<', time() - $time_to_leave_alone ) |
|
| 252 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
| 253 | 253 | ) |
| 254 | 254 | ), |
| 255 | 255 | $time_to_leave_alone |
@@ -262,29 +262,29 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | $txn_ids = apply_filters( |
| 264 | 264 | 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
| 265 | - EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ), |
|
| 265 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
| 266 | 266 | $time_to_leave_alone |
| 267 | 267 | ); |
| 268 | 268 | //now that we have the ids to delete |
| 269 | - if ( ! empty( $txn_ids ) && is_array( $txn_ids ) ) { |
|
| 269 | + if ( ! empty($txn_ids) && is_array($txn_ids)) { |
|
| 270 | 270 | // first, make sure these TXN's are removed the "ee_locked_transactions" array |
| 271 | - EEM_Transaction::unset_locked_transactions( $txn_ids ); |
|
| 271 | + EEM_Transaction::unset_locked_transactions($txn_ids); |
|
| 272 | 272 | // let's get deletin'... |
| 273 | 273 | // Why no wpdb->prepare? Because the data is trusted. |
| 274 | 274 | // We got the ids from the original query to get them FROM |
| 275 | 275 | // the db (which is sanitized) so no need to prepare them again. |
| 276 | - $query = ' |
|
| 276 | + $query = ' |
|
| 277 | 277 | DELETE |
| 278 | - FROM ' . $this->table() . ' |
|
| 278 | + FROM ' . $this->table().' |
|
| 279 | 279 | WHERE |
| 280 | - TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')'; |
|
| 281 | - $deleted = $wpdb->query( $query ); |
|
| 280 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
| 281 | + $deleted = $wpdb->query($query); |
|
| 282 | 282 | } |
| 283 | - if ( $deleted ) { |
|
| 283 | + if ($deleted) { |
|
| 284 | 284 | /** |
| 285 | 285 | * Allows code to do something after the transactions have been deleted. |
| 286 | 286 | */ |
| 287 | - do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids ); |
|
| 287 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
| 288 | 288 | } |
| 289 | 289 | return $deleted; |
| 290 | 290 | } |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | * @param array $transaction_IDs |
| 296 | 296 | * @return bool |
| 297 | 297 | */ |
| 298 | - public static function unset_locked_transactions( array $transaction_IDs ) { |
|
| 299 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
| 298 | + public static function unset_locked_transactions(array $transaction_IDs) { |
|
| 299 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
| 300 | 300 | $update = false; |
| 301 | - foreach ( $transaction_IDs as $TXN_ID ) { |
|
| 302 | - if ( isset( $locked_transactions[ $TXN_ID ] ) ) { |
|
| 303 | - unset( $locked_transactions[ $TXN_ID ] ); |
|
| 301 | + foreach ($transaction_IDs as $TXN_ID) { |
|
| 302 | + if (isset($locked_transactions[$TXN_ID])) { |
|
| 303 | + unset($locked_transactions[$TXN_ID]); |
|
| 304 | 304 | $update = true; |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - if ( $update ) { |
|
| 308 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
| 307 | + if ($update) { |
|
| 308 | + update_option('ee_locked_transactions', $locked_transactions); |
|
| 309 | 309 | } |
| 310 | 310 | return $update; |
| 311 | 311 | } |
@@ -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 | /** |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - public function __construct( $routing = TRUE ) { |
|
| 44 | - parent::__construct( $routing ); |
|
| 43 | + public function __construct($routing = TRUE) { |
|
| 44 | + parent::__construct($routing); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | protected function _ajax_hooks() { |
| 60 | - add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings')); |
|
| 61 | - add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states')); |
|
| 62 | - add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 ); |
|
| 63 | - add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state')); |
|
| 60 | + add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
| 61 | + add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
| 62 | + add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
| 63 | + add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | 'label' => __('Critical Pages', 'event_espresso'), |
| 154 | 154 | 'order' => 50 |
| 155 | 155 | ), |
| 156 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
| 156 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 157 | 157 | 'help_tabs' => array( |
| 158 | 158 | 'general_settings_critical_pages_help_tab' => array( |
| 159 | 159 | 'title' => __('Critical Pages', 'event_espresso'), |
| 160 | 160 | 'filename' => 'general_settings_critical_pages' |
| 161 | 161 | ) |
| 162 | 162 | ), |
| 163 | - 'help_tour' => array( 'Critical_Pages_Help_Tour' ), |
|
| 163 | + 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
| 164 | 164 | 'require_nonce' => FALSE |
| 165 | 165 | ), |
| 166 | 166 | 'default' => array( |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | 'filename' => 'general_settings_your_organization' |
| 175 | 175 | ) |
| 176 | 176 | ), |
| 177 | - 'help_tour' => array( 'Your_Organization_Help_Tour' ), |
|
| 178 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
| 177 | + 'help_tour' => array('Your_Organization_Help_Tour'), |
|
| 178 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 179 | 179 | 'require_nonce' => FALSE |
| 180 | 180 | ), |
| 181 | 181 | 'admin_option_settings' => array( |
@@ -183,14 +183,14 @@ discard block |
||
| 183 | 183 | 'label' => __('Admin Options', 'event_espresso'), |
| 184 | 184 | 'order' => 60 |
| 185 | 185 | ), |
| 186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
| 186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 187 | 187 | 'help_tabs' => array( |
| 188 | 188 | 'general_settings_admin_options_help_tab' => array( |
| 189 | 189 | 'title' => __('Admin Options', 'event_espresso'), |
| 190 | 190 | 'filename' => 'general_settings_admin_options' |
| 191 | 191 | ) |
| 192 | 192 | ), |
| 193 | - 'help_tour' => array( 'Admin_Options_Help_Tour' ), |
|
| 193 | + 'help_tour' => array('Admin_Options_Help_Tour'), |
|
| 194 | 194 | 'require_nonce' => FALSE |
| 195 | 195 | ), |
| 196 | 196 | 'country_settings' => array( |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | 'filename' => 'general_settings_countries' |
| 205 | 205 | ) |
| 206 | 206 | ), |
| 207 | - 'help_tour' => array( 'Countries_Help_Tour' ), |
|
| 207 | + 'help_tour' => array('Countries_Help_Tour'), |
|
| 208 | 208 | 'require_nonce' => FALSE |
| 209 | 209 | ) |
| 210 | 210 | ); |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | public function admin_init() { |
| 225 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
| 226 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
| 227 | - EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' ); |
|
| 228 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
| 229 | - EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol ); |
|
| 225 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
| 226 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
| 227 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso'); |
|
| 228 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
| 229 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | public function admin_notices() {} |
@@ -239,21 +239,21 @@ discard block |
||
| 239 | 239 | //scripts |
| 240 | 240 | wp_enqueue_script('media-upload'); |
| 241 | 241 | wp_enqueue_script('thickbox'); |
| 242 | - wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 243 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 244 | - wp_enqueue_script( 'organization_settings' ); |
|
| 245 | - wp_enqueue_style( 'organization-css' ); |
|
| 246 | - $confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
| 247 | - wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete ); |
|
| 242 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 243 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 244 | + wp_enqueue_script('organization_settings'); |
|
| 245 | + wp_enqueue_style('organization-css'); |
|
| 246 | + $confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
| 247 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
| 248 | 248 | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | public function load_scripts_styles_country_settings() { |
| 252 | 252 | //scripts |
| 253 | - wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 254 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 255 | - wp_enqueue_script( 'gen_settings_countries' ); |
|
| 256 | - wp_enqueue_style( 'organization-css' ); |
|
| 253 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 254 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 255 | + wp_enqueue_script('gen_settings_countries'); |
|
| 256 | + wp_enqueue_style('organization-css'); |
|
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | |
@@ -270,31 +270,31 @@ discard block |
||
| 270 | 270 | $this->_transient_garbage_collection(); |
| 271 | 271 | $this->_template_args['values'] = $this->_yes_no_values; |
| 272 | 272 | |
| 273 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
| 274 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE; |
|
| 273 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
| 274 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE; |
|
| 275 | 275 | |
| 276 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
| 277 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE; |
|
| 276 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
| 277 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE; |
|
| 278 | 278 | |
| 279 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
| 280 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE; |
|
| 279 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
| 280 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE; |
|
| 281 | 281 | |
| 282 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
| 283 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE; |
|
| 282 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
| 283 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE; |
|
| 284 | 284 | |
| 285 | - $this->_set_add_edit_form_tags( 'update_espresso_page_settings' ); |
|
| 286 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 287 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE ); |
|
| 285 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
| 286 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 287 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE); |
|
| 288 | 288 | $this->display_admin_page_with_sidebar(); |
| 289 | 289 | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | protected function _update_espresso_page_settings() { |
| 293 | 293 | // capture incoming request data |
| 294 | - $reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
| 295 | - $txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
| 296 | - $thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
| 297 | - $cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
| 294 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
| 295 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
| 296 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
| 297 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
| 298 | 298 | // pack critical_pages into an array |
| 299 | 299 | $critical_pages = array( |
| 300 | 300 | 'reg_page_id' => $reg_page_id, |
@@ -302,17 +302,17 @@ discard block |
||
| 302 | 302 | 'thank_you_page_id' => $thank_you_page_id, |
| 303 | 303 | 'cancel_page_id' => $cancel_page_id |
| 304 | 304 | ); |
| 305 | - foreach ( $critical_pages as $critical_page_name => $critical_page_id ) { |
|
| 305 | + foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
| 306 | 306 | // has the page changed ? |
| 307 | - if ( EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id ) { |
|
| 307 | + if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) { |
|
| 308 | 308 | // grab post object for old page |
| 309 | - $post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
| 309 | + $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} ); |
|
| 310 | 310 | // update post shortcodes for old page |
| 311 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
| 311 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
| 312 | 312 | // grab post object for new page |
| 313 | - $post = get_post( $critical_page_id ); |
|
| 313 | + $post = get_post($critical_page_id); |
|
| 314 | 314 | // update post shortcodes for new page |
| 315 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $critical_page_id, $post ); |
|
| 315 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | // set page IDs |
@@ -321,14 +321,14 @@ discard block |
||
| 321 | 321 | EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
| 322 | 322 | EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
| 323 | 323 | |
| 324 | - EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data ); |
|
| 324 | + EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data); |
|
| 325 | 325 | |
| 326 | 326 | $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
| 327 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 327 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__); |
|
| 328 | 328 | $query_args = array( |
| 329 | 329 | 'action' => 'critical_pages' |
| 330 | 330 | ); |
| 331 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
| 331 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
| 332 | 332 | |
| 333 | 333 | } |
| 334 | 334 | |
@@ -343,34 +343,34 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | protected function _your_organization_settings() { |
| 345 | 345 | |
| 346 | - $this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : ''; |
|
| 347 | - $this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : ''; |
|
| 348 | - $this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : ''; |
|
| 349 | - $this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : ''; |
|
| 350 | - $this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : ''; |
|
| 351 | - $this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : ''; |
|
| 352 | - $this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : ''; |
|
| 353 | - $this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : ''; |
|
| 354 | - $this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : ''; |
|
| 355 | - $this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$'; |
|
| 356 | - $this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE; |
|
| 357 | - $this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : ''; |
|
| 358 | - $this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : ''; |
|
| 359 | - $this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : ''; |
|
| 360 | - $this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : ''; |
|
| 361 | - $this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : ''; |
|
| 362 | - $this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : ''; |
|
| 346 | + $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
| 347 | + $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
| 348 | + $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
| 349 | + $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
| 350 | + $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
| 351 | + $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
| 352 | + $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
| 353 | + $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
| 354 | + $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
| 355 | + $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
| 356 | + $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE; |
|
| 357 | + $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
| 358 | + $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
| 359 | + $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
| 360 | + $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
| 361 | + $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
| 362 | + $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
| 363 | 363 | //UXIP settings |
| 364 | - $this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE; |
|
| 364 | + $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE; |
|
| 365 | 365 | |
| 366 | - $STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
| 366 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
| 367 | 367 | $this->_template_args['states'] = new EE_Question_Form_Input( |
| 368 | - EE_Question::new_instance ( array( |
|
| 368 | + EE_Question::new_instance(array( |
|
| 369 | 369 | 'QST_ID'=> 0, |
| 370 | 370 | 'QST_display_text'=> __('State/Province', 'event_espresso'), |
| 371 | 371 | 'QST_system'=>'admin-state' |
| 372 | 372 | )), |
| 373 | - EE_Answer::new_instance ( array( |
|
| 373 | + EE_Answer::new_instance(array( |
|
| 374 | 374 | 'ANS_ID' => 0, |
| 375 | 375 | 'ANS_value' => $STA_ID |
| 376 | 376 | )), |
@@ -382,14 +382,14 @@ discard block |
||
| 382 | 382 | ) |
| 383 | 383 | ); |
| 384 | 384 | |
| 385 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
| 385 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
| 386 | 386 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
| 387 | - EE_Question::new_instance ( array( |
|
| 387 | + EE_Question::new_instance(array( |
|
| 388 | 388 | 'QST_ID'=> 0, |
| 389 | 389 | 'QST_display_text'=> __('Country', 'event_espresso'), |
| 390 | 390 | 'QST_system'=>'admin-country' |
| 391 | 391 | )), |
| 392 | - EE_Answer::new_instance ( array( |
|
| 392 | + EE_Answer::new_instance(array( |
|
| 393 | 393 | 'ANS_ID' => 0, |
| 394 | 394 | 'ANS_value' => $CNT_ISO |
| 395 | 395 | )), |
@@ -401,51 +401,51 @@ discard block |
||
| 401 | 401 | ) |
| 402 | 402 | ); |
| 403 | 403 | |
| 404 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
| 405 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
| 404 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
| 405 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
| 406 | 406 | |
| 407 | 407 | //PUE verification stuff |
| 408 | - $ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME ); |
|
| 409 | - $verify_fail = get_option( $ver_option_key ); |
|
| 410 | - $this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
| 408 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
| 409 | + $verify_fail = get_option($ver_option_key); |
|
| 410 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
| 411 | 411 | |
| 412 | - $this->_set_add_edit_form_tags( 'update_your_organization_settings' ); |
|
| 413 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 414 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE ); |
|
| 412 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
| 413 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 414 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE); |
|
| 415 | 415 | |
| 416 | 416 | $this->display_admin_page_with_sidebar(); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | protected function _update_your_organization_settings() { |
| 420 | - if ( is_main_site() ) |
|
| 421 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
| 422 | - EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
|
| 423 | - EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
|
| 424 | - EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
|
| 425 | - EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city; |
|
| 426 | - EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
| 427 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
| 428 | - EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip; |
|
| 429 | - EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email; |
|
| 430 | - EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat; |
|
| 431 | - EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone; |
|
| 432 | - EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url; |
|
| 433 | - EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook; |
|
| 434 | - EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter; |
|
| 435 | - EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin; |
|
| 436 | - EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest; |
|
| 437 | - EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google; |
|
| 438 | - EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram; |
|
| 439 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
| 440 | - |
|
| 441 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO ); |
|
| 442 | - |
|
| 443 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG ); |
|
| 420 | + if (is_main_site()) |
|
| 421 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
| 422 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
| 423 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
| 424 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
| 425 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
| 426 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
| 427 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
| 428 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
| 429 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
| 430 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
| 431 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
| 432 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
| 433 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
| 434 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
| 435 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
| 436 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
| 437 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
| 438 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
| 439 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
| 440 | + |
|
| 441 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
| 442 | + |
|
| 443 | + EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG); |
|
| 444 | 444 | |
| 445 | 445 | $what = 'Your Organization Settings'; |
| 446 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 446 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
| 447 | 447 | |
| 448 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) ); |
|
| 448 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
| 449 | 449 | |
| 450 | 450 | } |
| 451 | 451 | |
@@ -456,36 +456,36 @@ discard block |
||
| 456 | 456 | protected function _admin_option_settings() { |
| 457 | 457 | |
| 458 | 458 | $this->_template_args['values'] = $this->_yes_no_values; |
| 459 | - $this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE; |
|
| 460 | - $this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE; |
|
| 461 | - $this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30; |
|
| 462 | - $this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE; |
|
| 463 | - $this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE; |
|
| 464 | - $this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
| 465 | - $this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1; |
|
| 466 | - |
|
| 467 | - $this->_set_add_edit_form_tags( 'update_admin_option_settings' ); |
|
| 468 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 459 | + $this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE; |
|
| 460 | + $this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE; |
|
| 461 | + $this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30; |
|
| 462 | + $this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE; |
|
| 463 | + $this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE; |
|
| 464 | + $this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
| 465 | + $this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1; |
|
| 466 | + |
|
| 467 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
| 468 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 469 | 469 | $this->_template_args['template_args'] = $this->_template_args; |
| 470 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE ); |
|
| 470 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE); |
|
| 471 | 471 | $this->display_admin_page_with_sidebar(); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | protected function _update_admin_option_settings() { |
| 475 | - EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
| 476 | - EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
| 477 | - EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
| 478 | - EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
| 479 | - EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
| 480 | - EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
| 481 | - EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
| 475 | + EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
| 476 | + EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
| 477 | + EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
| 478 | + EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
| 479 | + EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
| 480 | + EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
| 481 | + EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
| 482 | 482 | |
| 483 | - EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin ); |
|
| 483 | + EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin); |
|
| 484 | 484 | |
| 485 | 485 | $what = 'Admin Options'; |
| 486 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 487 | - $success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success ); |
|
| 488 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) ); |
|
| 486 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__); |
|
| 487 | + $success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success); |
|
| 488 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings')); |
|
| 489 | 489 | |
| 490 | 490 | } |
| 491 | 491 | |
@@ -498,20 +498,20 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | protected function _country_settings() { |
| 500 | 500 | |
| 501 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
| 502 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
| 501 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
| 502 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
| 503 | 503 | |
| 504 | 504 | //load field generator helper |
| 505 | 505 | |
| 506 | 506 | $this->_template_args['values'] = $this->_yes_no_values; |
| 507 | 507 | |
| 508 | 508 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
| 509 | - EE_Question::new_instance ( array( |
|
| 509 | + EE_Question::new_instance(array( |
|
| 510 | 510 | 'QST_ID'=> 0, |
| 511 | 511 | 'QST_display_text'=> __('Select Country', 'event_espresso'), |
| 512 | 512 | 'QST_system'=>'admin-country' |
| 513 | 513 | )), |
| 514 | - EE_Answer::new_instance ( array( |
|
| 514 | + EE_Answer::new_instance(array( |
|
| 515 | 515 | 'ANS_ID' => 0, |
| 516 | 516 | 'ANS_value' => $CNT_ISO |
| 517 | 517 | )), |
@@ -524,14 +524,14 @@ discard block |
||
| 524 | 524 | ); |
| 525 | 525 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 526 | 526 | |
| 527 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
| 528 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
| 527 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
| 528 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
| 529 | 529 | $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
| 530 | 530 | $this->_template_args['country_states_settings'] = $this->display_country_states(); |
| 531 | 531 | |
| 532 | - $this->_set_add_edit_form_tags( 'update_country_settings' ); |
|
| 533 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 534 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE ); |
|
| 532 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
| 533 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 534 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE); |
|
| 535 | 535 | $this->display_admin_page_with_no_sidebar(); |
| 536 | 536 | } |
| 537 | 537 | |
@@ -544,43 +544,43 @@ discard block |
||
| 544 | 544 | * @param string $CNT_ISO |
| 545 | 545 | * @return mixed string | array |
| 546 | 546 | */ |
| 547 | - public function display_country_settings( $CNT_ISO = '' ) { |
|
| 547 | + public function display_country_settings($CNT_ISO = '') { |
|
| 548 | 548 | |
| 549 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
| 550 | - if ( ! $CNT_ISO ) { |
|
| 549 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
| 550 | + if ( ! $CNT_ISO) { |
|
| 551 | 551 | return ''; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | // for ajax |
| 555 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
| 556 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
| 557 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
| 558 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
| 559 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
| 555 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
| 556 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
| 557 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
| 558 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
| 559 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
| 560 | 560 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 561 | 561 | $country_input_types = array( |
| 562 | - 'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
| 563 | - 'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
| 564 | - 'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
| 565 | - 'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
| 566 | - 'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ), |
|
| 567 | - 'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
| 568 | - 'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
| 569 | - 'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
| 570 | - 'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ), |
|
| 571 | - 'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
| 572 | - 'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))), |
|
| 573 | - 'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
| 574 | - 'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
| 575 | - 'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
| 576 | - 'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ) |
|
| 562 | + 'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
| 563 | + 'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
| 564 | + 'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
| 565 | + 'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
| 566 | + 'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'), |
|
| 567 | + 'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
| 568 | + 'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
| 569 | + 'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
| 570 | + 'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE), |
|
| 571 | + 'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
| 572 | + 'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))), |
|
| 573 | + 'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
| 574 | + 'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
| 575 | + 'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
| 576 | + 'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE) |
|
| 577 | 577 | ); |
| 578 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types ); |
|
| 579 | - $country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE ); |
|
| 578 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types); |
|
| 579 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE); |
|
| 580 | 580 | |
| 581 | - if ( defined( 'DOING_AJAX' )) { |
|
| 582 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
| 583 | - echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
| 581 | + if (defined('DOING_AJAX')) { |
|
| 582 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
| 583 | + echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
| 584 | 584 | die(); |
| 585 | 585 | } else { |
| 586 | 586 | return $country_details_settings; |
@@ -598,49 +598,49 @@ discard block |
||
| 598 | 598 | * @param string $CNT_ISO |
| 599 | 599 | * @return string |
| 600 | 600 | */ |
| 601 | - public function display_country_states( $CNT_ISO = '' ) { |
|
| 601 | + public function display_country_states($CNT_ISO = '') { |
|
| 602 | 602 | |
| 603 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO; |
|
| 603 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
| 604 | 604 | |
| 605 | - if ( ! $CNT_ISO ) { |
|
| 605 | + if ( ! $CNT_ISO) { |
|
| 606 | 606 | return ''; |
| 607 | 607 | } |
| 608 | 608 | // for ajax |
| 609 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
| 610 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
| 611 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 ); |
|
| 612 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 ); |
|
| 613 | - $states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO )); |
|
| 609 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
| 610 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
| 611 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
| 612 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
| 613 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
| 614 | 614 | |
| 615 | 615 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
| 616 | 616 | // global $wpdb; |
| 617 | 617 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
| 618 | 618 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 619 | - if ( $states ) { |
|
| 620 | - foreach ( $states as $STA_ID => $state ) { |
|
| 621 | - if ( $state instanceof EE_State ) { |
|
| 619 | + if ($states) { |
|
| 620 | + foreach ($states as $STA_ID => $state) { |
|
| 621 | + if ($state instanceof EE_State) { |
|
| 622 | 622 | //STA_abbrev STA_name STA_active |
| 623 | 623 | $state_input_types = array( |
| 624 | - 'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ), |
|
| 625 | - 'STA_name' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ), |
|
| 626 | - 'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true ) |
|
| 624 | + 'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'), |
|
| 625 | + 'STA_name' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'), |
|
| 626 | + 'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true) |
|
| 627 | 627 | ); |
| 628 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types ); |
|
| 629 | - $query_args = array( 'action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() ); |
|
| 630 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL ); |
|
| 628 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types); |
|
| 629 | + $query_args = array('action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev()); |
|
| 630 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL); |
|
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | 633 | } else { |
| 634 | 634 | $this->_template_args['states'] = FALSE; |
| 635 | 635 | } |
| 636 | 636 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 637 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ), GEN_SET_ADMIN_URL ); |
|
| 637 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL); |
|
| 638 | 638 | |
| 639 | - $state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE ); |
|
| 639 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE); |
|
| 640 | 640 | |
| 641 | - if ( defined( 'DOING_AJAX' )) { |
|
| 642 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
| 643 | - echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
| 641 | + if (defined('DOING_AJAX')) { |
|
| 642 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
| 643 | + echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
| 644 | 644 | die(); |
| 645 | 645 | } else { |
| 646 | 646 | return $state_details_settings; |
@@ -661,40 +661,39 @@ discard block |
||
| 661 | 661 | |
| 662 | 662 | $success = TRUE; |
| 663 | 663 | |
| 664 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
| 665 | - if ( ! $CNT_ISO ) { |
|
| 666 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 664 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
| 665 | + if ( ! $CNT_ISO) { |
|
| 666 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 667 | 667 | $success = FALSE; |
| 668 | 668 | } |
| 669 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
| 670 | - if ( ! $STA_abbrev ) { |
|
| 671 | - EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 669 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
| 670 | + if ( ! $STA_abbrev) { |
|
| 671 | + EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 672 | 672 | $success = FALSE; |
| 673 | 673 | } |
| 674 | - $STA_name = isset( $this->_req_data['STA_name'] ) ? sanitize_text_field( $this->_req_data['STA_name'] ) : |
|
| 675 | - FALSE; |
|
| 676 | - if ( ! $STA_name ) { |
|
| 677 | - EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 674 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE; |
|
| 675 | + if ( ! $STA_name) { |
|
| 676 | + EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 678 | 677 | $success = FALSE; |
| 679 | 678 | } |
| 680 | 679 | |
| 681 | - if ( $success ) { |
|
| 680 | + if ($success) { |
|
| 682 | 681 | $cols_n_values = array( |
| 683 | 682 | 'CNT_ISO' => $CNT_ISO, |
| 684 | 683 | 'STA_abbrev' => $STA_abbrev, |
| 685 | 684 | 'STA_name' => $STA_name, |
| 686 | 685 | 'STA_active' => TRUE |
| 687 | 686 | ); |
| 688 | - $success = EEM_State::instance()->insert ( $cols_n_values ); |
|
| 689 | - EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) ); |
|
| 687 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
| 688 | + EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
| 690 | 689 | } |
| 691 | 690 | |
| 692 | - if ( defined( 'DOING_AJAX' )) { |
|
| 693 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
| 694 | - echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) ); |
|
| 691 | + if (defined('DOING_AJAX')) { |
|
| 692 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
| 693 | + echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
| 695 | 694 | die(); |
| 696 | 695 | } else { |
| 697 | - $this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) ); |
|
| 696 | + $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
| 698 | 697 | } |
| 699 | 698 | } |
| 700 | 699 | |
@@ -707,25 +706,25 @@ discard block |
||
| 707 | 706 | * @return boolean | void |
| 708 | 707 | */ |
| 709 | 708 | public function delete_state() { |
| 710 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
| 711 | - $STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE; |
|
| 712 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
| 713 | - if ( ! $STA_ID ) { |
|
| 714 | - EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 709 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
| 710 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE; |
|
| 711 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
| 712 | + if ( ! $STA_ID) { |
|
| 713 | + EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 715 | 714 | return FALSE; |
| 716 | 715 | } |
| 717 | - $success = EEM_State::instance()->delete_by_ID( $STA_ID ); |
|
| 718 | - if ( $success !== FALSE ) { |
|
| 719 | - do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev )); |
|
| 720 | - EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' )); |
|
| 716 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
| 717 | + if ($success !== FALSE) { |
|
| 718 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev)); |
|
| 719 | + EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
| 721 | 720 | } |
| 722 | - if ( defined( 'DOING_AJAX' )) { |
|
| 723 | - $notices = EE_Error::get_notices( FALSE, FALSE ); |
|
| 721 | + if (defined('DOING_AJAX')) { |
|
| 722 | + $notices = EE_Error::get_notices(FALSE, FALSE); |
|
| 724 | 723 | $notices['return_data'] = TRUE; |
| 725 | - echo json_encode( $notices ); |
|
| 724 | + echo json_encode($notices); |
|
| 726 | 725 | die(); |
| 727 | 726 | } else { |
| 728 | - $this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) ); |
|
| 727 | + $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
| 729 | 728 | } |
| 730 | 729 | } |
| 731 | 730 | |
@@ -741,63 +740,63 @@ discard block |
||
| 741 | 740 | protected function _update_country_settings() { |
| 742 | 741 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 743 | 742 | // grab the country ISO code |
| 744 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE; |
|
| 745 | - if ( ! $CNT_ISO ) { |
|
| 746 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 743 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE; |
|
| 744 | + if ( ! $CNT_ISO) { |
|
| 745 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 747 | 746 | return; |
| 748 | 747 | } |
| 749 | 748 | $cols_n_values = array(); |
| 750 | - $cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE; |
|
| 751 | - $cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL; |
|
| 752 | - $cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL; |
|
| 753 | - $cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD'; |
|
| 754 | - $cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar'; |
|
| 755 | - $cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars'; |
|
| 756 | - $cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$'; |
|
| 757 | - $cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE; |
|
| 758 | - $cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2; |
|
| 759 | - $cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.'; |
|
| 760 | - $cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ','; |
|
| 761 | - $cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL; |
|
| 762 | - $cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE; |
|
| 763 | - $cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE; |
|
| 749 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE; |
|
| 750 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL; |
|
| 751 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL; |
|
| 752 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
| 753 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
| 754 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
| 755 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
| 756 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE; |
|
| 757 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
| 758 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
| 759 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
| 760 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL; |
|
| 761 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE; |
|
| 762 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE; |
|
| 764 | 763 | // allow filtering of country data |
| 765 | - $cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values ); |
|
| 764 | + $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values); |
|
| 766 | 765 | //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 767 | 766 | // where values |
| 768 | - $where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO )); |
|
| 767 | + $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
| 769 | 768 | // run the update |
| 770 | - $success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
| 769 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
| 771 | 770 | // global $wpdb; |
| 772 | 771 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
| 773 | 772 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
| 774 | - if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) { |
|
| 773 | + if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) { |
|
| 775 | 774 | // allow filtering of states data |
| 776 | - $states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] ); |
|
| 775 | + $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']); |
|
| 777 | 776 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 778 | 777 | // loop thru state data ( looks like : states[75][STA_name] ) |
| 779 | - foreach( $states as $STA_ID => $state ) { |
|
| 778 | + foreach ($states as $STA_ID => $state) { |
|
| 780 | 779 | $cols_n_values = array( |
| 781 | 780 | 'CNT_ISO' => $CNT_ISO, |
| 782 | - 'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ), |
|
| 783 | - 'STA_name' => sanitize_text_field( $state['STA_name'] ), |
|
| 784 | - 'STA_active' => (bool)absint( $state['STA_active'] ) |
|
| 781 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
| 782 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
| 783 | + 'STA_active' => (bool) absint($state['STA_active']) |
|
| 785 | 784 | ); |
| 786 | 785 | // where values |
| 787 | - $where_cols_n_values = array( array( 'STA_ID' => $STA_ID )); |
|
| 786 | + $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
| 788 | 787 | // run the update |
| 789 | - $success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
| 790 | - if ( $success !== FALSE ) { |
|
| 791 | - do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values ); |
|
| 788 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
| 789 | + if ($success !== FALSE) { |
|
| 790 | + do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values); |
|
| 792 | 791 | } |
| 793 | 792 | } |
| 794 | 793 | } |
| 795 | 794 | // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
| 796 | - if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) { |
|
| 797 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO ); |
|
| 795 | + if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
| 796 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
| 798 | 797 | EE_Registry::instance()->CFG->update_espresso_config(); |
| 799 | 798 | } |
| 800 | - $this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO )); |
|
| 799 | + $this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
| 801 | 800 | } |
| 802 | 801 | |
| 803 | 802 | |
@@ -811,11 +810,11 @@ discard block |
||
| 811 | 810 | * @param string $label |
| 812 | 811 | * @return string |
| 813 | 812 | */ |
| 814 | - public function country_form_field_label_wrap( $label, $required_text ) { |
|
| 813 | + public function country_form_field_label_wrap($label, $required_text) { |
|
| 815 | 814 | return ' |
| 816 | 815 | <tr> |
| 817 | 816 | <th> |
| 818 | - ' . $label . ' |
|
| 817 | + ' . $label.' |
|
| 819 | 818 | </th>'; |
| 820 | 819 | } |
| 821 | 820 | |
@@ -829,10 +828,10 @@ discard block |
||
| 829 | 828 | * @param string $label |
| 830 | 829 | * @return string |
| 831 | 830 | */ |
| 832 | - public function country_form_field_input__wrap( $input, $label ) { |
|
| 831 | + public function country_form_field_input__wrap($input, $label) { |
|
| 833 | 832 | return ' |
| 834 | 833 | <td class="general-settings-country-input-td"> |
| 835 | - ' . $input . ' |
|
| 834 | + ' . $input.' |
|
| 836 | 835 | </td> |
| 837 | 836 | </tr>'; |
| 838 | 837 | } |
@@ -848,7 +847,7 @@ discard block |
||
| 848 | 847 | * @param string $required_text |
| 849 | 848 | * @return string |
| 850 | 849 | */ |
| 851 | - public function state_form_field_label_wrap( $label, $required_text ) { |
|
| 850 | + public function state_form_field_label_wrap($label, $required_text) { |
|
| 852 | 851 | return $required_text; |
| 853 | 852 | } |
| 854 | 853 | |
@@ -862,10 +861,10 @@ discard block |
||
| 862 | 861 | * @param string $label |
| 863 | 862 | * @return string |
| 864 | 863 | */ |
| 865 | - public function state_form_field_input__wrap( $input, $label ) { |
|
| 864 | + public function state_form_field_input__wrap($input, $label) { |
|
| 866 | 865 | return ' |
| 867 | 866 | <td class="general-settings-country-state-input-td"> |
| 868 | - ' . $input . ' |
|
| 867 | + ' . $input.' |
|
| 869 | 868 | </td>'; |
| 870 | 869 | |
| 871 | 870 | } |
@@ -888,10 +887,10 @@ discard block |
||
| 888 | 887 | * @param int $ee_page_id |
| 889 | 888 | * @return string |
| 890 | 889 | */ |
| 891 | - public static function edit_view_links( $ee_page_id ) { |
|
| 892 | - $links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ), admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
| 890 | + public static function edit_view_links($ee_page_id) { |
|
| 891 | + $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; |
|
| 893 | 892 | $links .= ' | '; |
| 894 | - $links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
| 893 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; |
|
| 895 | 894 | return $links; |
| 896 | 895 | } |
| 897 | 896 | |
@@ -904,27 +903,27 @@ discard block |
||
| 904 | 903 | * @param WP page object $ee_page |
| 905 | 904 | * @return string |
| 906 | 905 | */ |
| 907 | - public static function page_and_shortcode_status( $ee_page, $shortcode ) { |
|
| 906 | + public static function page_and_shortcode_status($ee_page, $shortcode) { |
|
| 908 | 907 | |
| 909 | 908 | // page status |
| 910 | - if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') { |
|
| 909 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
| 911 | 910 | $pg_colour = 'green'; |
| 912 | - $pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), ' ' , ' ' ); |
|
| 911 | + $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
| 913 | 912 | } else { |
| 914 | 913 | $pg_colour = 'red'; |
| 915 | - $pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' ' ); |
|
| 914 | + $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
| 916 | 915 | } |
| 917 | 916 | |
| 918 | 917 | // shortcode status |
| 919 | - if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) { |
|
| 918 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) { |
|
| 920 | 919 | $sc_colour = 'green'; |
| 921 | - $sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), ' ' ); |
|
| 920 | + $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
| 922 | 921 | } else { |
| 923 | 922 | $sc_colour = 'red'; |
| 924 | - $sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), ' ' ); |
|
| 923 | + $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
| 925 | 924 | } |
| 926 | 925 | |
| 927 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
| 926 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>'; |
|
| 928 | 927 | |
| 929 | 928 | } |
| 930 | 929 | |
@@ -939,20 +938,20 @@ discard block |
||
| 939 | 938 | * @param unknown_type $level |
| 940 | 939 | * @return unknown |
| 941 | 940 | */ |
| 942 | - public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
|
| 941 | + public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) { |
|
| 943 | 942 | global $wpdb; |
| 944 | - $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) ); |
|
| 943 | + $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent)); |
|
| 945 | 944 | |
| 946 | - if ( $items ) { |
|
| 947 | - foreach ( $items as $item ) { |
|
| 948 | - $pad = str_repeat( ' ', $level * 3 ); |
|
| 949 | - if ( $item->ID == $default) |
|
| 945 | + if ($items) { |
|
| 946 | + foreach ($items as $item) { |
|
| 947 | + $pad = str_repeat(' ', $level * 3); |
|
| 948 | + if ($item->ID == $default) |
|
| 950 | 949 | $current = ' selected="selected"'; |
| 951 | 950 | else |
| 952 | 951 | $current = ''; |
| 953 | 952 | |
| 954 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
| 955 | - parent_dropdown( $default, $item->ID, $level +1 ); |
|
| 953 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>"; |
|
| 954 | + parent_dropdown($default, $item->ID, $level + 1); |
|
| 956 | 955 | } |
| 957 | 956 | } else { |
| 958 | 957 | return false; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public static function instance() { |
| 42 | 42 | // check if class object is instantiated |
| 43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
| 43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
| 44 | 44 | self::$_instance = new self(); |
| 45 | 45 | } |
| 46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
| 57 | 57 | // define global EE_Admin constants |
| 58 | 58 | $this->_define_all_constants(); |
| 59 | 59 | // set autoloaders for our admin page classes based on included path information |
| 60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
| 60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
| 61 | 61 | // admin hooks |
| 62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
| 62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
| 63 | 63 | // load EE_Request_Handler early |
| 64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
| 65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
| 64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
| 65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
| 66 | 66 | // post shortcode tracking |
| 67 | 67 | add_action( |
| 68 | 68 | 'AHEE__EE_System__initialize_last', |
| 69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
| 69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
| 70 | 70 | ); |
| 71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
| 72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
| 73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
| 74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
| 75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
| 76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
| 77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
| 78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
| 71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
| 72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
| 73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
| 74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
| 75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
| 76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
| 77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
| 78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
| 79 | 79 | |
| 80 | 80 | //reset Environment config (we only do this on admin page loads); |
| 81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
| 82 | 82 | |
| 83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
| 83 | + do_action('AHEE__EE_Admin__loaded'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | private function _define_all_constants() { |
| 98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
| 99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
| 100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
| 101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
| 102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
| 98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
| 99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
| 100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
| 101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
| 102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
| 112 | 112 | * @param string $plugin |
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
| 115 | + public function filter_plugin_actions($links, $plugin) { |
|
| 116 | 116 | // set $main_file in stone |
| 117 | 117 | static $main_file; |
| 118 | 118 | // if $main_file is not set yet |
| 119 | - if ( ! $main_file ) { |
|
| 120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
| 119 | + if ( ! $main_file) { |
|
| 120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
| 121 | 121 | } |
| 122 | - if ( $plugin === $main_file ) { |
|
| 122 | + if ($plugin === $main_file) { |
|
| 123 | 123 | // compare current plugin to this one |
| 124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
| 125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
| 126 | - array_unshift( $links, $maintenance_link ); |
|
| 124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
| 125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
| 126 | + array_unshift($links, $maintenance_link); |
|
| 127 | 127 | } else { |
| 128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
| 129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
| 128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
| 129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
| 130 | 130 | // add before other links |
| 131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
| 131 | + array_unshift($links, $org_settings_link, $events_link); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @return void |
| 144 | 144 | */ |
| 145 | 145 | public function get_request() { |
| 146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
| 147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
| 146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
| 147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | * @param array $admin_page_folder_names |
| 157 | 157 | * @return array |
| 158 | 158 | */ |
| 159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
| 159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
| 160 | 160 | return array( |
| 161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
| 162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
| 163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
| 161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
| 162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
| 163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
| 164 | 164 | ); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function init() { |
| 176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
| 177 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
| 177 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
| 178 | 178 | //ok so we want to enable the entire admin |
| 179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
| 180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
| 181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
| 179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
| 180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
| 181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
| 182 | 182 | //at a glance dashboard widget |
| 183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
| 183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
| 184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
| 185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
| 185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
| 186 | 186 | } |
| 187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
| 188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
| 188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
| 189 | 189 | try { |
| 190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
| 191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
| 192 | - } catch ( EE_Error $e ) { |
|
| 191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
| 192 | + } catch (EE_Error $e) { |
|
| 193 | 193 | $e->get_error(); |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
| 196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
| 197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
| 198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
| 199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
| 198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
| 199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
| 200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
| 201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
| 201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | * @param object $post_type WP post type object |
| 212 | 212 | * @return object WP post type object |
| 213 | 213 | */ |
| 214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
| 214 | + public function remove_pages_from_nav_menu($post_type) { |
|
| 215 | 215 | //if this isn't the "pages" post type let's get out |
| 216 | - if ( $post_type->name !== 'page' ) { |
|
| 216 | + if ($post_type->name !== 'page') { |
|
| 217 | 217 | return $post_type; |
| 218 | 218 | } |
| 219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
| 235 | 235 | global $wp_meta_boxes, $pagenow; |
| 236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
| 236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
| 237 | 237 | return; |
| 238 | 238 | } |
| 239 | 239 | $user = wp_get_current_user(); |
| 240 | 240 | //has this been done yet? |
| 241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
| 241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
| 242 | 242 | return; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
| 246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
| 245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
| 246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
| 247 | 247 | |
| 248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
| 249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
| 250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
| 251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
| 248 | + if (is_array($hidden_meta_boxes)) { |
|
| 249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
| 250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
| 251 | + unset($hidden_meta_boxes[$key]); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
| 257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
| 256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
| 257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @return void |
| 274 | 274 | */ |
| 275 | 275 | public function register_custom_nav_menu_boxes() { |
| 276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
| 276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | * |
| 290 | 290 | * @return string the (maybe) modified link |
| 291 | 291 | */ |
| 292 | - public function modify_edit_post_link( $link, $id ) { |
|
| 293 | - if ( ! $post = get_post( $id ) ){ |
|
| 292 | + public function modify_edit_post_link($link, $id) { |
|
| 293 | + if ( ! $post = get_post($id)) { |
|
| 294 | 294 | return $link; |
| 295 | 295 | } |
| 296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
| 296 | + if ($post->post_type === 'espresso_attendees') { |
|
| 297 | 297 | $query_args = array( |
| 298 | 298 | 'action' => 'edit_attendee', |
| 299 | 299 | 'post' => $id |
| 300 | 300 | ); |
| 301 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
| 301 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
| 302 | 302 | } |
| 303 | 303 | return $link; |
| 304 | 304 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | global $nav_menu_selected_id; |
| 311 | 311 | |
| 312 | 312 | $db_fields = false; |
| 313 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
| 313 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
| 314 | 314 | $current_tab = 'event-archives'; |
| 315 | 315 | |
| 316 | 316 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -329,9 +329,9 @@ discard block |
||
| 329 | 329 | ?> |
| 330 | 330 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
| 331 | 331 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
| 332 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
| 333 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
| 334 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
| 332 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
| 333 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
| 334 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
| 335 | 335 | </a> |
| 336 | 336 | </li> |
| 337 | 337 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -349,13 +349,13 @@ discard block |
||
| 349 | 349 | <?php */ ?> |
| 350 | 350 | |
| 351 | 351 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
| 352 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
| 352 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
| 353 | 353 | ?>"> |
| 354 | 354 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
| 355 | 355 | <?php |
| 356 | 356 | $pages = $this->_get_extra_nav_menu_pages_items(); |
| 357 | 357 | $args['walker'] = $walker; |
| 358 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
| 358 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
| 359 | 359 | ?> |
| 360 | 360 | </ul> |
| 361 | 361 | </div><!-- /.tabs-panel --> |
@@ -363,18 +363,18 @@ discard block |
||
| 363 | 363 | <p class="button-controls"> |
| 364 | 364 | <span class="list-controls"> |
| 365 | 365 | <a href="<?php |
| 366 | - echo esc_url( add_query_arg( |
|
| 366 | + echo esc_url(add_query_arg( |
|
| 367 | 367 | array( |
| 368 | 368 | 'extra-nav-menu-pages-tab' => 'event-archives', |
| 369 | 369 | 'selectall' => 1, |
| 370 | 370 | ), |
| 371 | - remove_query_arg( $removed_args ) |
|
| 371 | + remove_query_arg($removed_args) |
|
| 372 | 372 | )); |
| 373 | 373 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
| 374 | 374 | </span> |
| 375 | 375 | |
| 376 | 376 | <span class="add-to-menu"> |
| 377 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
| 377 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
| 378 | 378 | <span class="spinner"></span> |
| 379 | 379 | </span> |
| 380 | 380 | </p> |
@@ -395,10 +395,10 @@ discard block |
||
| 395 | 395 | private function _get_extra_nav_menu_pages_items() { |
| 396 | 396 | $menuitems[] = array( |
| 397 | 397 | 'title' => __('Event List', 'event_espresso'), |
| 398 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
| 398 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
| 399 | 399 | 'description' => __('Archive page for all events.', 'event_espresso') |
| 400 | 400 | ); |
| 401 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
| 401 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | * @param $menu_item_values |
| 411 | 411 | * @return stdClass |
| 412 | 412 | */ |
| 413 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
| 413 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
| 414 | 414 | $menu_item = new stdClass(); |
| 415 | 415 | $keys = array( |
| 416 | 416 | 'ID' => 0, |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | 'xfn' => '' |
| 431 | 431 | ); |
| 432 | 432 | |
| 433 | - foreach ( $keys as $key => $value) { |
|
| 434 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
| 433 | + foreach ($keys as $key => $value) { |
|
| 434 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
| 435 | 435 | } |
| 436 | 436 | return $menu_item; |
| 437 | 437 | } |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | * - check if doing post processing of one of EE CPTs |
| 471 | 471 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
| 472 | 472 | */ |
| 473 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
| 474 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
| 475 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
| 473 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
| 474 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
| 475 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | |
@@ -481,8 +481,8 @@ discard block |
||
| 481 | 481 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
| 482 | 482 | */ |
| 483 | 483 | global $pagenow; |
| 484 | - if ( $pagenow === 'options-reading.php' ) { |
|
| 485 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
| 484 | + if ($pagenow === 'options-reading.php') { |
|
| 485 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | } |
@@ -494,25 +494,25 @@ discard block |
||
| 494 | 494 | * @param string $output Current output. |
| 495 | 495 | * @return string |
| 496 | 496 | */ |
| 497 | - public function modify_dropdown_pages( $output ) { |
|
| 497 | + public function modify_dropdown_pages($output) { |
|
| 498 | 498 | //get critical pages |
| 499 | 499 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
| 500 | 500 | |
| 501 | 501 | //split current output by line break for easier parsing. |
| 502 | - $split_output = explode( "\n", $output ); |
|
| 502 | + $split_output = explode("\n", $output); |
|
| 503 | 503 | |
| 504 | 504 | //loop through to remove any critical pages from the array. |
| 505 | - foreach ( $critical_pages as $page_id ) { |
|
| 506 | - $needle = 'value="' . $page_id . '"'; |
|
| 507 | - foreach( $split_output as $key => $haystack ) { |
|
| 508 | - if( strpos( $haystack, $needle ) !== false ) { |
|
| 509 | - unset( $split_output[$key] ); |
|
| 505 | + foreach ($critical_pages as $page_id) { |
|
| 506 | + $needle = 'value="'.$page_id.'"'; |
|
| 507 | + foreach ($split_output as $key => $haystack) { |
|
| 508 | + if (strpos($haystack, $needle) !== false) { |
|
| 509 | + unset($split_output[$key]); |
|
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | //replace output with the new contents |
| 515 | - return implode( "\n", $split_output ); |
|
| 515 | + return implode("\n", $split_output); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | |
@@ -526,36 +526,36 @@ discard block |
||
| 526 | 526 | public function enqueue_admin_scripts() { |
| 527 | 527 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
| 528 | 528 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
| 529 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 529 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 530 | 530 | // register cookie script for future dependencies |
| 531 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
| 531 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
| 532 | 532 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
| 533 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
| 533 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
| 534 | 534 | // register jQuery Validate |
| 535 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
| 535 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
| 536 | 536 | } |
| 537 | 537 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
| 538 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
| 538 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
| 539 | 539 | //joyride style |
| 540 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
| 541 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
| 542 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
| 540 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
| 541 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
| 542 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
| 543 | 543 | //joyride JS |
| 544 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
| 544 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
| 545 | 545 | // wanna go for a joyride? |
| 546 | 546 | wp_enqueue_style('ee-joyride-css'); |
| 547 | 547 | wp_enqueue_script('jquery-joyride'); |
| 548 | 548 | } |
| 549 | 549 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
| 550 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
| 550 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
| 551 | 551 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
| 552 | 552 | } |
| 553 | 553 | //accounting.js library |
| 554 | 554 | // @link http://josscrowcroft.github.io/accounting.js/ |
| 555 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
| 556 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 557 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
| 558 | - wp_enqueue_script( 'ee-accounting' ); |
|
| 555 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
| 556 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 557 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
| 558 | + wp_enqueue_script('ee-accounting'); |
|
| 559 | 559 | // array of settings to get converted to JSON array via wp_localize_script |
| 560 | 560 | $currency_config = array( |
| 561 | 561 | 'currency' => array( |
@@ -602,11 +602,11 @@ discard block |
||
| 602 | 602 | public function get_persistent_admin_notices() { |
| 603 | 603 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
| 604 | 604 | $args = array( |
| 605 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
| 606 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
| 605 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
| 606 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
| 607 | 607 | ); |
| 608 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
| 609 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
| 608 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
| 609 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | |
@@ -627,26 +627,26 @@ discard block |
||
| 627 | 627 | * @param $elements |
| 628 | 628 | * @return array |
| 629 | 629 | */ |
| 630 | - public function dashboard_glance_items( $elements ) { |
|
| 630 | + public function dashboard_glance_items($elements) { |
|
| 631 | 631 | $events = EEM_Event::instance()->count(); |
| 632 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
| 633 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
| 632 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
| 633 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
| 634 | 634 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
| 635 | 635 | $registrations = EEM_Registration::instance()->count( |
| 636 | 636 | array( |
| 637 | 637 | array( |
| 638 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
| 638 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
| 639 | 639 | ) |
| 640 | 640 | ) |
| 641 | 641 | ); |
| 642 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
| 643 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
| 642 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
| 643 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
| 644 | 644 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
| 645 | 645 | |
| 646 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
| 646 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
| 647 | 647 | |
| 648 | - foreach ( $items as $type => $item_properties ) { |
|
| 649 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
| 648 | + foreach ($items as $type => $item_properties) { |
|
| 649 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
| 650 | 650 | } |
| 651 | 651 | return $elements; |
| 652 | 652 | } |
@@ -663,31 +663,31 @@ discard block |
||
| 663 | 663 | * @throws EE_Error |
| 664 | 664 | * @return string |
| 665 | 665 | */ |
| 666 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
| 666 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
| 667 | 667 | // check for date_format or time_format |
| 668 | - switch ( $option ) { |
|
| 668 | + switch ($option) { |
|
| 669 | 669 | case 'date_format' : |
| 670 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
| 670 | + $date_time_format = $value.' '.get_option('time_format'); |
|
| 671 | 671 | break; |
| 672 | 672 | case 'time_format' : |
| 673 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
| 673 | + $date_time_format = get_option('date_format').' '.$value; |
|
| 674 | 674 | break; |
| 675 | 675 | default : |
| 676 | 676 | $date_time_format = FALSE; |
| 677 | 677 | } |
| 678 | 678 | // do we have a date_time format to check ? |
| 679 | - if ( $date_time_format ) { |
|
| 680 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
| 679 | + if ($date_time_format) { |
|
| 680 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
| 681 | 681 | |
| 682 | - if ( is_array( $error_msg ) ) { |
|
| 683 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
| 682 | + if (is_array($error_msg)) { |
|
| 683 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
| 684 | 684 | |
| 685 | 685 | |
| 686 | - foreach ( $error_msg as $error ) { |
|
| 687 | - $msg .= '<li>' . $error . '</li>'; |
|
| 686 | + foreach ($error_msg as $error) { |
|
| 687 | + $msg .= '<li>'.$error.'</li>'; |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
| 690 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
| 691 | 691 | |
| 692 | 692 | // trigger WP settings error |
| 693 | 693 | add_settings_error( |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | ); |
| 698 | 698 | |
| 699 | 699 | // set format to something valid |
| 700 | - switch ( $option ) { |
|
| 700 | + switch ($option) { |
|
| 701 | 701 | case 'date_format' : |
| 702 | 702 | $value = 'F j, Y'; |
| 703 | 703 | break; |
@@ -719,8 +719,8 @@ discard block |
||
| 719 | 719 | * @param $content |
| 720 | 720 | * @return string |
| 721 | 721 | */ |
| 722 | - public function its_eSpresso( $content ) { |
|
| 723 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
| 722 | + public function its_eSpresso($content) { |
|
| 723 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | |
@@ -733,9 +733,9 @@ discard block |
||
| 733 | 733 | */ |
| 734 | 734 | public function espresso_admin_footer() { |
| 735 | 735 | return sprintf( |
| 736 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
| 736 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
| 737 | 737 | '<a href="https://eventespresso.com/" title="', |
| 738 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
| 738 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
| 739 | 739 | ); |
| 740 | 740 | } |
| 741 | 741 | |
@@ -755,12 +755,12 @@ discard block |
||
| 755 | 755 | * @param array $config |
| 756 | 756 | * @return void |
| 757 | 757 | */ |
| 758 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
| 759 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
| 760 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
| 758 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
| 759 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
| 760 | + if (class_exists('EE_Register_Admin_Page')) { |
|
| 761 | 761 | $config['page_path'] = $page_path; |
| 762 | 762 | } |
| 763 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
| 763 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
| 764 | 764 | |
| 765 | 765 | } |
| 766 | 766 | |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | * @param \WP_Post $post |
| 774 | 774 | * @return void |
| 775 | 775 | */ |
| 776 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
| 776 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
| 777 | 777 | EE_Error::doing_it_wrong( |
| 778 | 778 | __METHOD__, |
| 779 | 779 | __( |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | ), |
| 783 | 783 | '4.8.41' |
| 784 | 784 | ); |
| 785 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
| 785 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | * @param $value |
| 796 | 796 | * @return void |
| 797 | 797 | */ |
| 798 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
| 798 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
| 799 | 799 | EE_Error::doing_it_wrong( |
| 800 | 800 | __METHOD__, |
| 801 | 801 | __( |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | ), |
| 805 | 805 | '4.8.41' |
| 806 | 806 | ); |
| 807 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
| 807 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | } |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
| 171 | - * |
|
| 172 | - * @access public |
|
| 173 | - * @return void |
|
| 174 | - */ |
|
| 170 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
| 171 | + * |
|
| 172 | + * @access public |
|
| 173 | + * @return void |
|
| 174 | + */ |
|
| 175 | 175 | public function init() { |
| 176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
| 177 | 177 | if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
@@ -456,11 +456,11 @@ discard block |
||
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | - * admin_init |
|
| 460 | - * |
|
| 461 | - * @access public |
|
| 462 | - * @return void |
|
| 463 | - */ |
|
| 459 | + * admin_init |
|
| 460 | + * |
|
| 461 | + * @access public |
|
| 462 | + * @return void |
|
| 463 | + */ |
|
| 464 | 464 | public function admin_init() { |
| 465 | 465 | |
| 466 | 466 | /** |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | |
| 613 | 613 | |
| 614 | 614 | /** |
| 615 | - * dismiss_persistent_admin_notice |
|
| 616 | - * |
|
| 617 | - * @access public |
|
| 618 | - * @return void |
|
| 619 | - */ |
|
| 615 | + * dismiss_persistent_admin_notice |
|
| 616 | + * |
|
| 617 | + * @access public |
|
| 618 | + * @return void |
|
| 619 | + */ |
|
| 620 | 620 | public function dismiss_ee_nag_notice_callback() { |
| 621 | 621 | EE_Error::dismiss_persistent_admin_notice(); |
| 622 | 622 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
| 2 | 2 | /** |
| 3 | 3 | * Class EE_Select_Reveal_Input |
| 4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @since 4.6 |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
| 14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @param array $input_settings |
| 28 | 28 | */ |
| 29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
| 30 | - parent::__construct( $answer_options, $input_settings ); |
|
| 29 | + public function __construct($answer_options, $input_settings = array()) { |
|
| 30 | + parent::__construct($answer_options, $input_settings); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function sibling_sections_controlled() { |
| 38 | 38 | $sibling_sections = array(); |
| 39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
| 39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
| 40 | 40 | //if it's an empty string just leave it alone |
| 41 | - if( empty( $sibling_section_name ) ) { |
|
| 41 | + if (empty($sibling_section_name)) { |
|
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
| 45 | - if( |
|
| 44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
| 45 | + if ( |
|
| 46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
| 47 | - && ! empty( $sibling_section_name ) |
|
| 47 | + && ! empty($sibling_section_name) |
|
| 48 | 48 | ) { |
| 49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
| 49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | return $sibling_sections; |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | * @param array $form_other_js_data |
| 60 | 60 | * @return array |
| 61 | 61 | */ |
| 62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
| 63 | - $form_other_js_data = parent::get_other_js_data( $form_other_js_data ); |
|
| 64 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
| 65 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
| 62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
| 63 | + $form_other_js_data = parent::get_other_js_data($form_other_js_data); |
|
| 64 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
| 65 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
| 66 | 66 | } |
| 67 | 67 | $sibling_input_to_html_id_map = array(); |
| 68 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
| 69 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
| 68 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
| 69 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
| 70 | 70 | } |
| 71 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
| 71 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
| 72 | 72 | return $form_other_js_data; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | * @return string |
| 15 | 15 | */ |
| 16 | - public function layout_form_begin( $additional_args = array() ) { |
|
| 16 | + public function layout_form_begin($additional_args = array()) { |
|
| 17 | 17 | $this->_form_section->set_html_class('form-table'); |
| 18 | - return parent::layout_form_begin( $additional_args ); |
|
| 18 | + return parent::layout_form_begin($additional_args); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | * @param EE_Form_Section_Proper $form_section |
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | - public function layout_subsection( $form_section ){ |
|
| 29 | - if ( $form_section instanceof EE_Form_Section_Proper ) { |
|
| 30 | - return EEH_HTML::no_row( $form_section->get_html(), 2 ); |
|
| 31 | - } else if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
| 28 | + public function layout_subsection($form_section) { |
|
| 29 | + if ($form_section instanceof EE_Form_Section_Proper) { |
|
| 30 | + return EEH_HTML::no_row($form_section->get_html(), 2); |
|
| 31 | + } else if ($form_section instanceof EE_Form_Section_HTML) { |
|
| 32 | 32 | return $form_section->get_html(); |
| 33 | 33 | } |
| 34 | 34 | return ''; |
@@ -41,30 +41,30 @@ discard block |
||
| 41 | 41 | * @param EE_Form_Input_Base $input |
| 42 | 42 | * @return string |
| 43 | 43 | */ |
| 44 | - public function layout_input( $input ) { |
|
| 44 | + public function layout_input($input) { |
|
| 45 | 45 | |
| 46 | 46 | if ( |
| 47 | 47 | $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || |
| 48 | 48 | $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || |
| 49 | 49 | $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
| 50 | 50 | ) { |
| 51 | - $input->set_html_class( $input->html_class() . ' large-text' ); |
|
| 51 | + $input->set_html_class($input->html_class().' large-text'); |
|
| 52 | 52 | } |
| 53 | - if ( $input instanceof EE_Text_Area_Input ) { |
|
| 54 | - $input->set_rows( 4 ); |
|
| 55 | - $input->set_cols( 60 ); |
|
| 53 | + if ($input instanceof EE_Text_Area_Input) { |
|
| 54 | + $input->set_rows(4); |
|
| 55 | + $input->set_cols(60); |
|
| 56 | 56 | } |
| 57 | 57 | $input_html = $input->get_html_for_input(); |
| 58 | 58 | // maybe add errors and help text ? |
| 59 | - $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
| 60 | - $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
| 59 | + $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
| 60 | + $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
| 61 | 61 | //overriding parent to add wp admin specific things. |
| 62 | 62 | $html = ''; |
| 63 | - if ( $input instanceof EE_Hidden_Input ) { |
|
| 64 | - $html .= EEH_HTML::no_row( $input->get_html_for_input(), 2 ); |
|
| 63 | + if ($input instanceof EE_Hidden_Input) { |
|
| 64 | + $html .= EEH_HTML::no_row($input->get_html_for_input(), 2); |
|
| 65 | 65 | } else { |
| 66 | 66 | $html .= EEH_HTML::tr( |
| 67 | - EEH_HTML::th( $input->get_html_for_label(), '', '', '', 'scope="row"' ) . EEH_HTML::td( $input_html ) |
|
| 67 | + EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"').EEH_HTML::td($input_html) |
|
| 68 | 68 | ); |
| 69 | 69 | } |
| 70 | 70 | return $html; |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base{ |
|
| 3 | +class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base { |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
| 7 | 7 | * @param array $additional_args |
| 8 | 8 | * @return string |
| 9 | 9 | */ |
| 10 | - public function layout_form_begin( $additional_args = array() ) { |
|
| 11 | - return EEH_HTML::table( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ) . EEH_HTML::tbody(); |
|
| 10 | + public function layout_form_begin($additional_args = array()) { |
|
| 11 | + return EEH_HTML::table('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()).EEH_HTML::tbody(); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | * @param array $additional_args |
| 19 | 19 | * @return string |
| 20 | 20 | */ |
| 21 | - public function layout_form_end( $additional_args = array() ) { |
|
| 22 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex( $this->_form_section->html_id() ); |
|
| 21 | + public function layout_form_end($additional_args = array()) { |
|
| 22 | + return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id()); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | * @param EE_Form_Input_Base $input |
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | - public function layout_input( $input ) { |
|
| 32 | + public function layout_input($input) { |
|
| 33 | 33 | $html = ''; |
| 34 | - if ( $input instanceof EE_Hidden_Input ) { |
|
| 34 | + if ($input instanceof EE_Hidden_Input) { |
|
| 35 | 35 | $html .= $input->get_html_for_input(); |
| 36 | 36 | } else { |
| 37 | 37 | $html_for_input = $input->get_html_for_input(); |
| 38 | - $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
| 39 | - $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
| 38 | + $html_for_input .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
| 39 | + $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
| 40 | 40 | $html .= EEH_HTML::tr( |
| 41 | - EEH_HTML::th( $input->get_html_for_label() ) . |
|
| 42 | - EEH_HTML::td( $html_for_input ) |
|
| 41 | + EEH_HTML::th($input->get_html_for_label()). |
|
| 42 | + EEH_HTML::td($html_for_input) |
|
| 43 | 43 | ); |
| 44 | 44 | } |
| 45 | 45 | return $html; |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | * @param EE_Form_Section_Proper $form_section |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - public function layout_subsection( $form_section ){ |
|
| 55 | + public function layout_subsection($form_section) { |
|
| 56 | 56 | $html = ''; |
| 57 | - if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
| 57 | + if ($form_section instanceof EE_Form_Section_HTML) { |
|
| 58 | 58 | $html .= $form_section->get_html(); |
| 59 | 59 | } else { |
| 60 | 60 | $html .= EEH_HTML::tr( |
| 61 | - EEH_HTML::td( $form_section->get_html(), '', '', '', 'colspan="2"' ) |
|
| 61 | + EEH_HTML::td($form_section->get_html(), '', '', '', 'colspan="2"') |
|
| 62 | 62 | ); |
| 63 | 63 | } |
| 64 | 64 | return $html; |
@@ -26,31 +26,31 @@ discard block |
||
| 26 | 26 | * @param EE_Form_Input_Base $input |
| 27 | 27 | * @return string |
| 28 | 28 | */ |
| 29 | - public function layout_input( $input ) { |
|
| 29 | + public function layout_input($input) { |
|
| 30 | 30 | $html = ''; |
| 31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
| 32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
| 31 | + if ($input instanceof EE_Hidden_Input) { |
|
| 32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 33 | + } else if ($input instanceof EE_Submit_Input) { |
|
| 34 | 34 | $html .= EEH_HTML::br(); |
| 35 | 35 | $html .= $input->get_html_for_input(); |
| 36 | - } else if ( $input instanceof EE_Select_Input ) { |
|
| 36 | + } else if ($input instanceof EE_Select_Input) { |
|
| 37 | 37 | $html .= EEH_HTML::br(); |
| 38 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
| 39 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
| 40 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 41 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
| 38 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
| 39 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
| 40 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 41 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
| 42 | 42 | $html .= EEH_HTML::br(); |
| 43 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
| 43 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
| 44 | 44 | $html .= EEH_HTML::br(); |
| 45 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
| 46 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 47 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
| 45 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
| 46 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 47 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
| 48 | 48 | } else { |
| 49 | 49 | $html .= EEH_HTML::br(); |
| 50 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
| 51 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
| 52 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 53 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
| 50 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
| 51 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
| 52 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 53 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
| 54 | 54 | } |
| 55 | 55 | $html .= EEH_HTML::nl(-1); |
| 56 | 56 | return $html; |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | * @param EE_Form_Section_Proper $form_section |
| 64 | 64 | * @return string |
| 65 | 65 | */ |
| 66 | - public function layout_subsection( $form_section ){ |
|
| 66 | + public function layout_subsection($form_section) { |
|
| 67 | 67 | // d( $form_section ); |
| 68 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
| 68 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * closing div tag for a form |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - public function layout_form_end(){ |
|
| 76 | + public function layout_form_end() { |
|
| 77 | 77 | return EEH_HTML::nl(-1); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | \ No newline at end of file |
@@ -10,14 +10,14 @@ discard block |
||
| 10 | 10 | * @since 4.6.0 |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | -class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base{ |
|
| 13 | +class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base { |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * opening div tag for a form |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | 19 | public function layout_form_begin() { |
| 20 | - return EEH_HTML::div( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() ); |
|
| 20 | + return EEH_HTML::div('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style()); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -26,38 +26,38 @@ discard block |
||
| 26 | 26 | * @param EE_Form_Input_Base $input |
| 27 | 27 | * @return string |
| 28 | 28 | */ |
| 29 | - public function layout_input( $input ) { |
|
| 29 | + public function layout_input($input) { |
|
| 30 | 30 | $html = ''; |
| 31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
| 32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
| 34 | - $html .= EEH_HTML::div( $input->get_html_for_input(), $input->html_id() . '-submit-dv', $input->html_class() . '-submit-dv' ); |
|
| 35 | - } else if ( $input instanceof EE_Select_Input ) { |
|
| 31 | + if ($input instanceof EE_Hidden_Input) { |
|
| 32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 33 | + } else if ($input instanceof EE_Submit_Input) { |
|
| 34 | + $html .= EEH_HTML::div($input->get_html_for_input(), $input->html_id().'-submit-dv', $input->html_class().'-submit-dv'); |
|
| 35 | + } else if ($input instanceof EE_Select_Input) { |
|
| 36 | 36 | $html .= EEH_HTML::div( |
| 37 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
| 38 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
| 39 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
| 40 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
| 41 | - $input->html_id() . '-input-dv', |
|
| 42 | - $input->html_class() . '-input-dv' |
|
| 37 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
| 38 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
| 39 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
| 40 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
| 41 | + $input->html_id().'-input-dv', |
|
| 42 | + $input->html_class().'-input-dv' |
|
| 43 | 43 | ); |
| 44 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
| 44 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
| 45 | 45 | $html .= EEH_HTML::div( |
| 46 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question( $input ) . |
|
| 47 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
| 48 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
| 49 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
| 50 | - $input->html_id() . '-input-dv', |
|
| 51 | - $input->html_class() . '-input-dv' |
|
| 46 | + EEH_HTML::nl().$this->_display_label_for_option_type_question($input). |
|
| 47 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
| 48 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
| 49 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
| 50 | + $input->html_id().'-input-dv', |
|
| 51 | + $input->html_class().'-input-dv' |
|
| 52 | 52 | ); |
| 53 | 53 | } else { |
| 54 | 54 | $html .= EEH_HTML::div( |
| 55 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
| 56 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
| 57 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
| 58 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
| 59 | - $input->html_id() . '-input-dv', |
|
| 60 | - $input->html_class() . '-input-dv' |
|
| 55 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
| 56 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
| 57 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
| 58 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
| 59 | + $input->html_id().'-input-dv', |
|
| 60 | + $input->html_class().'-input-dv' |
|
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | 63 | return $html; |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | * @param EE_Form_Input_With_Options_Base $input |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - protected function _display_label_for_option_type_question( EE_Form_Input_With_Options_Base $input ){ |
|
| 78 | - if ( $input->display_html_label_text() != '' ) { |
|
| 79 | - $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class(); |
|
| 80 | - $label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
| 81 | - $html = '<div id="' . $input->html_label_id() . '"'; |
|
| 82 | - $html .= ' class="' . $class . '"'; |
|
| 83 | - $html .= ' style="' . $input->html_label_style() . '">'; |
|
| 84 | - $html .= $label_text . '</div>'; |
|
| 77 | + protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) { |
|
| 78 | + if ($input->display_html_label_text() != '') { |
|
| 79 | + $class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class(); |
|
| 80 | + $label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text(); |
|
| 81 | + $html = '<div id="'.$input->html_label_id().'"'; |
|
| 82 | + $html .= ' class="'.$class.'"'; |
|
| 83 | + $html .= ' style="'.$input->html_label_style().'">'; |
|
| 84 | + $html .= $label_text.'</div>'; |
|
| 85 | 85 | return $html; |
| 86 | 86 | } else { |
| 87 | 87 | return ''; |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | * @param EE_Form_Section_Proper $form_section |
| 96 | 96 | * @return string |
| 97 | 97 | */ |
| 98 | - public function layout_subsection( $form_section ){ |
|
| 98 | + public function layout_subsection($form_section) { |
|
| 99 | 99 | // d( $form_section ); |
| 100 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
| 100 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * closing div tag for a form |
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | - public function layout_form_end(){ |
|
| 109 | - return EEH_HTML::divx( $this->_form_section->html_id(), $this->_form_section->html_class() ); |
|
| 108 | + public function layout_form_end() { |
|
| 109 | + return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | \ No newline at end of file |