@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | // (all other times it gets resurrected from a wordpress option) |
15 | 15 | $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | -foreach($stages as $filepath){ |
|
17 | +foreach ($stages as $filepath) { |
|
18 | 18 | $matches = array(); |
19 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
19 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | 20 | $class_to_filepath[$matches[1]] = $filepath; |
21 | 21 | } |
22 | 22 | //give addons a chance to autoload their stages too |
23 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath); |
|
23 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
|
24 | 24 | EEH_Autoloader::register_autoloader($class_to_filepath); |
25 | 25 | |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @since 4.7.0 |
37 | 37 | * |
38 | 38 | */ |
39 | -class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{ |
|
39 | +class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base { |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * return EE_DMS_Core_4_7_0 |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | * @return bool |
59 | 59 | */ |
60 | 60 | public function can_migrate_from_version($version_array) { |
61 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
61 | + EE_Registry::instance()->load_helper('Activation'); |
|
62 | 62 | $version_string = $version_array['Core']; |
63 | 63 | if ( |
64 | - ( $version_string <= '4.7.0' && $version_string >= '4.6.0' ) |
|
64 | + ($version_string <= '4.7.0' && $version_string >= '4.6.0') |
|
65 | 65 | || |
66 | - ( $version_string >= '4.7.0' && |
|
67 | - ! EEH_Activation::table_exists( 'esp_registration_payment' ) && |
|
68 | - EEH_Activation::table_exists( 'esp_registration' ) ) ) { |
|
66 | + ($version_string >= '4.7.0' && |
|
67 | + ! EEH_Activation::table_exists('esp_registration_payment') && |
|
68 | + EEH_Activation::table_exists('esp_registration')) ) { |
|
69 | 69 | return true; |
70 | - } elseif ( ! $version_string ) { |
|
70 | + } elseif ( ! $version_string) { |
|
71 | 71 | //no version string provided... this must be pre 4.3 |
72 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
73 | 73 | } else { |
74 | 74 | return false; |
75 | 75 | } |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | 93 | //relies on 4.1's EEH_Activation::create_table |
94 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
95 | - $table_name='esp_answer'; |
|
96 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID INT UNSIGNED NOT NULL, |
98 | 98 | QST_ID INT UNSIGNED NOT NULL, |
99 | 99 | ANS_value TEXT NOT NULL, |
100 | 100 | PRIMARY KEY (ANS_ID), |
101 | 101 | KEY REG_ID (REG_ID), |
102 | 102 | KEY QST_ID (QST_ID)"; |
103 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
103 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | 104 | |
105 | 105 | $table_name = 'esp_attendee_meta'; |
106 | 106 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | CNT_is_EU TINYINT(1) DEFAULT '0', |
141 | 141 | CNT_active TINYINT(1) DEFAULT '0', |
142 | 142 | PRIMARY KEY (CNT_ISO)"; |
143 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
143 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | 144 | |
145 | 145 | $table_name = 'esp_currency'; |
146 | 146 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
151 | 151 | CUR_active TINYINT(1) DEFAULT '0', |
152 | 152 | PRIMARY KEY (CUR_code)"; |
153 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
153 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | $table_name = 'esp_currency_payment_method'; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | KEY EVT_ID (EVT_ID), |
181 | 181 | KEY DTT_is_primary (DTT_is_primary)"; |
182 | 182 | |
183 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
183 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | 184 | |
185 | 185 | $table_name = 'esp_event_meta'; |
186 | 186 | $sql = " |
@@ -199,44 +199,44 @@ discard block |
||
199 | 199 | EVT_donations TINYINT(1) NULL, |
200 | 200 | PRIMARY KEY (EVTM_ID), |
201 | 201 | KEY EVT_ID (EVT_ID)"; |
202 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
202 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | 203 | |
204 | 204 | |
205 | 205 | |
206 | - $table_name='esp_event_question_group'; |
|
207 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
206 | + $table_name = 'esp_event_question_group'; |
|
207 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
208 | 208 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
209 | 209 | QSG_ID INT UNSIGNED NOT NULL, |
210 | 210 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
211 | 211 | PRIMARY KEY (EQG_ID), |
212 | 212 | KEY EVT_ID (EVT_ID), |
213 | 213 | KEY QSG_ID (QSG_ID)"; |
214 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
214 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
215 | 215 | |
216 | 216 | |
217 | 217 | |
218 | - $table_name='esp_event_venue'; |
|
219 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
218 | + $table_name = 'esp_event_venue'; |
|
219 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
220 | 220 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
221 | 221 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
222 | 222 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
223 | 223 | PRIMARY KEY (EVV_ID)"; |
224 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
224 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | |
228 | - $table_name='esp_extra_meta'; |
|
229 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
228 | + $table_name = 'esp_extra_meta'; |
|
229 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
230 | 230 | OBJ_ID INT(11) DEFAULT NULL, |
231 | 231 | EXM_type VARCHAR(45) DEFAULT NULL, |
232 | 232 | EXM_key VARCHAR(45) DEFAULT NULL, |
233 | 233 | EXM_value TEXT, |
234 | 234 | PRIMARY KEY (EXM_ID), |
235 | 235 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
236 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
236 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
237 | 237 | |
238 | - $table_name='esp_line_item'; |
|
239 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
238 | + $table_name = 'esp_line_item'; |
|
239 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
240 | 240 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
241 | 241 | TXN_ID INT(11) DEFAULT NULL, |
242 | 242 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | PRIMARY KEY (LIN_ID), |
255 | 255 | KEY LIN_code (LIN_code(191)), |
256 | 256 | KEY TXN_ID (TXN_ID)"; |
257 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
257 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | 258 | |
259 | 259 | $table_name = 'esp_log'; |
260 | 260 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
295 | 295 | PRIMARY KEY (GRP_ID), |
296 | 296 | KEY MTP_user_id (MTP_user_id)"; |
297 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
297 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
298 | 298 | |
299 | 299 | $table_name = 'esp_event_message_template'; |
300 | 300 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | PRIMARY KEY (EMT_ID), |
304 | 304 | KEY EVT_ID (EVT_ID), |
305 | 305 | KEY GRP_ID (GRP_ID)"; |
306 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
306 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
307 | 307 | |
308 | 308 | |
309 | 309 | $table_name = 'esp_payment'; |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | PRIMARY KEY (TTM_ID)"; |
377 | 377 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
378 | 378 | |
379 | - $table_name='esp_question'; |
|
380 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
379 | + $table_name = 'esp_question'; |
|
380 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | 381 | QST_display_text TEXT NOT NULL, |
382 | 382 | QST_admin_label VARCHAR(255) NOT NULL, |
383 | 383 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -390,22 +390,22 @@ discard block |
||
390 | 390 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
391 | 391 | PRIMARY KEY (QST_ID), |
392 | 392 | KEY QST_order (QST_order)'; |
393 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
393 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
394 | 394 | |
395 | - $table_name='esp_question_group_question'; |
|
396 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
395 | + $table_name = 'esp_question_group_question'; |
|
396 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
397 | 397 | QSG_ID INT UNSIGNED NOT NULL, |
398 | 398 | QST_ID INT UNSIGNED NOT NULL, |
399 | 399 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
400 | 400 | PRIMARY KEY (QGQ_ID), |
401 | 401 | KEY QST_ID (QST_ID), |
402 | 402 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
403 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
403 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
404 | 404 | |
405 | 405 | |
406 | 406 | |
407 | - $table_name='esp_question_option'; |
|
408 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
407 | + $table_name = 'esp_question_option'; |
|
408 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
409 | 409 | QSO_value VARCHAR(255) NOT NULL, |
410 | 410 | QSO_desc TEXT NOT NULL, |
411 | 411 | QST_ID INT UNSIGNED NOT NULL, |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | PRIMARY KEY (QSO_ID), |
415 | 415 | KEY QST_ID (QST_ID), |
416 | 416 | KEY QSO_order (QSO_order)"; |
417 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
417 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | |
461 | 461 | |
462 | 462 | |
463 | - $table_name='esp_checkin'; |
|
464 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
463 | + $table_name = 'esp_checkin'; |
|
464 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
465 | 465 | REG_ID INT(10) UNSIGNED NOT NULL, |
466 | 466 | DTT_ID INT(10) UNSIGNED NOT NULL, |
467 | 467 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
557 | 557 | PRIMARY KEY (PRC_ID), |
558 | 558 | KEY PRT_ID (PRT_ID)"; |
559 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
559 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
560 | 560 | |
561 | 561 | $table_name = "esp_price_type"; |
562 | 562 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -594,10 +594,10 @@ discard block |
||
594 | 594 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
595 | 595 | PRIMARY KEY (TKT_ID), |
596 | 596 | KEY TKT_start_date (TKT_start_date)"; |
597 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
597 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
598 | 598 | |
599 | 599 | $table_name = 'esp_question_group'; |
600 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
600 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
601 | 601 | QSG_name VARCHAR(255) NOT NULL, |
602 | 602 | QSG_identifier VARCHAR(100) NOT NULL, |
603 | 603 | QSG_desc TEXT NULL, |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | PRIMARY KEY (QSG_ID), |
611 | 611 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC), |
612 | 612 | KEY QSG_order (QSG_order)'; |
613 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
613 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
614 | 614 | |
615 | 615 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
616 | 616 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | return true; |
643 | 643 | } |
644 | 644 | |
645 | - public function migration_page_hooks(){ |
|
645 | + public function migration_page_hooks() { |
|
646 | 646 | |
647 | 647 | } |
648 | 648 |
@@ -116,7 +116,7 @@ |
||
116 | 116 | * @access public |
117 | 117 | * @param EE_Template_Config $CFG |
118 | 118 | * @param array $REQ |
119 | - * @return EE_Event_Single_Config |
|
119 | + * @return EE_Template_Config |
|
120 | 120 | */ |
121 | 121 | public static function update_template_settings( $CFG, $REQ ) { |
122 | 122 | $display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Event_Single_Caff |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -50,34 +50,34 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | public static function set_hooks_admin() { |
53 | - define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
54 | - define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
53 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
54 | + define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
55 | 55 | add_action( |
56 | 56 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings', |
57 | - array( 'EED_Event_Single_Caff', 'load_scripts_styles' ), |
|
57 | + array('EED_Event_Single_Caff', 'load_scripts_styles'), |
|
58 | 58 | 10 |
59 | 59 | ); |
60 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 ); |
|
61 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 ); |
|
60 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10); |
|
61 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2); |
|
62 | 62 | // AJAX |
63 | - add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
64 | - add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
63 | + add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
64 | + add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | public static function load_scripts_styles() { |
71 | - add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 ); |
|
71 | + add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | 76 | public static function enqueue_scripts_styles() { |
77 | - wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION ); |
|
78 | - wp_enqueue_style( 'eed-event-single-sortable' ); |
|
79 | - wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true ); |
|
80 | - wp_enqueue_script( 'eed-event-single-sortable' ); |
|
77 | + wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION); |
|
78 | + wp_enqueue_style('eed-event-single-sortable'); |
|
79 | + wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
80 | + wp_enqueue_script('eed-event-single-sortable'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function template_settings_form() { |
93 | 93 | $config = EE_Registry::instance()->CFG->template_settings; |
94 | - $config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false; |
|
96 | - $config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config ); |
|
94 | + $config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
96 | + $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
|
97 | 97 | |
98 | 98 | $event_single_order_array = array(); |
99 | - $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
100 | - $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
101 | - $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
102 | - $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
99 | + $event_single_order_array[$config->display_order_tickets] = 'tickets'; |
|
100 | + $event_single_order_array[$config->display_order_datetimes] = 'datetimes'; |
|
101 | + $event_single_order_array[$config->display_order_event] = 'event'; |
|
102 | + $event_single_order_array[$config->display_order_venue] = 'venue'; |
|
103 | 103 | // get template parts |
104 | - $template_parts = EED_Event_Single::instance()->initialize_template_parts( $config ); |
|
104 | + $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
|
105 | 105 | // convert to array so that we can add more properties |
106 | - $config = get_object_vars( $config ); |
|
107 | - $config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' ); |
|
108 | - EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config ); |
|
106 | + $config = get_object_vars($config); |
|
107 | + $config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js'); |
|
108 | + EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param array $REQ |
119 | 119 | * @return EE_Event_Single_Config |
120 | 120 | */ |
121 | - public static function update_template_settings( $CFG, $REQ ) { |
|
122 | - $display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | - $display_order_datetimes = isset( $CFG->EED_Event_Single->display_order_datetimes ) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | - $display_order_event = isset( $CFG->EED_Event_Single->display_order_event ) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | - $display_order_venue = isset( $CFG->EED_Event_Single->display_order_venue ) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
121 | + public static function update_template_settings($CFG, $REQ) { |
|
122 | + $display_order_tickets = isset($CFG->EED_Event_Single->display_order_tickets) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | + $display_order_datetimes = isset($CFG->EED_Event_Single->display_order_datetimes) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | + $display_order_event = isset($CFG->EED_Event_Single->display_order_event) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | + $display_order_venue = isset($CFG->EED_Event_Single->display_order_venue) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
126 | 126 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
127 | - $CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | - $CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | - $CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) : 0; |
|
127 | + $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | + $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | + $CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) ? absint($REQ['EED_Events_Single_use_sortable_display_order']) : 0; |
|
130 | 130 | $CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_tickets : 100; |
131 | 131 | $CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_datetimes : 110; |
132 | 132 | $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_event : 120; |
133 | 133 | $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_venue : 130; |
134 | - do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ ); |
|
134 | + do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ); |
|
135 | 135 | return $CFG; |
136 | 136 | } |
137 | 137 | |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public static function update_event_single_order() { |
147 | 147 | $config_saved = false; |
148 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
149 | - if ( ! empty( $template_parts ) ) { |
|
150 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
151 | - foreach ( $template_parts as $key => $template_part ) { |
|
148 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
149 | + if ( ! empty($template_parts)) { |
|
150 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
151 | + foreach ($template_parts as $key => $template_part) { |
|
152 | 152 | $template_part = "display_order_$template_part"; |
153 | - $priority = ( $key * 10 ) + 100; |
|
153 | + $priority = ($key * 10) + 100; |
|
154 | 154 | EE_Registry::instance()->CFG->template_settings->EED_Event_Single->$template_part = $priority; |
155 | - do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority ); |
|
155 | + do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority); |
|
156 | 156 | } |
157 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
157 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
158 | 158 | } |
159 | - if ( $config_saved ) { |
|
160 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
159 | + if ($config_saved) { |
|
160 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
161 | 161 | } else { |
162 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
162 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
163 | 163 | } |
164 | - echo wp_json_encode( EE_Error::get_notices( false )); |
|
164 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
165 | 165 | exit(); |
166 | 166 | } |
167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param WP $WP |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function run( $WP ) { |
|
177 | + public function run($WP) { |
|
178 | 178 | } |
179 | 179 | |
180 | 180 |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * @access public |
124 | 124 | * @param EE_Template_Config $CFG |
125 | 125 | * @param array $REQ |
126 | - * @return EE_Events_Archive_Config |
|
126 | + * @return EE_Template_Config |
|
127 | 127 | */ |
128 | 128 | public static function update_template_settings( $CFG, $REQ ) { |
129 | 129 | $config = new EE_Events_Archive_Config(); |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EED_Events_Archive_Caff |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /modules/events_archive_caff/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EED_Events_Archive_Caff |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /modules/events_archive_caff/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EED_Events_Archive_Caff extends EED_Events_Archive { |
25 | 25 | |
26 | 26 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
54 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
55 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
54 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
55 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
56 | 56 | // AJAX |
57 | - add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
58 | - add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
57 | + add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
58 | + add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param WP $WP |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function run( $WP ) { |
|
71 | + public function run($WP) { |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,33 +83,33 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function template_settings_form() { |
85 | 85 | // grab general settings admin page and remove the existing hook callback |
86 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
87 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
88 | - remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 ); |
|
86 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
87 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
88 | + remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); |
|
89 | 89 | } |
90 | 90 | // first just grab the template settings |
91 | 91 | $config = EE_Registry::instance()->CFG->template_settings; |
92 | 92 | // then if the Event Archive config is valid, use that, else create a new one |
93 | - $config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | - $config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config ); |
|
95 | - $config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0; |
|
96 | - $config->display_description = isset( $config->display_description ) ? $config->display_description : 1; |
|
97 | - $config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0; |
|
98 | - $config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1; |
|
99 | - $config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0; |
|
100 | - $config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0; |
|
93 | + $config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | + $config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config); |
|
95 | + $config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0; |
|
96 | + $config->display_description = isset($config->display_description) ? $config->display_description : 1; |
|
97 | + $config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0; |
|
98 | + $config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1; |
|
99 | + $config->display_venue = isset($config->display_venue) ? $config->display_venue : 0; |
|
100 | + $config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0; |
|
101 | 101 | // display order options |
102 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order )? $config->use_sortable_display_order : false; |
|
103 | - $config->display_order_tickets = isset( $config->display_order_tickets )? $config->display_order_tickets : 100; |
|
104 | - $config->display_order_datetimes = isset( $config->display_order_datetimes )? $config->display_order_datetimes : 110; |
|
105 | - $config->display_order_event = isset( $config->display_order_event )? $config->display_order_event : 120; |
|
106 | - $config->display_order_venue = isset( $config->display_order_venue )? $config->display_order_venue : 130; |
|
102 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
103 | + $config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100; |
|
104 | + $config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110; |
|
105 | + $config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120; |
|
106 | + $config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130; |
|
107 | 107 | // get template parts |
108 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config ); |
|
108 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
109 | 109 | // convert to array so that we can add more properties |
110 | - $config = get_object_vars( $config ); |
|
111 | - $config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' ); |
|
112 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config ); |
|
110 | + $config = get_object_vars($config); |
|
111 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js'); |
|
112 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | * @param array $REQ |
126 | 126 | * @return EE_Events_Archive_Config |
127 | 127 | */ |
128 | - public static function update_template_settings( $CFG, $REQ ) { |
|
128 | + public static function update_template_settings($CFG, $REQ) { |
|
129 | 129 | $config = new EE_Events_Archive_Config(); |
130 | 130 | // unless we are resetting the config... |
131 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
132 | - $config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
133 | - $config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
134 | - $config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
135 | - $config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
136 | - $config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
137 | - $config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; |
|
138 | - $config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0; |
|
139 | - $config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | - $config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | - $config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | - $config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
131 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
132 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
133 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
134 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
135 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
136 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
137 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
138 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0; |
|
139 | + $config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | + $config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | + $config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | + $config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
143 | 143 | } |
144 | 144 | $CFG->EED_Events_Archive = $config; |
145 | - do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ ); |
|
145 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
146 | 146 | return $CFG; |
147 | 147 | } |
148 | 148 | |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function update_event_archive_order() { |
158 | 158 | $config_saved = false; |
159 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
160 | - if ( ! empty( $template_parts ) ) { |
|
161 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
162 | - foreach ( $template_parts as $key => $template_part ) { |
|
159 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
160 | + if ( ! empty($template_parts)) { |
|
161 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
162 | + foreach ($template_parts as $key => $template_part) { |
|
163 | 163 | $template_part = "display_order_$template_part"; |
164 | - $priority = ( $key * 10 ) + 100; |
|
164 | + $priority = ($key * 10) + 100; |
|
165 | 165 | if ( |
166 | 166 | property_exists( |
167 | 167 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive, |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ) { |
171 | 171 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->$template_part = $priority; |
172 | 172 | } |
173 | - do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority ); |
|
173 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
174 | 174 | } |
175 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
175 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
176 | 176 | } |
177 | - if ( $config_saved ) { |
|
178 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
177 | + if ($config_saved) { |
|
178 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
179 | 179 | } else { |
180 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
180 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
181 | 181 | } |
182 | - echo wp_json_encode( EE_Error::get_notices( false ) ); |
|
182 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
183 | 183 | exit(); |
184 | 184 | } |
185 | 185 |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | /** |
253 | 253 | * returns true if ANY reg status was updated during checkout |
254 | - * @return array |
|
254 | + * @return boolean |
|
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | /** |
278 | 278 | * @param $REG_ID |
279 | - * @param $reg_status |
|
279 | + * @param boolean $reg_status |
|
280 | 280 | */ |
281 | 281 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
282 | 282 | $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | * reset_reg_steps |
621 | 621 | * |
622 | 622 | * @access public |
623 | - * @return bool |
|
623 | + * @return boolean|null |
|
624 | 624 | */ |
625 | 625 | public function reset_reg_steps() { |
626 | 626 | $this->sort_reg_steps(); |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * stores whether any updates were made to the TXN or it's related registrations |
734 | 734 | * |
735 | 735 | * @access public |
736 | - * @return bool |
|
736 | + * @return boolean|null |
|
737 | 737 | */ |
738 | 738 | public function track_transaction_and_registration_status_updates() { |
739 | 739 | // verify the transaction |
@@ -1081,6 +1081,7 @@ discard block |
||
1081 | 1081 | * |
1082 | 1082 | * @param string | int $reg_cache_ID |
1083 | 1083 | * @param EE_Registration $registration |
1084 | + * @param integer $reg_cache_ID |
|
1084 | 1085 | * @return void |
1085 | 1086 | */ |
1086 | 1087 | protected function _refresh_registration( $reg_cache_ID, $registration ) { |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @param $REG_ID |
269 | 269 | * @return array |
270 | 270 | */ |
271 | - public function reg_status_updated( $REG_ID ) { |
|
272 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
271 | + public function reg_status_updated($REG_ID) { |
|
272 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | * @param $REG_ID |
279 | 279 | * @param $reg_status |
280 | 280 | */ |
281 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
282 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
281 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
282 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * can ONLY be set by the Finalize_Registration reg step |
301 | 301 | */ |
302 | 302 | public function set_exit_spco() { |
303 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
303 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
304 | 304 | $this->exit_spco = true; |
305 | 305 | } |
306 | 306 | } |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function reset_for_current_request() { |
319 | 319 | $this->process_form_submission = FALSE; |
320 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
320 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
321 | 321 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
322 | 322 | $this->continue_reg = true; |
323 | 323 | $this->redirect = false; |
324 | 324 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
325 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
325 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
326 | 326 | $this->redirect_form = ''; |
327 | 327 | } |
328 | 328 | $this->redirect_url = ''; |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_SPCO_Reg_Step $reg_step_obj |
340 | 340 | * @return void |
341 | 341 | */ |
342 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
343 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
342 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
343 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -356,14 +356,14 @@ discard block |
||
356 | 356 | * @param string $reg_step_slug |
357 | 357 | * @return void |
358 | 358 | */ |
359 | - public function skip_reg_step( $reg_step_slug = '' ) { |
|
360 | - $step_to_skip = $this->find_reg_step( $reg_step_slug ); |
|
361 | - if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) { |
|
359 | + public function skip_reg_step($reg_step_slug = '') { |
|
360 | + $step_to_skip = $this->find_reg_step($reg_step_slug); |
|
361 | + if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) { |
|
362 | 362 | // advance to the next step |
363 | - $this->set_current_step( $this->next_step->slug() ); |
|
364 | - $step_to_skip->set_is_current_step( false ); |
|
363 | + $this->set_current_step($this->next_step->slug()); |
|
364 | + $step_to_skip->set_is_current_step(false); |
|
365 | 365 | $step_to_skip->set_completed(); |
366 | - $this->set_reg_step_initiated( $this->current_step ); |
|
366 | + $this->set_reg_step_initiated($this->current_step); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
@@ -377,16 +377,16 @@ discard block |
||
377 | 377 | * @param bool $reset whether to reset reg steps after removal |
378 | 378 | * @throws EE_Error |
379 | 379 | */ |
380 | - public function remove_reg_step( $reg_step_slug = '', $reset = true ) { |
|
381 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
382 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
380 | + public function remove_reg_step($reg_step_slug = '', $reset = true) { |
|
381 | + unset($this->reg_steps[$reg_step_slug]); |
|
382 | + if ($this->transaction instanceof EE_Transaction) { |
|
383 | 383 | /** @type EE_Transaction_Processor $transaction_processor */ |
384 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
384 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
385 | 385 | // now remove reg step from TXN and save |
386 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
386 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
387 | 387 | $this->transaction->save(); |
388 | 388 | } |
389 | - if ( $reset ) { |
|
389 | + if ($reset) { |
|
390 | 390 | $this->reset_reg_steps(); |
391 | 391 | } |
392 | 392 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | * @param int $order |
402 | 402 | * @return void |
403 | 403 | */ |
404 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
405 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
406 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
404 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
405 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
406 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | |
@@ -416,25 +416,25 @@ discard block |
||
416 | 416 | * @param string $current_step |
417 | 417 | * @return void |
418 | 418 | */ |
419 | - public function set_current_step( $current_step ) { |
|
419 | + public function set_current_step($current_step) { |
|
420 | 420 | // grab what step we're on |
421 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
421 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
422 | 422 | // verify instance |
423 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
423 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
424 | 424 | // we don't want to repeat completed steps if this is the first time through SPCO |
425 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
425 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
426 | 426 | // so advance to the next step |
427 | 427 | $this->set_next_step(); |
428 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
428 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
429 | 429 | // and attempt to set it as the current step |
430 | - $this->set_current_step( $this->next_step->slug() ); |
|
430 | + $this->set_current_step($this->next_step->slug()); |
|
431 | 431 | } |
432 | 432 | return; |
433 | 433 | } |
434 | - $this->current_step->set_is_current_step( TRUE ); |
|
434 | + $this->current_step->set_is_current_step(TRUE); |
|
435 | 435 | } else { |
436 | 436 | EE_Error::add_error( |
437 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
437 | + __('The current step could not be set.', 'event_espresso'), |
|
438 | 438 | __FILE__, __FUNCTION__, __LINE__ |
439 | 439 | ); |
440 | 440 | } |
@@ -451,20 +451,20 @@ discard block |
||
451 | 451 | */ |
452 | 452 | public function set_next_step() { |
453 | 453 | // set pointer to start of array |
454 | - reset( $this->reg_steps ); |
|
454 | + reset($this->reg_steps); |
|
455 | 455 | // if there is more than one step |
456 | - if ( count( $this->reg_steps ) > 1 ) { |
|
456 | + if (count($this->reg_steps) > 1) { |
|
457 | 457 | // advance to the current step and set pointer |
458 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
459 | - next( $this->reg_steps ); |
|
458 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
459 | + next($this->reg_steps); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | // advance one more spot ( if it exists ) |
463 | - $this->next_step = next( $this->reg_steps ); |
|
463 | + $this->next_step = next($this->reg_steps); |
|
464 | 464 | // verify instance |
465 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
465 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
466 | 466 | // then back to current step to reset |
467 | - prev( $this->reg_steps ); |
|
467 | + prev($this->reg_steps); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @return EE_SPCO_Reg_Step | null |
479 | 479 | */ |
480 | 480 | public function get_next_reg_step() { |
481 | - $next = next( $this->reg_steps ); |
|
482 | - prev( $this->reg_steps ); |
|
481 | + $next = next($this->reg_steps); |
|
482 | + prev($this->reg_steps); |
|
483 | 483 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
484 | 484 | } |
485 | 485 | |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | * @return EE_SPCO_Reg_Step | null |
495 | 495 | */ |
496 | 496 | public function get_prev_reg_step() { |
497 | - $prev = prev( $this->reg_steps ); |
|
498 | - next( $this->reg_steps ); |
|
497 | + $prev = prev($this->reg_steps); |
|
498 | + next($this->reg_steps); |
|
499 | 499 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
500 | 500 | } |
501 | 501 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | public function sort_reg_steps() { |
511 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
512 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
511 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
512 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | |
@@ -522,19 +522,19 @@ discard block |
||
522 | 522 | * @param string $reg_step_slug |
523 | 523 | * @return EE_SPCO_Reg_Step|null |
524 | 524 | */ |
525 | - public function find_reg_step( $reg_step_slug = '' ) { |
|
526 | - if ( ! empty( $reg_step_slug ) ) { |
|
525 | + public function find_reg_step($reg_step_slug = '') { |
|
526 | + if ( ! empty($reg_step_slug)) { |
|
527 | 527 | // copy reg step array |
528 | 528 | $reg_steps = $this->reg_steps; |
529 | 529 | // set pointer to start of array |
530 | - reset( $reg_steps ); |
|
530 | + reset($reg_steps); |
|
531 | 531 | // if there is more than one step |
532 | - if ( count( $reg_steps ) > 1 ) { |
|
532 | + if (count($reg_steps) > 1) { |
|
533 | 533 | // advance to the current step and set pointer |
534 | - while ( key( $reg_steps ) != $reg_step_slug && key( $reg_steps ) != '' ) { |
|
535 | - next( $reg_steps ); |
|
534 | + while (key($reg_steps) != $reg_step_slug && key($reg_steps) != '') { |
|
535 | + next($reg_steps); |
|
536 | 536 | } |
537 | - return current( $reg_steps ); |
|
537 | + return current($reg_steps); |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | return null; |
@@ -550,17 +550,17 @@ discard block |
||
550 | 550 | * @param EE_SPCO_Reg_Step $reg_step_B |
551 | 551 | * @return array() |
552 | 552 | */ |
553 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
553 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
554 | 554 | // send finalize_registration step to the end of the array |
555 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
555 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
556 | 556 | return 1; |
557 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
557 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
558 | 558 | return -1; |
559 | 559 | } |
560 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
560 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
561 | 561 | return 0; |
562 | 562 | } |
563 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
563 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * @access public |
572 | 572 | * @param EE_SPCO_Reg_Step $reg_step |
573 | 573 | */ |
574 | - public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) { |
|
574 | + public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) { |
|
575 | 575 | // call set_reg_step_initiated ??? |
576 | 576 | if ( |
577 | 577 | // first time visiting SPCO ? |
@@ -580,13 +580,13 @@ discard block |
||
580 | 580 | && $this->action === 'display_spco_reg_step' |
581 | 581 | ) { |
582 | 582 | /** @type EE_Transaction_Processor $transaction_processor */ |
583 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
583 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
584 | 584 | // set the start time for this reg step |
585 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->transaction, $reg_step->slug() ) ) { |
|
586 | - if ( WP_DEBUG ) { |
|
585 | + if ( ! $transaction_processor->set_reg_step_initiated($this->transaction, $reg_step->slug())) { |
|
586 | + if (WP_DEBUG) { |
|
587 | 587 | EE_Error::add_error( |
588 | 588 | sprintf( |
589 | - __( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), |
|
589 | + __('The "%1$s" registration step was not initialized properly.', 'event_espresso'), |
|
590 | 590 | $reg_step->name() |
591 | 591 | ), |
592 | 592 | __FILE__, __FUNCTION__, __LINE__ |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function set_reg_step_JSON_info() { |
608 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
608 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
609 | 609 | // pass basic reg step data to JS |
610 | - foreach ( $this->reg_steps as $reg_step ) { |
|
611 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
610 | + foreach ($this->reg_steps as $reg_step) { |
|
611 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
612 | 612 | } |
613 | 613 | // reset reg step html |
614 | 614 | // $this->json_response->set_reg_step_html( '' ); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function reset_reg_steps() { |
626 | 626 | $this->sort_reg_steps(); |
627 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
627 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
628 | 628 | $this->set_next_step(); |
629 | 629 | // the text that appears on the reg step form submit button |
630 | 630 | $this->current_step->set_submit_button_text(); |
@@ -641,9 +641,9 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public function get_registration_time_limit() { |
643 | 643 | |
644 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
644 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
645 | 645 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
646 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
646 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
647 | 647 | return apply_filters( |
648 | 648 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
649 | 649 | $registration_time_limit |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | // overpaid TXN |
664 | 664 | // free TXN ( total = 0.00 ) |
665 | 665 | // then payment required is TRUE |
666 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
666 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -676,8 +676,8 @@ discard block |
||
676 | 676 | */ |
677 | 677 | public function initialize_txn_reg_steps_array() { |
678 | 678 | $txn_reg_steps_array = array(); |
679 | - foreach ( $this->reg_steps as $reg_step ) { |
|
680 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
679 | + foreach ($this->reg_steps as $reg_step) { |
|
680 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
681 | 681 | } |
682 | 682 | return $txn_reg_steps_array; |
683 | 683 | } |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | public function update_txn_reg_steps_array() { |
694 | 694 | $updated = FALSE; |
695 | 695 | /** @type EE_Transaction_Processor $transaction_processor */ |
696 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
697 | - foreach ( $this->reg_steps as $reg_step ) { |
|
698 | - if ( $reg_step->completed() ) { |
|
699 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
696 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
697 | + foreach ($this->reg_steps as $reg_step) { |
|
698 | + if ($reg_step->completed()) { |
|
699 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
700 | 700 | } |
701 | 701 | } |
702 | - if ( $updated ) { |
|
702 | + if ($updated) { |
|
703 | 703 | $this->transaction->save(); |
704 | 704 | } |
705 | 705 | return $updated; |
@@ -714,14 +714,14 @@ discard block |
||
714 | 714 | * @return void |
715 | 715 | */ |
716 | 716 | public function stash_transaction_and_checkout() { |
717 | - if ( ! $this->revisit ) { |
|
717 | + if ( ! $this->revisit) { |
|
718 | 718 | $this->update_txn_reg_steps_array(); |
719 | 719 | } |
720 | 720 | $this->track_transaction_and_registration_status_updates(); |
721 | 721 | // save all data to the db, but suppress errors |
722 | 722 | //$this->save_all_data( FALSE ); |
723 | 723 | // cache the checkout in the session |
724 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
724 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -737,21 +737,21 @@ discard block |
||
737 | 737 | */ |
738 | 738 | public function track_transaction_and_registration_status_updates() { |
739 | 739 | // verify the transaction |
740 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
740 | + if ($this->transaction instanceof EE_Transaction) { |
|
741 | 741 | /** @type EE_Transaction_Payments $transaction_payments */ |
742 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
742 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
743 | 743 | /** @type EE_Transaction_Processor $transaction_processor */ |
744 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
744 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
745 | 745 | // has there been a TXN status change during this checkout? |
746 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
746 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
747 | 747 | $this->txn_status_updated = true; |
748 | 748 | } |
749 | 749 | /** @type EE_Registration_Processor $registration_processor */ |
750 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
750 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
751 | 751 | // grab the saved registrations from the transaction |
752 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
753 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
754 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
752 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
753 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
754 | + $this->set_reg_status_updated($registration->ID(), true); |
|
755 | 755 | } |
756 | 756 | } |
757 | 757 | } |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | * @param EE_Registration $registration |
774 | 774 | * @return bool |
775 | 775 | */ |
776 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
777 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
776 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
777 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | |
@@ -799,18 +799,18 @@ discard block |
||
799 | 799 | * @param bool $show_errors |
800 | 800 | * @return bool |
801 | 801 | */ |
802 | - public function save_all_data( $show_errors = TRUE ) { |
|
802 | + public function save_all_data($show_errors = TRUE) { |
|
803 | 803 | // verify the transaction |
804 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
804 | + if ($this->transaction instanceof EE_Transaction) { |
|
805 | 805 | // save to ensure that TXN has ID |
806 | 806 | $this->transaction->save(); |
807 | 807 | // grab the saved registrations from the transaction |
808 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
809 | - $this->_save_registration( $registration, $show_errors ); |
|
808 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
809 | + $this->_save_registration($registration, $show_errors); |
|
810 | 810 | } |
811 | 811 | } else { |
812 | - if ( $show_errors ) { |
|
813 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
812 | + if ($show_errors) { |
|
813 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
814 | 814 | } |
815 | 815 | return FALSE; |
816 | 816 | } |
@@ -825,32 +825,32 @@ discard block |
||
825 | 825 | * @param bool $show_errors |
826 | 826 | * @return void |
827 | 827 | */ |
828 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
828 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
829 | 829 | // verify object |
830 | - if ( $registration instanceof EE_Registration ) { |
|
830 | + if ($registration instanceof EE_Registration) { |
|
831 | 831 | // should this registration be processed during this visit ? |
832 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
832 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
833 | 833 | //set TXN ID |
834 | - if ( ! $registration->transaction_ID() ) { |
|
835 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
834 | + if ( ! $registration->transaction_ID()) { |
|
835 | + $registration->set_transaction_id($this->transaction->ID()); |
|
836 | 836 | } |
837 | 837 | // verify and save the attendee |
838 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
838 | + $this->_save_registration_attendee($registration, $show_errors); |
|
839 | 839 | // save answers to reg form questions |
840 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
840 | + $this->_save_registration_answers($registration, $show_errors); |
|
841 | 841 | // save changes |
842 | 842 | $registration->save(); |
843 | 843 | // update txn cache |
844 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
845 | - if ( $show_errors ) { |
|
846 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
844 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
845 | + if ($show_errors) { |
|
846 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | } |
850 | 850 | } else { |
851 | - if ( $show_errors ) { |
|
851 | + if ($show_errors) { |
|
852 | 852 | EE_Error::add_error( |
853 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
853 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
854 | 854 | __FILE__, __FUNCTION__, __LINE__ |
855 | 855 | ); |
856 | 856 | } |
@@ -866,26 +866,26 @@ discard block |
||
866 | 866 | * @param bool $show_errors |
867 | 867 | * @return void |
868 | 868 | */ |
869 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
870 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
869 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
870 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
871 | 871 | // save so that ATT has ID |
872 | 872 | $registration->attendee()->save(); |
873 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
874 | - if ( $show_errors ) { |
|
873 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
874 | + if ($show_errors) { |
|
875 | 875 | EE_Error::add_error( |
876 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
876 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
877 | 877 | __FILE__, __FUNCTION__, __LINE__ |
878 | 878 | ); |
879 | 879 | } |
880 | 880 | } |
881 | 881 | } else { |
882 | - if ( $show_errors ) { |
|
882 | + if ($show_errors) { |
|
883 | 883 | ob_start(); |
884 | - var_dump( $registration->attendee() ); |
|
884 | + var_dump($registration->attendee()); |
|
885 | 885 | EE_Error::add_error( |
886 | 886 | sprintf( |
887 | 887 | '%1$s||%1$s $attendee = %2$s', |
888 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
888 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
889 | 889 | ob_get_clean() |
890 | 890 | ), |
891 | 891 | __FILE__, __FUNCTION__, __LINE__ |
@@ -903,25 +903,25 @@ discard block |
||
903 | 903 | * @param bool $show_errors |
904 | 904 | * @return void |
905 | 905 | */ |
906 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
906 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
907 | 907 | // now save the answers |
908 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
908 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
909 | 909 | // verify object |
910 | - if ( $answer instanceof EE_Answer ) { |
|
911 | - $answer->set_registration( $registration->ID() ); |
|
910 | + if ($answer instanceof EE_Answer) { |
|
911 | + $answer->set_registration($registration->ID()); |
|
912 | 912 | $answer->save(); |
913 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
914 | - if ( $show_errors ) { |
|
913 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
914 | + if ($show_errors) { |
|
915 | 915 | EE_Error::add_error( |
916 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
916 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
917 | 917 | __FILE__, __FUNCTION__, __LINE__ |
918 | 918 | ); |
919 | 919 | } |
920 | 920 | } |
921 | 921 | } else { |
922 | - if ( $show_errors ) { |
|
922 | + if ($show_errors) { |
|
923 | 923 | EE_Error::add_error( |
924 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
924 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @param bool $from_db |
940 | 940 | * @return bool |
941 | 941 | */ |
942 | - public function refresh_all_entities( $from_db = false ) { |
|
942 | + public function refresh_all_entities($from_db = false) { |
|
943 | 943 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
944 | 944 | //$this->log( |
945 | 945 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | */ |
961 | 961 | protected function refresh_from_db() { |
962 | 962 | // verify the transaction |
963 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
963 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
964 | 964 | // pull fresh TXN data from the db |
965 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
965 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
966 | 966 | // update EE_Checkout's cached primary_attendee object |
967 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
967 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
968 | 968 | // update EE_Checkout's cached payment object |
969 | 969 | $payment = $this->transaction->last_payment(); |
970 | 970 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
973 | 973 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
974 | 974 | //now refresh the cart, based on the TXN |
975 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
975 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
976 | 976 | // verify and update the cart because inaccurate totals are not so much fun |
977 | - if ( $this->cart instanceof EE_Cart ) { |
|
977 | + if ($this->cart instanceof EE_Cart) { |
|
978 | 978 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
979 | 979 | } else { |
980 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
980 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
981 | 981 | } |
982 | 982 | } else { |
983 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
983 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
984 | 984 | return FALSE; |
985 | 985 | } |
986 | 986 | return TRUE; |
@@ -994,24 +994,24 @@ discard block |
||
994 | 994 | * @param EE_Transaction $transaction |
995 | 995 | * @return EE_Attendee | null |
996 | 996 | */ |
997 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
997 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
998 | 998 | |
999 | 999 | $primary_attendee_obj = null; |
1000 | 1000 | // grab the saved registrations from the transaction |
1001 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
1001 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
1002 | 1002 | // verify object |
1003 | - if ( $registration instanceof EE_Registration ) { |
|
1003 | + if ($registration instanceof EE_Registration) { |
|
1004 | 1004 | $attendee = $registration->attendee(); |
1005 | 1005 | // verify object |
1006 | - if ( $attendee instanceof EE_Attendee ) { |
|
1006 | + if ($attendee instanceof EE_Attendee) { |
|
1007 | 1007 | // maybe cache primary_attendee_obj ? |
1008 | - if ( $registration->is_primary_registrant() ) { |
|
1008 | + if ($registration->is_primary_registrant()) { |
|
1009 | 1009 | $primary_attendee_obj = $attendee; |
1010 | 1010 | } |
1011 | 1011 | } |
1012 | 1012 | } else { |
1013 | 1013 | EE_Error::add_error( |
1014 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1014 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1015 | 1015 | __FILE__, __FUNCTION__, __LINE__ |
1016 | 1016 | ); |
1017 | 1017 | } |
@@ -1031,43 +1031,43 @@ discard block |
||
1031 | 1031 | */ |
1032 | 1032 | protected function refresh_entity_map() { |
1033 | 1033 | // verify the transaction |
1034 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
1034 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
1035 | 1035 | // never cache payment info |
1036 | - $this->transaction->clear_cache( 'Payment' ); |
|
1036 | + $this->transaction->clear_cache('Payment'); |
|
1037 | 1037 | /** @type EE_Transaction_Processor $transaction_processor */ |
1038 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1038 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1039 | 1039 | // is the Payment Options Reg Step completed ? |
1040 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
1040 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
1041 | 1041 | // then check for payments and update TXN accordingly |
1042 | 1042 | /** @type EE_Transaction_Payments $transaction_payments */ |
1043 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1044 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
1043 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1044 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
1045 | 1045 | } |
1046 | 1046 | // grab the saved registrations from the transaction |
1047 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
1048 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
1047 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
1048 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
1049 | 1049 | } |
1050 | 1050 | // make sure our cached TXN is added to the model entity mapper |
1051 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
1051 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
1052 | 1052 | |
1053 | 1053 | } else { |
1054 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
1054 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1055 | 1055 | return FALSE; |
1056 | 1056 | } |
1057 | 1057 | // verify and update the cart because inaccurate totals are not so much fun |
1058 | - if ( $this->cart instanceof EE_Cart ) { |
|
1058 | + if ($this->cart instanceof EE_Cart) { |
|
1059 | 1059 | $grand_total = $this->cart->get_grand_total(); |
1060 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
1060 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
1061 | 1061 | $grand_total->recalculate_total_including_taxes(); |
1062 | 1062 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
1063 | 1063 | $this->cart->get_grand_total()->ID(), |
1064 | 1064 | $this->cart->get_grand_total() |
1065 | 1065 | ); |
1066 | 1066 | } |
1067 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
1068 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
1067 | + if ($grand_total instanceof EE_Line_Item) { |
|
1068 | + $this->cart = EE_Cart::instance($grand_total); |
|
1069 | 1069 | } else { |
1070 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1071 | 1071 | return false; |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -1083,19 +1083,19 @@ discard block |
||
1083 | 1083 | * @param EE_Registration $registration |
1084 | 1084 | * @return void |
1085 | 1085 | */ |
1086 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
1086 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
1087 | 1087 | |
1088 | 1088 | // verify object |
1089 | - if ( $registration instanceof EE_Registration ) { |
|
1089 | + if ($registration instanceof EE_Registration) { |
|
1090 | 1090 | // update the entity mapper attendee |
1091 | - $this->_refresh_registration_attendee( $registration ); |
|
1091 | + $this->_refresh_registration_attendee($registration); |
|
1092 | 1092 | // update the entity mapper answers for reg form questions |
1093 | - $this->_refresh_registration_answers( $registration ); |
|
1093 | + $this->_refresh_registration_answers($registration); |
|
1094 | 1094 | // make sure the cached registration is added to the model entity mapper |
1095 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1095 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1096 | 1096 | } else { |
1097 | 1097 | EE_Error::add_error( |
1098 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1098 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1099 | 1099 | __FILE__, __FUNCTION__, __LINE__ |
1100 | 1100 | ); |
1101 | 1101 | } |
@@ -1109,15 +1109,15 @@ discard block |
||
1109 | 1109 | * @param EE_Registration $registration |
1110 | 1110 | * @return void |
1111 | 1111 | */ |
1112 | - protected function _refresh_registration_attendee( $registration ) { |
|
1112 | + protected function _refresh_registration_attendee($registration) { |
|
1113 | 1113 | |
1114 | 1114 | $attendee = $registration->attendee(); |
1115 | 1115 | // verify object |
1116 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1116 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1117 | 1117 | // make sure the cached attendee is added to the model entity mapper |
1118 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1118 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1119 | 1119 | // maybe cache primary_attendee_obj ? |
1120 | - if ( $registration->is_primary_registrant() ) { |
|
1120 | + if ($registration->is_primary_registrant()) { |
|
1121 | 1121 | $this->primary_attendee_obj = $attendee; |
1122 | 1122 | } |
1123 | 1123 | } |
@@ -1131,19 +1131,19 @@ discard block |
||
1131 | 1131 | * @param EE_Registration $registration |
1132 | 1132 | * @return void |
1133 | 1133 | */ |
1134 | - protected function _refresh_registration_answers( $registration ) { |
|
1134 | + protected function _refresh_registration_answers($registration) { |
|
1135 | 1135 | |
1136 | 1136 | // now update the answers |
1137 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1137 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1138 | 1138 | // verify object |
1139 | - if ( $answer instanceof EE_Answer ) { |
|
1140 | - if ( $answer->ID() ) { |
|
1139 | + if ($answer instanceof EE_Answer) { |
|
1140 | + if ($answer->ID()) { |
|
1141 | 1141 | // make sure the cached answer is added to the model entity mapper |
1142 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1142 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1143 | 1143 | } |
1144 | 1144 | } else { |
1145 | 1145 | EE_Error::add_error( |
1146 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1146 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1147 | 1147 | __FILE__, __FUNCTION__, __LINE__ |
1148 | 1148 | ); |
1149 | 1149 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1159 | 1159 | */ |
1160 | 1160 | function __wakeup() { |
1161 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1161 | + foreach ($this->reg_steps as $reg_step) { |
|
1162 | 1162 | $reg_step->checkout = $this; |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1174,11 +1174,11 @@ discard block |
||
1174 | 1174 | * @param array $info |
1175 | 1175 | * @param bool $display_request |
1176 | 1176 | */ |
1177 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1178 | - if ( WP_DEBUG && false ) { |
|
1179 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1177 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1178 | + if (WP_DEBUG && false) { |
|
1179 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1180 | 1180 | $default_data = array( |
1181 | - $class => $func . '() : ' . $line, |
|
1181 | + $class => $func.'() : '.$line, |
|
1182 | 1182 | 'request->step' => $this->step, |
1183 | 1183 | 'request->action' => $this->action, |
1184 | 1184 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1190,24 +1190,24 @@ discard block |
||
1190 | 1190 | 'reg_url_link' => $this->reg_url_link, |
1191 | 1191 | 'REQ' => $display_request ? $_REQUEST : '', |
1192 | 1192 | ); |
1193 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1194 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1195 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1196 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1197 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1193 | + if ($this->transaction instanceof EE_Transaction) { |
|
1194 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1195 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1196 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1197 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1198 | 1198 | } |
1199 | - if ( $this->transaction->ID() ) { |
|
1200 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1199 | + if ($this->transaction->ID()) { |
|
1200 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1201 | 1201 | // don't serialize objects |
1202 | - $info = $this->_strip_objects( $info ); |
|
1203 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1204 | - $debug_data[ $TXN_ID ] = array(); |
|
1202 | + $info = $this->_strip_objects($info); |
|
1203 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1204 | + $debug_data[$TXN_ID] = array(); |
|
1205 | 1205 | } |
1206 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1206 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1207 | 1207 | $default_data, |
1208 | 1208 | $info |
1209 | 1209 | ); |
1210 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1210 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1211 | 1211 | } |
1212 | 1212 | } |
1213 | 1213 | } |
@@ -1220,23 +1220,23 @@ discard block |
||
1220 | 1220 | * @param array $info |
1221 | 1221 | * @return array |
1222 | 1222 | */ |
1223 | - function _strip_objects( $info = array() ) { |
|
1224 | - foreach ( $info as $key => $value ) { |
|
1225 | - if ( is_array( $value )) { |
|
1226 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1227 | - } else if ( is_object( $value ) ) { |
|
1228 | - $object_class = get_class( $value ); |
|
1229 | - $info[ $object_class ] = array(); |
|
1230 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1231 | - if ( method_exists( $value, 'status' ) ) { |
|
1232 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1233 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1234 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1223 | + function _strip_objects($info = array()) { |
|
1224 | + foreach ($info as $key => $value) { |
|
1225 | + if (is_array($value)) { |
|
1226 | + $info[$key] = $this->_strip_objects($value); |
|
1227 | + } else if (is_object($value)) { |
|
1228 | + $object_class = get_class($value); |
|
1229 | + $info[$object_class] = array(); |
|
1230 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1231 | + if (method_exists($value, 'status')) { |
|
1232 | + $info[$object_class]['status'] = $value->status(); |
|
1233 | + } else if (method_exists($value, 'status_ID')) { |
|
1234 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1235 | 1235 | } |
1236 | - unset( $info[ $key ] ); |
|
1236 | + unset($info[$key]); |
|
1237 | 1237 | } |
1238 | 1238 | } |
1239 | - return (array)$info; |
|
1239 | + return (array) $info; |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * _auto_copy_attendee_info |
349 | 349 | * |
350 | 350 | * @access public |
351 | - * @return EE_Form_Section_Proper |
|
351 | + * @return EE_Form_Section_HTML |
|
352 | 352 | */ |
353 | 353 | private function _auto_copy_attendee_info() { |
354 | 354 | return new EE_Form_Section_HTML( |
@@ -462,6 +462,7 @@ discard block |
||
462 | 462 | * @param EE_Registration $registration |
463 | 463 | * @param EE_Question $question |
464 | 464 | * @param mixed EE_Answer|NULL $answer |
465 | + * @param EE_Answer $answer |
|
465 | 466 | * @return EE_Form_Input_Base |
466 | 467 | */ |
467 | 468 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param EE_Checkout $checkout |
38 | 38 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
39 | 39 | */ |
40 | - public function __construct( EE_Checkout $checkout ) { |
|
40 | + public function __construct(EE_Checkout $checkout) { |
|
41 | 41 | $this->_slug = 'attendee_information'; |
42 | 42 | $this->_name = __('Attendee Information', 'event_espresso'); |
43 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
43 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
44 | 44 | $this->checkout = $checkout; |
45 | 45 | $this->_reset_success_message(); |
46 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
46 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
54 | 54 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
55 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
55 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
56 | 56 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
57 | 57 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
58 | 58 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | EEH_Autoloader::register_line_item_display_autoloaders(); |
86 | 86 | $Line_Item_Display = new EE_Line_Item_Display(); |
87 | 87 | // calculate taxes |
88 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
88 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
89 | 89 | EE_Registry::instance()->load_helper('Line_Item'); |
90 | 90 | /** @var $subsections EE_Form_Section_Proper[] */ |
91 | 91 | $subsections = array( |
@@ -97,33 +97,33 @@ discard block |
||
97 | 97 | 'ticket_count' => array() |
98 | 98 | ); |
99 | 99 | // grab the saved registrations from the transaction |
100 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
101 | - if ( $registrations ) { |
|
102 | - foreach ( $registrations as $registration ) { |
|
103 | - if ( $registration instanceof EE_Registration ) { |
|
100 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
101 | + if ($registrations) { |
|
102 | + foreach ($registrations as $registration) { |
|
103 | + if ($registration instanceof EE_Registration) { |
|
104 | 104 | // can this registration be processed during this visit ? |
105 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
106 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
107 | - if ( ! $this->checkout->admin_request ) { |
|
108 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
109 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
110 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
111 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
112 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
105 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
106 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
107 | + if ( ! $this->checkout->admin_request) { |
|
108 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
109 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
110 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
111 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
112 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
113 | 113 | } |
114 | - if ( $registration->is_primary_registrant() ) { |
|
114 | + if ($registration->is_primary_registrant()) { |
|
115 | 115 | $primary_registrant = $registration->reg_url_link(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | // print_copy_info ? |
121 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
121 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
122 | 122 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
123 | 123 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
124 | 124 | // generate hidden input |
125 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
126 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
125 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
126 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | 'html_id' => $this->reg_form_name(), |
136 | 136 | 'subsections' => $subsections, |
137 | 137 | 'layout_strategy' => $this->checkout->admin_request ? |
138 | - new EE_Div_Per_Section_Layout() : |
|
139 | - new EE_Template_Layout( |
|
138 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
140 | 139 | array( |
141 | 140 | 'layout_template_file' => $this->_template, // layout_template |
142 | 141 | 'template_args' => $template_args |
@@ -153,61 +152,61 @@ discard block |
||
153 | 152 | * @param EE_Registration $registration |
154 | 153 | * @return EE_Form_Section_Proper |
155 | 154 | */ |
156 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
157 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
156 | + EE_Registry::instance()->load_helper('Template'); |
|
158 | 157 | static $attendee_nmbr = 1; |
159 | 158 | // array of params to pass to parent constructor |
160 | 159 | $form_args = array( |
161 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
160 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
162 | 161 | 'html_class' => 'ee-reg-form-attendee-dv', |
163 | 162 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
164 | 163 | 'subsections' => array(), |
165 | 164 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
166 | 165 | array( |
167 | 166 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
168 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
167 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
169 | 168 | ) |
170 | 169 | ) |
171 | 170 | ); |
172 | 171 | // verify that registration has valid event |
173 | - if ( $registration->event() instanceof EE_Event ) { |
|
172 | + if ($registration->event() instanceof EE_Event) { |
|
174 | 173 | $query_params = array( |
175 | 174 | array( |
176 | 175 | 'Event.EVT_ID' => $registration->event()->ID(), |
177 | 176 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
178 | 177 | ), |
179 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
178 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
180 | 179 | ); |
181 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
182 | - if ( $question_groups ) { |
|
183 | - foreach ( $question_groups as $question_group ) { |
|
184 | - if ( $question_group instanceof EE_Question_Group ) { |
|
185 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
180 | + $question_groups = $registration->event()->question_groups($query_params); |
|
181 | + if ($question_groups) { |
|
182 | + foreach ($question_groups as $question_group) { |
|
183 | + if ($question_group instanceof EE_Question_Group) { |
|
184 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
186 | 185 | // add hidden input |
187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
188 | 187 | } |
189 | 188 | } |
190 | 189 | // if we have question groups for additional attendees, then display the copy options |
191 | 190 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
192 | 191 | } else { |
193 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
192 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
194 | 193 | EEH_Template::locate_template( |
195 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
196 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
194 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
195 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
197 | 196 | TRUE, |
198 | 197 | TRUE |
199 | 198 | ) |
200 | 199 | ); |
201 | 200 | // add hidden input |
202 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
201 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
203 | 202 | } |
204 | 203 | } |
205 | - if ( $registration->is_primary_registrant() ) { |
|
204 | + if ($registration->is_primary_registrant()) { |
|
206 | 205 | // generate hidden input |
207 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
206 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
208 | 207 | } |
209 | 208 | $attendee_nmbr++; |
210 | - return new EE_Form_Section_Proper( $form_args ); |
|
209 | + return new EE_Form_Section_Proper($form_args); |
|
211 | 210 | } |
212 | 211 | |
213 | 212 | |
@@ -220,11 +219,11 @@ discard block |
||
220 | 219 | * @param bool $additional_attendee_reg_info |
221 | 220 | * @return EE_Form_Input_Base |
222 | 221 | */ |
223 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
222 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
224 | 223 | // generate hidden input |
225 | 224 | return new EE_Hidden_Input( |
226 | 225 | array( |
227 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
226 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
228 | 227 | 'default' => $additional_attendee_reg_info |
229 | 228 | ) |
230 | 229 | ); |
@@ -237,22 +236,22 @@ discard block |
||
237 | 236 | * @param EE_Question_Group $question_group |
238 | 237 | * @return EE_Form_Section_Proper |
239 | 238 | */ |
240 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
239 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
241 | 240 | // array of params to pass to parent constructor |
242 | 241 | $form_args = array( |
243 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
242 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
244 | 243 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
245 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
244 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
246 | 245 | 'subsections' => array( |
247 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
246 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
248 | 247 | ), |
249 | 248 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
250 | 249 | ); |
251 | 250 | // where params |
252 | - $query_params = array( 'QST_deleted' => 0 ); |
|
251 | + $query_params = array('QST_deleted' => 0); |
|
253 | 252 | // don't load admin only questions on the frontend |
254 | - if ( ! $this->checkout->admin_request ) { |
|
255 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
253 | + if ( ! $this->checkout->admin_request) { |
|
254 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
256 | 255 | } |
257 | 256 | $questions = $question_group->get_many_related( |
258 | 257 | 'Question', |
@@ -264,21 +263,21 @@ discard block |
||
264 | 263 | ) |
265 | 264 | ); |
266 | 265 | // filter for additional content before questions |
267 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
266 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
268 | 267 | // loop thru questions |
269 | - foreach ( $questions as $question ) { |
|
270 | - if( $question instanceof EE_Question ){ |
|
268 | + foreach ($questions as $question) { |
|
269 | + if ($question instanceof EE_Question) { |
|
271 | 270 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
272 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
271 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
273 | 272 | } |
274 | 273 | } |
275 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
274 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
276 | 275 | |
277 | 276 | // filter for additional content after questions |
278 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
277 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
279 | 278 | // d( $form_args ); |
280 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
281 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
279 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
280 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
282 | 281 | } |
283 | 282 | |
284 | 283 | |
@@ -288,12 +287,12 @@ discard block |
||
288 | 287 | * @param EE_Question_Group $question_group |
289 | 288 | * @return EE_Form_Section_HTML |
290 | 289 | */ |
291 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
290 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
292 | 291 | $html = ''; |
293 | 292 | // group_name |
294 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
293 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
295 | 294 | EE_Registry::instance()->load_helper('HTML'); |
296 | - if ( $this->checkout->admin_request ) { |
|
295 | + if ($this->checkout->admin_request) { |
|
297 | 296 | $html .= EEH_HTML::br(); |
298 | 297 | $html .= EEH_HTML::h3( |
299 | 298 | $question_group->name(), |
@@ -307,7 +306,7 @@ discard block |
||
307 | 306 | } |
308 | 307 | } |
309 | 308 | // group_desc |
310 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
309 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
311 | 310 | $html .= EEH_HTML::p( |
312 | 311 | $question_group->desc(), |
313 | 312 | '', |
@@ -315,7 +314,7 @@ discard block |
||
315 | 314 | ); |
316 | 315 | |
317 | 316 | } |
318 | - return new EE_Form_Section_HTML( $html ); |
|
317 | + return new EE_Form_Section_HTML($html); |
|
319 | 318 | } |
320 | 319 | |
321 | 320 | |
@@ -324,14 +323,14 @@ discard block |
||
324 | 323 | * @access public |
325 | 324 | * @return EE_Form_Section_Proper |
326 | 325 | */ |
327 | - private function _copy_attendee_info_form(){ |
|
326 | + private function _copy_attendee_info_form() { |
|
328 | 327 | // array of params to pass to parent constructor |
329 | 328 | return new EE_Form_Section_Proper( |
330 | 329 | array( |
331 | 330 | 'subsections' => $this->_copy_attendee_info_inputs(), |
332 | 331 | 'layout_strategy' => new EE_Template_Layout( |
333 | 332 | array( |
334 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
333 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
335 | 334 | 'begin_template_file' => NULL, |
336 | 335 | 'input_template_file' => NULL, |
337 | 336 | 'subsection_template_file' => NULL, |
@@ -353,8 +352,8 @@ discard block |
||
353 | 352 | private function _auto_copy_attendee_info() { |
354 | 353 | return new EE_Form_Section_HTML( |
355 | 354 | EEH_Template::locate_template( |
356 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
357 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
355 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
356 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
358 | 357 | TRUE, |
359 | 358 | TRUE |
360 | 359 | ) |
@@ -373,25 +372,25 @@ discard block |
||
373 | 372 | $copy_attendee_info_inputs = array(); |
374 | 373 | $prev_ticket = NULL; |
375 | 374 | // grab the saved registrations from the transaction |
376 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
377 | - foreach ( $registrations as $registration ) { |
|
375 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
376 | + foreach ($registrations as $registration) { |
|
378 | 377 | // for all attendees other than the primary attendee |
379 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
378 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
380 | 379 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
381 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
380 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
382 | 381 | $item_name = $registration->ticket()->name(); |
383 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
385 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
382 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
384 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
386 | 385 | ); |
387 | 386 | $prev_ticket = $registration->ticket()->ID(); |
388 | 387 | } |
389 | 388 | |
390 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
389 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
391 | 390 | EE_Checkbox_Multi_Input( |
392 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
391 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
393 | 392 | array( |
394 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
393 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
395 | 394 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
396 | 395 | 'display_html_label_text' => FALSE |
397 | 396 | ) |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param EE_Registration $registration |
411 | 410 | * @return EE_Form_Input_Base |
412 | 411 | */ |
413 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
412 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
414 | 413 | // generate hidden input |
415 | 414 | return new EE_Hidden_Input( |
416 | 415 | array( |
@@ -428,31 +427,31 @@ discard block |
||
428 | 427 | * @param EE_Question $question |
429 | 428 | * @return EE_Form_Input_Base |
430 | 429 | */ |
431 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
430 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
432 | 431 | |
433 | 432 | // if this question was for an attendee detail, then check for that answer |
434 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
433 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
435 | 434 | $answer = $answer_value === null |
436 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
435 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
437 | 436 | : null; |
438 | 437 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
439 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
438 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
440 | 439 | // create an EE_Answer object for storing everything in |
441 | - $answer = EE_Answer::new_instance ( array( |
|
440 | + $answer = EE_Answer::new_instance(array( |
|
442 | 441 | 'QST_ID'=> $question->ID(), |
443 | 442 | 'REG_ID'=> $registration->ID() |
444 | 443 | )); |
445 | 444 | } |
446 | 445 | // verify instance |
447 | - if( $answer instanceof EE_Answer ){ |
|
448 | - if ( ! empty( $answer_value )) { |
|
449 | - $answer->set( 'ANS_value', $answer_value ); |
|
446 | + if ($answer instanceof EE_Answer) { |
|
447 | + if ( ! empty($answer_value)) { |
|
448 | + $answer->set('ANS_value', $answer_value); |
|
450 | 449 | } |
451 | - $answer->cache( 'Question', $question ); |
|
452 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
453 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
450 | + $answer->cache('Question', $question); |
|
451 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
452 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
454 | 453 | } |
455 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
454 | + return $this->_generate_question_input($registration, $question, $answer); |
|
456 | 455 | |
457 | 456 | } |
458 | 457 | |
@@ -464,7 +463,7 @@ discard block |
||
464 | 463 | * @param mixed EE_Answer|NULL $answer |
465 | 464 | * @return EE_Form_Input_Base |
466 | 465 | */ |
467 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
466 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
468 | 467 | // d( $registration ); |
469 | 468 | // d( $question ); |
470 | 469 | // d( $answer ); |
@@ -487,29 +486,29 @@ discard block |
||
487 | 486 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
488 | 487 | |
489 | 488 | $input_constructor_args = array( |
490 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
491 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
492 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
489 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
490 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
491 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
493 | 492 | 'required' => $question->required() ? TRUE : FALSE, |
494 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
493 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
495 | 494 | 'html_label_class' => 'ee-reg-qstn', |
496 | 495 | 'html_label_text' => $question->display_text(), |
497 | 496 | 'required_validation_error_message' => $question->required_text() |
498 | 497 | ); |
499 | 498 | // has this question been answered ? |
500 | - if ( $answer instanceof EE_Answer ) { |
|
501 | - if ( $answer->ID() ) { |
|
502 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
503 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
504 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
499 | + if ($answer instanceof EE_Answer) { |
|
500 | + if ($answer->ID()) { |
|
501 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
502 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
503 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
505 | 504 | } |
506 | 505 | $input_constructor_args['default'] = $answer->value(); |
507 | 506 | } |
508 | 507 | //add "-lbl" to the end of the label id |
509 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
510 | - $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
511 | - if( EEM_Question::instance()->question_type_is_in_category( $question->type(), 'text' ) ) { |
|
512 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( |
|
508 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
509 | + $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
510 | + if (EEM_Question::instance()->question_type_is_in_category($question->type(), 'text')) { |
|
511 | + $input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( |
|
513 | 512 | null, |
514 | 513 | min( |
515 | 514 | $max_max_for_question, |
@@ -517,83 +516,83 @@ discard block |
||
517 | 516 | ) |
518 | 517 | ); |
519 | 518 | } |
520 | - $input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
519 | + $input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
521 | 520 | $input_constructor_args, |
522 | 521 | $registration, |
523 | 522 | $question, |
524 | 523 | $answer |
525 | 524 | ); |
526 | 525 | |
527 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
526 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
528 | 527 | |
529 | - switch ( $question->type() ) { |
|
528 | + switch ($question->type()) { |
|
530 | 529 | // Text |
531 | 530 | case EEM_Question::QST_type_text : |
532 | - if( $identifier == 'email' ){ |
|
533 | - return new EE_Email_Input( $input_constructor_args ); |
|
534 | - }else{ |
|
535 | - return new EE_Text_Input( $input_constructor_args ); |
|
531 | + if ($identifier == 'email') { |
|
532 | + return new EE_Email_Input($input_constructor_args); |
|
533 | + } else { |
|
534 | + return new EE_Text_Input($input_constructor_args); |
|
536 | 535 | } |
537 | 536 | break; |
538 | 537 | // Textarea |
539 | 538 | case EEM_Question::QST_type_textarea : |
540 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
539 | + return new EE_Text_Area_Input($input_constructor_args); |
|
541 | 540 | break; |
542 | 541 | // Radio Buttons |
543 | 542 | case EEM_Question::QST_type_radio : |
544 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
543 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
545 | 544 | break; |
546 | 545 | // Dropdown |
547 | 546 | case EEM_Question::QST_type_dropdown : |
548 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
547 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
549 | 548 | break; |
550 | 549 | // State Dropdown |
551 | 550 | case EEM_Question::QST_type_state : |
552 | - $state_options = array( '' => array( '' => '')); |
|
551 | + $state_options = array('' => array('' => '')); |
|
553 | 552 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
554 | - if ( ! empty( $states )) { |
|
555 | - foreach( $states as $state ){ |
|
556 | - if ( $state instanceof EE_State ) { |
|
557 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
553 | + if ( ! empty($states)) { |
|
554 | + foreach ($states as $state) { |
|
555 | + if ($state instanceof EE_State) { |
|
556 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
558 | 557 | } |
559 | 558 | } |
560 | 559 | } |
561 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
562 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
560 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
561 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
563 | 562 | break; |
564 | 563 | // Country Dropdown |
565 | 564 | case EEM_Question::QST_type_country : |
566 | - $country_options = array( '' => '' ); |
|
565 | + $country_options = array('' => ''); |
|
567 | 566 | // get possibly cached list of countries |
568 | 567 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
569 | - if ( ! empty( $countries )) { |
|
570 | - foreach( $countries as $country ){ |
|
571 | - if ( $country instanceof EE_Country ) { |
|
572 | - $country_options[ $country->ID() ] = $country->name(); |
|
568 | + if ( ! empty($countries)) { |
|
569 | + foreach ($countries as $country) { |
|
570 | + if ($country instanceof EE_Country) { |
|
571 | + $country_options[$country->ID()] = $country->name(); |
|
573 | 572 | } |
574 | 573 | } |
575 | 574 | } |
576 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
577 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
575 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
576 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
578 | 577 | break; |
579 | 578 | // Checkboxes |
580 | 579 | case EEM_Question::QST_type_checkbox : |
581 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
580 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
582 | 581 | break; |
583 | 582 | // Date |
584 | 583 | case EEM_Question::QST_type_date : |
585 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
584 | + return new EE_Datepicker_Input($input_constructor_args); |
|
586 | 585 | break; |
587 | 586 | case EEM_Question::QST_type_html_textarea : |
588 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
589 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
590 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
587 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
588 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
589 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
591 | 590 | return $input; |
592 | 591 | // fallback |
593 | 592 | default : |
594 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
595 | - if( ! $default_input ){ |
|
596 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
593 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
594 | + if ( ! $default_input) { |
|
595 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
597 | 596 | } |
598 | 597 | return $default_input; |
599 | 598 | } |
@@ -618,65 +617,65 @@ discard block |
||
618 | 617 | */ |
619 | 618 | public function process_reg_step() { |
620 | 619 | |
621 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
620 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
622 | 621 | // grab validated data from form |
623 | 622 | $valid_data = $this->checkout->current_step->valid_data(); |
624 | 623 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
625 | 624 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
626 | 625 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
627 | - if ( empty( $valid_data )) { |
|
628 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
626 | + if (empty($valid_data)) { |
|
627 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
629 | 628 | return FALSE; |
630 | 629 | } |
631 | 630 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
632 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
633 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
631 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
632 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
634 | 633 | return FALSE; |
635 | 634 | } |
636 | 635 | // get cached registrations |
637 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
636 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
638 | 637 | // verify we got the goods |
639 | - if ( empty( $registrations )) { |
|
640 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + if (empty($registrations)) { |
|
639 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
641 | 640 | return FALSE; |
642 | 641 | } |
643 | 642 | // extract attendee info from form data and save to model objects |
644 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
643 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
645 | 644 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
646 | - if ( $registrations_processed === FALSE ) { |
|
645 | + if ($registrations_processed === FALSE) { |
|
647 | 646 | // but return immediately if the previous step exited early due to errors |
648 | 647 | return FALSE; |
649 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
648 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
650 | 649 | // generate a correctly translated string for all possible singular/plural combinations |
651 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
650 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
652 | 651 | $error_msg = sprintf( |
653 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
652 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
654 | 653 | $this->checkout->total_ticket_count, |
655 | 654 | $registrations_processed |
656 | 655 | ); |
657 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
656 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
658 | 657 | $error_msg = sprintf( |
659 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
658 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
660 | 659 | $this->checkout->total_ticket_count, |
661 | 660 | $registrations_processed |
662 | 661 | ); |
663 | 662 | } else { |
664 | 663 | $error_msg = sprintf( |
665 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
664 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
666 | 665 | $this->checkout->total_ticket_count, |
667 | 666 | $registrations_processed |
668 | 667 | ); |
669 | 668 | |
670 | 669 | } |
671 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
670 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
672 | 671 | return FALSE; |
673 | 672 | } |
674 | 673 | // mark this reg step as completed |
675 | 674 | $this->set_completed(); |
676 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
675 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
677 | 676 | //do action in case a plugin wants to do something with the data submitted in step 1. |
678 | 677 | //passes EE_Single_Page_Checkout, and it's posted data |
679 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
678 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
680 | 679 | return TRUE; |
681 | 680 | |
682 | 681 | } |
@@ -690,9 +689,9 @@ discard block |
||
690 | 689 | * @param array $valid_data |
691 | 690 | * @return boolean | int |
692 | 691 | */ |
693 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
692 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
694 | 693 | // load resources and set some defaults |
695 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
694 | + EE_Registry::instance()->load_model('Attendee'); |
|
696 | 695 | // holder for primary registrant attendee object |
697 | 696 | $this->checkout->primary_attendee_obj = NULL; |
698 | 697 | // array for tracking reg form data for the primary registrant |
@@ -709,19 +708,19 @@ discard block |
||
709 | 708 | // attendee counter |
710 | 709 | $att_nmbr = 0; |
711 | 710 | // grab the saved registrations from the transaction |
712 | - foreach ( $registrations as $registration ) { |
|
711 | + foreach ($registrations as $registration) { |
|
713 | 712 | // verify EE_Registration object |
714 | - if ( ! $registration instanceof EE_Registration ) { |
|
715 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
713 | + if ( ! $registration instanceof EE_Registration) { |
|
714 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
716 | 715 | return FALSE; |
717 | 716 | } |
718 | 717 | $reg_url_link = $registration->reg_url_link(); |
719 | 718 | // reg_url_link exists ? |
720 | - if ( $reg_url_link ) { |
|
719 | + if ($reg_url_link) { |
|
721 | 720 | // should this registration be processed during this visit ? |
722 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
721 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
723 | 722 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
724 | - if ( ! $this->checkout->revisit ) { |
|
723 | + if ( ! $this->checkout->revisit) { |
|
725 | 724 | $registration->save(); |
726 | 725 | } |
727 | 726 | |
@@ -732,41 +731,41 @@ discard block |
||
732 | 731 | * @var bool if TRUE is returned by the plugin then the |
733 | 732 | * registration processing is halted. |
734 | 733 | */ |
735 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
734 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
736 | 735 | return FALSE; |
737 | 736 | } |
738 | 737 | |
739 | 738 | // Houston, we have a registration! |
740 | 739 | $att_nmbr++; |
741 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
740 | + $this->_attendee_data[$reg_url_link] = array(); |
|
742 | 741 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
743 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
742 | + if (isset($valid_data[$reg_url_link])) { |
|
744 | 743 | // do we need to copy basic info from primary attendee ? |
745 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
744 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
746 | 745 | // filter form input data for this registration |
747 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
746 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
748 | 747 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
749 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
750 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
751 | - unset( $valid_data['primary_attendee'] ); |
|
748 | + if (isset($valid_data['primary_attendee'])) { |
|
749 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
750 | + unset($valid_data['primary_attendee']); |
|
752 | 751 | } |
753 | 752 | // now loop through our array of valid post data && process attendee reg forms |
754 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
755 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
756 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
753 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
754 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
755 | + foreach ($form_inputs as $form_input => $input_value) { |
|
757 | 756 | // check for critical inputs |
758 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
757 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
759 | 758 | return FALSE; |
760 | 759 | } |
761 | 760 | // store a bit of data about the primary attendee |
762 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
763 | - $primary_registrant[ $form_input ] = $input_value; |
|
764 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
765 | - $input_value = $primary_registrant[ $form_input ]; |
|
761 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
762 | + $primary_registrant[$form_input] = $input_value; |
|
763 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
764 | + $input_value = $primary_registrant[$form_input]; |
|
766 | 765 | } |
767 | 766 | // now attempt to save the input data |
768 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
769 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
767 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
768 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 769 | return FALSE; |
771 | 770 | } |
772 | 771 | } |
@@ -775,51 +774,51 @@ discard block |
||
775 | 774 | } |
776 | 775 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
777 | 776 | // this registration does not require additional attendee information ? |
778 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
777 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
779 | 778 | // just copy the primary registrant |
780 | 779 | $attendee = $this->checkout->primary_attendee_obj; |
781 | 780 | } else { |
782 | 781 | // have we met before? |
783 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
782 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
784 | 783 | // did we find an already existing record for this attendee ? |
785 | - if ( $attendee instanceof EE_Attendee ) { |
|
786 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
784 | + if ($attendee instanceof EE_Attendee) { |
|
785 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
787 | 786 | } else { |
788 | 787 | // ensure critical details are set for additional attendees |
789 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
790 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
788 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
789 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
791 | 790 | } |
792 | 791 | // who's #1 ? |
793 | - if ( $att_nmbr == 1 ) { |
|
792 | + if ($att_nmbr == 1) { |
|
794 | 793 | $this->checkout->primary_attendee_obj = $attendee; |
795 | 794 | } |
796 | 795 | } |
797 | 796 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
798 | 797 | // add relation to registration, set attendee ID, and cache attendee |
799 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
800 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
801 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
798 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
799 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
800 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
802 | 801 | return FALSE; |
803 | 802 | } |
804 | 803 | /** @type EE_Registration_Processor $registration_processor */ |
805 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
804 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
806 | 805 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
807 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
806 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
808 | 807 | /** @type EE_Transaction_Processor $transaction_processor */ |
809 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
808 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
810 | 809 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
811 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
810 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
812 | 811 | // if we've gotten this far, then let's save what we have |
813 | 812 | $registration->save(); |
814 | 813 | // add relation between TXN and registration |
815 | - $this->_associate_registration_with_transaction( $registration ); |
|
814 | + $this->_associate_registration_with_transaction($registration); |
|
816 | 815 | |
817 | 816 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
818 | 817 | |
819 | - } else { |
|
820 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
818 | + } else { |
|
819 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
821 | 820 | // remove malformed data |
822 | - unset( $valid_data[ $reg_url_link ] ); |
|
821 | + unset($valid_data[$reg_url_link]); |
|
823 | 822 | return FALSE; |
824 | 823 | } |
825 | 824 | |
@@ -837,22 +836,22 @@ discard block |
||
837 | 836 | * @param string $input_value |
838 | 837 | * @return boolean |
839 | 838 | */ |
840 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
839 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
841 | 840 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
842 | 841 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
843 | 842 | // allow for plugins to hook in and do their own processing of the form input. |
844 | 843 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
845 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
844 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
846 | 845 | return TRUE; |
847 | 846 | } |
848 | 847 | |
849 | 848 | // grab related answer objects |
850 | 849 | $answers = $registration->answers(); |
851 | 850 | // $answer_cache_id is the key used to find the EE_Answer we want |
852 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
853 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
851 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
852 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
854 | 853 | //rename form_inputs if they are EE_Attendee properties |
855 | - switch( (string)$form_input ) { |
|
854 | + switch ((string) $form_input) { |
|
856 | 855 | |
857 | 856 | case 'state' : |
858 | 857 | case 'STA_ID' : |
@@ -867,33 +866,33 @@ discard block |
||
867 | 866 | break; |
868 | 867 | |
869 | 868 | default : |
870 | - $ATT_input = 'ATT_' . $form_input; |
|
869 | + $ATT_input = 'ATT_'.$form_input; |
|
871 | 870 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
872 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
873 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
871 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
872 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
874 | 873 | } |
875 | 874 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
876 | 875 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
877 | 876 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
878 | 877 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
879 | 878 | // if this form input has a corresponding attendee property |
880 | - if ( $attendee_property ) { |
|
881 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
882 | - if ( $answer_is_obj ) { |
|
879 | + if ($attendee_property) { |
|
880 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
881 | + if ($answer_is_obj) { |
|
883 | 882 | // and delete the corresponding answer since we won't be storing this data in that object |
884 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
885 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
883 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
884 | + $answers[$answer_cache_id]->delete_permanently(); |
|
886 | 885 | } |
887 | 886 | return TRUE; |
888 | - } elseif ( $answer_is_obj ) { |
|
887 | + } elseif ($answer_is_obj) { |
|
889 | 888 | // save this data to the answer object |
890 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
891 | - $result = $answers[ $answer_cache_id ]->save(); |
|
889 | + $answers[$answer_cache_id]->set_value($input_value); |
|
890 | + $result = $answers[$answer_cache_id]->save(); |
|
892 | 891 | return $result !== false ? true : false; |
893 | 892 | } else { |
894 | - foreach ( $answers as $answer ) { |
|
895 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
896 | - $answer->set_value( $input_value ); |
|
893 | + foreach ($answers as $answer) { |
|
894 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
895 | + $answer->set_value($input_value); |
|
897 | 896 | $result = $answer->save(); |
898 | 897 | return $result !== false ? true : false; |
899 | 898 | } |
@@ -911,33 +910,33 @@ discard block |
||
911 | 910 | * @param string $input_value |
912 | 911 | * @return boolean |
913 | 912 | */ |
914 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
915 | - if ( empty( $input_value )) { |
|
913 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
914 | + if (empty($input_value)) { |
|
916 | 915 | // if the form input isn't marked as being required, then just return |
917 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
916 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
918 | 917 | return true; |
919 | 918 | } |
920 | - switch( $form_input ) { |
|
919 | + switch ($form_input) { |
|
921 | 920 | case 'fname' : |
922 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
921 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
923 | 922 | return FALSE; |
924 | 923 | break; |
925 | 924 | case 'lname' : |
926 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
925 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
927 | 926 | return FALSE; |
928 | 927 | break; |
929 | 928 | case 'email' : |
930 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
929 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
931 | 930 | return FALSE; |
932 | 931 | break; |
933 | 932 | } |
934 | - } else if ( $form_input === 'email' ) { |
|
933 | + } else if ($form_input === 'email') { |
|
935 | 934 | // clean the email address |
936 | - $valid_email = sanitize_email( $input_value ); |
|
935 | + $valid_email = sanitize_email($input_value); |
|
937 | 936 | // check if it matches |
938 | - if ( $input_value != $valid_email ) { |
|
937 | + if ($input_value != $valid_email) { |
|
939 | 938 | // whoops!!! |
940 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
939 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
941 | 940 | return FALSE; |
942 | 941 | } |
943 | 942 | } |
@@ -965,14 +964,14 @@ discard block |
||
965 | 964 | * @param array $attendee_data |
966 | 965 | * @return boolean |
967 | 966 | */ |
968 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
967 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
969 | 968 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
970 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
971 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
972 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
969 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
970 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
971 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
973 | 972 | // but only if those have values |
974 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
975 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
973 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
974 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
976 | 975 | 'ATT_fname' => $ATT_fname, |
977 | 976 | 'ATT_lname' => $ATT_lname, |
978 | 977 | 'ATT_email' => $ATT_email |
@@ -980,7 +979,7 @@ discard block |
||
980 | 979 | } else { |
981 | 980 | $existing_attendee = NULL; |
982 | 981 | } |
983 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
982 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
984 | 983 | } |
985 | 984 | |
986 | 985 | |
@@ -992,13 +991,13 @@ discard block |
||
992 | 991 | * @param array $attendee_data |
993 | 992 | * @return \EE_Attendee |
994 | 993 | */ |
995 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
994 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
996 | 995 | // first remove fname, lname, and email from attendee data |
997 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
996 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
998 | 997 | // now loop thru what's left and add to attendee CPT |
999 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1000 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1001 | - $existing_attendee->set( $property_name, $property_value ); |
|
998 | + foreach ($attendee_data as $property_name => $property_value) { |
|
999 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1000 | + $existing_attendee->set($property_name, $property_value); |
|
1002 | 1001 | } |
1003 | 1002 | } |
1004 | 1003 | // better save that now |
@@ -1015,11 +1014,11 @@ discard block |
||
1015 | 1014 | * @param EE_Attendee $attendee |
1016 | 1015 | * @return void |
1017 | 1016 | */ |
1018 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1017 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1019 | 1018 | // add relation to attendee |
1020 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1021 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1022 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1019 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1020 | + $registration->set_attendee_id($attendee->ID()); |
|
1021 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1023 | 1022 | } |
1024 | 1023 | |
1025 | 1024 | |
@@ -1030,10 +1029,10 @@ discard block |
||
1030 | 1029 | * @param EE_Registration $registration |
1031 | 1030 | * @return void |
1032 | 1031 | */ |
1033 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1032 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1034 | 1033 | // add relation to attendee |
1035 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1036 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1034 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1035 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1037 | 1036 | } |
1038 | 1037 | |
1039 | 1038 | |
@@ -1045,17 +1044,17 @@ discard block |
||
1045 | 1044 | * @param array $attendee_data |
1046 | 1045 | * @return array |
1047 | 1046 | */ |
1048 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1047 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1049 | 1048 | // bare minimum critical details include first name, last name, email address |
1050 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1049 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1051 | 1050 | // add address info to critical details? |
1052 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1053 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1054 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1051 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1052 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1053 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1055 | 1054 | } |
1056 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1057 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1058 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1055 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1056 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1057 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1059 | 1058 | } |
1060 | 1059 | } |
1061 | 1060 | return $attendee_data; |
@@ -1070,11 +1069,11 @@ discard block |
||
1070 | 1069 | * @param array $attendee_data |
1071 | 1070 | * @return \EE_Attendee |
1072 | 1071 | */ |
1073 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1072 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1074 | 1073 | // create new attendee object |
1075 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1074 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1076 | 1075 | // set author to event creator |
1077 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1076 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1078 | 1077 | $new_attendee->save(); |
1079 | 1078 | return $new_attendee; |
1080 | 1079 | } |
@@ -1090,7 +1089,7 @@ discard block |
||
1090 | 1089 | */ |
1091 | 1090 | public function update_reg_step() { |
1092 | 1091 | // save everything |
1093 | - if ( $this->process_reg_step() ) { |
|
1092 | + if ($this->process_reg_step()) { |
|
1094 | 1093 | $this->checkout->redirect = TRUE; |
1095 | 1094 | $this->checkout->redirect_url = add_query_arg( |
1096 | 1095 | array( |
@@ -1099,7 +1098,7 @@ discard block |
||
1099 | 1098 | ), |
1100 | 1099 | $this->checkout->thank_you_page_url |
1101 | 1100 | ); |
1102 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1101 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1103 | 1102 | return TRUE; |
1104 | 1103 | } |
1105 | 1104 | return FALSE; |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Applies all teh individual item validation strategies on each item in the array |
29 | 29 | * @param array $normalized_value |
30 | - * @return boolean |
|
30 | + * @return boolean|null |
|
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
33 | 33 | if( is_array($normalized_value)){ |
@@ -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 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _init_page_props() { |
65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
68 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
68 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
70 | 70 | $this->_cpt_model_names = array( |
71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => __('Update Venue', 'event_espresso'), |
109 | 109 | 'add_category' => __('Save New Category', 'event_espresso'), |
110 | 110 | 'edit_category' => __('Update Category', 'event_espresso'), |
111 | - 'google_map_settings' => __( 'Update Settings', 'event_espresso' ) |
|
111 | + 'google_map_settings' => __('Update Settings', 'event_espresso') |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | protected function _set_page_routes() { |
121 | 121 | |
122 | 122 | //load formatter helper |
123 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
123 | + EE_Registry::instance()->load_helper('Formatter'); |
|
124 | 124 | //load field generator helper |
125 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
125 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
126 | 126 | |
127 | 127 | //is there a vnu_id in the request? |
128 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
129 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
128 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
129 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
130 | 130 | |
131 | 131 | $this->_page_routes = array( |
132 | 132 | 'default' => array( |
@@ -144,27 +144,27 @@ discard block |
||
144 | 144 | ), |
145 | 145 | 'trash_venue' => array( |
146 | 146 | 'func' => '_trash_or_restore_venue', |
147 | - 'args' => array( 'venue_status' => 'trash' ), |
|
147 | + 'args' => array('venue_status' => 'trash'), |
|
148 | 148 | 'noheader' => TRUE, |
149 | 149 | 'capability' => 'ee_delete_venue', |
150 | 150 | 'obj_id' => $vnu_id |
151 | 151 | ), |
152 | 152 | 'trash_venues' => array( |
153 | 153 | 'func' => '_trash_or_restore_venues', |
154 | - 'args' => array( 'venue_status' => 'trash' ), |
|
154 | + 'args' => array('venue_status' => 'trash'), |
|
155 | 155 | 'noheader' => TRUE, |
156 | 156 | 'capability' => 'ee_delete_venues' |
157 | 157 | ), |
158 | 158 | 'restore_venue' => array( |
159 | 159 | 'func' => '_trash_or_restore_venue', |
160 | - 'args' => array( 'venue_status' => 'draft' ), |
|
160 | + 'args' => array('venue_status' => 'draft'), |
|
161 | 161 | 'noheader' => TRUE, |
162 | 162 | 'capability' => 'ee_delete_venue', |
163 | 163 | 'obj_id' => $vnu_id |
164 | 164 | ), |
165 | 165 | 'restore_venues' => array( |
166 | 166 | 'func' => '_trash_or_restore_venues', |
167 | - 'args' => array( 'venue_status' => 'draft' ), |
|
167 | + 'args' => array('venue_status' => 'draft'), |
|
168 | 168 | 'noheader' => TRUE, |
169 | 169 | 'capability' => 'ee_delete_venues' |
170 | 170 | ), |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'filename' => 'venues_overview_views_bulk_actions_search' |
267 | 267 | ) |
268 | 268 | ), |
269 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
269 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
270 | 270 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
271 | 271 | 'require_nonce' => FALSE |
272 | 272 | ), |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | 'filename' => 'venues_editor_other' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
305 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
306 | 306 | 'metaboxes' => array('_venue_editor_metaboxes'), |
307 | 307 | 'require_nonce' => FALSE |
308 | 308 | ), |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | 'label' => __('Edit Venue', 'event_espresso'), |
312 | 312 | 'order' => 5, |
313 | 313 | 'persistent' => FALSE, |
314 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
314 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
315 | 315 | ), |
316 | 316 | 'help_tabs' => array( |
317 | 317 | 'venues_editor_help_tab' => array( |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | 'filename' => 'venues_editor_other' |
340 | 340 | ) |
341 | 341 | ), |
342 | - 'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ), |
|
342 | + 'help_tour' => array('Venues_Edit_Venue_Help_Tour'), |
|
343 | 343 | 'metaboxes' => array('_venue_editor_metaboxes'), |
344 | 344 | 'require_nonce' => FALSE |
345 | 345 | ), |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | 'label' => __('Google Maps'), |
349 | 349 | 'order' => 40 |
350 | 350 | ), |
351 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
351 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
352 | 352 | 'help_tabs' => array( |
353 | 353 | 'general_settings_google_maps_help_tab' => array( |
354 | 354 | 'title' => __('Google Maps', 'event_espresso'), |
355 | 355 | 'filename' => 'general_settings_google_maps' |
356 | 356 | ) |
357 | 357 | ), |
358 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
358 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
359 | 359 | 'require_nonce' => FALSE |
360 | 360 | ), |
361 | 361 | //venue category stuff |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | 'filename' => 'venues_add_category' |
372 | 372 | ) |
373 | 373 | ), |
374 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
374 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
375 | 375 | 'require_nonce' => FALSE |
376 | 376 | ), |
377 | 377 | 'edit_category' => array( |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | 'label' => __('Edit Category', 'event_espresso'), |
380 | 380 | 'order' => 15, |
381 | 381 | 'persistent' => FALSE, |
382 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
382 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
383 | 383 | ), |
384 | 384 | 'metaboxes' => array('_publish_post_box'), |
385 | 385 | 'help_tabs' => array( |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'filename' => 'venues_edit_category' |
389 | 389 | ) |
390 | 390 | ), |
391 | - 'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ), |
|
391 | + 'help_tour' => array('Venues_Edit_Category_Help_Tour'), |
|
392 | 392 | 'require_nonce' => FALSE |
393 | 393 | ), |
394 | 394 | 'category_list' => array( |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | 'filename' => 'venues_categories_other' |
416 | 416 | ) |
417 | 417 | ), |
418 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
418 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
419 | 419 | 'metaboxes' => $this->_default_espresso_metaboxes, |
420 | 420 | 'require_nonce' => FALSE |
421 | 421 | ) |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | |
473 | 473 | |
474 | 474 | public function load_scripts_styles() { |
475 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
475 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
476 | 476 | wp_enqueue_style('ee-cat-admin'); |
477 | 477 | } |
478 | 478 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | public function load_scripts_styles_edit() { |
496 | 496 | //styles |
497 | 497 | wp_enqueue_style('espresso-ui-theme'); |
498 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
498 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
499 | 499 | wp_enqueue_style('espresso_venues'); |
500 | 500 | } |
501 | 501 | |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | ) |
515 | 515 | ); |
516 | 516 | |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
518 | 518 | $this->_views['all']['bulk_action'] = array( |
519 | 519 | 'trash_venues' => __('Move to Trash', 'event_espresso') |
520 | 520 | ); |
521 | 521 | $this->_views['trash'] = array( |
522 | 522 | 'slug' => 'trash', |
523 | - 'label' => __( 'Trash', 'event_espresso' ), |
|
523 | + 'label' => __('Trash', 'event_espresso'), |
|
524 | 524 | 'count' => 0, |
525 | 525 | 'bulk_action' => array( |
526 | 526 | 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | |
554 | 554 | |
555 | 555 | protected function _overview_list_table() { |
556 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
557 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' ); |
|
556 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
557 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button'); |
|
558 | 558 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
559 | 559 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
560 | 560 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
569 | 569 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
570 | 570 | ); |
571 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
572 | - EEH_Template::display_template( $template, $extra_rows ); |
|
571 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
572 | + EEH_Template::display_template($template, $extra_rows); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -584,115 +584,115 @@ discard block |
||
584 | 584 | $default_map_settings = new stdClass(); |
585 | 585 | $default_map_settings->use_google_maps = TRUE; |
586 | 586 | // for event details pages (reg page) |
587 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
588 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
589 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
590 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
591 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
592 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
593 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
587 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
588 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
589 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
590 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
591 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
592 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
593 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
594 | 594 | // for event list pages |
595 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
596 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
597 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
598 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
599 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
600 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
601 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
595 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
596 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
597 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
598 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
599 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
600 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
601 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
602 | 602 | |
603 | 603 | $this->_template_args['map_settings'] = |
604 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
605 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
604 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
605 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
606 | 606 | : $default_map_settings; |
607 | 607 | |
608 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
609 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
610 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE ); |
|
608 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
609 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
610 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE); |
|
611 | 611 | $this->display_admin_page_with_sidebar(); |
612 | 612 | } |
613 | 613 | |
614 | 614 | protected function _update_google_map_settings() { |
615 | 615 | |
616 | 616 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
617 | - isset( $this->_req_data['use_google_maps'] ) |
|
618 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
617 | + isset($this->_req_data['use_google_maps']) |
|
618 | + ? absint($this->_req_data['use_google_maps']) |
|
619 | 619 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
620 | 620 | |
621 | 621 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
622 | - isset( $this->_req_data['event_details_map_width'] ) |
|
623 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
622 | + isset($this->_req_data['event_details_map_width']) |
|
623 | + ? absint($this->_req_data['event_details_map_width']) |
|
624 | 624 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
625 | 625 | |
626 | 626 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
627 | - isset( $this->_req_data['event_details_map_height'] ) |
|
628 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
627 | + isset($this->_req_data['event_details_map_height']) |
|
628 | + ? absint($this->_req_data['event_details_map_height']) |
|
629 | 629 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
630 | 630 | |
631 | 631 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
632 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
633 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
632 | + isset($this->_req_data['event_details_map_zoom']) |
|
633 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
634 | 634 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
635 | 635 | |
636 | 636 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
637 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
638 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
637 | + isset($this->_req_data['event_details_display_nav']) |
|
638 | + ? absint($this->_req_data['event_details_display_nav']) |
|
639 | 639 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
640 | 640 | |
641 | 641 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
642 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
643 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
642 | + isset($this->_req_data['event_details_nav_size']) |
|
643 | + ? absint($this->_req_data['event_details_nav_size']) |
|
644 | 644 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
645 | 645 | |
646 | 646 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
647 | - isset( $this->_req_data['event_details_control_type'] ) |
|
648 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
647 | + isset($this->_req_data['event_details_control_type']) |
|
648 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
649 | 649 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
650 | 650 | |
651 | 651 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
652 | - isset( $this->_req_data['event_details_map_align'] ) |
|
653 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
652 | + isset($this->_req_data['event_details_map_align']) |
|
653 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
654 | 654 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
655 | 655 | |
656 | 656 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
657 | - isset( $this->_req_data['event_list_map_width'] ) |
|
658 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
657 | + isset($this->_req_data['event_list_map_width']) |
|
658 | + ? absint($this->_req_data['event_list_map_width']) |
|
659 | 659 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
660 | 660 | |
661 | 661 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
662 | - isset( $this->_req_data['event_list_map_height'] ) |
|
663 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
662 | + isset($this->_req_data['event_list_map_height']) |
|
663 | + ? absint($this->_req_data['event_list_map_height']) |
|
664 | 664 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
665 | 665 | |
666 | 666 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
667 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
668 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
667 | + isset($this->_req_data['event_list_map_zoom']) |
|
668 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
669 | 669 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
670 | 670 | |
671 | 671 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
672 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
673 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
672 | + isset($this->_req_data['event_list_display_nav']) |
|
673 | + ? absint($this->_req_data['event_list_display_nav']) |
|
674 | 674 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
675 | 675 | |
676 | 676 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
677 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
678 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
677 | + isset($this->_req_data['event_list_nav_size']) |
|
678 | + ? absint($this->_req_data['event_list_nav_size']) |
|
679 | 679 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
680 | 680 | |
681 | 681 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
682 | - isset( $this->_req_data['event_list_control_type'] ) |
|
683 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
682 | + isset($this->_req_data['event_list_control_type']) |
|
683 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
684 | 684 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
685 | 685 | |
686 | 686 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
687 | - isset( $this->_req_data['event_list_map_align'] ) |
|
688 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
687 | + isset($this->_req_data['event_list_map_align']) |
|
688 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
689 | 689 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
690 | 690 | |
691 | - EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings ); |
|
691 | + EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings); |
|
692 | 692 | |
693 | 693 | $what = 'Google Map Settings'; |
694 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
695 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
694 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__); |
|
695 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
696 | 696 | |
697 | 697 | } |
698 | 698 | |
@@ -701,9 +701,9 @@ discard block |
||
701 | 701 | protected function _venue_editor_metaboxes() { |
702 | 702 | $this->verify_cpt_object(); |
703 | 703 | |
704 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
705 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
706 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
704 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
705 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
706 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
707 | 707 | |
708 | 708 | } |
709 | 709 | |
@@ -711,23 +711,23 @@ discard block |
||
711 | 711 | |
712 | 712 | public function venue_gmap_metabox() { |
713 | 713 | $template_args = array( |
714 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
714 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
715 | 715 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
716 | 716 | ); |
717 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
718 | - EEH_Template::display_template( $template, $template_args ); |
|
717 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
718 | + EEH_Template::display_template($template, $template_args); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
722 | 722 | |
723 | 723 | public function venue_address_metabox() { |
724 | 724 | |
725 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
725 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
726 | 726 | |
727 | 727 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
728 | 728 | $QFI = new EE_Question_Form_Input( |
729 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
730 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
729 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
730 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
731 | 731 | array( |
732 | 732 | 'input_name' => 'sta_id', |
733 | 733 | 'input_id' => 'sta_id', |
@@ -739,8 +739,8 @@ discard block |
||
739 | 739 | ); |
740 | 740 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
741 | 741 | $QFI = new EE_Question_Form_Input( |
742 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
743 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
742 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
743 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
744 | 744 | array( |
745 | 745 | 'input_name' => 'cnt_iso', |
746 | 746 | 'input_id' => 'cnt_iso', |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | ) |
752 | 752 | ); |
753 | 753 | |
754 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
755 | - EEH_Template::display_template( $template, $template_args ); |
|
754 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
755 | + EEH_Template::display_template($template, $template_args); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | |
@@ -764,8 +764,8 @@ discard block |
||
764 | 764 | $template_args = array( |
765 | 765 | '_venue' => $this->_cpt_model_obj |
766 | 766 | ); |
767 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
768 | - EEH_Template::display_template( $template, $template_args ); |
|
767 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
768 | + EEH_Template::display_template($template, $template_args); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -788,52 +788,52 @@ discard block |
||
788 | 788 | * @param object $post Post object (with "blessed" WP properties) |
789 | 789 | * @return void |
790 | 790 | */ |
791 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
791 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
792 | 792 | |
793 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) { |
|
794 | - return;// get out we're not processing the saving of venues. |
|
793 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
794 | + return; // get out we're not processing the saving of venues. |
|
795 | 795 | } |
796 | 796 | |
797 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
797 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
798 | 798 | |
799 | 799 | $venue_values = array( |
800 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
801 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
802 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
803 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
804 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
805 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
806 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
807 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF, |
|
808 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
809 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
810 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
811 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
812 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
800 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
801 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
802 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
803 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
804 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
805 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
806 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
807 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF, |
|
808 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
809 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
810 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
811 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
812 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
813 | 813 | ); |
814 | 814 | |
815 | 815 | //update venue |
816 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
816 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
817 | 817 | |
818 | 818 | //get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
819 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
820 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
819 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
820 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
821 | 821 | |
822 | 822 | //notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
823 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
823 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
824 | 824 | |
825 | 825 | $att_success = TRUE; |
826 | 826 | |
827 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
828 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
829 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
827 | + foreach ($venue_update_callbacks as $v_callback) { |
|
828 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
829 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | //any errors? |
833 | - if ( $success && !$att_success ) { |
|
834 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
835 | - } else if ( $success === FALSE ) { |
|
836 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
833 | + if ($success && ! $att_success) { |
|
834 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
835 | + } else if ($success === FALSE) { |
|
836 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
837 | 837 | } |
838 | 838 | } |
839 | 839 | |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | |
842 | 842 | |
843 | 843 | |
844 | - public function trash_cpt_item( $post_id ) { |
|
844 | + public function trash_cpt_item($post_id) { |
|
845 | 845 | $this->_req_data['VNU_ID'] = $post_id; |
846 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
846 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | |
@@ -851,18 +851,18 @@ discard block |
||
851 | 851 | |
852 | 852 | |
853 | 853 | |
854 | - public function restore_cpt_item( $post_id ) { |
|
854 | + public function restore_cpt_item($post_id) { |
|
855 | 855 | $this->_req_data['VNU_ID'] = $post_id; |
856 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
856 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | |
860 | 860 | |
861 | 861 | |
862 | 862 | |
863 | - public function delete_cpt_item( $post_id ) { |
|
863 | + public function delete_cpt_item($post_id) { |
|
864 | 864 | $this->_req_data['VNU_ID'] = $post_id; |
865 | - $this->_delete_venue( FALSE ); |
|
865 | + $this->_delete_venue(FALSE); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -877,15 +877,15 @@ discard block |
||
877 | 877 | |
878 | 878 | |
879 | 879 | |
880 | - protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
881 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
880 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) { |
|
881 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
882 | 882 | |
883 | 883 | //loop thru venues |
884 | - if ( $VNU_ID ) { |
|
884 | + if ($VNU_ID) { |
|
885 | 885 | //clean status |
886 | - $venue_status = sanitize_key( $venue_status ); |
|
886 | + $venue_status = sanitize_key($venue_status); |
|
887 | 887 | // grab status |
888 | - if (!empty($venue_status)) { |
|
888 | + if ( ! empty($venue_status)) { |
|
889 | 889 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
890 | 890 | } else { |
891 | 891 | $success = FALSE; |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | } |
900 | 900 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
901 | 901 | |
902 | - if ( $redirect_after ) |
|
902 | + if ($redirect_after) |
|
903 | 903 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
904 | 904 | |
905 | 905 | } |
@@ -908,11 +908,11 @@ discard block |
||
908 | 908 | |
909 | 909 | |
910 | 910 | |
911 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
911 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
912 | 912 | // clean status |
913 | 913 | $venue_status = sanitize_key($venue_status); |
914 | 914 | // grab status |
915 | - if (!empty($venue_status)) { |
|
915 | + if ( ! empty($venue_status)) { |
|
916 | 916 | $success = TRUE; |
917 | 917 | //determine the event id and set to array. |
918 | 918 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -952,20 +952,20 @@ discard block |
||
952 | 952 | * @param string $venue_status |
953 | 953 | * @return void |
954 | 954 | */ |
955 | - private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
|
955 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') { |
|
956 | 956 | // grab venue id |
957 | - if (! $VNU_ID) { |
|
957 | + if ( ! $VNU_ID) { |
|
958 | 958 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
959 | 959 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
960 | 960 | return FALSE; |
961 | 961 | } |
962 | 962 | |
963 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
963 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
964 | 964 | |
965 | 965 | // clean status |
966 | 966 | $venue_status = sanitize_key($venue_status); |
967 | 967 | // grab status |
968 | - if ( ! $venue_status ) { |
|
968 | + if ( ! $venue_status) { |
|
969 | 969 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
970 | 970 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
971 | 971 | return FALSE; |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $hook = FALSE; |
987 | 987 | } |
988 | 988 | //use class to change status |
989 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
989 | + $this->_cpt_model_obj->set_status($venue_status); |
|
990 | 990 | $success = $this->_cpt_model_obj->save(); |
991 | 991 | |
992 | 992 | if ($success === FALSE) { |
@@ -1005,21 +1005,21 @@ discard block |
||
1005 | 1005 | * @param bool $redirect_after |
1006 | 1006 | * @return void |
1007 | 1007 | */ |
1008 | - protected function _delete_venue( $redirect_after = true ) { |
|
1008 | + protected function _delete_venue($redirect_after = true) { |
|
1009 | 1009 | //determine the venue id and set to array. |
1010 | 1010 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
1011 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID; |
|
1011 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1012 | 1012 | |
1013 | 1013 | |
1014 | 1014 | // loop thru venues |
1015 | 1015 | if ($VNU_ID) { |
1016 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
1016 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1017 | 1017 | } else { |
1018 | 1018 | $success = FALSE; |
1019 | 1019 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1020 | 1020 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1021 | 1021 | } |
1022 | - if ( $redirect_after ) |
|
1022 | + if ($redirect_after) |
|
1023 | 1023 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | //todo: put in parent |
1052 | 1052 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
1053 | 1053 | // grab event id |
1054 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
1054 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1055 | 1055 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1056 | 1056 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1057 | 1057 | return FALSE; |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1072 | 1072 | return FALSE; |
1073 | 1073 | } |
1074 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
1074 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1075 | 1075 | return TRUE; |
1076 | 1076 | } |
1077 | 1077 | |
@@ -1082,11 +1082,11 @@ discard block |
||
1082 | 1082 | /* QUERIES */ |
1083 | 1083 | |
1084 | 1084 | |
1085 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
1085 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
1086 | 1086 | |
1087 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
1087 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1088 | 1088 | |
1089 | - switch ( $_orderby ) { |
|
1089 | + switch ($_orderby) { |
|
1090 | 1090 | case 'id': |
1091 | 1091 | $orderby = 'VNU_ID'; |
1092 | 1092 | break; |
@@ -1104,43 +1104,43 @@ discard block |
||
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
1107 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1108 | 1108 | |
1109 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1110 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
1111 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1109 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1110 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1111 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1112 | 1112 | |
1113 | 1113 | |
1114 | - $offset = ($current_page-1)*$per_page; |
|
1114 | + $offset = ($current_page - 1) * $per_page; |
|
1115 | 1115 | $limit = array($offset, $per_page); |
1116 | 1116 | |
1117 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1117 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1118 | 1118 | $where = array(); |
1119 | 1119 | |
1120 | 1120 | //only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
1121 | - if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) { |
|
1121 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1122 | 1122 | $where['status'] = $this->_req_data['status']; |
1123 | 1123 | } |
1124 | 1124 | |
1125 | - if ( isset( $this->_req_data['venue_status'] ) ) { |
|
1125 | + if (isset($this->_req_data['venue_status'])) { |
|
1126 | 1126 | $where['status'] = $this->_req_data['venue_status']; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | |
1130 | - if ( $category ) { |
|
1130 | + if ($category) { |
|
1131 | 1131 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
1132 | 1132 | $where['Term_Taxonomy.term_id'] = $category; |
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
1136 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
1137 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1136 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1137 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1138 | 1138 | } else { |
1139 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
1139 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1140 | 1140 | $where['OR'] = array( |
1141 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1141 | + 'status*restrict_private' => array('!=', 'private'), |
|
1142 | 1142 | 'AND' => array( |
1143 | - 'status*inclusive' => array( '=', 'private' ), |
|
1143 | + 'status*inclusive' => array('=', 'private'), |
|
1144 | 1144 | 'VNU_wp_user' => get_current_user_id() |
1145 | 1145 | ) |
1146 | 1146 | ); |
@@ -1150,30 +1150,30 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | |
1152 | 1152 | |
1153 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1154 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1153 | + if (isset($this->_req_data['s'])) { |
|
1154 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1155 | 1155 | $where['OR'] = array( |
1156 | - 'VNU_name' => array('LIKE',$sstr ), |
|
1157 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
1158 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
1159 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
1160 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
1161 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
1162 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
1163 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
1164 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
1165 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
1166 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
1167 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
1168 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
1169 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
1170 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
1171 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
1156 | + 'VNU_name' => array('LIKE', $sstr), |
|
1157 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1158 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1159 | + 'VNU_address' => array('LIKE', $sstr), |
|
1160 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1161 | + 'VNU_city' => array('LIKE', $sstr), |
|
1162 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1163 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1164 | + 'VNU_url' => array('LIKE', $sstr), |
|
1165 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1166 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1167 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1168 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1169 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1170 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1171 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1172 | 1172 | ); |
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
1176 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
1177 | 1177 | |
1178 | 1178 | return $venues; |
1179 | 1179 | |
@@ -1191,22 +1191,22 @@ discard block |
||
1191 | 1191 | * @return void |
1192 | 1192 | */ |
1193 | 1193 | private function _set_category_object() { |
1194 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1194 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
1195 | 1195 | return; //already have the category object so get out. |
1196 | 1196 | |
1197 | 1197 | //set default category object |
1198 | 1198 | $this->_set_empty_category_object(); |
1199 | 1199 | |
1200 | 1200 | //only set if we've got an id |
1201 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
1201 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1202 | 1202 | return; |
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
1206 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
1206 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1207 | 1207 | |
1208 | 1208 | |
1209 | - if ( !empty( $term ) ) { |
|
1209 | + if ( ! empty($term)) { |
|
1210 | 1210 | $this->_category->category_name = $term->name; |
1211 | 1211 | $this->_category->category_identifier = $term->slug; |
1212 | 1212 | $this->_category->category_desc = $term->description; |
@@ -1220,14 +1220,14 @@ discard block |
||
1220 | 1220 | |
1221 | 1221 | private function _set_empty_category_object() { |
1222 | 1222 | $this->_category = new stdClass(); |
1223 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1223 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1224 | 1224 | $this->_category->id = $this->_category->parent = 0; |
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | |
1228 | 1228 | |
1229 | 1229 | protected function _category_list_table() { |
1230 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1230 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1231 | 1231 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
1232 | 1232 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
1233 | 1233 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -1237,21 +1237,21 @@ discard block |
||
1237 | 1237 | protected function _category_details($view) { |
1238 | 1238 | |
1239 | 1239 | //load formatter helper |
1240 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1240 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1241 | 1241 | //load field generator helper |
1242 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1242 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1243 | 1243 | |
1244 | 1244 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
1245 | 1245 | $this->_set_add_edit_form_tags($route); |
1246 | 1246 | |
1247 | 1247 | $this->_set_category_object(); |
1248 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
1248 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1249 | 1249 | |
1250 | 1250 | $delete_action = 'delete_category'; |
1251 | 1251 | |
1252 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
1252 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1253 | 1253 | |
1254 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
1254 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1255 | 1255 | |
1256 | 1256 | //take care of contents |
1257 | 1257 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1265,25 +1265,25 @@ discard block |
||
1265 | 1265 | 'type' => 'wp_editor', |
1266 | 1266 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
1267 | 1267 | 'class' => 'my_editor_custom', |
1268 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
1268 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
1269 | 1269 | ); |
1270 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
1270 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1271 | 1271 | |
1272 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
1272 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
1273 | 1273 | |
1274 | 1274 | //setup category select for term parents. |
1275 | 1275 | $category_select_values[] = array( |
1276 | 1276 | 'text' => __('No Parent', 'event_espresso'), |
1277 | 1277 | 'id' => 0 |
1278 | 1278 | ); |
1279 | - foreach ( $all_terms as $term ) { |
|
1279 | + foreach ($all_terms as $term) { |
|
1280 | 1280 | $category_select_values[] = array( |
1281 | 1281 | 'text' => $term->name, |
1282 | 1282 | 'id' => $term->term_id |
1283 | 1283 | ); |
1284 | 1284 | } |
1285 | 1285 | |
1286 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
1286 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
1287 | 1287 | $template_args = array( |
1288 | 1288 | 'category' => $this->_category, |
1289 | 1289 | 'category_select' => $category_select, |
@@ -1292,15 +1292,15 @@ discard block |
||
1292 | 1292 | 'disable' => '', |
1293 | 1293 | 'disabled_message' =>FALSE |
1294 | 1294 | ); |
1295 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1296 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
1295 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1296 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | |
1300 | 1300 | protected function _delete_categories() { |
1301 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1301 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1302 | 1302 | |
1303 | - foreach ( $cat_ids as $cat_id ) { |
|
1303 | + foreach ($cat_ids as $cat_id) { |
|
1304 | 1304 | $this->_delete_category($cat_id); |
1305 | 1305 | } |
1306 | 1306 | |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | $query_args = array( |
1309 | 1309 | 'action' => 'category_list' |
1310 | 1310 | ); |
1311 | - $this->_redirect_after_action(0,'','',$query_args); |
|
1311 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1312 | 1312 | |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1317,58 +1317,58 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | |
1319 | 1319 | protected function _delete_category($cat_id) { |
1320 | - $cat_id = absint( $cat_id ); |
|
1321 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
1320 | + $cat_id = absint($cat_id); |
|
1321 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | |
1325 | 1325 | |
1326 | 1326 | protected function _insert_or_update_category($new_category) { |
1327 | 1327 | |
1328 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
1328 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
1329 | 1329 | $success = 0; //we already have a success message so lets not send another. |
1330 | - if ( $cat_id ) { |
|
1330 | + if ($cat_id) { |
|
1331 | 1331 | $query_args = array( |
1332 | 1332 | 'action' => 'edit_category', |
1333 | 1333 | 'VEN_CAT_ID' => $cat_id |
1334 | 1334 | ); |
1335 | 1335 | } else { |
1336 | - $query_args = array( 'action' => 'add_category' ); |
|
1336 | + $query_args = array('action' => 'add_category'); |
|
1337 | 1337 | } |
1338 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
1338 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
1339 | 1339 | |
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | |
1343 | 1343 | |
1344 | - private function _insert_category( $update = FALSE ) { |
|
1344 | + private function _insert_category($update = FALSE) { |
|
1345 | 1345 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
1346 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
1347 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
1348 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
1346 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1347 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1348 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1349 | 1349 | |
1350 | - if ( empty( $category_name ) ) { |
|
1351 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
1352 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1350 | + if (empty($category_name)) { |
|
1351 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1352 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1353 | 1353 | return false; |
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | |
1357 | - $term_args=array( |
|
1357 | + $term_args = array( |
|
1358 | 1358 | 'name'=>$category_name, |
1359 | 1359 | 'description'=>$category_desc, |
1360 | 1360 | 'parent'=>$category_parent |
1361 | 1361 | ); |
1362 | 1362 | |
1363 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1363 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
1364 | 1364 | |
1365 | - if ( !is_array( $insert_ids ) ) { |
|
1366 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1367 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1365 | + if ( ! is_array($insert_ids)) { |
|
1366 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1367 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1368 | 1368 | } else { |
1369 | 1369 | $cat_id = $insert_ids['term_id']; |
1370 | - $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
1371 | - EE_Error::add_success( $msg ); |
|
1370 | + $msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name); |
|
1371 | + EE_Error::add_success($msg); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | return $cat_id; |
@@ -1388,12 +1388,12 @@ discard block |
||
1388 | 1388 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
1389 | 1389 | ); |
1390 | 1390 | |
1391 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
1391 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1392 | 1392 | |
1393 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1394 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
1395 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
1396 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
1393 | + EE_Registry::instance()->load_helper('File'); |
|
1394 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1395 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1396 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1397 | 1397 | $EE_Export->export(); |
1398 | 1398 | } |
1399 | 1399 | |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | |
1406 | 1406 | protected function _import_categories() { |
1407 | 1407 | |
1408 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1408 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1409 | 1409 | EE_Import::instance()->import(); |
1410 | 1410 | |
1411 | 1411 | } |
@@ -1413,29 +1413,29 @@ discard block |
||
1413 | 1413 | |
1414 | 1414 | |
1415 | 1415 | |
1416 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1416 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
1417 | 1417 | |
1418 | 1418 | //testing term stuff |
1419 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1420 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1421 | - $limit = ($current_page-1)*$per_page; |
|
1422 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1423 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1424 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1419 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1420 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1421 | + $limit = ($current_page - 1) * $per_page; |
|
1422 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1423 | + if (isset($this->_req_data['s'])) { |
|
1424 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1425 | 1425 | $where['OR'] = array( |
1426 | - 'Term.name' => array( 'LIKE', $sstr), |
|
1427 | - 'description' => array( 'LIKE', $sstr ) |
|
1426 | + 'Term.name' => array('LIKE', $sstr), |
|
1427 | + 'description' => array('LIKE', $sstr) |
|
1428 | 1428 | ); |
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | $query_params = array( |
1432 | 1432 | $where, |
1433 | - 'order_by' => array( $orderby => $order ), |
|
1434 | - 'limit' => $limit . ',' . $per_page, |
|
1433 | + 'order_by' => array($orderby => $order), |
|
1434 | + 'limit' => $limit.','.$per_page, |
|
1435 | 1435 | 'force_join' => array('Term') |
1436 | 1436 | ); |
1437 | 1437 | |
1438 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1438 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1439 | 1439 | |
1440 | 1440 | return $categories; |
1441 | 1441 | } |
@@ -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 | /** |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | $this->_name = 'pricing'; |
55 | 55 | |
56 | 56 | //capability check |
57 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) { |
|
57 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
61 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
62 | 62 | |
63 | 63 | //if we were going to add our own metaboxes we'd use the below. |
64 | 64 | $this->_metaboxes = array( |
65 | 65 | 0 => array( |
66 | - 'page_route' => array('edit','create_new'), |
|
66 | + 'page_route' => array('edit', 'create_new'), |
|
67 | 67 | 'func' => 'pricing_metabox', |
68 | 68 | 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
69 | 69 | 'priority' => 'high', |
70 | 70 | 'context' => 'normal' |
71 | 71 | ), |
72 | 72 | |
73 | - );/**/ |
|
73 | + ); /**/ |
|
74 | 74 | |
75 | 75 | $this->_remove_metaboxes = array( |
76 | 76 | 0 => array( |
@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @var array Expected an array returned with 'date' and 'time' keys. |
91 | 91 | */ |
92 | - $this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
92 | + $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
93 | 93 | 'date' => 'Y-m-d', |
94 | 94 | 'time' => 'h:i a' |
95 | 95 | )); |
96 | 96 | |
97 | 97 | //validate |
98 | - $this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null; |
|
99 | - $this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null; |
|
98 | + $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
99 | + $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
100 | 100 | |
101 | 101 | //validate format strings |
102 | - $format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
103 | - if ( is_array( $format_validation ) ) { |
|
104 | - $msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>'; |
|
105 | - foreach ( $format_validation as $error ) { |
|
106 | - $msg .= '<li>' . $error . '</li>'; |
|
102 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
103 | + if (is_array($format_validation)) { |
|
104 | + $msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>'; |
|
105 | + foreach ($format_validation as $error) { |
|
106 | + $msg .= '<li>'.$error.'</li>'; |
|
107 | 107 | } |
108 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
109 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
108 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
109 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
110 | 110 | $this->_date_format_strings = array( |
111 | 111 | 'date' => 'Y-m-d', |
112 | 112 | 'time' => 'h:i a' |
@@ -117,60 +117,60 @@ discard block |
||
117 | 117 | $this->_scripts_styles = array( |
118 | 118 | 'registers' => array( |
119 | 119 | 'ee-tickets-datetimes-css' => array( |
120 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
120 | + 'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css', |
|
121 | 121 | 'type' => 'css' |
122 | 122 | ), |
123 | 123 | 'ee-dtt-ticket-metabox' => array( |
124 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
124 | + 'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js', |
|
125 | 125 | 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
126 | 126 | ) |
127 | 127 | ), |
128 | 128 | 'deregisters' => array( |
129 | - 'event-editor-css' => array('type' => 'css' ), |
|
129 | + 'event-editor-css' => array('type' => 'css'), |
|
130 | 130 | 'event-datetime-metabox' => array('type' => 'js') |
131 | 131 | ), |
132 | 132 | 'enqueues' => array( |
133 | - 'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ), |
|
134 | - 'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' ) |
|
133 | + 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
134 | + 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
135 | 135 | ), |
136 | 136 | 'localize' => array( |
137 | 137 | 'ee-dtt-ticket-metabox' => array( |
138 | 138 | 'DTT_TRASH_BLOCK' => array( |
139 | 139 | 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'), |
140 | 140 | 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'), |
141 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>', |
|
141 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>', |
|
142 | 142 | 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
143 | 143 | 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
144 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>' |
|
144 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>' |
|
145 | 145 | ), |
146 | 146 | 'DTT_ERROR_MSG' => array( |
147 | 147 | 'no_ticket_name' => __('General Admission', 'event_espresso'), |
148 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>' |
|
148 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>' |
|
149 | 149 | ), |
150 | 150 | 'DTT_OVERSELL_WARNING' => array( |
151 | 151 | 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'), |
152 | 152 | 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso') |
153 | 153 | ), |
154 | - 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ), |
|
155 | - 'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) ) |
|
154 | + 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']), |
|
155 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')) |
|
156 | 156 | ) |
157 | 157 | ) |
158 | 158 | ); |
159 | 159 | |
160 | 160 | |
161 | - add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 ); |
|
162 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
161 | + add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10); |
|
162 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | - public function caf_updates( $update_callbacks ) { |
|
168 | - foreach ( $update_callbacks as $key => $callback ) { |
|
169 | - if ( $callback[1] == '_default_tickets_update' ) |
|
170 | - unset( $update_callbacks[$key] ); |
|
167 | + public function caf_updates($update_callbacks) { |
|
168 | + foreach ($update_callbacks as $key => $callback) { |
|
169 | + if ($callback[1] == '_default_tickets_update') |
|
170 | + unset($update_callbacks[$key]); |
|
171 | 171 | } |
172 | 172 | |
173 | - $update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' ); |
|
173 | + $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
174 | 174 | return $update_callbacks; |
175 | 175 | } |
176 | 176 | |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param array $data The request data from the form |
184 | 184 | * @return bool success or fail |
185 | 185 | */ |
186 | - public function dtt_and_tickets_caf_update( $evtobj, $data ) { |
|
186 | + public function dtt_and_tickets_caf_update($evtobj, $data) { |
|
187 | 187 | //first we need to start with datetimes cause they are the "root" items attached to events. |
188 | - $saved_dtts = $this->_update_dtts( $evtobj, $data ); |
|
188 | + $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
189 | 189 | //next tackle the tickets (and prices?) |
190 | - $this->_update_tkts( $evtobj, $saved_dtts, $data ); |
|
190 | + $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -198,36 +198,36 @@ discard block |
||
198 | 198 | * @param array $data the request data from the form |
199 | 199 | * @return EE_Datetime[] |
200 | 200 | */ |
201 | - protected function _update_dtts( $evt_obj, $data ) { |
|
202 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
201 | + protected function _update_dtts($evt_obj, $data) { |
|
202 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
203 | 203 | $saved_dtt_ids = array(); |
204 | 204 | $saved_dtt_objs = array(); |
205 | 205 | |
206 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
206 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
207 | 207 | //trim all values to ensure any excess whitespace is removed. |
208 | - $dtt = array_map( 'trim', $dtt ); |
|
209 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
208 | + $dtt = array_map('trim', $dtt); |
|
209 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
210 | 210 | $datetime_values = array( |
211 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
212 | - 'DTT_name' => ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '', |
|
213 | - 'DTT_description' => ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '', |
|
211 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
212 | + 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
213 | + 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
214 | 214 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
215 | 215 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
216 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ], |
|
217 | - 'DTT_order' => ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'], |
|
216 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
217 | + 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
218 | 218 | ); |
219 | 219 | |
220 | 220 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
221 | 221 | |
222 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
223 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
222 | + if ( ! empty($dtt['DTT_ID'])) { |
|
223 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
224 | 224 | |
225 | 225 | //set date and time format according to what is set in this class. |
226 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
227 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
226 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
227 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
228 | 228 | |
229 | - foreach ( $datetime_values as $field => $value ) { |
|
230 | - $DTM->set( $field, $value ); |
|
229 | + foreach ($datetime_values as $field => $value) { |
|
230 | + $DTM->set($field, $value); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. |
@@ -235,24 +235,24 @@ discard block |
||
235 | 235 | $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
236 | 236 | |
237 | 237 | } else { |
238 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE ); |
|
238 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE); |
|
239 | 239 | |
240 | 240 | //reset date and times to match the format |
241 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
242 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
243 | - foreach( $datetime_values as $field => $value ) { |
|
244 | - $DTM->set( $field, $value ); |
|
241 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
242 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
243 | + foreach ($datetime_values as $field => $value) { |
|
244 | + $DTM->set($field, $value); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | 248 | |
249 | 249 | $DTM->save(); |
250 | - $DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' ); |
|
250 | + $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
251 | 251 | $evt_obj->save(); |
252 | 252 | |
253 | 253 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
254 | - if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) { |
|
255 | - $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') ); |
|
254 | + if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) { |
|
255 | + $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start')); |
|
256 | 256 | EE_Registry::instance()->load_helper('DTT_Helper'); |
257 | 257 | $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days'); |
258 | 258 | $DTM->save(); |
@@ -268,25 +268,25 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | //now we need to REMOVE any dtts that got deleted. Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point. |
271 | - $old_datetimes = explode(',', $data['datetime_IDs'] ); |
|
271 | + $old_datetimes = explode(',', $data['datetime_IDs']); |
|
272 | 272 | $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
273 | 273 | |
274 | - if ( is_array( $old_datetimes ) ) { |
|
275 | - $dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids ); |
|
276 | - foreach ( $dtts_to_delete as $id ) { |
|
277 | - $id = absint( $id ); |
|
278 | - if ( empty( $id ) ) |
|
274 | + if (is_array($old_datetimes)) { |
|
275 | + $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids); |
|
276 | + foreach ($dtts_to_delete as $id) { |
|
277 | + $id = absint($id); |
|
278 | + if (empty($id)) |
|
279 | 279 | continue; |
280 | 280 | |
281 | 281 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
282 | 282 | |
283 | 283 | //remove tkt relationships. |
284 | 284 | $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
285 | - foreach ( $related_tickets as $tkt ) { |
|
285 | + foreach ($related_tickets as $tkt) { |
|
286 | 286 | $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
287 | 287 | } |
288 | 288 | |
289 | - $evt_obj->_remove_relation_to( $id, 'Datetime' ); |
|
289 | + $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
290 | 290 | $dtt_to_remove->refresh_cache_of_related_objects(); |
291 | 291 | |
292 | 292 | } |
@@ -307,81 +307,81 @@ discard block |
||
307 | 307 | * @param array $data incoming request data |
308 | 308 | * @return EE_Ticket[] |
309 | 309 | */ |
310 | - protected function _update_tkts( $evtobj, $saved_dtts, $data ) { |
|
310 | + protected function _update_tkts($evtobj, $saved_dtts, $data) { |
|
311 | 311 | |
312 | 312 | $new_tkt = null; |
313 | 313 | $new_default = null; |
314 | 314 | //stripslashes because WP filtered the $_POST ($data) array to add slashes |
315 | 315 | $data = stripslashes_deep($data); |
316 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
316 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
317 | 317 | $saved_tickets = $dtts_on_existing = array(); |
318 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
318 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
319 | 319 | |
320 | 320 | //load money helper |
321 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
321 | + EE_Registry::instance()->load_helper('Money'); |
|
322 | 322 | |
323 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
323 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
324 | 324 | |
325 | 325 | $update_prices = $create_new_TKT = FALSE; |
326 | 326 | |
327 | 327 | //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
328 | 328 | |
329 | - $starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]); |
|
330 | - $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] ); |
|
329 | + $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
330 | + $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
331 | 331 | $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
332 | 332 | $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
333 | 333 | |
334 | 334 | // trim inputs to ensure any excess whitespace is removed. |
335 | - $tkt = array_map( 'trim', $tkt ); |
|
335 | + $tkt = array_map('trim', $tkt); |
|
336 | 336 | |
337 | 337 | //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
338 | 338 | //note incoming ['TKT_price'] value is already in standard notation (via js). |
339 | - $ticket_price = isset( $tkt['TKT_price'] ) ? round ( (float) $tkt['TKT_price'], 3 ) : 0; |
|
339 | + $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0; |
|
340 | 340 | |
341 | 341 | //note incoming base price needs converted from localized value. |
342 | - $base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0; |
|
342 | + $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
343 | 343 | //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
344 | 344 | $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
345 | - $base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0; |
|
345 | + $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
346 | 346 | |
347 | 347 | $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
348 | 348 | |
349 | 349 | $now = null; |
350 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
350 | + if (empty($tkt['TKT_start_date'])) { |
|
351 | 351 | //lets' use now in the set timezone. |
352 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
353 | - $tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
352 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
353 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
354 | 354 | } |
355 | 355 | |
356 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
356 | + if (empty($tkt['TKT_end_date'])) { |
|
357 | 357 | /** |
358 | 358 | * set the TKT_end_date to the first datetime attached to the ticket. |
359 | 359 | */ |
360 | - $first_dtt = $saved_dtts[reset( $tkt_dtt_rows )]; |
|
361 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] ); |
|
360 | + $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
361 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | $TKT_values = array( |
365 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
366 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
367 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
368 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
365 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
366 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
367 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
368 | + 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
369 | 369 | 'TKT_start_date' => $tkt['TKT_start_date'], |
370 | 370 | 'TKT_end_date' => $tkt['TKT_end_date'], |
371 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ], |
|
372 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'], |
|
373 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
374 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
371 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
372 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
373 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
374 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
375 | 375 | 'TKT_row' => $row, |
376 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0, |
|
377 | - 'TKT_taxable' => ! empty( $tkt['TKT_taxable'] ) ? 1 : 0, |
|
378 | - 'TKT_required' => ! empty( $tkt['TKT_required'] ) ? 1 : 0, |
|
376 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
377 | + 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
378 | + 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
379 | 379 | 'TKT_price' => $ticket_price |
380 | 380 | ); |
381 | 381 | |
382 | 382 | |
383 | 383 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
384 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
384 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
385 | 385 | $TKT_values['TKT_ID'] = 0; |
386 | 386 | $TKT_values['TKT_is_default'] = 0; |
387 | 387 | $update_prices = TRUE; |
@@ -393,21 +393,21 @@ discard block |
||
393 | 393 | // but DID have it's items modified. |
394 | 394 | // keep in mind that if the TKT has been sold (and we have changed pricing information), |
395 | 395 | // then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
396 | - if ( absint( $TKT_values['TKT_ID'] ) ) { |
|
397 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
398 | - if ( $TKT instanceof EE_Ticket ) { |
|
396 | + if (absint($TKT_values['TKT_ID'])) { |
|
397 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
398 | + if ($TKT instanceof EE_Ticket) { |
|
399 | 399 | |
400 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
400 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
401 | 401 | // are there any registrations using this ticket ? |
402 | 402 | $tickets_sold = $TKT->count_related( |
403 | 403 | 'Registration', |
404 | - array( array( |
|
405 | - 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) |
|
406 | - ) ) |
|
404 | + array(array( |
|
405 | + 'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete)) |
|
406 | + )) |
|
407 | 407 | ); |
408 | 408 | //set ticket formats |
409 | - $TKT->set_date_format( $this->_date_format_strings['date'] ); |
|
410 | - $TKT->set_time_format( $this->_date_format_strings['time'] ); |
|
409 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
410 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
411 | 411 | |
412 | 412 | // let's just check the total price for the existing ticket |
413 | 413 | // and determine if it matches the new total price. |
@@ -417,17 +417,17 @@ discard block |
||
417 | 417 | ? TRUE : FALSE; |
418 | 418 | |
419 | 419 | //set new values |
420 | - foreach ( $TKT_values as $field => $value ) { |
|
421 | - if ( $field === 'TKT_qty' ) { |
|
422 | - $TKT->set_qty( $value ); |
|
420 | + foreach ($TKT_values as $field => $value) { |
|
421 | + if ($field === 'TKT_qty') { |
|
422 | + $TKT->set_qty($value); |
|
423 | 423 | } else { |
424 | - $TKT->set( $field, $value ); |
|
424 | + $TKT->set($field, $value); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | 428 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
429 | - if ( $create_new_TKT ) { |
|
430 | - $new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id ); |
|
429 | + if ($create_new_TKT) { |
|
430 | + $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id); |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | $TKT = EE_Ticket::new_instance( |
437 | 437 | $TKT_values, |
438 | 438 | $timezone, |
439 | - array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ] ) |
|
439 | + array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
440 | 440 | ); |
441 | - if ( $TKT instanceof EE_Ticket ) { |
|
441 | + if ($TKT instanceof EE_Ticket) { |
|
442 | 442 | // make sure ticket has an ID of setting relations won't work |
443 | 443 | $TKT->save(); |
444 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
444 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
445 | 445 | $update_prices = TRUE; |
446 | 446 | } |
447 | 447 | } |
@@ -449,38 +449,38 @@ discard block |
||
449 | 449 | //$TKT->save(); |
450 | 450 | |
451 | 451 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
452 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
453 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
452 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
453 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
454 | 454 | EE_Registry::instance()->load_helper('DTT_Helper'); |
455 | 455 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
456 | 456 | } |
457 | 457 | |
458 | 458 | //let's make sure the base price is handled |
459 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT; |
|
459 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT; |
|
460 | 460 | |
461 | 461 | //add/update price_modifiers |
462 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT; |
|
462 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
463 | 463 | |
464 | 464 | //need to make sue that the TKT_price is accurate after saving the prices. |
465 | 465 | $TKT->ensure_TKT_Price_correct(); |
466 | 466 | |
467 | 467 | //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave. |
468 | - if ( ! defined('DOING_AUTOSAVE' ) ) { |
|
469 | - if ( !empty($tkt['TKT_is_default_selector'] ) ) { |
|
468 | + if ( ! defined('DOING_AUTOSAVE')) { |
|
469 | + if ( ! empty($tkt['TKT_is_default_selector'])) { |
|
470 | 470 | $update_prices = TRUE; |
471 | 471 | $new_default = clone $TKT; |
472 | - $new_default->set( 'TKT_ID', 0 ); |
|
473 | - $new_default->set( 'TKT_is_default', 1 ); |
|
474 | - $new_default->set( 'TKT_row', 1 ); |
|
475 | - $new_default->set( 'TKT_price', $ticket_price ); |
|
472 | + $new_default->set('TKT_ID', 0); |
|
473 | + $new_default->set('TKT_is_default', 1); |
|
474 | + $new_default->set('TKT_row', 1); |
|
475 | + $new_default->set('TKT_price', $ticket_price); |
|
476 | 476 | //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object) |
477 | 477 | $new_default->_remove_relations('Datetime'); |
478 | 478 | //todo we need to add the current attached prices as new prices to the new default ticket. |
479 | - $new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices ); |
|
479 | + $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
|
480 | 480 | //don't forget the base price! |
481 | - $new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id ); |
|
481 | + $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id); |
|
482 | 482 | $new_default->save(); |
483 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data ); |
|
483 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -491,19 +491,19 @@ discard block |
||
491 | 491 | //let's assign any tickets that have been setup to the saved_tickets tracker |
492 | 492 | //save existing TKT |
493 | 493 | $TKT->save(); |
494 | - if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) { |
|
494 | + if ($create_new_TKT && $new_tkt instanceof EE_Ticket) { |
|
495 | 495 | //save new TKT |
496 | 496 | $new_tkt->save(); |
497 | 497 | //add new ticket to array |
498 | - $saved_tickets[ $new_tkt->ID() ] = $new_tkt; |
|
498 | + $saved_tickets[$new_tkt->ID()] = $new_tkt; |
|
499 | 499 | |
500 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data ); |
|
500 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
501 | 501 | |
502 | 502 | } else { |
503 | 503 | //add tkt to saved tkts |
504 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
504 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
505 | 505 | |
506 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data ); |
|
506 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | } |
@@ -513,22 +513,22 @@ discard block |
||
513 | 513 | // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). |
514 | 514 | // Or a draft event was saved and in the process of editing a ticket is trashed. |
515 | 515 | // No sense in keeping all the related data in the db! |
516 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
517 | - $tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) ); |
|
516 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
517 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
518 | 518 | |
519 | - foreach ( $tickets_removed as $id ) { |
|
520 | - $id = absint( $id ); |
|
519 | + foreach ($tickets_removed as $id) { |
|
520 | + $id = absint($id); |
|
521 | 521 | |
522 | 522 | //get the ticket for this id |
523 | 523 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
524 | 524 | |
525 | 525 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
526 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
526 | + if ($tkt_to_remove->get('TKT_is_default')) |
|
527 | 527 | continue; |
528 | 528 | |
529 | 529 | // if this tkt has any registrations attached so then we just ARCHIVE |
530 | 530 | // because we don't actually permanently delete these tickets. |
531 | - if ( $tkt_to_remove->count_related('Registration') > 0 ) { |
|
531 | + if ($tkt_to_remove->count_related('Registration') > 0) { |
|
532 | 532 | $tkt_to_remove->delete(); |
533 | 533 | continue; |
534 | 534 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | // (remember this process can ONLY kick off if there are NO tkts_sold) |
538 | 538 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
539 | 539 | |
540 | - foreach( $dtts as $dtt ) { |
|
540 | + foreach ($dtts as $dtt) { |
|
541 | 541 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
542 | 542 | } |
543 | 543 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
546 | 546 | $tkt_to_remove->delete_related_permanently('Price'); |
547 | 547 | |
548 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove ); |
|
548 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
549 | 549 | |
550 | 550 | // finally let's delete this ticket |
551 | 551 | // (which should not be blocked at this point b/c we've removed all our relationships) |
@@ -577,39 +577,39 @@ discard block |
||
577 | 577 | // and removing the ticket from datetimes it got removed from. |
578 | 578 | |
579 | 579 | // first let's add datetimes |
580 | - if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) { |
|
581 | - foreach ( $added_datetimes as $row_id ) { |
|
582 | - $row_id = (int)$row_id; |
|
583 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
584 | - $ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
580 | + if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
|
581 | + foreach ($added_datetimes as $row_id) { |
|
582 | + $row_id = (int) $row_id; |
|
583 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
584 | + $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
585 | 585 | // Is this an existing ticket (has an ID) and does it have any sold? |
586 | 586 | // If so, then we need to add that to the DTT sold because this DTT is getting added. |
587 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
588 | - $saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() ); |
|
589 | - $saved_datetimes[ $row_id ]->save(); |
|
587 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
588 | + $saved_datetimes[$row_id]->increase_sold($ticket->sold()); |
|
589 | + $saved_datetimes[$row_id]->save(); |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | } |
593 | 593 | } |
594 | 594 | // then remove datetimes |
595 | - if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) { |
|
596 | - foreach ( $removed_datetimes as $row_id ) { |
|
597 | - $row_id = (int)$row_id; |
|
595 | + if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
|
596 | + foreach ($removed_datetimes as $row_id) { |
|
597 | + $row_id = (int) $row_id; |
|
598 | 598 | // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
599 | 599 | // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
600 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
601 | - $ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
600 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
601 | + $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
602 | 602 | // Is this an existing ticket (has an ID) and does it have any sold? |
603 | 603 | // If so, then we need to remove it's sold from the DTT_sold. |
604 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
605 | - $saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() ); |
|
606 | - $saved_datetimes[ $row_id ]->save(); |
|
604 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
605 | + $saved_datetimes[$row_id]->decrease_sold($ticket->sold()); |
|
606 | + $saved_datetimes[$row_id]->save(); |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |
611 | 611 | // cap ticket qty by datetime reg limits |
612 | - $ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) ); |
|
612 | + $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit'))); |
|
613 | 613 | return $ticket; |
614 | 614 | } |
615 | 615 | |
@@ -630,39 +630,39 @@ discard block |
||
630 | 630 | EE_Ticket $ticket, |
631 | 631 | $price_rows = array(), |
632 | 632 | $ticket_price = 0, |
633 | - $base_price = 0 , |
|
633 | + $base_price = 0, |
|
634 | 634 | $base_price_id = 0 |
635 | 635 | ) { |
636 | 636 | |
637 | 637 | // create new ticket that's a copy of the existing |
638 | 638 | // except a new id of course (and not archived) |
639 | 639 | // AND has the new TKT_price associated with it. |
640 | - $new_ticket = clone( $ticket ); |
|
641 | - $new_ticket->set( 'TKT_ID', 0 ); |
|
642 | - $new_ticket->set( 'TKT_deleted', 0 ); |
|
643 | - $new_ticket->set( 'TKT_price', $ticket_price ); |
|
644 | - $new_ticket->set( 'TKT_sold', 0 ); |
|
640 | + $new_ticket = clone($ticket); |
|
641 | + $new_ticket->set('TKT_ID', 0); |
|
642 | + $new_ticket->set('TKT_deleted', 0); |
|
643 | + $new_ticket->set('TKT_price', $ticket_price); |
|
644 | + $new_ticket->set('TKT_sold', 0); |
|
645 | 645 | // let's get a new ID for this ticket |
646 | 646 | $new_ticket->save(); |
647 | 647 | // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket |
648 | - $datetimes_on_existing = $ticket->get_many_related( 'Datetime' ); |
|
648 | + $datetimes_on_existing = $ticket->get_many_related('Datetime'); |
|
649 | 649 | $new_ticket = $this->_update_ticket_datetimes( |
650 | 650 | $new_ticket, |
651 | 651 | $datetimes_on_existing, |
652 | - array_keys( $datetimes_on_existing ) |
|
652 | + array_keys($datetimes_on_existing) |
|
653 | 653 | ); |
654 | 654 | |
655 | 655 | // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array. |
656 | 656 | // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining |
657 | 657 | // available. |
658 | - if ( $ticket->sold() > 0 ) { |
|
658 | + if ($ticket->sold() > 0) { |
|
659 | 659 | $new_qty = $ticket->qty() - $ticket->sold(); |
660 | - $new_ticket->set_qty( $new_qty ); |
|
660 | + $new_ticket->set_qty($new_qty); |
|
661 | 661 | } |
662 | 662 | //now we update the prices just for this ticket |
663 | - $new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true ); |
|
663 | + $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true); |
|
664 | 664 | //and we update the base price |
665 | - $new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id ); |
|
665 | + $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id); |
|
666 | 666 | return $new_ticket; |
667 | 667 | } |
668 | 668 | |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
683 | 683 | * @return EE_Ticket |
684 | 684 | */ |
685 | - protected function _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) { |
|
685 | + protected function _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) { |
|
686 | 686 | |
687 | 687 | //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session. |
688 | 688 | $current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers(); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | $updated_prices = array(); |
691 | 691 | |
692 | 692 | // if $base_price ! FALSE then updating a base price. |
693 | - if ( $base_price !== FALSE ) { |
|
693 | + if ($base_price !== FALSE) { |
|
694 | 694 | $prices[1] = array( |
695 | 695 | 'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id, |
696 | 696 | 'PRT_ID' => 1, |
@@ -701,47 +701,47 @@ discard block |
||
701 | 701 | } |
702 | 702 | |
703 | 703 | //possibly need to save tkt |
704 | - if ( ! $ticket->ID() ) |
|
704 | + if ( ! $ticket->ID()) |
|
705 | 705 | $ticket->save(); |
706 | 706 | |
707 | - foreach ( $prices as $row => $prc ) { |
|
708 | - $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
|
709 | - if ( empty($prt_id) ) |
|
707 | + foreach ($prices as $row => $prc) { |
|
708 | + $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL; |
|
709 | + if (empty($prt_id)) |
|
710 | 710 | continue; //prices MUST have a price type id. |
711 | 711 | $PRC_values = array( |
712 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
712 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
713 | 713 | 'PRT_ID' => $prt_id, |
714 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
715 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
716 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
714 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
715 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
716 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
717 | 717 | 'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor |
718 | 718 | 'PRC_order' => $row |
719 | 719 | ); |
720 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
720 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
721 | 721 | $PRC_values['PRC_ID'] = 0; |
722 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
722 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
723 | 723 | } else { |
724 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
724 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
725 | 725 | //update this price with new values |
726 | - foreach ( $PRC_values as $field => $newprc ) { |
|
727 | - $PRC->set( $field, $newprc ); |
|
726 | + foreach ($PRC_values as $field => $newprc) { |
|
727 | + $PRC->set($field, $newprc); |
|
728 | 728 | } |
729 | 729 | } |
730 | 730 | $PRC->save(); |
731 | 731 | $prcid = $PRC->ID(); |
732 | 732 | $updated_prices[$prcid] = $PRC; |
733 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
733 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | //now let's remove any prices that got removed from the ticket |
737 | - if ( !empty ( $current_prices_on_ticket ) ) { |
|
737 | + if ( ! empty ($current_prices_on_ticket)) { |
|
738 | 738 | $current = array_keys($current_prices_on_ticket); |
739 | 739 | $updated = array_keys($updated_prices); |
740 | 740 | $prices_to_remove = array_diff($current, $updated); |
741 | - if ( !empty( $prices_to_remove ) ) { |
|
742 | - foreach ( $prices_to_remove as $prc_id ) { |
|
741 | + if ( ! empty($prices_to_remove)) { |
|
742 | + foreach ($prices_to_remove as $prc_id) { |
|
743 | 743 | $p = $current_prices_on_ticket[$prc_id]; |
744 | - $ticket->_remove_relation_to( $p, 'Price' ); |
|
744 | + $ticket->_remove_relation_to($p, 'Price'); |
|
745 | 745 | |
746 | 746 | //delete permanently the price |
747 | 747 | $p->delete_permanently(); |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | |
755 | 755 | |
756 | 756 | |
757 | - public function autosave_handling( $event_admin_obj ) { |
|
757 | + public function autosave_handling($event_admin_obj) { |
|
758 | 758 | return $event_admin_obj; //doing nothing for the moment. |
759 | 759 | //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method) |
760 | 760 | |
@@ -788,12 +788,12 @@ discard block |
||
788 | 788 | |
789 | 789 | //default main template args |
790 | 790 | $main_template_args = array( |
791 | - 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
791 | + 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
792 | 792 | 'existing_datetime_ids' => '', |
793 | 793 | 'total_dtt_rows' => 1, |
794 | - 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
794 | + 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
795 | 795 | 'datetime_rows' => '', |
796 | - 'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
796 | + 'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
797 | 797 | 'ticket_rows' => '', |
798 | 798 | 'existing_ticket_ids' => '', |
799 | 799 | 'total_ticket_rows' => 1, |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL; |
805 | 805 | |
806 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
806 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * 1. Start with retrieving Datetimes |
@@ -811,25 +811,25 @@ discard block |
||
811 | 811 | * 3. For each ticket get related prices |
812 | 812 | */ |
813 | 813 | |
814 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) ); |
|
815 | - $times = $DTM->get_all_event_dates( $evtID ); |
|
814 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
815 | + $times = $DTM->get_all_event_dates($evtID); |
|
816 | 816 | |
817 | 817 | |
818 | 818 | |
819 | 819 | $main_template_args['total_dtt_rows'] = count($times); |
820 | - foreach ( $times as $time ) { |
|
820 | + foreach ($times as $time) { |
|
821 | 821 | $dttid = $time->get('DTT_ID'); |
822 | 822 | $dttrow = $time->get('DTT_order'); |
823 | 823 | $existing_datetime_ids[] = $dttid; |
824 | 824 | |
825 | 825 | //tickets attached |
826 | - $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array(); |
|
826 | + $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array(); |
|
827 | 827 | |
828 | 828 | //if there are no related tickets this is likely a new event OR autodraft |
829 | 829 | // event so we need to generate the default tickets because dtts |
830 | 830 | // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
831 | 831 | // datetime on the event. |
832 | - if ( empty ( $related_tickets ) && count( $times ) < 2 ) { |
|
832 | + if (empty ($related_tickets) && count($times) < 2) { |
|
833 | 833 | $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
834 | 834 | } |
835 | 835 | |
@@ -838,11 +838,11 @@ discard block |
||
838 | 838 | |
839 | 839 | //loop through and setup the ticket rows and make sure the order is set. |
840 | 840 | $order = 0; |
841 | - foreach ( $related_tickets as $ticket ) { |
|
841 | + foreach ($related_tickets as $ticket) { |
|
842 | 842 | $tktid = $ticket->get('TKT_ID'); |
843 | 843 | $tktrow = $ticket->get('TKT_row'); |
844 | 844 | //we only want unique tickets in our final display!! |
845 | - if ( !in_array( $tktid, $existing_ticket_ids ) ) { |
|
845 | + if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
846 | 846 | $existing_ticket_ids[] = $tktid; |
847 | 847 | $all_tickets[] = $ticket; |
848 | 848 | } |
@@ -851,56 +851,56 @@ discard block |
||
851 | 851 | $datetime_tickets[$dttid][] = $tktrow; |
852 | 852 | |
853 | 853 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
854 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
854 | + if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) |
|
855 | 855 | $ticket_datetimes[$tktid][] = $dttrow; |
856 | 856 | } |
857 | 857 | } |
858 | 858 | |
859 | - $main_template_args['total_ticket_rows'] = count( $existing_ticket_ids ); |
|
860 | - $main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
861 | - $main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
859 | + $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
860 | + $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
861 | + $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
862 | 862 | |
863 | 863 | //sort $all_tickets by order |
864 | - usort( $all_tickets, function( $a, $b ) { |
|
864 | + usort($all_tickets, function($a, $b) { |
|
865 | 865 | $a_order = (int) $a->get('TKT_order'); |
866 | 866 | $b_order = (int) $b->get('TKT_order'); |
867 | - if ( $a_order == $b_order ) { |
|
867 | + if ($a_order == $b_order) { |
|
868 | 868 | return 0; |
869 | 869 | } |
870 | - return ( $a_order < $b_order ) ? -1 : 1; |
|
870 | + return ($a_order < $b_order) ? -1 : 1; |
|
871 | 871 | }); |
872 | 872 | |
873 | 873 | //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again. |
874 | 874 | $dttrow = 1; |
875 | - foreach ( $times as $time ) { |
|
876 | - $main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times ); |
|
875 | + foreach ($times as $time) { |
|
876 | + $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times); |
|
877 | 877 | $dttrow++; |
878 | 878 | } |
879 | 879 | |
880 | 880 | //then loop through all tickets for the ticket rows. |
881 | 881 | $tktrow = 1; |
882 | - foreach ( $all_tickets as $ticket ) { |
|
883 | - $main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets ); |
|
882 | + foreach ($all_tickets as $ticket) { |
|
883 | + $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets); |
|
884 | 884 | $tktrow++; |
885 | 885 | } |
886 | 886 | |
887 | 887 | $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
888 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
889 | - EEH_Template::display_template( $template, $main_template_args ); |
|
888 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'; |
|
889 | + EEH_Template::display_template($template, $main_template_args); |
|
890 | 890 | return; |
891 | 891 | } |
892 | 892 | |
893 | 893 | |
894 | 894 | |
895 | - protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
|
895 | + protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) { |
|
896 | 896 | |
897 | 897 | $dtt_display_template_args = array( |
898 | - 'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ), |
|
899 | - 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ), |
|
898 | + 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
899 | + 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default), |
|
900 | 900 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
901 | 901 | ); |
902 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
903 | - return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE); |
|
902 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php'; |
|
903 | + return EEH_Template::display_template($template, $dtt_display_template_args, TRUE); |
|
904 | 904 | } |
905 | 905 | |
906 | 906 | |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | * |
919 | 919 | * @return string Generated edit row. |
920 | 920 | */ |
921 | - protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) { |
|
921 | + protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) { |
|
922 | 922 | |
923 | 923 | // if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true. |
924 | 924 | $default = ! $dtt instanceof EE_Datetime ? true : false; |
@@ -926,30 +926,30 @@ discard block |
||
926 | 926 | $template_args = array( |
927 | 927 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
928 | 928 | 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
929 | - 'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
929 | + 'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
930 | 930 | 'DTT_ID' => $default ? '' : $dtt->ID(), |
931 | 931 | 'DTT_name' => $default ? '' : $dtt->name(), |
932 | 932 | 'DTT_description' => $default ? '' : $dtt->description(), |
933 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
934 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
935 | - 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'), |
|
933 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
934 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
935 | + 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
936 | 936 | 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
937 | 937 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
938 | - 'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
939 | - 'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
938 | + 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
939 | + 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
940 | 940 | ); |
941 | 941 | |
942 | - $template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
942 | + $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
943 | 943 | |
944 | 944 | //allow filtering of template args at this point. |
945 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event ); |
|
945 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
|
946 | 946 | |
947 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
948 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
947 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php'; |
|
948 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
949 | 949 | } |
950 | 950 | |
951 | 951 | |
952 | - protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
|
952 | + protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) { |
|
953 | 953 | |
954 | 954 | $template_args = array( |
955 | 955 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
@@ -957,47 +957,47 @@ discard block |
||
957 | 957 | 'DTT_description' => $default ? '' : $dtt->description(), |
958 | 958 | 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
959 | 959 | 'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
960 | - 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
960 | + 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
961 | 961 | 'DTT_ID' => $default ? '' : $dtt->ID() |
962 | 962 | ); |
963 | 963 | |
964 | 964 | //need to setup the list items (but only if this isnt' a default skeleton setup) |
965 | - if ( !$default ) { |
|
965 | + if ( ! $default) { |
|
966 | 966 | $tktrow = 1; |
967 | - foreach ( $all_tickets as $ticket ) { |
|
968 | - $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ); |
|
967 | + foreach ($all_tickets as $ticket) { |
|
968 | + $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default); |
|
969 | 969 | $tktrow++; |
970 | 970 | } |
971 | 971 | } |
972 | 972 | |
973 | 973 | //filter template args at this point |
974 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event ); |
|
974 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
|
975 | 975 | |
976 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
977 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
976 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php'; |
|
977 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | |
981 | 981 | |
982 | - protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) { |
|
983 | - $tktid = !empty( $ticket ) ? $ticket->ID() : 0; |
|
984 | - $dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array(); |
|
982 | + protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) { |
|
983 | + $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
984 | + $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
985 | 985 | |
986 | - $displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0; |
|
986 | + $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
987 | 987 | $template_args = array( |
988 | 988 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
989 | - 'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow, |
|
989 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
990 | 990 | 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
991 | 991 | 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
992 | - 'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
993 | - 'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
992 | + 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
993 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(), |
|
994 | 994 | ); |
995 | 995 | |
996 | 996 | //filter template args |
997 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event ); |
|
997 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
|
998 | 998 | |
999 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1000 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
999 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1000 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1019,32 +1019,32 @@ discard block |
||
1019 | 1019 | * |
1020 | 1020 | * @return [type] [description] |
1021 | 1021 | */ |
1022 | - protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) { |
|
1022 | + protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) { |
|
1023 | 1023 | |
1024 | 1024 | //if $ticket is not an instance of EE_Ticket then force default to true. |
1025 | - $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1025 | + $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1026 | 1026 | |
1027 | 1027 | |
1028 | - $prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array(); |
|
1028 | + $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
1029 | 1029 | |
1030 | 1030 | // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket). This will future proof in case there is ever any behaviour change between what the primary_key defaults to. |
1031 | - $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE; |
|
1031 | + $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE; |
|
1032 | 1032 | |
1033 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1033 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1034 | 1034 | |
1035 | 1035 | $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
1036 | - $base_price = $default ? NULL : $ticket->base_price(); |
|
1036 | + $base_price = $default ? NULL : $ticket->base_price(); |
|
1037 | 1037 | $count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE); |
1038 | 1038 | |
1039 | 1039 | //breaking out complicated condition for ticket_status |
1040 | - if ( $default ) { |
|
1041 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1040 | + if ($default) { |
|
1041 | + $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale; |
|
1042 | 1042 | } else { |
1043 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1043 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(); |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | //breaking out complicated condition for TKT_taxable |
1047 | - if ( $default ) { |
|
1047 | + if ($default) { |
|
1048 | 1048 | $TKT_taxable = ''; |
1049 | 1049 | } else { |
1050 | 1050 | $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
@@ -1059,19 +1059,19 @@ discard block |
||
1059 | 1059 | 'edit_tkt_expanded' => '', |
1060 | 1060 | 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
1061 | 1061 | 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
1062 | - 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1063 | - 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1064 | - 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1062 | + 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1063 | + 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1064 | + 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1065 | 1065 | 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE), |
1066 | 1066 | 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
1067 | 1067 | 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
1068 | - 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'), |
|
1069 | - 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'), |
|
1070 | - 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'), |
|
1071 | - 'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ), |
|
1072 | - 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max','input'), |
|
1068 | + 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1069 | + 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1070 | + 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1071 | + 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1072 | + 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1073 | 1073 | 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
1074 | - 'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ), |
|
1074 | + 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))), |
|
1075 | 1075 | 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
1076 | 1076 | 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
1077 | 1077 | 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
@@ -1080,99 +1080,99 @@ discard block |
||
1080 | 1080 | 'ticket_price_rows' => '', |
1081 | 1081 | 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'), |
1082 | 1082 | 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
1083 | - 'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"', |
|
1084 | - 'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '', |
|
1083 | + 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1084 | + 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1085 | 1085 | 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
1086 | 1086 | 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
1087 | 1087 | 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
1088 | 1088 | 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
1089 | - 'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ), |
|
1089 | + 'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)), |
|
1090 | 1090 | 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
1091 | 1091 | 'TKT_taxable' => $TKT_taxable, |
1092 | 1092 | 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
1093 | 1093 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1094 | - 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ), |
|
1094 | + 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE), |
|
1095 | 1095 | 'TKT_subtotal_amount' => $ticket_subtotal, |
1096 | - 'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ), |
|
1097 | - 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE, |
|
1096 | + 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1097 | + 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE, |
|
1098 | 1098 | 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
1099 | 1099 | 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
1100 | 1100 | 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
1101 | 1101 | ); |
1102 | 1102 | |
1103 | - $template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1103 | + $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1104 | 1104 | |
1105 | 1105 | //handle rows that should NOT be empty |
1106 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1106 | + if (empty($template_args['TKT_start_date'])) { |
|
1107 | 1107 | //if empty then the start date will be now. |
1108 | - $template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp')); |
|
1109 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1108 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp')); |
|
1109 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1112 | + if (empty($template_args['TKT_end_date'])) { |
|
1113 | 1113 | |
1114 | 1114 | //get the earliest datetime (if present); |
1115 | - $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1115 | + $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1116 | 1116 | |
1117 | - if ( !empty( $earliest_dtt ) ) { |
|
1118 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
1117 | + if ( ! empty($earliest_dtt)) { |
|
1118 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
1119 | 1119 | } else { |
1120 | 1120 | //default so let's just use what's been set for the default date-time which is 30 days from now. |
1121 | - $template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") ) ); |
|
1121 | + $template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
|
1122 | 1122 | } |
1123 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1123 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | //generate ticket_datetime items |
1127 | - if ( ! $default ) { |
|
1127 | + if ( ! $default) { |
|
1128 | 1128 | $dttrow = 1; |
1129 | - foreach ( $all_dtts as $dtt ) { |
|
1130 | - $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ); |
|
1129 | + foreach ($all_dtts as $dtt) { |
|
1130 | + $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default); |
|
1131 | 1131 | $dttrow++; |
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | $prcrow = 1; |
1136 | - foreach ( $prices as $price ) { |
|
1137 | - if ( $price->is_base_price() ) { |
|
1136 | + foreach ($prices as $price) { |
|
1137 | + if ($price->is_base_price()) { |
|
1138 | 1138 | $prcrow++; |
1139 | 1139 | continue; |
1140 | 1140 | } |
1141 | - $show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1 ? FALSE : TRUE; |
|
1142 | - $show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE; |
|
1143 | - $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create ); |
|
1141 | + $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE; |
|
1142 | + $show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE; |
|
1143 | + $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create); |
|
1144 | 1144 | $prcrow++; |
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | //filter $template_args |
1148 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event ); |
|
1148 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event); |
|
1149 | 1149 | |
1150 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1151 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1150 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php'; |
|
1151 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | |
1155 | 1155 | |
1156 | 1156 | |
1157 | 1157 | |
1158 | - protected function _get_tax_rows( $tktrow, $ticket ) { |
|
1158 | + protected function _get_tax_rows($tktrow, $ticket) { |
|
1159 | 1159 | $tax_rows = ''; |
1160 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1160 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1161 | 1161 | $template_args = array(); |
1162 | - $taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1163 | - foreach ( $taxes as $tax ) { |
|
1164 | - $tax_added = $this->_get_tax_added( $tax, $ticket ); |
|
1162 | + $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1163 | + foreach ($taxes as $tax) { |
|
1164 | + $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1165 | 1165 | $template_args = array( |
1166 | - 'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1166 | + 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1167 | 1167 | 'tax_id' => $tax->ID(), |
1168 | 1168 | 'tkt_row' => $tktrow, |
1169 | 1169 | 'tax_label' => $tax->get('PRC_name'), |
1170 | 1170 | 'tax_added' => $tax_added, |
1171 | - 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ), |
|
1171 | + 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE), |
|
1172 | 1172 | 'tax_amount' => $tax->get('PRC_amount') |
1173 | 1173 | ); |
1174 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event ); |
|
1175 | - $tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1174 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1175 | + $tax_rows .= EEH_Template::display_template($template, $template_args, TRUE); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | |
@@ -1180,81 +1180,81 @@ discard block |
||
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | |
1183 | - protected function _get_tax_added( EE_Price $tax, $ticket ) { |
|
1184 | - $subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal(); |
|
1183 | + protected function _get_tax_added(EE_Price $tax, $ticket) { |
|
1184 | + $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1185 | 1185 | return $subtotal * $tax->get('PRC_amount') / 100; |
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | |
1189 | 1189 | |
1190 | 1190 | |
1191 | - protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
|
1192 | - $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1191 | + protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) { |
|
1192 | + $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1193 | 1193 | $template_args = array( |
1194 | 1194 | 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
1195 | 1195 | 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
1196 | 1196 | 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
1197 | - 'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ), |
|
1197 | + 'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled), |
|
1198 | 1198 | 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
1199 | 1199 | 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
1200 | 1200 | 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
1201 | 1201 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1202 | 1202 | 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
1203 | - 'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1204 | - 'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1205 | - 'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ), |
|
1206 | - 'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1207 | - 'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ), |
|
1203 | + 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1204 | + 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1205 | + 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1206 | + 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1207 | + 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1208 | 1208 | 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
1209 | 1209 | 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
1210 | - 'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'), |
|
1211 | - 'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1210 | + 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1211 | + 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1212 | 1212 | ); |
1213 | 1213 | |
1214 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event ); |
|
1214 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event); |
|
1215 | 1215 | |
1216 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1217 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1216 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php'; |
|
1217 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | |
1221 | - protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1222 | - if ( $price->is_base_price() ) { |
|
1223 | - return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ); |
|
1221 | + protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1222 | + if ($price->is_base_price()) { |
|
1223 | + return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1224 | 1224 | } else { |
1225 | - return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled ); |
|
1225 | + return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | |
1231 | - protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) { |
|
1231 | + protected function _get_base_price_template($tktrow, $prcrow, $price, $default) { |
|
1232 | 1232 | $template_args = array( |
1233 | 1233 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1234 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1235 | - 'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'), |
|
1234 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1235 | + 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1236 | 1236 | 'PRT_name' => __('Price', 'event_espresso'), |
1237 | 1237 | 'price_selected_operator' => '+', |
1238 | 1238 | 'price_selected_is_percent' => 0 |
1239 | 1239 | ); |
1240 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1240 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php'; |
|
1241 | 1241 | |
1242 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event ); |
|
1242 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
|
1243 | 1243 | |
1244 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1244 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | |
1248 | 1248 | |
1249 | - protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1250 | - $select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1251 | - $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) ); |
|
1252 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1253 | - $all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array(); |
|
1254 | - $selected_price_type_id = $default && empty( $price ) ? 0 : $price->type(); |
|
1249 | + protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1250 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]'; |
|
1251 | + $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3')))); |
|
1252 | + $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php'; |
|
1253 | + $all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array(); |
|
1254 | + $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1255 | 1255 | $price_option_spans = ''; |
1256 | 1256 | //setup pricetypes for selector |
1257 | - foreach ( $price_types as $price_type ) { |
|
1257 | + foreach ($price_types as $price_type) { |
|
1258 | 1258 | $all_price_types[] = array( |
1259 | 1259 | 'id' => $price_type->ID(), |
1260 | 1260 | 'text' => $price_type->get('PRT_name'), |
@@ -1266,50 +1266,50 @@ discard block |
||
1266 | 1266 | 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
1267 | 1267 | 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
1268 | 1268 | ); |
1269 | - $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE ); |
|
1269 | + $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE); |
|
1270 | 1270 | } |
1271 | 1271 | |
1272 | - $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1272 | + $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1273 | 1273 | $main_name = $select_name; |
1274 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1274 | + $select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name; |
|
1275 | 1275 | |
1276 | 1276 | $template_args = array( |
1277 | 1277 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1278 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1279 | - 'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ), |
|
1278 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1279 | + 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1280 | 1280 | 'main_name' => $main_name, |
1281 | 1281 | 'selected_price_type_id' => $selected_price_type_id, |
1282 | 1282 | 'price_option_spans' => $price_option_spans, |
1283 | - 'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ), |
|
1284 | - 'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ), |
|
1283 | + 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1284 | + 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1285 | 1285 | 'disabled' => $disabled |
1286 | 1286 | ); |
1287 | 1287 | |
1288 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event ); |
|
1288 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
|
1289 | 1289 | |
1290 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1290 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1291 | 1291 | |
1292 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1292 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | |
1297 | - protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
|
1298 | - $dttid = !empty($dtt) ? $dtt->ID() : 0; |
|
1299 | - $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1300 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1297 | + protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) { |
|
1298 | + $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1299 | + $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1300 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1301 | 1301 | $template_args = array( |
1302 | - 'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow, |
|
1302 | + 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1303 | 1303 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1304 | - 'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '', |
|
1305 | - 'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '', |
|
1306 | - 'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ), |
|
1304 | + 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1305 | + 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1306 | + 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE), |
|
1307 | 1307 | 'tkt_status_class' => '', |
1308 | 1308 | ); |
1309 | 1309 | |
1310 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event ); |
|
1311 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1312 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1310 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
|
1311 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1312 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | |
@@ -1317,53 +1317,53 @@ discard block |
||
1317 | 1317 | protected function _get_ticket_js_structure($all_dtts, $all_tickets) { |
1318 | 1318 | $template_args = array( |
1319 | 1319 | 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts), |
1320 | - 'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE), |
|
1321 | - 'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ), |
|
1320 | + 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE), |
|
1321 | + 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL), |
|
1322 | 1322 | 'default_price_rows' => '', |
1323 | 1323 | 'default_base_price_amount' => 0, |
1324 | 1324 | 'default_base_price_name' => '', |
1325 | 1325 | 'default_base_price_description' => '', |
1326 | - 'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ), |
|
1327 | - 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ), |
|
1326 | + 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE), |
|
1327 | + 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE), |
|
1328 | 1328 | 'existing_available_datetime_tickets_list' => '', |
1329 | 1329 | 'existing_available_ticket_datetimes_list' => '', |
1330 | - 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ), |
|
1331 | - 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ) |
|
1330 | + 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE), |
|
1331 | + 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE) |
|
1332 | 1332 | ); |
1333 | 1333 | |
1334 | 1334 | $tktrow = 1; |
1335 | - foreach ( $all_tickets as $ticket ) { |
|
1336 | - $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE ); |
|
1335 | + foreach ($all_tickets as $ticket) { |
|
1336 | + $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE); |
|
1337 | 1337 | $tktrow++; |
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | |
1341 | 1341 | $dttrow = 1; |
1342 | - foreach ( $all_dtts as $dtt ) { |
|
1343 | - $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE ); |
|
1342 | + foreach ($all_dtts as $dtt) { |
|
1343 | + $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE); |
|
1344 | 1344 | $dttrow++; |
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
1348 | 1348 | $prcrow = 1; |
1349 | - foreach ( $default_prices as $price ) { |
|
1350 | - if ( $price->is_base_price() ) { |
|
1349 | + foreach ($default_prices as $price) { |
|
1350 | + if ($price->is_base_price()) { |
|
1351 | 1351 | $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
1352 | 1352 | $template_args['default_base_price_name'] = $price->get('PRC_name'); |
1353 | 1353 | $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
1354 | 1354 | $prcrow++; |
1355 | 1355 | continue; |
1356 | 1356 | } |
1357 | - $show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1 ? FALSE : TRUE; |
|
1358 | - $show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE; |
|
1359 | - $template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create ); |
|
1357 | + $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE; |
|
1358 | + $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE; |
|
1359 | + $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create); |
|
1360 | 1360 | $prcrow++; |
1361 | 1361 | } |
1362 | 1362 | |
1363 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event ); |
|
1363 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
|
1364 | 1364 | |
1365 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1366 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1365 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1366 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
3 | -EE_Registry::instance()->load_helper( 'Event_View' ); |
|
4 | -EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | +EE_Registry::instance()->load_helper('Event_View'); |
|
4 | +EE_Registry::instance()->load_helper('Form_Fields'); |
|
5 | 5 | $values = EEH_Form_Fields::prep_answer_options( |
6 | 6 | array( |
7 | - array( 'id' => 1, 'text' => __( 'Yes', 'event_espresso' ) ), |
|
8 | - array( 'id' => 0, 'text' => __( 'No', 'event_espresso' ) ) |
|
7 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
8 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
9 | 9 | ) |
10 | 10 | ); |
11 | 11 | ?> |
@@ -24,27 +24,27 @@ discard block |
||
24 | 24 | </label> |
25 | 25 | </th> |
26 | 26 | <td> |
27 | - <?php echo EEH_Form_Fields::select( 'display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single' ); ?> |
|
28 | - <p class="description"><?php _e( 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso' ); ?></p> |
|
27 | + <?php echo EEH_Form_Fields::select('display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single'); ?> |
|
28 | + <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso'); ?></p> |
|
29 | 29 | </td> |
30 | 30 | </tr> |
31 | 31 | |
32 | 32 | <tr> |
33 | 33 | <th> |
34 | 34 | <label for="display_venue"> |
35 | - <?php _e( 'Display Venue Details', 'event_espresso' ); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
35 | + <?php _e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
36 | 36 | </label> |
37 | 37 | </th> |
38 | 38 | <td> |
39 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'display_venue', 'display_venue' ); ?> |
|
40 | - <p class="description"><?php _e( 'Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso' ); ?></p> |
|
39 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'display_venue', 'display_venue'); ?> |
|
40 | + <p class="description"><?php _e('Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso'); ?></p> |
|
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | |
44 | 44 | <tr> |
45 | 45 | <th> |
46 | 46 | <label for="EED_Events_Single_use_sortable_display_order"> |
47 | - <?php _e( 'Use Custom Display Order?', 'event_espresso' ); ?> |
|
47 | + <?php _e('Use Custom Display Order?', 'event_espresso'); ?> |
|
48 | 48 | </label> |
49 | 49 | </th> |
50 | 50 | <td> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <p class="description "> |
61 | 61 | <?php |
62 | 62 | echo sprintf( |
63 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
63 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
64 | 64 | '<span class="important-notice">', |
65 | 65 | '</span>', |
66 | 66 | '<br />' |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | <tr> |
74 | 74 | <th> |
75 | - <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
75 | + <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
76 | 76 | </th> |
77 | 77 | <td> |
78 | 78 | |
79 | - <?php wp_nonce_field( 'espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false ); ?> |
|
79 | + <?php wp_nonce_field('espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false); ?> |
|
80 | 80 | <?php echo $event_single_display_order; ?> |
81 | 81 | |
82 | 82 | <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.', 'event_espresso'); ?></p> |