Completed
Branch BUG-7537 (60d82a)
by
unknown
82:58 queued 65:49
created
admin_pages/support/Support_Admin_Page.core.php 1 patch
Spacing   +19 added lines, -19 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
 /**
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 class Support_Admin_Page extends EE_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35 35
 	}
36 36
 
37 37
 
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 				'nav' => array(
86 86
 					'label' => __('Shortcodes', 'event_espresso'),
87 87
 					'order' => 30),
88
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ),
88
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')),
89 89
 				'require_nonce' => FALSE
90 90
 				),
91 91
 			'contact_support' => array(
92 92
 				'nav' => array(
93 93
 					'label' => __('Support', 'event_espresso'),
94 94
 					'order' => 40),
95
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ),
95
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')),
96 96
 				'require_nonce' => FALSE
97 97
 				),
98 98
 			'developers' => array(
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 	protected function _installation() {
123
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php';
124
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE);
123
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php';
124
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE);
125 125
 		$this->display_admin_page_with_sidebar();
126 126
 	}
127 127
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 			'other_resources' => __('Other Resources', 'event_espresso')
147 147
 			);
148 148
 
149
-		foreach ( $boxes as $box => $label ) {
150
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
149
+		foreach ($boxes as $box => $label) {
150
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
151 151
 			$callback_args = array('template_path' => $template_path);
152
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
152
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
153 153
 		}
154 154
 	}
155 155
 
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
 			'shortcodes_event_listings' => __('Event Listings', 'event_espresso'),
171 171
 			'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'),
172 172
 			'shortcodes_category' => __('Event Categories', 'event_espresso'),
173
-			'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' )
173
+			'shortcodes_attendee' => __('Event Attendees', 'event_espresso')
174 174
 			/*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/
175 175
 			/*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/
176 176
 			);
177 177
 
178
-		foreach ( $boxes as $box => $label ) {
179
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
178
+		foreach ($boxes as $box => $label) {
179
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
180 180
 			$callback_args = array('template_path' => $template_path);
181
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
181
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
182 182
 		}
183 183
 	}
184 184
 
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
 			'important_information' => __('Important Information', 'event_espresso')
198 198
 			);
199 199
 
200
-		foreach ( $boxes as $box => $label ) {
201
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
200
+		foreach ($boxes as $box => $label) {
201
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
202 202
 			$callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args);
203
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
203
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
204 204
 		}
205 205
 	}
206 206
 
207 207
 
208 208
 	protected function _developers() {
209
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php';
210
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true );
209
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php';
210
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true);
211 211
 		$this->display_admin_page_with_sidebar();
212 212
 	}
213 213
 
Please login to merge, or discard this patch.
core/db_models/EEM_CPT_Base.model.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 define('EE_Event_Category_Taxonomy','espresso_event_category');
3 3
 /**
4
- *
5
- * EEM_CPT_Base
6
- *
7
- * For shared functionality between models internally implemented
8
- * as Custom Post Types. Subclass of EEM_Soft_Delete_Base, meaning that when you 'delete' one of these model objects
9
- * we actually default ot just trashing it. (It works differently than EEM_Soft_Delete under the hood,because there's a post status field
10
- * instead of a soft-delete flag, but the functionality is the same)
11
- * Note: if you add a new subclass of EEM_CPT_Base, you should add it as a relation
12
- * on EEM_Term_Taxonomy and EEM_Term_Relationship
13
- *
14
- * @package 			Event Espresso
15
- * @subpackage 	core
16
- * @author 				Mike Nelson
17
- *
18
- */
4
+	 *
5
+	 * EEM_CPT_Base
6
+	 *
7
+	 * For shared functionality between models internally implemented
8
+	 * as Custom Post Types. Subclass of EEM_Soft_Delete_Base, meaning that when you 'delete' one of these model objects
9
+	 * we actually default ot just trashing it. (It works differently than EEM_Soft_Delete under the hood,because there's a post status field
10
+	 * instead of a soft-delete flag, but the functionality is the same)
11
+	 * Note: if you add a new subclass of EEM_CPT_Base, you should add it as a relation
12
+	 * on EEM_Term_Taxonomy and EEM_Term_Relationship
13
+	 *
14
+	 * @package 			Event Espresso
15
+	 * @subpackage 	core
16
+	 * @author 				Mike Nelson
17
+	 *
18
+	 */
19 19
 abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base{
20 20
 
21 21
 	/**
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-define('EE_Event_Category_Taxonomy','espresso_event_category');
2
+define('EE_Event_Category_Taxonomy', 'espresso_event_category');
3 3
 /**
4 4
  *
5 5
  * EEM_CPT_Base
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @author 				Mike Nelson
17 17
  *
18 18
  */
19
-abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base{
19
+abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base {
20 20
 
21 21
 	/**
22 22
 	 * @var string post_status_publish - the wp post status for published cpts
@@ -69,56 +69,56 @@  discard block
 block discarded – undo
69 69
 	 * @param string $timezone
70 70
 	 * @throws \EE_Error
71 71
 	 */
72
-	protected function __construct( $timezone = NULL ){
72
+	protected function __construct($timezone = NULL) {
73 73
 
74 74
 		//adds a relationship to Term_Taxonomy for all these models. For this to work
75 75
 		//Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly
76 76
 		//eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry
77 77
 		//with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value
78 78
 		//must also be new EE_HABTM_Relation('Term_Relationship');
79
-		$this->_model_relations['Term_Taxonomy'] =new EE_HABTM_Relation('Term_Relationship');
80
-		$this->_model_relations[ 'Post_Meta' ] = new EE_Has_Many_Relation( false );
79
+		$this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship');
80
+		$this->_model_relations['Post_Meta'] = new EE_Has_Many_Relation(false);
81 81
 		$primary_table_name = NULL;
82 82
 		//add  the common _status field to all CPT primary tables.
83
-		foreach ( $this->_tables as $alias => $table_obj ) {
84
-			if ( $table_obj instanceof EE_Primary_Table ) {
83
+		foreach ($this->_tables as $alias => $table_obj) {
84
+			if ($table_obj instanceof EE_Primary_Table) {
85 85
 				$primary_table_name = $alias;
86 86
 			}
87 87
 		}
88 88
 		//set default wp post statuses if child has not already set.
89
-		if ( ! isset( $this->_fields[$primary_table_name]['status'] )) {
89
+		if ( ! isset($this->_fields[$primary_table_name]['status'])) {
90 90
 			$this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft');
91 91
 		}
92
-		if( ! isset( $this->_fields[$primary_table_name]['to_ping'])){
93
-			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __( 'To Ping', 'event_espresso' ), FALSE, '');
92
+		if ( ! isset($this->_fields[$primary_table_name]['to_ping'])) {
93
+			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __('To Ping', 'event_espresso'), FALSE, '');
94 94
 		}
95
-		if( ! isset( $this->_fields[$primary_table_name]['pinged'])){
96
-			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __( 'Pinged', 'event_espresso' ), FALSE, '');
95
+		if ( ! isset($this->_fields[$primary_table_name]['pinged'])) {
96
+			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __('Pinged', 'event_espresso'), FALSE, '');
97 97
 		}
98 98
 
99
-		if( ! isset( $this->_fields[$primary_table_name]['comment_status'])){
100
-			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso' ), FALSE, 'open');
99
+		if ( ! isset($this->_fields[$primary_table_name]['comment_status'])) {
100
+			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso'), FALSE, 'open');
101 101
 		}
102 102
 
103
-		if( ! isset( $this->_fields[$primary_table_name]['ping_status'])){
103
+		if ( ! isset($this->_fields[$primary_table_name]['ping_status'])) {
104 104
 			$this->_fields[$primary_table_name]['ping_status'] = new EE_Plain_Text_Field('ping_status', __('Ping Status', 'event_espresso'), FALSE, 'open');
105 105
 		}
106 106
 
107
-		if( ! isset( $this->_fields[$primary_table_name]['post_content_filtered'])){
108
-			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __( 'Post Content Filtered', 'event_espresso' ), FALSE, '');
107
+		if ( ! isset($this->_fields[$primary_table_name]['post_content_filtered'])) {
108
+			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __('Post Content Filtered', 'event_espresso'), FALSE, '');
109 109
 		}
110
-		if( ! isset( $this->_model_relations[ 'Post_Meta' ] ) ) {
110
+		if ( ! isset($this->_model_relations['Post_Meta'])) {
111 111
 			//don't block deletes though because we want to maintain the current behaviour
112
-			$this->_model_relations[ 'Post_Meta' ] = new EE_Has_Many_Relation( false );
112
+			$this->_model_relations['Post_Meta'] = new EE_Has_Many_Relation(false);
113 113
 		}
114
-		if( ! $this->_minimum_where_conditions_strategy instanceof EE_Default_Where_Conditions ){
114
+		if ( ! $this->_minimum_where_conditions_strategy instanceof EE_Default_Where_Conditions) {
115 115
 			//nothing was set during child constructor, so set default
116
-			$this->_minimum_where_conditions_strategy = new EE_CPT_Minimum_Where_Conditions( $this->post_type() );
116
+			$this->_minimum_where_conditions_strategy = new EE_CPT_Minimum_Where_Conditions($this->post_type());
117 117
 		}
118
-		if( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions ) {
118
+		if ( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions) {
119 119
 			//nothing was set during child constructor, so set default
120 120
 			//it's ok for child classes to specify this, but generally this is more DRY
121
-			$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions( $this->post_type() );
121
+			$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions($this->post_type());
122 122
 		}
123 123
 		parent::__construct($timezone);
124 124
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function public_event_stati() {
133 133
 		// @see wp-includes/post.php
134
-		return get_post_stati( array( 'public' => TRUE ));
134
+		return get_post_stati(array('public' => TRUE));
135 135
 	}
136 136
 
137 137
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return string
143 143
 	 * @throws EE_Error
144 144
 	 */
145
-	public function deleted_field_name(){
145
+	public function deleted_field_name() {
146 146
 		throw new EE_Error(sprintf(__("EEM_CPT_Base should nto call deleted_field_name! It should instead use post_status_field_name", "event_espresso")));
147 147
 	}
148 148
 
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 	 * @return string
154 154
 	 * @throws EE_Error
155 155
 	 */
156
-	public function post_status_field_name(){
156
+	public function post_status_field_name() {
157 157
 		$field = $this->get_a_field_of_type('EE_WP_Post_Status_Field');
158
-		if($field){
158
+		if ($field) {
159 159
 			return $field->get_name();
160
-		}else{
161
-			throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
160
+		} else {
161
+			throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
162 162
 		}
163 163
 	}
164 164
 
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 	 * @param array $query_params like EEM_Base::get_all's $query_params
170 170
 	 * @return array like EEM_Base::get_all's $query_params
171 171
 	 */
172
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
173
-		$post_status_field_name=$this->post_status_field_name();
174
-		$query_params[0][$post_status_field_name]=self::post_status_trashed;
172
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
173
+		$post_status_field_name = $this->post_status_field_name();
174
+		$query_params[0][$post_status_field_name] = self::post_status_trashed;
175 175
 		return $query_params;
176 176
 	}
177 177
 
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	 * @param array $query_params
183 183
 	 * @return array
184 184
 	 */
185
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
186
-		$query_params[ 'default_where_conditions' ] = 'minimum';
185
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
186
+		$query_params['default_where_conditions'] = 'minimum';
187 187
 		return $query_params;
188 188
 	}
189 189
 
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 	 * @param array $query_params like EEM_Base::get_all
196 196
 	 * @return boolean success
197 197
 	 */
198
-	function delete_or_restore($delete=true,$query_params = array()){
199
-		$post_status_field_name=$this->post_status_field_name();
198
+	function delete_or_restore($delete = true, $query_params = array()) {
199
+		$post_status_field_name = $this->post_status_field_name();
200 200
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
201 201
 		$new_status = $delete ? self::post_status_trashed : 'draft';
202
-		if ( $this->update (array($post_status_field_name=>$new_status), $query_params )) {
202
+		if ($this->update(array($post_status_field_name=>$new_status), $query_params)) {
203 203
 			return TRUE;
204 204
 		} else {
205 205
 			return FALSE;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function meta_table() {
218 218
 		$meta_table = $this->_get_other_tables();
219
-		$meta_table = reset( $meta_table );
219
+		$meta_table = reset($meta_table);
220 220
 		return $meta_table instanceof EE_Secondary_Table ? $meta_table->get_table_name() : NULL;
221 221
 	}
222 222
 
@@ -228,16 +228,16 @@  discard block
 block discarded – undo
228 228
 	 * @param  bool $all triggers whether we include DB_Only fields or JUST non DB_Only fields.  Defaults to false (no db only fields)
229 229
 	 * @return array
230 230
 	 */
231
-	public function get_meta_table_fields( $all = FALSE ) {
231
+	public function get_meta_table_fields($all = FALSE) {
232 232
 		$all_fields = $fields_to_return = array();
233
-		foreach ( $this->_tables as $alias => $table_obj ) {
234
-			if ( $table_obj instanceof EE_Secondary_Table )
235
-				$all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields );
233
+		foreach ($this->_tables as $alias => $table_obj) {
234
+			if ($table_obj instanceof EE_Secondary_Table)
235
+				$all_fields = array_merge($this->_get_fields_for_table($alias), $all_fields);
236 236
 		}
237 237
 
238
-		if ( !$all ) {
239
-			foreach ( $all_fields as $name => $obj ) {
240
-				if ( $obj instanceof EE_DB_Only_Field_Base )
238
+		if ( ! $all) {
239
+			foreach ($all_fields as $name => $obj) {
240
+				if ($obj instanceof EE_DB_Only_Field_Base)
241 241
 					continue;
242 242
 				$fields_to_return[] = $name;
243 243
 			}
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 	 * @param int $parent_term_taxonomy_id
261 261
 	 * @return EE_Term_Taxonomy
262 262
 	 */
263
-	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description ='',$parent_term_taxonomy_id = null){
263
+	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description = '', $parent_term_taxonomy_id = null) {
264 264
 		//create term
265
-		require_once( EE_MODELS . 'EEM_Term.model.php');
265
+		require_once(EE_MODELS.'EEM_Term.model.php');
266 266
 		//first, check for a term by the same name or slug
267 267
 		$category_slug = sanitize_title($category_name);
268
-		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name,'slug'=>$category_slug))));
269
-		if( ! $term ){
268
+		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name, 'slug'=>$category_slug))));
269
+		if ( ! $term) {
270 270
 			$term = EE_Term::new_instance(array(
271 271
 				'name'=>$category_name,
272 272
 				'slug'=>$category_slug
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 			$term->save();
275 275
 		}
276 276
 		//make sure there's a term-taxonomy entry too
277
-		require_once( EE_MODELS . 'EEM_Term_Taxonomy.model.php');
278
-		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(),'taxonomy'=>EE_Event_Category_Taxonomy)));
277
+		require_once(EE_MODELS.'EEM_Term_Taxonomy.model.php');
278
+		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(), 'taxonomy'=>EE_Event_Category_Taxonomy)));
279 279
 		/** @var $term_taxonomy EE_Term_Taxonomy */
280
-		if( ! $term_taxonomy ){
280
+		if ( ! $term_taxonomy) {
281 281
 			$term_taxonomy = EE_Term_Taxonomy::new_instance(array(
282 282
 				'term_id'=>$term->ID(),
283 283
 				'taxonomy'=>EE_Event_Category_Taxonomy,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 				'parent'=>$parent_term_taxonomy_id
287 287
 			));
288 288
 			$term_taxonomy->save();
289
-		}else{
289
+		} else {
290 290
 			$term_taxonomy->set_count($term_taxonomy->count() + 1);
291 291
 			$term_taxonomy->save();
292 292
 		}
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	 * @param string $category_name name of the event category (term)
302 302
 	 * @return bool
303 303
 	 */
304
-	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name){
304
+	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name) {
305 305
 		//find the term_taxonomy by that name
306
-		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name,'taxonomy'=>EE_Event_Category_Taxonomy)));
306
+		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name, 'taxonomy'=>EE_Event_Category_Taxonomy)));
307 307
 		/** @var $term_taxonomy EE_Term_Taxonomy */
308
-		if( $term_taxonomy ){
308
+		if ($term_taxonomy) {
309 309
 			$term_taxonomy->set_count($term_taxonomy->count() - 1);
310 310
 			$term_taxonomy->save();
311 311
 		}
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 	 * @param string|array $attr Optional. Query string or array of attributes.
326 326
 	 * @return string HTML image element
327 327
 	 */
328
-	public function get_feature_image( $id, $size = 'thumbnail', $attr = '' ) {
329
-		return get_the_post_thumbnail( $id, $size, $attr );
328
+	public function get_feature_image($id, $size = 'thumbnail', $attr = '') {
329
+		return get_the_post_thumbnail($id, $size, $attr);
330 330
 	}
331 331
 
332 332
 
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 	 * @global array $wp_post_statuses set in wp core for storing all the post stati
340 340
 	 * @return array
341 341
 	 */
342
-	public function get_post_statuses(){
342
+	public function get_post_statuses() {
343 343
 		global $wp_post_statuses;
344 344
 		$statuses = array();
345
-		foreach($wp_post_statuses as $post_status => $args_object){
345
+		foreach ($wp_post_statuses as $post_status => $args_object) {
346 346
 			$statuses[$post_status] = $args_object->label;
347 347
 		}
348 348
 		return $statuses;
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 	public function get_status_array() {
358 358
 		$statuses = $this->get_post_statuses();
359 359
 		//first the global filter
360
-		$statuses = apply_filters( 'FHEE_EEM_CPT_Base__get_status_array', $statuses );
360
+		$statuses = apply_filters('FHEE_EEM_CPT_Base__get_status_array', $statuses);
361 361
 		//now the class specific filter
362
-		$statuses = apply_filters( 'FHEE_EEM_' . get_class($this) . '__get_status_array', $statuses );
362
+		$statuses = apply_filters('FHEE_EEM_'.get_class($this).'__get_status_array', $statuses);
363 363
 		return $statuses;
364 364
 	}
365 365
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	public function get_custom_post_statuses() {
373 373
 		$new_stati = array();
374
-		foreach ( $this->_custom_stati as $status => $props ) {
374
+		foreach ($this->_custom_stati as $status => $props) {
375 375
 			$new_stati[$status] = $props['label'];
376 376
 		}
377 377
 		return $new_stati;
@@ -387,24 +387,24 @@  discard block
 block discarded – undo
387 387
 	 * @param WP_Post|array $post
388 388
 	 * @return EE_CPT_Base
389 389
 	 */
390
-	public function instantiate_class_from_post_object_orig($post){
391
-		$post = (array)$post;
390
+	public function instantiate_class_from_post_object_orig($post) {
391
+		$post = (array) $post;
392 392
 		$has_all_necessary_fields_for_table = true;
393 393
 		//check if the post has fields on the meta table already
394
-		foreach($this->_get_other_tables() as $table_obj){
394
+		foreach ($this->_get_other_tables() as $table_obj) {
395 395
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
396
-			foreach($fields_for_that_table as $field_obj){
397
-				if( ! isset($post[$field_obj->get_table_column()])
398
-					&& ! isset($post[$field_obj->get_qualified_column()])){
396
+			foreach ($fields_for_that_table as $field_obj) {
397
+				if ( ! isset($post[$field_obj->get_table_column()])
398
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
399 399
 					$has_all_necessary_fields_for_table = false;
400 400
 				}
401 401
 			}
402 402
 		}
403 403
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
404
-		if( ! $has_all_necessary_fields_for_table){
404
+		if ( ! $has_all_necessary_fields_for_table) {
405 405
 
406 406
 			return $this->get_one_by_ID($post['ID']);
407
-		}else{
407
+		} else {
408 408
 			return $this->instantiate_class_from_array_or_object($post);
409 409
 		}
410 410
 	}
@@ -415,30 +415,30 @@  discard block
 block discarded – undo
415 415
 	 * @param null $post
416 416
 	 * @return EE_Base_Class|EE_Soft_Delete_Base_Class
417 417
 	 */
418
-	public function instantiate_class_from_post_object( $post = NULL ){
419
-		if ( empty( $post )) {
418
+	public function instantiate_class_from_post_object($post = NULL) {
419
+		if (empty($post)) {
420 420
 			global $post;
421 421
 		}
422
-		$post = (array)$post;
422
+		$post = (array) $post;
423 423
 		$tables_needing_to_be_queried = array();
424 424
 		//check if the post has fields on the meta table already
425
-		foreach($this->get_tables() as $table_obj){
425
+		foreach ($this->get_tables() as $table_obj) {
426 426
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
427
-			foreach($fields_for_that_table as $field_obj){
428
-				if( ! isset($post[$field_obj->get_table_column()])
429
-					&& ! isset($post[$field_obj->get_qualified_column()])){
427
+			foreach ($fields_for_that_table as $field_obj) {
428
+				if ( ! isset($post[$field_obj->get_table_column()])
429
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
430 430
 					$tables_needing_to_be_queried[$table_obj->get_table_alias()] = $table_obj;
431 431
 				}
432 432
 			}
433 433
 		}
434 434
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
435
-		if( $tables_needing_to_be_queried){
436
-			if(count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table){
435
+		if ($tables_needing_to_be_queried) {
436
+			if (count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table) {
437 437
 				//so we're only missing data from a secondary table. Well that's not too hard to query for
438 438
 				$table_to_query = reset($tables_needing_to_be_queried);
439
-				$missing_data = $this->_do_wpdb_query( 'get_row', array( 'SELECT * FROM ' . $table_to_query->get_table_name() . ' WHERE ' . $table_to_query->get_fk_on_table() . ' = ' . $post['ID'], ARRAY_A ));
440
-				if ( ! empty( $missing_data )) {
441
-					$post = array_merge( $post, $missing_data );
439
+				$missing_data = $this->_do_wpdb_query('get_row', array('SELECT * FROM '.$table_to_query->get_table_name().' WHERE '.$table_to_query->get_fk_on_table().' = '.$post['ID'], ARRAY_A));
440
+				if ( ! empty($missing_data)) {
441
+					$post = array_merge($post, $missing_data);
442 442
 				}
443 443
 			} else {
444 444
 				return $this->get_one_by_ID($post['ID']);
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 	 * @throws EE_Error
456 456
 	 * @return string
457 457
 	 */
458
-	public function post_type(){
458
+	public function post_type() {
459 459
 		$post_type_field = NULL;
460
-		foreach($this->field_settings(true) as $field_obj){
461
-			if($field_obj instanceof EE_WP_Post_Type_Field){
462
-				$post_type_field = $field_obj;break;
460
+		foreach ($this->field_settings(true) as $field_obj) {
461
+			if ($field_obj instanceof EE_WP_Post_Type_Field) {
462
+				$post_type_field = $field_obj; break;
463 463
 			}
464 464
 		}
465
-		if($post_type_field == NULL){
466
-			throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"),get_class($this)));
465
+		if ($post_type_field == NULL) {
466
+			throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"), get_class($this)));
467 467
 		}
468 468
 		return $post_type_field->get_default_value();
469 469
 	}
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -808,7 +808,7 @@
 block discarded – undo
808 808
 
809 809
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
810 810
 
811
-			}  else {
811
+			} else {
812 812
 				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
813 813
 				// remove malformed data
814 814
 				unset( $valid_data[ $reg_url_link ] );
Please login to merge, or discard this patch.
Spacing   +249 added lines, -250 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	 * @param    EE_Checkout $checkout
38 38
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
39 39
 	 */
40
-	public function __construct( EE_Checkout $checkout ) {
40
+	public function __construct(EE_Checkout $checkout) {
41 41
 		$this->_slug = 'attendee_information';
42 42
 		$this->_name = __('Attendee Information', 'event_espresso');
43
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
43
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
44 44
 		$this->checkout = $checkout;
45 45
 		$this->_reset_success_message();
46
-		$this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso'));
46
+		$this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso'));
47 47
 	}
48 48
 
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
53 53
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso');
54 54
 		EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso');
55
-		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' );
55
+		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>');
56 56
 		EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso');
57 57
 		EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso');
58 58
 		EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		EEH_Autoloader::register_line_item_display_autoloaders();
86 86
 		$Line_Item_Display = new EE_Line_Item_Display();
87 87
 		// calculate taxes
88
-		$Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) );
88
+		$Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true));
89 89
 		EE_Registry::instance()->load_helper('Line_Item');
90 90
 		/** @var $subsections EE_Form_Section_Proper[] */
91 91
 		$subsections = array(
@@ -97,33 +97,33 @@  discard block
 block discarded – undo
97 97
 			'ticket_count' 	=> array()
98 98
 		);
99 99
 		// grab the saved registrations from the transaction
100
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
101
-		if ( $registrations ) {
102
-			foreach ( $registrations as $registration ) {
103
-				if ( $registration instanceof EE_Registration ) {
100
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
101
+		if ($registrations) {
102
+			foreach ($registrations as $registration) {
103
+				if ($registration instanceof EE_Registration) {
104 104
 					// can this registration be processed during this visit ?
105
-					if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
106
-						$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
107
-						if ( ! $this->checkout->admin_request ) {
108
-							$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
109
-							$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1;
110
-							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) );
111
-							$ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item;
112
-							$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item );
105
+					if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
106
+						$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
107
+						if ( ! $this->checkout->admin_request) {
108
+							$template_args['registrations'][$registration->reg_url_link()] = $registration;
109
+							$template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1;
110
+							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID()));
111
+							$ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item;
112
+							$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item);
113 113
 						}
114
-						if ( $registration->is_primary_registrant() ) {
114
+						if ($registration->is_primary_registrant()) {
115 115
 							$primary_registrant = $registration->reg_url_link();
116 116
 						}
117 117
 					}
118 118
 				}
119 119
 			}
120 120
 			// print_copy_info ?
121
-			if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) {
121
+			if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) {
122 122
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
123 123
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info();
124 124
 				// generate hidden input
125
-				if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) {
126
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
125
+				if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) {
126
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
127 127
 				}
128 128
 			}
129 129
 
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
 				'html_id' 					=> $this->reg_form_name(),
136 136
 				'subsections' 			=> $subsections,
137 137
 				'layout_strategy'		=> $this->checkout->admin_request ?
138
-					new EE_Div_Per_Section_Layout() :
139
-					new EE_Template_Layout(
138
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
140 139
 						array(
141 140
 							'layout_template_file' 	=> $this->_template, // layout_template
142 141
 							'template_args' 				=> $template_args
@@ -153,61 +152,61 @@  discard block
 block discarded – undo
153 152
 	 * @param EE_Registration $registration
154 153
 	 * @return EE_Form_Section_Proper
155 154
 	 */
156
-	private function _registrations_reg_form( EE_Registration $registration ) {
157
-		EE_Registry::instance()->load_helper( 'Template' );
155
+	private function _registrations_reg_form(EE_Registration $registration) {
156
+		EE_Registry::instance()->load_helper('Template');
158 157
 		static $attendee_nmbr = 1;
159 158
 		// array of params to pass to parent constructor
160 159
 		$form_args = array(
161
-			'html_id' 				=> 'ee-registration-' . $registration->reg_url_link(),
160
+			'html_id' 				=> 'ee-registration-'.$registration->reg_url_link(),
162 161
 			'html_class' 		=> 'ee-reg-form-attendee-dv',
163 162
 			'html_style' 		=> $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '',
164 163
 			'subsections' 		=> array(),
165 164
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
166 165
 				array(
167 166
 					'legend_class' 	=> 'spco-attendee-lgnd smaller-text lt-grey-text',
168
-					'legend_text' 	=> sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
167
+					'legend_text' 	=> sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
169 168
 				)
170 169
 			)
171 170
 		);
172 171
 		// verify that registration has valid event
173
-		if ( $registration->event() instanceof EE_Event ) {
172
+		if ($registration->event() instanceof EE_Event) {
174 173
 			$query_params = array(
175 174
 				array(
176 175
 					'Event.EVT_ID' => $registration->event()->ID(),
177 176
 					'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE
178 177
 				),
179
-				'order_by'=>array( 'QSG_order'=>'ASC' )
178
+				'order_by'=>array('QSG_order'=>'ASC')
180 179
 			);
181
-			$question_groups = $registration->event()->question_groups( $query_params );
182
-			if ( $question_groups ) {
183
-				foreach ( $question_groups as $question_group ) {
184
-					if ( $question_group instanceof EE_Question_Group ) {
185
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group );
180
+			$question_groups = $registration->event()->question_groups($query_params);
181
+			if ($question_groups) {
182
+				foreach ($question_groups as $question_group) {
183
+					if ($question_group instanceof EE_Question_Group) {
184
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group);
186 185
 						// add hidden input
187
-						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration );
186
+						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration);
188 187
 					}
189 188
 				}
190 189
 				// if we have question groups for additional attendees, then display the copy options
191 190
 				$this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info;
192 191
 			} else {
193
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML(
192
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML(
194 193
 					EEH_Template::locate_template(
195
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
196
-						apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
194
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
195
+						apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
197 196
 						TRUE,
198 197
 						TRUE
199 198
 					)
200 199
 				);
201 200
 				// add hidden input
202
-				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE );
201
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE);
203 202
 			}
204 203
 		}
205
-		if ( $registration->is_primary_registrant() ) {
204
+		if ($registration->is_primary_registrant()) {
206 205
 			// generate hidden input
207
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
206
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
208 207
 		}
209 208
 		$attendee_nmbr++;
210
-		return new EE_Form_Section_Proper( $form_args );
209
+		return new EE_Form_Section_Proper($form_args);
211 210
 	}
212 211
 
213 212
 
@@ -220,11 +219,11 @@  discard block
 block discarded – undo
220 219
 	 * @param bool  $additional_attendee_reg_info
221 220
 	 * @return    EE_Form_Input_Base
222 221
 	 */
223
-	private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){
222
+	private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) {
224 223
 		// generate hidden input
225 224
 		return new EE_Hidden_Input(
226 225
 			array(
227
-				'html_id' 				=> 'additional-attendee-reg-info-' . $registration->reg_url_link(),
226
+				'html_id' 				=> 'additional-attendee-reg-info-'.$registration->reg_url_link(),
228 227
 				'default'				=> $additional_attendee_reg_info
229 228
 			)
230 229
 		);
@@ -237,22 +236,22 @@  discard block
 block discarded – undo
237 236
 	 * @param EE_Question_Group $question_group
238 237
 	 * @return EE_Form_Section_Proper
239 238
 	 */
240
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
239
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
241 240
 		// array of params to pass to parent constructor
242 241
 		$form_args = array(
243
-			'html_id' 					=> 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
242
+			'html_id' 					=> 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
244 243
 			'html_class' 			=> $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv',
245
-			'html_label_id' 		=> 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
244
+			'html_label_id' 		=> 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
246 245
 			'subsections' 			=> array(
247
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
246
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
248 247
 			),
249 248
 			'layout_strategy' 	=> $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout()
250 249
 		);
251 250
 		// where params
252
-		$query_params = array( 'QST_deleted' => 0 );
251
+		$query_params = array('QST_deleted' => 0);
253 252
 		// don't load admin only questions on the frontend
254
-		if ( ! $this->checkout->admin_request ) {
255
-			$query_params['QST_admin_only'] = array( '!=', TRUE );
253
+		if ( ! $this->checkout->admin_request) {
254
+			$query_params['QST_admin_only'] = array('!=', TRUE);
256 255
 		}
257 256
 		$questions = $question_group->get_many_related(
258 257
 			'Question',
@@ -264,21 +263,21 @@  discard block
 block discarded – undo
264 263
 			)
265 264
 		);
266 265
 		// filter for additional content before questions
267
-		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this ));
266
+		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this));
268 267
 		// loop thru questions
269
-		foreach ( $questions as $question ) {
270
-			if( $question instanceof EE_Question ){
268
+		foreach ($questions as $question) {
269
+			if ($question instanceof EE_Question) {
271 270
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
272
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
271
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
273 272
 			}
274 273
 		}
275
-		$form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this );
274
+		$form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this);
276 275
 
277 276
 		// filter for additional content after questions
278
-		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this ));
277
+		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this));
279 278
 //		d( $form_args );
280
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
281
-		return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this );
279
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
280
+		return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this);
282 281
 	}
283 282
 
284 283
 
@@ -288,12 +287,12 @@  discard block
 block discarded – undo
288 287
 	 * @param EE_Question_Group $question_group
289 288
 	 * @return 	EE_Form_Section_HTML
290 289
 	 */
291
-	private function _question_group_header( EE_Question_Group $question_group ){
290
+	private function _question_group_header(EE_Question_Group $question_group) {
292 291
 		$html = '';
293 292
 		// group_name
294
-		if ( $question_group->show_group_name() && $question_group->name() != '' ) {
293
+		if ($question_group->show_group_name() && $question_group->name() != '') {
295 294
 			EE_Registry::instance()->load_helper('HTML');
296
-			if ( $this->checkout->admin_request ) {
295
+			if ($this->checkout->admin_request) {
297 296
 				$html .= EEH_HTML::br();
298 297
 				$html .= EEH_HTML::h3(
299 298
 					$question_group->name(),
@@ -307,7 +306,7 @@  discard block
 block discarded – undo
307 306
 			}
308 307
 		}
309 308
 		// group_desc
310
-		if ( $question_group->show_group_desc() && $question_group->desc() != '' ) {
309
+		if ($question_group->show_group_desc() && $question_group->desc() != '') {
311 310
 			$html .= EEH_HTML::p(
312 311
 				$question_group->desc(),
313 312
 				'',
@@ -315,7 +314,7 @@  discard block
 block discarded – undo
315 314
 			);
316 315
 
317 316
 		}
318
-		return new EE_Form_Section_HTML( $html );
317
+		return new EE_Form_Section_HTML($html);
319 318
 	}
320 319
 
321 320
 
@@ -324,14 +323,14 @@  discard block
 block discarded – undo
324 323
 	 * @access public
325 324
 	 * @return 	EE_Form_Section_Proper
326 325
 	 */
327
-	private function _copy_attendee_info_form(){
326
+	private function _copy_attendee_info_form() {
328 327
 		// array of params to pass to parent constructor
329 328
 		return new EE_Form_Section_Proper(
330 329
 			array(
331 330
 				'subsections' 			=> $this->_copy_attendee_info_inputs(),
332 331
 				'layout_strategy' 	=> new EE_Template_Layout(
333 332
 					array(
334
-						'layout_template_file' 			=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template
333
+						'layout_template_file' 			=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template
335 334
 						'begin_template_file' 			=> NULL,
336 335
 						'input_template_file' 				=> NULL,
337 336
 						'subsection_template_file' 	=> NULL,
@@ -353,8 +352,8 @@  discard block
 block discarded – undo
353 352
 	private function _auto_copy_attendee_info() {
354 353
 		return new EE_Form_Section_HTML(
355 354
 			EEH_Template::locate_template(
356
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
357
-				apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
355
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
356
+				apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
358 357
 				TRUE,
359 358
 				TRUE
360 359
 			)
@@ -373,25 +372,25 @@  discard block
 block discarded – undo
373 372
 		$copy_attendee_info_inputs = array();
374 373
 		$prev_ticket = NULL;
375 374
 		// grab the saved registrations from the transaction
376
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
377
-		foreach ( $registrations as $registration ) {
375
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
376
+		foreach ($registrations as $registration) {
378 377
 			// for all  attendees other than the primary attendee
379
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
378
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
380 379
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
381
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
380
+				if ($registration->ticket()->ID() !== $prev_ticket) {
382 381
 					$item_name = $registration->ticket()->name();
383
-					$item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : '';
384
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
385
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
382
+					$item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : '';
383
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
384
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
386 385
 					);
387 386
 					$prev_ticket = $registration->ticket()->ID();
388 387
 				}
389 388
 
390
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
389
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
391 390
 				EE_Checkbox_Multi_Input(
392
-					array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )),
391
+					array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())),
393 392
 					array(
394
-						'html_id' 								=> 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
393
+						'html_id' 								=> 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
395 394
 						'html_class' 						=> 'spco-copy-attendee-chk ee-do-not-validate',
396 395
 						'display_html_label_text' 	=> FALSE
397 396
 					)
@@ -410,7 +409,7 @@  discard block
 block discarded – undo
410 409
 	 * @param EE_Registration $registration
411 410
 	 * @return    EE_Form_Input_Base
412 411
 	 */
413
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
412
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
414 413
 		// generate hidden input
415 414
 		return new EE_Hidden_Input(
416 415
 			array(
@@ -428,31 +427,31 @@  discard block
 block discarded – undo
428 427
 	 * @param EE_Question     $question
429 428
 	 * @return 	EE_Form_Input_Base
430 429
 	 */
431
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
430
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
432 431
 
433 432
 		// if this question was for an attendee detail, then check for that answer
434
-		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() );
433
+		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID());
435 434
 		$answer = $answer_value === null
436
-				? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() )	) )
435
+				? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())))
437 436
 				: null;
438 437
 		// if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object
439
-		if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) {
438
+		if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) {
440 439
 			// create an EE_Answer object for storing everything in
441
-			$answer = EE_Answer::new_instance ( array(
440
+			$answer = EE_Answer::new_instance(array(
442 441
 				'QST_ID'=> $question->ID(),
443 442
 				'REG_ID'=> $registration->ID()
444 443
 			));
445 444
 		}
446 445
 		// verify instance
447
-		if( $answer instanceof EE_Answer ){
448
-			if ( ! empty( $answer_value )) {
449
-				$answer->set( 'ANS_value', $answer_value );
446
+		if ($answer instanceof EE_Answer) {
447
+			if ( ! empty($answer_value)) {
448
+				$answer->set('ANS_value', $answer_value);
450 449
 			}
451
-			$answer->cache( 'Question', $question );
452
-			$answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link();
453
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
450
+			$answer->cache('Question', $question);
451
+			$answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link();
452
+			$registration->cache('Answer', $answer, $answer_cache_id);
454 453
 		}
455
-		return $this->_generate_question_input( $registration, $question, $answer );
454
+		return $this->_generate_question_input($registration, $question, $answer);
456 455
 
457 456
 	}
458 457
 
@@ -464,31 +463,31 @@  discard block
 block discarded – undo
464 463
 	 * @param mixed EE_Answer|NULL      $answer
465 464
 	 * @return EE_Form_Input_Base
466 465
 	 */
467
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
466
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
468 467
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
469
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
470
-		add_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ), 10, 4 );
471
-		add_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ), 10, 4 );
468
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
469
+		add_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'), 10, 4);
470
+		add_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'), 10, 4);
472 471
 		$input_constructor_args = array(
473
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
474
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
475
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
476
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
472
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
473
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
474
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
475
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
477 476
 			'html_label_class'	=> 'ee-reg-qstn',
478 477
 		);
479
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
480
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
481
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
482
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
483
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
478
+		$input_constructor_args['html_label_id'] .= '-lbl';
479
+		if ($answer instanceof EE_Answer && $answer->ID()) {
480
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
481
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
482
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
484 483
 		}
485
-		$form_input =  $question->generate_form_input(
484
+		$form_input = $question->generate_form_input(
486 485
 			$registration,
487 486
 			$answer,
488 487
 			$input_constructor_args
489 488
 		);
490
-		remove_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ) );
491
-		remove_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ) );
489
+		remove_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'));
490
+		remove_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'));
492 491
 		return $form_input;
493 492
 	}
494 493
 
@@ -502,20 +501,20 @@  discard block
 block discarded – undo
502 501
 	 * @param EE_Registration $registration
503 502
 	 * @return array 2d keys are country IDs, values are their names
504 503
 	 */
505
-	public function use_cached_countries_for_form_input( $countries_list, $question, $registration, $answer ) {
506
-		$country_options = array( '' => '' );
504
+	public function use_cached_countries_for_form_input($countries_list, $question, $registration, $answer) {
505
+		$country_options = array('' => '');
507 506
 		// get possibly cached list of countries
508 507
 		$countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
509
-		if ( ! empty( $countries )) {
510
-			foreach( $countries as $country ){
511
-				if ( $country instanceof EE_Country ) {
512
-					$country_options[ $country->ID() ] = $country->name();
508
+		if ( ! empty($countries)) {
509
+			foreach ($countries as $country) {
510
+				if ($country instanceof EE_Country) {
511
+					$country_options[$country->ID()] = $country->name();
513 512
 				}
514 513
 			}
515 514
 		}
516
-		if( $question instanceof EE_Question 
517
-			&& $registration instanceof EE_Registration ) {
518
-			$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) );
515
+		if ($question instanceof EE_Question 
516
+			&& $registration instanceof EE_Registration) {
517
+			$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())));
519 518
 		} else {
520 519
 			$answer = EE_Answer::new_instance();
521 520
 		}
@@ -540,19 +539,19 @@  discard block
 block discarded – undo
540 539
 	 * @param EE_Registration $registration
541 540
 	 * @return array 2d keys are state IDs, values are their names
542 541
 	 */
543
-	public function use_cached_states_for_form_input( $states_list, $question, $registration, $answer ) {
544
-		$state_options = array( '' => array( '' => ''));
542
+	public function use_cached_states_for_form_input($states_list, $question, $registration, $answer) {
543
+		$state_options = array('' => array('' => ''));
545 544
 		$states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states();
546
-		if ( ! empty( $states )) {
547
-			foreach( $states as $state ){
548
-				if ( $state instanceof EE_State ) {
549
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
545
+		if ( ! empty($states)) {
546
+			foreach ($states as $state) {
547
+				if ($state instanceof EE_State) {
548
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
550 549
 				}
551 550
 			}
552 551
 		}
553
-		if( $question instanceof EE_Question 
554
-			&& $registration instanceof EE_Registration ) {
555
-			$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) );
552
+		if ($question instanceof EE_Question 
553
+			&& $registration instanceof EE_Registration) {
554
+			$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())));
556 555
 		} else {
557 556
 			$answer = EE_Answer::new_instance();
558 557
 		}
@@ -586,65 +585,65 @@  discard block
 block discarded – undo
586 585
 	 */
587 586
 	public function process_reg_step() {
588 587
 
589
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
588
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
590 589
 		// grab validated data from form
591 590
 		$valid_data = $this->checkout->current_step->valid_data();
592 591
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
593 592
 		//EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
594 593
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
595
-		if ( empty( $valid_data ))  {
596
-			EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
594
+		if (empty($valid_data)) {
595
+			EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
597 596
 			return FALSE;
598 597
 		}
599 598
 		//EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ );
600
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
601
-			EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
599
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
600
+			EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
602 601
 			return FALSE;
603 602
 		}
604 603
 		// get cached registrations
605
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
604
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
606 605
 		// verify we got the goods
607
-		if ( empty( $registrations )) {
608
-			EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
606
+		if (empty($registrations)) {
607
+			EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
609 608
 			return FALSE;
610 609
 		}
611 610
 		// extract attendee info from form data and save to model objects
612
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
611
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
613 612
 		// if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart
614
-		if ( $registrations_processed === FALSE ) {
613
+		if ($registrations_processed === FALSE) {
615 614
 			// but return immediately if the previous step exited early due to errors
616 615
 			return FALSE;
617
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
616
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
618 617
 			// generate a correctly translated string for all possible singular/plural combinations
619
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
618
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
620 619
 				$error_msg = sprintf(
621
-					__( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
620
+					__('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
622 621
 					$this->checkout->total_ticket_count,
623 622
 					$registrations_processed
624 623
 				);
625
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
624
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
626 625
 				$error_msg = sprintf(
627
-					__( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ),
626
+					__('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'),
628 627
 					$this->checkout->total_ticket_count,
629 628
 					$registrations_processed
630 629
 				);
631 630
 			} else {
632 631
 				$error_msg = sprintf(
633
-					__( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
632
+					__('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
634 633
 					$this->checkout->total_ticket_count,
635 634
 					$registrations_processed
636 635
 				);
637 636
 
638 637
 			}
639
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
638
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
640 639
 			return FALSE;
641 640
 		}
642 641
 		// mark this reg step as completed
643 642
 		$this->set_completed();
644
-		$this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' ));
643
+		$this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso'));
645 644
 		//do action in case a plugin wants to do something with the data submitted in step 1.
646 645
 		//passes EE_Single_Page_Checkout, and it's posted data
647
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
646
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
648 647
 		return TRUE;
649 648
 
650 649
 	}
@@ -658,9 +657,9 @@  discard block
 block discarded – undo
658 657
 	 * @param array             $valid_data
659 658
 	 * @return boolean | int
660 659
 	 */
661
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
660
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
662 661
 		// load resources and set some defaults
663
-		EE_Registry::instance()->load_model( 'Attendee' );
662
+		EE_Registry::instance()->load_model('Attendee');
664 663
 		// holder for primary registrant attendee object
665 664
 		$this->checkout->primary_attendee_obj = NULL;
666 665
 		// array for tracking reg form data for the primary registrant
@@ -677,19 +676,19 @@  discard block
 block discarded – undo
677 676
 		// attendee counter
678 677
 		$att_nmbr = 0;
679 678
 		// grab the saved registrations from the transaction
680
-		foreach ( $registrations  as $registration ) {
679
+		foreach ($registrations  as $registration) {
681 680
 			// verify EE_Registration object
682
-			if ( ! $registration instanceof EE_Registration ) {
683
-				EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
681
+			if ( ! $registration instanceof EE_Registration) {
682
+				EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
684 683
 				return FALSE;
685 684
 			}
686 685
 			$reg_url_link = $registration->reg_url_link();
687 686
 			// reg_url_link exists ?
688
-			if ( $reg_url_link ) {
687
+			if ($reg_url_link) {
689 688
 				// should this registration be processed during this visit ?
690
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
689
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
691 690
 					// if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects
692
-					if ( ! $this->checkout->revisit ) {
691
+					if ( ! $this->checkout->revisit) {
693 692
 						$registration->save();
694 693
 					}
695 694
 
@@ -700,41 +699,41 @@  discard block
 block discarded – undo
700 699
 					 * @var bool   if TRUE is returned by the plugin then the
701 700
 					 *      		registration processing is halted.
702 701
 					 */
703
-					if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) {
702
+					if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) {
704 703
 						return FALSE;
705 704
 					}
706 705
 
707 706
 					// Houston, we have a registration!
708 707
 					$att_nmbr++;
709
-					$this->_attendee_data[ $reg_url_link ] = array();
708
+					$this->_attendee_data[$reg_url_link] = array();
710 709
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
711
-					if ( isset( $valid_data[ $reg_url_link ] )) {
710
+					if (isset($valid_data[$reg_url_link])) {
712 711
 						// do we need to copy basic info from primary attendee ?
713
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE;
712
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE;
714 713
 						// filter form input data for this registration
715
-						$valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] );
714
+						$valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]);
716 715
 						//EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
717
-						if ( isset( $valid_data['primary_attendee'] )) {
718
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE;
719
-							unset( $valid_data['primary_attendee'] );
716
+						if (isset($valid_data['primary_attendee'])) {
717
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE;
718
+							unset($valid_data['primary_attendee']);
720 719
 						}
721 720
 						// now loop through our array of valid post data && process attendee reg forms
722
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
723
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
724
-								foreach ( $form_inputs as $form_input => $input_value ) {
721
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
722
+							if ( ! in_array($form_section, $non_input_form_sections)) {
723
+								foreach ($form_inputs as $form_input => $input_value) {
725 724
 									// check for critical inputs
726
-									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) {
725
+									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) {
727 726
 										return FALSE;
728 727
 									}
729 728
 									// store a bit of data about the primary attendee
730
-									if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) {
731
-										$primary_registrant[ $form_input ] = $input_value;
732
-									} else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) {
733
-										$input_value = $primary_registrant[ $form_input ];
729
+									if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) {
730
+										$primary_registrant[$form_input] = $input_value;
731
+									} else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) {
732
+										$input_value = $primary_registrant[$form_input];
734 733
 									}
735 734
 									// now attempt to save the input data
736
-									if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value ))  {
737
-										EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ );
735
+									if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) {
736
+										EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__);
738 737
 										return FALSE;
739 738
 									}
740 739
 								}
@@ -743,51 +742,51 @@  discard block
 block discarded – undo
743 742
 					}
744 743
 					//EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );
745 744
 					// this registration does not require additional attendee information ?
746
-					if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
745
+					if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
747 746
 						// just copy the primary registrant
748 747
 						$attendee = $this->checkout->primary_attendee_obj;
749 748
 					} else {
750 749
 						// have we met before?
751
-						$attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
750
+						$attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]);
752 751
 						// did we find an already existing record for this attendee ?
753
-						if ( $attendee instanceof EE_Attendee ) {
754
-							$attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] );
752
+						if ($attendee instanceof EE_Attendee) {
753
+							$attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]);
755 754
 						} else {
756 755
 							// ensure critical details are set for additional attendees
757
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ];
758
-							$attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
756
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link];
757
+							$attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]);
759 758
 						}
760 759
 						// who's #1 ?
761
-						if ( $att_nmbr == 1 ) {
760
+						if ($att_nmbr == 1) {
762 761
 							$this->checkout->primary_attendee_obj = $attendee;
763 762
 						}
764 763
 					}
765 764
 					//EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
766 765
 					// add relation to registration, set attendee ID, and cache attendee
767
-					$this->_associate_attendee_with_registration( $registration, $attendee );
768
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
769
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
766
+					$this->_associate_attendee_with_registration($registration, $attendee);
767
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
768
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
770 769
 						return FALSE;
771 770
 					}
772 771
 					/** @type EE_Registration_Processor $registration_processor */
773
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
772
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
774 773
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
775
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE );
774
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE);
776 775
 					/** @type EE_Transaction_Processor $transaction_processor */
777
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
776
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
778 777
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
779
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
778
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
780 779
 					// if we've gotten this far, then let's save what we have
781 780
 					$registration->save();
782 781
 					// add relation between TXN and registration
783
-					$this->_associate_registration_with_transaction( $registration );
782
+					$this->_associate_registration_with_transaction($registration);
784 783
 
785 784
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
786 785
 
787
-			}  else {
788
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
786
+			} else {
787
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
789 788
 				// remove malformed data
790
-				unset( $valid_data[ $reg_url_link ] );
789
+				unset($valid_data[$reg_url_link]);
791 790
 				return FALSE;
792 791
 			}
793 792
 
@@ -805,22 +804,22 @@  discard block
 block discarded – undo
805 804
 	 * @param string           	$input_value
806 805
 	 * @return boolean
807 806
 	 */
808
-	private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) {
807
+	private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') {
809 808
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
810 809
 		//EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );
811 810
 		// allow for plugins to hook in and do their own processing of the form input.
812 811
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
813
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) {
812
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) {
814 813
 			return TRUE;
815 814
 		}
816 815
 
817 816
 		// grab related answer objects
818 817
 		$answers = $registration->answers();
819 818
 		// $answer_cache_id is the key used to find the EE_Answer we want
820
-		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link();
821
-		$answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE;
819
+		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link();
820
+		$answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE;
822 821
 		//rename form_inputs if they are EE_Attendee properties
823
-		switch( (string)$form_input ) {
822
+		switch ((string) $form_input) {
824 823
 
825 824
 			case 'state' :
826 825
 			case 'STA_ID' :
@@ -835,33 +834,33 @@  discard block
 block discarded – undo
835 834
 				break;
836 835
 
837 836
 			default :
838
-				$ATT_input = 'ATT_' . $form_input;
837
+				$ATT_input = 'ATT_'.$form_input;
839 838
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
840
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE;
841
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
839
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE;
840
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
842 841
 		}
843 842
 		//EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
844 843
 		//EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
845 844
 		//EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
846 845
 		//EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
847 846
 		// if this form input has a corresponding attendee property
848
-		if ( $attendee_property ) {
849
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
850
-			if (  $answer_is_obj ) {
847
+		if ($attendee_property) {
848
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
849
+			if ($answer_is_obj) {
851 850
 				// and delete the corresponding answer since we won't be storing this data in that object
852
-				$registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' );
853
-				$answers[ $answer_cache_id ]->delete_permanently();
851
+				$registration->_remove_relation_to($answers[$answer_cache_id], 'Answer');
852
+				$answers[$answer_cache_id]->delete_permanently();
854 853
 			}
855 854
 			return TRUE;
856
-		} elseif ( $answer_is_obj ) {
855
+		} elseif ($answer_is_obj) {
857 856
 			// save this data to the answer object
858
-			$answers[ $answer_cache_id ]->set_value( $input_value );
859
-			$result = $answers[ $answer_cache_id ]->save();
857
+			$answers[$answer_cache_id]->set_value($input_value);
858
+			$result = $answers[$answer_cache_id]->save();
860 859
 			return $result !== false ? true : false;
861 860
 		} else {
862
-			foreach ( $answers as $answer ) {
863
-				if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) {
864
-					$answer->set_value( $input_value );
861
+			foreach ($answers as $answer) {
862
+				if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) {
863
+					$answer->set_value($input_value);
865 864
 					$result = $answer->save();
866 865
 					return $result !== false ? true : false;
867 866
 				}
@@ -879,33 +878,33 @@  discard block
 block discarded – undo
879 878
 	 * @param string $input_value
880 879
 	 * @return boolean
881 880
 	 */
882
-	private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) {
883
-		if ( empty( $input_value )) {
881
+	private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') {
882
+		if (empty($input_value)) {
884 883
 			// if the form input isn't marked as being required, then just return
885
-			if ( ! isset( $this->_required_questions[ $form_input ]  ) || ! $this->_required_questions[ $form_input ] ) {
884
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
886 885
 				return true;
887 886
 			}
888
-			switch( $form_input ) {
887
+			switch ($form_input) {
889 888
 				case 'fname' :
890
-					EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
889
+					EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
891 890
 					return FALSE;
892 891
 					break;
893 892
 				case 'lname' :
894
-					EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
893
+					EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
895 894
 					return FALSE;
896 895
 					break;
897 896
 				case 'email' :
898
-					EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
897
+					EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
899 898
 					return FALSE;
900 899
 					break;
901 900
 			}
902
-		} else if ( $form_input === 'email' ) {
901
+		} else if ($form_input === 'email') {
903 902
 			// clean the email address
904
-			$valid_email = sanitize_email( $input_value );
903
+			$valid_email = sanitize_email($input_value);
905 904
 			// check if it matches
906
-			if ( $input_value != $valid_email ) {
905
+			if ($input_value != $valid_email) {
907 906
 				// whoops!!!
908
-				EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
907
+				EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
909 908
 				return FALSE;
910 909
 			}
911 910
 		}
@@ -933,14 +932,14 @@  discard block
 block discarded – undo
933 932
 	 * @param array           $attendee_data
934 933
 	 * @return boolean
935 934
 	 */
936
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
935
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
937 936
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
938
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : '';
939
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : '';
940
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : '';
937
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : '';
938
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : '';
939
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : '';
941 940
 		// but only if those have values
942
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
943
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
941
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
942
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
944 943
 				'ATT_fname' => $ATT_fname,
945 944
 				'ATT_lname' => $ATT_lname,
946 945
 				'ATT_email' => $ATT_email
@@ -948,7 +947,7 @@  discard block
 block discarded – undo
948 947
 		} else {
949 948
 			$existing_attendee = NULL;
950 949
 		}
951
-		return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data );
950
+		return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data);
952 951
 	}
953 952
 
954 953
 
@@ -960,13 +959,13 @@  discard block
 block discarded – undo
960 959
 	 * @param array           $attendee_data
961 960
 	 * @return \EE_Attendee
962 961
 	 */
963
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
962
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
964 963
 		// first remove fname, lname, and email from attendee data
965
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
964
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
966 965
 		// now loop thru what's left and add to attendee CPT
967
-		foreach ( $attendee_data as $property_name => $property_value ) {
968
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
969
-				$existing_attendee->set( $property_name, $property_value );
966
+		foreach ($attendee_data as $property_name => $property_value) {
967
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
968
+				$existing_attendee->set($property_name, $property_value);
970 969
 			}
971 970
 		}
972 971
 		// better save that now
@@ -983,11 +982,11 @@  discard block
 block discarded – undo
983 982
 	 * @param EE_Attendee     $attendee
984 983
 	 * @return void
985 984
 	 */
986
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
985
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
987 986
 		// add relation to attendee
988
-		$registration->_add_relation_to( $attendee, 'Attendee' );
989
-		$registration->set_attendee_id( $attendee->ID() );
990
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
987
+		$registration->_add_relation_to($attendee, 'Attendee');
988
+		$registration->set_attendee_id($attendee->ID());
989
+		$registration->update_cache_after_object_save('Attendee', $attendee);
991 990
 	}
992 991
 
993 992
 
@@ -998,10 +997,10 @@  discard block
 block discarded – undo
998 997
 	 * @param EE_Registration $registration
999 998
 	 * @return void
1000 999
 	 */
1001
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1000
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1002 1001
 		// add relation to attendee
1003
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1004
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1002
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1003
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1005 1004
 	}
1006 1005
 
1007 1006
 
@@ -1013,17 +1012,17 @@  discard block
 block discarded – undo
1013 1012
 	 * @param array $attendee_data
1014 1013
 	 * @return array
1015 1014
 	 */
1016
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1015
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1017 1016
 		// bare minimum critical details include first name, last name, email address
1018
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1017
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1019 1018
 		// add address info to critical details?
1020
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) {
1021
-			$address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' );
1022
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1019
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) {
1020
+			$address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone');
1021
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1023 1022
 		}
1024
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1025
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) {
1026
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail );
1023
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1024
+			if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) {
1025
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail);
1027 1026
 			}
1028 1027
 		}
1029 1028
 		return $attendee_data;
@@ -1038,11 +1037,11 @@  discard block
 block discarded – undo
1038 1037
 	 * @param array           $attendee_data
1039 1038
 	 * @return \EE_Attendee
1040 1039
 	 */
1041
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1040
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1042 1041
 		// create new attendee object
1043
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1042
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1044 1043
 		// set author to event creator
1045
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1044
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1046 1045
 		$new_attendee->save();
1047 1046
 		return $new_attendee;
1048 1047
 	}
@@ -1058,7 +1057,7 @@  discard block
 block discarded – undo
1058 1057
 	 */
1059 1058
 	public function update_reg_step() {
1060 1059
 		// save everything
1061
-		if ( $this->process_reg_step() ) {
1060
+		if ($this->process_reg_step()) {
1062 1061
 			$this->checkout->redirect = TRUE;
1063 1062
 			$this->checkout->redirect_url = add_query_arg(
1064 1063
 				array(
@@ -1067,7 +1066,7 @@  discard block
 block discarded – undo
1067 1066
 				),
1068 1067
 				$this->checkout->thank_you_page_url
1069 1068
 			);
1070
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1069
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1071 1070
 			return TRUE;
1072 1071
 		}
1073 1072
 		return FALSE;
Please login to merge, or discard this patch.
Registration_Form_Question_Groups_Admin_List_Table.class.php 1 patch
Spacing   +30 added lines, -30 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
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 class Registration_Form_Question_Groups_Admin_List_Table extends EE_Admin_List_Table {
32 32
 
33 33
 
34
-	public function __construct( $admin_page ) {
34
+	public function __construct($admin_page) {
35 35
 		parent::__construct($admin_page);
36 36
 	}
37 37
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 	protected function _setup_data() {
42
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, FALSE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, FALSE );
43
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE );
42
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, FALSE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, FALSE);
43
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE);
44 44
 	}
45 45
 
46 46
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 	protected function _set_properties() {
51 51
 		$this->_wp_list_args = array(
52
-			'singular' => __('question group', 'event_espresso' ),
53
-			'plural' => __('question groups', 'event_espresso' ),
52
+			'singular' => __('question group', 'event_espresso'),
53
+			'plural' => __('question groups', 'event_espresso'),
54 54
 			'ajax' => TRUE, //for now,
55 55
 			'screen' => $this->_admin_page->get_current_screen()->id
56 56
 			);
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 		$this->_sortable_columns = array(
68
-			'id' => array( 'QSG_ID' => FALSE ),
69
-			'name' => array( 'QSG_name' => FALSE )
68
+			'id' => array('QSG_ID' => FALSE),
69
+			'name' => array('QSG_name' => FALSE)
70 70
 			);
71 71
 
72 72
 		$this->_hidden_columns = array(
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 	protected function _add_view_counts() {
95
-		$this->_views['all']['count'] = $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE );
96
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_group' ) ) {
97
-			$this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE );
95
+		$this->_views['all']['count'] = $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE);
96
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_group')) {
97
+			$this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE);
98 98
 		}
