Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
17:38 queued 10s
created
core/helpers/EEH_Money.helper.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * ------------------------------------------------------------------------
22 22
  */
23
-class EEH_Money extends EEH_Base  {
23
+class EEH_Money extends EEH_Base {
24 24
 
25 25
 
26 26
 	/**
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 * @param int|string $incoming_value
30 30
 	 * @return float
31 31
 	 */
32
-	public static function convert_to_float_from_localized_money( $incoming_value ) {
32
+	public static function convert_to_float_from_localized_money($incoming_value) {
33 33
 		//remove thousands separator
34
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value );
34
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value);
35 35
 
36 36
 		//replace decimal place with standard decimal.
37
-		$money_value = str_replace( EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value );
37
+		$money_value = str_replace(EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value);
38 38
 
39 39
 		//float it! and round to three decimal places
40
-		$money_value = round ( (float) $money_value, 3 );
40
+		$money_value = round((float) $money_value, 3);
41 41
 		return $money_value;
42 42
 	}
43 43
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * @throws \EE_Error
58 58
 	 */
59 59
 
60
-	public static function compare_floats( $float1, $float2, $operator='=' ) {
60
+	public static function compare_floats($float1, $float2, $operator = '=') {
61 61
 		// Check numbers to 5 digits of precision
62 62
 		$epsilon = 0.00001;
63 63
 
64
-		$float1 = (float)$float1;
65
-		$float2 = (float)$float2;
64
+		$float1 = (float) $float1;
65
+		$float2 = (float) $float2;
66 66
 
67 67
 		switch ($operator) {
68 68
 			// equal
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 				}
117 117
 				break;
118 118
 			default:
119
-				throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) );
119
+				throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso'));
120 120
 		}
121 121
 
122 122
 		return false;
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return string
133 133
 	 */
