Completed
Branch BUG-9647-cpt-queries (303307)
by
unknown
201:19 queued 184:10
created
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -69,101 +69,101 @@  discard block
 block discarded – undo
69 69
 	 * @param array        $options
70 70
 	 * @return mixed
71 71
 	 */
72
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
72
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
73 73
 
74 74
 		$html = '';
75 75
 		// set some default options and merge with incoming
76 76
 		$default_options = array(
77
-			'show_desc' => true,  // 	true 		false
77
+			'show_desc' => true, // 	true 		false
78 78
 			'odd' => false
79 79
 		);
80
-		$options = array_merge( $default_options, (array)$options );
80
+		$options = array_merge($default_options, (array) $options);
81 81
 
82
-		switch( $line_item->type() ) {
82
+		switch ($line_item->type()) {
83 83
 
84 84
 			case EEM_Line_Item::type_line_item:
85 85
 				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
86
-				if ( $line_item->OBJ_type() == 'Ticket' ) {
86
+				if ($line_item->OBJ_type() == 'Ticket') {
87 87
 					// item row
88
-					$html .= $this->_ticket_row( $line_item, $options );
88
+					$html .= $this->_ticket_row($line_item, $options);
89 89
 					// got any kids?
90
-					foreach ( $line_item->children() as $child_line_item ) {
91
-						$this->display_line_item( $child_line_item, $options );
90
+					foreach ($line_item->children() as $child_line_item) {
91
+						$this->display_line_item($child_line_item, $options);
92 92
 					}
93 93
 				} else {
94 94
 					// item row
95
-					$html .= $this->_item_row( $line_item, $options );
95
+					$html .= $this->_item_row($line_item, $options);
96 96
 					// got any kids?
97
-					foreach ( $line_item->children() as $child_line_item ) {
98
-						$this->display_line_item( $child_line_item, $options );
97
+					foreach ($line_item->children() as $child_line_item) {
98
+						$this->display_line_item($child_line_item, $options);
99 99
 					}
100 100
 				}
101 101
 				break;
102 102
 
103 103
 			case EEM_Line_Item::type_sub_line_item:
104
-				$html .= $this->_sub_item_row( $line_item, $options );
104
+				$html .= $this->_sub_item_row($line_item, $options);
105 105
 				break;
106 106
 
107 107
 			case EEM_Line_Item::type_sub_total:
108 108
 				static $sub_total = 0;
109 109
 				$event_sub_total = 0;
110
-				$text = __( 'Sub-Total', 'event_espresso' );
111
-				if ( $line_item->OBJ_type() == 'Event' ) {
112
-					$options[ 'event_id' ] = $event_id = $line_item->OBJ_ID();
113
-					if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
114
-						$event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] );
115
-						if ( $event instanceof EE_Event ) {
116
-							if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) {
110
+				$text = __('Sub-Total', 'event_espresso');
111
+				if ($line_item->OBJ_type() == 'Event') {
112
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
113
+					if ( ! isset($this->_events[$options['event_id']])) {
114
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
115
+						if ($event instanceof EE_Event) {
116
+							if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) {
117 117
 								return '';
118 118
 							}
119 119
 						}
120
-						$this->_events[ $options[ 'event_id' ] ] = 0;
121
-						$html .= $this->_event_row( $line_item );
122
-						$text = __( 'Event Sub-Total', 'event_espresso' );
120
+						$this->_events[$options['event_id']] = 0;
121
+						$html .= $this->_event_row($line_item);
122
+						$text = __('Event Sub-Total', 'event_espresso');
123 123
 					}
124 124
 				}
125 125
 				$child_line_items = $line_item->children();
126 126
 				// loop thru children
127
-				foreach( $child_line_items as $child_line_item ) {
127
+				foreach ($child_line_items as $child_line_item) {
128 128
 					// recursively feed children back into this method
129
-					$html .= $this->display_line_item( $child_line_item, $options );
129
+					$html .= $this->display_line_item($child_line_item, $options);
130 130
 				}
131
-				$event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0;
131
+				$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
132 132
 				$sub_total += $event_sub_total;
133 133
 				if (
134 134
 					(
135 135
 						// event subtotals
136 136
 						$line_item->code() != 'pre-tax-subtotal' &&
137
-						count( $child_line_items ) > 1
137
+						count($child_line_items) > 1
138 138
 					)
139 139
 					||
140 140
 					(
141 141
 						// pre-tax subtotals
142 142
 						$line_item->code() == 'pre-tax-subtotal' &&
143
-						count( $this->_events ) > 1
143
+						count($this->_events) > 1
144 144
 					)
145 145
 				) {
146 146
 					$options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total;
147
-					$html .= $this->_sub_total_row( $line_item, $text, $options );
147
+					$html .= $this->_sub_total_row($line_item, $text, $options);
148 148
 				}
149 149
 				break;
150 150
 
151 151
 			case EEM_Line_Item::type_tax:
152
-				if ( $this->_show_taxes ) {
153
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
152
+				if ($this->_show_taxes) {
153
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
154 154
 				}
155 155
 				break;
156 156
 
157 157
 			case EEM_Line_Item::type_tax_sub_total:
158
-				if ( $this->_show_taxes ) {
158
+				if ($this->_show_taxes) {
159 159
 					$child_line_items = $line_item->children();
160 160
 					// loop thru children
161
-					foreach( $child_line_items as $child_line_item ) {
161
+					foreach ($child_line_items as $child_line_item) {
162 162
 						// recursively feed children back into this method
163
-						$html .= $this->display_line_item( $child_line_item, $options );
163
+						$html .= $this->display_line_item($child_line_item, $options);
164 164
 					}
165
-					if ( count( $child_line_items ) > 1 ) {
166
-						$this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) );
165
+					if (count($child_line_items) > 1) {
166
+						$this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso'));
167 167
 					}
168 168
 				}
169 169
 				break;
@@ -172,25 +172,25 @@  discard block
 block discarded – undo
172 172
 				// get all child line items
173 173
 				$children = $line_item->children();
174 174
 				// loop thru all non-tax child line items
175
-				foreach( $children as $child_line_item ) {
176
-					if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) {
175
+				foreach ($children as $child_line_item) {
176
+					if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
177 177
 						// recursively feed children back into this method
178
-						$html .= $this->display_line_item( $child_line_item, $options );
178
+						$html .= $this->display_line_item($child_line_item, $options);
179 179
 					}
180 180
 				}
181 181
 
182 182
 				// now loop thru  tax child line items
183
-				foreach( $children as $child_line_item ) {
184
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) {
183
+				foreach ($children as $child_line_item) {
184
+					if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
185 185
 						// recursively feed children back into this method
186
-						$html .= $this->display_line_item( $child_line_item, $options );
186
+						$html .= $this->display_line_item($child_line_item, $options);
187 187
 					}
188 188
 				}
189 189
 				$html .= $this->_taxes_html;
190
-				$html .= $this->_total_row( $line_item, __('Total', 'event_espresso') );
190
+				$html .= $this->_total_row($line_item, __('Total', 'event_espresso'));
191 191
 
192 192
 
193
-				$html .= $this->_payments_and_amount_owing_rows( $line_item, $options );
193
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
194 194
 				break;
195 195
 
196 196
 		}
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	 * @param EE_Line_Item $line_item
206 206
 	 * @return mixed
207 207
 	 */
208
-	private function _event_row( EE_Line_Item $line_item ) {
208
+	private function _event_row(EE_Line_Item $line_item) {
209 209
 		// start of row
210
-		$html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' );
210
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
211 211
 		// event name td
212
-		$html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' );
212
+		$html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"');
213 213
 		// end of row
214 214
 		$html .= EEH_HTML::trx();
215 215
 		return $html;
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 	 * @param array        $options
225 225
 	 * @return mixed
226 226
 	 */
227
-	private function _ticket_row( EE_Line_Item $line_item, $options = array() ) {
227
+	private function _ticket_row(EE_Line_Item $line_item, $options = array()) {
228 228
 		// start of row
229 229
 		$row_class = $options['odd'] ? 'item odd' : 'item';
230
-		$html = EEH_HTML::tr( '', '', $row_class );
230
+		$html = EEH_HTML::tr('', '', $row_class);
231 231
 		// name && desc
232 232
 		$name_and_desc = apply_filters(
233 233
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
@@ -236,23 +236,23 @@  discard block
 block discarded – undo
236 236
 		);
237 237
 		$name_and_desc .= apply_filters(
238 238
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
239
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
239
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
240 240
 			$line_item,
241 241
 			$options
242 242
 		);
243 243
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
244 244
 		// name td
245
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l' );
245
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' );
246 246
 		// price td
247
-		$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
247
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
248 248
 		// quantity td
249
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
249
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
250 250
 		$this->_total_items += $line_item->quantity();
251 251
 		// determine total for line item
252 252
 		$total = $line_item->total();
253
-		$this->_events[ $options[ 'event_id' ] ] += $total;
253
+		$this->_events[$options['event_id']] += $total;
254 254
 		// total td
255
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
255
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
256 256
 		// end of row
257 257
 		$html .= EEH_HTML::trx();
258 258
 		return $html;
@@ -267,41 +267,41 @@  discard block
 block discarded – undo
267 267
 	 * @param array        $options
268 268
 	 * @return mixed
269 269
 	 */
270
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
270
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
271 271
 		// start of row
272 272
 		$row_class = $options['odd'] ? 'item odd' : 'item';
273
-		$html = EEH_HTML::tr( '', '', $row_class );
274
-		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type() . ': ' : '';
273
+		$html = EEH_HTML::tr('', '', $row_class);
274
+		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type().': ' : '';
275 275
 		// name && desc
276 276
 		$name_and_desc = apply_filters(
277 277
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
278
-			 $obj_name . $line_item->name(),
278
+			 $obj_name.$line_item->name(),
279 279
 			$line_item
280 280
 		);
281 281
 		$name_and_desc .= apply_filters(
282 282
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
283
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
283
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
284 284
 			$line_item,
285 285
 			$options
286 286
 		);
287 287
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
288 288
 		// name td
289
-		$html .= EEH_HTML::td( $name_and_desc, '',  'item_l' );
289
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
290 290
 		// price td
291
-		if ( $line_item->is_percent() ) {
292
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' );
291
+		if ($line_item->is_percent()) {
292
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght');
293 293
 		} else {
294
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' );
294
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
295 295
 		}
296 296
 		// quantity td
297
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
297
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
298 298
 		//$total = $line_item->total() * $line_item->quantity();
299 299
 		$total = $line_item->total();
300
-		if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
301
-			$this->_events[ $options[ 'event_id' ] ] += $total;
300
+		if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) {
301
+			$this->_events[$options['event_id']] += $total;
302 302
 		}
303 303
 		// total td
304
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
304
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
305 305
 		// end of row
306 306
 		$html .= EEH_HTML::trx();
307 307
 		return $html;
@@ -316,22 +316,22 @@  discard block
 block discarded – undo
316 316
 	 * @param array        $options
317 317
 	 * @return mixed
318 318
 	 */
319
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
319
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
320 320
 		// start of row
321
-		$html = EEH_HTML::tr( '', 'item sub-item-row' );
321
+		$html = EEH_HTML::tr('', 'item sub-item-row');
322 322
 		// name && desc
323 323
 		$name_and_desc = $line_item->name();
324
-		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
324
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : '';
325 325
 		// name td
326
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
326
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
327 327
 		// discount/surcharge td
328
-		if ( $line_item->is_percent() ) {
329
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
328
+		if ($line_item->is_percent()) {
329
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
330 330
 		} else {
331
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
331
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
332 332
 		}
333 333
 		// total td
334
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
334
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
335 335
 		// end of row
336 336
 		$html .= EEH_HTML::trx();
337 337
 		return $html;
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 * @param array        $options
347 347
 	 * @return mixed
348 348
 	 */
349
-	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
349
+	private function _tax_row(EE_Line_Item $line_item, $options = array()) {
350 350
 		// start of row
351
-		$html = EEH_HTML::tr( '', 'item sub-item tax-total' );
351
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
352 352
 		// name && desc
353 353
 		$name_and_desc = $line_item->name();
354
-		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>';
355
-		$name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : '';
354
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>';
355
+		$name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
356 356
 		// name td
357
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
357
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
358 358
 		// percent td
359
-		$html .= EEH_HTML::td( $line_item->percent() . '%', '',  ' jst-rght', '' );
359
+		$html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', '');
360 360
 		// empty td (price)
361
-		$html .= EEH_HTML::td( EEH_HTML::nbsp() );
361
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
362 362
 		// total td
363
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
363
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
364 364
 		// end of row
365 365
 		$html .= EEH_HTML::trx();
366 366
 		return $html;
@@ -375,17 +375,17 @@  discard block
 block discarded – undo
375 375
 	 * @param string $text
376 376
 	 * @return mixed
377 377
 	 */
378
-	private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) {
378
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '') {
379 379
 		$html = '';
380
-		if ( $line_item->total() ) {
380
+		if ($line_item->total()) {
381 381
 			// start of row
382
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
382
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
383 383
 			// total td
384
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' );
384
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"');
385 385
 			// empty td (price)
386
-			$html .= EEH_HTML::td( EEH_HTML::nbsp() );
386
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
387 387
 			// total td
388
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' );
388
+			$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
389 389
 			// end of row
390 390
 			$html .= EEH_HTML::trx();
391 391
 		}
@@ -402,15 +402,15 @@  discard block
 block discarded – undo
402 402
 	 * @param array        $options
403 403
 	 * @return mixed
404 404
 	 */
405
-	private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
405
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
406 406
 		$html = '';
407
-		if ( $line_item->total() ) {
407
+		if ($line_item->total()) {
408 408
 			// start of row
409
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
409
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
410 410
 			// total td
411
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' );
411
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
412 412
 			// total td
413
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' );
413
+			$html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght');
414 414
 			// end of row
415 415
 			$html .= EEH_HTML::trx();
416 416
 		}
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	 * @param string       $text
428 428
 	 * @return mixed
429 429
 	 */
430
-	private function _total_row( EE_Line_Item $line_item, $text = '' ) {
430
+	private function _total_row(EE_Line_Item $line_item, $text = '') {
431 431
 		// start of row
432
-		$html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' );
432
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
433 433
 		// total td
434
-		$html .= EEH_HTML::td( $text, '',  'total_currency total jst-rght',  '',  ' colspan="3"' );
434
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
435 435
 		// total td
436
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'total jst-rght' );
436
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
437 437
 		// end of row
438 438
 		$html .= EEH_HTML::trx();
439 439
 		return $html;
@@ -448,30 +448,30 @@  discard block
 block discarded – undo
448 448
 	 * @param array        $options
449 449
 	 * @return mixed
450 450
 	 */
451
-	private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) {
451
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) {
452 452
 		$html = '';
453 453
 		$owing = $line_item->total();
454
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() );
455
-		if ( $transaction instanceof EE_Transaction ) {
454
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
455
+		if ($transaction instanceof EE_Transaction) {
456 456
 			$registration_payments = array();
457
-			$registrations = ! empty( $options['registrations'] )
458
-				? $options[ 'registrations' ]
457
+			$registrations = ! empty($options['registrations'])
458
+				? $options['registrations']
459 459
 				: $transaction->registrations();
460
-			foreach ( $registrations as $registration ) {
461
-				if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
460
+			foreach ($registrations as $registration) {
461
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
462 462
 					$registration_payments = $registration_payments + $registration->registration_payments();
463 463
 				}
464 464
 			}
465
-			if ( ! empty( $registration_payments )) {
466
-				foreach ( $registration_payments as $registration_payment ) {
467
-					if ( $registration_payment instanceof EE_Registration_Payment ) {
465
+			if ( ! empty($registration_payments)) {
466
+				foreach ($registration_payments as $registration_payment) {
467
+					if ($registration_payment instanceof EE_Registration_Payment) {
468 468
 						$owing = $owing - $registration_payment->amount();
469 469
 						$payment = $registration_payment->payment();
470
-						if ( $payment instanceof EE_Payment ) {
470
+						if ($payment instanceof EE_Payment) {
471 471
 							$payment_desc = sprintf(
472
-								__( 'Payment%1$s Received: %2$s', 'event_espresso' ),
472
+								__('Payment%1$s Received: %2$s', 'event_espresso'),
473 473
 								$payment->txn_id_chq_nmbr() != ''
474
-									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
474
+									? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
475 475
 									: '',
476 476
 								$payment->timestamp()
477 477
 							);
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 							$payment_desc = '';
480 480
 						}
481 481
 						// start of row
482
-						$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
482
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
483 483
 						// payment desc
484
-						$html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' );
484
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
485 485
 						// total td
486 486
 						$html .= EEH_HTML::td(
487
-							EEH_Template::format_currency( $registration_payment->amount(), false, false ),
487
+							EEH_Template::format_currency($registration_payment->amount(), false, false),
488 488
 							'',
489 489
 							'total jst-rght'
490 490
 						);
@@ -492,17 +492,17 @@  discard block
 block discarded – undo
492 492
 						$html .= EEH_HTML::trx();
493 493
 					}
494 494
 				}
495
-				if ( $line_item->total() ) {
495
+				if ($line_item->total()) {
496 496
 					// start of row
497
-					$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
497
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
498 498
 					// total td
499 499
 					$html .= EEH_HTML::td(
500 500
 						__('Amount Owing', 'event_espresso'),
501
-						'',  'total_currency total jst-rght',  '',  ' colspan="3"'
501
+						'', 'total_currency total jst-rght', '', ' colspan="3"'
502 502
 					);
503 503
 					// total td
504 504
 					$html .= EEH_HTML::td(
505
-						EEH_Template::format_currency( $owing, false, false ), '',  'total jst-rght'
505
+						EEH_Template::format_currency($owing, false, false), '', 'total jst-rght'
506 506
 					);
507 507
 					// end of row
508 508
 					$html .= EEH_HTML::trx();
Please login to merge, or discard this patch.
line_item_display/EE_Default_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -57,29 +57,29 @@  discard block
 block discarded – undo
57 57
 	 * @param array        $options
58 58
 	 * @return mixed
59 59
 	 */
60
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
60
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
61 61
 
62 62
 		$html = '';
63 63
 		// set some default options and merge with incoming
64 64
 		$default_options = array(
65
-			'show_desc' => TRUE,  // 	TRUE 		FALSE
65
+			'show_desc' => TRUE, // 	TRUE 		FALSE
66 66
 			'odd' => FALSE
67 67
 		);
68
-		$options = array_merge( $default_options, (array)$options );
68
+		$options = array_merge($default_options, (array) $options);
69 69
 
70
-		switch( $line_item->type() ) {
70
+		switch ($line_item->type()) {
71 71
 
72 72
 			case EEM_Line_Item::type_line_item:
73 73
 				// item row
74
-				$html .= $this->_item_row( $line_item, $options );
74
+				$html .= $this->_item_row($line_item, $options);
75 75
 				// got any kids?
76
-				foreach ( $line_item->children() as $child_line_item ) {
77
-					$this->display_line_item( $child_line_item, $options );
76
+				foreach ($line_item->children() as $child_line_item) {
77
+					$this->display_line_item($child_line_item, $options);
78 78
 				}
79 79
 				break;
80 80
 
81 81
 			case EEM_Line_Item::type_sub_line_item:
82
-				$html .= $this->_sub_item_row( $line_item, $options );
82
+				$html .= $this->_sub_item_row($line_item, $options);
83 83
 				break;
84 84
 
85 85
 			case EEM_Line_Item::type_sub_total:
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 				break;
91 91
 
92 92
 			case EEM_Line_Item::type_tax_sub_total:
93
-				foreach ( $line_item->children() as $child_line_item ) {
94
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax ) {
93
+				foreach ($line_item->children() as $child_line_item) {
94
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
95 95
 						// recursively feed children back into this method
96
-						$this->display_line_item( $child_line_item, $options );
96
+						$this->display_line_item($child_line_item, $options);
97 97
 					}
98 98
 				}
99 99
 				break;
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
 			case EEM_Line_Item::type_total:
102 102
 				// get all child line items
103 103
 				$children = $line_item->children();
104
-				if ( $options[ 'set_tax_rate' ] === true  ) {
104
+				if ($options['set_tax_rate'] === true) {
105 105
 					// loop thru tax child line items just to determine tax rate
106
-					foreach ( $children as $child_line_item ) {
107
-						if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) {
106
+					foreach ($children as $child_line_item) {
107
+						if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
108 108
 							// recursively feed children back into this method
109
-							$this->display_line_item( $child_line_item, $options );
109
+							$this->display_line_item($child_line_item, $options);
110 110
 						}
111 111
 					}
112 112
 				} else {
113 113
 					// now loop thru all non-tax child line items
114
-					foreach ( $children as $child_line_item ) {
115
-						if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) {
114
+					foreach ($children as $child_line_item) {
115
+						if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
116 116
 							// recursively feed children back into this method
117
-							$html .= $this->display_line_item( $child_line_item, $options );
117
+							$html .= $this->display_line_item($child_line_item, $options);
118 118
 						}
119 119
 					}
120 120
 				}
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 	 * @param array        $options
135 135
 	 * @return mixed
136 136
 	 */
137
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
137
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
138 138
 		// start of row
139 139
 		$row_class = $options['odd'] ? 'item odd' : 'item';
140
-		$html = EEH_HTML::tr( '', '', $row_class );
140
+		$html = EEH_HTML::tr('', '', $row_class);
141 141
 		// name && desc
142 142
 		$name_and_desc = apply_filters(
143 143
 			'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name',
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
 		);
147 147
 		$name_and_desc .= apply_filters(
148 148
 			'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc',
149
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
149
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
150 150
 			$line_item,
151 151
 			$options
152 152
 		);
153
-		$name_and_desc .= $line_item->is_taxable() ? '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable item', 'event_espresso' ) . '</span>' : '';
153
+		$name_and_desc .= $line_item->is_taxable() ? '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable item', 'event_espresso').'</span>' : '';
154 154
 		// name td
155
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l' );
155
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' );
156 156
 		// quantity td
157
-		$html .= EEH_HTML::td( $line_item->quantity(), '',  'item_l jst-rght' );
158
-		$tax_rate = $line_item->is_taxable() ? 1 + ( $this->_tax_rate / 100 ) : 1;
157
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
158
+		$tax_rate = $line_item->is_taxable() ? 1 + ($this->_tax_rate / 100) : 1;
159 159
 		// price td
160
-		$unit_price = EEH_Template::format_currency( $line_item->unit_price() * $tax_rate, false, false );
161
-		$html .= EEH_HTML::td( $unit_price, '',  'item_c jst-rght' );
160
+		$unit_price = EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false);
161
+		$html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght');
162 162
 		// total td
163
-		$total = EEH_Template::format_currency( $line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false );
164
-		$html .= EEH_HTML::td( $total, '',  'item_r jst-rght' );
163
+		$total = EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false);
164
+		$html .= EEH_HTML::td($total, '', 'item_r jst-rght');
165 165
 		// end of row
166 166
 		$html .= EEH_HTML::trx();
167 167
 
@@ -177,22 +177,22 @@  discard block
 block discarded – undo
177 177
 	 * @param array        $options
178 178
 	 * @return mixed
179 179
 	 */
180
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
180
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
181 181
 		// start of row
182
-		$html = EEH_HTML::tr( '', 'item sub-item-row' );
182
+		$html = EEH_HTML::tr('', 'item sub-item-row');
183 183
 		// name && desc
184 184
 		$name_and_desc = $line_item->name();
185
-		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
185
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : '';
186 186
 		// name td
187
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
187
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
188 188
 		// discount/surcharge td
189
-		if ( $line_item->is_percent() ) {
190
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
189
+		if ($line_item->is_percent()) {
190
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
191 191
 		} else {
192
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
192
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
193 193
 		}
194 194
 		// total td
195
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
195
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
196 196
 		// end of row
197 197
 		$html .= EEH_HTML::trx();
198 198
 		return $html;
Please login to merge, or discard this patch.
line_item_display/EE_Receipt_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param array        $options
34 34
 	 * @return mixed
35 35
 	 */
36
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
36
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
37 37
 
38 38
 		$html = '';
39 39
 		// set some default options and merge with incoming
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 			'show_desc' => TRUE,
42 42
 			'odd' => FALSE
43 43
 		);
44
-		$options = array_merge( $default_options, (array)$options );
45
-		switch( $line_item->type() ) {
44
+		$options = array_merge($default_options, (array) $options);
45
+		switch ($line_item->type()) {
46 46
 
47 47
 			case EEM_Line_Item::type_total:
48 48
 				// loop thru children
49
-				foreach( $line_item->children() as $child_line_item ) {
49
+				foreach ($line_item->children() as $child_line_item) {
50 50
 					// recursively feed children back into this method
51 51
 //					$html .= $this->display_line_item( $child_line_item, $options );
52 52
 				}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 			case EEM_Line_Item::type_sub_total:
59 59
 				// loop thru children
60
-				foreach( $line_item->children() as $child_line_item ) {
60
+				foreach ($line_item->children() as $child_line_item) {
61 61
 					// recursively feed children back into this method
62 62
 //					$html .= $this->display_line_item( $child_line_item, $options );
63 63
 				}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 			case EEM_Line_Item::type_tax_sub_total:
69 69
 				// loop thru children
70
-				foreach( $line_item->children() as $child_line_item ) {
70
+				foreach ($line_item->children() as $child_line_item) {
71 71
 					// recursively feed children back into this method
72 72
 //					$html .= $this->display_line_item( $child_line_item, $options );
73 73
 				}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 				// item row
80 80
 //				$html .= $this->_item_row( $line_item, $options );
81 81
 				// got any kids?
82
-				foreach( $line_item->children() as $child_line_item ) {
82
+				foreach ($line_item->children() as $child_line_item) {
83 83
 //					$this->display_line_item( $child_line_item, $options );
84 84
 				}
85 85
 				break;
Please login to merge, or discard this patch.
line_item_display/EE_Invoice_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param array        $options
19 19
 	 * @return mixed
20 20
 	 */
21
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
21
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
22 22
 
23 23
 		$html = '';
24 24
 		// set some default options and merge with incoming
@@ -26,58 +26,58 @@  discard block
 block discarded – undo
26 26
 			'show_desc' => TRUE,
27 27
 			'odd' => FALSE
28 28
 		);
29
-		$options = array_merge( $default_options, (array)$options );
29
+		$options = array_merge($default_options, (array) $options);
30 30
 
31
-		switch( $line_item->type() ) {
31
+		switch ($line_item->type()) {
32 32
 
33 33
 			case EEM_Line_Item::type_total:
34 34
 				// loop thru children
35
-				foreach( $line_item->children() as $child_line_item ) {
35
+				foreach ($line_item->children() as $child_line_item) {
36 36
 					// recursively feed children back into this method
37
-					$html .= $this->display_line_item( $child_line_item, $options );
37
+					$html .= $this->display_line_item($child_line_item, $options);
38 38
 				}
39
-				$html .= $this->_separator_row( $options );
40
-				$html .= $this->_total_row( $line_item, __('Total', 'event_espresso'), $options );
39
+				$html .= $this->_separator_row($options);
40
+				$html .= $this->_total_row($line_item, __('Total', 'event_espresso'), $options);
41 41
 				 break;
42 42
 
43 43
 
44 44
 			case EEM_Line_Item::type_sub_total:
45 45
 				// loop thru children
46
-				foreach( $line_item->children() as $child_line_item ) {
46
+				foreach ($line_item->children() as $child_line_item) {
47 47
 					// recursively feed children back into this method
48
-					$html .= $this->display_line_item( $child_line_item, $options );
48
+					$html .= $this->display_line_item($child_line_item, $options);
49 49
 				}
50
-				$html .= $this->_total_row( $line_item, __('Sub-Total', 'event_espresso'), $options );
50
+				$html .= $this->_total_row($line_item, __('Sub-Total', 'event_espresso'), $options);
51 51
 				break;
52 52
 
53 53
 
54 54
 			case EEM_Line_Item::type_tax_sub_total:
55 55
 				// loop thru children
56
-				foreach( $line_item->children() as $child_line_item ) {
56
+				foreach ($line_item->children() as $child_line_item) {
57 57
 					// recursively feed children back into this method
58
-					$html .= $this->display_line_item( $child_line_item, $options );
58
+					$html .= $this->display_line_item($child_line_item, $options);
59 59
 				}
60
-				$html .= $this->_total_row( $line_item, __('Tax Total', 'event_espresso'), $options );
60
+				$html .= $this->_total_row($line_item, __('Tax Total', 'event_espresso'), $options);
61 61
 				break;
62 62
 
63 63
 
64 64
 			case EEM_Line_Item::type_line_item:
65 65
 				// item row
66
-				$html .= $this->_item_row( $line_item, $options );
66
+				$html .= $this->_item_row($line_item, $options);
67 67
 				// got any kids?
68
-				foreach( $line_item->children() as $child_line_item ) {
69
-					$this->display_line_item( $child_line_item, $options );
68
+				foreach ($line_item->children() as $child_line_item) {
69
+					$this->display_line_item($child_line_item, $options);
70 70
 				}
71 71
 				break;
72 72
 
73 73
 
74 74
 			case EEM_Line_Item::type_sub_line_item:
75
-				$html .= $this->_sub_item_row( $line_item, $options );
75
+				$html .= $this->_sub_item_row($line_item, $options);
76 76
 				break;
77 77
 
78 78
 
79 79
 			case EEM_Line_Item::type_tax:
80
-				$html .= $this->_tax_row( $line_item, $options );
80
+				$html .= $this->_tax_row($line_item, $options);
81 81
 				break;
82 82
 
83 83
 		}
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
 	 * @param array        $options
95 95
 	 * @return mixed
96 96
 	 */
97
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
97
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
98 98
 		// start of row
99 99
 		$row_class = $options['odd'] ? 'item odd' : 'item';
100
-		$html = EEH_HTML::tr( '', $row_class );
100
+		$html = EEH_HTML::tr('', $row_class);
101 101
 		// name td
102
-		$html .= EEH_HTML::td( $line_item->name(), '',  'item_l' );
102
+		$html .= EEH_HTML::td($line_item->name(), '', 'item_l');
103 103
 		// desc td
104
-		$html .= $options['show_desc'] ? EEH_HTML::td( $line_item->desc(), '',  'item_l' ) : '';
104
+		$html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
105 105
 		// quantity td
106
-		$html .= EEH_HTML::td( $line_item->quantity(), '',  'item_l' );
106
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l');
107 107
 		// price td
108
-		$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c' );
108
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
109 109
 		// total td
110
-		$total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code();
111
-		$html .= EEH_HTML::td( $total, '',  'item_r' );
110
+		$total = $line_item->is_taxable() ? $line_item->total_no_code().'*' : $line_item->total_no_code();
111
+		$html .= EEH_HTML::td($total, '', 'item_r');
112 112
 		// end of row
113 113
 		$html .= EEH_HTML::trx();
114 114
 		return $html;
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
 	 * @param array        $options
124 124
 	 * @return mixed
125 125
 	 */
126
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
126
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
127 127
 		// start of row
128
-		$html = EEH_HTML::tr( '', 'item sub-item-row' );
128
+		$html = EEH_HTML::tr('', 'item sub-item-row');
129 129
 		// name td
130
-		$html .= EEH_HTML::td( $line_item->name(), '',  'item_l sub-item' );
130
+		$html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
131 131
 		// desc td
132
-		$html .= $options['show_desc'] ? EEH_HTML::td( $line_item->desc(), '',  'item_l' ) : '';
133
-		$html .= EEH_HTML::td() . EEH_HTML::tdx();
132
+		$html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
133
+		$html .= EEH_HTML::td().EEH_HTML::tdx();
134 134
 		// discount/surcharge td
135
-		if ( $line_item->is_percent() ) {
136
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
135
+		if ($line_item->is_percent()) {
136
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
137 137
 		} else {
138
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c' );
138
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
139 139
 		}
140 140
 		// total td
141
-		$html .= EEH_HTML::td( $line_item->total_no_code(), '',  'item_r' );
141
+		$html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
142 142
 		// end of row
143 143
 		$html .= EEH_HTML::trx();
144 144
 		return $html;
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 	 * @param array        $options
154 154
 	 * @return mixed
155 155
 	 */
156
-	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
156
+	private function _tax_row(EE_Line_Item $line_item, $options = array()) {
157 157
 		// start of row
158
-		$html = EEH_HTML::tr( '', 'item sub-item tax-total' );
158
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
159 159
 		// name td
160
-		$html .= EEH_HTML::td( $line_item->name(), '',  'item_l sub-item' );
160
+		$html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
161 161
 		// desc td
162
-		$html .= $options['show_desc'] ? EEH_HTML::td( $line_item->desc(), '',  'item_l' ) : '';
162
+		$html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
163 163
 		// percent td
164
-		$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c', '', ' colspan="2"' );
164
+		$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c', '', ' colspan="2"');
165 165
 		// total td
166
-		$html .= EEH_HTML::td( $line_item->total_no_code(), '',  'item_r' );
166
+		$html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
167 167
 		// end of row
168 168
 		$html .= EEH_HTML::trx();
169 169
 		return $html;
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	 * @param array        $options
180 180
 	 * @return mixed
181 181
 	 */
182
-	private function _total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
182
+	private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
183 183
 		// colspan
184 184
 		$colspan = $options['show_desc'] ? ' colspan="2"' : '';
185 185
 		// start of row
186
-		$html = EEH_HTML::tr( '', '', 'total_tr odd' );
186
+		$html = EEH_HTML::tr('', '', 'total_tr odd');
187 187
 		// empty td
188
-		$html .= EEH_HTML::td( EEH_HTML::nbsp(), '',  '',  '',  $colspan );
188
+		$html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan);
189 189
 		// total td
190
-		$html .= EEH_HTML::td( $text, '',  'total_currency total',  '',  $colspan );
190
+		$html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan);
191 191
 		// total td
192
-		$html .= EEH_HTML::td( $line_item->total_no_code(), '',  'total' );
192
+		$html .= EEH_HTML::td($line_item->total_no_code(), '', 'total');
193 193
 		// end of row
194 194
 		$html .= EEH_HTML::trx();
195 195
 		return $html;
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 	 * @param array        $options
204 204
 	 * @return mixed
205 205
 	 */
206
-	private function _separator_row( $options = array() ) {
206
+	private function _separator_row($options = array()) {
207 207
 		// colspan
208 208
 		$colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"';
209 209
 		// start of row
210
-		$html = EEH_HTML::tr( EEH_HTML::td( '<hr>', '',  '',  '',  $colspan ));
210
+		$html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan));
211 211
 //		// separator td
212 212
 //		$html .= EEH_HTML::td( '<hr>', '',  '',  '',  $colspan );
213 213
 //		// end of row
Please login to merge, or discard this patch.
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array        $options
50 50
 	 * @return mixed
51 51
 	 */
52
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
52
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
53 53
 
54 54
 		$html = '';
55 55
 		// set some default options and merge with incoming
@@ -60,40 +60,40 @@  discard block
 block discarded – undo
60 60
 			'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
61 61
 			'total_tr_css_class' => 'admin-primary-mbox-total-tr'
62 62
 		);
63
-		$options = array_merge( $default_options, (array)$options );
63
+		$options = array_merge($default_options, (array) $options);
64 64
 
65
-		switch( $line_item->type() ) {
65
+		switch ($line_item->type()) {
66 66
 
67 67
 			case EEM_Line_Item::type_line_item:
68 68
 				// item row
69
-				$html .= $this->_item_row( $line_item, $options );
69
+				$html .= $this->_item_row($line_item, $options);
70 70
 				break;
71 71
 
72 72
 			case EEM_Line_Item::type_sub_line_item:
73
-				$html .= $this->_sub_item_row( $line_item, $options );
73
+				$html .= $this->_sub_item_row($line_item, $options);
74 74
 				break;
75 75
 
76 76
 			case EEM_Line_Item::type_sub_total:
77 77
 				//loop through children
78 78
 				$child_line_items = $line_item->children();
79 79
 				//loop through children
80
-				foreach ( $child_line_items as $child_line_item ) {
80
+				foreach ($child_line_items as $child_line_item) {
81 81
 					//recursively feed children back into this method
82
-					$html .= $this->display_line_item( $child_line_item, $options );
82
+					$html .= $this->display_line_item($child_line_item, $options);
83 83
 				}
84
-				$html .= $this->_sub_total_row( $line_item, $options );
84
+				$html .= $this->_sub_total_row($line_item, $options);
85 85
 				break;
86 86
 
87 87
 			case EEM_Line_Item::type_tax:
88
-				if ( $this->_show_taxes ) {
89
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
88
+				if ($this->_show_taxes) {
89
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
90 90
 				}
91 91
 				break;
92 92
 
93 93
 			case EEM_Line_Item::type_tax_sub_total:
94
-				foreach( $line_item->children() as $child_line_item ) {
95
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax ) {
96
-						$this->display_line_item( $child_line_item, $options );
94
+				foreach ($line_item->children() as $child_line_item) {
95
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
96
+						$this->display_line_item($child_line_item, $options);
97 97
 					}
98 98
 				}
99 99
 				break;
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 				$children = $line_item->children();
106 106
 
107 107
 				// loop thru all non-tax child line items
108
-				foreach( $children as $child_line_item ) {
109
-						$html .= $this->display_line_item( $child_line_item, $options );
108
+				foreach ($children as $child_line_item) {
109
+						$html .= $this->display_line_item($child_line_item, $options);
110 110
 				}
111 111
 
112 112
 				$html .= $this->_taxes_html;
113
-				$html .= $this->_total_row( $line_item, $options );
114
-				if ( $options['use_table_wrapper'] ) {
115
-					$html = $this->_table_header( $options ) . $html . $this->_table_footer( $options );
113
+				$html .= $this->_total_row($line_item, $options);
114
+				if ($options['use_table_wrapper']) {
115
+					$html = $this->_table_header($options).$html.$this->_table_footer($options);
116 116
 				}
117 117
 				break;
118 118
 
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param array $options
130 130
 	 * @return string
131 131
 	 */
132
-	protected function _table_header( $options ) {
133
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
132
+	protected function _table_header($options) {
133
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
134 134
 		$html .= EEH_HTML::thead();
135 135
 		$html .= EEH_HTML::tr();
136
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
137
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
138
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
139
-		$html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' );
140
-		$html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' );
136
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
137
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
138
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
139
+		$html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
140
+		$html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
141 141
 		$html .= EEH_HTML::tbody();
142 142
 		return $html;
143 143
 	}
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param array $options array of options for the table.
150 150
 	 * @return string
151 151
 	 */
152
-	protected function _table_footer( $options ) {
153
-		return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
152
+	protected function _table_footer($options) {
153
+		return EEH_HTML::tbodyx().EEH_HTML::tablex();
154 154
 	}
155 155
 
156 156
 
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 * @param array        $options
163 163
 	 * @return mixed
164 164
 	 */
165
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
165
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
166 166
 		$line_item_related_object = $line_item->get_object();
167 167
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
168 168
 		// start of row
169 169
 		$row_class = $options['odd'] ? 'item odd' : 'item';
170
-		$html = EEH_HTML::tr( '', '', $row_class );
170
+		$html = EEH_HTML::tr('', '', $row_class);
171 171
 
172 172
 
173 173
 		//Name Column
@@ -175,44 +175,44 @@  discard block
 block discarded – undo
175 175
 
176 176
 		//related object scope.
177 177
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
178
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
178
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
179 179
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
180 180
 
181 181
 
182 182
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
183
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
183
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
184 184
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
185 185
 		//maybe preface with icon?
186
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
187
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
188
-		$name_html .=  sprintf(
189
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
186
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
187
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
188
+		$name_html .= sprintf(
189
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
190 190
 			'<span class="ee-line-item-related-parent-object">',
191
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type() : __( 'Item:', 'event_espresso' ),
192
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
191
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type() : __('Item:', 'event_espresso'),
192
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
193 193
 			'</span>'
194 194
 		);
195
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
195
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
196 196
 
197 197
 		//Type Column
198
-		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type() . '<br />' : '';
198
+		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type().'<br />' : '';
199 199
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
200
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
201
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
200
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
201
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
202 202
 
203 203
 
204 204
 		//Amount Column
205
-		if ( $line_item->is_percent() ) {
206
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
205
+		if ($line_item->is_percent()) {
206
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
207 207
 		} else {
208
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
208
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
209 209
 		}
210 210
 
211 211
 		//QTY column
212
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' );
212
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
213 213
 
214 214
 		//total column
215
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
215
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
216 216
 
217 217
 		//finish things off and return
218 218
 		$html .= EEH_HTML::trx();
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 * @param array        $options
229 229
 	 * @return mixed
230 230
 	 */
231
-	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
231
+	protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
232 232
 		//for now we're not showing sub-items
233 233
 		return '';
234 234
 	}
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 * @param array        $options
243 243
 	 * @return mixed
244 244
 	 */
245
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
245
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
246 246
 		// start of row
247
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
247
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
248 248
 		// name th
249
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="4"' );
249
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"');
250 250
 		// total th
251
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
251
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
252 252
 		// end of row
253 253
 		$html .= EEH_HTML::trx();
254 254
 		return $html;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 * @param array        $options
266 266
 	 * @return mixed
267 267
 	 */
268
-	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
268
+	protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
269 269
 		//currently not showing subtotal row
270 270
 		return '';
271 271
 	}
@@ -279,15 +279,15 @@  discard block
 block discarded – undo
279 279
 	 * @param array        $options
280 280
 	 * @return mixed
281 281
 	 */
282
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
282
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
283 283
 		// start of row
284
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
284
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
285 285
 		// Total th label
286
-		$total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ),  '(' . EE_Registry::instance()->CFG->currency->code . ')' );
287
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="4"' );
286
+		$total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
287
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
288 288
 		// total th
289 289
 
290
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
290
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
291 291
 		// end of row
292 292
 		$html .= EEH_HTML::trx();
293 293
 		return $html;
Please login to merge, or discard this patch.
core/libraries/template_parts/EE_Template_Part_Manager.class.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 //namespace EventEspresso\core\libraries\templates;
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -70,23 +70,23 @@  discard block
 block discarded – undo
70 70
 	 * @param string $template - name or path of template to be used by EEH_Template::locate_template()
71 71
 	 * @param int $priority    - order in which template parts should be applied
72 72
 	 */
73
-	public function add_template_part( $name, $label, $template, $priority ) {
73
+	public function add_template_part($name, $label, $template, $priority) {
74 74
 		// SplPriorityQueue doesn't play nice with multiple items having the same priority
75 75
 		// so if the incoming priority is already occupied, then let's increment it by one,
76 76
 		// and then pass everything back into this method and try again with the new priority
77
-		if ( isset( $this->priorities[ $priority ] ) ) {
77
+		if (isset($this->priorities[$priority])) {
78 78
 			$priority++;
79
-			$this->add_template_part( $name, $label, $template, $priority );
79
+			$this->add_template_part($name, $label, $template, $priority);
80 80
 			return;
81 81
 		}
82 82
 		// kk now we can mark this priority as being occupied
83
-		$this->priorities[ $priority ] = true;
83
+		$this->priorities[$priority] = true;
84 84
 		// create the template part and add to the queue
85 85
 		$this->template_parts->insert(
86
-			new EE_Template_Part( $name, $label, $template, $priority ),
86
+			new EE_Template_Part($name, $label, $template, $priority),
87 87
 			$priority
88 88
 		);
89
-		if ( $name == 'event' ) {
89
+		if ($name == 'event') {
90 90
 			$this->event_desc_priority = $priority;
91 91
 		}
92 92
 	}
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	 * @param string $content
104 104
 	 * @return string
105 105
 	 */
106
-	public function apply_template_part_filters( $content = '' ) {
106
+	public function apply_template_part_filters($content = '') {
107 107
 		$this->template_parts->rewind();
108 108
 		// loop through template parts and position content
109
-		while ( $this->template_parts->valid() ) {
109
+		while ($this->template_parts->valid()) {
110 110
 			$this->_position_template_part(
111 111
 				$content,
112 112
 				$this->template_parts->current()->template(),
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			$this->template_parts->next();
116 116
 		}
117 117
 		// now simply add our three strings of content together
118
-		return $this->before_event_content . $this->event_content . $this->after_event_content;
118
+		return $this->before_event_content.$this->event_content.$this->after_event_content;
119 119
 	}
120 120
 
121 121
 
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 * @param int $priority
137 137
 	 * @return string
138 138
 	 */
139
-	protected function _position_template_part( $content, $template, $priority ) {
139
+	protected function _position_template_part($content, $template, $priority) {
140 140
 		// Event Description content is the actual incoming content itself
141
-		if ( $priority === $this->event_desc_priority ) {
141
+		if ($priority === $this->event_desc_priority) {
142 142
 			$this->event_content = $content;
143
-		} else if ( $priority < $this->event_desc_priority ) {
143
+		} else if ($priority < $this->event_desc_priority) {
144 144
 			// everything BEFORE the Event Description
145
-			$this->before_event_content .= EEH_Template::locate_template( $template );
146
-		} else if ( $priority > $this->event_desc_priority ) {
145
+			$this->before_event_content .= EEH_Template::locate_template($template);
146
+		} else if ($priority > $this->event_desc_priority) {
147 147
 			// everything AFTER the Event Description
148
-			$this->after_event_content .= EEH_Template::locate_template( $template );
148
+			$this->after_event_content .= EEH_Template::locate_template($template);
149 149
 		}
150 150
 	}
151 151
 
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
 		$list_item_css_class = '',
171 171
 		$list_item_css_id_prefix = ''
172 172
 	) {
173
-		$event_archive_display_order = EEH_HTML::ul( $list_css_id, $list_css_class );
173
+		$event_archive_display_order = EEH_HTML::ul($list_css_id, $list_css_class);
174 174
 		$this->template_parts->rewind();
175 175
 		// loop through template parts and add template content
176
-		while ( $this->template_parts->valid() ) {
176
+		while ($this->template_parts->valid()) {
177 177
 			$event_archive_display_order .= EEH_HTML::li(
178
-				EEH_HTML::span( '', '', 'dashicons dashicons-arrow-up-alt2' ) .
179
-				EEH_HTML::span( '', '', 'dashicons dashicons-arrow-down-alt2' ) .
178
+				EEH_HTML::span('', '', 'dashicons dashicons-arrow-up-alt2').
179
+				EEH_HTML::span('', '', 'dashicons dashicons-arrow-down-alt2').
180 180
 				$this->template_parts->current()->label(),
181
-				$list_item_css_id_prefix . $this->template_parts->current()->name(),
181
+				$list_item_css_id_prefix.$this->template_parts->current()->name(),
182 182
 				$list_item_css_class
183 183
 			);
184 184
 			$this->template_parts->next();
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 	 * @return string
199 199
 	 */
200 200
 	public function display_template_parts() {
201
-		if ( WP_DEBUG ) {
201
+		if (WP_DEBUG) {
202 202
 			$this->template_parts->rewind();
203
-			while ( $this->template_parts->valid() ) {
204
-				EEH_Debug_Tools::printr( $this->template_parts->current(), 'template_part', __FILE__, __LINE__ );
203
+			while ($this->template_parts->valid()) {
204
+				EEH_Debug_Tools::printr($this->template_parts->current(), 'template_part', __FILE__, __LINE__);
205 205
 				$this->template_parts->next();
206 206
 			}
207 207
 		}
Please login to merge, or discard this patch.
core/helpers/EEH_Event_View.helper.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -40,27 +40,27 @@  discard block
 block discarded – undo
40 40
 	 * @param    int $EVT_ID
41 41
 	 * @return    object
42 42
 	 */
43
-	public static function get_event( $EVT_ID = 0 ) {
44
-		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID );
43
+	public static function get_event($EVT_ID = 0) {
44
+		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID);
45 45
 		// do we already have the Event  you are looking for?
46
-		if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) {
46
+		if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
47 47
 			return EEH_Event_View::$_event;
48 48
 		}
49 49
 		EEH_Event_View::$_event = NULL;
50 50
 		// international newspaper?
51 51
 		global $post;
52 52
 		// if this is being called from an EE_Event post, then we can just grab the attached EE_Event object
53
-		 if ( isset( $post->post_type ) && $post->post_type == 'espresso_events' || $EVT_ID ) {
53
+		 if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) {
54 54
 //			d( $post );
55 55
 			// grab the event we're looking for
56
-			if ( isset( $post->EE_Event ) && ( $EVT_ID == 0 || ( $EVT_ID == $post->ID ))) {
56
+			if (isset($post->EE_Event) && ($EVT_ID == 0 || ($EVT_ID == $post->ID))) {
57 57
 				EEH_Event_View::$_event = $post->EE_Event;
58 58
 //				d( EEH_Event_View::$_event );
59 59
 			}
60 60
 			// now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID...
61
-			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) {
61
+			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
62 62
 				// sigh... pull it from the db
63
-				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
63
+				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
64 64
 //				d( EEH_Event_View::$_event );
65 65
 			}
66 66
 		}
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param    int $EVT_ID
77 77
 	 * @return    boolean
78 78
 	 */
79
-	public static function display_ticket_selector( $EVT_ID = 0 ) {
80
-		$event = EEH_Event_View::get_event( $EVT_ID );
79
+	public static function display_ticket_selector($EVT_ID = 0) {
80
+		$event = EEH_Event_View::get_event($EVT_ID);
81 81
 		return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE;
82 82
 	}
83 83
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param    int $EVT_ID
91 91
 	 * @return    string
92 92
 	 */
93
-	public static function event_status( $EVT_ID = 0 ) {
94
-		$event = EEH_Event_View::get_event( $EVT_ID );
95
-		return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : '';
93
+	public static function event_status($EVT_ID = 0) {
94
+		$event = EEH_Event_View::get_event($EVT_ID);
95
+		return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : '';
96 96
 	}
97 97
 
98 98
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param    int $EVT_ID
105 105
 	 *  @return 	string
106 106
 	 */
107
-	public static function event_active_status( $EVT_ID = 0 ) {
108
-		$event = EEH_Event_View::get_event( $EVT_ID );
107
+	public static function event_active_status($EVT_ID = 0) {
108
+		$event = EEH_Event_View::get_event($EVT_ID);
109 109
 		return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive';
110 110
 	}
111 111
 
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 * @param    int $EVT_ID
119 119
 	 *  @return 	string
120 120
 	 */
121
-	public static function event_has_content_or_excerpt( $EVT_ID = 0 ) {
122
-		$event = EEH_Event_View::get_event( $EVT_ID );
121
+	public static function event_has_content_or_excerpt($EVT_ID = 0) {
122
+		$event = EEH_Event_View::get_event($EVT_ID);
123 123
 		$has_content_or_excerpt = FALSE;
124
-		if ( $event instanceof EE_Event ) {
125
-			$has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE;
124
+		if ($event instanceof EE_Event) {
125
+			$has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE;
126 126
 		}
127
-		if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) {
127
+		if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) {
128 128
 			$has_content_or_excerpt = FALSE;
129 129
 		}
130 130
 		return $has_content_or_excerpt;
@@ -140,45 +140,45 @@  discard block
 block discarded – undo
140 140
 	 * @param null $more
141 141
 	 * @return    string
142 142
 	 */
143
-	public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) {
143
+	public static function event_content_or_excerpt($num_words = NULL, $more = NULL) {
144 144
 		global $post;
145 145
 
146 146
 		ob_start();
147
-		if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
147
+		if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) {
148 148
 
149 149
 			// admin has chosen "full description" for the "Event Espresso - Events > Templates > Display Description" option
150 150
 			the_content();
151 151
 
152
-		} else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) ) {
152
+		} else if ((is_archive() && has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) {
153 153
 
154 154
 			// admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
155 155
 			// AND an excerpt actually exists
156 156
 			the_excerpt();
157 157
 
158
-		} else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) {
158
+		} else if ((is_archive() && ! has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) {
159 159
 
160 160
 			// admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
161 161
 			// but NO excerpt actually exists, so we need to create one
162
-			if ( ! empty( $num_words )) {
163
-				if ( empty( $more )) {
164
-					$more_link_text = __( '(more&hellip;)' );
165
-					$more = ' <a href="' . get_permalink() . '" class="more-link">' . $more_link_text . '</a>';
166
-					$more = apply_filters( 'the_content_more_link', $more, $more_link_text );
162
+			if ( ! empty($num_words)) {
163
+				if (empty($more)) {
164
+					$more_link_text = __('(more&hellip;)');
165
+					$more = ' <a href="'.get_permalink().'" class="more-link">'.$more_link_text.'</a>';
166
+					$more = apply_filters('the_content_more_link', $more, $more_link_text);
167 167
 				}
168
-				$content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' ));
168
+				$content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
169 169
 
170
-				$content =  wp_trim_words( $content, $num_words, ' ' ) . $more;
170
+				$content = wp_trim_words($content, $num_words, ' ').$more;
171 171
 			} else {
172
-				$content =  get_the_content();
172
+				$content = get_the_content();
173 173
 			}
174 174
 			global $allowedtags;
175
-			$content = wp_kses( $content, $allowedtags );
176
-			$content = strip_shortcodes( $content );
177
-			echo apply_filters( 'the_content', $content );
175
+			$content = wp_kses($content, $allowedtags);
176
+			$content = strip_shortcodes($content);
177
+			echo apply_filters('the_content', $content);
178 178
 
179 179
 		} else {
180 180
 			// admin has chosen "none" for the "Event Espresso - Events > Templates > Display Description" option
181
-			echo apply_filters( 'the_content', '' );
181
+			echo apply_filters('the_content', '');
182 182
 		}
183 183
 		return ob_get_clean();
184 184
 	}
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 	 * @param    int $EVT_ID
193 193
 	 *  @return 	EE_Ticket[]
194 194
 	 */
195
-	public static function event_tickets_available( $EVT_ID = 0 ) {
196
-		$event = EEH_Event_View::get_event( $EVT_ID );
195
+	public static function event_tickets_available($EVT_ID = 0) {
196
+		$event = EEH_Event_View::get_event($EVT_ID);
197 197
 		$tickets_available_for_purchase = array();
198
-		if( $event instanceof EE_Event ) {
199
-			$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE );
200
-			foreach( $datetimes as $datetime ) {
201
-				$tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() );
198
+		if ($event instanceof EE_Event) {
199
+			$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE);
200
+			foreach ($datetimes as $datetime) {
201
+				$tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
202 202
 			}
203 203
 		}
204 204
 		return $tickets_available_for_purchase;
@@ -214,22 +214,22 @@  discard block
 block discarded – undo
214 214
 	 * @param 	  bool   $hide_uncategorized
215 215
 	 * @return    string
216 216
 	 */
217
-	public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) {
217
+	public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) {
218 218
 		$category_links = array();
219
-		$event = EEH_Event_View::get_event( $EVT_ID );
220
-		if ( $event instanceof EE_Event ) {
221
-			$event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' );
222
-			if ( $event_categories ) {
219
+		$event = EEH_Event_View::get_event($EVT_ID);
220
+		if ($event instanceof EE_Event) {
221
+			$event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
222
+			if ($event_categories) {
223 223
 				// loop thru terms and create links
224
-				foreach ( $event_categories as $term ) {
225
-					$url = get_term_link( $term, 'espresso_venue_categories' );
226
-					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
227
-						$category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a>';
224
+				foreach ($event_categories as $term) {
225
+					$url = get_term_link($term, 'espresso_venue_categories');
226
+					if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
227
+						$category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a>';
228 228
 					}
229 229
 				}
230 230
 			}
231 231
 		}
232
-		return implode( ', ', $category_links );
232
+		return implode(', ', $category_links);
233 233
 	}
234 234
 
235 235
 
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 	 * @param int    $EVT_ID
244 244
 	 * @return    string
245 245
 	 */
246
-	public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
247
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
248
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
249
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) :  '';
246
+	public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
247
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
248
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
249
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
250 250
 	}
251 251
 
252 252
 
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 	 * @param int    $EVT_ID
261 261
 	 * @return    string
262 262
 	 */
263
-	public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
264
-		$datetime = EEH_Event_View::get_last_date_obj( $EVT_ID );
265
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
266
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
263
+	public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
264
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
265
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
266
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
267 267
 	}
268 268
 
269 269
 
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
 	 * @param int    $EVT_ID
278 278
 	 * @return    string
279 279
 	 */
280
-	public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
281
-		$datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID );
282
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
283
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : '';
280
+	public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
281
+		$datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
282
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
283
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
284 284
 	}
285 285
 
286 286
 
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 	 * @param int    $EVT_ID
295 295
 	 * @return    string
296 296
 	 */
297
-	public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
298
-		$datetime = EEH_Event_View::get_last_date_obj( $EVT_ID );
299
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
300
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
297
+	public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
298
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
299
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
300
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
301 301
 	}
302 302
 
303 303
 
@@ -309,13 +309,13 @@  discard block
 block discarded – undo
309 309
 	 * @param int $EVT_ID
310 310
 	 * @return    string
311 311
 	 */
312
-	public static function event_date_as_calendar_page( $EVT_ID = 0 ) {
313
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
314
-		if ( $datetime instanceof EE_Datetime ) {
312
+	public static function event_date_as_calendar_page($EVT_ID = 0) {
313
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
314
+		if ($datetime instanceof EE_Datetime) {
315 315
 	?>
316 316
 		<div class="event-date-calendar-page-dv">
317
-			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div>
318
-			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div>
317
+			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div>
318
+			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div>
319 319
 		</div>
320 320
 	<?php
321 321
 		}
@@ -330,17 +330,17 @@  discard block
 block discarded – undo
330 330
 	 * @param int $EVT_ID
331 331
 	 * @return    string
332 332
 	 */
333
-	public static function get_primary_date_obj( $EVT_ID = 0 ) {
334
-		$event = EEH_Event_View::get_event( $EVT_ID );
335
-		if ( $event instanceof EE_Event ) {
333
+	public static function get_primary_date_obj($EVT_ID = 0) {
334
+		$event = EEH_Event_View::get_event($EVT_ID);
335
+		if ($event instanceof EE_Event) {
336 336
 			$datetimes = $event->get_many_related(
337 337
 				'Datetime',
338 338
 				array(
339 339
 					'limit' => 1,
340
-					'order_by' => array( 'DTT_order' => 'ASC' )
340
+					'order_by' => array('DTT_order' => 'ASC')
341 341
 				)
342 342
 			);
343
-			return reset( $datetimes );
343
+			return reset($datetimes);
344 344
 		} else {
345 345
 			 return FALSE;
346 346
 		}
@@ -355,17 +355,17 @@  discard block
 block discarded – undo
355 355
 	 * @param int $EVT_ID
356 356
 	 * @return    string
357 357
 	 */
358
-	public static function get_last_date_obj( $EVT_ID = 0 ) {
359
-		$event = EEH_Event_View::get_event( $EVT_ID );
360
-		if ( $event instanceof EE_Event ) {
358
+	public static function get_last_date_obj($EVT_ID = 0) {
359
+		$event = EEH_Event_View::get_event($EVT_ID);
360
+		if ($event instanceof EE_Event) {
361 361
 			$datetimes = $event->get_many_related(
362 362
 				'Datetime',
363 363
 				array(
364 364
 					'limit' => 1,
365
-					'order_by' => array( 'DTT_order' => 'DESC' )
365
+					'order_by' => array('DTT_order' => 'DESC')
366 366
 				)
367 367
 			);
368
-			return end( $datetimes );
368
+			return end($datetimes);
369 369
 		} else {
370 370
 			return FALSE;
371 371
 		}
@@ -380,17 +380,17 @@  discard block
 block discarded – undo
380 380
 	 * @param int $EVT_ID
381 381
 	 * @return    string
382 382
 	 */
383
-	public static function get_earliest_date_obj( $EVT_ID = 0 ) {
384
-		$event = EEH_Event_View::get_event( $EVT_ID );
385
-		if ( $event instanceof EE_Event ) {
383
+	public static function get_earliest_date_obj($EVT_ID = 0) {
384
+		$event = EEH_Event_View::get_event($EVT_ID);
385
+		if ($event instanceof EE_Event) {
386 386
 			$datetimes = $event->get_many_related(
387 387
 				'Datetime',
388 388
 				array(
389 389
 					'limit' => 1,
390
-					'order_by' => array( 'DTT_EVT_start' => 'ASC' )
390
+					'order_by' => array('DTT_EVT_start' => 'ASC')
391 391
 				)
392 392
 			);
393
-			return reset( $datetimes );
393
+			return reset($datetimes);
394 394
 		} else {
395 395
 			 return FALSE;
396 396
 		}
@@ -405,17 +405,17 @@  discard block
 block discarded – undo
405 405
 	 * @param int $EVT_ID
406 406
 	 * @return    string
407 407
 	 */
408
-	public static function get_latest_date_obj( $EVT_ID = 0 ) {
409
-		$event = EEH_Event_View::get_event( $EVT_ID );
410
-		if ( $event instanceof EE_Event ) {
408
+	public static function get_latest_date_obj($EVT_ID = 0) {
409
+		$event = EEH_Event_View::get_event($EVT_ID);
410
+		if ($event instanceof EE_Event) {
411 411
 			$datetimes = $event->get_many_related(
412 412
 				'Datetime',
413 413
 				array(
414 414
 					'limit' => 1,
415
-					'order_by' => array( 'DTT_EVT_start' => 'DESC' )
415
+					'order_by' => array('DTT_EVT_start' => 'DESC')
416 416
 				)
417 417
 			);
418
-			return end( $datetimes );
418
+			return end($datetimes);
419 419
 		} else {
420 420
 			return FALSE;
421 421
 		}
@@ -433,17 +433,17 @@  discard block
 block discarded – undo
433 433
 	 * @param null $limit
434 434
 	 * @return EE_Datetime[]
435 435
 	 */
436
-	public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) {
437
-		$event = EEH_Event_View::get_event( $EVT_ID );
438
-		if($include_expired === null){
439
-			if($event instanceof EE_Event && $event->is_expired()){
436
+	public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) {
437
+		$event = EEH_Event_View::get_event($EVT_ID);
438
+		if ($include_expired === null) {
439
+			if ($event instanceof EE_Event && $event->is_expired()) {
440 440
 				$include_expired = true;
441
-			}else{
441
+			} else {
442 442
 				$include_expired = false;
443 443
 			}
444 444
 		}
445 445
 
446
-		if ( $event instanceof EE_Event ) {
446
+		if ($event instanceof EE_Event) {
447 447
 			return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
448 448
 		} else {
449 449
 			 return array();
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
 	 * @param int $EVT_ID
460 460
 	 * @return    string
461 461
 	 */
462
-	public static function event_link_url( $EVT_ID = 0 ) {
463
-		$event = EEH_Event_View::get_event( $EVT_ID );
464
-		if ( $event instanceof EE_Event ) {
465
-			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() );
466
-			return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url;
462
+	public static function event_link_url($EVT_ID = 0) {
463
+		$event = EEH_Event_View::get_event($EVT_ID);
464
+		if ($event instanceof EE_Event) {
465
+			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID());
466
+			return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url;
467 467
 		}
468 468
 		return NULL;
469 469
 	}
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 	 * @param int $EVT_ID
478 478
 	 * @return    string
479 479
 	 */
480
-	public static function event_phone( $EVT_ID = 0 ) {
481
-		$event = EEH_Event_View::get_event( $EVT_ID );
482
-		if ( $event instanceof EE_Event ) {
483
-			return EEH_Schema::telephone( $event->phone() );
480
+	public static function event_phone($EVT_ID = 0) {
481
+		$event = EEH_Event_View::get_event($EVT_ID);
482
+		if ($event instanceof EE_Event) {
483
+			return EEH_Schema::telephone($event->phone());
484 484
 		}
485 485
 		return NULL;
486 486
 	}
@@ -497,23 +497,23 @@  discard block
 block discarded – undo
497 497
 	 * @param string $after
498 498
 	 * @return    string
499 499
 	 */
500
-	public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) {
501
-		$event = EEH_Event_View::get_event( $EVT_ID );
502
-		if ( $event instanceof EE_Event ) {
500
+	public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') {
501
+		$event = EEH_Event_View::get_event($EVT_ID);
502
+		if ($event instanceof EE_Event) {
503 503
 			// can the user edit this post ?
504
-			if ( current_user_can( 'edit_post', $event->ID() )) {
504
+			if (current_user_can('edit_post', $event->ID())) {
505 505
 				// set link text
506
-				$link = ! empty( $link ) ? $link : __('edit this event');
506
+				$link = ! empty($link) ? $link : __('edit this event');
507 507
 				// generate nonce
508
-				$nonce = wp_create_nonce( 'edit_nonce' );
508
+				$nonce = wp_create_nonce('edit_nonce');
509 509
 				// generate url to event editor for this event
510
-				$url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() );
510
+				$url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url());
511 511
 				// get edit CPT text
512
-				$post_type_obj = get_post_type_object( 'espresso_events' );
512
+				$post_type_obj = get_post_type_object('espresso_events');
513 513
 				// build final link html
514
-				$link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>';
514
+				$link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>';
515 515
 				// put it all together
516
-				return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after;
516
+				return $before.apply_filters('edit_post_link', $link, $event->ID()).$after;
517 517
 			}
518 518
 		}
519 519
 		return '';
Please login to merge, or discard this patch.
core/helpers/EEH_Address.helper.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
 		$add_wrapper = true
36 36
 	) {
37 37
 		// check that incoming object implements the EEI_Address interface
38
-		if ( ! $obj_with_address instanceof EEI_Address ) {
39
-			$msg = __( 'The address could not be formatted.', 'event_espresso' );
38
+		if ( ! $obj_with_address instanceof EEI_Address) {
39
+			$msg = __('The address could not be formatted.', 'event_espresso');
40 40
 			$dev_msg = __(
41 41
 				'The Address Formatter requires passed objects to implement the EEI_Address interface.',
42 42
 				'event_espresso'
43 43
 			);
44
-			EE_Error::add_error( $msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
44
+			EE_Error::add_error($msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
45 45
 			return null;
46 46
 		}
47 47
 		// obtain an address formatter
48
-		$formatter = EEH_Address::_get_formatter( $type );
48
+		$formatter = EEH_Address::_get_formatter($type);
49 49
 		// apply schema.org formatting ?
50 50
 		$use_schema = ! is_admin() ? $use_schema : false;
51 51
 		$formatted_address = $use_schema
52
-			? EEH_Address::_schema_formatting( $formatter, $obj_with_address )
53
-			: EEH_Address::_regular_formatting( $formatter, $obj_with_address, $add_wrapper );
52
+			? EEH_Address::_schema_formatting($formatter, $obj_with_address)
53
+			: EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper);
54 54
 		$formatted_address = $add_wrapper && ! $use_schema
55
-			? '<div class="espresso-address-dv">' . $formatted_address . '</div>'
55
+			? '<div class="espresso-address-dv">'.$formatted_address.'</div>'
56 56
 			: $formatted_address;
57 57
 		// return the formatted address
58 58
 		return $formatted_address;
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 * @param string $type how the address is formatted. for example: 'multiline' or 'inline'
68 68
 	 * @return EEI_Address_Formatter
69 69
 	 */
70
-	private static function _get_formatter( $type ) {
71
-		switch ( $type ) {
70
+	private static function _get_formatter($type) {
71
+		switch ($type) {
72 72
 			case 'multiline' :
73 73
 				return new EventEspresso\core\services\address\formatters\MultiLineAddressFormatter();
74 74
 			case 'inline' :
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 	 * @param object EEI_Address $obj_with_address
122 122
 	 * @return string
123 123
 	 */
124
-	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ) {
124
+	private static function _schema_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address) {
125 125
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
126 126
 		$formatted_address .= $formatter->format(
127
-			EEH_Schema::streetAddress( $obj_with_address ),
128
-			EEH_Schema::postOfficeBoxNumber( $obj_with_address ),
129
-			EEH_Schema::addressLocality( $obj_with_address ),
130
-			EEH_Schema::addressRegion( $obj_with_address ),
131
-			EEH_Schema::postalCode( $obj_with_address ),
132
-			EEH_Schema::addressCountry( $obj_with_address ),
127
+			EEH_Schema::streetAddress($obj_with_address),
128
+			EEH_Schema::postOfficeBoxNumber($obj_with_address),
129
+			EEH_Schema::addressLocality($obj_with_address),
130
+			EEH_Schema::addressRegion($obj_with_address),
131
+			EEH_Schema::postalCode($obj_with_address),
132
+			EEH_Schema::addressCountry($obj_with_address),
133 133
 			$obj_with_address->country_ID()
134 134
 		);
135 135
 		$formatted_address .= '</div>';
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 1 patch
Spacing   +377 added lines, -377 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 * 	@return string
70 70
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
71 71
 	 */
72
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
72
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
73 73
 		
74
-		if ( empty($input_vars) ) {
75
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
74
+		if (empty($input_vars)) {
75
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
76 76
 			return FALSE;
77 77
 		}
78 78
 
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
 				'append_content' => ''
99 99
 				);
100 100
 
101
-			$input_value = wp_parse_args( $input_value, $defaults );
101
+			$input_value = wp_parse_args($input_value, $defaults);
102 102
 
103 103
 			// required fields get a *
104 104
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
105 105
 			// and the css class "required"
106
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
107
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
106
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
107
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
108 108
 
109
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
110
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
109
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
110
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
111 111
 
112 112
 			//rows or cols?
113
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
114
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
113
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
114
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
115 115
 
116 116
 			//any content?
117 117
 			$append_content = $input_value['append_content'];
118 118
 
119
-			$output .= (!$close) ? '<ul>' : '';
119
+			$output .= ( ! $close) ? '<ul>' : '';
120 120
 			$output .= '<li>';
121 121
 
122 122
 			// what type of input are we dealing with ?
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 
125 125
 				// text inputs
126 126
 				case 'text' :
127
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
128
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
127
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
128
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
129 129
 					break;
130 130
 
131 131
 				// dropdowns
132 132
 				case 'select' :
133 133
 
134
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
135
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
134
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
135
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
136 136
 
137 137
 					if (is_array($input_value['options'])) {
138 138
 						$options = $input_value['options'];
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
 					}
142 142
 
143 143
 					foreach ($options as $key => $value) {
144
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
144
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
145 145
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
146
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
146
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
147 147
 					}
148
-					$output .= "\n\t\t\t" . '</select>';
148
+					$output .= "\n\t\t\t".'</select>';
149 149
 
150 150
 					break;
151 151
 
152 152
 				case 'textarea' :
153 153
 
154
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
155
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
154
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
155
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
156 156
 					break;
157 157
 
158 158
 				case 'hidden' :
159 159
 					$close = false;
160 160
 					$output .= "</li></ul>";
161
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
161
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
162 162
 					break;
163 163
 
164 164
 				case 'checkbox' :
165
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
166
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
167
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
165
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
166
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
167
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
168 168
 					break;
169 169
 
170 170
 				case 'wp_editor' :
@@ -177,19 +177,19 @@  discard block
 block discarded – undo
177 177
 					);
178 178
 					$output .= '</li>';
179 179
 					$output .= '</ul>';
180
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
181
-					if ( $append_content ) {
180
+					$output .= '<h4>'.$input_value['label'].'</h4>';
181
+					if ($append_content) {
182 182
 						$output .= $append_content;
183 183
 					}
184 184
 					ob_start();
185
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
185
+					wp_editor($input_value['value'], $field_id, $editor_settings);
186 186
 					$editor = ob_get_contents();
187 187
 					ob_end_clean();
188 188
 					$output .= $editor;
189 189
 					break;
190 190
 
191 191
 				}
192
-				if ( $append_content && $input_value['input'] !== 'wp_editor' ) {
192
+				if ($append_content && $input_value['input'] !== 'wp_editor') {
193 193
 					$output .= $append_content;
194 194
 				}
195 195
 				$output .= ($close) ? '</li>' : '';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$form_fields = array();
231 231
 		$fields = (array) $fields;
232 232
 
233
-		foreach ( $fields as $field_name => $field_atts ) {
233
+		foreach ($fields as $field_name => $field_atts) {
234 234
 			//defaults:
235 235
 			$defaults = array(
236 236
 				'label' => '',
@@ -248,67 +248,67 @@  discard block
 block discarded – undo
248 248
 				'wpeditor_args' => array()
249 249
 				);
250 250
 			// merge defaults with passed arguments
251
-			$_fields = wp_parse_args( $field_atts, $defaults);
252
-			extract( $_fields );
251
+			$_fields = wp_parse_args($field_atts, $defaults);
252
+			extract($_fields);
253 253
 			// generate label
254
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
254
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
255 255
 			// generate field name
256
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
256
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
257 257
 
258 258
 			//tabindex
259
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
259
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
260 260
 
261 261
 			//we determine what we're building based on the type
262
-			switch ( $type ) {
262
+			switch ($type) {
263 263
 
264 264
 				case 'textarea' :
265
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
265
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
266 266
 						$fld .= $extra_desc;
267 267
 					break;
268 268
 
269 269
 				case 'checkbox' :
270 270
 						$c_input = '';
271
-						if ( is_array($value) ) {
272
-							foreach ( $value as $key => $val ) {
273
-								$c_id = $field_name . '_' . $value;
274
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
275
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
276
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
277
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
271
+						if (is_array($value)) {
272
+							foreach ($value as $key => $val) {
273
+								$c_id = $field_name.'_'.$value;
274
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
275
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
276
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
277
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
278 278
 							}
279 279
 							$fld = $c_input;
280 280
 						} else {
281
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
282
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
281
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
282
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
283 283
 						}
284 284
 					break;
285 285
 
286 286
 				case 'radio' :
287 287
 						$c_input = '';
288
-						if ( is_array($value) ) {
289
-							foreach ( $value as $key => $val ) {
290
-								$c_id = $field_name . '_' . $value;
291
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
292
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
293
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
294
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
288
+						if (is_array($value)) {
289
+							foreach ($value as $key => $val) {
290
+								$c_id = $field_name.'_'.$value;
291
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
292
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
293
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
294
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
295 295
 							}
296 296
 							$fld = $c_input;
297 297
 						} else {
298
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
299
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
298
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
299
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
300 300
 						}
301 301
 					break;
302 302
 
303 303
 				case 'hidden' :
304
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
304
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
305 305
 					break;
306 306
 
307 307
 				case 'select' :
308
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
309
-						foreach ( $value as $key => $val ) {
310
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
311
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
308
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
309
+						foreach ($value as $key => $val) {
310
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
311
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
312 312
 						}
313 313
 						$fld .= '</select>';
314 314
 					break;
@@ -320,21 +320,21 @@  discard block
 block discarded – undo
320 320
 							'editor_class' => $class,
321 321
 							'tabindex' => $tabindex
322 322
 							);
323
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
323
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
324 324
 						ob_start();
325
-						wp_editor( $value, $id, $editor_settings );
325
+						wp_editor($value, $id, $editor_settings);
326 326
 						$editor = ob_get_contents();
327 327
 						ob_end_clean();
328 328
 						$fld = $editor;
329 329
 					break;
330 330
 
331 331
 				default : //'text fields'
332
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
332
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
333 333
 						$fld .= $extra_desc;
334 334
 
335 335
 			}
336 336
 
337
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
337
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
338 338
 		}
339 339
 
340 340
 		return $form_fields;
@@ -363,19 +363,19 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
365 365
 		//if $values was submitted in the wrong format, convert it over
366
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
367
-			$converted_values=array();
368
-			foreach($values as $id=>$text){
369
-				$converted_values[]=array('id'=>$id,'text'=>$text);
366
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
367
+			$converted_values = array();
368
+			foreach ($values as $id=>$text) {
369
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
370 370
 			}
371
-			$values=$converted_values;
371
+			$values = $converted_values;
372 372
 		}
373 373
 
374
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
374
+		$field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"';
375 375
 		//Debug
376 376
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
377
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
378
-			$field .= ' ' . $parameters;
377
+		if (EEH_Formatter::ee_tep_not_null($parameters))
378
+			$field .= ' '.$parameters;
379 379
 		if ($autosize) {
380 380
 			$size = 'med';
381 381
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -388,21 +388,21 @@  discard block
 block discarded – undo
388 388
 			$size = '';
389 389
 		}
390 390
 
391
-		$field .= ' class="' . $class . ' ' . $size . '">';
391
+		$field .= ' class="'.$class.' '.$size.'">';
392 392
 
393 393
 		if (empty($default) && isset($GLOBALS[$name]))
394 394
 			$default = stripslashes($GLOBALS[$name]);
395 395
 
396 396
 
397 397
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
398
-			$field .= '<option value="' . $values[$i]['id'] . '"';
398
+			$field .= '<option value="'.$values[$i]['id'].'"';
399 399
 			if ($default == $values[$i]['id']) {
400 400
 				$field .= ' selected = "selected"';
401 401
 			}
402
-			if ( isset( $values[$i]['class'] ) ) {
403
-				$field .= ' class="' . $values[$i]['class'] . '"';
402
+			if (isset($values[$i]['class'])) {
403
+				$field .= ' class="'.$values[$i]['class'].'"';
404 404
 			}
405
-			$field .= '>' . $values[$i]['text'] . '</option>';
405
+			$field .= '>'.$values[$i]['text'].'</option>';
406 406
 		}
407 407
 		$field .= '</select>';
408 408
 
@@ -420,38 +420,38 @@  discard block
 block discarded – undo
420 420
 	 * @param string $question_groups
421 421
 	 * @return string HTML
422 422
 	 */
423
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
423
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
424 424
 
425 425
 		$html = '';
426
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
427
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
426
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
427
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
428 428
 
429
-		if ( ! empty( $question_groups )) {
429
+		if ( ! empty($question_groups)) {
430 430
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
431 431
 			// loop thru question groups
432
-			foreach ( $question_groups as $QSG ) {
432
+			foreach ($question_groups as $QSG) {
433 433
 				// check that questions exist
434
-				if ( ! empty( $QSG['QSG_questions'] )) {
434
+				if ( ! empty($QSG['QSG_questions'])) {
435 435
 					// use fieldsets
436
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
436
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
437 437
 					// group_name
438
-					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : '';
438
+					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : '';
439 439
 					// group_desc
440
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
440
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
441 441
 
442 442
 					$html .= $before_question_group_questions;
443 443
 					// loop thru questions
444
-					foreach ( $QSG['QSG_questions'] as $question ) {
444
+					foreach ($QSG['QSG_questions'] as $question) {
445 445
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
446 446
 						$QFI = new EE_Question_Form_Input(
447 447
 							$question['qst_obj'],
448 448
 							$question['ans_obj'],
449 449
 							$question
450 450
 						);
451
-						$html .= self::generate_form_input( $QFI );
451
+						$html .= self::generate_form_input($QFI);
452 452
 					}
453 453
 					$html .= $after_question_group_questions;
454
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
454
+					$html .= "\n\t".'</'.$group_wrapper.'>';
455 455
 				}
456 456
 			}
457 457
 		}
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
 	 * @param string       $group_wrapper
472 472
 	 * @return string HTML
473 473
 	 */
474
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
474
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
475 475
 
476 476
 		$html = '';
477
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
478
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
477
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
478
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
479 479
 
480 480
 		$default_q_meta = array(
481 481
 				'att_nmbr' => 1,
@@ -484,55 +484,55 @@  discard block
 block discarded – undo
484 484
 				'input_id' => '',
485 485
 				'input_class' => ''
486 486
 		);
487
-		$q_meta = array_merge( $default_q_meta, $q_meta );
487
+		$q_meta = array_merge($default_q_meta, $q_meta);
488 488
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
489 489
 
490
-		if ( ! empty( $question_groups )) {
490
+		if ( ! empty($question_groups)) {
491 491
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
492 492
 			// loop thru question groups
493
-			foreach ( $question_groups as $QSG ) {
494
-				if ( $QSG instanceof EE_Question_Group ) {
493
+			foreach ($question_groups as $QSG) {
494
+				if ($QSG instanceof EE_Question_Group) {
495 495
 					// check that questions exist
496 496
 
497
-					$where = array( 'QST_deleted' => 0 );
498
-					if ( ! $from_admin ) {
497
+					$where = array('QST_deleted' => 0);
498
+					if ( ! $from_admin) {
499 499
 						$where['QST_admin_only'] = 0;
500 500
 					}
501
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
502
-					if ( ! empty( $questions )) {
501
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
502
+					if ( ! empty($questions)) {
503 503
 						// use fieldsets
504
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
504
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
505 505
 						// group_name
506
-						if ( $QSG->show_group_name() ) {
507
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
506
+						if ($QSG->show_group_name()) {
507
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
508 508
 						}
509 509
 						// group_desc
510
-						if ( $QSG->show_group_desc() ) {
511
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
510
+						if ($QSG->show_group_desc()) {
511
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
512 512
 						}
513 513
 
514 514
 						$html .= $before_question_group_questions;
515 515
 						// loop thru questions
516
-						foreach ( $questions as $QST ) {
516
+						foreach ($questions as $QST) {
517 517
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
518 518
 
519 519
 							$answer = NULL;
520 520
 
521
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
521
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
522 522
 								// check for answer in $_GET in case we are reprocessing a form after an error
523
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
524
-									$answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] );
523
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
524
+									$answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]);
525 525
 								}
526
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
526
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
527 527
 								//attendee data from the session
528
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
528
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
529 529
 							}
530 530
 
531 531
 
532 532
 
533 533
 							$QFI = new EE_Question_Form_Input(
534 534
 									$QST,
535
-									EE_Answer::new_instance ( array(
535
+									EE_Answer::new_instance(array(
536 536
 											'ANS_ID'=> 0,
537 537
 											'QST_ID'=> 0,
538 538
 											'REG_ID'=> 0,
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
 									$q_meta
542 542
 							);
543 543
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
544
-							$html .= self::generate_form_input( $QFI );
544
+							$html .= self::generate_form_input($QFI);
545 545
 						}
546 546
 						$html .= $after_question_group_questions;
547
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
547
+						$html .= "\n\t".'</'.$group_wrapper.'>';
548 548
 					}
549 549
 				}
550 550
 			}
@@ -564,63 +564,63 @@  discard block
 block discarded – undo
564 564
 	 * @param EE_Question_Form_Input $QFI
565 565
 	 * @return string HTML
566 566
 	 */
567
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
568
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
567
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
568
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
569 569
 			return '';
570 570
 		}
571 571
 
572
-		$QFI = self::_load_system_dropdowns( $QFI );
573
-		$QFI = self::_load_specialized_dropdowns( $QFI );
572
+		$QFI = self::_load_system_dropdowns($QFI);
573
+		$QFI = self::_load_specialized_dropdowns($QFI);
574 574
 
575 575
 		//we also need to verify
576 576
 
577 577
 		$display_text = $QFI->get('QST_display_text');
578 578
 		$input_name = $QFI->get('QST_input_name');
579
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
579
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
580 580
 		$input_id = $QFI->get('QST_input_id');
581 581
 		$input_class = $QFI->get('QST_input_class');
582 582
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
583 583
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
584
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
584
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
585 585
 		$QST_required = $QFI->get('QST_required');
586
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
587
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
588
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
589
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
586
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
587
+		$use_html_entities = $QFI->get_meta('htmlentities');
588
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
589
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
590 590
 		$label_class = 'espresso-form-input-lbl';
591
-		$QST_options = $QFI->options(true,$answer);
592
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
591
+		$QST_options = $QFI->options(true, $answer);
592
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
593 593
 		$system_ID = $QFI->get('QST_system');
594
-		$label_b4 = $QFI->get_meta( 'label_b4' );
595
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
594
+		$label_b4 = $QFI->get_meta('label_b4');
595
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
596 596
 
597 597
 
598
-		switch ( $QFI->get('QST_type') ){
598
+		switch ($QFI->get('QST_type')) {
599 599
 
600 600
 			case 'TEXTAREA' :
601
-					return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
601
+					return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
602 602
 				break;
603 603
 
604 604
 			case 'DROPDOWN' :
605
-					return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE );
605
+					return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE);
606 606
 				break;
607 607
 
608 608
 
609 609
 			case 'RADIO_BTN' :
610
-					return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label );
610
+					return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label);
611 611
 				break;
612 612
 
613 613
 			case 'CHECKBOX' :
614
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities );
614
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities);
615 615
 				break;
616 616
 
617 617
 			case 'DATE' :
618
-					return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
618
+					return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
619 619
 				break;
620 620
 
621 621
 			case 'TEXT' :
622 622
 			default:
623
-					return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
623
+					return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
624 624
 				break;
625 625
 
626 626
 		}
@@ -646,31 +646,31 @@  discard block
 block discarded – undo
646 646
 	 * @param string $disabled 		disabled="disabled" or null
647 647
 	 * @return string HTML
648 648
 	 */
649
-	static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
649
+	static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
650 650
 		// need these
651
-		if ( ! $question || ! $name ) {
651
+		if ( ! $question || ! $name) {
652 652
 			return NULL;
653 653
 		}
654 654
 		// prep the answer
655
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
655
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
656 656
 		// prep the required array
657
-		$required = self::prep_required( $required );
657
+		$required = self::prep_required($required);
658 658
 		// set disabled tag
659
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
659
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
660 660
 		// ya gots ta have style man!!!
661 661
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
662
-		$class = empty( $class ) ? $txt_class : $class;
663
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
664
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
662
+		$class = empty($class) ? $txt_class : $class;
663
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
664
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
665 665
 
666
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
666
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
667 667
 		// filter label but ensure required text comes before it
668
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
668
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
669 669
 
670
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . esc_attr( $answer ) . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
670
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.esc_attr($answer).'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
671 671
 
672
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
673
-		return  $label_html . $input_html;
672
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
673
+		return  $label_html.$input_html;
674 674
 
675 675
 	}
676 676
 
@@ -692,35 +692,35 @@  discard block
 block discarded – undo
692 692
 	 * @param string $disabled 		disabled="disabled" or null
693 693
 	 * @return string HTML
694 694
 	 */
695
-	static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
695
+	static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
696 696
 		// need these
697
-		if ( ! $question || ! $name ) {
697
+		if ( ! $question || ! $name) {
698 698
 			return NULL;
699 699
 		}
700 700
 		// prep the answer
701
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
701
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
702 702
 		// prep the required array
703
-		$required = self::prep_required( $required );
703
+		$required = self::prep_required($required);
704 704
 		// make sure $dimensions is an array
705
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
705
+		$dimensions = is_array($dimensions) ? $dimensions : array();
706 706
 		// and set some defaults
707
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
707
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
708 708
 		// set disabled tag
709
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
709
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
710 710
 		// ya gots ta have style man!!!
711 711
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
712
-		$class = empty( $class ) ? $txt_class : $class;
713
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
714
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
712
+		$class = empty($class) ? $txt_class : $class;
713
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
714
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
715 715
 
716
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
716
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
717 717
 		// filter label but ensure required text comes before it
718
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
718
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
719 719
 
720
-		$input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>';
720
+		$input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'"  title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>';
721 721
 
722
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
723
-		return  $label_html . $input_html;
722
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
723
+		return  $label_html.$input_html;
724 724
 
725 725
 	}
726 726
 
@@ -743,47 +743,47 @@  discard block
 block discarded – undo
743 743
 	 * @param string $disabled 		disabled="disabled" or null
744 744
 	 * @return string HTML
745 745
 	 */
746
-	static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) {
746
+	static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) {
747 747
 
748 748
 		// need these
749
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
749
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
750 750
 			return NULL;
751 751
 		}
752 752
 		// prep the answer
753
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer ), $use_html_entities) : self::prep_answer( $answer, $use_html_entities );
753
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer), $use_html_entities) : self::prep_answer($answer, $use_html_entities);
754 754
 		// prep the required array
755
-		$required = self::prep_required( $required );
755
+		$required = self::prep_required($required);
756 756
 		// set disabled tag
757
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
757
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
758 758
 		// ya gots ta have style man!!!
759 759
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
760
-		$class = empty( $class ) ? $txt_class : $class;
761
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
762
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
760
+		$class = empty($class) ? $txt_class : $class;
761
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
762
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
763 763
 
764
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
764
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
765 765
 		// filter label but ensure required text comes before it
766
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
766
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
767 767
 
768
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
768
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
769 769
 		// recursively count array elements, to determine total number of options
770
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
771
-		if ( ! $only_option ) {
770
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
771
+		if ( ! $only_option) {
772 772
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
773 773
 			$selected = $answer === NULL ? ' selected="selected"' : '';
774
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
774
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
775 775
 		}
776
-		foreach ( $options as $key => $value ) {
776
+		foreach ($options as $key => $value) {
777 777
 			// if value is an array, then create option groups, else create regular ol' options
778
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer, $use_html_entities ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option, $use_html_entities );
778
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer, $use_html_entities) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option, $use_html_entities);
779 779
 		}
780 780
 
781
-		$input_html .= "\n\t\t\t" . '</select>';
781
+		$input_html .= "\n\t\t\t".'</select>';
782 782
 
783
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
783
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
784 784
 
785
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
786
-		return  $label_html . $input_html;
785
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
786
+		return  $label_html.$input_html;
787 787
 
788 788
 	}
789 789
 
@@ -801,12 +801,12 @@  discard block
 block discarded – undo
801 801
 	 * @param boolean $use_html_entities
802 802
 	 * @return string
803 803
 	 */
804
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer, $use_html_entities = true ){
805
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
806
-		foreach ( $QSOs as $QSO ) {
807
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer, false, $use_html_entities );
804
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true) {
805
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
806
+		foreach ($QSOs as $QSO) {
807
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities);
808 808
 		}
809
-		$html .= "\n\t\t\t\t" . '</optgroup>';
809
+		$html .= "\n\t\t\t\t".'</optgroup>';
810 810
 		return $html;
811 811
 	}
812 812
 
@@ -821,12 +821,12 @@  discard block
 block discarded – undo
821 821
 	 * @param boolean $use_html_entities
822 822
 	 * @return string
823 823
 	 */
824
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE, $use_html_entities = true ){
825
-		$key = self::prep_answer( $key, $use_html_entities );
826
-		$value = self::prep_answer( $value, $use_html_entities );
827
-		$value = ! empty( $value ) ? $value : $key;
828
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
829
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
824
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE, $use_html_entities = true) {
825
+		$key = self::prep_answer($key, $use_html_entities);
826
+		$value = self::prep_answer($value, $use_html_entities);
827
+		$value = ! empty($value) ? $value : $key;
828
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
829
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
830 830
 	}
831 831
 
832 832
 
@@ -850,56 +850,56 @@  discard block
 block discarded – undo
850 850
 	 * @param bool        $use_desc_4_label
851 851
 	 * @return string HTML
852 852
 	 */
853
-	static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) {
853
+	static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) {
854 854
 		// need these
855
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
855
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
856 856
 			return NULL;
857 857
 		}
858 858
 		// prep the answer
859
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
859
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
860 860
 		// prep the required array
861
-		$required = self::prep_required( $required );
861
+		$required = self::prep_required($required);
862 862
 		// set disabled tag
863
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
863
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
864 864
 		// ya gots ta have style man!!!
865 865
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
866
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
867
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
866
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
867
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
868 868
 
869
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
869
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
870 870
 		// filter label but ensure required text comes before it
871
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
871
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
872 872
 
873
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
873
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
874 874
 
875
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
876
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
875
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
876
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
877 877
 
878
-		foreach ( $options as $OPT ) {
879
-			if ( $OPT instanceof EE_Question_Option ) {
880
-				$value = self::prep_option_value( $OPT->value() );
878
+		foreach ($options as $OPT) {
879
+			if ($OPT instanceof EE_Question_Option) {
880
+				$value = self::prep_option_value($OPT->value());
881 881
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
882
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
883
-				$desc = $OPT->desc();//no self::prep_answer
884
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
885
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
886
-				$opt = '-' . sanitize_key( $value );
887
-
888
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
889
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
890
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
891
-				$input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
892
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
893
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
894
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
895
-				$input_html .= "\n\t\t\t\t" . '</li>';
882
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
883
+				$desc = $OPT->desc(); //no self::prep_answer
884
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
885
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
886
+				$opt = '-'.sanitize_key($value);
887
+
888
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
889
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
890
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
891
+				$input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
892
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
893
+				$input_html .= "\n\t\t\t\t\t".'</label>';
894
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
895
+				$input_html .= "\n\t\t\t\t".'</li>';
896 896
 			}
897 897
 		}
898 898
 
899
-		$input_html .= "\n\t\t\t" . '</ul>';
899
+		$input_html .= "\n\t\t\t".'</ul>';
900 900
 
901
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
902
-		return  $label_html . $input_html;
901
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
902
+		return  $label_html.$input_html;
903 903
 
904 904
 	}
905 905
 
@@ -922,65 +922,65 @@  discard block
 block discarded – undo
922 922
 	 * @param string $disabled 		disabled="disabled" or null
923 923
 	 * @return string HTML
924 924
 	 */
925
-	static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
925
+	static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
926 926
 		// need these
927
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
927
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
928 928
 			return NULL;
929 929
 		}
930
-		$answer = maybe_unserialize( $answer );
930
+		$answer = maybe_unserialize($answer);
931 931
 
932 932
 		// prep the answer(s)
933
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
933
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
934 934
 
935
-		foreach ( $answer as $key => $value ) {
936
-			$key = self::prep_option_value( $key );
937
-			$answer[$key] = self::prep_answer( $value, $use_html_entities );
935
+		foreach ($answer as $key => $value) {
936
+			$key = self::prep_option_value($key);
937
+			$answer[$key] = self::prep_answer($value, $use_html_entities);
938 938
 		}
939 939
 
940 940
 		// prep the required array
941
-		$required = self::prep_required( $required );
941
+		$required = self::prep_required($required);
942 942
 		// set disabled tag
943
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
943
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
944 944
 		// ya gots ta have style man!!!
945 945
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
946
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
947
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
946
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
947
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
948 948
 
949
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
949
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
950 950
 		// filter label but ensure required text comes before it
951
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
952
-
953
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
954
-
955
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
956
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
957
-
958
-		foreach ( $options as $OPT ) {
959
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
960
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
961
-			$text = self::prep_answer( $OPT->value() );
962
-			$desc = $OPT->desc() ;
963
-			$opt = '-' . sanitize_key( $value );
964
-
965
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
966
-
967
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
968
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
969
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
970
-			$input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
971
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
972
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
973
-			if ( ! empty( $desc ) && $desc != $text ) {
974
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
951
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
952
+
953
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
954
+
955
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
956
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
957
+
958
+		foreach ($options as $OPT) {
959
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
960
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
961
+			$text = self::prep_answer($OPT->value());
962
+			$desc = $OPT->desc();
963
+			$opt = '-'.sanitize_key($value);
964
+
965
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
966
+
967
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
968
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
969
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
970
+			$input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
971
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
972
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
973
+			if ( ! empty($desc) && $desc != $text) {
974
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
975 975
 			}
976
-			$input_html .= "\n\t\t\t\t" . '</li>';
976
+			$input_html .= "\n\t\t\t\t".'</li>';
977 977
 
978 978
 		}
979 979
 
980
-		$input_html .= "\n\t\t\t" . '</ul>';
980
+		$input_html .= "\n\t\t\t".'</ul>';
981 981
 
982
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
983
-		return  $label_html . $input_html;
982
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
983
+		return  $label_html.$input_html;
984 984
 
985 985
 	}
986 986
 
@@ -1002,36 +1002,36 @@  discard block
 block discarded – undo
1002 1002
 	 * @param string $disabled 		disabled="disabled" or null
1003 1003
 	 * @return string HTML
1004 1004
 	 */
1005
-	static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
1005
+	static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
1006 1006
 		// need these
1007
-		if ( ! $question || ! $name ) {
1007
+		if ( ! $question || ! $name) {
1008 1008
 			return NULL;
1009 1009
 		}
1010 1010
 		// prep the answer
1011
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
1011
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1012 1012
 		// prep the required array
1013
-		$required = self::prep_required( $required );
1013
+		$required = self::prep_required($required);
1014 1014
 		// set disabled tag
1015
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
1015
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
1016 1016
 		// ya gots ta have style man!!!
1017 1017
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1018
-		$class = empty( $class ) ? $txt_class : $class;
1019
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
1020
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
1018
+		$class = empty($class) ? $txt_class : $class;
1019
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
1020
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1021 1021
 
1022
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
1022
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
1023 1023
 		// filter label but ensure required text comes before it
1024
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
1024
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1025 1025
 
1026
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>';
1026
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
1027 1027
 
1028 1028
 		// enqueue scripts
1029
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION );
1030
-		wp_enqueue_style( 'espresso-ui-theme');
1031
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1029
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1030
+		wp_enqueue_style('espresso-ui-theme');
1031
+		wp_enqueue_script('jquery-ui-datepicker');
1032 1032
 
1033
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1034
-		return  $label_html . $input_html;
1033
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1034
+		return  $label_html.$input_html;
1035 1035
 
1036 1036
 	}
1037 1037
 
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 	 * 	@access public
1044 1044
 	 * 	@return 	string
1045 1045
 	 */
1046
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1046
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1047 1047
 		return $required_text;
1048 1048
 	}
1049 1049
 
@@ -1057,9 +1057,9 @@  discard block
 block discarded – undo
1057 1057
 	 * @param string $value
1058 1058
 	 * @return string HTML
1059 1059
 	 */
1060
-	static function hidden_input( $name, $value, $id = '' ){
1061
-		$id = ! empty( $id ) ? $id : $name;
1062
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1060
+	static function hidden_input($name, $value, $id = '') {
1061
+		$id = ! empty($id) ? $id : $name;
1062
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1063 1063
 	}
1064 1064
 
1065 1065
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 	 * @param string $question
1072 1072
 	 * @return string
1073 1073
 	 */
1074
-	static function prep_question( $question ){
1074
+	static function prep_question($question) {
1075 1075
 		return $question;
1076 1076
 //		$link = '';
1077 1077
 //		// does this label have a help link attached ?
@@ -1094,13 +1094,13 @@  discard block
 block discarded – undo
1094 1094
 	 * @param mixed $answer
1095 1095
 	 * @return string
1096 1096
 	 */
1097
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1097
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1098 1098
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1099
-		if ( is_bool( $answer ) ) {
1099
+		if (is_bool($answer)) {
1100 1100
 			$answer = $answer ? 1 : 0;
1101 1101
 		}
1102
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1103
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1102
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1103
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1104 1104
 	}
1105 1105
 
1106 1106
 
@@ -1110,18 +1110,18 @@  discard block
 block discarded – undo
1110 1110
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1111 1111
 	 * 	@return array
1112 1112
 	 */
1113
-	public static function prep_answer_options( $QSOs = array() ){
1113
+	public static function prep_answer_options($QSOs = array()) {
1114 1114
 		$prepped_answer_options = array();
1115
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1116
-			foreach( $QSOs as $key => $QSO ) {
1117
-				if ( ! $QSO instanceof EE_Question_Option ) {
1118
-					$QSO = EE_Question_Option::new_instance( array(
1119
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1120
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1115
+		if (is_array($QSOs) && ! empty($QSOs)) {
1116
+			foreach ($QSOs as $key => $QSO) {
1117
+				if ( ! $QSO instanceof EE_Question_Option) {
1118
+					$QSO = EE_Question_Option::new_instance(array(
1119
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1120
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1121 1121
 					));
1122 1122
 				}
1123
-				if ( $QSO->opt_group() ) {
1124
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1123
+				if ($QSO->opt_group()) {
1124
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1125 1125
 				} else {
1126 1126
 					$prepped_answer_options[] = $QSO;
1127 1127
 				}
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
 	 * @param string $option_value
1138 1138
 	 * @return string
1139 1139
 	 */
1140
-	static function prep_option_value( $option_value ){
1141
-		return esc_attr( trim( stripslashes( $option_value ) ) );
1140
+	static function prep_option_value($option_value) {
1141
+		return esc_attr(trim(stripslashes($option_value)));
1142 1142
 	}
1143 1143
 
1144 1144
 
@@ -1149,11 +1149,11 @@  discard block
 block discarded – undo
1149 1149
 	 * @param string|array 	$required
1150 1150
 	 * @return array
1151 1151
 	 */
1152
-	static function prep_required( $required = array() ){
1152
+	static function prep_required($required = array()) {
1153 1153
 		// make sure required is an array
1154
-		$required = is_array( $required ) ? $required : array();
1154
+		$required = is_array($required) ? $required : array();
1155 1155
 		// and set some defaults
1156
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1156
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1157 1157
 		return $required;
1158 1158
 	}
1159 1159
 
@@ -1164,30 +1164,30 @@  discard block
 block discarded – undo
1164 1164
 	 * @param string 	$value
1165 1165
 	 * @return string
1166 1166
 	 */
1167
-	static function get_label_size_class( $value = FALSE ){
1168
-			if ( $value === FALSE || $value == '' ) {
1167
+	static function get_label_size_class($value = FALSE) {
1168
+			if ($value === FALSE || $value == '') {
1169 1169
 				return ' class="medium-lbl"';
1170 1170
 			}
1171 1171
 			// determine length of option value
1172
-			$val_size = strlen( $value );
1173
-			switch( $val_size ){
1172
+			$val_size = strlen($value);
1173
+			switch ($val_size) {
1174 1174
 				case $val_size < 3 :
1175
-					$size =  ' class="nano-lbl"';
1175
+					$size = ' class="nano-lbl"';
1176 1176
 					break;
1177 1177
 				case $val_size < 6 :
1178
-					$size =  ' class="micro-lbl"';
1178
+					$size = ' class="micro-lbl"';
1179 1179
 					break;
1180 1180
 				case $val_size < 12 :
1181
-					$size =  ' class="tiny-lbl"';
1181
+					$size = ' class="tiny-lbl"';
1182 1182
 					break;
1183 1183
 				case $val_size < 25 :
1184
-					$size =  ' class="small-lbl"';
1184
+					$size = ' class="small-lbl"';
1185 1185
 					break;
1186 1186
 				case $val_size > 100 :
1187
-					$size =  ' class="big-lbl"';
1187
+					$size = ' class="big-lbl"';
1188 1188
 					break;
1189 1189
 				default:
1190
-					$size =  ' class="medium-lbl"';
1190
+					$size = ' class="medium-lbl"';
1191 1191
 					break;
1192 1192
 			}
1193 1193
 		return $size;
@@ -1201,20 +1201,20 @@  discard block
 block discarded – undo
1201 1201
 	 * @param array 	$QFI
1202 1202
 	 * @return array
1203 1203
 	 */
1204
-	private static function _load_system_dropdowns( $QFI ){
1204
+	private static function _load_system_dropdowns($QFI) {
1205 1205
 		$QST_system = $QFI->get('QST_system');
1206
-		switch ( $QST_system ) {
1206
+		switch ($QST_system) {
1207 1207
 			case 'state' :
1208
-				$QFI = self::generate_state_dropdown( $QFI );
1208
+				$QFI = self::generate_state_dropdown($QFI);
1209 1209
 				break;
1210 1210
 			case 'country' :
1211
-				$QFI = self::generate_country_dropdown( $QFI );
1211
+				$QFI = self::generate_country_dropdown($QFI);
1212 1212
 				break;
1213 1213
 			case 'admin-state' :
1214
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1214
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1215 1215
 				break;
1216 1216
 			case 'admin-country' :
1217
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1217
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1218 1218
 				break;
1219 1219
 		}
1220 1220
 		return $QFI;
@@ -1231,13 +1231,13 @@  discard block
 block discarded – undo
1231 1231
 	 *
1232 1232
 	 * @return EE_Question_Form_Input
1233 1233
 	 */
1234
-	protected static function _load_specialized_dropdowns( $QFI ) {
1235
-		switch( $QFI->get( 'QST_type' ) ) {
1234
+	protected static function _load_specialized_dropdowns($QFI) {
1235
+		switch ($QFI->get('QST_type')) {
1236 1236
 			case 'STATE' :
1237
-				$QFI = self::generate_state_dropdown( $QFI );
1237
+				$QFI = self::generate_state_dropdown($QFI);
1238 1238
 				break;
1239 1239
 			case 'COUNTRY' :
1240
-				$QFI = self::generate_country_dropdown( $QFI );
1240
+				$QFI = self::generate_country_dropdown($QFI);
1241 1241
 				break;
1242 1242
 		}
1243 1243
 		return $QFI;
@@ -1251,23 +1251,23 @@  discard block
 block discarded – undo
1251 1251
 	 * @param bool  $get_all
1252 1252
 	 * @return array
1253 1253
 	 */
1254
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1254
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1255 1255
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1256
-		if ( $states && count( $states ) != count( $QST->options() )) {
1257
-			$QST->set( 'QST_type', 'DROPDOWN' );
1256
+		if ($states && count($states) != count($QST->options())) {
1257
+			$QST->set('QST_type', 'DROPDOWN');
1258 1258
 			// if multiple countries, we'll create option groups within the dropdown
1259
-			foreach ( $states as $state ) {
1260
-				if ( $state instanceof EE_State ) {
1261
-					$QSO = EE_Question_Option::new_instance ( array (
1259
+			foreach ($states as $state) {
1260
+				if ($state instanceof EE_State) {
1261
+					$QSO = EE_Question_Option::new_instance(array(
1262 1262
 						'QSO_value' => $state->ID(),
1263 1263
 						'QSO_desc' => $state->name(),
1264
-						'QST_ID' => $QST->get( 'QST_ID' ),
1264
+						'QST_ID' => $QST->get('QST_ID'),
1265 1265
 						'QSO_deleted' => FALSE
1266 1266
 					));
1267 1267
 					// set option group
1268
-					$QSO->set_opt_group( $state->country()->name() );
1268
+					$QSO->set_opt_group($state->country()->name());
1269 1269
 					// add option to question
1270
-					$QST->add_temp_option( $QSO );
1270
+					$QST->add_temp_option($QSO);
1271 1271
 				}
1272 1272
 			}
1273 1273
 		}
@@ -1283,20 +1283,20 @@  discard block
 block discarded – undo
1283 1283
 	 * @internal param array $question
1284 1284
 	 * @return array
1285 1285
 	 */
1286
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1286
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1287 1287
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1288
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1289
-			$QST->set( 'QST_type', 'DROPDOWN' );
1288
+		if ($countries && count($countries) != count($QST->options())) {
1289
+			$QST->set('QST_type', 'DROPDOWN');
1290 1290
 			// now add countries
1291
-			foreach ( $countries as $country ) {
1292
-				if ( $country instanceof EE_Country ) {
1293
-					$QSO = EE_Question_Option::new_instance ( array (
1291
+			foreach ($countries as $country) {
1292
+				if ($country instanceof EE_Country) {
1293
+					$QSO = EE_Question_Option::new_instance(array(
1294 1294
 						'QSO_value' => $country->ID(),
1295 1295
 						'QSO_desc' => $country->name(),
1296
-						'QST_ID' => $QST->get( 'QST_ID' ),
1296
+						'QST_ID' => $QST->get('QST_ID'),
1297 1297
 						'QSO_deleted' => FALSE
1298 1298
 					));
1299
-					$QST->add_temp_option( $QSO );
1299
+					$QST->add_temp_option($QSO);
1300 1300
 				}
1301 1301
 			}
1302 1302
 		}
@@ -1313,11 +1313,11 @@  discard block
 block discarded – undo
1313 1313
 	 */
1314 1314
 	public static function two_digit_months_dropdown_options() {
1315 1315
 		$options = array();
1316
-		for ( $x = 1; $x <= 12; $x++ ) {
1317
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1318
-			$options[ (string)$mm ] = (string)$mm;
1316
+		for ($x = 1; $x <= 12; $x++) {
1317
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1318
+			$options[(string) $mm] = (string) $mm;
1319 1319
 		}
1320
-		return EEH_Form_Fields::prep_answer_options( $options );
1320
+		return EEH_Form_Fields::prep_answer_options($options);
1321 1321
 	}
1322 1322
 
1323 1323
 
@@ -1332,11 +1332,11 @@  discard block
 block discarded – undo
1332 1332
 		$options = array();
1333 1333
 		$current_year = date('y');
1334 1334
 		$next_decade = $current_year + 10;
1335
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1336
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1337
-			$options[ (string)$yy ] = (string)$yy;
1335
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1336
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1337
+			$options[(string) $yy] = (string) $yy;
1338 1338
 		}
1339
-		return EEH_Form_Fields::prep_answer_options( $options );
1339
+		return EEH_Form_Fields::prep_answer_options($options);
1340 1340
 	}
1341 1341
 
1342 1342
 
@@ -1350,17 +1350,17 @@  discard block
 block discarded – undo
1350 1350
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1351 1351
 	 * @return string                html
1352 1352
 	 */
1353
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1353
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1354 1354
 		$_where = array();
1355
-		if ( !empty( $status ) ) {
1355
+		if ( ! empty($status)) {
1356 1356
 			$_where['STS_ID'] = $status;
1357 1357
 		}
1358 1358
 
1359
-		if ( $evt_category > 0 ) {
1359
+		if ($evt_category > 0) {
1360 1360
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1361 1361
 		}
1362 1362
 
1363
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1363
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1364 1364
 
1365 1365
 		//setup vals for select input helper
1366 1366
 		$options = array(
@@ -1370,15 +1370,15 @@  discard block
 block discarded – undo
1370 1370
 				)
1371 1371
 			);
1372 1372
 
1373
-		foreach ( $regdtts as $regdtt ) {
1374
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1373
+		foreach ($regdtts as $regdtt) {
1374
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1375 1375
 			$options[] = array(
1376 1376
 				'text' => $date,
1377 1377
 				'id' => $date
1378 1378
 				);
1379 1379
 		}
1380 1380
 
1381
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1381
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1382 1382
 	}
1383 1383
 
1384 1384
 
@@ -1392,18 +1392,18 @@  discard block
 block discarded – undo
1392 1392
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1393 1393
 	 * @return string                    html
1394 1394
 	 */
1395
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1395
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1396 1396
 		//determine what post_status our condition will have for the query.
1397
-		switch ( $status ) {
1397
+		switch ($status) {
1398 1398
 			case 'month' :
1399 1399
 			case 'today' :
1400 1400
 			case NULL :
1401 1401
 			case 'all' :
1402
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1402
+				$where['Event.status'] = array('NOT IN', array('trash'));
1403 1403
 				break;
1404 1404
 
1405 1405
 			case 'draft' :
1406
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1406
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1407 1407
 
1408 1408
 			default :
1409 1409
 				$where['Event.status'] = $status;
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		//categories?
1413 1413
 
1414 1414
 
1415
-		if ( !empty ( $evt_category ) ) {
1415
+		if ( ! empty ($evt_category)) {
1416 1416
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1417 1417
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1418 1418
 		}
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 //		$where['DTT_is_primary'] = 1;
1422 1422
 
1423
-		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status );
1423
+		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status);
1424 1424
 
1425 1425
 		//let's setup vals for select input helper
1426 1426
 		$options = array(
@@ -1435,9 +1435,9 @@  discard block
 block discarded – undo
1435 1435
 		//translate month and date
1436 1436
 		global $wp_locale;
1437 1437
 
1438
-		foreach ( $DTTS as $DTT ) {
1439
-			$localized_date = $wp_locale->get_month( $DTT->dtt_month_num ) . ' ' . $DTT->dtt_year;
1440
-			$id = $DTT->dtt_month . ' ' . $DTT->dtt_year;
1438
+		foreach ($DTTS as $DTT) {
1439
+			$localized_date = $wp_locale->get_month($DTT->dtt_month_num).' '.$DTT->dtt_year;
1440
+			$id = $DTT->dtt_month.' '.$DTT->dtt_year;
1441 1441
 			$options[] = array(
1442 1442
 				'text' => $localized_date,
1443 1443
 				'id' => $id
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 		}
1446 1446
 
1447 1447
 
1448
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1448
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1449 1449
 	}
1450 1450
 
1451 1451
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 	 * @param  integer $current_cat currently selected category
1457 1457
 	 * @return string               html for dropdown
1458 1458
 	 */
1459
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1459
+	public static function generate_event_category_dropdown($current_cat = -1) {
1460 1460
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1461 1461
 		$options = array(
1462 1462
 			'0' => array(
@@ -1466,14 +1466,14 @@  discard block
 block discarded – undo
1466 1466
 			);
1467 1467
 
1468 1468
 		//setup categories for dropdown
1469
-		foreach ( $categories as $category ) {
1469
+		foreach ($categories as $category) {
1470 1470
 			$options[] = array(
1471 1471
 				'text' => $category->get('name'),
1472 1472
 				'id' => $category->ID()
1473 1473
 				);
1474 1474
 		}
1475 1475
 
1476
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1476
+		return self::select_input('EVT_CAT', $options, $current_cat);
1477 1477
 	}
1478 1478
 
1479 1479
 
@@ -1492,20 +1492,20 @@  discard block
 block discarded – undo
1492 1492
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1493 1493
 	 * @return    void
1494 1494
 	 */
1495
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1495
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1496 1496
 		$btn = '';
1497
-		if ( empty( $url ) || empty( $ID )) {
1497
+		if (empty($url) || empty($ID)) {
1498 1498
 			return $btn;
1499 1499
 		}
1500
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1501
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1502
-		if ( ! $input_only ) {
1503
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1504
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1500
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1501
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1502
+		if ( ! $input_only) {
1503
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1504
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1505 1505
 			$btn_frm .= $btn;
1506 1506
 			$btn_frm .= '</form>';
1507 1507
 			$btn = $btn_frm;
1508
-			unset ( $btn_frm );
1508
+			unset ($btn_frm);
1509 1509
 		}
1510 1510
 		return $btn;
1511 1511
 	}
Please login to merge, or discard this patch.