99 99
 	}
100 100
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$system_group = $item->get('QSG_system');
108 108
 		$has_questions_with_answers = $item->has_questions_with_answers();
109 109
 		$lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock';
110
-		return $system_group > 0 || ( $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID() ) ? '<span class="' . $lock_icon . '"></span>'  . sprintf( '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID() )  : sprintf( '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID() );
110
+		return $system_group > 0 || ($system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers) || ! EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID()) ? '<span class="'.$lock_icon.'"></span>'.sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) : sprintf('<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
111 111
 	}
112 112
 
113 113
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	public function column_id(EE_Question_Group $item) {
119 119
 		$content = $item->ID();
120
-		$content .= '  <span class="show-on-mobile-view-only">' .$item->name() . '</span>';
120
+		$content .= '  <span class="show-on-mobile-view-only">'.$item->name().'</span>';
121 121
 		return $content;
122 122
 	}
123 123
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$actions = array();
128 128
 
129 129
 		//return $item->name();
130
-		if ( !defined('REG_ADMIN_URL') )
130
+		if ( ! defined('REG_ADMIN_URL'))
131 131
 			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
132 132
 
133 133
 		$edit_query_args = array(
@@ -152,32 +152,32 @@  discard block
 block discarded – undo
152 152
 
153 153
 
154 154
 
155
-		$edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL );
156
-		$trash_link = EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL );
157
-		$restore_link = EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL );
158
-		$delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL );
155
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
156
+		$trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL);
157
+		$restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL);
158
+		$delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL);
159 159
 