134
-	public static function get_format_for_jqplot( $CNT_ISO = '') {
134
+	public static function get_format_for_jqplot($CNT_ISO = '') {
135 135
 		//default format
136 136
 		$format = 'f';
137 137
 		//if CNT_ISO passed lets try to get currency settings for it.
138
-		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null;
138
+		$currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
139 139
 		//default currency settings for site if not set
140
-		if ( ! $currency_config instanceof EE_Currency_Config ) {
140
+		if ( ! $currency_config instanceof EE_Currency_Config) {
141 141
 			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
142 142
 		}
143 143
 
144 144
 		//first get the decimal place and number of places
145
-		$format = "%'." . $currency_config->dec_plc . $format;
145
+		$format = "%'.".$currency_config->dec_plc.$format;
146 146
 
147 147
 		//currency symbol on right side.
148
-		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
148
+		$format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign;
149 149
 		return $format;
150 150
 	}
151 151
 
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * This file contains a helper class for money type actions.
4
- *
5
- * @since %VER%
6
- * @package  Event Espresso
7
- * @subpackage helper
8
- */
3
+	 * This file contains a helper class for money type actions.
4
+	 *
5
+	 * @since %VER%
6
+	 * @package  Event Espresso
7
+	 * @subpackage helper
8
+	 */
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
10 10
  /**
11
- *
12
- * Money helper class.
13
- * This class has helper methods that help with money related conversions and calculations.
14
- *
15
- * @since %VER%
16
- *
17
- * @package		Event Espresso
18
- * @subpackage	helpers
19
- * @author		Darren Ethier
20
- *
21
- * ------------------------------------------------------------------------
22
- */
11
+  *
12
+  * Money helper class.
13
+  * This class has helper methods that help with money related conversions and calculations.
14
+  *
15
+  * @since %VER%
16
+  *
17
+  * @package		Event Espresso
18
+  * @subpackage	helpers
19
+  * @author		Darren Ethier
20
+  *
21
+  * ------------------------------------------------------------------------
22
+  */
23 23
 class EEH_Money extends EEH_Base  {
24 24
 
25 25
 
Please login to merge, or discard this patch.
core/interfaces/EEI_Duplicatable.interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *	with the exception of a particular attribute
27 27
 	 * @return object of the same class as what was called on
28 28
 	 */
29
-	public function duplicate( $options = array() );
29
+	public function duplicate($options = array());
30 30
 
31 31
 
32 32
 
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 3 patches
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html_and_js) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	/**
13 13
 	 * Subsections
@@ -68,38 +68,38 @@  discard block
 block discarded – undo
68 68
 	 * } @see EE_Form_Section_Validatable::__construct()
69 69
 	 *
70 70
 	 */
71
-	public function __construct( $options_array = array() ){
71
+	public function __construct($options_array = array()) {
72 72
 		EE_Registry::instance()->load_helper('Formatter');
73
-		$options_array = apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
73
+		$options_array = apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
74 74
 		//call parent first, as it may be setting the name
75 75
 		parent::__construct($options_array);
76 76
 		//if they've included subsections in the constructor, add them now
77
-		if( isset( $options_array['include'] )){
77
+		if (isset($options_array['include'])) {
78 78
 			//we are going to make sure we ONLY have those subsections to include
79 79
 			//AND we are going to make sure they're in that specified order
80 80
 			$reordered_subsections = array();
81
-			foreach($options_array['include'] as $input_name){
82
-				if(isset($this->_subsections[$input_name])){
81
+			foreach ($options_array['include'] as $input_name) {
82
+				if (isset($this->_subsections[$input_name])) {
83 83
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
84 84
 				}
85 85
 			}
86 86
 			$this->_subsections = $reordered_subsections;
87 87
 		}
88
-		if(isset($options_array['exclude'])){
88
+		if (isset($options_array['exclude'])) {
89 89
 			$exclude = $options_array['exclude'];
90 90
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
91 91
 		}
92
-		if(isset($options_array['layout_strategy'])){
92
+		if (isset($options_array['layout_strategy'])) {
93 93
 			$this->_layout_strategy = $options_array['layout_strategy'];
94 94
 		}
95
-		if( ! $this->_layout_strategy){
95
+		if ( ! $this->_layout_strategy) {
96 96
 			$this->_layout_strategy = new EE_Two_Column_Layout();
97 97
 		}
98 98
 		$this->_layout_strategy->_construct_finalize($this);
99 99
 
100
-		add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
101
-		add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
102
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
100
+		add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
101
+		add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
102
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
103 103
 	}
104 104
 
105 105
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 * @param string                 $name
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public function _construct_finalize( $parent_form_section, $name ) {
114
+	public function _construct_finalize($parent_form_section, $name) {
115 115
 		parent::_construct_finalize($parent_form_section, $name);
116 116
 		$this->_set_default_name_if_empty();
117 117
 		$this->_set_default_html_id_if_empty();
118
-		foreach( $this->_subsections as $subsection_name => $subsection ){
119
-			if ( $subsection instanceof EE_Form_Section_Base ) {
120
-				$subsection->_construct_finalize( $this, $subsection_name );
118
+		foreach ($this->_subsections as $subsection_name => $subsection) {
119
+			if ($subsection instanceof EE_Form_Section_Base) {
120
+				$subsection->_construct_finalize($this, $subsection_name);
121 121
 			} else {
122 122
 				throw new EE_Error(
123 123
 					sprintf(
124
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
124
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
125 125
 						$subsection_name,
126 126
 						get_class($this),
127
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
127
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
128 128
 					)
129 129
 				);
130 130
 			}
131 131
 		}
132
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
132
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
133 133
 	}
134 134
 
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * Gets the layout strategy for this form section
139 139
 	 * @return EE_Form_Section_Layout_Base
140 140
 	 */
141
-	public function get_layout_strategy(){
141
+	public function get_layout_strategy() {
142 142
 		return $this->_layout_strategy;
143 143
 	}
144 144
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @param EE_Form_Input_Base $input
151 151
 	 * @return string
152 152
 	 */
153
-	public function get_html_for_input($input){
153
+	public function get_html_for_input($input) {
154 154
 		return $this->_layout_strategy->layout_input($input);
155 155
 	}
156 156
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param null $form_data
164 164
 	 * @return boolean
165 165
 	 */
166
-	public function was_submitted($form_data = NULL){
166
+	public function was_submitted($form_data = NULL) {
167 167
 		return $this->form_data_present_in($form_data);
168 168
 	}
169 169
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 	 * to skip this step.
185 185
 	 * @return void
186 186
 	 */
187
-	public function receive_form_submission($req_data = NULL, $validate = TRUE){
188
-		if( $req_data === NULL){
187
+	public function receive_form_submission($req_data = NULL, $validate = TRUE) {
188
+		if ($req_data === NULL) {
189 189
 			$req_data = $_REQUEST;
190 190
 		}
191 191
 		$this->_normalize($req_data);
192
-		if( $validate ){
192
+		if ($validate) {
193 193
 			$this->_validate();
194 194
 		}
195 195
 	}
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 	 * the value being an array formatted in teh same way
205 205
 	 * @param array $default_data
206 206
 	 */
207
-	public function populate_defaults($default_data){
208
-		foreach($this->subsections() as $subsection_name => $subsection){
209
-			if(isset($default_data[$subsection_name])){
210
-				if($subsection instanceof EE_Form_Input_Base){
207
+	public function populate_defaults($default_data) {
208
+		foreach ($this->subsections() as $subsection_name => $subsection) {
209
+			if (isset($default_data[$subsection_name])) {
210
+				if ($subsection instanceof EE_Form_Input_Base) {
211 211
 					$subsection->set_default($default_data[$subsection_name]);
212
-				}elseif($subsection instanceof EE_Form_Section_Proper){
212
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
213 213
 					$subsection->populate_defaults($default_data[$subsection_name]);
214 214
 				}
215 215
 			}
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * (realizing that the subsections' html names might not be set yet, etc.)
228 228
 	 * @return EE_Form_Section_Base
229 229
 	 */
230
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
231
-		if( $require_construction_to_be_finalized ){
230
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
231
+		if ($require_construction_to_be_finalized) {
232 232
 			$this->ensure_construct_finalized_called();
233 233
 		}
234 234
 		return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL;
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 	 * Gets all the validatable subsections of this form section
241 241
 	 * @return EE_Form_Section_Validatable[]
242 242
 	 */
243
-	public function get_validatable_subsections(){
243
+	public function get_validatable_subsections() {
244 244
 		$validatable_subsections = array();
245
-		foreach($this->subsections() as $name=>$obj){
246
-			if($obj instanceof EE_Form_Section_Validatable){
245
+		foreach ($this->subsections() as $name=>$obj) {
246
+			if ($obj instanceof EE_Form_Section_Validatable) {
247 247
 				$validatable_subsections[$name] = $obj;
248 248
 			}
249 249
 		}
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	 * @return EE_Form_Input_Base
264 264
 	 * @throws EE_Error
265 265
 	 */
266
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
266
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
267 267
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
268
-		if( ! $subsection instanceof EE_Form_Input_Base){
269
-			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
268
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
269
+			throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso')));
270 270
 		}
271 271
 		return $subsection;
272 272
 	}
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 	 * @return EE_Form_Section_Proper
285 285
 	 * @throws EE_Error
286 286
 	 */
287
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
288
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
289
-		if( ! $subsection instanceof EE_Form_Section_Proper){
290
-			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this)));
287
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
288
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
289
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
290
+			throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this)));
291 291
 		}
292 292
 		return $subsection;
293 293
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param string $name
301 301
 	 * @return mixed depending on the input's type and its normalization strategy
302 302
 	 */
303
-	public function get_input_value($name){
303
+	public function get_input_value($name) {
304 304
 		$input = $this->get_input($name);
305 305
 		return $input->normalized_value();
306 306
 	}
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
 	 * @return boolean
314 314
 	 */
315 315
 	public function is_valid() {
316
-		if( ! $this->has_received_submission()){
316
+		if ( ! $this->has_received_submission()) {
317 317
 			throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso")));
318 318
 		}
319
-		if( ! parent::is_valid()){
319
+		if ( ! parent::is_valid()) {
320 320
 			return false;
321 321
 		}
322 322
 		//ok so no errors general to this entire form section. so let's check the subsections
323
-		foreach( $this->get_validatable_subsections() as $subsection ){
324
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '' ){
325
-				$this->set_submission_error_message( $subsection->get_validation_error_string() );
323
+		foreach ($this->get_validatable_subsections() as $subsection) {
324
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '') {
325
+				$this->set_submission_error_message($subsection->get_validation_error_string());
326 326
 				return false;
327 327
 			}
328 328
 		}
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	 * gets teh default name of this form section if none is specified
336 336
 	 * @return string
337 337
 	 */
338
-	protected function _set_default_name_if_empty(){
339
-		if( ! $this->_name ){
338
+	protected function _set_default_name_if_empty() {
339
+		if ( ! $this->_name) {
340 340
 			$classname = get_class($this);
341 341
 			$default_name = str_replace("EE_", "", $classname);
342
-			$this->_name =  $default_name;
342
+			$this->_name = $default_name;
343 343
 		}
344 344
 	}
345 345
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * Also returns the HTML for the form, except for the form opening and closing tags
351 351
 	 * (as the form section doesn't know where you necessarily want to send the information to), and except for a submit button.
352 352
 	 */
353
-	public function get_html_and_js(){
353
+	public function get_html_and_js() {
354 354
 		$this->enqueue_js();
355 355
 		return $this->get_html();
356 356
 	}
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * returns HTML for displaying this form section. recursively calls display_section() on all subsections
362 362
 	 * @return string
363 363
 	 */
364
-	public function get_html(){
364
+	public function get_html() {
365 365
 		$this->ensure_construct_finalized_called();
366 366
 		return $this->_layout_strategy->layout_form();
367 367
 	}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * enqueues JS for the form
373 373
 	 * @return string
374 374
 	 */
375
-	public function enqueue_js(){
375
+	public function enqueue_js() {
376 376
 		$this->_enqueue_and_localize_form_js();
377 377
 	}
378 378
 
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 	 * could change until it's actually outputted)
388 388
 	 * @return void
389 389
 	 */
390
-	public static function wp_enqueue_scripts(){
391
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
392
-		wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
390
+	public static function wp_enqueue_scripts() {
391
+		add_filter('FHEE_load_jquery_validate', '__return_true');
392
+		wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
393 393
 	}
394 394
 
395 395
 
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 	 * This needs to be called AFTER we've called $this->_enqueue_jquery_validate_script,
400 400
 	 * but before the wordpress hook wp_loaded
401 401
 	 */
402
-	public function _enqueue_and_localize_form_js(){
402
+	public function _enqueue_and_localize_form_js() {
403 403
 		$this->ensure_construct_finalized_called();
404 404
 		//actually, we don't want to localize just yet. There may be other forms on the page.
405 405
 		//so we need to add our form section data to a static variable accessible by all form sections
406 406
 		//and localize it just before the footer
407 407
 		$this->localize_validation_rules();
408
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
409
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
408
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
409
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
410 410
 	}
411 411
 
412 412
 
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 	 * @param bool $return_for_subsection
417 417
 	 * @return void
418 418
 	 */
419
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
419
+	public function localize_validation_rules($return_for_subsection = FALSE) {
420 420
 		// we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog
421
-		if ( ! $this->parent_section() || $return_for_subsection ) {
422
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
423
-				'form_section_id'=> $this->html_id( TRUE ),
421
+		if ( ! $this->parent_section() || $return_for_subsection) {
422
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
423
+				'form_section_id'=> $this->html_id(TRUE),
424 424
 				'validation_rules'=> $this->get_jquery_validation_rules(),
425 425
 				'errors'=> $this->subsection_validation_errors_by_html_name()
426 426
 			);
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 	 * Keys are their form names, and values are the inputs themselves
436 436
 	 * @return EE_Form_Input_Base
437 437
 	 */
438
-	public function inputs_in_subsections(){
438
+	public function inputs_in_subsections() {
439 439
 		$inputs = array();
440
-		foreach($this->subsections() as $subsection){
441
-			if( $subsection instanceof EE_Form_Input_Base ){
442
-				$inputs[ $subsection->html_name() ] = $subsection;
443
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
440
+		foreach ($this->subsections() as $subsection) {
441
+			if ($subsection instanceof EE_Form_Input_Base) {
442
+				$inputs[$subsection->html_name()] = $subsection;
443
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
444 444
 				$inputs += $subsection->inputs_in_subsections();
445 445
 			}
446 446
 		}
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
 	 * and values are a string of all their validation errors
454 454
 	 * @return string[]
455 455
 	 */
456
-	public function subsection_validation_errors_by_html_name(){
456
+	public function subsection_validation_errors_by_html_name() {
457 457
 		$inputs = $this->inputs();
458 458
 		$errors = array();
459
-		foreach( $inputs as $form_input ){
460
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
461
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
459
+		foreach ($inputs as $form_input) {
460
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
461
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
462 462
 			}
463 463
 		}
464 464
 		return $errors;
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
471 471
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
472 472
 	 */
473
-	public static function localize_script_for_all_forms(){
473
+	public static function localize_script_for_all_forms() {
474 474
 		//allow inputs and stuff to hook in their JS and stuff here
475 475
 		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
476 476
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
477
-		wp_enqueue_script( 'ee_form_section_validation' );
478
-		wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization );
477
+		wp_enqueue_script('ee_form_section_validation');
478
+		wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization);
479 479
 	}
480 480
 
481 481
 
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 	/**
484 484
 	 * ensure_scripts_localized
485 485
 	 */
486
-	public function ensure_scripts_localized(){
487
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
486
+	public function ensure_scripts_localized() {
487
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
488 488
 			$this->_enqueue_and_localize_form_js();
489 489
 		}
490 490
 	}
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 	 * is that the key here should be the same as the custom validation rule put in the JS file
497 497
 	 * @return array keys are custom validation rules, and values are internationalized strings
498 498
 	 */
499
-	private static function _get_localized_error_messages(){
499
+	private static function _get_localized_error_messages() {
500 500
 		return array(
501 501
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
502
-			'regex' => __( 'Please check your input', 'event_espresso' ),
502
+			'regex' => __('Please check your input', 'event_espresso'),
503 503
 		);
504 504
 	}
505 505
 
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 	 * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more...
528 528
 	 * @return array
529 529
 	 */
530
-	function get_jquery_validation_rules(){
530
+	function get_jquery_validation_rules() {
531 531
 		$jquery_validation_rules = array();
532
-		foreach($this->get_validatable_subsections() as $subsection){
533
-			$jquery_validation_rules = array_merge( $jquery_validation_rules,  $subsection->get_jquery_validation_rules() );
532
+		foreach ($this->get_validatable_subsections() as $subsection) {
533
+			$jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules());
534 534
 		}
535 535
 		return $jquery_validation_rules;
536 536
 	}
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 	protected function _normalize($req_data) {
546 546
 		$this->_received_submission = TRUE;
547 547
 		$this->_validation_errors = array();
548
-		foreach($this->get_validatable_subsections() as $subsection){
549
-			try{
548
+		foreach ($this->get_validatable_subsections() as $subsection) {
549
+			try {
550 550
 				$subsection->_normalize($req_data);
551
-			}catch( EE_Validation_Error $e ){
552
-				$subsection->add_validation_error( $e );
551
+			} catch (EE_Validation_Error $e) {
552
+				$subsection->add_validation_error($e);
553 553
 			}
554 554
 		}
555 555
 	}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * calling parent::_validate() first.
564 564
 	 */
565 565
 	protected function _validate() {
566
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
567
-			if(method_exists($this,'_validate_'.$subsection_name)){
568
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
566
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
567
+			if (method_exists($this, '_validate_'.$subsection_name)) {
568
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
569 569
 			}
570 570
 			$subsection->_validate();
571 571
 		}
@@ -577,13 +577,13 @@  discard block
 block discarded – undo
577 577
 	 * Gets all the validated inputs for the form section
578 578
 	 * @return array
579 579
 	 */
580
-	public function valid_data(){
580
+	public function valid_data() {
581 581
 		$inputs = array();
582
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
583
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
584
-				$inputs[ $subsection_name ] = $subsection->valid_data();
585
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
586
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
582
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
583
+			if ($subsection instanceof EE_Form_Section_Proper) {
584
+				$inputs[$subsection_name] = $subsection->valid_data();
585
+			} else if ($subsection instanceof EE_Form_Input_Base) {
586
+				$inputs[$subsection_name] = $subsection->normalized_value();
587 587
 			}
588 588
 		}
589 589
 		return $inputs;
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
 	 * Gets all the inputs on this form section
596 596
 	 * @return EE_Form_Input_Base[]
597 597
 	 */
598
-	public function inputs(){
598
+	public function inputs() {
599 599
 		$inputs = array();
600
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
601
-			if ( $subsection instanceof EE_Form_Input_Base ){
602
-				$inputs[ $subsection_name ] = $subsection;
600
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
601
+			if ($subsection instanceof EE_Form_Input_Base) {
602
+				$inputs[$subsection_name] = $subsection;
603 603
 			}
604 604
 		}
605 605
 		return $inputs;
@@ -611,10 +611,10 @@  discard block
 block discarded – undo
611 611
 	 * Gets all the subsections which are a proper form
612 612
 	 * @return EE_Form_Section_Proper[]
613 613
 	 */
614
-	public function subforms(){
614
+	public function subforms() {
615 615
 		$form_sections = array();
616
-		foreach($this->subsections() as $name=>$obj){
617
-			if($obj instanceof EE_Form_Section_Proper){
616
+		foreach ($this->subsections() as $name=>$obj) {
617
+			if ($obj instanceof EE_Form_Section_Proper) {
618 618
 				$form_sections[$name] = $obj;
619 619
 			}
620 620
 		}
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 	 * if you only want form inputs or proper form sections.
630 630
 	 * @return EE_Form_Section_Proper[]
631 631
 	 */
632
-	public function subsections(){
632
+	public function subsections() {
633 633
 		$this->ensure_construct_finalized_called();
634 634
 		return $this->_subsections;
635 635
 	}
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
648 648
 	 * input's normalized value, or an array like the top-level array
649 649
 	 */
650
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
651
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
650
+	public function input_values($include_subform_inputs = false, $flatten = false) {
651
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
652 652
 	}
653 653
 
654 654
 	/**
@@ -664,8 +664,8 @@  discard block
 block discarded – undo
664 664
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
665 665
 	 * input's normalized value, or an array like the top-level array
666 666
 	 */
667
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
668
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
667
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
668
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
669 669
 	}
670 670
 
671 671
 	/**
@@ -678,17 +678,17 @@  discard block
 block discarded – undo
678 678
 	 * it can be a multidimensional array where keys are always subsection names and values are either the
679 679
 	 * input's normalized value, or an array like the top-level array
680 680
 	 */
681
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
681
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
682 682
 		$input_values = array();
683
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
684
-			if( $subsection instanceof EE_Form_Input_Base ) {
685
-				$input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
686
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
687
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
688
-				if( $flatten ) {
689
-					$input_values = array_merge( $input_values, $subform_input_values );
683
+		foreach ($this->subsections() as $subsection_name => $subsection) {
684
+			if ($subsection instanceof EE_Form_Input_Base) {
685
+				$input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value();
686
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
687
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
688
+				if ($flatten) {
689
+					$input_values = array_merge($input_values, $subform_input_values);
690 690
 				} else {
691
-					$input_values[ $subsection_name ] = $subform_input_values;
691
+					$input_values[$subsection_name] = $subform_input_values;
692 692
 				}
693 693
 			}
694 694
 		}
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * (ie, had receive_form_submission called on it yet)
703 703
 	 * @return boolean
704 704
 	 */
705
-	public function has_received_submission(){
705
+	public function has_received_submission() {
706 706
 		$this->ensure_construct_finalized_called();
707 707
 		return $this->_received_submission;
708 708
 	}
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	 * @param array $inputs_to_exclude values are the input names
716 716
 	 * @return void
717 717
 	 */
718
-	public function exclude($inputs_to_exclude = array()){
719
-		foreach($inputs_to_exclude as $input_to_exclude_name){
718
+	public function exclude($inputs_to_exclude = array()) {
719
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
720 720
 			unset($this->_subsections[$input_to_exclude_name]);
721 721
 		}
722 722
 	}
@@ -726,8 +726,8 @@  discard block
 block discarded – undo
726 726
 	/**
727 727
 	 * @param array $inputs_to_hide
728 728
 	 */
729
-	public function hide($inputs_to_hide= array()){
730
-		foreach($inputs_to_hide as $input_to_hide){
729
+	public function hide($inputs_to_hide = array()) {
730
+		foreach ($inputs_to_hide as $input_to_hide) {
731 731
 			$input = $this->get_input($input_to_hide);
732 732
 
733 733
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -752,13 +752,13 @@  discard block
 block discarded – undo
752 752
 	 * 																								or if $subsection_name_to_target is null, before or after entire subsections array
753 753
 	 * @return void
754 754
 	 */
755
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
756
-		foreach($new_subsections as $subsection_name => $subsection){
757
-			if( ! $subsection instanceof EE_Form_Section_Base){
755
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
756
+		foreach ($new_subsections as $subsection_name => $subsection) {
757
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
758 758
 				EE_Error::add_error(
759 759
 					sprintf(
760 760
 						__("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"),
761
-						get_class( $subsection ),
761
+						get_class($subsection),
762 762
 						$subsection_name,
763 763
 						$this->name()
764 764
 					)
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 			}
768 768
 		}
769 769
 
770
-		EE_Registry::instance()->load_helper( 'Array' );
771
-		$this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before );
770
+		EE_Registry::instance()->load_helper('Array');
771
+		$this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before);
772 772
 
773 773
 		/*$subsections_before = array();
774 774
 		if( $subsection_name_to_target ){
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 				$this->_subsections = $new_subsections;
800 800
 			}
801 801
 		}*/
802
-		if( $this->_construction_finalized ){
803
-			foreach($this->_subsections as $name => $subsection){
802
+		if ($this->_construction_finalized) {
803
+			foreach ($this->_subsections as $name => $subsection) {
804 804
 				$subsection->_construct_finalize($this, $name);
805 805
 			}
806 806
 		}
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
 	/**
812 812
 	 * Just gets all validatable subsections to clean their sensitive data
813 813
 	 */
814
-	public function clean_sensitive_data(){
815
-		foreach($this->get_validatable_subsections() as $subsection){
814
+	public function clean_sensitive_data() {
815
+		foreach ($this->get_validatable_subsections() as $subsection) {
816 816
 			$subsection->clean_sensitive_data();
817 817
 		}
818 818
 	}
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 	/**
823 823
 	 * @param string $form_submission_error_message
824 824
 	 */
825
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
826
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' );
825
+	public function set_submission_error_message($form_submission_error_message = '') {
826
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso');
827 827
 	}
828 828
 
829 829
 
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	/**
841 841
 	 * @param string $form_submission_success_message
842 842
 	 */
843
-	public function set_submission_success_message( $form_submission_success_message ) {
844
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' );
843
+	public function set_submission_success_message($form_submission_success_message) {
844
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso');
845 845
 	}
846 846
 
847 847
 
@@ -863,10 +863,10 @@  discard block
 block discarded – undo
863 863
 	 * EE_Form_Input_Base::_set_default_html_name_if_empty
864 864
 	 * @return string
865 865
 	 */
866
-	public function html_name_prefix(){
867
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
868
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
869
-		}else{
866
+	public function html_name_prefix() {
867
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
868
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
869
+		} else {
870 870
 			return $this->name();
871 871
 		}
872 872
 	}
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 	 * was set, which is probably nothing, or the classname)
878 878
 	 * @return string
879 879
 	 */
880
-	public function name(){
880
+	public function name() {
881 881
 		$this->ensure_construct_finalized_called();
882 882
 		return parent::name();
883 883
 	}
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	 *
887 887
 	 * @return EE_Form_Section_Proper
888 888
 	 */
889
-	public function parent_section(){
889
+	public function parent_section() {
890 890
 		$this->ensure_construct_finalized_called();
891 891
 		return parent::parent_section();
892 892
 	}
@@ -895,9 +895,9 @@  discard block
 block discarded – undo
895 895
 	 * make sure construction finalized was called, otherwise children might not be ready
896 896
 	 * @return void
897 897
 	 */
898
-	public function ensure_construct_finalized_called(){
899
-		if( ! $this->_construction_finalized ){
900
-			$this->_construct_finalize($this->_parent_section, $this->_name );
898
+	public function ensure_construct_finalized_called() {
899
+		if ( ! $this->_construction_finalized) {
900
+			$this->_construct_finalize($this->_parent_section, $this->_name);
901 901
 		}
902 902
 	}
903 903
 
@@ -909,17 +909,17 @@  discard block
 block discarded – undo
909 909
 	 * @param array $req_data
910 910
 	 * @return boolean
911 911
 	 */
912
-	public function form_data_present_in( $req_data = NULL ) {
913
-		if( $req_data === NULL){
912
+	public function form_data_present_in($req_data = NULL) {
913
+		if ($req_data === NULL) {
914 914
 			$req_data = $_POST;
915 915
 		}
916
-		foreach( $this->subsections() as $subsection ) {
917
-			if($subsection instanceof EE_Form_Input_Base ) {
918
-				if( $subsection->form_data_present_in( $req_data ) ) {
916
+		foreach ($this->subsections() as $subsection) {
917
+			if ($subsection instanceof EE_Form_Input_Base) {
918
+				if ($subsection->form_data_present_in($req_data)) {
919 919
 					return TRUE;
920 920
 				}
921
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
922
-				if( $subsection->form_data_present_in( $req_data ) ) {
921
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
922
+				if ($subsection->form_data_present_in($req_data)) {
923 923
 					return TRUE;
924 924
 				}
925 925
 			}
@@ -936,14 +936,14 @@  discard block
 block discarded – undo
936 936
 	 */
937 937
 	public function get_validation_errors_accumulated() {
938 938
 		$validation_errors = $this->get_validation_errors();
939
-		foreach($this->get_validatable_subsections() as $subsection ) {
940
-			if( $subsection instanceof EE_Form_Section_Proper ) {
939
+		foreach ($this->get_validatable_subsections() as $subsection) {
940
+			if ($subsection instanceof EE_Form_Section_Proper) {
941 941
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
942 942
 			} else {
943
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
943
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
944 944
 			}
945
-			if( $validation_errors_on_this_subsection ){
946
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
945
+			if ($validation_errors_on_this_subsection) {
946
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
947 947
 			}
948 948
 		}
949 949
 		return $validation_errors;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@
 block discarded – undo
225 225
 	 * leave this as TRUE so that the inputs will be properly configured. However,
226 226
 	 * some client code may be ok with construction finalize being called later
227 227
 	 * (realizing that the subsections' html names might not be set yet, etc.)
228
-	 * @return EE_Form_Section_Base
228
+	 * @return EE_Form_Section_Validatable|null
229 229
 	 */
230 230
 	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
231 231
 		if( $require_construction_to_be_finalized ){
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * For containing info about a non-field form section, which contains other form sections/fields.
4
- * Relies heavily on the script form_section_validation.js for client-side validation, mostly
5
- * the php code just provides form_section_validation.js with teh variables to use.
6
- * Important: in order for the JS to be loaded properly, you must construct a form section
7
- * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8
- * However, you may output the form (usually by calling get_html_and_js) anywhere you like.
9
- */
3
+	 * For containing info about a non-field form section, which contains other form sections/fields.
4
+	 * Relies heavily on the script form_section_validation.js for client-side validation, mostly
5
+	 * the php code just provides form_section_validation.js with teh variables to use.
6
+	 * Important: in order for the JS to be loaded properly, you must construct a form section
7
+	 * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8
+	 * However, you may output the form (usually by calling get_html_and_js) anywhere you like.
9
+	 */
10 10
 class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
11 11
 
12 12
 	/**
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -141,67 +141,67 @@  discard block
 block discarded – undo
141 141
 	 *		@type EE_Validation_Strategy_Base[] $validation_strategies
142 142
 	 * }
143 143
 	 */
144
-	public function __construct( $input_args = array() ){
145
-		$input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
144
+	public function __construct($input_args = array()) {
145
+		$input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
146 146
 		// the following properties must be cast as arrays
147 147
 		$set_as_array = array(
148 148
 			'validation_strategies'
149 149
 		);
150 150
 		// loop thru incoming options
151
-		foreach( $input_args as $key => $value ) {
151
+		foreach ($input_args as $key => $value) {
152 152
 			// add underscore to $key to match property names
153
-			$_key = '_' . $key;
154
-			if ( property_exists( $this, $_key )) {
153
+			$_key = '_'.$key;
154
+			if (property_exists($this, $_key)) {
155 155
 				// first check if this property needs to be set as an array
156
-				if ( isset( $set_as_array[ $key ] )) {
156
+				if (isset($set_as_array[$key])) {
157 157
 					// ensure value is an array
158
-					$value = is_array( $value ) ? $value : array( $value );
158
+					$value = is_array($value) ? $value : array($value);
159 159
 					// and merge with existing values
160
-					$this->$_key = array_merge( $this->$_key, $value );
160
+					$this->$_key = array_merge($this->$_key, $value);
161 161
 				} else {
162 162
 					$this->$_key = $value;
163 163
 				}
164 164
 			}
165 165
 		}
166 166
 		// ensure that "required" is set correctly
167
-		$this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL );
167
+		$this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL);
168 168
 
169
-		$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
169
+		$this->_html_name_specified = isset($input_args['html_name']) ? TRUE : FALSE;
170 170
 
171 171
 		$this->_display_strategy->_construct_finalize($this);
172 172
 
173
-		if ( $this->_validation_strategies ){
174
-			foreach( $this->_validation_strategies as $validation_strategy ){
173
+		if ($this->_validation_strategies) {
174
+			foreach ($this->_validation_strategies as $validation_strategy) {
175 175
 				$validation_strategy->_construct_finalize($this);
176 176
 			}
177 177
 		}
178 178
 
179
-		if( ! $this->_normalization_strategy){
179
+		if ( ! $this->_normalization_strategy) {
180 180
 			$this->_normalization_strategy = new EE_Text_Normalization();
181 181
 		}
182 182
 		$this->_normalization_strategy->_construct_finalize($this);
183 183
 
184 184
 		//at least we can use the normalization strategy to populate the default
185
-		if( isset( $input_args[ 'default' ] ) ) {
186
-			$this->set_default( $input_args[ 'default' ] );
185
+		if (isset($input_args['default'])) {
186
+			$this->set_default($input_args['default']);
187 187
 		}
188 188
 
189
-		if( ! $this->_sensitive_data_removal_strategy){
189
+		if ( ! $this->_sensitive_data_removal_strategy) {
190 190
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
191 191
 		}
192 192
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
193
-		parent::__construct( $input_args );
193
+		parent::__construct($input_args);
194 194
 	}
195 195
 
196 196
 	/**
197 197
 	 * Sets the html_name to its default value, if none was specified in teh constructor.
198 198
 	 * Calculation involves using the name and the parent's html_name
199 199
 	 */
200
-	protected function _set_default_html_name_if_empty(){
201
-		if( ! $this->_html_name){
202
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
203
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
204
-			}else{
200
+	protected function _set_default_html_name_if_empty() {
201
+		if ( ! $this->_html_name) {
202
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
203
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
204
+			} else {
205 205
 				$this->_html_name = $this->name();
206 206
 			}
207 207
 		}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 	function _construct_finalize($parent_form_section, $name) {
217 217
 		parent::_construct_finalize($parent_form_section, $name);
218 218
 		$this->_set_default_html_name_if_empty();
219
-		if( ! $this->_html_label ){
220
-			if( ! $this->_html_label_text){
221
-				$this->_html_label_text = ucwords( str_replace("_"," ",$name));
219
+		if ( ! $this->_html_label) {
220
+			if ( ! $this->_html_label_text) {
221
+				$this->_html_label_text = ucwords(str_replace("_", " ", $name));
222 222
 			}
223 223
 		}
224
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
224
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
225 225
 	}
226 226
 
227 227
 	 /**
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 	  * @return EE_Display_Strategy_Base
230 230
 	  * @throws EE_Error
231 231
 	  */
232
-	protected function _get_display_strategy(){
233
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
234
-			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
235
-		}else{
232
+	protected function _get_display_strategy() {
233
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
234
+			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id()));
235
+		} else {
236 236
 			return $this->_display_strategy;
237 237
 		}
238 238
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * Sets the display strategy.
241 241
 	 * @param EE_Display_Strategy_Base $strategy
242 242
 	 */
243
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
243
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
244 244
 		$this->_display_strategy = $strategy;
245 245
 	}
246 246
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * Sets the sanitization strategy
249 249
 	 * @param EE_Normalization_Strategy_Base $strategy
250 250
 	 */
251
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
251
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
252 252
 		$this->_normalization_strategy = $strategy;
253 253
 	}
254 254
 
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
 	 * Gets the display strategy for this input
275 275
 	 * @return EE_Display_Strategy_Base
276 276
 	 */
277
-	public function get_display_strategy(){
277
+	public function get_display_strategy() {
278 278
 		return $this->_display_strategy;
279 279
 	}
280 280
 	/**
281 281
 	 * Overwrites the display strategy
282 282
 	 * @param EE_Display_Strategy_Base $display_strategy
283 283
 	 */
284
-	public function set_display_strategy($display_strategy){
284
+	public function set_display_strategy($display_strategy) {
285 285
 		$this->_display_strategy = $display_strategy;
286 286
 		$this->_display_strategy->_construct_finalize($this);
287 287
 	}
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
 	 * Gets the normalization strategy set on this input
290 290
 	 * @return EE_Normalization_Strategy_Base
291 291
 	 */
292
-	public function get_normalization_strategy(){
292
+	public function get_normalization_strategy() {
293 293
 		return $this->_normalization_strategy;
294 294
 	}
295 295
 	/**
296 296
 	 * Overwrites the normalization strategy
297 297
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
298 298
 	 */
299
-	public function set_normalization_strategy($normalization_strategy){
299
+	public function set_normalization_strategy($normalization_strategy) {
300 300
 		$this->_normalization_strategy = $normalization_strategy;
301 301
 		$this->_normalization_strategy->_construct_finalize($this);
302 302
 	}
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
306 306
 	 * @return EE_Validation_Strategy_Base[]
307 307
 	 */
308
-	public function get_validation_strategies(){
309
-		if(is_array($this->_validation_strategies)){
308
+	public function get_validation_strategies() {
309
+		if (is_array($this->_validation_strategies)) {
310 310
 			return $this->_validation_strategies;
311
-		}else{
311
+		} else {
312 312
 			return array();
313 313
 		}
314 314
 
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 	 * @param EE_Validation_Strategy_Base $validation_strategy
319 319
 	 * @return void
320 320
 	 */
321
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
322
-		$validation_strategy->_construct_finalize( $this );
323
-		$this->_validation_strategies[ get_class($validation_strategy) ] = $validation_strategy;
321
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
322
+		$validation_strategy->_construct_finalize($this);
323
+		$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
324 324
 
325 325
 	}
326 326
 
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
 	 * @param EE_Validation_Strategy_Base $validation_strategy
330 330
 	 * @return void
331 331
 	 */
332
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
333
-		$this->_add_validation_strategy( $validation_strategy );
332
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
333
+		$this->_add_validation_strategy($validation_strategy);
334 334
 	}
335 335
 
336 336
 	/**
337 337
 	 * The classname of the validation strategy to remove
338 338
 	 * @param string $validation_strategy_classname
339 339
 	 */
340
-	public function remove_validation_strategy( $validation_strategy_classname ) {
341
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
342
-			if( is_subclass_of( $validation_strategy, $validation_strategy_classname ) ){
343
-				unset( $this->_validation_strategies[ $key ] );
340
+	public function remove_validation_strategy($validation_strategy_classname) {
341
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
342
+			if (is_subclass_of($validation_strategy, $validation_strategy_classname)) {
343
+				unset($this->_validation_strategies[$key]);
344 344
 			}
345 345
 		}
346 346
 	}
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 * to the parent form's layout strategy
350 350
 	 * @return string
351 351
 	 */
352
-	public function get_html_and_js(){
352
+	public function get_html_and_js() {
353 353
 		return $this->_parent_section->get_html_for_input($this);
354 354
 	}
355 355
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 * Makes sure the JS and CSS are enqueued for it
359 359
 	 * @return string
360 360
 	 */
361
-	public function get_html_for_input(){
361
+	public function get_html_for_input() {
362 362
 		return  $this->_get_display_strategy()->display();
363 363
 	}
364 364
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @return string
369 369
 	 */
370 370
 	public function html_other_attributes() {
371
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
371
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
372 372
 	}
373 373
 
374 374
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	/**
377 377
 	 * @param string $html_other_attributes
378 378
 	 */
379
-	public function set_html_other_attributes( $html_other_attributes ) {
379
+	public function set_html_other_attributes($html_other_attributes) {
380 380
 		$this->_html_other_attributes = $html_other_attributes;
381 381
 	}
382 382
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	 * according to the form section's layout strategy
386 386
 	 * @return string
387 387
 	 */
388
-	public function get_html_for_label(){
388
+	public function get_html_for_label() {
389 389
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
390 390
 	}
391 391
 	/**
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 * according to the form section's layout strategy
394 394
 	 * @return string
395 395
 	 */
396
-	public function get_html_for_errors(){
396
+	public function get_html_for_errors() {
397 397
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
398 398
 	}
399 399
 	/**
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * according to the form section's layout strategy
402 402
 	 * @return string
403 403
 	 */
404
-	public function get_html_for_help(){
404
+	public function get_html_for_help() {
405 405
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
406 406
 	}
407 407
 	/**
@@ -410,20 +410,20 @@  discard block
 block discarded – undo
410 410
 	 * @return boolean
411 411
 	 */
412 412
 	protected function _validate() {
413
-		if(is_array($this->_validation_strategies)){
414
-			foreach($this->_validation_strategies as $validation_strategy){
415
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
416
-					try{
413
+		if (is_array($this->_validation_strategies)) {
414
+			foreach ($this->_validation_strategies as $validation_strategy) {
415
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
416
+					try {
417 417
 						$validation_strategy->validate($this->normalized_value());
418
-					}catch(EE_Validation_Error $e){
418
+					} catch (EE_Validation_Error $e) {
419 419
 						$this->add_validation_error($e);
420 420
 					}
421 421
 				}
422 422
 			}
423 423
 		}
424
-		if( $this->get_validation_errors()){
424
+		if ($this->get_validation_errors()) {
425 425
 			return false;
426
-		}else{
426
+		} else {
427 427
 			return true;
428 428
 		}
429 429
 	}
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	 * @param string $value
437 437
 	 * @return null|string
438 438
 	 */
439
-	private function _sanitize($value){
440
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
439
+	private function _sanitize($value) {
440
+		return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
441 441
 	}
442 442
 
443 443
 
@@ -449,24 +449,24 @@  discard block
 block discarded – undo
449 449
 	 * @param array $req_data like $_POST
450 450
 	 * @return boolean whether or not there was an error
451 451
 	 */
452
-	protected function _normalize( $req_data ) {
452
+	protected function _normalize($req_data) {
453 453
 		//any existing validation errors don't apply so clear them
454 454
 		$this->_validation_errors = array();
455 455
 		try {
456
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
456
+			$raw_input = $this->find_form_data_for_this_section($req_data);
457 457
 			//super simple sanitization for now
458
-			if ( is_array( $raw_input )) {
458
+			if (is_array($raw_input)) {
459 459
 				$this->_raw_value = array();
460
-				foreach( $raw_input as $key => $value ) {
461
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
460
+				foreach ($raw_input as $key => $value) {
461
+					$this->_raw_value[$key] = $this->_sanitize($value);
462 462
 				}
463 463
 			} else {
464
-				$this->_raw_value = $this->_sanitize( $raw_input );
464
+				$this->_raw_value = $this->_sanitize($raw_input);
465 465
 			}
466 466
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
467
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
468
-		} catch ( EE_Validation_Error $e ) {
469
-			$this->add_validation_error( $e );
467
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
468
+		} catch (EE_Validation_Error $e) {
469
+			$this->add_validation_error($e);
470 470
 		}
471 471
 	}
472 472
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	/**
476 476
 	 * @return string
477 477
 	 */
478
-	public function html_name(){
478
+	public function html_name() {
479 479
 		return $this->_html_name;
480 480
 	}
481 481
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * @return string
486 486
 	 */
487
-	function html_label_id(){
488
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
487
+	function html_label_id() {
488
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
489 489
 	}
490 490
 
491 491
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	/**
494 494
 	 * @return string
495 495
 	 */
496
-	function html_label_class(){
496
+	function html_label_class() {
497 497
 		return $this->_html_label_class;
498 498
 	}
499 499
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	/**
503 503
 	 * @return string
504 504
 	 */
505
-	function html_label_style(){
505
+	function html_label_style() {
506 506
 		return $this->_html_label_style;
507 507
 	}
508 508
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	/**
512 512
 	 * @return string
513 513
 	 */
514
-	function html_label_text(){
514
+	function html_label_text() {
515 515
 		return $this->_html_label_text;
516 516
 	}
517 517
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	/**
521 521
 	 * @return string
522 522
 	 */
523
-	function html_help_text(){
523
+	function html_help_text() {
524 524
 		return $this->_html_help_text;
525 525
 	}
526 526
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	/**
530 530
 	 * @return string
531 531
 	 */
532
-	function html_help_class(){
532
+	function html_help_class() {
533 533
 		return $this->_html_help_class;
534 534
 	}
535 535
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	/**
539 539
 	 * @return string
540 540
 	 */
541
-	function html_help_style(){
541
+	function html_help_style() {
542 542
 		return $this->_html_style;
543 543
 	}
544 544
 	/**
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * in which case, we would have stored the malicious content to our database.
552 552
 	 * @return string
553 553
 	 */
554
-	function raw_value(){
554
+	function raw_value() {
555 555
 		return $this->_raw_value;
556 556
 	}
557 557
 	/**
@@ -559,15 +559,15 @@  discard block
 block discarded – undo
559 559
 	 * it escapes all html entities
560 560
 	 * @return string
561 561
 	 */
562
-	function raw_value_in_form(){
563
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
562
+	function raw_value_in_form() {
563
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
564 564
 	}
565 565
 	/**
566 566
 	 * returns the value after it's been sanitized, and then converted into it's proper type
567 567
 	 * in PHP. Eg, a string, an int, an array,
568 568
 	 * @return mixed
569 569
 	 */
570
-	function normalized_value(){
570
+	function normalized_value() {
571 571
 		return $this->_normalized_value;
572 572
 	}
573 573
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * the best thing to display
578 578
 	 * @return string
579 579
 	 */
580
-	function pretty_value(){
580
+	function pretty_value() {
581 581
 		return $this->_normalized_value;
582 582
 	}
583 583
 	/**
@@ -596,15 +596,15 @@  discard block
 block discarded – undo
596 596
 		  }</code>
597 597
 	 * @return array
598 598
 	 */
599
-	function get_jquery_validation_rules(){
599
+	function get_jquery_validation_rules() {
600 600
 		$jquery_validation_rules = array();
601
-		foreach($this->get_validation_strategies() as $validation_strategy){
602
-			$jquery_validation_rules = array_replace_recursive( $jquery_validation_rules, $validation_strategy->get_jquery_validation_rule_array());
601
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
602
+			$jquery_validation_rules = array_replace_recursive($jquery_validation_rules, $validation_strategy->get_jquery_validation_rule_array());
603 603
 		}
604 604
 
605
-		if(! empty($jquery_validation_rules)){
606
-			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
607
-		}else{
605
+		if ( ! empty($jquery_validation_rules)) {
606
+			$jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules;
607
+		} else {
608 608
 			return array();
609 609
 		}
610 610
 		return $jquery_validation_js;
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 	 * @param mixed $value
617 617
 	 * @return void
618 618
 	 */
619
-	function set_default($value){
619
+	function set_default($value) {
620 620
 		$this->_normalized_value = $value;
621
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
621
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
622 622
 	}
623 623
 
624 624
 	/**
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * @param string $label
627 627
 	 * @return void
628 628
 	 */
629
-	function set_html_label_text($label){
629
+	function set_html_label_text($label) {
630 630
 		$this->_html_label_text = $label;
631 631
 	}
632 632
 
@@ -638,12 +638,12 @@  discard block
 block discarded – undo
638 638
 	 * @param boolean $required
639 639
 	 * @param null    $required_text
640 640
 	 */
641
-	function set_required($required = true, $required_text = NULL ){
642
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN );
643
-		if ( $required ) {
644
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
641
+	function set_required($required = true, $required_text = NULL) {
642
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
643
+		if ($required) {
644
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
645 645
 		} else {
646
-			unset( $this->_validation_strategies[ get_class( new EE_Required_Validation_Strategy() ) ] );
646
+			unset($this->_validation_strategies[get_class(new EE_Required_Validation_Strategy())]);
647 647
 		}
648 648
 		$this->_required = $required;
649 649
 	}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	 * Returns whether or not this field is required
652 652
 	 * @return boolean
653 653
 	 */
654
-	public function required(){
654
+	public function required() {
655 655
 		return $this->_required;
656 656
 	}
657 657
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	/**
661 661
 	 * @param string $required_css_class
662 662
 	 */
663
-	public function set_required_css_class( $required_css_class ) {
663
+	public function set_required_css_class($required_css_class) {
664 664
 		$this->_required_css_class = $required_css_class;
665 665
 	}
666 666
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 	 * Sets the help text, in case
680 680
 	 * @param string $text
681 681
 	 */
682
-	public function set_html_help_text($text){
682
+	public function set_html_help_text($text) {
683 683
 		$this->_html_help_text = $text;
684 684
 	}
685 685
 	/**
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 	public function clean_sensitive_data() {
692 692
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
693 693
 		//if we need more logic than this we'll make a strategy for it
694
-		if( $this->_sensitive_data_removal_strategy &&
695
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
694
+		if ($this->_sensitive_data_removal_strategy &&
695
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
696 696
 			$this->_raw_value = NULL;
697 697
 		}
698 698
 		//and clean the normalized value according to the appropriate strategy
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 	 * @param string $button_size
707 707
 	 * @param string $other_attributes
708 708
 	 */
709
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
709
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
710 710
 		$button_css_attributes = 'button';
711 711
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
712
-		switch ( $button_size ) {
712
+		switch ($button_size) {
713 713
 			case 'xs' :
714 714
 			case 'extra-small' :
715 715
 				$button_css_attributes .= ' button-xs';
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 			default :
731 731
 				$button_css_attributes .= '';
732 732
 		}
733
-		$this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes;
733
+		$this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes;
734 734
 	}
735 735
 
736 736
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 	 * @return string
740 740
 	 */
741 741
 	public function button_css_attributes() {
742
-		if ( empty( $this->_button_css_attributes )) {
742
+		if (empty($this->_button_css_attributes)) {
743 743
 			$this->set_button_css_attributes();
744 744
 		}
745 745
 		return $this->_button_css_attributes;
@@ -759,27 +759,27 @@  discard block
 block discarded – undo
759 759
 	 * @param array $req_data
760 760
 	 * @return mixed whatever the raw value of this form section is in the request data
761 761
 	 */
762
-	public function find_form_data_for_this_section( $req_data ){
762
+	public function find_form_data_for_this_section($req_data) {
763 763
 		// break up the html name by "[]"
764
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
765
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
764
+		if (strpos($this->html_name(), '[') !== FALSE) {
765
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
766 766
 		} else {
767 767
 			$before_any_brackets = $this->html_name();
768 768
 		}
769 769
 		// grab all of the segments
770
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
771
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
772
-			$name_parts = $matches[ 1 ];
770
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
771
+		if (isset($matches[1]) && is_array($matches[1])) {
772
+			$name_parts = $matches[1];
773 773
 			array_unshift($name_parts, $before_any_brackets);
774
-		}else{
775
-			$name_parts = array( $before_any_brackets );
774
+		} else {
775
+			$name_parts = array($before_any_brackets);
776 776
 		}
777 777
 		// now get the value for the input
778 778
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
779
-		if( $value === NULL ){
779
+		if ($value === NULL) {
780 780
 			//check if this thing's name is at the TOP level of the request data
781
-			if( isset( $req_data[ $this->name() ] ) ){
782
-				$value = $req_data[ $this->name() ];
781
+			if (isset($req_data[$this->name()])) {
782
+				$value = $req_data[$this->name()];
783 783
 			}
784 784
 		}
785 785
 		return $value;
@@ -793,15 +793,15 @@  discard block
 block discarded – undo
793 793
 	 * @param array $req_data
794 794
 	 * @return array | NULL
795 795
 	 */
796
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
797
-		$first_part_to_consider = array_shift( $html_name_parts );
798
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
799
-			if( empty($html_name_parts ) ){
800
-				return $req_data[ $first_part_to_consider ];
801
-			}else{
802
-				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
796
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
797
+		$first_part_to_consider = array_shift($html_name_parts);
798
+		if (isset($req_data[$first_part_to_consider])) {
799
+			if (empty($html_name_parts)) {
800
+				return $req_data[$first_part_to_consider];
801
+			} else {
802
+				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]);
803 803
 			}
804
-		}else{
804
+		} else {
805 805
 			return NULL;
806 806
 		}
807 807
 	}
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 	 * @param array $req_data like $_POST
814 814
 	 * @return boolean
815 815
 	 */
816
-	public function form_data_present_in($req_data = NULL){
817
-		if( $req_data === NULL ){
816
+	public function form_data_present_in($req_data = NULL) {
817
+		if ($req_data === NULL) {
818 818
 			$req_data = $_POST;
819 819
 		}
820
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
821
-		if( $checked_value !== null ){
820
+		$checked_value = $this->find_form_data_for_this_section($req_data);
821
+		if ($checked_value !== null) {
822 822
 			return TRUE;
823
-		}else{
823
+		} else {
824 824
 			return FALSE;
825 825
 		}
826 826
 	}
Please login to merge, or discard this patch.
form_sections/payment_methods/EE_Billing_Attendee_Info_Form.form.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
  * @author				Mike Nelson
15 15
  *
16 16
  */
17
-class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{
17
+class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form {
18 18
 
19 19
 	/**
20 20
 	 *
21 21
 	 * @param EE_Payment_Method $payment_method
22 22
 	 * @param array $options_array @see EE_Form_Section_Proper::__construct()
23 23
 	 */
24
-	public function __construct( EE_Payment_Method $payment_method, $options_array= array()){
24
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array()) {
25 25
 		$options_array['subsections'] = array_merge(
26 26
 			array(
27
-				'first_name' 	=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ),
28
-				'last_name'		=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ),
29
-				'email'				=> new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ),
30
-				'address'			=> new EE_Text_Input( array( 'html_label_text'=>  __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
31
-				'address2'		=> new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
32
-				'city'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ),
33
-				'state' 				=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ),
34
-				'country' 			=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ),
35
-				'zip'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ),
36
-				'phone'			=> new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )),
27
+				'first_name' 	=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))),
28
+				'last_name'		=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))),
29
+				'email'				=> new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))),
30
+				'address'			=> new EE_Text_Input(array('html_label_text'=>  __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')),
31
+				'address2'		=> new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')),
32
+				'city'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))),
33
+				'state' 				=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))),
34
+				'country' 			=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))),
35
+				'zip'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))),
36
+				'phone'			=> new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))),
37 37
 			),
38
-			isset( $options_array['subsections'] ) ? $options_array['subsections'] : array()
38
+			isset($options_array['subsections']) ? $options_array['subsections'] : array()
39 39
 		);
40 40
 
41
-		parent::__construct( $payment_method, $options_array );
41
+		parent::__construct($payment_method, $options_array);
42 42
 
43 43
 	}
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	 * Sets the defaults for the billing form according to the attendee's details
47 47
 	 * @param EE_Attendee $attendee
48 48
 	 */
49
-	public function populate_from_attendee( $attendee ){
49
+	public function populate_from_attendee($attendee) {
50 50
 		$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
51 51
 		/** @var $attendee EE_Attendee */
52 52
 		$this->populate_defaults( 
53
-				apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
53
+				apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
54 54
 					array(
55 55
 						'first_name'=>$attendee->fname(),
56 56
 						'last_name'=>$attendee->lname(),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 						'zip'=>$attendee->zip(),
64 64
 						'phone'=>$attendee->phone(),
65 65
 					),
66
-					$attendee )
66
+					$attendee)
67 67
 				
68 68
 				);
69 69
 	}
@@ -76,48 +76,48 @@  discard block
 block discarded – undo
76 76
 	 * @param \EE_Attendee $attendee - the attendee object to copy details to
77 77
 	 * @return \EE_Attendee
78 78
 	 */
79
-	public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){
79
+	public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) {
80 80
 		// grab billing form data
81 81
 		$data = $this->valid_data();
82 82
 		// copy first_name
83
-		if ( ! empty( $data['first_name'] )) {
84
-			$attendee->set_fname( $data['first_name'] );
83
+		if ( ! empty($data['first_name'])) {
84
+			$attendee->set_fname($data['first_name']);
85 85
 		}
86 86
 		// copy last_name
87
-		if ( ! empty( $data['last_name'] )) {
88
-			$attendee->set_lname( $data['last_name'] );
87
+		if ( ! empty($data['last_name'])) {
88
+			$attendee->set_lname($data['last_name']);
89 89
 		}
90 90
 		// copy email
91
-		if ( ! empty( $data['email'] )) {
92
-			$attendee->set_email( $data['email'] );
91
+		if ( ! empty($data['email'])) {
92
+			$attendee->set_email($data['email']);
93 93
 		}
94 94
 		// copy address
95
-		if ( ! empty( $data['address'] )) {
96
-			$attendee->set_address( $data['address'] );
95
+		if ( ! empty($data['address'])) {
96
+			$attendee->set_address($data['address']);
97 97
 		}
98 98
 		// copy address2
99
-		if ( ! empty( $data['address2'] )) {
100
-			$attendee->set_address2( $data['address2'] );
99
+		if ( ! empty($data['address2'])) {
100
+			$attendee->set_address2($data['address2']);
101 101
 		}
102 102
 		// copy city
103
-		if ( ! empty( $data['city'] )) {
104
-			$attendee->set_city( $data['city'] );
103
+		if ( ! empty($data['city'])) {
104
+			$attendee->set_city($data['city']);
105 105
 		}
106 106
 		// copy state
107
-		if ( ! empty( $data['state'] )) {
108
-			$attendee->set_state( $data['state'] );
107
+		if ( ! empty($data['state'])) {
108
+			$attendee->set_state($data['state']);
109 109
 		}
110 110
 		// copy country
111
-		if ( ! empty( $data['country'] )) {
112
-			$attendee->set_country( $data['country'] );
111
+		if ( ! empty($data['country'])) {
112
+			$attendee->set_country($data['country']);
113 113
 		}
114 114
 		// copy zip
115
-		if ( ! empty( $data['zip'] )) {
116
-			$attendee->set_zip( $data['zip'] );
115
+		if ( ! empty($data['zip'])) {
116
+			$attendee->set_zip($data['zip']);
117 117
 		}
118 118
 		// copy phone
119
-		if ( ! empty( $data['phone'] )) {
120
-			$attendee->set_phone( $data['phone'] );
119
+		if ( ! empty($data['phone'])) {
120
+			$attendee->set_phone($data['phone']);
121 121
 		}
122 122
 		return $attendee;
123 123
 	}
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 	 * uses info from the billing form to create a new attendee
129 129
 	 * @return \EE_Attendee
130 130
 	 */
131
-	public function create_attendee_from_billing_form_data(){
131
+	public function create_attendee_from_billing_form_data() {
132 132
 		// grab billing form data
133 133
 		$data = $this->valid_data();
134
-		return EE_Attendee::new_instance( array(
135
-			'ATT_fname' 		=> ! empty( $data['first_name'] ) ? $data['first_name'] : '',
136
-			'ATT_lname' 		=> ! empty( $data['last_name'] ) ? $data['last_name'] : '',
137
-			'ATT_email' 		=> ! empty( $data['email'] ) ? $data['email'] : '',
138
-			'ATT_address' 		=> ! empty( $data['address'] ) ? $data['address'] : '',
139
-			'ATT_address2' 	=> ! empty( $data['address2'] ) ? $data['address2'] : '',
140
-			'ATT_city' 			=> ! empty( $data['city'] ) ? $data['city'] : '',
141
-			'STA_ID' 				=> ! empty( $data['state'] ) ? $data['state'] : '',
142
-			'CNT_ISO' 			=> ! empty( $data['country'] ) ? $data['country'] : '',
143
-			'ATT_zip' 				=> ! empty( $data['zip'] ) ? $data['zip'] : '',
144
-			'ATT_phone' 		=> ! empty( $data['phone'] ) ? $data['phone'] : '',
134
+		return EE_Attendee::new_instance(array(
135
+			'ATT_fname' 		=> ! empty($data['first_name']) ? $data['first_name'] : '',
136
+			'ATT_lname' 		=> ! empty($data['last_name']) ? $data['last_name'] : '',
137
+			'ATT_email' 		=> ! empty($data['email']) ? $data['email'] : '',
138
+			'ATT_address' 		=> ! empty($data['address']) ? $data['address'] : '',
139
+			'ATT_address2' 	=> ! empty($data['address2']) ? $data['address2'] : '',
140
+			'ATT_city' 			=> ! empty($data['city']) ? $data['city'] : '',
141
+			'STA_ID' 				=> ! empty($data['state']) ? $data['state'] : '',
142
+			'CNT_ISO' 			=> ! empty($data['country']) ? $data['country'] : '',
143
+			'ATT_zip' 				=> ! empty($data['zip']) ? $data['zip'] : '',
144
+			'ATT_phone' 		=> ! empty($data['phone']) ? $data['phone'] : '',
145 145
 		));
146 146
 	}
147 147
 }
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/email_main_wrapper.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 	<!-- Facebook sharing information tags -->
8 8
 	<meta property="og:title" content="<?php echo $subject; ?>" />
9 9
 	<title><?php echo $subject; ?></title>
10
-	<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?>
10
+	<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?>
11 11
 </head>
12
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?>
12
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?>
13 13
 <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
14
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?>
14
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?>
15 15
 <?php echo $main_body; ?>
16
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?>
16
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?>
17 17
 </body>
18
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?>
18
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?>
19 19
 </html>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/html_main_wrapper.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 		<!-- Primary Style Sheet -->
28 28
 		<link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" />
29 29
 		<!-- Make sure the buttons don't print -->
30
-		<?php if ( isset( $extra_css )) : ?>
30
+		<?php if (isset($extra_css)) : ?>
31 31
 		<!-- Additional Style Sheet -->
32 32
 		<link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" />
33 33
 		<?php endif; ?>
34 34
 		<style type="text/css">
35 35
 		@media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }}
36 36
 		</style>
37
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
37
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
38 38
 	</head>
39
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
39
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
40 40
 	<body>
41
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
41
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
42 42
 		<?php echo $main_body; ?>
43
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
43
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
44 44
 	</body>
45
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
45
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
46 46
 	<?php wp_footer(); ?>
47 47
 </html>
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Addon.lib.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 	 * @param string $min_core_version
67 67
 	 * @return string always like '4.3.0.rc.000'
68 68
 	 */
69
-	protected static function _effective_version( $min_core_version ) {
69
+	protected static function _effective_version($min_core_version) {
70 70
 		// versions: 4 . 3 . 1 . p . 123
71 71
 		// offsets:    0 . 1 . 2 . 3 . 4
72
-		$version_parts = explode( '.', $min_core_version );
72
+		$version_parts = explode('.', $min_core_version);
73 73
 		//check they specified the micro version (after 2nd period)
74
-		if( ! isset( $version_parts[ 2 ] ) ) {
75
-			$version_parts[ 2] = '0';
74
+		if ( ! isset($version_parts[2])) {
75
+			$version_parts[2] = '0';
76 76
 		}
77 77
 		//if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
78 78
 		//soon we can assume that's 'rc', but this current version is 'alpha'
79
-		if( ! isset( $version_parts[ 3 ] ) ) {
80
-			$version_parts[ 3 ] = 'dev';
79
+		if ( ! isset($version_parts[3])) {
80
+			$version_parts[3] = 'dev';
81 81
 		}
82
-		if( ! isset( $version_parts[ 4 ] ) ) {
83
-			$version_parts[ 4 ] = '000';
82
+		if ( ! isset($version_parts[4])) {
83
+			$version_parts[4] = '000';
84 84
 		}
85
-		return implode( '.', $version_parts );
85
+		return implode('.', $version_parts);
86 86
 
87 87
 	}
88 88
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param string $actual_core_version the actual core version, optional
93 93
 	 * @return boolean
94 94
 	 */
95
-	public static  function _meets_min_core_version_requirement( $min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION ) {
96
-		return version_compare( self::_effective_version( $actual_core_version ), self::_effective_version( $min_core_version ), '>=' );
95
+	public static  function _meets_min_core_version_requirement($min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION) {
96
+		return version_compare(self::_effective_version($actual_core_version), self::_effective_version($min_core_version), '>=');
97 97
 	}
98 98
 
99 99
 
@@ -155,235 +155,235 @@  discard block
 block discarded – undo
155 155
 	 * @throws EE_Error
156 156
 	 * @return void
157 157
 	 */
158
-	public static function register( $addon_name = '', $setup_args = array()  ) {
158
+	public static function register($addon_name = '', $setup_args = array()) {
159 159
 		// required fields MUST be present, so let's make sure they are.
160
-		if ( empty( $addon_name ) || ! is_array( $setup_args )) {
161
-			throw new EE_Error( __( 'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso' ));
160
+		if (empty($addon_name) || ! is_array($setup_args)) {
161
+			throw new EE_Error(__('In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso'));
162 162
 		}
163
-		if ( ! isset($setup_args[ 'main_file_path' ]) || empty( $setup_args[ 'main_file_path' ] ) ){
164
-			throw new EE_Error( sprintf( __( 'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso' ), implode(",", array_keys( $setup_args ) ) ) );
163
+		if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
164
+			throw new EE_Error(sprintf(__('When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso'), implode(",", array_keys($setup_args))));
165 165
 		}
166 166
 		// check that addon has not already been registered with that name
167
-		if ( isset( self::$_settings[ $addon_name ] ) && ! did_action( 'activate_plugin' ) ) {
168
-			throw new EE_Error( sprintf( __( 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso' ), $addon_name ));
167
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
168
+			throw new EE_Error(sprintf(__('An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso'), $addon_name));
169 169
 		}
170 170
 
171 171
 
172 172
 		// no class name for addon?
173
-		if ( empty( $setup_args['class_name'] )) {
173
+		if (empty($setup_args['class_name'])) {
174 174
 			// generate one by first separating name with spaces
175
-			$class_name = str_replace( array( '-', '_' ), ' ', trim( $addon_name ));
175
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
176 176
 			//capitalize, then replace spaces with underscores
177
-			$class_name = str_replace( ' ', '_', ucwords( $class_name ));
177
+			$class_name = str_replace(' ', '_', ucwords($class_name));
178 178
 		} else {
179 179
 			$class_name = $setup_args['class_name'];
180 180
 		}
181
-		$class_name = strpos( $class_name, 'EE_' ) === 0 ? $class_name : 'EE_' . $class_name;
181
+		$class_name = strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name;
182 182
 		//setup $_settings array from incoming values.
183 183
 		$addon_settings = array(
184 184
 			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
185 185
 			'class_name' 						=> $class_name,
186 186
 			// the addon slug for use in URLs, etc
187
-			'plugin_slug' 						=> isset( $setup_args['plugin_slug'] ) ? (string)$setup_args['plugin_slug'] : '',
187
+			'plugin_slug' 						=> isset($setup_args['plugin_slug']) ? (string) $setup_args['plugin_slug'] : '',
188 188
 			// page slug to be used when generating the "Settings" link on the WP plugin page
189
-			'plugin_action_slug' 			=> isset( $setup_args[ 'plugin_action_slug' ] ) ? (string)$setup_args[ 'plugin_action_slug' ] : '',
189
+			'plugin_action_slug' 			=> isset($setup_args['plugin_action_slug']) ? (string) $setup_args['plugin_action_slug'] : '',
190 190
 			// the "software" version for the addon
191
-			'version' 								=> isset( $setup_args['version'] ) ? (string)$setup_args['version'] : '',
191
+			'version' 								=> isset($setup_args['version']) ? (string) $setup_args['version'] : '',
192 192
 			// the minimum version of EE Core that the addon will work with
193
-			'min_core_version' 			=> isset( $setup_args['min_core_version'] ) ? (string)$setup_args['min_core_version'] : '',
193
+			'min_core_version' 			=> isset($setup_args['min_core_version']) ? (string) $setup_args['min_core_version'] : '',
194 194
 			// full server path to main file (file loaded directly by WP)
195
-			'main_file_path' 					=> isset( $setup_args['main_file_path'] ) ? (string)$setup_args['main_file_path'] : '',
195
+			'main_file_path' 					=> isset($setup_args['main_file_path']) ? (string) $setup_args['main_file_path'] : '',
196 196
 			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
197
-			'admin_path' 						=> isset( $setup_args['admin_path'] ) ? (string)$setup_args['admin_path'] : '',
197
+			'admin_path' 						=> isset($setup_args['admin_path']) ? (string) $setup_args['admin_path'] : '',
198 198
 			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
199
-			'admin_callback' 				=> isset( $setup_args['admin_callback'] ) ? (string)$setup_args['admin_callback'] : '',
199
+			'admin_callback' 				=> isset($setup_args['admin_callback']) ? (string) $setup_args['admin_callback'] : '',
200 200
 			// the section name for this addon's configuration settings section (defaults to "addons")
201
-			'config_section' 					=> isset( $setup_args['config_section'] ) ? (string)$setup_args['config_section'] : 'addons',
201
+			'config_section' 					=> isset($setup_args['config_section']) ? (string) $setup_args['config_section'] : 'addons',
202 202
 			// the class name for this addon's configuration settings object
203
-			'config_class' 						=> isset( $setup_args['config_class'] ) ? (string)$setup_args['config_class'] : '',
203
+			'config_class' 						=> isset($setup_args['config_class']) ? (string) $setup_args['config_class'] : '',
204 204
 			//the name given to the config for this addons' configuration settings object (optional)
205
-			'config_name' 					=> isset( $setup_args['config_name'] ) ? (string) $setup_args['config_name']: '',
205
+			'config_name' 					=> isset($setup_args['config_name']) ? (string) $setup_args['config_name'] : '',
206 206
 			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
207
-			'autoloader_paths' 			=> isset( $setup_args['autoloader_paths'] ) ? (array)$setup_args['autoloader_paths'] : array(),
207
+			'autoloader_paths' 			=> isset($setup_args['autoloader_paths']) ? (array) $setup_args['autoloader_paths'] : array(),
208 208
 			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
209
-			'autoloader_folders' 			=> isset( $setup_args['autoloader_folders'] ) ? (array)$setup_args['autoloader_folders'] : array(),
209
+			'autoloader_folders' 			=> isset($setup_args['autoloader_folders']) ? (array) $setup_args['autoloader_folders'] : array(),
210 210
 			// array of full server paths to any EE_DMS data migration scripts used by the addon
211
-			'dms_paths' 						=> isset( $setup_args['dms_paths'] ) ? (array)$setup_args['dms_paths'] : array(),
211
+			'dms_paths' 						=> isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array(),
212 212
 			// array of full server paths to any EED_Modules used by the addon
213
-			'module_paths' 					=> isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(),
213
+			'module_paths' 					=> isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(),
214 214
 			// array of full server paths to any EES_Shortcodes used by the addon
215
-			'shortcode_paths'			 	=> isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(),
215
+			'shortcode_paths'			 	=> isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(),
216 216
 			// array of full server paths to any WP_Widgets used by the addon
217
-			'widget_paths' 					=> isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(),
217
+			'widget_paths' 					=> isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(),
218 218
 			// array of PUE options used by the addon
219
-			'pue_options' 						=> isset( $setup_args['pue_options'] ) ? (array)$setup_args['pue_options'] : array(),
220
-			'message_types' 				=> isset( $setup_args['message_types'] ) ? (array) $setup_args['message_types'] : array(),
221
-			'capabilities' 						=> isset( $setup_args['capabilities'] ) ? (array) $setup_args['capabilities'] : array(),
222
-			'capability_maps' 				=> isset( $setup_args['capability_maps'] ) ? (array) $setup_args['capability_maps'] : array(),
223
-			'model_paths' 					=> isset( $setup_args['model_paths'] ) ? (array) $setup_args['model_paths'] : array(),
224
-			'class_paths' 						=> isset( $setup_args['class_paths'] ) ? (array) $setup_args['class_paths'] : array(),
225
-			'model_extension_paths' 	=> isset( $setup_args['model_extension_paths'] ) ? (array) $setup_args['model_extension_paths'] : array(),
226
-			'class_extension_paths' 		=> isset( $setup_args['class_extension_paths'] ) ? (array) $setup_args['class_extension_paths'] : array(),
227
-			'custom_post_types' 			=> isset( $setup_args['custom_post_types'] ) ? (array) $setup_args['custom_post_types'] : array(),
228
-			'custom_taxonomies' 		=> isset( $setup_args['custom_taxonomies'] ) ? (array) $setup_args['custom_taxonomies'] : array(),
229
-			'payment_method_paths'	=> isset( $setup_args[ 'payment_method_paths' ] ) ? (array) $setup_args[ 'payment_method_paths' ] : array(),
230
-			'default_terms' 					=> isset( $setup_args['default_terms'] ) ? (array) $setup_args['default_terms'] : array(),
219
+			'pue_options' 						=> isset($setup_args['pue_options']) ? (array) $setup_args['pue_options'] : array(),
220
+			'message_types' 				=> isset($setup_args['message_types']) ? (array) $setup_args['message_types'] : array(),
221
+			'capabilities' 						=> isset($setup_args['capabilities']) ? (array) $setup_args['capabilities'] : array(),
222
+			'capability_maps' 				=> isset($setup_args['capability_maps']) ? (array) $setup_args['capability_maps'] : array(),
223
+			'model_paths' 					=> isset($setup_args['model_paths']) ? (array) $setup_args['model_paths'] : array(),
224
+			'class_paths' 						=> isset($setup_args['class_paths']) ? (array) $setup_args['class_paths'] : array(),
225
+			'model_extension_paths' 	=> isset($setup_args['model_extension_paths']) ? (array) $setup_args['model_extension_paths'] : array(),
226
+			'class_extension_paths' 		=> isset($setup_args['class_extension_paths']) ? (array) $setup_args['class_extension_paths'] : array(),
227
+			'custom_post_types' 			=> isset($setup_args['custom_post_types']) ? (array) $setup_args['custom_post_types'] : array(),
228
+			'custom_taxonomies' 		=> isset($setup_args['custom_taxonomies']) ? (array) $setup_args['custom_taxonomies'] : array(),
229
+			'payment_method_paths'	=> isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(),
230
+			'default_terms' 					=> isset($setup_args['default_terms']) ? (array) $setup_args['default_terms'] : array(),
231 231
 			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page that can be used for adding upgrading/marketing info
232
-			'plugins_page_row' 			=> isset( $setup_args['plugins_page_row'] ) ? $setup_args['plugins_page_row'] : '',
232
+			'plugins_page_row' 			=> isset($setup_args['plugins_page_row']) ? $setup_args['plugins_page_row'] : '',
233 233
 		);
234 234
 
235 235
 		// if plugin_action_slug is NOT set, but an admin page path IS set, then let's just use the plugin_slug since that will be used for linking to the admin page
236
-		$addon_settings[ 'plugin_action_slug' ] = empty( $addon_settings[ 'plugin_action_slug' ] ) && ! empty( $addon_settings[ 'admin_path' ] ) ? $addon_settings[ 'plugin_slug' ] : $addon_settings[ 'plugin_action_slug' ];
236
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) && ! empty($addon_settings['admin_path']) ? $addon_settings['plugin_slug'] : $addon_settings['plugin_action_slug'];
237 237
 		// full server path to main file (file loaded directly by WP)
238
-		$addon_settings['plugin_basename'] = plugin_basename( $addon_settings[ 'main_file_path' ] );
238
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
239 239
 
240 240
 		//check whether this addon version is compatible with EE core
241
-		if ( isset( EE_Register_Addon::$_incompatible_addons[ $addon_name ] ) &&
242
-				! self::_meets_min_core_version_requirement( EE_Register_Addon::$_incompatible_addons[ $addon_name ], $addon_settings[ 'version' ] ) ) {
241
+		if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) &&
242
+				! self::_meets_min_core_version_requirement(EE_Register_Addon::$_incompatible_addons[$addon_name], $addon_settings['version'])) {
243 243
 			$incompatibility_message = sprintf(
244
-				__( 'The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso' ),
244
+				__('The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso'),
245 245
 				$addon_name,
246 246
 				'<br />',
247
-				EE_Register_Addon::$_incompatible_addons[ $addon_name ]
247
+				EE_Register_Addon::$_incompatible_addons[$addon_name]
248 248
 			);
249
-		} else if ( ! self::_meets_min_core_version_requirement( $setup_args[ 'min_core_version' ], espresso_version() ) ) {
249
+		} else if ( ! self::_meets_min_core_version_requirement($setup_args['min_core_version'], espresso_version())) {
250 250
 			$incompatibility_message = sprintf(
251
-				__( 'The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".', 'event_espresso' ),
251
+				__('The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".', 'event_espresso'),
252 252
 				$addon_name,
253
-				self::_effective_version( $setup_args[ 'min_core_version' ] ),
254
-				self::_effective_version( espresso_version() ),
253
+				self::_effective_version($setup_args['min_core_version']),
254
+				self::_effective_version(espresso_version()),
255 255
 				'<br />'
256 256
 			);
257 257
 		} else {
258 258
 			$incompatibility_message = '';
259 259
 		}
260
-		if ( ! empty( $incompatibility_message ) ) {
260
+		if ( ! empty($incompatibility_message)) {
261 261
 			//remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the
262 262
 			//plugin activated fine when it didn't
263
-			if( isset( $_GET[ 'activate' ]) ) {
264
-				unset( $_GET[ 'activate' ] );
263
+			if (isset($_GET['activate'])) {
264
+				unset($_GET['activate']);
265 265
 			}
266
-			if( isset( $_REQUEST[ 'activate' ] ) ){
267
-				unset( $_REQUEST[ 'activate' ] );
266
+			if (isset($_REQUEST['activate'])) {
267
+				unset($_REQUEST['activate']);
268 268
 			}
269 269
 			//and show an error message indicating the plugin didn't activate properly
270
-			EE_Error::add_error( $incompatibility_message, __FILE__, __FUNCTION__, __LINE__ );
271
-			if ( current_user_can( 'activate_plugins' )) {
272
-				require_once( ABSPATH.'wp-admin/includes/plugin.php' );
273
-				deactivate_plugins( plugin_basename( $addon_settings[ 'main_file_path' ] ), TRUE );
270
+			EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
271
+			if (current_user_can('activate_plugins')) {
272
+				require_once(ABSPATH.'wp-admin/includes/plugin.php');
273
+				deactivate_plugins(plugin_basename($addon_settings['main_file_path']), TRUE);
274 274
 			}
275 275
 			return;
276 276
 		}
277 277
 		//this is an activation request
278
-		if( did_action( 'activate_plugin' ) ){
278
+		if (did_action('activate_plugin')) {
279 279
 			//to find if THIS is the addon that was activated,
280 280
 			//just check if we have already registered it or not
281 281
 			//(as the newly-activated addon wasn't around the first time addons were registered)
282
-			if( ! isset( self::$_settings[ $addon_name ] ) ){
283
-				self::$_settings[ $addon_name ] = $addon_settings;
282
+			if ( ! isset(self::$_settings[$addon_name])) {
283
+				self::$_settings[$addon_name] = $addon_settings;
284 284
 				$addon = self::_load_and_init_addon_class($addon_name);
285 285
 				$addon->set_activation_indicator_option();
286 286
 				//dont bother setting up the rest of the addon.
287 287
 				//we know it was just activated and the request will end soon
288 288
 			}
289 289
 			return;
290
-		}else{
290
+		} else {
291 291
 			// make sure this was called in the right place!
292
-			if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' )) {
292
+			if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
293 293
 				EE_Error::doing_it_wrong(
294 294
 					__METHOD__,
295 295
 					sprintf(
296
-						__( 'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.','event_espresso'),
296
+						__('An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.', 'event_espresso'),
297 297
 						$addon_name
298 298
 					),
299 299
 					'4.3.0'
300 300
 				);
301 301
 			}
302
-			self::$_settings[ $addon_name ] = $addon_settings;
302
+			self::$_settings[$addon_name] = $addon_settings;
303 303
 		}
304 304
 		// we need cars
305
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_paths'] )) {
305
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
306 306
 			// setup autoloader for single file
307
-			EEH_Autoloader::instance()->register_autoloader( self::$_settings[ $addon_name ]['autoloader_paths'] );
307
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
308 308
 		}
309 309
 		// setup autoloaders for folders
310
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_folders'] )) {
311
-			foreach ( self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder ) {
312
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $autoloader_folder );
310
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
311
+			foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
312
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
313 313
 			}
314 314
 		}
315 315
 		// register new models
316
-		if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
317
-			EE_Register_Model::register( $addon_name, array( 'model_paths' => self::$_settings[ $addon_name ]['model_paths'] , 'class_paths' => self::$_settings[ $addon_name ]['class_paths']));
316
+		if ( ! empty(self::$_settings[$addon_name]['model_paths']) || ! empty(self::$_settings[$addon_name]['class_paths'])) {
317
+			EE_Register_Model::register($addon_name, array('model_paths' => self::$_settings[$addon_name]['model_paths'], 'class_paths' => self::$_settings[$addon_name]['class_paths']));
318 318
 		}
319 319
 		// register model extensions
320
-		if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
321
-			EE_Register_Model_Extensions::register( $addon_name, array( 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'] , 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths']));
320
+		if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) || ! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
321
+			EE_Register_Model_Extensions::register($addon_name, array('model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths']));
322 322
 		}
323 323
 		// setup DMS
324
-		if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
325
-			EE_Register_Data_Migration_Scripts::register( $addon_name, array( 'dms_paths' => self::$_settings[ $addon_name ]['dms_paths'] ));
324
+		if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
325
+			EE_Register_Data_Migration_Scripts::register($addon_name, array('dms_paths' => self::$_settings[$addon_name]['dms_paths']));
326 326
 		}
327 327
 		// if config_class is present let's register config.
328
-		if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
328
+		if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
329 329
 			EE_Register_Config::register(
330
-				self::$_settings[ $addon_name ]['config_class'],
330
+				self::$_settings[$addon_name]['config_class'],
331 331
 				array(
332
-					'config_section' => self::$_settings[ $addon_name ]['config_section'],
333
-					'config_name' => self::$_settings[ $addon_name ]['config_name']
332
+					'config_section' => self::$_settings[$addon_name]['config_section'],
333
+					'config_name' => self::$_settings[$addon_name]['config_name']
334 334
 				)
335 335
 			);
336 336
 		}
337 337
 		// register admin page
338
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
339
-			EE_Register_Admin_Page::register( $addon_name, array( 'page_path' => self::$_settings[ $addon_name ]['admin_path'] ));
338
+		if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
339
+			EE_Register_Admin_Page::register($addon_name, array('page_path' => self::$_settings[$addon_name]['admin_path']));
340 340
 
341 341
 		}
342 342
 		// add to list of modules to be registered
343
-		if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
344
-			EE_Register_Module::register( $addon_name, array( 'module_paths' => self::$_settings[ $addon_name ]['module_paths'] ));
343
+		if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
344
+			EE_Register_Module::register($addon_name, array('module_paths' => self::$_settings[$addon_name]['module_paths']));
345 345
 		}
346 346
 		// add to list of shortcodes to be registered
347
-		if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
348
-			EE_Register_Shortcode::register( $addon_name, array( 'shortcode_paths' => self::$_settings[ $addon_name ]['shortcode_paths'] ));
347
+		if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
348
+			EE_Register_Shortcode::register($addon_name, array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']));
349 349
 		}
350 350
 		// add to list of widgets to be registered
351
-		if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
352
-			EE_Register_Widget::register( $addon_name, array( 'widget_paths' => self::$_settings[ $addon_name ]['widget_paths'] ));
351
+		if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
352
+			EE_Register_Widget::register($addon_name, array('widget_paths' => self::$_settings[$addon_name]['widget_paths']));
353 353
 		}
354 354
 
355 355
 		//register capability related stuff.
356
-		if ( ! empty( self::$_settings[ $addon_name ]['capabilities'] ) ) {
357
-			EE_Register_Capabilities::register( $addon_name , array( 'capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps'] ) );
356
+		if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
357
+			EE_Register_Capabilities::register($addon_name, array('capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps']));
358 358
 		}
359 359
 		//any message type to register?
360
-		if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
361
-				add_action( 'EE_Brewing_Regular___messages_caf', array( 'EE_Register_Addon', 'register_message_types' ) );
360
+		if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
361
+				add_action('EE_Brewing_Regular___messages_caf', array('EE_Register_Addon', 'register_message_types'));
362 362
 		}
363 363
 
364 364
 		// if plugin update engine is being used for auto-updates (not needed if PUE is not being used)
365
-		if ( ! empty( $setup_args['pue_options'] )) {
366
-			self::$_settings[ $addon_name ]['pue_options'] = array(
367
-				'pue_plugin_slug' 	=> isset( $setup_args['pue_options']['pue_plugin_slug'] ) ? (string)$setup_args['pue_options']['pue_plugin_slug'] : 'espresso_' . strtolower( $class_name ),
368
-				'plugin_basename' => isset( $setup_args['pue_options']['plugin_basename'] ) ? (string)$setup_args['pue_options']['plugin_basename'] : plugin_basename( self::$_settings[ $addon_name ]['main_file_path'] ),
369
-				'checkPeriod' 			=> isset( $setup_args['pue_options']['checkPeriod'] ) ? (string)$setup_args['pue_options']['checkPeriod'] : '24',
370
-				'use_wp_update'		=> isset( $setup_args['pue_options']['use_wp_update'] ) ? (string)$setup_args['pue_options']['use_wp_update'] : FALSE
365
+		if ( ! empty($setup_args['pue_options'])) {
366
+			self::$_settings[$addon_name]['pue_options'] = array(
367
+				'pue_plugin_slug' 	=> isset($setup_args['pue_options']['pue_plugin_slug']) ? (string) $setup_args['pue_options']['pue_plugin_slug'] : 'espresso_'.strtolower($class_name),
368
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) ? (string) $setup_args['pue_options']['plugin_basename'] : plugin_basename(self::$_settings[$addon_name]['main_file_path']),
369
+				'checkPeriod' 			=> isset($setup_args['pue_options']['checkPeriod']) ? (string) $setup_args['pue_options']['checkPeriod'] : '24',
370
+				'use_wp_update'		=> isset($setup_args['pue_options']['use_wp_update']) ? (string) $setup_args['pue_options']['use_wp_update'] : FALSE
371 371
 			);
372
-			add_action( 'AHEE__EE_System__brew_espresso__after_pue_init', array( 'EE_Register_Addon', 'load_pue_update' ));
372
+			add_action('AHEE__EE_System__brew_espresso__after_pue_init', array('EE_Register_Addon', 'load_pue_update'));
373 373
 		}
374 374
 
375 375
 		//any custom post type/ custom capabilities or default terms to register
376
-		if ( !empty( self::$_settings[$addon_name]['custom_post_types'] ) || !empty( self::$_settings[$addon_name]['custom_taxonomies'] ) ) {
377
-			EE_Register_CPT::register( $addon_name, array( 'cpts' => self::$_settings[$addon_name]['custom_post_types'] , 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms'] ) );
376
+		if ( ! empty(self::$_settings[$addon_name]['custom_post_types']) || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])) {
377
+			EE_Register_CPT::register($addon_name, array('cpts' => self::$_settings[$addon_name]['custom_post_types'], 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms']));
378 378
 		}
379
-		if( ! empty( self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) ){
380
-			EE_Register_Payment_Method::register($addon_name, array( 'payment_method_paths' => self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) );
379
+		if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
380
+			EE_Register_Payment_Method::register($addon_name, array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']));
381 381
 		}
382 382
 		// load and instantiate main addon class
383 383
 		$addon = self::_load_and_init_addon_class($addon_name);
384 384
 		// call any additional admin_callback functions during load_admin_controller hook
385
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_callback'] )) {
386
-			add_action( 'AHEE__EE_System__load_controllers__load_admin_controllers', array( $addon, self::$_settings[ $addon_name ]['admin_callback'] ));
385
+		if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
386
+			add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($addon, self::$_settings[$addon_name]['admin_callback']));
387 387
 		}
388 388
 	}
389 389
 
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 	 * @param string $addon_name
395 395
 	 * @return EE_Addon
396 396
 	 */
397
-	private static function _load_and_init_addon_class($addon_name){
398
-		$addon = EE_Registry::instance()->load_addon( dirname( self::$_settings[ $addon_name ]['main_file_path'] ), self::$_settings[ $addon_name ]['class_name'] );
399
-		$addon->set_name( $addon_name );
400
-		$addon->set_plugin_slug( self::$_settings[ $addon_name ][ 'plugin_slug' ] );
401
-		$addon->set_plugin_basename( self::$_settings[ $addon_name ][ 'plugin_basename' ] );
402
-		$addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] );
403
-		$addon->set_plugin_action_slug( self::$_settings[ $addon_name ][ 'plugin_action_slug' ] );
404
-		$addon->set_plugins_page_row( self::$_settings[ $addon_name ][ 'plugins_page_row' ] );
405
-		$addon->set_version( self::$_settings[ $addon_name ]['version'] );
406
-		$addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) );
407
-		$addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] );
408
-		$addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] );
409
-		$addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] );
397
+	private static function _load_and_init_addon_class($addon_name) {
398
+		$addon = EE_Registry::instance()->load_addon(dirname(self::$_settings[$addon_name]['main_file_path']), self::$_settings[$addon_name]['class_name']);
399
+		$addon->set_name($addon_name);
400
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
401
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
402
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
403
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
404
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
405
+		$addon->set_version(self::$_settings[$addon_name]['version']);
406
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
407
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
408
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
409
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
410 410
 		//unfortunately this can't be hooked in upon construction, because we don't have
411 411
 		//the plugin mainfile's path upon construction.
412
-		register_deactivation_hook($addon->get_main_plugin_file(), array($addon,'deactivation'));
412
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
413 413
 		return $addon;
414 414
 	}
415 415
 
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	public static function load_pue_update() {
424 424
 		// load PUE client
425
-		require_once  EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
425
+		require_once  EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
426 426
 		// cycle thru settings
427
-		foreach ( self::$_settings as $settings ) {
428
-			if ( ! empty( $settings['pue_options'] )) {
427
+		foreach (self::$_settings as $settings) {
428
+			if ( ! empty($settings['pue_options'])) {
429 429
 				// initiate the class and start the plugin update engine!
430 430
 				new PluginUpdateEngineChecker(
431 431
 				// host file URL
432 432
 					'http://eventespresso.com',
433 433
 					// plugin slug(s)
434 434
 					array(
435
-						'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ),
436
-						'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' )
435
+						'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']),
436
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr')
437 437
 					),
438 438
 					// options
439 439
 					array(
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 	 * @return void
462 462
 	 */
463 463
 	public static function register_message_types() {
464
-		foreach ( self::$_settings as $settings ) {
465
-			foreach( $settings['message_types'] as $message_type => $message_type_settings ) {
466
-				EE_Register_Message_Type::register( $message_type, $message_type_settings );
464
+		foreach (self::$_settings as $settings) {
465
+			foreach ($settings['message_types'] as $message_type => $message_type_settings) {
466
+				EE_Register_Message_Type::register($message_type, $message_type_settings);
467 467
 			}
468 468
 		}
469 469
 	}
@@ -479,60 +479,60 @@  discard block
 block discarded – undo
479 479
 	 * @throws EE_Error
480 480
 	 * @return void
481 481
 	 */
482
-	public static function deregister( $addon_name = NULL ) {
483
-		if ( isset( self::$_settings[ $addon_name ] )) {
484
-			$class_name = self::$_settings[ $addon_name ]['class_name'];
485
-			if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
482
+	public static function deregister($addon_name = NULL) {
483
+		if (isset(self::$_settings[$addon_name])) {
484
+			$class_name = self::$_settings[$addon_name]['class_name'];
485
+			if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
486 486
 				// setup DMS
487
-				EE_Register_Data_Migration_Scripts::deregister( $addon_name );
487
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
488 488
 			}
489
-			if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
489
+			if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
490 490
 				// register admin page
491
-				EE_Register_Admin_Page::deregister( $addon_name );
491
+				EE_Register_Admin_Page::deregister($addon_name);
492 492
 			}
493
-			if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
493
+			if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
494 494
 				// add to list of modules to be registered
495
-				EE_Register_Module::deregister( $addon_name );
495
+				EE_Register_Module::deregister($addon_name);
496 496
 			}
497
-			if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
497
+			if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
498 498
 				// add to list of shortcodes to be registered
499
-				EE_Register_Shortcode::deregister( $addon_name );
499
+				EE_Register_Shortcode::deregister($addon_name);
500 500
 			}
501
-			if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
501
+			if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
502 502
 				// if config_class present let's register config.
503
-				EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class']);
503
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
504 504
 			}
505
-			if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
505
+			if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
506 506
 				// add to list of widgets to be registered
507
-				EE_Register_Widget::deregister( $addon_name );
507
+				EE_Register_Widget::deregister($addon_name);
508 508
 			}
509
-			if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) ||
510
-					! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
509
+			if ( ! empty(self::$_settings[$addon_name]['model_paths']) ||
510
+					! empty(self::$_settings[$addon_name]['class_paths'])) {
511 511
 				// add to list of shortcodes to be registered
512
-				EE_Register_Model::deregister( $addon_name );
512
+				EE_Register_Model::deregister($addon_name);
513 513
 			}
514
-			if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) ||
515
-					! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
514
+			if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) ||
515
+					! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
516 516
 				// add to list of shortcodes to be registered
517
-				EE_Register_Model_Extensions::deregister( $addon_name );
517
+				EE_Register_Model_Extensions::deregister($addon_name);
518 518
 				}
519
-			if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
520
-				foreach( self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings ) {
521
-					EE_Register_Message_Type::deregister( $message_type );
519
+			if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
520
+				foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
521
+					EE_Register_Message_Type::deregister($message_type);
522 522
 				}
523 523
 			}
524 524
 			//deregister capabilities for addon
525
-			if ( ! empty( self::$_settings[$addon_name]['capabilities'] ) || ! empty( self::$_settings[$addon_name]['capability_maps']) ) {
526
-				EE_Register_Capabilities::deregister( $addon_name );
525
+			if ( ! empty(self::$_settings[$addon_name]['capabilities']) || ! empty(self::$_settings[$addon_name]['capability_maps'])) {
526
+				EE_Register_Capabilities::deregister($addon_name);
527 527
 			}
528 528
 			//deregister custom_post_types for addon
529
-			if ( ! empty( self::$_settings[$addon_name]['custom_post_types'] ) ) {
530
-				EE_Register_CPT::deregister( $addon_name );
529
+			if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
530
+				EE_Register_CPT::deregister($addon_name);
531 531
 			}
532
-			remove_action('deactivate_'.EE_Registry::instance()->addons->$class_name->get_main_plugin_file_basename(),  array( EE_Registry::instance()->addons->$class_name, 'deactivation' ) );
533
-			remove_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( EE_Registry::instance()->addons->$class_name, 'initialize_db_if_no_migrations_required' ) );
532
+			remove_action('deactivate_'.EE_Registry::instance()->addons->$class_name->get_main_plugin_file_basename(), array(EE_Registry::instance()->addons->$class_name, 'deactivation'));
533
+			remove_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array(EE_Registry::instance()->addons->$class_name, 'initialize_db_if_no_migrations_required'));
534 534
 			unset(EE_Registry::instance()->addons->$class_name);
535
-			unset( self::$_settings[ $addon_name ] );
535
+			unset(self::$_settings[$addon_name]);
536 536
 		}
537 537
 	}
538 538
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Shortcodes.lib.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -56,34 +56,34 @@  discard block
 block discarded – undo
56 56
 			'[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'),
57 57
 			'[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'),
58 58
 			'[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'),
59
-			'[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ),
59
+			'[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'),
60 60
 			'[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'),
61 61
 			'[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'),
62 62
 			'[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'),
63 63
 			'[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'),
64 64
 			'[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'),
65 65
 			'[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf(
66
-				__( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ),
66
+				__('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'),
67 67
 				'<code>',
68 68
 				'</code>'
69 69
 				),
70
-			'[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ),
70
+			'[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'),
71 71
 			'[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'),
72 72
 			'[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'),
73 73
 			'[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'),
74
-			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ),
74
+			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'),
75 75
 			);
76 76
 	}
77 77
 
78 78
 
79
-	protected function _parser( $shortcode ) {
79
+	protected function _parser($shortcode) {
80 80
 
81
-		EE_Registry::instance()->load_helper( 'Formatter' );
81
+		EE_Registry::instance()->load_helper('Formatter');
82 82
 
83 83
 		$this->_event = $this->_data instanceof EE_Event ? $this->_data : null;
84 84
 
85 85
 		//if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the reg_obj instead.
86
-		if ( empty( $this->_event ) ) {
86
+		if (empty($this->_event)) {
87 87
 			$aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
88 88
 			$aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
89 89
 
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 		//If there is no event objecdt by now then get out.
95
-		if ( ! $this->_event instanceof EE_Event )
95
+		if ( ! $this->_event instanceof EE_Event)
96 96
 			return '';
97 97
 
98
-		switch ( $shortcode ) {
98
+		switch ($shortcode) {
99 99
 
100 100
 			case '[EVENT_ID]' :
101 101
 				return $this->_event->ID();
102 102
 				break;
103 103
 
104 104
 			case '[EVENT_IDENTIFIER]' :
105
-				return isset($this->_data['line_ref']) ? $this->_data['line_ref']: '';
105
+				return isset($this->_data['line_ref']) ? $this->_data['line_ref'] : '';
106 106
 				break;
107 107
 
108 108
 			case '[EVENT]' :
@@ -132,71 +132,71 @@  discard block
 block discarded – undo
132 132
 
133 133
 			case '[VIRTUAL_URL]' :
134 134
 				$venue = $this->_event->get_first_related('Venue');
135
-				if ( empty( $venue ) )
135
+				if (empty($venue))
136 136
 					return '';
137 137
 				return $venue->get('VNU_virtual_url');
138 138
 
139 139
 			case '[VIRTUAL_PHONE]' :
140 140
 				$venue = $this->_event->get_first_related('Venue');
141
-				if ( empty( $venue ) )
141
+				if (empty($venue))
142 142
 					return '';
143 143
 				return $venue->get('VNU_virtual_phone');
144 144
 				break;
145 145
 
146 146
 			case '[EVENT_IMAGE]' :
147
-				$image = $this->_event->feature_image_url(array(600,300) );
147
+				$image = $this->_event->feature_image_url(array(600, 300));
148 148
 				// @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned.
149
-				return !empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : '';
149
+				return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : '';
150 150
 				break;
151 151
 
152 152
 			case '[EVENT_FACEBOOK_URL]' :
153
-				$facebook_url = $this->_event->get_post_meta('event_facebook', true );
154
-				return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url;
153
+				$facebook_url = $this->_event->get_post_meta('event_facebook', true);
154
+				return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url;
155 155
 				break;
156 156
 
157 157
 			case '[EVENT_TWITTER_URL]' :
158 158
 				$twitter_url = $this->_event->get_post_meta('event_twitter', true);
159
-				return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url;
159
+				return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url;
160 160
 				break;
161 161
 
162 162
 			case '[EVENT_AUTHOR_EMAIL]' :
163 163
 				$author_id = $this->_event->get('EVT_wp_user');
164
-				$user_data = get_userdata( (int) $author_id );
164
+				$user_data = get_userdata((int) $author_id);
165 165
 				return $user_data->user_email;
166 166
 				break;
167 167
 
168 168
 			case '[EVENT_TOTAL_SPOTS_TAKEN]' :
169
-				return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
169
+				return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
170 170
 				break;
171 171
 
172 172
 			case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' :
173
-				EE_Registry::instance()->load_helper( 'URL' );
173
+				EE_Registry::instance()->load_helper('URL');
174 174
 				return EEH_URL::add_query_args_and_nonce(
175 175
 					array(
176 176
 						'event_id' => $this->_event->ID(),
177 177
 						'page' => 'espresso_registrations',
178 178
 						'action' => 'default'
179 179
 					),
180
-					admin_url( 'admin.php' ),
180
+					admin_url('admin.php'),
181 181
 					true
182 182
 				);
183 183
 				break;
184 184
 		}
185 185
 
186
-		if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) {
187
-			$shortcode = str_replace( '[EVENT_META_*', '', $shortcode );
188
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
186
+		if (strpos($shortcode, '[EVENT_META_*') !== false) {
187
+			$shortcode = str_replace('[EVENT_META_*', '', $shortcode);
188
+			$shortcode = trim(str_replace(']', '', $shortcode));
189 189
 
190 190
 			//pull the meta value from the event post
191
-			$event_meta = $this->_event->get_post_meta( $shortcode, true );
191
+			$event_meta = $this->_event->get_post_meta($shortcode, true);
192 192
 
193
-			return !empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : '';
193
+			return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : '';
194 194
 
195 195
 		}
196 196
 
197
-		if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) {
198
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
199
-			$method = empty( $attrs['method'] ) ? 'current' : $attrs['method'];
197
+		if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) {
198
+			$attrs = $this->_get_shortcode_attrs($shortcode);
199
+			$method = empty($attrs['method']) ? 'current' : $attrs['method'];
200 200
 			$method = $method === 'current';
201 201
 			$available = $this->_event->total_available_spaces($method);
202 202
 			return $available === INF ? '&infin;' : $available;
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	 * @param  boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event.  Otherwise we just return the url of the event.
213 213
 	 * @return string
214 214
 	 */
215
-	private function _get_event_link( $event, $full_link = TRUE ) {
215
+	private function _get_event_link($event, $full_link = TRUE) {
216 216
 		$url = get_permalink($event->ID());
217 217
 
218
-		return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url;
218
+		return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url;
219 219
 	}
220 220
 
221 221
 
Please login to merge, or discard this patch.