Completed
Branch BUG-8866-category-permalink (0af2d2)
by
unknown
22:53 queued 19s
created
strategies/validation/EE_Max_Length_Validation_Strategy.strategy.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,36 +8,36 @@
 block discarded – undo
8 8
  * @subpackage	Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php.
9 9
  * @author				Mike Nelson
10 10
  */
11
-class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 	protected $_max_length;
14 14
 
15
-	public function __construct( $validation_error_message = NULL, $max_length = EE_INF ) {
15
+	public function __construct($validation_error_message = NULL, $max_length = EE_INF) {
16 16
 		$this->_max_length = $max_length;
17
-		if( $validation_error_message === null ) {
18
-			$validation_error_message = sprintf( __( 'Input is too long. Maximum number of characters is %1$s', 'event_espresso' ), $max_length );
17
+		if ($validation_error_message === null) {
18
+			$validation_error_message = sprintf(__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length);
19 19
 		}
20
-		parent::__construct( $validation_error_message );
20
+		parent::__construct($validation_error_message);
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @param $normalized_value
25 25
 	 */
26 26
 	public function validate($normalized_value) {
27
-		if( $this->_max_length !== EE_INF &&
27
+		if ($this->_max_length !== EE_INF &&
28 28
 				$normalized_value &&
29
-				is_string( $normalized_value ) &&
30
-				 strlen( $normalized_value ) > $this->_max_length){
31
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'maxlength' );
29
+				is_string($normalized_value) &&
30
+				 strlen($normalized_value) > $this->_max_length) {
31
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength');
32 32
 		}
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @return array
37 37
 	 */
38
-	function get_jquery_validation_rule_array(){
39
-		if( $this->_max_length !== EE_INF ) {
40
-			return array( 'maxlength'=> $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) );
38
+	function get_jquery_validation_rule_array() {
39
+		if ($this->_max_length !== EE_INF) {
40
+			return array('maxlength'=> $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message()));
41 41
 		} else {
42 42
 			return array();
43 43
 		}
Please login to merge, or discard this patch.
libraries/form_sections/payment_methods/EE_Payment_Method_Form.form.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Specialized form for payment methods, allowing for easy setting and retrieving of meta fields.
5 5
  * Uses EEM_Payment_Method as the model
6 6
  */
7
-class EE_Payment_Method_Form extends EE_Model_Form_Section{
7
+class EE_Payment_Method_Form extends EE_Model_Form_Section {
8 8
 
9 9
 	/**
10 10
 	 * All the subsection inputs that correspond ot extra meta rows
@@ -39,37 +39,37 @@  discard block
 block discarded – undo
39 39
 	 *	@see EE_Model_Form_Section::__construct() for more
40 40
 	 * }
41 41
 	 */
42
-	public function __construct($options_array = array()){
42
+	public function __construct($options_array = array()) {
43 43
 		$this->_model = EEM_Payment_Method::instance();
44 44
 		$this->_options_array = $options_array;
45
-		if(isset($options_array['payment_method_type'])){
45
+		if (isset($options_array['payment_method_type'])) {
46 46
 			$this->_payment_method_type = $options_array['payment_method_type'];
47 47
 		}
48 48
 		$options_array = $this->_options_array;
49
-		if(isset($options_array['extra_meta_inputs'])){
50
-			$this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs,$options_array['extra_meta_inputs']);
49
+		if (isset($options_array['extra_meta_inputs'])) {
50
+			$this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs, $options_array['extra_meta_inputs']);
51 51
 		}
52
-		if($this->_extra_meta_inputs){
53
-			$this->_subsections = array_merge($this->_subsections,$this->_extra_meta_inputs);
52
+		if ($this->_extra_meta_inputs) {
53
+			$this->_subsections = array_merge($this->_subsections, $this->_extra_meta_inputs);
54 54
 		}
55 55
 		$this->_subsections['PMD_button_url'] = new EE_Admin_File_Uploader_Input(
56
-			array( 'html_label_text'=>  __( 'Button URL', 'event_espresso' ))
56
+			array('html_label_text'=>  __('Button URL', 'event_espresso'))
57 57
 		);
58 58
 		$this->_subsections['PMD_scope'] = new EE_Checkbox_Multi_Input(
59 59
 			EEM_Payment_Method::instance()->scopes(),
60
-			array( 'html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename() . EEH_Template::get_help_tab_link( 'payment_methods_overview' ))
60
+			array('html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename().EEH_Template::get_help_tab_link('payment_methods_overview'))
61 61
 		);
62 62
 		//setup the currency options
63 63
 		$this->_subsections['Currency'] = new EE_Select_Multi_Model_Input(
64
-			EEM_Currency::instance()->get_all_currencies_usable_by( $this->_payment_method_type ),
64
+			EEM_Currency::instance()->get_all_currencies_usable_by($this->_payment_method_type),
65 65
 			array(
66
-				'html_label_text'=>  __( 'Currencies Supported', 'event_espresso' ),
66
+				'html_label_text'=>  __('Currencies Supported', 'event_espresso'),
67 67
 				'required'=>TRUE
68 68
 			)
69 69
 		);
70
-		$this->_subsections['PMD_order'] = new EE_Text_Input( array(
71
-			'html_label_text' => __( 'Order', 'event_espresso' ),
72
-			'html_help_text' => __( 'Lowest numbers will be shown first', 'event_espresso' ),
70
+		$this->_subsections['PMD_order'] = new EE_Text_Input(array(
71
+			'html_label_text' => __('Order', 'event_espresso'),
72
+			'html_help_text' => __('Lowest numbers will be shown first', 'event_espresso'),
73 73
 			'normalization_strategy' => new EE_Int_Normalization(),
74 74
 			'validation_strategies' => array(
75 75
 				new EE_Int_Validation_Strategy()
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
 	 * @param string 	$name
89 89
 	 * @throws EE_Error
90 90
 	 */
91
-	public function _construct_finalize( $parent_form_section, $name ) {
92
-		if( ! $this->_payment_method_type instanceof EE_PMT_Base ){
93
-			throw new EE_Error( sprintf( __( 'Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso' )));
91
+	public function _construct_finalize($parent_form_section, $name) {
92
+		if ( ! $this->_payment_method_type instanceof EE_PMT_Base) {
93
+			throw new EE_Error(sprintf(__('Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso')));
94 94
 		}
95 95
 		//set the name of this form based on the payment method type
96
-		if( ! $this->_name && ! $name ){
97
-			$name = str_replace(" ","_",ucwords(str_replace("_"," ",($this->_payment_method_type->system_name()))))."_Settings_Form";
96
+		if ( ! $this->_name && ! $name) {
97
+			$name = str_replace(" ", "_", ucwords(str_replace("_", " ", ($this->_payment_method_type->system_name()))))."_Settings_Form";
98 98
 		}
99
-		parent::_construct_finalize( $parent_form_section, $name );
99
+		parent::_construct_finalize($parent_form_section, $name);
100 100
 	}
101 101
 
102 102
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param $payment_method_type
106 106
 	 * @throws EE_Error
107 107
 	 */
108
-	public function set_payment_method_type( $payment_method_type ){
109
-		if( ! $payment_method_type instanceof EE_PMT_Base){
108
+	public function set_payment_method_type($payment_method_type) {
109
+		if ( ! $payment_method_type instanceof EE_PMT_Base) {
110 110
 			throw new EE_Error(sprintf(__("Payment Method forms MUST set a payment method type by using _set_payment_method_type", "event_espresso")));
111 111
 		}
112 112
 		$this->_payment_method_type = $payment_method_type;
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	 * extends the model form section's save method to also save the extra meta field values
119 119
 	 * @return int ID of the payment method inserted, or true on update
120 120
 	 */
121
-	public function save(){
121
+	public function save() {
122 122
 		$parent_save_val = parent::save();
123
-		if( $this->_model_object && $this->_model_object->ID()){
124
-			foreach($this->_extra_meta_inputs as $input_name => $input){
123
+		if ($this->_model_object && $this->_model_object->ID()) {
124
+			foreach ($this->_extra_meta_inputs as $input_name => $input) {
125 125
 				$this->_model_object->update_extra_meta($input_name, $input->normalized_value());
126 126
 			}
127 127
 		}
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 		$model_obj = $this->_model->ensure_is_obj($model_obj);
139 139
 		parent::populate_model_obj($model_obj);
140 140
 		$extra_meta = $model_obj->all_extra_meta_array();
141
-		foreach($this->_extra_meta_inputs as $input_name => $extra_meta_input){
142
-			if(isset($extra_meta[$input_name])){
141
+		foreach ($this->_extra_meta_inputs as $input_name => $extra_meta_input) {
142
+			if (isset($extra_meta[$input_name])) {
143 143
 				$extra_meta_input->set_default($extra_meta[$input_name]);
144 144
 			}
145 145
 		}
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 	 * gets the default name of this form section if none is specified
152 152
 	 * @return string
153 153
 	 */
154
-	protected function _set_default_name_if_empty(){
155
-		if( ! $this->_name ){
156
-			$default_name = str_replace("EEM_", "", get_class($this->_model)) . "_Model_Form";
157
-			$this->_name =  $default_name;
154
+	protected function _set_default_name_if_empty() {
155
+		if ( ! $this->_name) {
156
+			$default_name = str_replace("EEM_", "", get_class($this->_model))."_Model_Form";
157
+			$this->_name = $default_name;
158 158
 		}
159 159
 	}
160 160
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * Gets all the extra meta inputs in this form
165 165
 	 * @return EE_Form_Input_Base[]
166 166
 	 */
167
-	public function extra_meta_inputs(){
167
+	public function extra_meta_inputs() {
168 168
 		return $this->_extra_meta_inputs;
169 169
 	}
170 170
 }
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page.core.php 2 patches
Braces   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -330,14 +331,9 @@  discard block
 block discarded – undo
330 331
 			else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] )  )) {
331 332
 				$QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ;
332 333
 				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10));
333
-			}
334
-
335
-
336
-			else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
334
+			} else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
337 335
 				$set_column_values[$fieldName] = 0;
338
-			}
339
-
340
-			else if ( $fieldName == 'QST_max' ) {
336
+			} else if ( $fieldName == 'QST_max' ) {
341 337
 				$qst_system = EEM_Question::instance()->get_var(
342 338
 					array(
343 339
 						array(
@@ -390,7 +386,7 @@  discard block
 block discarded – undo
390 386
 			$question=$this->_question_model->get_one_by_ID($ID);
391 387
 			$additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID));
392 388
 			$this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
393
-		}else{
389
+		} else{
394 390
 			$question= EE_Question::new_instance();
395 391
 			$question->set_order_to_latest();
396 392
 			$this->_set_add_edit_form_tags('insert_question');
@@ -421,7 +417,7 @@  discard block
 block discarded – undo
421 417
 			$ID=$this->_question_model->insert($set_column_values);
422 418
 			$success = $ID ? true : false;
423 419
 			$action_desc = 'added';
424
-		}else{
420
+		} else{
425 421
 			$ID=absint($this->_req_data['QST_ID']);
426 422
 			$pk=$this->_question_model->primary_key_name();
427 423
 			$wheres=array($pk=>$ID);
@@ -442,7 +438,7 @@  discard block
 block discarded – undo
442 438
 					$option_req_index=$this->_get_option_req_data_index($option_ID);
443 439
 					if($option_req_index!==FALSE){
444 440
 						$option->save($this->_req_data['question_options'][$option_req_index]);
445
-					}else{
441
+					} else{
446 442
 						//not found, remove it
447 443
 						$option->delete();
448 444
 					}
@@ -519,7 +515,7 @@  discard block
 block discarded – undo
519 515
 						'QSG_name'=>array('LIKE',"%$search_string%"),
520 516
 						'QSG_desc'=>array('LIKE',"%$search_string%"))
521 517
 					);
522
-			}else{
518
+			} else{
523 519
 				$query_params[0]=array(
524 520
 					'QST_display_text'=>array('LIKE',"%$search_string%")
525 521
 					);
@@ -575,7 +571,7 @@  discard block
 block discarded – undo
575 571
 		if ($count){
576 572
 			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
577 573
 			$results = $QST->count($where);
578
-		}else{
574
+		} else{
579 575
 			$results = $QST->get_all($query_params);
580 576
 		}
581 577
 		return $results;
Please login to merge, or discard this patch.
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 /**
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
 
60 60
 
61
-	public function __construct( $routing = TRUE ) {
62
-		require_once( EE_MODELS . 'EEM_Question.model.php' );
63
-		require_once( EE_MODELS . 'EEM_Question_Group.model.php' );
64
-		$this->_question_model=  EEM_Question::instance();
65
-		$this->_question_group_model=EEM_Question_Group::instance();
66
-		parent::__construct( $routing );
61
+	public function __construct($routing = TRUE) {
62
+		require_once(EE_MODELS.'EEM_Question.model.php');
63
+		require_once(EE_MODELS.'EEM_Question_Group.model.php');
64
+		$this->_question_model = EEM_Question::instance();
65
+		$this->_question_group_model = EEM_Question_Group::instance();
66
+		parent::__construct($routing);
67 67
 	}
68 68
 
69 69
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 
99 99
 	protected function _set_page_routes() {
100
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
100
+		$qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
101 101
 		$this->_page_routes = array(
102 102
 			'default' => array(
103 103
 				'func' => '_questions_overview_list_table',
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 			'update_question' => array(
120 120
 				'func' => '_insert_or_update_question',
121
-				'args' => array('new_question' => FALSE ),
121
+				'args' => array('new_question' => FALSE),
122 122
 				'capability' => 'ee_edit_question',
123 123
 				'obj_id' => $qst_id,
124 124
 				'noheader' => TRUE,
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 						'filename' => 'registration_form_questions_overview_views_bulk_actions_search'
154 154
 						)
155 155
 					),
156
-				'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'),
156
+				'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'),
157 157
 				'require_nonce' => FALSE,
158 158
 				'qtips' => array(
159 159
 					'EE_Registration_Form_Tips'
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 						'filename' => 'registration_form_question_groups'
173 173
 						),
174 174
 					),
175
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
175
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
176 176
 				'require_nonce' => FALSE
177 177
 				),
178 178
 
@@ -181,16 +181,16 @@  discard block
 block discarded – undo
181 181
 					'label' => __('Edit Question', 'event_espresso'),
182 182
 					'order' => 15,
183 183
 					'persistent' => FALSE,
184
-					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
184
+					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url
185 185
 					),
186
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
186
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
187 187
 				'help_tabs' => array(
188 188
 					'registration_form_edit_question_group_help_tab' => array(
189 189
 						'title' => __('Edit Question', 'event_espresso'),
190 190
 						'filename' => 'registration_form_edit_question'
191 191
 						),
192 192
 					),
193
-                'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'),
193
+                'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'),
194 194
 				'require_nonce' => FALSE
195 195
 				),
196 196
 			);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	//none of the below group are currently used for Event Categories
219 219
 	protected function _add_feature_pointers() {}
220 220
 	public function load_scripts_styles() {
221
-		wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION );
221
+		wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION);
222 222
 		wp_enqueue_style('espresso_registration');
223 223
 	}
224 224
 	public function admin_init() {}
@@ -234,20 +234,20 @@  discard block
 block discarded – undo
234 234
 
235 235
 	public function load_scripts_styles_add_question() {
236 236
 		$this->load_scripts_styles_forms();
237
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
238
-		wp_enqueue_script( 'espresso_registration_form_single' );
237
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
238
+		wp_enqueue_script('espresso_registration_form_single');
239 239
 	}
240 240
 	public function load_scripts_styles_edit_question() {
241 241
 		$this->load_scripts_styles_forms();
242
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
243
-		wp_enqueue_script( 'espresso_registration_form_single' );
242
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
243
+		wp_enqueue_script('espresso_registration_form_single');
244 244
 	}
245 245
 
246 246
 
247 247
 
248 248
 
249 249
 	public function recaptcha_info_help_tab() {
250
-		$template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
250
+		$template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php';
251 251
 		EEH_Template::display_template($template, array());
252 252
 	}
253 253
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 				)
280 280
 		);
281 281
 
282
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
282
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
283 283
 			$this->_views['trash'] = array(
284 284
 				'slug' => 'trash',
285 285
 				'label' => __('Trash', 'event_espresso'),
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	protected function _questions_groups_preview() {
299 299
 		$this->_admin_page_title = __('Question Groups (Preview)', 'event_espresso');
300
-		$this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />';
301
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>';
302
-		$this->display_admin_caf_preview_page( 'question_groups_tab' );
300
+		$this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />';
301
+		$this->_template_args['preview_text'] = '<strong>'.__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>';
302
+		$this->display_admin_caf_preview_page('question_groups_tab');
303 303
 	}
304 304
 
305 305
 
@@ -310,58 +310,58 @@  discard block
 block discarded – undo
310 310
 	 * @param \EEM_Base $model
311 311
 	 * @return array where each key is the name of a model's field/db column, and each value is its value.
312 312
 	 */
313
-	protected function _set_column_values_for(EEM_Base $model){
314
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
315
-		$set_column_values=array();
313
+	protected function _set_column_values_for(EEM_Base $model) {
314
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
315
+		$set_column_values = array();
316 316
 
317 317
 		//some initial checks for proper values.
318 318
 		//if QST_admin_only, then no matter what QST_required is we disable.
319
-		if ( !empty( $this->_req_data['QST_admin_only'] ) ) {
319
+		if ( ! empty($this->_req_data['QST_admin_only'])) {
320 320
 			$this->_req_data['QST_required'] = 0;
321 321
 		}
322
-		foreach($model->field_settings() as $fieldName=>$settings){
322
+		foreach ($model->field_settings() as $fieldName=>$settings) {
323 323
 			// basically if QSG_identifier is empty or not set
324
-			if ( $fieldName == 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) {
325
-				$QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ;
326
-				$set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid();
324
+			if ($fieldName == 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) {
325
+				$QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : '';
326
+				$set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid();
327 327
 //				dd($set_column_values);
328 328
 			}
329 329
 			//if the admin label is blank, use a slug version of the question text
330
-			else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] )  )) {
331
-				$QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ;
332
-				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10));
330
+			else if ($fieldName == 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) {
331
+				$QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : '';
332
+				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10));
333 333
 			}
334 334
 
335 335
 
336
-			else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
336
+			else if ($fieldName == 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) {
337 337
 				$set_column_values[$fieldName] = 0;
338 338
 			}
339 339
 
340
-			else if ( $fieldName == 'QST_max' ) {
340
+			else if ($fieldName == 'QST_max') {
341 341
 				$qst_system = EEM_Question::instance()->get_var(
342 342
 					array(
343 343
 						array(
344
-							'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0
344
+							'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0
345 345
 						)
346 346
 					),
347 347
 					'QST_system' );
348
-				$max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system );
349
-				if( empty( $this->_req_data[ 'QST_max' ] ) ||
350
-					 $this->_req_data[ 'QST_max' ] > $max_max ) {
351
-					$set_column_values[ $fieldName ] = $max_max;
348
+				$max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system);
349
+				if (empty($this->_req_data['QST_max']) ||
350
+					 $this->_req_data['QST_max'] > $max_max) {
351
+					$set_column_values[$fieldName] = $max_max;
352 352
 				}
353 353
 			}
354 354
 
355 355
 
356 356
 			//only add a property to the array if it's not null (otherwise the model should just use the default value)
357
-			if(
358
-				! isset( $set_column_values[ $fieldName ] ) &&
359
-				isset($this->_req_data[$fieldName] ) ){
360
-				$set_column_values[$fieldName]=$this->_req_data[$fieldName];
357
+			if (
358
+				! isset($set_column_values[$fieldName]) &&
359
+				isset($this->_req_data[$fieldName]) ) {
360
+				$set_column_values[$fieldName] = $this->_req_data[$fieldName];
361 361
 			}
362 362
 
363 363
 		}
364
-		return $set_column_values;//validation fo this data to be performed by the model before insertion.
364
+		return $set_column_values; //validation fo this data to be performed by the model before insertion.
365 365
 	}
366 366
 
367 367
 
@@ -379,30 +379,30 @@  discard block
 block discarded – undo
379 379
 	/**
380 380
 	 * @param string $action
381 381
 	 */
382
-	protected function _edit_question( $action= 'add' ) {
383
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
384
-		$ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE;
382
+	protected function _edit_question($action = 'add') {
383
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
384
+		$ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE;
385 385
 
386
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
386
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
387 387
 		// add PRC_ID to title if editing
388
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
389
-		if($ID){
390
-			$question=$this->_question_model->get_one_by_ID($ID);
391
-			$additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID));
388
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
389
+		if ($ID) {
390
+			$question = $this->_question_model->get_one_by_ID($ID);
391
+			$additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID));
392 392
 			$this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
393
-		}else{
394
-			$question= EE_Question::new_instance();
393
+		} else {
394
+			$question = EE_Question::new_instance();
395 395
 			$question->set_order_to_latest();
396 396
 			$this->_set_add_edit_form_tags('insert_question');
397 397
 		}
398
-		$question_types = $question->has_answers() ?  $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types();
399
-		$this->_template_args['QST_ID']=$ID;
400
-		$this->_template_args['question']=$question;
401
-		$this->_template_args['question_types']= $question_types;
402
-		$this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() );
398
+		$question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types();
399
+		$this->_template_args['QST_ID'] = $ID;
400
+		$this->_template_args['question'] = $question;
401
+		$this->_template_args['question_types'] = $question_types;
402
+		$this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID());
403 403
 
404
-		$this->_set_publish_post_box_vars( 'id', $ID );
405
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE );
404
+		$this->_set_publish_post_box_vars('id', $ID);
405
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE);
406 406
 
407 407
 		// the details template wrapper
408 408
 		$this->display_admin_page_with_sidebar();
@@ -414,58 +414,58 @@  discard block
 block discarded – undo
414 414
 	 * @param bool|true $new_question
415 415
 	 * @throws \EE_Error
416 416
 	 */
417
-	protected function _insert_or_update_question( $new_question = TRUE) {
418
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
419
-		$set_column_values=$this->_set_column_values_for($this->_question_model);
420
-		if($new_question){
421
-			$ID=$this->_question_model->insert($set_column_values);
417
+	protected function _insert_or_update_question($new_question = TRUE) {
418
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
419
+		$set_column_values = $this->_set_column_values_for($this->_question_model);
420
+		if ($new_question) {
421
+			$ID = $this->_question_model->insert($set_column_values);
422 422
 			$success = $ID ? true : false;
423 423
 			$action_desc = 'added';
424
-		}else{
425
-			$ID=absint($this->_req_data['QST_ID']);
426
-			$pk=$this->_question_model->primary_key_name();
427
-			$wheres=array($pk=>$ID);
424
+		} else {
425
+			$ID = absint($this->_req_data['QST_ID']);
426
+			$pk = $this->_question_model->primary_key_name();
427
+			$wheres = array($pk=>$ID);
428 428
 			unset($set_column_values[$pk]);
429
-			$success= $this->_question_model->update($set_column_values,array($wheres));
430
-			$action_desc='updated';
429
+			$success = $this->_question_model->update($set_column_values, array($wheres));
430
+			$action_desc = 'updated';
431 431
 		}
432 432
 
433
-		if ($ID){
433
+		if ($ID) {
434 434
 			//save the related options
435 435
 			//trash removed options, save old ones
436 436
 			//get list of all options
437 437
 			/** @type EE_Question $question */
438
-			$question=$this->_question_model->get_one_by_ID($ID);
439
-			$options=$question->options();
440
-			if(! empty($options)){
441
-				foreach($options as $option_ID=>$option){
442
-					$option_req_index=$this->_get_option_req_data_index($option_ID);
443
-					if($option_req_index!==FALSE){
438
+			$question = $this->_question_model->get_one_by_ID($ID);
439
+			$options = $question->options();
440
+			if ( ! empty($options)) {
441
+				foreach ($options as $option_ID=>$option) {
442
+					$option_req_index = $this->_get_option_req_data_index($option_ID);
443
+					if ($option_req_index !== FALSE) {
444 444
 						$option->save($this->_req_data['question_options'][$option_req_index]);
445
-					}else{
445
+					} else {
446 446
 						//not found, remove it
447 447
 						$option->delete();
448 448
 					}
449 449
 				}
450 450
 			}
451 451
 			//save new related options
452
-			foreach($this->_req_data['question_options'] as $index=>$option_req_data){
453
-				if( empty($option_req_data['QSO_ID'] ) && (  ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it!
454
-					if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === ''  ){
455
-						$option_req_data['QSO_value']=$option_req_data['QSO_desc'];
452
+			foreach ($this->_req_data['question_options'] as $index=>$option_req_data) {
453
+				if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it!
454
+					if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') {
455
+						$option_req_data['QSO_value'] = $option_req_data['QSO_desc'];
456 456
 					}
457
-					$new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
457
+					$new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
458 458
 					$new_option->save();
459 459
 				}
460 460
 			}
461 461
 		}
462
-		$query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID );
463
-		if ( $success !== FALSE ) {
464
-			$msg = $new_question ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() );
465
-			EE_Error::add_success( $msg );
462
+		$query_args = array('action' => 'edit_question', 'QST_ID' => $ID);
463
+		if ($success !== FALSE) {
464
+			$msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name());
465
+			EE_Error::add_success($msg);
466 466
 		}
467 467
 
468
-		$this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE);
468
+		$this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE);
469 469
 	}
470 470
 
471 471
 
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 	 * @param int $ID of the question option to find
479 479
 	 * @return int index in question_options array if successful, FALSE if unsuccessful
480 480
 	 */
481
-	protected function _get_option_req_data_index($ID){
482
-		$req_data_for_question_options=$this->_req_data['question_options'];
483
-		foreach($req_data_for_question_options as $num=>$option_data){
484
-			if(array_key_exists('QSO_ID',$option_data) && intval($option_data['QSO_ID'])==$ID){
481
+	protected function _get_option_req_data_index($ID) {
482
+		$req_data_for_question_options = $this->_req_data['question_options'];
483
+		foreach ($req_data_for_question_options as $num=>$option_data) {
484
+			if (array_key_exists('QSO_ID', $option_data) && intval($option_data['QSO_ID']) == $ID) {
485 485
 				return $num;
486 486
 			}
487 487
 		}
@@ -503,25 +503,25 @@  discard block
 block discarded – undo
503 503
 	 * @param int      $current_page
504 504
 	 * @return array lik EEM_Base::get_all's $query_params parameter
505 505
 	 */
506
-	protected function get_query_params($model, $per_page=10,$current_page=10){
506
+	protected function get_query_params($model, $per_page = 10, $current_page = 10) {
507 507
 		$query_params = array();
508
-		$offset=($current_page-1)*$per_page;
509
-		$query_params['limit']=array($offset,$per_page);
510
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
508
+		$offset = ($current_page - 1) * $per_page;
509
+		$query_params['limit'] = array($offset, $per_page);
510
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
511 511
 		$orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
512 512
 		$field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
513
-		$query_params['order_by']=array( $field_to_order_by => $order );
514
-		$search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null;
515
-		if(! empty($search_string)){
516
-			if($model instanceof EEM_Question_Group){
517
-				$query_params[0]=array(
513
+		$query_params['order_by'] = array($field_to_order_by => $order);
514
+		$search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
515
+		if ( ! empty($search_string)) {
516
+			if ($model instanceof EEM_Question_Group) {
517
+				$query_params[0] = array(
518 518
 					'OR'=>array(
519
-						'QSG_name'=>array('LIKE',"%$search_string%"),
520
-						'QSG_desc'=>array('LIKE',"%$search_string%"))
519
+						'QSG_name'=>array('LIKE', "%$search_string%"),
520
+						'QSG_desc'=>array('LIKE', "%$search_string%"))
521 521
 					);
522
-			}else{
523
-				$query_params[0]=array(
524
-					'QST_display_text'=>array('LIKE',"%$search_string%")
522
+			} else {
523
+				$query_params[0] = array(
524
+					'QST_display_text'=>array('LIKE', "%$search_string%")
525 525
 					);
526 526
 			}
527 527
 		}
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
 	 * @param bool|false $count
570 570
 	 * @return \EE_Soft_Delete_Base_Class[]|int
571 571
 	 */
572
-	public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) {
572
+	public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) {
573 573
 		$QST = EEM_Question::instance();
574 574
 		$query_params = $this->get_query_params($QST, $per_page, $current_page);
575
-		if ($count){
576
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
575
+		if ($count) {
576
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
577 577
 			$results = $QST->count($where);
578
-		}else{
578
+		} else {
579 579
 			$results = $QST->get_all($query_params);
580 580
 		}
581 581
 		return $results;
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
 	 * @param bool|false $count
591 591
 	 * @return \EE_Soft_Delete_Base_Class[]|int
592 592
 	 */
593
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
594
-		$query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page);
595
-		$where        = isset( $query_params[0] ) ? array($query_params[0]) : array();
596
-		$questions    =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
593
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
594
+		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
595
+		$where        = isset($query_params[0]) ? array($query_params[0]) : array();
596
+		$questions    = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
597 597
 		return $questions;
598 598
 	}
599 599
 
@@ -605,11 +605,11 @@  discard block
 block discarded – undo
605 605
 	 * @param bool|false $count
606 606
 	 * @return \EE_Soft_Delete_Base_Class[]
607 607
 	 */
608
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
608
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
609 609
 		/** @type EEM_Question_Group $questionGroupModel */
610
-		$questionGroupModel=EEM_Question_Group::instance();
611
-		$query_params=$this->get_query_params( $questionGroupModel, $per_page, $current_page );
612
-		$questionGroups=$questionGroupModel->get_all($query_params);//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
610
+		$questionGroupModel = EEM_Question_Group::instance();
611
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
612
+		$questionGroups = $questionGroupModel->get_all($query_params); //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
613 613
 		return $questionGroups;
614 614
 	}
615 615
 
@@ -626,36 +626,36 @@  discard block
 block discarded – undo
626 626
 
627 627
 		$this->_template_args['values'] = $this->_yes_no_values;
628 628
 
629
-		$this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
630
-		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': '';
629
+		$this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
630
+		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : '';
631 631
 
632
-		$this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '';
633
-		$this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '';
634
-		$this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500;
632
+		$this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '';
633
+		$this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '';
634
+		$this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500;
635 635
 
636 636
 		$this->_template_args['recaptcha_theme_options'] = array(
637
-				array('id'  => 'red','text'=> __('Red', 'event_espresso')),
638
-				array('id'  => 'white','text'=> __('White', 'event_espresso')),
639
-				array('id'  => 'blackglass','text'=> __('Blackglass', 'event_espresso')),
640
-				array('id'  => 'clean','text'=> __('Clean', 'event_espresso'))
637
+				array('id'  => 'red', 'text'=> __('Red', 'event_espresso')),
638
+				array('id'  => 'white', 'text'=> __('White', 'event_espresso')),
639
+				array('id'  => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')),
640
+				array('id'  => 'clean', 'text'=> __('Clean', 'event_espresso'))
641 641
 			);
642
-		$this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean';
642
+		$this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean';
643 643
 
644 644
 		$this->_template_args['recaptcha_language_options'] = array(
645
-				array('id'  => 'en','text'=> __('English', 'event_espresso')),
646
-				array('id'  => 'es','text'=> __('Spanish', 'event_espresso')),
647
-				array('id'  => 'nl','text'=> __('Dutch', 'event_espresso')),
648
-				array('id'  => 'fr','text'=> __('French', 'event_espresso')),
649
-				array('id'  => 'de','text'=> __('German', 'event_espresso')),
650
-				array('id'  => 'pt','text'=> __('Portuguese', 'event_espresso')),
651
-				array('id'  => 'ru','text'=> __('Russian', 'event_espresso')),
652
-				array('id'  => 'tr','text'=> __('Turkish', 'event_espresso'))
645
+				array('id'  => 'en', 'text'=> __('English', 'event_espresso')),
646
+				array('id'  => 'es', 'text'=> __('Spanish', 'event_espresso')),
647
+				array('id'  => 'nl', 'text'=> __('Dutch', 'event_espresso')),
648
+				array('id'  => 'fr', 'text'=> __('French', 'event_espresso')),
649
+				array('id'  => 'de', 'text'=> __('German', 'event_espresso')),
650
+				array('id'  => 'pt', 'text'=> __('Portuguese', 'event_espresso')),
651
+				array('id'  => 'ru', 'text'=> __('Russian', 'event_espresso')),
652
+				array('id'  => 'tr', 'text'=> __('Turkish', 'event_espresso'))
653 653
 			);
654
-		$this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
654
+		$this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
655 655
 
656
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
657
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
658
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE );
656
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
657
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
658
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE);
659 659
 		$this->display_admin_page_with_sidebar();
660 660
 	}
661 661
 
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Payment_Method_Manager.lib.php 2 patches
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		// check if class object is instantiated, and instantiated properly
38
-		if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) {
38
+		if ( ! self::$_instance instanceof EE_Payment_Method_Manager) {
39 39
 			self::$_instance = new self();
40 40
 		}
41 41
 		EE_Registry::instance()->load_lib('PMT_Base');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * Resets the instance and returns a new one
47 47
 	 * @return EE_Payment_Method_Manager
48 48
 	 */
49
-	public static function reset(){
49
+	public static function reset() {
50 50
 		self::$_instance = NULL;
51 51
 		return self::instance();
52 52
 	}
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * or just re-use the PMTs we found last time we checked during this request (if
58 58
 	 * we have not yet checked during this request, then we need to check anyways)
59 59
 	 */
60
-	public function maybe_register_payment_methods( $force_recheck = FALSE ){
61
-		if( ! $this->_payment_method_types || $force_recheck ){
60
+	public function maybe_register_payment_methods($force_recheck = FALSE) {
61
+		if ( ! $this->_payment_method_types || $force_recheck) {
62 62
 			$this->_register_payment_methods();
63 63
 			//if in admin lets ensure caps are set.
64
-			if ( is_admin() ) {
65
-				add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) );
64
+			if (is_admin()) {
65
+				add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps'));
66 66
 				EE_Registry::instance()->CAP->init_caps();
67 67
 			}
68 68
 		}
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _register_payment_methods() {
77 77
 		// grab list of installed modules
78
-		$pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
78
+		$pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
79 79
 		// filter list of modules to register
80
-		$pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register );
80
+		$pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register);
81 81
 
82 82
 		// loop through folders
83
-		foreach ( $pm_to_register as $pm_path ) {
84
-				$this->register_payment_method( $pm_path );
83
+		foreach ($pm_to_register as $pm_path) {
84
+				$this->register_payment_method($pm_path);
85 85
 		}
86
-		do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' );
86
+		do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods');
87 87
 		// filter list of installed modules
88 88
 		//keep them organized alphabetically by the payment method type's name
89
-		ksort( $this->_payment_method_types );
90
-		return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types );
89
+		ksort($this->_payment_method_types);
90
+		return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types);
91 91
 	}
92 92
 
93 93
 
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 	 * @param string $payment_method_path - full path up to and including payment method folder
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function register_payment_method( $payment_method_path = '' ) {
103
-		do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path );
102
+	public function register_payment_method($payment_method_path = '') {
103
+		do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path);
104 104
 		$module_ext = '.pm.php';
105 105
 		// make all separators match
106
-		$payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS );
106
+		$payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS);
107 107
 		// grab and sanitize module name
108
-		$module_dir = basename( $payment_method_path );
108
+		$module_dir = basename($payment_method_path);
109 109
 		// create classname from module directory name
110
-		$module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir ));
110
+		$module = str_replace(' ', '_', str_replace('_', ' ', $module_dir));
111 111
 		// add class prefix
112
-		$module_class = 'EE_PMT_' . $module;
112
+		$module_class = 'EE_PMT_'.$module;
113 113
 		// does the module exist ?
114
-		if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) {
115
-			$msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
116
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
114
+		if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) {
115
+			$msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
116
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
117 117
 			return FALSE;
118 118
 		}
119
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); }
119
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); }
120 120
 		// load the module class file
121
-		require_once( $payment_method_path . DS . $module_class . $module_ext );
122
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
121
+		require_once($payment_method_path.DS.$module_class.$module_ext);
122
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
123 123
 		// verify that class exists
124
-		if ( ! class_exists( $module_class )) {
125
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
126
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
124
+		if ( ! class_exists($module_class)) {
125
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
126
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
127 127
 			return FALSE;
128 128
 		}
129 129
 		// add to array of registered modules
130
-		$this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext;
130
+		$this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext;
131 131
 		return TRUE;
132 132
 	}
133 133
 	/**
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
137 137
 	 * @return boolean
138 138
 	 */
139
-	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){
140
-		if ( ! is_array( $this->_payment_method_types ) || ! isset( $this->_payment_method_types[$payment_method_name] )
141
-				|| $force_recheck ) {
139
+	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) {
140
+		if ( ! is_array($this->_payment_method_types) || ! isset($this->_payment_method_types[$payment_method_name])
141
+				|| $force_recheck) {
142 142
 			$this->maybe_register_payment_methods($force_recheck);
143 143
 		}
144
-		if(isset($this->_payment_method_types[$payment_method_name])){
144
+		if (isset($this->_payment_method_types[$payment_method_name])) {
145 145
 			require_once($this->_payment_method_types[$payment_method_name]);
146 146
 			return true;
147
-		}else{
147
+		} else {
148 148
 			return false;
149 149
 		}
150 150
 	}
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
156 156
 	 * @return array
157 157
 	 */
158
-	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){
158
+	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) {
159 159
 		$this->maybe_register_payment_methods($force_recheck);
160
-		if($with_prefixes){
160
+		if ($with_prefixes) {
161 161
 			$classnames = array_keys($this->_payment_method_types);
162 162
 			$payment_methods = array();
163
-			foreach($classnames as $classname){
163
+			foreach ($classnames as $classname) {
164 164
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
165 165
 			}
166 166
 			return $payment_methods;
167
-		}else{
167
+		} else {
168 168
 			return array_keys($this->_payment_method_types);
169 169
 		}
170 170
 	}
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
175 175
 	 * @return EE_PMT_Base[]
176 176
 	 */
177
-	public function payment_method_types( $force_recheck = FALSE ){
177
+	public function payment_method_types($force_recheck = FALSE) {
178 178
 		$this->maybe_register_payment_methods($force_recheck);
179 179
 		$pmt_objs = array();
180
-		foreach($this->payment_method_type_names(true) as $classname){
180
+		foreach ($this->payment_method_type_names(true) as $classname) {
181 181
 			$pmt_objs[] = new $classname;
182 182
 		}
183 183
 		return $pmt_objs;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 * @param string $classname
190 190
 	 * @return string
191 191
 	 */
192
-	public function payment_method_type_sans_class_prefix($classname){
193
-		$pmt_name = str_replace("EE_PMT_","",$classname);
192
+	public function payment_method_type_sans_class_prefix($classname) {
193
+		$pmt_name = str_replace("EE_PMT_", "", $classname);
194 194
 		return $pmt_name;
195 195
 	}
196 196
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param string $type
200 200
 	 * @return string
201 201
 	 */
202
-	public function payment_method_class_from_type($type){
202
+	public function payment_method_class_from_type($type) {
203 203
 		$this->maybe_register_payment_methods();
204 204
 		return "EE_PMT_".$type;
205 205
 	}
@@ -213,38 +213,38 @@  discard block
 block discarded – undo
213 213
 	 * @return \EE_Payment_Method
214 214
 	 * @throws \EE_Error
215 215
 	 */
216
-	public function activate_a_payment_method_of_type( $payment_method_type ){
216
+	public function activate_a_payment_method_of_type($payment_method_type) {
217 217
 		$payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type);
218
-		if( ! $payment_method instanceof EE_Payment_Method ){
218
+		if ( ! $payment_method instanceof EE_Payment_Method) {
219 219
 			$pm_type_class = $this->payment_method_class_from_type($payment_method_type);
220
-			if(class_exists($pm_type_class)){
220
+			if (class_exists($pm_type_class)) {
221 221
 				/** @var $pm_type_obj EE_PMT_Base */
222 222
 				$pm_type_obj = new $pm_type_class;
223 223
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name());
224
-				if( ! $payment_method){
225
-					$payment_method = $this->create_payment_method_of_type( $pm_type_obj );
224
+				if ( ! $payment_method) {
225
+					$payment_method = $this->create_payment_method_of_type($pm_type_obj);
226 226
 				}
227
-				$payment_method->set_type( $payment_method_type );
228
-				$this->initialize_payment_method( $payment_method );
227
+				$payment_method->set_type($payment_method_type);
228
+				$this->initialize_payment_method($payment_method);
229 229
 			} else {
230 230
 				throw new EE_Error(
231 231
 					sprintf(
232
-						__( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
232
+						__('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
233 233
 						$pm_type_class )
234 234
 				);
235 235
 			}
236 236
 		}
237 237
 		$payment_method->set_active();
238 238
 		$payment_method->save();
239
-		$this->set_usable_currencies_on_payment_method( $payment_method );
240
-		if( $payment_method->type() == 'Invoice' ){
241
-			$messages = EE_Registry::instance()->load_lib( 'messages' );
242
-			$messages->ensure_message_type_is_active( 'invoice', 'html' );
243
-			$messages->ensure_messenger_is_active( 'pdf' );
239
+		$this->set_usable_currencies_on_payment_method($payment_method);
240
+		if ($payment_method->type() == 'Invoice') {
241
+			$messages = EE_Registry::instance()->load_lib('messages');
242
+			$messages->ensure_message_type_is_active('invoice', 'html');
243
+			$messages->ensure_messenger_is_active('pdf');
244 244
 			EE_Error::add_attention(
245 245
 				sprintf(
246
-					__( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ),
247
-					'<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">',
246
+					__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'),
247
+					'<a href="'.admin_url('admin.php?page=espresso_messages').'">',
248 248
 					'</a>'
249 249
 				)
250 250
 			);
@@ -258,17 +258,17 @@  discard block
 block discarded – undo
258 258
 	 * @param EE_PMT_Base $pm_type_obj
259 259
 	 * @return EE_Payment_Method
260 260
 	 */
261
-	public function create_payment_method_of_type( $pm_type_obj ) {
261
+	public function create_payment_method_of_type($pm_type_obj) {
262 262
 		global $current_user;
263 263
 		$payment_method = EE_Payment_Method::new_instance(
264 264
 			array(
265 265
 				'PMD_type' 		 => $pm_type_obj->system_name(),
266 266
 				'PMD_name' 		 => $pm_type_obj->pretty_name(),
267 267
 				'PMD_admin_name' => $pm_type_obj->pretty_name(),
268
-				'PMD_slug' 		 => $pm_type_obj->system_name(),//automatically converted to slug
268
+				'PMD_slug' 		 => $pm_type_obj->system_name(), //automatically converted to slug
269 269
 				'PMD_wp_user' 	 => $current_user->ID,
270 270
 				'PMD_order' 	 => EEM_Payment_Method::instance()->count(
271
-						array( array( 'PMD_type' => array( '!=', 'Admin_Only' )))
271
+						array(array('PMD_type' => array('!=', 'Admin_Only')))
272 272
 					) * 10,
273 273
 			)
274 274
 		);
@@ -280,16 +280,16 @@  discard block
 block discarded – undo
280 280
 	 * @param EE_Payment_Method $payment_method
281 281
 	 * @return EE_Payment_Method
282 282
 	 */
283
-	public function initialize_payment_method( $payment_method ) {
283
+	public function initialize_payment_method($payment_method) {
284 284
 		$pm_type_obj = $payment_method->type_obj();
285
-		$payment_method->set_description( $pm_type_obj->default_description() );
286
-		if( ! $payment_method->button_url() ){
287
-			$payment_method->set_button_url( $pm_type_obj->default_button_url() );
285
+		$payment_method->set_description($pm_type_obj->default_description());
286
+		if ( ! $payment_method->button_url()) {
287
+			$payment_method->set_button_url($pm_type_obj->default_button_url());
288 288
 		}	
289 289
 		//now add setup its default extra meta properties
290 290
 		$extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs();
291
-		foreach( $extra_metas as $meta_name => $input ){
292
-			$payment_method->update_extra_meta($meta_name, $input->raw_value() );
291
+		foreach ($extra_metas as $meta_name => $input) {
292
+			$payment_method->update_extra_meta($meta_name, $input->raw_value());
293 293
 		}
294 294
 		return $payment_method;
295 295
 	}
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 * @param EE_Payment_Method $payment_method
300 300
 	 * @return EE_Payment_Method
301 301
 	 */
302
-	public function set_usable_currencies_on_payment_method( $payment_method ) {
303
-		foreach($payment_method->get_all_usable_currencies() as $currency_obj){
302
+	public function set_usable_currencies_on_payment_method($payment_method) {
303
+		foreach ($payment_method->get_all_usable_currencies() as $currency_obj) {
304 304
 			$payment_method->_add_relation_to($currency_obj, 'Currency');
305 305
 		}
306 306
 		return $payment_method;
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @return int count of rows updated.
320 320
 	 */
321
-	public function deactivate_payment_method( $payment_method_slug ) {
322
-		$count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()),array(array('PMD_slug'=>$payment_method_slug)));
321
+	public function deactivate_payment_method($payment_method_slug) {
322
+		$count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()), array(array('PMD_slug'=>$payment_method_slug)));
323 323
 		return $count_updated;
324 324
 	}
325 325
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @param array $caps capabilities being filtered
333 333
 	 * @return array
334 334
 	 */
335
-	public function add_payment_method_caps( $caps ) {
335
+	public function add_payment_method_caps($caps) {
336 336
 		/* add dynamic caps from payment methods
337 337
 		 * at the time of writing, october 20 2014, these are the caps added:
338 338
 		 * ee_payment_method_admin_only
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		 * their related capability automatically added too, so long as they are
348 348
 		 * registered properly using EE_Register_Payment_Method::register()
349 349
 		 */
350
-		foreach( $this->payment_method_types() as $payment_method_type_obj ){
350
+		foreach ($this->payment_method_types() as $payment_method_type_obj) {
351 351
 			$caps['administrator'][] = $payment_method_type_obj->cap_name();
352 352
 		}
353 353
 		return $caps;
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  *
4 6
  * Class EE_Payment_Method_Manager
@@ -144,7 +146,7 @@  discard block
 block discarded – undo
144 146
 		if(isset($this->_payment_method_types[$payment_method_name])){
145 147
 			require_once($this->_payment_method_types[$payment_method_name]);
146 148
 			return true;
147
-		}else{
149
+		} else{
148 150
 			return false;
149 151
 		}
150 152
 	}
@@ -164,7 +166,7 @@  discard block
 block discarded – undo
164 166
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
165 167
 			}
166 168
 			return $payment_methods;
167
-		}else{
169
+		} else{
168 170
 			return array_keys($this->_payment_method_types);
169 171
 		}
170 172
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Join.model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,26 +21,26 @@
 block discarded – undo
21 21
  * @since		 	   $VID:$
22 22
  *
23 23
  */
24
-if (!defined('EVENT_ESPRESSO_VERSION')) {
24
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
25 25
 	exit('No direct script access allowed');
26 26
 }
27 27
 
28
-class EEM_Extra_Join extends EEM_Base{
28
+class EEM_Extra_Join extends EEM_Base {
29 29
 	// private instance of the Extra Join object
30 30
 	protected static $_instance = NULL;
31 31
 	
32 32
 	public function __construct($timezone = NULL) {
33
-		$models_this_can_join = array_keys( EE_Registry::instance()->non_abstract_db_models );
33
+		$models_this_can_join = array_keys(EE_Registry::instance()->non_abstract_db_models);
34 34
 		$this->_tables = array(
35
-			'Extra_Join' => new EE_Primary_Table( 'esp_extra_join', 'EXJ_ID' ),
35
+			'Extra_Join' => new EE_Primary_Table('esp_extra_join', 'EXJ_ID'),
36 36
 		);
37 37
 		$this->_fields = array(
38 38
 			'Extra_Join' => array(
39
-				'EXJ_ID' => new EE_Primary_Key_Int_Field( 'EXJ_ID', __( 'Extra Join ID', 'event_espresso' ) ),
40
-				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_first_model_ID', __( 'First Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
41
-				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_first_model_name', __( 'First Model Name', 'event_espresso'), true, '', $models_this_can_join ),
42
-				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_second_model_ID', __( 'Second Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
43
-				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_second_model_name', __( 'Second Model Name', 'event_espresso'), true, '', $models_this_can_join ),
39
+				'EXJ_ID' => new EE_Primary_Key_Int_Field('EXJ_ID', __('Extra Join ID', 'event_espresso')),
40
+				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field('EXJ_first_model_ID', __('First Model ID', 'event_espresso'), true, 0, $models_this_can_join),
41
+				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_first_model_name', __('First Model Name', 'event_espresso'), true, '', $models_this_can_join),
42
+				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field('EXJ_second_model_ID', __('Second Model ID', 'event_espresso'), true, 0, $models_this_can_join),
43
+				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_second_model_name', __('Second Model Name', 'event_espresso'), true, '', $models_this_can_join),
44 44
 				
45 45
 			)
46 46
 		);
Please login to merge, or discard this patch.
registration_form/templates/questions_main_meta_box.template.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		<tbody>
22 22
 			<tr>
23 23
 				<th>
24
-					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?>
24
+					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?>
25 25
 				</th>
26 26
 				<td>
27 27
 					<input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/>
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 
32 32
 			<tr>
33 33
 				<th>
34
-					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?>
34
+					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?>
35 35
 				</th>
36 36
 				<td>
37 37
 					<?php
38
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
39
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
38
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
39
+						$id = ! empty($QST_system) ? '_disabled' : '';
40 40
 					?>
41 41
 					<input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/>
42 42
 					<input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" />
43
-					<?php if ( ! empty( $QST_system )) { ?>
43
+					<?php if ( ! empty($QST_system)) { ?>
44 44
 						<input type="hidden"  id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/>
45 45
 					<?php } ?>
46 46
 					<br/>
47 47
 					<p class="description">
48
-					<?php if ( ! empty( $QST_system )) { ?>
48
+					<?php if ( ! empty($QST_system)) { ?>
49 49
 					<span class="description" style="color:#D54E21;">
50
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
50
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
51 51
 					</span>
52 52
 					<?php } ?>
53 53
 
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
 			<tr>
59 59
 				<th>
60
-					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?>
60
+					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?>
61 61
 				</th>
62 62
 				<td>
63 63
 					<?php
64
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
65
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
64
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
65
+						$id = ! empty($QST_system) ? '_disabled' : '';
66 66
 						$admin_only = $question->get('QST_admin_only');
67
-						$checked = !empty( $admin_only ) ? ' checked="checked"' : '';
67
+						$checked = ! empty($admin_only) ? ' checked="checked"' : '';
68 68
 					?>
69 69
 					<input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/>
70 70
 					<br/>
71 71
 					<p class="description">
72
-					<?php if ( ! empty( $QST_system )) { ?>
72
+					<?php if ( ! empty($QST_system)) { ?>
73 73
 					<span class="description" style="color:#D54E21;">
74
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
74
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
75 75
 					</span>
76 76
 					<?php } ?>
77 77
 
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 
82 82
 			<tr>
83 83
 				<th>
84
-					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?>
84
+					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?>
85 85
 				</th>
86 86
 				<td>
87 87
 					<?php
88
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
89
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
90
-						echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled );
91
-						if( ! empty( $QST_system ) ) { ?>
88
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
89
+						$id = ! empty($QST_system) ? '_disabled' : '';
90
+						echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled);
91
+						if ( ! empty($QST_system)) { ?>
92 92
 							<input type="hidden"  id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/>
93 93
 						<?php
94
-							$explanatory_text = __('System question! This field cannot be changed.','event_espresso');
95
-						}else{
96
-							$explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso');
94
+							$explanatory_text = __('System question! This field cannot be changed.', 'event_espresso');
95
+						} else {
96
+							$explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso');
97 97
 						}
98
-						if ( ! empty( $QST_system ) || $has_answers ) { ?>
98
+						if ( ! empty($QST_system) || $has_answers) { ?>
99 99
 							<p><span class="description" style="color:#D54E21;">
100 100
 								<?php echo $explanatory_text; ?>
101 101
 							</span></p>
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 			<tr id="text_input_question_options">
109 109
 				<th>
110 110
 					<label>
111
-						<?php _e( 'Maximum Allowed Response Size', 'event_espresso' );?>
111
+						<?php _e('Maximum Allowed Response Size', 'event_espresso'); ?>
112 112
 					</label>
113 113
 				</th>
114 114
 				<td>
115
-					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max == EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1">
115
+					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max == EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1">
116 116
 					<p>
117 117
 						<span class="description">
118
-							<?php _e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?>
118
+							<?php _e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?>
119 119
 						</span>
120 120
 					</p>
121
-					<?php if ( $QST_system ) { ?>
121
+					<?php if ($QST_system) { ?>
122 122
 					<p>
123 123
 						<span class="description" style="color:#D54E21;">
124 124
 							<?php printf(
125
-									__( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ),
126
-									$max_max );?>
125
+									__('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'),
126
+									$max_max ); ?>
127 127
 						</span>
128 128
 					</p>
129 129
 					<?php } ?>
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			<tr id="question_options">
133 133
 				<th>
134 134
 					<label>
135
-						<?php _e('Answer Options','event_espresso')?>
135
+						<?php _e('Answer Options', 'event_espresso')?>
136 136
 					</label>
137 137
 				</th>
138 138
 				<td>
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 						<thead>
142 142
 							<tr>
143 143
 								<th class="option-value-header">
144
-									<?php _e('Value','event_espresso')?>
144
+									<?php _e('Value', 'event_espresso')?>
145 145
 								</th>
146 146
 								<th class="option-desc-header">
147
-									<?php _e('Description (optional, only shown on registration form)','event_espresso')?>
147
+									<?php _e('Description (optional, only shown on registration form)', 'event_espresso')?>
148 148
 								</th>
149 149
 								<th>
150 150
 								</th>
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 							</tr>
168 168
 
169 169
 							<?php
170
-							$count=0;
170
+							$count = 0;
171 171
 							$question_options = $question->options();
172
-							if ( ! empty( $question_options )) {
173
-								foreach( $question_options as $option_id => $option ) {
174
-									$disabled =  $has_answers || $option->get('QSO_system') ? ' disabled="disabled"'  : '';
172
+							if ( ! empty($question_options)) {
173
+								foreach ($question_options as $option_id => $option) {
174
+									$disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : '';
175 175
 							?>
176 176
 								<tr class="question-option ee-options-sortable">
177 177
 									<td class="option-value-cell">
178 178
 										<input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>">
179 179
 										<input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php  $option->f('QSO_value')?>"<?php echo $disabled; ?>>
180
-										<?php if ( $has_answers ) : ?>
180
+										<?php if ($has_answers) : ?>
181 181
 											<input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" >
182 182
 										<?php endif; ?>
183 183
 									</td>
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 										<input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>">
186 186
 									</td>
187 187
 									<td>
188
-										<?php if ( ! $option->system() ) { ?>
188
+										<?php if ( ! $option->system()) { ?>
189 189
 											<span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span>
190 190
 										<?php } ?>
191 191
 										<span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span>
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
 					</table>
225 225
 
226 226
 					<a id="new-question-option" class="button" style="margin:0 0 1em 3px;">
227
-						<?php _e('Add Another Answer Option','event_espresso')?>
227
+						<?php _e('Add Another Answer Option', 'event_espresso')?>
228 228
 					</a><br/>
229 229
 
230 230
 					<p class="description">
231
-						<?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?>
231
+						<?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?>
232 232
 					</p>
233
-					<?php if ( $has_answers ) : ?>
233
+					<?php if ($has_answers) : ?>
234 234
 					<p class="description" style="color:#D54E21;">
235 235
 							<?php _e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?>
236 236
 					</p>
@@ -241,32 +241,32 @@  discard block
 block discarded – undo
241 241
 
242 242
 			<tr>
243 243
 				<th>
244
-					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?>
244
+					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?>
245 245
 				</th>
246 246
 				<td>
247 247
 					<?php
248
-					$system_required = array( 'fname', 'email' );
249
-					$disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : '';
248
+					$system_required = array('fname', 'email');
249
+					$disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
250 250
 					$required_on = $question->get('QST_admin_only');
251 251
 					$show_required_msg = $required_on ? '' : ' display:none;';
252
-					$disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : '';
253
-					$id =  ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : '';
254
-					$requiredOptions=array(
255
-						array('text'=>'Optional','id'=>0),
256
-						array('text'=>'Required','id'=>1)
252
+					$disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : '';
253
+					$id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : '';
254
+					$requiredOptions = array(
255
+						array('text'=>'Optional', 'id'=>0),
256
+						array('text'=>'Required', 'id'=>1)
257 257
 					);
258
-					echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled );
258
+					echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled);
259 259
 					?>
260 260
 						<p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>">
261
-						<?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?>
261
+						<?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?>
262 262
 						</span></p>
263 263
 						<p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
264
-							<?php _e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?>
264
+							<?php _e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?>
265 265
 						</span></p>
266
-					<?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?>
266
+					<?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?>
267 267
 						<input type="hidden"  id="QST_required" name="QST_required" value="1"/>
268 268
 						<p><span class="description" style="color:#D54E21;">
269
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
269
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
270 270
 					</span></p>
271 271
 					<?php } ?>
272 272
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 			<tr>
277 277
 				<th>
278
-					<label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?>
278
+					<label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?>
279 279
 				</th>
280 280
 				<td>
281 281
 					<input type="text" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php  $question->f('QST_required_text')?>"/>
Please login to merge, or discard this patch.
core/db_models/EEM_Question.model.php 2 patches
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question.class.php');
26 26
 
27 27
 class EEM_Question extends EEM_Soft_Delete_Base {
28 28
 
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
 	// private instance of the Attendee object
70 70
 	protected static $_instance = NULL;
71 71
 
72
-	protected function __construct( $timezone = NULL ) {
73
-		$this->singular_item = __('Question','event_espresso');
74
-		$this->plural_item = __('Questions','event_espresso');
75
-		$this->_allowed_question_types=apply_filters(
72
+	protected function __construct($timezone = NULL) {
73
+		$this->singular_item = __('Question', 'event_espresso');
74
+		$this->plural_item = __('Questions', 'event_espresso');
75
+		$this->_allowed_question_types = apply_filters(
76 76
 			'FHEE__EEM_Question__construct__allowed_question_types',
77 77
 			array(
78
-				EEM_Question::QST_type_text =>__('Text','event_espresso'),
79
-				EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'),
80
-				EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'),
81
-				EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'),
82
-				EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'),
83
-				EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'),
84
-				EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'),
85
-				EEM_Question::QST_type_date =>__('Date Picker','event_espresso'),
86
-				EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ),
78
+				EEM_Question::QST_type_text =>__('Text', 'event_espresso'),
79
+				EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'),
80
+				EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'),
81
+				EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'),
82
+				EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'),
83
+				EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'),
84
+				EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'),
85
+				EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'),
86
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
87 87
 			)
88 88
 		);
89 89
 		$this->_question_type_categories = apply_filters(
@@ -102,22 +102,22 @@  discard block
 block discarded – undo
102 102
 		);
103 103
 
104 104
 		$this->_tables = array(
105
-			'Question'=>new EE_Primary_Table('esp_question','QST_ID')
105
+			'Question'=>new EE_Primary_Table('esp_question', 'QST_ID')
106 106
 		);
107 107
 		$this->_fields = array(
108 108
 			'Question'=>array(
109
-				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')),
110
-				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''),
111
-				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''),
112
-				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ),
113
-				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types),
114
-				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false),
115
-				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''),
116
-				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0),
117
-				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false),
118
-				'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso'	), false, EE_INF ),
119
-				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ),
120
-				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false)
109
+				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
110
+				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
111
+				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
112
+				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL),
113
+				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
114
+				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
115
+				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
116
+				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
117
+				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
118
+				'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
119
+				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
120
+				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
121 121
 			)
122 122
 		);
123 123
 		$this->_model_relations = array(
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 			'Question_Group_Question'=>new EE_Has_Many_Relation()
130 130
 		);
131 131
 		//this model is generally available for reading
132
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
133
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
134
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
135
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
136
-		parent::__construct( $timezone );
132
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
133
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
134
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
135
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
136
+		parent::__construct($timezone);
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * but they can be extended
142 142
 	 * @return string[]
143 143
 	 */
144
-	public function allowed_question_types(){
144
+	public function allowed_question_types() {
145 145
 		return $this->_allowed_question_types;
146 146
 	}
147 147
 	/**
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 	 * @param string $question_type one of EEM_Question::allowed_question_types(
150 150
 	 * @return string[] like EEM_Question::allowed_question_types()
151 151
 	 */
152
-	public function question_types_in_same_category( $question_type ) {
153
-		$question_types = array( $question_type );
154
-		foreach( $this->_question_type_categories as $category => $question_types_in_category ) {
155
-			if( in_array( $question_type, $question_types_in_category ) ) {
152
+	public function question_types_in_same_category($question_type) {
153
+		$question_types = array($question_type);
154
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
155
+			if (in_array($question_type, $question_types_in_category)) {
156 156
 				$question_types = $question_types_in_category;
157 157
 				break;
158 158
 			}
159 159
 		}
160 160
 
161
-		return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) );
161
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
162 162
 	}
163 163
 
164 164
 	/**
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 	 * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
168 168
 	 * @return boolean
169 169
 	 */
170
-	public function question_type_is_in_category( $question_type, $category ) {
171
-		if( ! isset( $this->_question_type_categories[ $category ] ) ) {
170
+	public function question_type_is_in_category($question_type, $category) {
171
+		if ( ! isset($this->_question_type_categories[$category])) {
172 172
 			return false;
173 173
 		}
174
-		return in_array( $question_type, $this->_question_type_categories[ $category ] );
174
+		return in_array($question_type, $this->_question_type_categories[$category]);
175 175
 	}
176 176
 
177 177
 	/**
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 	 * @param string $system_question_group_id QSG_system
189 189
 	 * @return array of system question names (QST_system)
190 190
 	 */
191
-	public function allowed_system_questions_in_system_question_group( $system_question_group_id ) {
191
+	public function allowed_system_questions_in_system_question_group($system_question_group_id) {
192 192
 		$question_system_ids = array();
193
-		switch( $system_question_group_id ) {
193
+		switch ($system_question_group_id) {
194 194
 			case EEM_Question_Group::system_personal:
195 195
 				$question_system_ids = array(
196 196
 					EEM_Attendee::system_question_fname,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 				);
212 212
 				break;
213 213
 		}
214
-		return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id );
214
+		return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
215 215
 	}
216 216
 
217 217
 	/**
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	 * @param string $system_question_group_id QSG_system
221 221
 	 * @return array of system question names (QST_system)
222 222
 	 */
223
-	public function required_system_questions_in_system_question_group( $system_question_group_id ) {
223
+	public function required_system_questions_in_system_question_group($system_question_group_id) {
224 224
 		$question_system_ids = null;
225
-		switch( $system_question_group_id ) {
225
+		switch ($system_question_group_id) {
226 226
 			case EEM_Question_Group::system_personal:
227
-				$question_system_ids =  array(
227
+				$question_system_ids = array(
228 228
 					EEM_Attendee::system_question_fname,
229 229
 					EEM_Attendee::system_question_email,
230 230
 				);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			default:
233 233
 				$question_system_ids = array();
234 234
 		}
235
-		return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id );
235
+		return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
236 236
 	}
237 237
 
238 238
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 	 * @param $QST_system
244 244
 	 * @return int of QST_ID for the question that corresponds to that QST_system
245 245
 	 */
246
-	public function get_Question_ID_from_system_string( $QST_system ){
247
-		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
246
+	public function get_Question_ID_from_system_string($QST_system) {
247
+		 return $this->get_var(array(array('QST_system' => $QST_system)));
248 248
 	}
249 249
 
250 250
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public function get_latest_question_order() {
258 258
 		$columns_to_select = array(
259
-			'max_order' => array("MAX(QST_order)","%d")
259
+			'max_order' => array("MAX(QST_order)", "%d")
260 260
 		);
261
-		$max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select );
261
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
262 262
 		return $max[0]['max_order'];
263 263
 	}
264 264
 
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 	 * @param string $system_question_value
289 289
 	 * @return int|float
290 290
 	 */
291
-	public function absolute_max_for_system_question( $system_question_value ) {
291
+	public function absolute_max_for_system_question($system_question_value) {
292 292
 		$maxes = $this->system_question_maxes();
293
-		if( isset( $maxes[ $system_question_value ] ) ) {
294
-			return $maxes[ $system_question_value ];
293
+		if (isset($maxes[$system_question_value])) {
294
+			return $maxes[$system_question_value];
295 295
 		} else {
296 296
 			return EE_INF;
297 297
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Base.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 	protected $_model_version_info;
27 27
 
28 28
 /**
29
-	 * Sets the version the user requested
30
-	 * @param string $version eg '4.8'
31
-	 */
29
+ * Sets the version the user requested
30
+ * @param string $version eg '4.8'
31
+ */
32 32
 	public function set_requested_version( $version ) {
33 33
 		parent::set_requested_version( $version );
34 34
 		$this->_model_version_info = new Model_Version_Info( $version );
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\core\libraries\rest_api\controllers\Base as Controller_Base;
4 4
 use EventEspresso\core\libraries\rest_api\Model_Version_Info;
5 5
 
6
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * Sets the version the user requested
30 30
 	 * @param string $version eg '4.8'
31 31
 	 */
32
-	public function set_requested_version( $version ) {
33
-		parent::set_requested_version( $version );
34
-		$this->_model_version_info = new Model_Version_Info( $version );
32
+	public function set_requested_version($version) {
33
+		parent::set_requested_version($version);
34
+		$this->_model_version_info = new Model_Version_Info($version);
35 35
 	}
36 36
 
37 37
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @return \EventEspresso\core\libraries\rest_api\Model_Version_Info
44 44
 	 * @throws \EE_Error
45 45
 	 */
46
-	public function get_model_version_info(){
47
-		if( ! $this->_model_version_info ) {
46
+	public function get_model_version_info() {
47
+		if ( ! $this->_model_version_info) {
48 48
 			throw new \EE_Error(
49 49
 				sprintf(
50 50
 					__(
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @param array $classnames
67 67
 	 * @return boolean
68 68
 	 */
69
-	public function is_subclass_of_one( $object, $classnames ) {
70
-		foreach( $classnames as $classname ) {
71
-			if( is_a( $object, $classname ) ) {
69
+	public function is_subclass_of_one($object, $classnames) {
70
+		foreach ($classnames as $classname) {
71
+			if (is_a($object, $classname)) {
72 72
 				return true;
73 73
 			}
74 74
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -443,7 +443,7 @@
 block discarded – undo
443 443
 	/**
444 444
 	 * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
445 445
 	 *
446
-	 * @param  array $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
446
+	 * @param  string[] $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
447 447
 	 *                               you want counts for as values in the array.  An empty array returns counts for all valid
448 448
 	 *                               stati.
449 449
 	 * @param  array  $query_params  If included can be used to refine the conditions for returning the count (i.e. only for
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
56 56
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
57
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
58
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
57
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
58
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
59 59
 			));
60 60
 		$this->_model_relations = array(
61 61
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 		$this->_model_chain_to_wp_user = 'Event';
66 66
 		//this model is generally available for reading
67
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
71
-		parent::__construct( $timezone );
67
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
71
+		parent::__construct($timezone);
72 72
 	}
73 73
 
74 74
 
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
86
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
87
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
86
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
88 88
 				'DTT_order' => 1,
89 89
 				'DTT_reg_limit' => EE_INF
90 90
 			),
91 91
 			$this->_timezone
92 92
 		);
93
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
94
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
95
-		return array( $blank_datetime );
93
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
94
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
95
+		return array($blank_datetime);
96 96
 	}
97 97
 
98 98
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	* 		@param		int 			$EVT_ID
107 107
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108 108
 	*/
109
-	public function get_all_event_dates( $EVT_ID = 0 ) {
110
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
109
+	public function get_all_event_dates($EVT_ID = 0) {
110
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
112 112
 		}
113
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
113
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114 114
 
115
-		if ( empty( $results ) ) {
115
+		if (empty($results)) {
116 116
 			return $this->create_new_blank_datetime();
117 117
 		}
118 118
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 	 *                        	the given number
134 134
 	 * @return EE_Datetime[]
135 135
 	 */
136
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
136
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
137 137
 
138 138
 		//sanitize EVT_ID
139
-		$EVT_ID = intval( $EVT_ID );
139
+		$EVT_ID = intval($EVT_ID);
140 140
 
141 141
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
142
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
143
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
142
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
143
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
144 144
 
145
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
145
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
146 146
 
147
-		if( ! $include_expired){
148
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
147
+		if ( ! $include_expired) {
148
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
149 149
 		}
150
-		if( $include_deleted){
151
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
150
+		if ($include_deleted) {
151
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
152 152
 		}
153 153
 
154
-		$result = $this->get_all( $query_params );
155
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
154
+		$result = $this->get_all($query_params);
155
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
156 156
 		return $result;
157 157
 	}
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param int $limit
168 168
 	 * @return EE_Datetime[]
169 169
 	 */
170
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
171
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
170
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
171
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
172 172
 			'limit'=>$limit,
173 173
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
174 174
 			'default_where_conditions' => 'none'));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param boolean $include_deleted
184 184
 	 * @return EE_Datetime
185 185
 	 */
186
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
187
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
-		if($results){
186
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
187
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
+		if ($results) {
189 189
 			return array_shift($results);
190
-		}else{
190
+		} else {
191 191
 			return NULL;
192 192
 		}
193 193
 	}
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 	 * @param bool $try_to_exclude_deleted
202 202
 	 * @return \EE_Datetime
203 203
 	 */
204
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
205
-		if($try_to_exclude_expired){
206
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
207
-			if($non_expired){
204
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
205
+		if ($try_to_exclude_expired) {
206
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
207
+			if ($non_expired) {
208 208
 				return $non_expired;
209 209
 			}
210 210
 		}
211
-		if($try_to_exclude_deleted){
211
+		if ($try_to_exclude_deleted) {
212 212
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
213
-			if($expired_even){
213
+			if ($expired_even) {
214 214
 				return $expired_even;
215 215
 			}
216 216
 		}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	 * @param int $limit
230 230
 	 * @return EE_Datetime[]
231 231
 	 */
232
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
232
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
233 233
 		//sanitize EVT_ID
234
-		$EVT_ID = intval( $EVT_ID );
234
+		$EVT_ID = intval($EVT_ID);
235 235
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
236
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
237
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
238
-		if( ! $include_expired){
239
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
236
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
237
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
238
+		if ( ! $include_expired) {
239
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
240 240
 		}
241
-		if( $include_deleted){
242
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
241
+		if ($include_deleted) {
242
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
243 243
 		}
244
-		if($limit){
244
+		if ($limit) {
245 245
 			$query_params['limit'] = $limit;
246 246
 		}
247
-		$result = $this->get_all( $query_params );
248
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
247
+		$result = $this->get_all($query_params);
248
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
249 249
 		return $result;
250 250
 	}
251 251
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
 	 * @param int $limit
259 259
 	 * @return EE_Datetime[]
260 260
 	 */
261
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
261
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
262 262
 		//sanitize TKT_ID
263
-		$TKT_ID =  intval( $TKT_ID );
263
+		$TKT_ID = intval($TKT_ID);
264 264
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
265
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
266
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
267
-		if( ! $include_expired){
268
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
265
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
266
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
267
+		if ( ! $include_expired) {
268
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
269 269
 		}
270
-		if( $include_deleted){
271
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
270
+		if ($include_deleted) {
271
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
272 272
 		}
273
-		if($limit){
273
+		if ($limit) {
274 274
 			$query_params['limit'] = $limit;
275 275
 		}
276
-		$result = $this->get_all( $query_params );
277
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
276
+		$result = $this->get_all($query_params);
277
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
278 278
 		return $result;
279 279
 	}
280 280
 
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *                                  that number
291 291
 	 * @return EE_Datetime[]
292 292
 	 */
293
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
293
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
294 294
 		//sanitize id.
295
-		$TKT_ID =  intval( $TKT_ID );
295
+		$TKT_ID = intval($TKT_ID);
296 296
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
297
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
298
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
299
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
300
-		if( ! $include_expired){
301
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
297
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
298
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
299
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
300
+		if ( ! $include_expired) {
301
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
302 302
 		}
303
-		if( $include_deleted){
304
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
303
+		if ($include_deleted) {
304
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
305 305
 		}
306
-		if($limit){
306
+		if ($limit) {
307 307
 			$query_params['limit'] = $limit;
308 308
 		}
309
-		$result = $this->get_all( $query_params );
310
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
309
+		$result = $this->get_all($query_params);
310
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
311 311
 		return $result;
312 312
 	}
313 313
 
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	 * @param int $EVT_ID
319 319
 	 * @return EE_Datetime
320 320
 	 */
321
-	public function get_most_important_datetime_for_event($EVT_ID){
321
+	public function get_most_important_datetime_for_event($EVT_ID) {
322 322
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323
-		if($results){
323
+		if ($results) {
324 324
 			return array_shift($results);
325
-		}else{
325
+		} else {
326 326
 			return null;
327 327
 		}
328 328
 	}
@@ -341,71 +341,71 @@  discard block
 block discarded – undo
341 341
 	 * 			- inactive = Events that are either not published.
342 342
 	 * @return wpdb results array
343 343
 	 */
344
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
344
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
345 345
 
346
-		switch ( $evt_active_status ) {
346
+		switch ($evt_active_status) {
347 347
 			case 'upcoming' :
348 348
 					$where_params['Event.status'] = 'publish';
349 349
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
350
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
350
+					if (isset($where_params['DTT_EVT_start'])) {
351 351
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
352 352
 					}
353
-					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query( 'DTT_EVT_start' ) );
353
+					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query('DTT_EVT_start'));
354 354
 					break;
355 355
 
356 356
 			case 'expired' :
357
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
357
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
358 358
 				//get events to exclude
359
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $this->current_time_for_query( 'DTT_EVT_end' ) ) ) );
359
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $this->current_time_for_query('DTT_EVT_end'))));
360 360
 				//first get all events that have datetimes where its not expired.
361
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
362
-				$event_ids = array_keys( $event_ids );
361
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
362
+				$event_ids = array_keys($event_ids);
363 363
 
364
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
364
+				if (isset($where_params['DTT_EVT_end'])) {
365 365
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
366 366
 				}
367
-				$where_params['DTT_EVT_end'] = array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
368
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
367
+				$where_params['DTT_EVT_end'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
368
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
369 369
 				break;
370 370
 
371 371
 			case 'active' :
372 372
 				$where_params['Event.status'] = 'publish';
373
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
373
+				if (isset($where_params['DTT_EVT_start'])) {
374 374
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
375 375
 				}
376
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
376
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
377 377
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
378 378
 				}
379
-				$where_params['DTT_EVT_start'] = array('<',  $this->current_time_for_query( 'DTT_EVT_start' ) );
380
-				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query( 'DTT_EVT_end' ) );
379
+				$where_params['DTT_EVT_start'] = array('<', $this->current_time_for_query('DTT_EVT_start'));
380
+				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query('DTT_EVT_end'));
381 381
 				break;
382 382
 
383 383
 			case 'inactive' :
384
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
385
-				if ( isset( $where_params['OR'] ) ) {
384
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
385
+				if (isset($where_params['OR'])) {
386 386
 					$where_params['AND']['OR'] = $where_params['OR'];
387 387
 				}
388
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
388
+				if (isset($where_params['DTT_EVT_end'])) {
389 389
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
390
-					unset( $where_params['DTT_EVT_end'] );
390
+					unset($where_params['DTT_EVT_end']);
391 391
 				}
392 392
 
393
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
393
+				if (isset($where_params['DTT_EVT_start'])) {
394 394
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
395
-					unset( $where_params['DTT_EVT_start'] );
395
+					unset($where_params['DTT_EVT_start']);
396 396
 				}
397
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
397
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
398 398
 				break;
399 399
 		}
400 400
 
401 401
 		$query_params[0] = $where_params;
402 402
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
403
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
403
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
404 404
 		$columns_to_select = array(
405 405
 			'dtt_year' => array('YEAR(DTT_EVT_start)', '%s'),
406 406
 			'dtt_month' => array('MONTHNAME(DTT_EVT_start)', '%s')
407 407
 			);
408
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
408
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
409 409
 	}
410 410
 
411 411
 	/**
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 	 * for the tickets for each datetime)
414 414
 	 * @param EE_Datetime[] $datetimes
415 415
 	 */
416
-	public function update_sold($datetimes){
417
-		foreach($datetimes as $datetime){
416
+	public function update_sold($datetimes) {
417
+		foreach ($datetimes as $datetime) {
418 418
 			$datetime->update_sold();
419 419
 		}
420 420
 	}
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 	 * @param array $query_params
430 430
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
431 431
 	 */
432
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
433
-		$datetime = $this->get_one_by_ID( $DTT_ID );
434
-		if ( $datetime instanceof EE_Datetime ) {
435
-			return $datetime->tickets_remaining( $query_params );
432
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
433
+		$datetime = $this->get_one_by_ID($DTT_ID);
434
+		if ($datetime instanceof EE_Datetime) {
435
+			return $datetime->tickets_remaining($query_params);
436 436
 		}
437 437
 		return 0;
438 438
 	}
@@ -454,36 +454,36 @@  discard block
 block discarded – undo
454 454
 	 *                EE_Datetime::upcoming
455 455
 	 *                EE_Datetime::expired
456 456
 	 */
457
-	public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) {
457
+	public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) {
458 458
 		//only accept where conditions for this query.
459
-		$_where = isset( $query_params[0] ) ? $query_params[0] : array();
459
+		$_where = isset($query_params[0]) ? $query_params[0] : array();
460 460
 		$status_query_args = array(
461 461
 				EE_Datetime::active => array_merge(
462 462
 						$_where,
463
-						array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) )
463
+						array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
464 464
 				),
465 465
 				EE_Datetime::upcoming => array_merge(
466 466
 						$_where,
467
-						array( 'DTT_EVT_start' => array( '>', time() ) )
467
+						array('DTT_EVT_start' => array('>', time()))
468 468
 				),
469 469
 				EE_Datetime::expired => array_merge(
470 470
 						$_where,
471
-						array( 'DTT_EVT_end' => array('<', time() ) )
471
+						array('DTT_EVT_end' => array('<', time()))
472 472
 				)
473 473
 		);
474 474
 
475
-		if ( ! empty( $stati_to_include ) ) {
476
-			foreach( array_keys( $status_query_args ) as $status ) {
477
-				if ( ! in_array( $status, $stati_to_include ) ) {
478
-					unset( $status_query_args[$status] );
475
+		if ( ! empty($stati_to_include)) {
476
+			foreach (array_keys($status_query_args) as $status) {
477
+				if ( ! in_array($status, $stati_to_include)) {
478
+					unset($status_query_args[$status]);
479 479
 				}
480 480
 			}
481 481
 		}
482 482
 
483 483
 		//loop through and query counts for each stati.
484 484
 		$status_query_results = array();
485
-		foreach( $status_query_args as $status => $status_where_conditions ) {
486
-			$status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true );
485
+		foreach ($status_query_args as $status => $status_where_conditions) {
486
+			$status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true);
487 487
 		}
488 488
 
489 489
 		return $status_query_results;
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
 	 * @param array $query_params
498 498
 	 * @return int
499 499
 	 */
500
-	public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) {
501
-		$count = $this->get_datetime_counts_by_status( array( $status ), $query_params );
502
-		return ! empty( $count[$status] ) ? $count[$status] : 0;
500
+	public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) {
501
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
502
+		return ! empty($count[$status]) ? $count[$status] : 0;
503 503
 	}
504 504
 
505 505
 
Please login to merge, or discard this patch.