160
-		if (  EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ) {
160
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID())) {
161 161
 			$actions = array(
162
-				'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Question Group', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'
162
+				'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Question Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'
163 163
 			);
164 164
 		}
165
-		if ( $item->get('QSG_system') < 1 && $this->_view != 'trash' &&  EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID() ) ) {
166
-			$actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__('Delete Question Group', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
165
+		if ($item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID())) {
166
+			$actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__('Delete Question Group', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
167 167
 		}
168 168
 
169
-		if ( $this->_view == 'trash' ) {
169
+		if ($this->_view == 'trash') {
170 170
 
171
-			if (  EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID() ) ) {
172
-				$actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__('Restore Question Group', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
171
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID())) {
172
+				$actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__('Restore Question Group', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
173 173
 			}
174 174
 
175
-			if ( !$item->has_questions_with_answers() &&  EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID() ) ) {
176
-				$actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
175
+			if ( ! $item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID())) {
176
+				$actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Question Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
177 177
 			}
178 178
 		}
179 179
 
180
-		$content =  EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name();
180
+		$content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name();
181 181
 		$content .= $this->row_actions($actions);
182 182
 		return $content;
183 183
 	}
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 
199 199
 
200 200
 	public function column_show_group_name(EE_Question_Group $item) {
201
-		return $this->_yes_no[ $item->show_group_name() ];
201
+		return $this->_yes_no[$item->show_group_name()];
202 202
 	}
203 203
 
204 204
 
205 205
 
206 206
 	public function column_show_group_desc(EE_Question_Group $item) {
207
-		return $this->_yes_no[ $item->show_group_desc() ];
207
+		return $this->_yes_no[$item->show_group_desc()];
208 208
 	}
209 209
 
210 210
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3
- *
4
- * EEG_Mijireh
5
- *
6
- * @package			Event Espresso
7
- * @subpackage
8
- * @author				Mike Nelson
9
- *
10
- */
3
+	 *
4
+	 * EEG_Mijireh
5
+	 *
6
+	 * @package			Event Espresso
7
+	 * @subpackage
8
+	 * @author				Mike Nelson
9
+	 *
10
+	 */
11 11
 class EEG_Mijireh extends EE_Offsite_Gateway{
12 12
 
13 13
 	protected $_access_key;
@@ -99,45 +99,45 @@  discard block
 block discarded – undo
99 99
 		'body'=>  json_encode($order)
100 100
 		);
101 101
 		$response = wp_remote_post( $this->_mijireh_api_orders_url, $args );
102
-                $problems_string = false;
102
+				$problems_string = false;
103 103
 		$this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment);
104 104
 		if( ! $response instanceof WP_Error ){
105 105
 			$response_body = json_decode($response['body']);
106 106
 			if($response_body && isset($response_body->checkout_url)){
107
-                            $payment->set_redirect_url($response_body->checkout_url);
108
-                            $payment->set_txn_id_chq_nmbr($response_body->order_number);
109
-                            $payment->set_details($response['body']);
107
+							$payment->set_redirect_url($response_body->checkout_url);
108
+							$payment->set_txn_id_chq_nmbr($response_body->order_number);
109
+							$payment->set_details($response['body']);
110 110
 			} else {
111
-                           if( is_array( $response_body ) || is_object( $response_body)){
112
-                                    $response_body_as_array = (array)$response_body;
113
-                                    foreach($response_body_as_array as $problem_parameter => $problems){
114
-                                            $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115
-                                    }
116
-                            }else{
117
-                                    $problems_string = $response['body'];
118
-                            }
119
-                            if( ! $problems_string ) {
120
-                                //no message to show? wack
121
-                                if( isset( $response[ 'headers' ][ 'status' ] ) ){
122
-                                        $problems_string = $response[ 'headers' ][ 'status' ];
123
-                                }else{
124
-                                        $problems_string = __( 'No response from Mijireh', 'event_espresso' );
125
-                                }
126
-                            }
127
-                        }
111
+						   if( is_array( $response_body ) || is_object( $response_body)){
112
+									$response_body_as_array = (array)$response_body;
113
+									foreach($response_body_as_array as $problem_parameter => $problems){
114
+											$problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115
+									}
116
+							}else{
117
+									$problems_string = $response['body'];
118
+							}
119
+							if( ! $problems_string ) {
120
+								//no message to show? wack
121
+								if( isset( $response[ 'headers' ][ 'status' ] ) ){
122
+										$problems_string = $response[ 'headers' ][ 'status' ];
123
+								}else{
124
+										$problems_string = __( 'No response from Mijireh', 'event_espresso' );
125
+								}
126
+							}
127
+						}
128 128
 		}else{
129
-                    $problems_string = implode( ",", $response->get_error_messages() );
129
+					$problems_string = implode( ",", $response->get_error_messages() );
130 130
 		}
131 131
                 
132
-                if( $problems_string ) {
133
-                    $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
134
-                    $payment->set_details( $response );
135
-                    $payment->set_redirect_url( null );
136
-                    //even though the payment's status is failed at this point anyways,
137
-                    //let's be explicit about it. The fact that the redirect url is null
138
-                    //should be enough to client code that they can't redirect the user
139
-                    $payment->set_status( $this->_pay_model->failed_status() );
140
-                }
132
+				if( $problems_string ) {
133
+					$payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
134
+					$payment->set_details( $response );
135
+					$payment->set_redirect_url( null );
136
+					//even though the payment's status is failed at this point anyways,
137
+					//let's be explicit about it. The fact that the redirect url is null
138
+					//should be enough to client code that they can't redirect the user
139
+					$payment->set_status( $this->_pay_model->failed_status() );
140
+				}
141 141
 		return $payment;
142 142
 	}
143 143
 
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author				Mike Nelson
9 9
  *
10 10
  */
11
-class EEG_Mijireh extends EE_Offsite_Gateway{
11
+class EEG_Mijireh extends EE_Offsite_Gateway {
12 12
 
13 13
 	protected $_access_key;
14 14
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 		$primary_attendee = $primary_registrant->attendee();
38 38
 		$items = array();
39 39
 		//if we're are charging for the full amount, show the normal line items
40
-		if( $this->_can_easily_itemize_transaction_for( $payment )){
40
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
41 41
 			$total_line_item = $transaction->total_line_item();
42 42
 			$tax_total = $total_line_item->get_total_tax();
43
-			foreach($total_line_item->get_items() as $line_item){
43
+			foreach ($total_line_item->get_items() as $line_item) {
44 44
 				$items[] = array(
45 45
 					'name'=>apply_filters(
46 46
 						'FHEE__EEG_Mijireh__set_redirection_info__full_amount_line_item_name',
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 					'quantity'=>$line_item->quantity()
55 55
 				);
56 56
 			}
57
-		}else{//its a partial payment
57
+		} else {//its a partial payment
58 58
 			$tax_total = 0;
59 59
 			//partial payment, so just add 1 item
60 60
 			$items[] = array(
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 					'FHEE__EEG_Mijireh__set_redirection_info__partial_amount_line_item_name',
63 63
 					sprintf(
64 64
 						__("Payment of %s for %s", 'event_espresso'),
65
-						$payment->get_pretty( 'PAY_amount', 'no_currency_code' ),
65
+						$payment->get_pretty('PAY_amount', 'no_currency_code'),
66 66
 						$primary_registrant->event_name()
67 67
 					),
68 68
 					$payment,
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 		$order = array(
77 77
 			'total'=>$this->format_currency($payment->amount()),
78 78
 			'return_url'=>$return_url,
79
-			'items'=>$this->_prepare_for_mijireh( $items ),
79
+			'items'=>$this->_prepare_for_mijireh($items),
80 80
 			'email'=>$primary_attendee->email(),
81 81
 			'first_name'=>$primary_attendee->fname(),
82 82
 			'last_name'=>$primary_attendee->lname(),
83 83
 			'tax'=>$this->format_currency($tax_total),
84 84
 			'partner_id'=>'ee');
85 85
 		//setup address?
86
-		if(		$primary_attendee->address()  &&
87
-				$primary_attendee->city()  &&
88
-				$primary_attendee->state_ID()  &&
89
-				$primary_attendee->country_ID()  &&
90
-				$primary_attendee->zip()  ){
86
+		if ($primary_attendee->address() &&
87
+				$primary_attendee->city() &&
88
+				$primary_attendee->state_ID() &&
89
+				$primary_attendee->country_ID() &&
90
+				$primary_attendee->zip()) {
91 91
 			$shipping_address = array(
92 92
 				'first_name'=>$primary_attendee->fname(),
93 93
 				'last_name'=>$primary_attendee->lname(),
@@ -97,62 +97,62 @@  discard block
 block discarded – undo
97 97
 				'zip_code' => $primary_attendee->zip(),
98 98
 				'country' => $primary_attendee->country_ID()
99 99
 			);
100
-			if( $primary_attendee->address2() ){
101
-				$shipping_address[ 'apt_suite' ] = $primary_attendee->address2();
100
+			if ($primary_attendee->address2()) {
101
+				$shipping_address['apt_suite'] = $primary_attendee->address2();
102 102
 			}
103
-			if( $primary_attendee->phone() ){
104
-				$shipping_address[ 'phone' ] = $primary_attendee->phone();
103
+			if ($primary_attendee->phone()) {
104
+				$shipping_address['phone'] = $primary_attendee->phone();
105 105
 			}
106
-			$order[ 'shipping_address' ] = $shipping_address;
106
+			$order['shipping_address'] = $shipping_address;
107 107
 		}
108
-		$order = apply_filters( 'FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant );
109
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)) );
108
+		$order = apply_filters('FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant);
109
+		do_action('AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)));
110 110
 		$args = array(
111 111
 			'headers' => array(
112
-				'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ),
112
+				'Authorization' => 'Basic '.base64_encode($this->_access_key.':'),
113 113
 				'Accept'=>'application/json'
114 114
 			),
115 115
 			'body'=>  json_encode($order)
116 116
 		);
117
-		$response = wp_remote_post( $this->_mijireh_api_orders_url, $args );
117
+		$response = wp_remote_post($this->_mijireh_api_orders_url, $args);
118 118
                 $problems_string = false;
119
-		$this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment);
120
-		if( ! $response instanceof WP_Error ){
119
+		$this->log(array('get checkout url request_args' => $args, 'response' => $response), $payment);
120
+		if ( ! $response instanceof WP_Error) {
121 121
 			$response_body = json_decode($response['body']);
122
-			if($response_body && isset($response_body->checkout_url)){
122
+			if ($response_body && isset($response_body->checkout_url)) {
123 123
                             $payment->set_redirect_url($response_body->checkout_url);
124 124
                             $payment->set_txn_id_chq_nmbr($response_body->order_number);
125 125
                             $payment->set_details($response['body']);
126 126
 			} else {
127
-                           if( is_array( $response_body ) || is_object( $response_body)){
128
-                                    $response_body_as_array = (array)$response_body;
129
-                                    foreach($response_body_as_array as $problem_parameter => $problems){
130
-                                            $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
127
+                           if (is_array($response_body) || is_object($response_body)) {
128
+                                    $response_body_as_array = (array) $response_body;
129
+                                    foreach ($response_body_as_array as $problem_parameter => $problems) {
130
+                                            $problems_string .= sprintf(__('\nProblems with %s: %s', 'event_espresso'), $problem_parameter, implode(", ", $problems));
131 131
                                     }
132
-                            }else{
132
+                            } else {
133 133
                                     $problems_string = $response['body'];
134 134
                             }
135
-                            if( ! $problems_string ) {
135
+                            if ( ! $problems_string) {
136 136
                                 //no message to show? wack
137
-                                if( isset( $response[ 'headers' ][ 'status' ] ) ){
138
-                                        $problems_string = $response[ 'headers' ][ 'status' ];
139
-                                }else{
140
-                                        $problems_string = __( 'No response from Mijireh', 'event_espresso' );
137
+                                if (isset($response['headers']['status'])) {
138
+                                        $problems_string = $response['headers']['status'];
139
+                                } else {
140
+                                        $problems_string = __('No response from Mijireh', 'event_espresso');
141 141
                                 }
142 142
                             }
143 143
                         }
144
-		}else{
145
-                    $problems_string = implode( ",", $response->get_error_messages() );
144
+		} else {
145
+                    $problems_string = implode(",", $response->get_error_messages());
146 146
 		}
147 147
                 
148
-                if( $problems_string ) {
149
-                    $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
150
-                    $payment->set_details( $response );
151
-                    $payment->set_redirect_url( null );
148
+                if ($problems_string) {
149
+                    $payment->set_gateway_response(sprintf(__('Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string));
150
+                    $payment->set_details($response);
151
+                    $payment->set_redirect_url(null);
152 152
                     //even though the payment's status is failed at this point anyways,
153 153
                     //let's be explicit about it. The fact that the redirect url is null
154 154
                     //should be enough to client code that they can't redirect the user
155
-                    $payment->set_status( $this->_pay_model->failed_status() );
155
+                    $payment->set_status($this->_pay_model->failed_status());
156 156
                 }
157 157
 		return $payment;
158 158
 	}
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	 * @param mixed $data
166 166
 	 * @return mixed same type as $data
167 167
 	 */
168
-	private function _prepare_for_mijireh( $data ){
169
-		if( is_array( $data ) ){
168
+	private function _prepare_for_mijireh($data) {
169
+		if (is_array($data)) {
170 170
 			$prepared_data = array();
171
-			foreach($data as $key => $datum ){
172
-				$prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum );
171
+			foreach ($data as $key => $datum) {
172
+				$prepared_data[$key] = $this->_prepare_for_mijireh($datum);
173 173
 			}
174 174
 			return $prepared_data;
175
-		}elseif(is_string( $data ) ){
176
-			return str_replace( '%', 'percent', $data );
177
-		}else{
175
+		}elseif (is_string($data)) {
176
+			return str_replace('%', 'percent', $data);
177
+		} else {
178 178
 			return $data;
179 179
 		}
180 180
 	}
@@ -195,30 +195,30 @@  discard block
 block discarded – undo
195 195
 
196 196
 		$payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL;
197 197
 
198
-		if ( ! $payment instanceof EEI_Payment ){
199
-			throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) );
198
+		if ( ! $payment instanceof EEI_Payment) {
199
+			throw new EE_Error(sprintf(__("Could not find Mijireh payment for transaction %s", 'event_espresso'), $transaction->ID()));
200 200
 		}
201 201
 
202 202
 		$request_args = array(
203 203
 			'headers' => array(
204
-				'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ),
204
+				'Authorization' => 'Basic '.base64_encode($this->_access_key.':'),
205 205
 				'Accept'=>'application/json'
206 206
 			)
207 207
 		);
208 208
 
209 209
 		$response = wp_remote_get(
210
-			$this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(),
210
+			$this->_mijireh_api_orders_url.'/'.$payment->txn_id_chq_nmbr(),
211 211
 			$request_args
212 212
 		);
213 213
 
214 214
 		$this->log(
215
-			array( 'get payment status request_args' => $request_args, 'response' => $response ),
215
+			array('get payment status request_args' => $request_args, 'response' => $response),
216 216
 			$payment
217 217
 		);
218 218
 		// validate response
219
-		$response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : '';
220
-		if( $response && $response_body ){
221
-			switch( $response_body->status ){
219
+		$response_body = isset($response['body']) ? json_decode($response['body']) : '';
220
+		if ($response && $response_body) {
221
+			switch ($response_body->status) {
222 222
 				case 'paid':
223 223
 					$payment->set_status($this->_pay_model->approved_status());
224 224
 					break;
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 			}
231 231
 
232 232
 		} else {
233
-			$payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) );
234
-			$payment->set_details( $response );
235
-			$payment->set_status( $this->_pay_model->failed_status() );
233
+			$payment->set_gateway_response(__('Response from Mijireh could not be understood.', 'event_espresso'));
234
+			$payment->set_details($response);
235
+			$payment->set_status($this->_pay_model->failed_status());
236 236
 		}
237 237
 		// the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage
238 238
 //		$payment->set_status( $this->_pay_model->pending_status() );
Please login to merge, or discard this patch.
core/EE_Request_Handler.core.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	 * @param WP $wp
66 66
 	 * @return \EE_Request_Handler
67 67
 	 */
68
-	public function __construct( $wp = null ) {
68
+	public function __construct($wp = null) {
69 69
 		// grab request vars
70 70
 		$this->_params = $_REQUEST;
71 71
 		// AJAX ???
72
-		$this->ajax = defined( 'DOING_AJAX' ) ? true : false;
73
-		$this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false;
74
-		do_action( 'AHEE__EE_Request_Handler__construct__complete' );
72
+		$this->ajax = defined('DOING_AJAX') ? true : false;
73
+		$this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false;
74
+		do_action('AHEE__EE_Request_Handler__construct__complete');
75 75
 	}
76 76
 
77 77
 
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 	 * @param WP $wp
84 84
 	 * @return void
85 85
 	 */
86
-	public function parse_request( $wp = null ) {
86
+	public function parse_request($wp = null) {
87 87
 		//if somebody forgot to provide us with WP, that's ok because its global
88
-		if ( ! $wp instanceof WP ) {
88
+		if ( ! $wp instanceof WP) {
89 89
 			global $wp;
90 90
 		}
91
-		$this->set_request_vars( $wp );
91
+		$this->set_request_vars($wp);
92 92
 	}
93 93
 
94 94
 
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 * @param WP $wp
101 101
 	 * @return void
102 102
 	 */
103
-	public function set_request_vars( $wp = null ) {
104
-		if ( ! is_admin() ) {
103
+	public function set_request_vars($wp = null) {
104
+		if ( ! is_admin()) {
105 105
 			// set request post_id
106
-			$this->set( 'post_id', $this->get_post_id_from_request( $wp ));
106
+			$this->set('post_id', $this->get_post_id_from_request($wp));
107 107
 			// set request post name
108
-			$this->set( 'post_name', $this->get_post_name_from_request( $wp ));
108
+			$this->set('post_name', $this->get_post_name_from_request($wp));
109 109
 			// set request post_type
110
-			$this->set( 'post_type', $this->get_post_type_from_request( $wp ));
110
+			$this->set('post_type', $this->get_post_type_from_request($wp));
111 111
 			// true or false ? is this page being used by EE ?
112 112
 			$this->set_espresso_page();
113 113
 		}
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 	 * @param WP $wp
123 123
 	 * @return int
124 124
 	 */
125
-	public function get_post_id_from_request( $wp = null ) {
126
-		if ( ! $wp instanceof WP ){
125
+	public function get_post_id_from_request($wp = null) {
126
+		if ( ! $wp instanceof WP) {
127 127
 			global $wp;
128 128
 		}
129 129
 		$post_id = null;
130
-		if ( isset( $wp->query_vars['p'] )) {
130
+		if (isset($wp->query_vars['p'])) {
131 131
 			$post_id = $wp->query_vars['p'];
132 132
 		}
133
-		if ( ! $post_id && isset( $wp->query_vars['page_id'] )) {
133
+		if ( ! $post_id && isset($wp->query_vars['page_id'])) {
134 134
 			$post_id = $wp->query_vars['page_id'];
135 135
 		}
136
-		if ( ! $post_id && isset( $wp->request )) {
137
-			if ( is_numeric( basename( $wp->request ))) {
138
-				$post_id = basename( $wp->request );
136
+		if ( ! $post_id && isset($wp->request)) {
137
+			if (is_numeric(basename($wp->request))) {
138
+				$post_id = basename($wp->request);
139 139
 			}
140 140
 		}
141 141
 		return $post_id;
@@ -150,35 +150,35 @@  discard block
 block discarded – undo
150 150
 	 * @param WP $wp
151 151
 	 * @return string
152 152
 	 */
153
-	public function get_post_name_from_request( $wp = null ) {
154
-		if ( ! $wp instanceof WP ){
153
+	public function get_post_name_from_request($wp = null) {
154
+		if ( ! $wp instanceof WP) {
155 155
 			global $wp;
156 156
 		}
157 157
 		$post_name = null;
158
-		if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) {
158
+		if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) {
159 159
 			$post_name = $wp->query_vars['name'];
160 160
 		}
161
-		if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) {
161
+		if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) {
162 162
 			$post_name = $wp->query_vars['pagename'];
163 163
 		}
164
-		if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) {
165
-			$possible_post_name = basename( $wp->request );
166
-			if ( ! is_numeric( $possible_post_name )) {
164
+		if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) {
165
+			$possible_post_name = basename($wp->request);
166
+			if ( ! is_numeric($possible_post_name)) {
167 167
 				/** @type WPDB $wpdb */
168 168
 				global $wpdb;
169 169
 				$SQL = "SELECT ID from $wpdb->posts WHERE post_status='publish' AND post_name=%s";
170
-				$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name ));
171
-				if ( $possible_post_name ) {
170
+				$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name));
171
+				if ($possible_post_name) {
172 172
 					$post_name = $possible_post_name;
173 173
 				}
174 174
 			}
175 175
 		}
176
-		if ( ! $post_name && $this->get( 'post_id' )) {
176
+		if ( ! $post_name && $this->get('post_id')) {
177 177
 			/** @type WPDB $wpdb */
178 178
 			global $wpdb;
179 179
 			$SQL = "SELECT post_name from $wpdb->posts WHERE post_status='publish' AND ID=%d";
180
-			$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' )));
181
-			if( $possible_post_name ) {
180
+			$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id')));
181
+			if ($possible_post_name) {
182 182
 				$post_name = $possible_post_name;
183 183
 			}
184 184
 		}
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 	 * @param WP $wp
195 195
 	 * @return mixed
196 196
 	 */
197
-	public function get_post_type_from_request( $wp = null ) {
198
-		if ( ! $wp instanceof WP ){
197
+	public function get_post_type_from_request($wp = null) {
198
+		if ( ! $wp instanceof WP) {
199 199
 			global $wp;
200 200
 		}
201
-		return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null;
201
+		return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null;
202 202
 	}
203 203
 
204 204
 
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
 	 * @param  WP $wp
209 209
 	 * @return bool|string|void
210 210
 	 */
211
-	public function get_current_page_permalink( $wp = null ) {
212
-		$post_id = $this->get_post_id_from_request( $wp );
213
-		if ( $post_id ) {
214
-			$current_page_permalink = get_permalink( $post_id );
211
+	public function get_current_page_permalink($wp = null) {
212
+		$post_id = $this->get_post_id_from_request($wp);
213
+		if ($post_id) {
214
+			$current_page_permalink = get_permalink($post_id);
215 215
 		} else {
216
-			if ( ! $wp instanceof WP ) {
216
+			if ( ! $wp instanceof WP) {
217 217
 				global $wp;
218 218
 			}
219
-			if ( $wp->request ) {
220
-				$current_page_permalink = site_url( $wp->request );
219
+			if ($wp->request) {
220
+				$current_page_permalink = site_url($wp->request);
221 221
 			} else {
222
-				$current_page_permalink = esc_url( site_url( $_SERVER[ 'REQUEST_URI' ] ) );
222
+				$current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI']));
223 223
 			}
224 224
 		}
225 225
 		return $current_page_permalink;
@@ -236,41 +236,41 @@  discard block
 block discarded – undo
236 236
 	public function test_for_espresso_page() {
237 237
 		global $wp;
238 238
 		/** @type EE_CPT_Strategy $EE_CPT_Strategy */
239
-		$EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' );
239
+		$EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy');
240 240
 		$espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies();
241
-		if ( is_array( $espresso_CPT_taxonomies ) ) {
242
-			foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) {
243
-				if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) {
241
+		if (is_array($espresso_CPT_taxonomies)) {
242
+			foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) {
243
+				if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) {
244 244
 					return true;
245 245
 				}
246 246
 			}
247 247
 		}
248 248
 		// load espresso CPT endpoints
249 249
 		$espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints();
250
-		$post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints );
251
-		$post_types = (array)$this->get( 'post_type' );
252
-		foreach ( $post_types as $post_type ) {
250
+		$post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
251
+		$post_types = (array) $this->get('post_type');
252
+		foreach ($post_types as $post_type) {
253 253
 			// was a post name passed ?
254
-			if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) {
254
+			if (isset($post_type_CPT_endpoints[$post_type])) {
255 255
 				// kk we know this is an espresso page, but is it a specific post ?
256
-				if ( ! $this->get( 'post_name' ) ) {
256
+				if ( ! $this->get('post_name')) {
257 257
 					// there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
258
-					$post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null;
258
+					$post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null;
259 259
 					// if the post type matches on of our then set the endpoint
260
-					if ( $post_name ) {
261
-						$this->set( 'post_name', $post_name );
260
+					if ($post_name) {
261
+						$this->set('post_name', $post_name);
262 262
 					}
263 263
 				}
264 264
 				return true;
265 265
 			}
266 266
 		}
267
-		if ( $this->get( 'post_name' )) {
267
+		if ($this->get('post_name')) {
268 268
 			// load all pages using espresso shortcodes
269
-			$post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
269
+			$post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
270 270
 			// make sure core pages are included
271
-			$espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes );
271
+			$espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes);
272 272
 			// was a post name passed ?
273
-			if (  isset( $espresso_pages[ $this->get( 'post_name' ) ] )) {
273
+			if (isset($espresso_pages[$this->get('post_name')])) {
274 274
 				 return true;
275 275
 			}
276 276
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * @param null $value
287 287
 	 * @return    mixed
288 288
 	 */
289
-	public function set_espresso_page( $value = null ) {
289
+	public function set_espresso_page($value = null) {
290 290
 		$value = $value ? $value : $this->test_for_espresso_page();
291 291
 		$this->_params['is_espresso_page'] = $value;
292 292
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 *  @return 	mixed
301 301
 	 */
302 302
 	public function is_espresso_page() {
303
-		return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false;
303
+		return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false;
304 304
 	}
305 305
 
306 306
 
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 * @param bool $override_ee
325 325
 	 * @return    void
326 326
 	 */
327
-	public function set( $key, $value, $override_ee = false ) {
327
+	public function set($key, $value, $override_ee = false) {
328 328
 		// don't allow "ee" to be overwritten unless explicitly instructed to do so
329
-		if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) {
330
-			$this->_params[ $key ] = $value;
329
+		if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) {
330
+			$this->_params[$key] = $value;
331 331
 		}
332 332
 	}
333 333
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * @param null $default
342 342
 	 * @return    mixed
343 343
 	 */
344
-	public function get( $key, $default = null ) {
345
-		return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default;
344
+	public function get($key, $default = null) {
345
+		return isset($this->_params[$key]) ? $this->_params[$key] : $default;
346 346
 	}
347 347
 
348 348
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param $key
355 355
 	 * @return    boolean
356 356
 	 */
357
-	public function is_set( $key ) {
358
-		return isset( $this->_params[ $key ] ) ? true : false;
357
+	public function is_set($key) {
358
+		return isset($this->_params[$key]) ? true : false;
359 359
 	}
360 360
 
361 361
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 * @param $key
368 368
 	 * @return    void
369 369
 	 */
370
-	public function un_set( $key ) {
371
-		unset( $this->_params[ $key ] );
370
+	public function un_set($key) {
371
+		unset($this->_params[$key]);
372 372
 	}
373 373
 
374 374
 
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 	 * @param $value
382 382
 	 * @return    void
383 383
 	 */
384
-	public function set_notice( $key, $value ) {
385
-		$this->_notice[ $key ] = $value;
384
+	public function set_notice($key, $value) {
385
+		$this->_notice[$key] = $value;
386 386
 	}
387 387
 
388 388
 
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param $key
395 395
 	 * @return    mixed
396 396
 	 */
397
-	public function get_notice( $key ) {
398
-		return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null;
397
+	public function get_notice($key) {
398
+		return isset($this->_notice[$key]) ? $this->_notice[$key] : null;
399 399
 	}
400 400
 
401 401
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @param $string
408 408
 	 * @return    void
409 409
 	 */
410
-	public function add_output( $string ) {
410
+	public function add_output($string) {
411 411
 		$this->_output .= $string;
412 412
 	}
413 413
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 * @param $item
430 430
 	 * @param $key
431 431
 	 */
432
-	function sanitize_text_field_for_array_walk( &$item, &$key ) {
433
-		$item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item );
432
+	function sanitize_text_field_for_array_walk(&$item, &$key) {
433
+		$item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item);
434 434
 	}
435 435
 
436 436
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @param $b
441 441
 	 * @return bool
442 442
 	 */
443
-	public function __set($a,$b) { return false; }
443
+	public function __set($a, $b) { return false; }
444 444
 
445 445
 
446 446
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -715,7 +715,7 @@
 block discarded – undo
715 715
 				}
716 716
 			}
717 717
 		}
718
-        }
718
+		}
719 719
 	/**
720 720
 	 * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
721 721
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
Please login to merge, or discard this patch.
core/db_models/EEM_Event.model.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 
180 180
 
181 181
 	/**
182
-	*		get_question_groups
183
-	*
184
-	* 		@access		public
185
-	*		@return 		array
186
-	*/
182
+	 *		get_question_groups
183
+	 *
184
+	 * 		@access		public
185
+	 *		@return 		array
186
+	 */
187 187
 	public function get_all_question_groups() {
188 188
 		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
189 189
 			array( 'QSG_deleted' => FALSE ),
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 	/**
200
-	*		get_question_groups
201
-	*
202
-	* 		@access		public
203
-	* 		@param		int $EVT_ID
204
-	*		@return 		array
205
-	*/
200
+	 *		get_question_groups
201
+	 *
202
+	 * 		@access		public
203
+	 * 		@param		int $EVT_ID
204
+	 *		@return 		array
205
+	 */
206 206
 	public function get_all_event_question_groups( $EVT_ID = 0 ) {
207 207
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
208 208
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
 	/**
221
-	*		get_question_groups
222
-	*
223
-	* 		@access		public
224
-	* 		@param		int $EVT_ID
225
-	* 		@param		boolean	$for_primary_attendee
226
-	*		@return 		array
227
-	*/
221
+	 *		get_question_groups
222
+	 *
223
+	 * 		@access		public
224
+	 * 		@param		int $EVT_ID
225
+	 * 		@param		boolean	$for_primary_attendee
226
+	 *		@return 		array
227
+	 */
228 228
 	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
229 229
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
230 230
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 	/**
244
-	*		get_question_groups
245
-	*
246
-	* 		@access		public
247
-	* 		@param		int $EVT_ID
248
-	* 		@param		EE_Registration 	$registration
249
-	*		@return 		array
250
-	*/
244
+	 *		get_question_groups
245
+	 *
246
+	 * 		@access		public
247
+	 * 		@param		int $EVT_ID
248
+	 * 		@param		EE_Registration 	$registration
249
+	 *		@return 		array
250
+	 */
251 251
 	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
252 252
 
253 253
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 
276 276
 
277 277
 	/**
278
-	*		get_question_target_db_column
279
-	*
280
-	* 		@access		public
281
-	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
-	*		@return 		array
283
-	*/
278
+	 *		get_question_target_db_column
279
+	 *
280
+	 * 		@access		public
281
+	 * 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
+	 *		@return 		array
283
+	 */
284 284
 	public function get_questions_in_groups( $QSG_IDs = '' ) {
285 285
 
286 286
 		if ( empty( $QSG_IDs )) {
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 
307 307
 
308 308
 	/**
309
-	*		get_options_for_question
310
-	*
311
-	* 		@access		public
312
-	* 		@param		string		$QST_IDs  csv list of $QST IDs
313
-	*		@return 		array
314
-	*/
309
+	 *		get_options_for_question
310
+	 *
311
+	 * 		@access		public
312
+	 * 		@param		string		$QST_IDs  csv list of $QST IDs
313
+	 *		@return 		array
314
+	 */
315 315
 	public function get_options_for_question( $QST_IDs ) {
316 316
 
317 317
 		if ( empty( $QST_IDs )) {
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 	/**
399
-	*		_get_question_target_db_column
400
-	*
401
-	* 		@access		private
402
-	* 		@param		$QST
403
-	*		@return 		string		string
404
-	*/
399
+	 *		_get_question_target_db_column
400
+	 *
401
+	 * 		@access		private
402
+	 * 		@param		$QST
403
+	 *		@return 		string		string
404
+	 */
405 405
 	private function _generate_question_input_name( $QST ) {
406 406
 
407 407
 		if ( $QST->QST_system ) {
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
2
+require_once(EE_MODELS.'EEM_CPT_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * EEM_Event Model
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author				Michael Nelson, Brent Christensen
12 12
  *
13 13
  */
14
-class EEM_Event  extends EEM_CPT_Base{
14
+class EEM_Event  extends EEM_CPT_Base {
15 15
 
16 16
 	/**
17 17
 	 * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 	 * @param string $timezone
52 52
 	 * @return EEM_Event
53 53
 	 */
54
-	public static function instance( $timezone = NULL ){
54
+	public static function instance($timezone = NULL) {
55 55
 
56 56
 		// check if instance of EEM_Event already exists
57
-		if ( ! self::$_instance instanceof EEM_Event ) {
57
+		if ( ! self::$_instance instanceof EEM_Event) {
58 58
 			// instantiate Espresso_model
59
-			self::$_instance = new self( $timezone );
59
+			self::$_instance = new self($timezone);
60 60
 		}
61 61
 		//we might have a timezone set, let set_timezone decide what to do with it
62
-		self::$_instance->set_timezone( $timezone );
62
+		self::$_instance->set_timezone($timezone);
63 63
 		// EEM_Event object
64 64
 		return self::$_instance;
65 65
 	}
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	 * @param string $timezone
71 71
 	 * @return EEM_Event
72 72
 	 */
73
-	protected function __construct($timezone = null){
73
+	protected function __construct($timezone = null) {
74 74
 
75
-		EE_Registry::instance()->load_model( 'Registration' );
75
+		EE_Registry::instance()->load_model('Registration');
76 76
 
77
-		$this->singular_item = __('Event','event_espresso');
78
-		$this->plural_item = __('Events','event_espresso');
77
+		$this->singular_item = __('Event', 'event_espresso');
78
+		$this->plural_item = __('Events', 'event_espresso');
79 79
 
80 80
 		// to remove Cancelled events from the frontend, copy the following filter to your functions.php file
81 81
 		// add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' );
@@ -89,57 +89,57 @@  discard block
 block discarded – undo
89 89
 			array(
90 90
 				EEM_Event::cancelled => array(
91 91
 					'label' => __('Cancelled', 'event_espresso'),
92
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE )
92
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE)
93 93
 				),
94 94
 				EEM_Event::postponed => array(
95 95
 					'label' => __('Postponed', 'event_espresso'),
96
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE )
96
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE)
97 97
 				),
98 98
 				EEM_Event::sold_out => array(
99 99
 					'label' => __('Sold Out', 'event_espresso'),
100
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE )
100
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE)
101 101
 				)
102 102
 			)
103 103
 		);
104 104
 
105
-		self::$_default_reg_status = empty( self::$_default_reg_status ) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status;
105
+		self::$_default_reg_status = empty(self::$_default_reg_status) ? EEM_Registration::status_id_pending_payment : self::$_default_reg_status;
106 106
 
107 107
 		$this->_tables = array(
108
-			'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ),
109
-			'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' )
108
+			'Event_CPT'=>new EE_Primary_Table('posts', 'ID'),
109
+			'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID')
110 110
 		);
111 111
 
112 112
 		$this->_fields = array(
113 113
 			'Event_CPT'=>array(
114
-				'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )),
115
-				'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ),
116
-				'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ),
117
-				'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ),
118
-				'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, time()),
119
-				'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ),
120
-				'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, time()),
121
-				'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE),
122
-				'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ),
123
-				'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ),
124
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
125
-				'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati )
114
+				'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')),
115
+				'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''),
116
+				'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''),
117
+				'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''),
118
+				'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, time()),
119
+				'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''),
120
+				'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, time()),
121
+				'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE),
122
+				'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0),
123
+				'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1),
124
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
125
+				'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati)
126 126
 			),
127 127
 			'Event_Meta'=>array(
128
-				'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ),
129
-				'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ),
130
-				'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ),
131
-				'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ),
132
-				'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, time()),
133
-				'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ),
128
+				'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE),
129
+				'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE),
130
+				'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1),
131
+				'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1),
132
+				'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, time()),
133
+				'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10),
134 134
 				'EVT_default_registration_status'=>new EE_Enum_Text_Field(
135
-					'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array()
135
+					'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array()
136 136
 				),
137
-				'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ),
138
-				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ),
139
-				'EVT_allow_overflow'=>new EE_Boolean_Field(  'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ),
140
-				'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ),
141
-				'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ),
142
-				'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE )
137
+				'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE),
138
+				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE),
139
+				'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE),
140
+				'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE),
141
+				'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE),
142
+				'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE)
143 143
 
144 144
 			));
145 145
 
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 			'WP_User' => new EE_Belongs_To_Relation(),
155 155
 		);
156 156
 		//this model is generally available for reading
157
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
158
-		parent::__construct( $timezone );
157
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
158
+		parent::__construct($timezone);
159 159
 	}
160 160
 
161 161
 
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	/**
164 164
 	 * @param string $default_reg_status
165 165
 	 */
166
-	public static function set_default_reg_status( $default_reg_status ) {
166
+	public static function set_default_reg_status($default_reg_status) {
167 167
 		self::$_default_reg_status = $default_reg_status;
168 168
 		//if EEM_Event has already been instantiated, then we need to reset the `EVT_default_reg_status` field to use the new default.
169
-		if ( self::$_instance instanceof EEM_Event ) {
169
+		if (self::$_instance instanceof EEM_Event) {
170 170
 			self::$_instance->_fields['Event_Meta']['EVT_default_registration_status'] = new EE_Enum_Text_Field(
171
-				'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), false, $default_reg_status, EEM_Registration::reg_status_array()
171
+				'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), false, $default_reg_status, EEM_Registration::reg_status_array()
172 172
 			);
173
-			self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize( 'Event_Meta', 'EVT_default_registration_status', 'EEM_Event' );
173
+			self::$_instance->_fields['Event_Meta']['EVT_default_registration_status']->_construct_finalize('Event_Meta', 'EVT_default_registration_status', 'EEM_Event');
174 174
 		}
175 175
 	}
176 176
 
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	*		@return 		array
184 184
 	*/
185 185
 	public function get_all_question_groups() {
186
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
187
-			array( 'QSG_deleted' => FALSE ),
188
-			'order_by' => array( 'QSG_order' => 'ASC' )
186
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
187
+			array('QSG_deleted' => FALSE),
188
+			'order_by' => array('QSG_order' => 'ASC')
189 189
 		));
190 190
 	}
191 191
 
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	* 		@param		int $EVT_ID
202 202
 	*		@return 		array
203 203
 	*/
204
-	public function get_all_event_question_groups( $EVT_ID = 0 ) {
205
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
206
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
204
+	public function get_all_event_question_groups($EVT_ID = 0) {
205
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
206
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
207 207
 			return FALSE;
208 208
 		}
209
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
210
-			array( 'EVT_ID' => $EVT_ID )
209
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
210
+			array('EVT_ID' => $EVT_ID)
211 211
 		));
212 212
 	}
213 213
 
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 	* 		@param		boolean	$for_primary_attendee
224 224
 	*		@return 		array
225 225
 	*/
226
-	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
227
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
228
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
226
+	public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) {
227
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
228
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
229 229
 			return FALSE;
230 230
 		}
231
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
232
-			array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee )
231
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
232
+			array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee)
233 233
 		));
234 234
 	}
235 235
 
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 	* 		@param		EE_Registration 	$registration
247 247
 	*		@return 		array
248 248
 	*/
249
-	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
249
+	public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) {
250 250
 
251
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
252
-			EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
251
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
252
+			EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
253 253
 			return FALSE;
254 254
 		}
255 255
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 			'QSG_deleted' => FALSE
260 260
 		);
261 261
 
262
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
262
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
263 263
 			$where_params,
264 264
 			'order_by' => array('QSG_order' => 'ASC')
265 265
 		));
@@ -279,16 +279,16 @@  discard block
 block discarded – undo
279 279
 	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
280 280
 	*		@return 		array
281 281
 	*/
282
-	public function get_questions_in_groups( $QSG_IDs = '' ) {
282
+	public function get_questions_in_groups($QSG_IDs = '') {
283 283
 
284
-		if ( empty( $QSG_IDs )) {
285
-			EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
284
+		if (empty($QSG_IDs)) {
285
+			EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
286 286
 			return FALSE;
287 287
 		}
288 288
 
289
-		return EE_Registry::instance()->load_model( 'Question' )->get_all( array(
289
+		return EE_Registry::instance()->load_model('Question')->get_all(array(
290 290
 			array(
291
-				'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ),
291
+				'Question_Group.QSG_ID' => array('IN', $QSG_IDs),
292 292
 				'QST_deleted' => FALSE,
293 293
 				'QST_admin_only' => is_admin()
294 294
 			),
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
 	* 		@param		string		$QST_IDs  csv list of $QST IDs
311 311
 	*		@return 		array
312 312
 	*/
313
-	public function get_options_for_question( $QST_IDs ) {
313
+	public function get_options_for_question($QST_IDs) {
314 314
 
315
-		if ( empty( $QST_IDs )) {
316
-			EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
315
+		if (empty($QST_IDs)) {
316
+			EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
317 317
 			return FALSE;
318 318
 		}
319 319
 
320
-		return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array(
320
+		return EE_Registry::instance()->load_model('Question_Option')->get_all(array(
321 321
 			array(
322
-				'Question.QST_ID' => array( 'IN', $QST_IDs ),
322
+				'Question.QST_ID' => array('IN', $QST_IDs),
323 323
 				'QSO_deleted' => FALSE
324 324
 			),
325 325
 			'order_by' => 'QSO_ID'
@@ -338,46 +338,46 @@  discard block
 block discarded – undo
338 338
 	 * @throws EE_Error
339 339
 	 * @return 	array
340 340
 	 */
341
-	public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) {
341
+	public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) {
342 342
 
343
-		if ( empty( $EVT_ID ) ) {
344
-			throw new EE_Error( __( 'An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso' ) );
343
+		if (empty($EVT_ID)) {
344
+			throw new EE_Error(__('An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso'));
345 345
 		}
346 346
 
347 347
 		$questions = array();
348 348
 
349 349
 		// get all question groups for event
350
-		$qgs = $this->get_question_groups_for_event( $EVT_ID, $registration );
351
-		if ( !empty( $qgs ) ) {
352
-			foreach ( $qgs as $qg ) {
350
+		$qgs = $this->get_question_groups_for_event($EVT_ID, $registration);
351
+		if ( ! empty($qgs)) {
352
+			foreach ($qgs as $qg) {
353 353
 			 	$qsts = $qg->questions();
354
-			 	$questions[ $qg->ID() ] = $qg->model_field_array();
355
-			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
356
-			 	foreach ( $qsts as $qst ) {
357
-			 		if ( $qst->is_system_question() )
354
+			 	$questions[$qg->ID()] = $qg->model_field_array();
355
+			 	$questions[$qg->ID()]['QSG_questions'] = array();
356
+			 	foreach ($qsts as $qst) {
357
+			 		if ($qst->is_system_question())
358 358
 			 			continue;
359
-			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
359
+			 		$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID())));
360 360
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
361 361
 			 		$qst_name = $qstn_id = $qst->ID();
362 362
 			 		$ans_id = $answer->ID();
363
-			 		$qst_name = !empty( $ans_id ) ?  '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']';
363
+			 		$qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']';
364 364
 			 		$input_name = '';
365
-			 		$input_id = sanitize_key( $qst->display_text() );
365
+			 		$input_id = sanitize_key($qst->display_text());
366 366
 			 		$input_class = '';
367 367
 			 		$questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array();
368
-		 			$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name;
369
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id;
370
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class;
371
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array();
372
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst;
373
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer;
368
+		 			$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name;
369
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id;
370
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class;
371
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array();
372
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst;
373
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer;
374 374
 					//leave responses as-is, don't convert stuff into html entities please!
375
-					$questions[ $qg->ID() ][ 'QSG_questions'][ $qst->ID() ][ 'htmlentities' ] = false;
376
-					if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) {
377
-						$QSOs = $qst->options(TRUE,$answer->value());
378
-						if ( is_array( $QSOs ) ) {
379
-							foreach ( $QSOs as $QSO_ID => $QSO ) {
380
-								$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array();
375
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['htmlentities'] = false;
376
+					if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') {
377
+						$QSOs = $qst->options(TRUE, $answer->value());
378
+						if (is_array($QSOs)) {
379
+							foreach ($QSOs as $QSO_ID => $QSO) {
380
+								$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array();
381 381
 							}
382 382
 						}
383 383
 					}
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 	* 		@param		$QST
402 402
 	*		@return 		string		string
403 403
 	*/
404
-	private function _generate_question_input_name( $QST ) {
404
+	private function _generate_question_input_name($QST) {
405 405
 
406
-		if ( $QST->QST_system ) {
406
+		if ($QST->QST_system) {
407 407
 			$qst_name = $QST->QST_system;
408 408
 /*			switch( $QST->QST_system ) {
409 409
 
@@ -470,36 +470,36 @@  discard block
 block discarded – undo
470 470
 	 * @param bool    $count whether to return the count or not (default FALSE)
471 471
 	 * @return array 	EE_Event objects
472 472
 	 */
473
-	public function get_active_events( $query_params, $count = FALSE ) {
474
-		if ( array_key_exists( 0, $query_params ) ) {
473
+	public function get_active_events($query_params, $count = FALSE) {
474
+		if (array_key_exists(0, $query_params)) {
475 475
 			$where_params = $query_params[0];
476
-			unset( $query_params[0] );
476
+			unset($query_params[0]);
477 477
 		} else {
478 478
 			$where_params = array();
479 479
 		}
480 480
 
481 481
 		//if we have count make sure we don't include group by
482
-		if ( $count && isset( $query_params['group_by'] ) ) {
483
-			unset( $query_params['group_by'] );
482
+		if ($count && isset($query_params['group_by'])) {
483
+			unset($query_params['group_by']);
484 484
 		}
485 485
 
486 486
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
487 487
 		$where_params['status'] = 'publish';
488 488
 		//if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions
489
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
490
-			$where_params['Datetime.DTT_EVT_start******'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
489
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
490
+			$where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
491 491
 		} else {
492
-			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
492
+			$where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
493 493
 		}
494 494
 
495
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
496
-			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
495
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
496
+			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
497 497
 		} else {
498
-			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
498
+			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
499 499
 		}
500 500
 		$query_params[0] = $where_params;
501 501
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
502
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
502
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
503 503
 	}
504 504
 
505 505
 
@@ -514,30 +514,30 @@  discard block
 block discarded – undo
514 514
 	 * @param bool    $count whether to return the count or not (default FALSE)
515 515
 	 * @return array               EE_Event objects
516 516
 	 */
517
-	public function get_upcoming_events( $query_params, $count = FALSE ) {
518
-		if ( array_key_exists( 0, $query_params ) ) {
517
+	public function get_upcoming_events($query_params, $count = FALSE) {
518
+		if (array_key_exists(0, $query_params)) {
519 519
 			$where_params = $query_params[0];
520
-			unset( $query_params[0] );
520
+			unset($query_params[0]);
521 521
 		} else {
522 522
 			$where_params = array();
523 523
 		}
524 524
 
525 525
 		//if we have count make sure we don't include group by
526
-		if ( $count && isset( $query_params['group_by'] ) ) {
527
-			unset( $query_params['group_by'] );
526
+		if ($count && isset($query_params['group_by'])) {
527
+			unset($query_params['group_by']);
528 528
 		}
529 529
 
530 530
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
531 531
 		$where_params['status'] = 'publish';
532 532
 		//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
533
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
534
-			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
533
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
534
+			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
535 535
 		} else {
536
-			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
536
+			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
537 537
 		}
538 538
 		$query_params[0] = $where_params;
539 539
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
540
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
540
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
541 541
 	}
542 542
 
543 543
 
@@ -549,56 +549,56 @@  discard block
 block discarded – undo
549 549
 	 * @param bool    $count whether to return the count or not (default FALSE)
550 550
 	 * @return array 	EE_Event objects
551 551
 	 */
552
-	public function get_expired_events( $query_params, $count = FALSE ) {
552
+	public function get_expired_events($query_params, $count = FALSE) {
553 553
 
554
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
554
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
555 555
 
556 556
 		//if we have count make sure we don't include group by
557
-		if ( $count && isset( $query_params['group_by'] ) ) {
558
-			unset( $query_params['group_by'] );
557
+		if ($count && isset($query_params['group_by'])) {
558
+			unset($query_params['group_by']);
559 559
 		}
560 560
 
561 561
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
562
-		if ( isset( $where_params['status'] ) ) {
563
-			unset( $where_params['status'] );
562
+		if (isset($where_params['status'])) {
563
+			unset($where_params['status']);
564 564
 		}
565 565
 		$exclude_query = $query_params;
566
-		if ( isset( $exclude_query[0] ) ) {
567
-			unset( $exclude_query[0] );
566
+		if (isset($exclude_query[0])) {
567
+			unset($exclude_query[0]);
568 568
 		}
569
-		$exclude_query[0] = array( 'Datetime.DTT_EVT_end' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) );
569
+		$exclude_query[0] = array('Datetime.DTT_EVT_end' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')));
570 570
 		//first get all events that have datetimes where its not expired.
571
-		$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Event_CPT.ID' );
572
-		$event_ids = array_keys( $event_ids );
571
+		$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Event_CPT.ID');
572
+		$event_ids = array_keys($event_ids);
573 573
 
574 574
 		//if we have any additional query_params, let's add them to the 'AND' condition
575 575
 		$and_condition = array(
576
-			'Datetime.DTT_EVT_end' => array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ),
577
-			'EVT_ID' =>  array( 'NOT IN', $event_ids )
576
+			'Datetime.DTT_EVT_end' => array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')),
577
+			'EVT_ID' =>  array('NOT IN', $event_ids)
578 578
 			);
579 579
 
580
-		if ( isset( $where_params['OR'] ) ) {
580
+		if (isset($where_params['OR'])) {
581 581
 			$and_condition['OR'] = $where_params['OR'];
582
-			unset( $where_params['OR'] );
582
+			unset($where_params['OR']);
583 583
 		}
584 584
 
585
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
585
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
586 586
 			$and_condition['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
587
-			unset( $where_params['Datetime.DTT_EVT_end'] );
587
+			unset($where_params['Datetime.DTT_EVT_end']);
588 588
 		}
589 589
 
590
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
590
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
591 591
 			$and_condition['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
592
-			unset( $where_params['Datetime.DTT_EVT_start'] );
592
+			unset($where_params['Datetime.DTT_EVT_start']);
593 593
 		}
594 594
 
595 595
 		//merge remaining $where params with the and conditions.
596
-		$and_condtion = array_merge( $and_condition, $where_params );
596
+		$and_condtion = array_merge($and_condition, $where_params);
597 597
 
598 598
 		$where_params['AND'] = $and_condition;
599 599
 		$query_params[0] = $where_params;
600 600
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
601
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
601
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
602 602
 	}
603 603
 
604 604
 
@@ -609,40 +609,40 @@  discard block
 block discarded – undo
609 609
 	 * @param  boolean $count        whether to return the count or not (default FALSE)
610 610
 	 * @return EE_Event[]            array of EE_Event objects
611 611
 	 */
612
-	public function get_inactive_events( $query_params, $count = FALSE ) {
613
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
612
+	public function get_inactive_events($query_params, $count = FALSE) {
613
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
614 614
 
615 615
 		//let's add in specific query_params for inactive events.
616
-		if ( isset( $where_params['status'] ) ) {
617
-			unset( $where_params['status'] );
616
+		if (isset($where_params['status'])) {
617
+			unset($where_params['status']);
618 618
 		}
619 619
 
620 620
 		//if we have count make sure we don't include group by
621
-		if ( $count && isset( $query_params['group_by'] ) ) {
622
-			unset( $query_params['group_by'] );
621
+		if ($count && isset($query_params['group_by'])) {
622
+			unset($query_params['group_by']);
623 623
 		}
624 624
 
625 625
 		//if we have any additional query_params, let's add them to the 'AND' condition
626
-		$where_params['AND']['status'] = array( '!=', 'publish' );
626
+		$where_params['AND']['status'] = array('!=', 'publish');
627 627
 
628
-		if ( isset( $where_params['OR'] ) ) {
628
+		if (isset($where_params['OR'])) {
629 629
 			$where_params['AND']['OR'] = $where_params['OR'];
630
-			unset( $where_params['OR'] );
630
+			unset($where_params['OR']);
631 631
 		}
632 632
 
633
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
633
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
634 634
 			$where_params['AND']['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
635
-			unset( $where_params['Datetime.DTT_EVT_end'] );
635
+			unset($where_params['Datetime.DTT_EVT_end']);
636 636
 		}
637 637
 
638
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
638
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
639 639
 			$where_params['AND']['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
640
-			unset( $where_params['Datetime.DTT_EVT_start'] );
640
+			unset($where_params['Datetime.DTT_EVT_start']);
641 641
 		}
642 642
 
643 643
 		$query_params[0] = $where_params;
644 644
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
645
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
645
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
646 646
 	}
647 647
 
648 648
 
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
 	 * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event.
651 651
 	 * See parent for param descriptions
652 652
 	 */
653
-	public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){
653
+	public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) {
654 654
 
655
-		if ( $relationName == 'Price' ) {
655
+		if ($relationName == 'Price') {
656 656
 			//let's get the PRC object for the given ID to make sure that we aren't dealing with a default
657 657
 			$prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj);
658 658
 			//if EVT_ID = 0, then this is a default
659
-			if ( $prc_chk->get('EVT_ID') == 0 ) {
659
+			if ($prc_chk->get('EVT_ID') == 0) {
660 660
 				//let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation
661 661
 				$prc_chk->set('PRC_ID', 0);
662 662
 			}
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		}
667 667
 
668 668
 		//otherwise carry on as normal
669
-		return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query);
669
+		return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query);
670 670
 	}
671 671
 
672 672
 
Please login to merge, or discard this patch.
core/db_classes/EE_Checkin.class.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 3
 /**
4
- * Event Espresso
5
- *
6
- * Event Registration and Management Plugin for WordPress
7
- *
8
- * @ package			Event Espresso
9
- * @ author				Seth Shoultes
10
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
11
- * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
12
- * @ link					{@link http://www.eventespresso.com}
13
- * @ since		 		4.0
14
- *
15
- */
4
+	 * Event Espresso
5
+	 *
6
+	 * Event Registration and Management Plugin for WordPress
7
+	 *
8
+	 * @ package			Event Espresso
9
+	 * @ author				Seth Shoultes
10
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
11
+	 * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing *
12
+	 * @ link					{@link http://www.eventespresso.com}
13
+	 * @ since		 		4.0
14
+	 *
15
+	 */
16 16
 
17 17
 
18 18
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * Event Espresso
5 5
  *
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @subpackage		includes/classes/EE_Checkin.class.php
24 24
  * @author				Darren Ethier
25 25
  */
26
-class EE_Checkin extends EE_Base_Class{
26
+class EE_Checkin extends EE_Base_Class {
27 27
 
28 28
 	/**
29 29
 	 *
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 *                             		    date_format and the second value is the time format
35 35
 	 * @return EE_Checkin
36 36
 	 */
37
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
38
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
39
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
37
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
38
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
39
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
40 40
 	}
41 41
 
42 42
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 *                          		the website will be used.
48 48
 	 * @return EE_Checkin
49 49
 	 */
50
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
51
-		return new self( $props_n_values, TRUE, $timezone );
50
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
51
+		return new self($props_n_values, TRUE, $timezone);
52 52
 	}
53 53
 
54 54
 
Please login to merge, or discard this patch.