Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
64:09 queued 52:26
created
core/libraries/form_sections/strategies/layout/EE_No_Layout.strategy.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,31 +26,31 @@  discard block
 block discarded – undo
26 26
 	 * @param EE_Form_Input_Base $input
27 27
 	 * @return string
28 28
 	 */
29
-	public function layout_input( $input ) {
29
+	public function layout_input($input) {
30 30
 		$html = '';
31
-		if ( $input instanceof EE_Hidden_Input  ) {
32
-			$html .= EEH_HTML::nl() . $input->get_html_for_input();
33
-		} else if ( $input instanceof EE_Submit_Input  ) {
31
+		if ($input instanceof EE_Hidden_Input) {
32
+			$html .= EEH_HTML::nl().$input->get_html_for_input();
33
+		} else if ($input instanceof EE_Submit_Input) {
34 34
 			$html .= EEH_HTML::br();
35 35
 			$html .= $input->get_html_for_input();
36
-		} else if ( $input instanceof EE_Select_Input  ) {
36
+		} else if ($input instanceof EE_Select_Input) {
37 37
 			$html .= EEH_HTML::br();
38
-			$html .= EEH_HTML::nl(1) . $input->get_html_for_label();
39
-			$html .= EEH_HTML::nl() . $input->get_html_for_errors();
40
-			$html .= EEH_HTML::nl() . $input->get_html_for_input();
41
-			$html .= EEH_HTML::nl() . $input->get_html_for_help();
38
+			$html .= EEH_HTML::nl(1).$input->get_html_for_label();
39
+			$html .= EEH_HTML::nl().$input->get_html_for_errors();
40
+			$html .= EEH_HTML::nl().$input->get_html_for_input();
41
+			$html .= EEH_HTML::nl().$input->get_html_for_help();
42 42
 			$html .= EEH_HTML::br();
43
-		} else if ( $input instanceof EE_Form_Input_With_Options_Base  ) {
43
+		} else if ($input instanceof EE_Form_Input_With_Options_Base) {
44 44
 			$html .= EEH_HTML::br();
45
-			$html .= EEH_HTML::nl() . $input->get_html_for_errors();
46
-			$html .= EEH_HTML::nl() . $input->get_html_for_input();
47
-			$html .= EEH_HTML::nl() . $input->get_html_for_help();
45
+			$html .= EEH_HTML::nl().$input->get_html_for_errors();
46
+			$html .= EEH_HTML::nl().$input->get_html_for_input();
47
+			$html .= EEH_HTML::nl().$input->get_html_for_help();
48 48
 		} else {
49 49
 			$html .= EEH_HTML::br();
50
-			$html .= EEH_HTML::nl(1) . $input->get_html_for_label();
51
-			$html .= EEH_HTML::nl() . $input->get_html_for_errors();
52
-			$html .= EEH_HTML::nl() . $input->get_html_for_input();
53
-			$html .= EEH_HTML::nl() . $input->get_html_for_help();
50
+			$html .= EEH_HTML::nl(1).$input->get_html_for_label();
51
+			$html .= EEH_HTML::nl().$input->get_html_for_errors();
52
+			$html .= EEH_HTML::nl().$input->get_html_for_input();
53
+			$html .= EEH_HTML::nl().$input->get_html_for_help();
54 54
 		}
55 55
 		$html .= EEH_HTML::nl(-1);
56 56
 		return $html;
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 * @param EE_Form_Section_Proper $form_section
64 64
 	 * @return string
65 65
 	 */
66
-	public function layout_subsection( $form_section ){
66
+	public function layout_subsection($form_section) {
67 67
 //		d( $form_section );
68
-		return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
68
+		return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1);
69 69
 	}
70 70
 
71 71
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * closing div tag for a form
74 74
 	 * @return string
75 75
 	 */
76
-	public function layout_form_end(){
76
+	public function layout_form_end() {
77 77
 		return EEH_HTML::nl(-1);
78 78
 	}
79 79
 }
80 80
\ No newline at end of file
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Div_Per_Section_Layout.strategy.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6.0
11 11
  *
12 12
  */
13
-class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base{
13
+class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base {
14 14
 
15 15
 	/**
16 16
 	 * opening div tag for a form
17 17
 	 * @return string
18 18
 	 */
19 19
 	public function layout_form_begin() {
20
-		return EEH_HTML::div( '', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style() );
20
+		return EEH_HTML::div('', $this->_form_section->html_id(), $this->_form_section->html_class(), $this->_form_section->html_style());
21 21
 	}
22 22
 
23 23
 
@@ -26,38 +26,38 @@  discard block
 block discarded – undo
26 26
 	 * @param EE_Form_Input_Base $input
27 27
 	 * @return string
28 28
 	 */
29
-	public function layout_input( $input ) {
29
+	public function layout_input($input) {
30 30
 		$html = '';
31
-		if ( $input instanceof EE_Hidden_Input  ) {
32
-			$html .= EEH_HTML::nl() . $input->get_html_for_input();
33
-		} else if ( $input instanceof EE_Submit_Input  ) {
34
-			$html .= EEH_HTML::div( $input->get_html_for_input(), $input->html_id() . '-submit-dv', $input->html_class() . '-submit-dv' );
35
-		} else if ( $input instanceof EE_Select_Input  ) {
31
+		if ($input instanceof EE_Hidden_Input) {
32
+			$html .= EEH_HTML::nl().$input->get_html_for_input();
33
+		} else if ($input instanceof EE_Submit_Input) {
34
+			$html .= EEH_HTML::div($input->get_html_for_input(), $input->html_id().'-submit-dv', $input->html_class().'-submit-dv');
35
+		} else if ($input instanceof EE_Select_Input) {
36 36
 			$html .= EEH_HTML::div(
37
-				EEH_HTML::nl(1) . $input->get_html_for_label() .
38
-				EEH_HTML::nl() . $input->get_html_for_errors() .
39
-				EEH_HTML::nl() . $input->get_html_for_input() .
40
-				EEH_HTML::nl() . $input->get_html_for_help(),
41
-				$input->html_id() . '-input-dv',
42
-				$input->html_class() . '-input-dv'
37
+				EEH_HTML::nl(1).$input->get_html_for_label().
38
+				EEH_HTML::nl().$input->get_html_for_errors().
39
+				EEH_HTML::nl().$input->get_html_for_input().
40
+				EEH_HTML::nl().$input->get_html_for_help(),
41
+				$input->html_id().'-input-dv',
42
+				$input->html_class().'-input-dv'
43 43
 			);
44
-		} else if ( $input instanceof EE_Form_Input_With_Options_Base  ) {
44
+		} else if ($input instanceof EE_Form_Input_With_Options_Base) {
45 45
 			$html .= EEH_HTML::div(
46
-				EEH_HTML::nl() . $this->_display_label_for_option_type_question( $input ) .
47
-				EEH_HTML::nl() . $input->get_html_for_errors() .
48
-				EEH_HTML::nl() . $input->get_html_for_input() .
49
-				EEH_HTML::nl() . $input->get_html_for_help(),
50
-				$input->html_id() . '-input-dv',
51
-				$input->html_class() . '-input-dv'
46
+				EEH_HTML::nl().$this->_display_label_for_option_type_question($input).
47
+				EEH_HTML::nl().$input->get_html_for_errors().
48
+				EEH_HTML::nl().$input->get_html_for_input().
49
+				EEH_HTML::nl().$input->get_html_for_help(),
50
+				$input->html_id().'-input-dv',
51
+				$input->html_class().'-input-dv'
52 52
 			);
53 53
 		} else {
54 54
 			$html .= EEH_HTML::div(
55
-				EEH_HTML::nl(1) . $input->get_html_for_label() .
56
-				EEH_HTML::nl() . $input->get_html_for_errors() .
57
-				EEH_HTML::nl() . $input->get_html_for_input() .
58
-				EEH_HTML::nl() . $input->get_html_for_help(),
59
-				$input->html_id() . '-input-dv',
60
-				$input->html_class() . '-input-dv'
55
+				EEH_HTML::nl(1).$input->get_html_for_label().
56
+				EEH_HTML::nl().$input->get_html_for_errors().
57
+				EEH_HTML::nl().$input->get_html_for_input().
58
+				EEH_HTML::nl().$input->get_html_for_help(),
59
+				$input->html_id().'-input-dv',
60
+				$input->html_class().'-input-dv'
61 61
 			);
62 62
 		}
63 63
 		return $html;
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 * @param EE_Form_Input_With_Options_Base $input
75 75
 	 * @return string
76 76
 	 */
77
-	protected function _display_label_for_option_type_question( EE_Form_Input_With_Options_Base $input ){
78
-		if ( $input->display_html_label_text() != '' ) {
79
-			$class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class();
80
-			$label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text();
81
-			$html = '<div id="' . $input->html_label_id() . '"';
82
-			$html .= ' class="' . $class . '"';
83
-			$html .= ' style="' . $input->html_label_style() . '">';
84
-			$html .= $label_text . '</div>';
77
+	protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) {
78
+		if ($input->display_html_label_text() != '') {
79
+			$class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class();
80
+			$label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text();
81
+			$html = '<div id="'.$input->html_label_id().'"';
82
+			$html .= ' class="'.$class.'"';
83
+			$html .= ' style="'.$input->html_label_style().'">';
84
+			$html .= $label_text.'</div>';
85 85
 			return $html;
86 86
 		} else {
87 87
 			return '';
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @param EE_Form_Section_Proper $form_section
96 96
 	 * @return string
97 97
 	 */
98
-	public function layout_subsection( $form_section ){
98
+	public function layout_subsection($form_section) {
99 99
 //		d( $form_section );
100
-		return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1);
100
+		return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1);
101 101
 	}
102 102
 
103 103
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * closing div tag for a form
106 106
 	 * @return string
107 107
 	 */
108
-	public function layout_form_end(){
109
-		return EEH_HTML::divx( $this->_form_section->html_id(), $this->_form_section->html_class() );
108
+	public function layout_form_end() {
109
+		return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class());
110 110
 	}
111 111
 }
112 112
\ No newline at end of file
Please login to merge, or discard this patch.
core/middleware/EE_Detect_Login.php 1 patch
Spacing   +6 added lines, -6 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,20 +26,20 @@  discard block
 block discarded – undo
26 26
 	 * @param    EE_Response $response
27 27
 	 * @return    EE_Response
28 28
 	 */
29
-	public function handle_request( EE_Request $request, EE_Response $response ) {
29
+	public function handle_request(EE_Request $request, EE_Response $response) {
30 30
 		$this->_request = $request;
31 31
 		$this->_response = $response;
32 32
 		global $pagenow;
33 33
 		if (
34 34
 			in_array(
35 35
 				$pagenow,
36
-				array( 'wp-login.php', 'wp-register.php' )
36
+				array('wp-login.php', 'wp-register.php')
37 37
 			)
38
-			&& ! $request->get( 'ee_load_on_login' )
38
+			&& ! $request->get('ee_load_on_login')
39 39
 		) {
40 40
 			$this->_response->terminate_request();
41 41
 		}
42
-		$this->_response = $this->process_request_stack( $this->_request, $this->_response );
42
+		$this->_response = $this->process_request_stack($this->_request, $this->_response);
43 43
 		return $this->_response;
44 44
 	}
45 45
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 //(all other times it gets resurrected from a wordpress option)
14 14
 $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*');
15 15
 $class_to_filepath = array();
16
-foreach($stages as $filepath){
16
+foreach ($stages as $filepath) {
17 17
 	$matches = array();
18
-	preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches);
18
+	preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19 19
 	$class_to_filepath[$matches[1]] = $filepath;
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath);
22
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
23 23
 EEH_Autoloader::register_autoloader($class_to_filepath);
24 24
 
25 25
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  * @since                4.6.0
36 36
  *
37 37
  */
38
-class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{
38
+class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base {
39 39
 
40 40
 	/**
41 41
 	 * return EE_DMS_Core_4_8_0
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function can_migrate_from_version($version_array) {
64 64
 		$version_string = $version_array['Core'];
65
-		if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){
65
+		if ($version_string <= '4.8.0' && $version_string >= '4.7.0') {
66 66
 //			echo "$version_string can be migrated from";
67 67
 			return true;
68
-		}elseif( ! $version_string ){
68
+		}elseif ( ! $version_string) {
69 69
 //			echo "no version string provided: $version_string";
70 70
 			//no version string provided... this must be pre 4.3
71
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
72
-		}else{
71
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
72
+		} else {
73 73
 //			echo "$version_string doesnt apply";
74 74
 			return false;
75 75
 		}
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 	 * @return bool
91 91
 	 */
92 92
 	public function schema_changes_before_migration() {
93
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
94
-		$now_in_mysql = current_time( 'mysql', true );
93
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
94
+		$now_in_mysql = current_time('mysql', true);
95 95
 
96
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
97
-		$table_name='esp_answer';
98
-		$sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
96
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
97
+		$table_name = 'esp_answer';
98
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
99 99
 					REG_ID int(10) unsigned NOT NULL,
100 100
 					QST_ID int(10) unsigned NOT NULL,
101 101
 					ANS_value text NOT NULL,
102 102
 					PRIMARY KEY  (ANS_ID),
103 103
 					KEY REG_ID (REG_ID),
104 104
 					KEY QST_ID (QST_ID)";
105
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
105
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
106 106
 
107 107
 		$table_name = 'esp_attendee_meta';
108 108
 		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 					  CNT_is_EU tinyint(1) DEFAULT '0',
143 143
 					  CNT_active tinyint(1) DEFAULT '0',
144 144
 					  PRIMARY KEY  (CNT_ISO)";
145
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
145
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
146 146
 
147 147
 		$table_name = 'esp_currency';
148 148
 		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
153 153
 				CUR_active tinyint(1) DEFAULT '0',
154 154
 				PRIMARY KEY  (CUR_code)";
155
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
155
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
156 156
 
157 157
 
158 158
 		$table_name = 'esp_currency_payment_method';
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 						KEY EVT_ID (EVT_ID),
183 183
 						KEY DTT_is_primary (DTT_is_primary)";
184 184
 
185
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
185
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
186 186
 
187 187
 		$table_name = 'esp_event_meta';
188 188
 		$sql = "
@@ -201,41 +201,41 @@  discard block
 block discarded – undo
201 201
 			EVT_donations tinyint(1) NULL,
202 202
 			PRIMARY KEY  (EVTM_ID),
203 203
 			KEY EVT_ID (EVT_ID)";
204
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
204
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
205 205
 
206 206
 
207 207
 
208
-		$table_name='esp_event_question_group';
209
-		$sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
208
+		$table_name = 'esp_event_question_group';
209
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
210 210
 					EVT_ID bigint(20) unsigned NOT NULL,
211 211
 					QSG_ID int(10) unsigned NOT NULL,
212 212
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
213 213
 					PRIMARY KEY  (EQG_ID),
214 214
 					KEY EVT_ID (EVT_ID),
215 215
 					KEY QSG_ID (QSG_ID)";
216
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
216
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
217 217
 
218 218
 
219 219
 
220
-		$table_name='esp_event_venue';
221
-		$sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT,
220
+		$table_name = 'esp_event_venue';
221
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
222 222
 				EVT_ID bigint(20) unsigned NOT NULL,
223 223
 				VNU_ID bigint(20) unsigned NOT NULL,
224 224
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
225 225
 				PRIMARY KEY  (EVV_ID)";
226
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
226
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
227 227
 
228 228
 
229 229
 
230
-		$table_name='esp_extra_meta';
231
-		$sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT,
230
+		$table_name = 'esp_extra_meta';
231
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
232 232
 				OBJ_ID int(11) DEFAULT NULL,
233 233
 				EXM_type varchar(45) DEFAULT NULL,
234 234
 				EXM_key varchar(45) DEFAULT NULL,
235 235
 				EXM_value text,
236 236
 				PRIMARY KEY  (EXM_ID),
237 237
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
238
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
238
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
239 239
 
240 240
 		$table_name = 'esp_extra_join';
241 241
 		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
249 249
 		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
250 250
 
251
-		$table_name='esp_line_item';
252
-		$sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT,
251
+		$table_name = 'esp_line_item';
252
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
253 253
 				LIN_code varchar(245) NOT NULL DEFAULT '',
254 254
 				TXN_ID int(11) DEFAULT NULL,
255 255
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				PRIMARY KEY  (LIN_ID),
269 269
 				KEY LIN_code (LIN_code(191)),
270 270
 				KEY TXN_ID (TXN_ID)";
271
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
271
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
272 272
 
273 273
 		$table_name = 'esp_log';
274 274
 		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
308 308
 					PRIMARY KEY  (GRP_ID),
309 309
 					KEY MTP_user_id (MTP_user_id)";
310
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
310
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
311 311
 
312 312
 		$table_name = 'esp_event_message_template';
313 313
 		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 					PRIMARY KEY  (EMT_ID),
317 317
 					KEY EVT_ID (EVT_ID),
318 318
 					KEY GRP_ID (GRP_ID)";
319
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
319
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
320 320
 
321 321
 
322 322
 		$table_name = 'esp_payment';
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 					  PRIMARY KEY  (TTM_ID)";
390 390
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
391 391
 
392
-		$table_name='esp_question';
393
-		$sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
392
+		$table_name = 'esp_question';
393
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
394 394
 					QST_display_text text NOT NULL,
395 395
 					QST_admin_label varchar(255) NOT NULL,
396 396
 					QST_system varchar(25) NOT NULL DEFAULT "",
@@ -404,22 +404,22 @@  discard block
 block discarded – undo
404 404
 					QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
405 405
 					PRIMARY KEY  (QST_ID),
406 406
 					KEY QST_order (QST_order)';
407
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
407
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
408 408
 
409
-		$table_name='esp_question_group_question';
410
-		$sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
409
+		$table_name = 'esp_question_group_question';
410
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
411 411
 					QSG_ID int(10) unsigned NOT NULL,
412 412
 					QST_ID int(10) unsigned NOT NULL,
413 413
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
414 414
 					PRIMARY KEY  (QGQ_ID),
415 415
 					KEY QST_ID (QST_ID),
416 416
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
417
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
417
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
418 418
 
419 419
 
420 420
 
421
-		$table_name='esp_question_option';
422
-		$sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
421
+		$table_name = 'esp_question_option';
422
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
423 423
 					QSO_value varchar(255) NOT NULL,
424 424
 					QSO_desc text NOT NULL,
425 425
 					QST_ID int(10) unsigned NOT NULL,
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 					PRIMARY KEY  (QSO_ID),
430 430
 					KEY QST_ID (QST_ID),
431 431
 					KEY QSO_order (QSO_order)";
432
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
432
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
433 433
 
434 434
 
435 435
 
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
 
476 476
 
477 477
 
478
-		$table_name='esp_checkin';
479
-		$sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
478
+		$table_name = 'esp_checkin';
479
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
480 480
 					REG_ID int(10) unsigned NOT NULL,
481 481
 					DTT_ID int(10) unsigned NOT NULL,
482 482
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 					  PRC_parent int(10) unsigned DEFAULT 0,
572 572
 					  PRIMARY KEY  (PRC_ID),
573 573
 					  KEY PRT_ID (PRT_ID)";
574
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
574
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
575 575
 
576 576
 		$table_name = "esp_price_type";
577 577
 		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
610 610
 					  PRIMARY KEY  (TKT_ID),
611 611
 					  KEY TKT_start_date (TKT_start_date)";
612
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
612
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
613 613
 
614 614
 		$table_name = 'esp_question_group';
615
-		$sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
615
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
616 616
 					QSG_name varchar(255) NOT NULL,
617 617
 					QSG_identifier varchar(100) NOT NULL,
618 618
 					QSG_desc text NULL,
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 					PRIMARY KEY  (QSG_ID),
626 626
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
627 627
 					KEY QSG_order (QSG_order)';
628
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
628
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
629 629
 
630 630
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
631 631
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 		return $script_4_7_defaults->schema_changes_after_migration();
662 662
 	}
663 663
 
664
-	public function migration_page_hooks(){
664
+	public function migration_page_hooks() {
665 665
 
666 666
 	}
667 667
 	
@@ -675,19 +675,19 @@  discard block
 block discarded – undo
675 675
 		//CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active
676 676
 		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
677 677
 		$newer_countries = array(
678
-			array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ),
679
-			array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
680
-			array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ),
681
-			array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ),
682
-			array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2,  '+44', 0, 0  ),
683
-			array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ),
684
-			array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
685
-			array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1,  2, '+382', 0, 0 ),
686
-			array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ),
687
-			array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ),
688
-			array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ),
689
-			array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ),
690
-			array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ),
678
+			array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
679
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
680
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
681
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
682
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
683
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
684
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
685
+			array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
686
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0),
687
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
688
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
689
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0),
690
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
691 691
 		);
692 692
 		global $wpdb;
693 693
 		$country_table = $wpdb->prefix."esp_country";
@@ -706,14 +706,14 @@  discard block
 block discarded – undo
706 706
 							"CNT_is_EU" => '%d',
707 707
 							"CNT_active" => '%d',
708 708
 						);
709
-		if ( EEH_Activation::table_exists( $country_table ) ) {
710
-			foreach( $newer_countries as $country ) {
711
-				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ;
709
+		if (EEH_Activation::table_exists($country_table)) {
710
+			foreach ($newer_countries as $country) {
711
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
712 712
 				$countries = $wpdb->get_var($SQL);
713
-				if ( ! $countries ) {
713
+				if ( ! $countries) {
714 714
 
715
-					$wpdb->insert( $country_table,
716
-							array_combine( array_keys( $country_format), $country ),
715
+					$wpdb->insert($country_table,
716
+							array_combine(array_keys($country_format), $country),
717 717
 							$country_format
718 718
 							);
719 719
 				}
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
732 732
 		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
733 733
 		$newer_currencies = array(
734
-			array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ),
734
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
735 735
 		);
736 736
 		global $wpdb;
737 737
 		$currency_table = $wpdb->prefix."esp_currency";
@@ -743,14 +743,14 @@  discard block
 block discarded – undo
743 743
 							"CUR_dec_plc" => '%d',
744 744
 							"CUR_active" => '%d',
745 745
 						);
746
-		if ( EEH_Activation::table_exists( $currency_table ) ) {
747
-			foreach( $newer_currencies as $currency ) {
748
-				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ;
746
+		if (EEH_Activation::table_exists($currency_table)) {
747
+			foreach ($newer_currencies as $currency) {
748
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
749 749
 				$countries = $wpdb->get_var($SQL);
750
-				if ( ! $countries ) {
750
+				if ( ! $countries) {
751 751
 
752
-					$wpdb->insert( $currency_table,
753
-							array_combine( array_keys( $currency_format), $currency ),
752
+					$wpdb->insert($currency_table,
753
+							array_combine(array_keys($currency_format), $currency),
754 754
 							$currency_format
755 755
 							);
756 756
 				}
@@ -762,9 +762,9 @@  discard block
 block discarded – undo
762 762
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
763 763
 	 * we should be able to stop doing this in 4.9
764 764
 	 */
765
-	public function fix_non_default_taxes(){
765
+	public function fix_non_default_taxes() {
766 766
 		global $wpdb;
767
-		$query = $wpdb->prepare( "UPDATE
767
+		$query = $wpdb->prepare("UPDATE
768 768
 				{$wpdb->prefix}esp_price p INNER JOIN
769 769
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
770 770
 			SET
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 			WHERE
773 773
 				p.PRC_is_default = 0 AND
774 774
 				pt.PBT_ID = %d
775
-					", EEM_Price_Type::base_type_tax );
776
-		$wpdb->query( $query );
775
+					", EEM_Price_Type::base_type_tax);
776
+		$wpdb->query($query);
777 777
 	}
778 778
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_1_0.dms.php 1 patch
Spacing   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@  discard block
 block discarded – undo
8 8
 //(all other times it gets resurrected from a wordpress option)
9 9
 $stages = glob(EE_CORE.'data_migration_scripts/4_1_0_stages/*');
10 10
 $class_to_filepath = array();
11
-if ( ! empty( $stages ) ) {
12
-	foreach($stages as $filepath){
11
+if ( ! empty($stages)) {
12
+	foreach ($stages as $filepath) {
13 13
 		$matches = array();
14
-		preg_match('~4_1_0_stages/(.*).dmsstage.php~',$filepath,$matches);
14
+		preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches);
15 15
 		$class_to_filepath[$matches[1]] = $filepath;
16 16
 	}
17 17
 }
18 18
 //give addons a chance to autoload their stages too
19
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages',$class_to_filepath);
19
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages', $class_to_filepath);
20 20
 EEH_Autoloader::register_autoloader($class_to_filepath);
21 21
 
22 22
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * --a function named update_espresso_config() which saves the EE_Config object to the database
35 35
  * --...and all its subclasses... really, you're best off copying the whole thin gwhen 4.1 is released into this file and wrapping its declaration in if( ! class_exists()){...}
36 36
  */
37
-class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base{
37
+class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base {
38 38
 
39 39
 
40 40
 
@@ -67,26 +67,26 @@  discard block
 block discarded – undo
67 67
 	 * @global type $wpdb
68 68
 	 * @return boolean
69 69
 	 */
70
-	private function _checkin_table_exists(){
70
+	private function _checkin_table_exists() {
71 71
 		global $wpdb;
72 72
 		$results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'");
73
-		if($results){
73
+		if ($results) {
74 74
 			return true;
75
-		}else{
75
+		} else {
76 76
 			return false;
77 77
 		}
78 78
 	}
79 79
 	public function can_migrate_from_version($version_array) {
80 80
 		$version_string = $version_array['Core'];
81
-		if($version_string < '4.0.0' && $version_string > '3.1.26' ){
81
+		if ($version_string < '4.0.0' && $version_string > '3.1.26') {
82 82
 //			echo "$version_string can be migrated fro";
83 83
 			return true;
84
-		}elseif( ! $version_string ){
84
+		}elseif ( ! $version_string) {
85 85
 //			echo "no version string provided: $version_string";
86 86
 			//no version string provided... this must be pre 4.1
87 87
 			//because since 4.1 we're
88
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
89
-		}else{
88
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
89
+		} else {
90 90
 //			echo "$version_string doesnt apply";
91 91
 			return false;
92 92
 		}
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 	public function schema_changes_before_migration() {
98 98
 		//relies on 4.1's EEH_Activation::create_table
99
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
99
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
100 100
 
101
-		$table_name='esp_answer';
102
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
101
+		$table_name = 'esp_answer';
102
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
103 103
 					REG_ID INT UNSIGNED NOT NULL,
104 104
 					QST_ID INT UNSIGNED NOT NULL,
105 105
 					ANS_value TEXT NOT NULL,
106 106
 					PRIMARY KEY  (ANS_ID)";
107
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
107
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
108 108
 
109 109
 		$table_name = 'esp_attendee_meta';
110 110
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
145 145
 					  CNT_active TINYINT(1) DEFAULT '0',
146 146
 					  PRIMARY KEY  (CNT_ISO)";
147
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
147
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
148 148
 
149 149
 
150 150
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
 
167 167
 
168
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
168
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
169 169
 		$table_name = 'esp_event_meta';
170 170
 		$sql = "
171 171
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 			EVT_external_URL VARCHAR(200) NULL,
183 183
 			EVT_donations TINYINT(1) NULL,
184 184
 			PRIMARY KEY  (EVTM_ID)";
185
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
185
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
186 186
 
187 187
 
188 188
 
189
-		$table_name='esp_event_question_group';
190
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
189
+		$table_name = 'esp_event_question_group';
190
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
191 191
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
192 192
 					QSG_ID INT UNSIGNED NOT NULL,
193 193
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
194 194
 					PRIMARY KEY  (EQG_ID)";
195
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
195
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
196 196
 
197 197
 
198 198
 
199
-		$table_name='esp_event_venue';
200
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
199
+		$table_name = 'esp_event_venue';
200
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
201 201
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
202 202
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
203 203
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
204 204
 				PRIMARY KEY  (EVV_ID)";
205
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
205
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
206 206
 
207 207
 
208 208
 
209
-		$table_name='esp_extra_meta';
210
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
209
+		$table_name = 'esp_extra_meta';
210
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
211 211
 				OBJ_ID INT(11) DEFAULT NULL,
212 212
 				EXM_type VARCHAR(45) DEFAULT NULL,
213 213
 				EXM_key VARCHAR(45) DEFAULT NULL,
214 214
 				EXM_value TEXT,
215 215
 				PRIMARY KEY  (EXM_ID)";
216
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
216
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
217 217
 
218
-		$table_name='esp_line_item';
219
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
218
+		$table_name = 'esp_line_item';
219
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
220 220
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
221 221
 				TXN_ID INT(11) DEFAULT NULL,
222 222
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 				OBJ_ID INT(11) DEFAULT NULL,
233 233
 				OBJ_type VARCHAR(45)DEFAULT NULL,
234 234
 				PRIMARY KEY  (LIN_ID)";
235
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
235
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
236 236
 
237 237
 		$table_name = 'esp_message_template';
238 238
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 					PRIMARY KEY  (GRP_ID),
260 260
 					KEY EVT_ID (EVT_ID),
261 261
 					KEY MTP_user_id (MTP_user_id)";
262
-		$this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB');
262
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
263 263
 
264 264
 
265 265
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 
368 368
 
369 369
 
370
-		$table_name='esp_question';
371
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
370
+		$table_name = 'esp_question';
371
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
372 372
 					QST_display_text TEXT NOT NULL,
373 373
 					QST_admin_label VARCHAR(255) NOT NULL,
374 374
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
 					QST_wp_user BIGINT UNSIGNED NULL,
381 381
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
382 382
 					PRIMARY KEY  (QST_ID)';
383
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
383
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
384 384
 
385
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
385
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
386 386
 
387 387
 		$table_name = 'esp_question_group';
388
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
388
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
389 389
 					QSG_name VARCHAR(255) NOT NULL,
390 390
 					QSG_identifier VARCHAR(100) NOT NULL,
391 391
 					QSG_desc TEXT NULL,
@@ -396,27 +396,27 @@  discard block
 block discarded – undo
396 396
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
397 397
 					PRIMARY KEY  (QSG_ID),
398 398
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
399
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
399
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
400 400
 
401 401
 
402 402
 
403
-		$table_name='esp_question_group_question';
404
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
403
+		$table_name = 'esp_question_group_question';
404
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
405 405
 					QSG_ID INT UNSIGNED NOT NULL,
406 406
 					QST_ID INT UNSIGNED NOT NULL,
407 407
 					PRIMARY KEY  (QGQ_ID) ";
408
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
408
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
409 409
 
410 410
 
411 411
 
412
-		$table_name='esp_question_option';
413
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
412
+		$table_name = 'esp_question_option';
413
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
414 414
 					QSO_value VARCHAR(255) NOT NULL,
415 415
 					QSO_desc TEXT NOT NULL,
416 416
 					QST_ID INT UNSIGNED NOT NULL,
417 417
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
418 418
 					PRIMARY KEY  (QSO_ID)";
419
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
419
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
420 420
 
421 421
 
422 422
 
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 
450 450
 
451 451
 
452
-		$table_name='esp_checkin';
453
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
452
+		$table_name = 'esp_checkin';
453
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
454 454
 					REG_ID INT(10) UNSIGNED NOT NULL,
455 455
 					DTT_ID INT(10) UNSIGNED NOT NULL,
456 456
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -557,12 +557,12 @@  discard block
 block discarded – undo
557 557
 
558 558
 		global $wpdb;
559 559
 		$state_table = $wpdb->prefix."esp_state";
560
-		if ( EEH_Activation::table_exists( $state_table ) ) {
560
+		if (EEH_Activation::table_exists($state_table)) {
561 561
 
562
-			$SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
562
+			$SQL = "SELECT COUNT('STA_ID') FROM ".$state_table;
563 563
 			$states = $wpdb->get_var($SQL);
564
-			if ( ! $states ) {
565
-				$SQL = "INSERT INTO " . $state_table . "
564
+			if ( ! $states) {
565
+				$SQL = "INSERT INTO ".$state_table."
566 566
 				(STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES
567 567
 				(1, 'US', 'AK', 'Alaska', 1),
568 568
 				(2, 'US', 'AL', 'Alabama', 1),
@@ -649,12 +649,12 @@  discard block
 block discarded – undo
649 649
 
650 650
 		global $wpdb;
651 651
 		$country_table = $wpdb->prefix."esp_country";
652
-		if ( EEH_Activation::table_exists( $country_table ) ) {
652
+		if (EEH_Activation::table_exists($country_table)) {
653 653
 
654
-			$SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
654
+			$SQL = "SELECT COUNT('CNT_ISO') FROM ".$country_table;
655 655
 			$countries = $wpdb->get_var($SQL);
656
-			if ( ! $countries ) {
657
-				$SQL = "INSERT INTO " . $country_table . "
656
+			if ( ! $countries) {
657
+				$SQL = "INSERT INTO ".$country_table."
658 658
 				(CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active) VALUES
659 659
 				('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
660 660
 				('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0),
@@ -901,20 +901,20 @@  discard block
 block discarded – undo
901 901
 		global $wpdb;
902 902
 		$price_type_table = $wpdb->prefix."esp_price_type";
903 903
 
904
-		if ( EEH_Activation::table_exists( $price_type_table ) ) {
904
+		if (EEH_Activation::table_exists($price_type_table)) {
905 905
 
906
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
907
-			$price_types_exist = $wpdb->get_var( $SQL );
906
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
907
+			$price_types_exist = $wpdb->get_var($SQL);
908 908
 
909
-			if ( ! $price_types_exist ) {
909
+			if ( ! $price_types_exist) {
910 910
 				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
911
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, 0),
912
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, 0),
913
-							(3, '" . __('Fixed Discount', 'event_espresso') . "', 2,  0, 30, 0),
914
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, 0),
915
-							(5, '" . __('Fixed Surcharge', 'event_espresso') . "', 3,  0, 50, 0);";
916
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL );
917
-				$wpdb->query( $SQL );
911
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, 0),
912
+							(2, '" . __('Percent Discount', 'event_espresso')."', 2,  1, 20, 0),
913
+							(3, '" . __('Fixed Discount', 'event_espresso')."', 2,  0, 30, 0),
914
+							(4, '" . __('Percent Surcharge', 'event_espresso')."', 3,  1, 40, 0),
915
+							(5, '" . __('Fixed Surcharge', 'event_espresso')."', 3,  0, 50, 0);";
916
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
917
+				$wpdb->query($SQL);
918 918
 			}
919 919
 		}
920 920
 	}
@@ -934,16 +934,16 @@  discard block
 block discarded – undo
934 934
 		global $wpdb;
935 935
 		$price_table = $wpdb->prefix."esp_price";
936 936
 
937
-		if ( EEH_Activation::table_exists(  $price_table ) ) {
937
+		if (EEH_Activation::table_exists($price_table)) {
938 938
 
939
-			$SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table;
940
-			$prices_exist = $wpdb->get_var( $SQL );
939
+			$SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
940
+			$prices_exist = $wpdb->get_var($SQL);
941 941
 
942
-			if ( ! $prices_exist ) {
942
+			if ( ! $prices_exist) {
943 943
 				$SQL = "INSERT INTO $price_table
944 944
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_order, PRC_deleted, PRC_parent ) VALUES
945 945
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, 0, 0, 0);";
946
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL );
946
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL);
947 947
 				$wpdb->query($SQL);
948 948
 			}
949 949
 		}
@@ -960,34 +960,34 @@  discard block
 block discarded – undo
960 960
 
961 961
 		global $wpdb;
962 962
 		$ticket_table = $wpdb->prefix."esp_ticket";
963
-		if ( EEH_Activation::table_exists( $ticket_table ) ) {
963
+		if (EEH_Activation::table_exists($ticket_table)) {
964 964
 
965
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
965
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
966 966
 			$tickets_exist = $wpdb->get_var($SQL);
967 967
 
968
-			if ( ! $tickets_exist ) {
968
+			if ( ! $tickets_exist) {
969 969
 				$SQL = "INSERT INTO $ticket_table
970 970
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
971
-					( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
972
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL );
971
+					( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
972
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
973 973
 				$wpdb->query($SQL);
974 974
 			}
975 975
 		}
976 976
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
977 977
 
978
-		if ( EEH_Activation::table_exists( $ticket_price_table ) ) {
978
+		if (EEH_Activation::table_exists($ticket_price_table)) {
979 979
 
980
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
980
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
981 981
 			$ticket_prc_exist = $wpdb->get_var($SQL);
982 982
 
983
-			if ( ! $ticket_prc_exist ) {
983
+			if ( ! $ticket_prc_exist) {
984 984
 
985 985
 				$SQL = "INSERT INTO $ticket_price_table
986 986
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
987 987
 				( 1, 1, 1 )
988 988
 				";
989 989
 
990
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL );
990
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
991 991
 				$wpdb->query($SQL);
992 992
 			}
993 993
 		}
@@ -1000,20 +1000,20 @@  discard block
 block discarded – undo
1000 1000
 	 * @param string $country_name
1001 1001
 	 * @return array where keys are columns, values are column values
1002 1002
 	 */
1003
-	public function get_or_create_country($country_name){
1004
-		if( ! $country_name ){
1003
+	public function get_or_create_country($country_name) {
1004
+		if ( ! $country_name) {
1005 1005
 			throw new EE_Error(__("Could not get a country because country name is blank", "event_espresso"));
1006 1006
 		}
1007 1007
 		global $wpdb;
1008 1008
 		$country_table = $wpdb->prefix."esp_country";
1009
-		if(is_int($country_name)){
1009
+		if (is_int($country_name)) {
1010 1010
 			$country_name = $this->get_iso_from_3_1_country_id($country_name);
1011 1011
 		}
1012 1012
 		$country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE
1013 1013
 			CNT_ISO LIKE %s OR
1014 1014
 			CNT_ISO3 LIKE %s OR
1015
-			CNT_name LIKE %s LIMIT 1",$country_name,$country_name,$country_name),ARRAY_A);
1016
-		if( ! $country ){
1015
+			CNT_name LIKE %s LIMIT 1", $country_name, $country_name, $country_name), ARRAY_A);
1016
+		if ( ! $country) {
1017 1017
 			//insert a new one then
1018 1018
 			$cols_n_values = array(
1019 1019
 				'CNT_ISO'=> $this->_find_available_country_iso(2),
@@ -1033,26 +1033,26 @@  discard block
 block discarded – undo
1033 1033
 				'CNT_active'=>true
1034 1034
 			);
1035 1035
 			$data_types = array(
1036
-				'%s',//CNT_ISO
1037
-				'%s',//CNT_ISO3
1038
-				'%d',//RGN_ID
1039
-				'%s',//CNT_name
1040
-				'%s',//CNT_cur_code
1041
-				'%s',//CNT_cur_single
1042
-				'%s',//CNT_cur_plural
1043
-				'%s',//CNT_cur_sign
1044
-				'%d',//CNT_cur_sign_b4
1045
-				'%d',//CNT_cur_dec_plc
1046
-				'%s',//CNT_cur_dec_mrk
1047
-				'%s',//CNT_cur_thsnds
1048
-				'%s',//CNT_tel_code
1049
-				'%d',//CNT_is_EU
1050
-				'%d',//CNT_active
1036
+				'%s', //CNT_ISO
1037
+				'%s', //CNT_ISO3
1038
+				'%d', //RGN_ID
1039
+				'%s', //CNT_name
1040
+				'%s', //CNT_cur_code
1041
+				'%s', //CNT_cur_single
1042
+				'%s', //CNT_cur_plural
1043
+				'%s', //CNT_cur_sign
1044
+				'%d', //CNT_cur_sign_b4
1045
+				'%d', //CNT_cur_dec_plc
1046
+				'%s', //CNT_cur_dec_mrk
1047
+				'%s', //CNT_cur_thsnds
1048
+				'%s', //CNT_tel_code
1049
+				'%d', //CNT_is_EU
1050
+				'%d', //CNT_active
1051 1051
 			);
1052 1052
 			$success = $wpdb->insert($country_table,
1053 1053
 					$cols_n_values,
1054 1054
 					$data_types);
1055
-			if( ! $success){
1055
+			if ( ! $success) {
1056 1056
 				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('country_id'=>$country_name), $country_table, $cols_n_values, $data_types));
1057 1057
 			}
1058 1058
 			$country = $cols_n_values;
@@ -1064,13 +1064,13 @@  discard block
 block discarded – undo
1064 1064
 	 * @global type $wpdb
1065 1065
 	 * @return string
1066 1066
 	 */
1067
-	private function _find_available_country_iso($num_letters = 2){
1067
+	private function _find_available_country_iso($num_letters = 2) {
1068 1068
 		global $wpdb;
1069 1069
 		$country_table = $wpdb->prefix."esp_country";
1070
-		do{
1070
+		do {
1071 1071
 			$current_iso = strtoupper(wp_generate_password($num_letters, false));
1072
-			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s",$current_iso));
1073
-		}while(intval($country_with_that_iso));
1072
+			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s", $current_iso));
1073
+		}while (intval($country_with_that_iso));
1074 1074
 		return $current_iso;
1075 1075
 	}
1076 1076
 
@@ -1081,14 +1081,14 @@  discard block
 block discarded – undo
1081 1081
 	 * @param string $state_name
1082 1082
 	 * @return array where keys are columns, values are column values
1083 1083
 	 */
1084
-	public function get_or_create_state($state_name,$country_name = ''){
1085
-		if( ! $state_name ){
1084
+	public function get_or_create_state($state_name, $country_name = '') {
1085
+		if ( ! $state_name) {
1086 1086
 			throw new EE_Error(__("Could not get-or-create state because no state name was provided", "event_espresso"));
1087 1087
 		}
1088
-		try{
1088
+		try {
1089 1089
 			$country = $this->get_or_create_country($country_name);
1090 1090
 			$country_iso = $country['CNT_ISO'];
1091
-		}catch(EE_Error $e){
1091
+		} catch (EE_Error $e) {
1092 1092
 			$country_iso = $this->get_default_country_iso();
1093 1093
 		}
1094 1094
 		global $wpdb;
@@ -1096,24 +1096,24 @@  discard block
 block discarded – undo
1096 1096
 		$state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
1097 1097
 			(STA_abbrev LIKE %s OR
1098 1098
 			STA_name LIKE %s) AND
1099
-			CNT_ISO LIKE %s LIMIT 1",$state_name,$state_name,$country_iso),ARRAY_A);
1100
-		if ( ! $state){
1099
+			CNT_ISO LIKE %s LIMIT 1", $state_name, $state_name, $country_iso), ARRAY_A);
1100
+		if ( ! $state) {
1101 1101
 			//insert a new one then
1102 1102
 			$cols_n_values = array(
1103 1103
 				'CNT_ISO'=>$country_iso,
1104
-				'STA_abbrev'=>substr($state_name,0,6),
1104
+				'STA_abbrev'=>substr($state_name, 0, 6),
1105 1105
 				'STA_name'=>$state_name,
1106 1106
 				'STA_active'=>true
1107 1107
 			);
1108 1108
 			$data_types = array(
1109
-				'%s',//CNT_ISO
1110
-				'%s',//STA_abbrev
1111
-				'%s',//STA_name
1112
-				'%d',//STA_active
1109
+				'%s', //CNT_ISO
1110
+				'%s', //STA_abbrev
1111
+				'%s', //STA_name
1112
+				'%d', //STA_active
1113 1113
 			);
1114
-			$success = $wpdb->insert($state_table,$cols_n_values,$data_types);
1115
-			if ( ! $success ){
1116
-				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name,'country_id'=>$country_name), $state_table, $cols_n_values, $data_types));
1114
+			$success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1115
+			if ( ! $success) {
1116
+				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name, 'country_id'=>$country_name), $state_table, $cols_n_values, $data_types));
1117 1117
 			}
1118 1118
 			$state = $cols_n_values;
1119 1119
 			$state['STA_ID'] = $wpdb->insert_id;
@@ -1126,21 +1126,21 @@  discard block
 block discarded – undo
1126 1126
 	 * @param type $timeString
1127 1127
 	 * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes with leading zeros)
1128 1128
 	 */
1129
-	public function convertTimeFromAMPM($timeString){
1129
+	public function convertTimeFromAMPM($timeString) {
1130 1130
 		$matches = array();
1131
-		preg_match("~(\\d*):(\\d*)~",$timeString,$matches);
1132
-		if( ! $matches || count($matches)<3){
1131
+		preg_match("~(\\d*):(\\d*)~", $timeString, $matches);
1132
+		if ( ! $matches || count($matches) < 3) {
1133 1133
 			$hour = '00';
1134 1134
 			$minutes = '00';
1135
-		}else{
1135
+		} else {
1136 1136
 			$hour = intval($matches[1]);
1137 1137
 			$minutes = $matches[2];
1138 1138
 		}
1139
-		if(strpos($timeString, 'PM') || strpos($timeString, 'pm')){
1139
+		if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) {
1140 1140
 			$hour = intval($hour) + 12;
1141 1141
 		}
1142
-		$hour = str_pad( "$hour", 2, '0',STR_PAD_LEFT);
1143
-		$minutes = str_pad( "$minutes", 2, '0',STR_PAD_LEFT);
1142
+		$hour = str_pad("$hour", 2, '0', STR_PAD_LEFT);
1143
+		$minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT);
1144 1144
 		return "$hour:$minutes";
1145 1145
 	}
1146 1146
 
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 	 * @param int $country_id
1150 1150
 	 * @return string the country's ISO3 code
1151 1151
 	 */
1152
-	public function get_iso_from_3_1_country_id($country_id){
1152
+	public function get_iso_from_3_1_country_id($country_id) {
1153 1153
 		$old_countries = array(
1154 1154
 			array(64, 'United States', 'US', 'USA', 1),
1155 1155
 			array(15, 'Australia', 'AU', 'AUS', 1),
@@ -1375,9 +1375,9 @@  discard block
 block discarded – undo
1375 1375
 			array(226, 'Zimbabwe', 'ZW', 'ZWE', 1));
1376 1376
 
1377 1377
 		$country_iso = 'US';
1378
-		foreach($old_countries as $country_array){
1378
+		foreach ($old_countries as $country_array) {
1379 1379
 			//note: index 0 is the 3.1 country ID
1380
-			if($country_array[0] == $country_id){
1380
+			if ($country_array[0] == $country_id) {
1381 1381
 				//note: index 2 is the ISO
1382 1382
 				$country_iso = $country_array[2];
1383 1383
 				break;
@@ -1390,8 +1390,8 @@  discard block
 block discarded – undo
1390 1390
 	 * Gets the ISO3 for the
1391 1391
 	 * @return string
1392 1392
 	 */
1393
-	public function get_default_country_iso(){
1394
-		$old_org_options= get_option('events_organization_settings');
1393
+	public function get_default_country_iso() {
1394
+		$old_org_options = get_option('events_organization_settings');
1395 1395
 		$iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']);
1396 1396
 		return $iso;
1397 1397
 	}
@@ -1403,13 +1403,13 @@  discard block
 block discarded – undo
1403 1403
 	 * the event's DEFAULT payment status, or the attendee's payment status) required pre-approval.
1404 1404
 	 * @return string STS_ID for use in 4.1
1405 1405
 	 */
1406
-	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false){
1406
+	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false) {
1407 1407
 
1408 1408
 		//EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1409
-		if($this_thing_required_pre_approval){
1409
+		if ($this_thing_required_pre_approval) {
1410 1410
 				return 'RNA';
1411
-		}else{
1412
-				$mapping = $default_reg_stati_conversions=array(
1411
+		} else {
1412
+				$mapping = $default_reg_stati_conversions = array(
1413 1413
 			'Completed'=>'RAP',
1414 1414
 			''=>'RPP',
1415 1415
 			'Incomplete'=>'RPP',
@@ -1439,22 +1439,22 @@  discard block
 block discarded – undo
1439 1439
 	 * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1440 1440
 	 * @return boolean whether or not we had to do the big job of creating an image attachment
1441 1441
 	 */
1442
-	public function convert_image_url_to_attachment_and_attach_to_post($guid,$new_cpt_id,  EE_Data_Migration_Script_Stage $migration_stage){
1442
+	public function convert_image_url_to_attachment_and_attach_to_post($guid, $new_cpt_id, EE_Data_Migration_Script_Stage $migration_stage) {
1443 1443
 		$created_attachment_post = false;
1444 1444
 		$guid = $this->_get_original_guid($guid);
1445
-		if($guid){
1445
+		if ($guid) {
1446 1446
 			//check for an existing attachment post with this guid
1447 1447
 			$attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid);
1448
-			if( ! $attachment_post_id){
1448
+			if ( ! $attachment_post_id) {
1449 1449
 				//post thumbnail with that GUID doesn't exist, we should create one
1450 1450
 				$attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage);
1451 1451
 				$created_attachment_post = true;
1452 1452
 			}
1453 1453
 			//double-check we actually have an attachment post
1454
-			if( $attachment_post_id){
1455
-				update_post_meta($new_cpt_id,'_thumbnail_id',$attachment_post_id);
1456
-			}else{
1457
-				$migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"),$guid,$new_cpt_id,$attachment_post_id));
1454
+			if ($attachment_post_id) {
1455
+				update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id);
1456
+			} else {
1457
+				$migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"), $guid, $new_cpt_id, $attachment_post_id));
1458 1458
 			}
1459 1459
 		}
1460 1460
 		return $created_attachment_post;
@@ -1468,13 +1468,13 @@  discard block
 block discarded – undo
1468 1468
 	 * @param string $guid_in_old_event
1469 1469
 	 * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was
1470 1470
 	 */
1471
-	private function _get_original_guid($guid_in_old_event){
1472
-		$original_guid = preg_replace('~-\d*x\d*\.~','.',$guid_in_old_event,1);
1471
+	private function _get_original_guid($guid_in_old_event) {
1472
+		$original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1);
1473 1473
 		//do a head request to verify the file exists
1474 1474
 		$head_response = wp_remote_head($original_guid);
1475
-		if( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK'){
1475
+		if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') {
1476 1476
 			return $original_guid;
1477
-		}else{
1477
+		} else {
1478 1478
 			return $guid_in_old_event;
1479 1479
 		}
1480 1480
 	}
@@ -1486,32 +1486,32 @@  discard block
 block discarded – undo
1486 1486
 	 * @param EE_Data_Migration_Script_Stage $migration_stage
1487 1487
 	 * @return int
1488 1488
 	 */
1489
-	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage){
1490
-		if ( ! $guid){
1489
+	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage) {
1490
+		if ( ! $guid) {
1491 1491
 			$migration_stage->add_error(sprintf(__("Cannot create image attachment for a blank GUID!", "event_espresso")));
1492 1492
 			return 0;
1493 1493
 		}
1494
-		$wp_filetype = wp_check_filetype(basename($guid), null );
1494
+		$wp_filetype = wp_check_filetype(basename($guid), null);
1495 1495
 		$wp_upload_dir = wp_upload_dir();
1496 1496
 		//if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1497
-		if(strpos($guid,$wp_upload_dir['url']) === FALSE){
1497
+		if (strpos($guid, $wp_upload_dir['url']) === FALSE) {
1498 1498
 			//image is located remotely. download it and place it in the uploads directory
1499
-			if( ! is_readable($guid)){
1500
-				$migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"),$guid));
1499
+			if ( ! is_readable($guid)) {
1500
+				$migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"), $guid));
1501 1501
 				return 0;
1502 1502
 			}
1503
-			$contents= file_get_contents($guid);
1504
-			if($contents === FALSE){
1505
-				$migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"),$guid));
1503
+			$contents = file_get_contents($guid);
1504
+			if ($contents === FALSE) {
1505
+				$migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"), $guid));
1506 1506
 				return false;
1507 1507
 			}
1508
-			$local_filepath  = $wp_upload_dir['path'].DS.basename($guid);
1508
+			$local_filepath = $wp_upload_dir['path'].DS.basename($guid);
1509 1509
 			$savefile = fopen($local_filepath, 'w');
1510 1510
 			fwrite($savefile, $contents);
1511 1511
 			fclose($savefile);
1512
-			$guid = str_replace($wp_upload_dir['path'],$wp_upload_dir['url'],$local_filepath);
1513
-		}else{
1514
-			$local_filepath = str_replace($wp_upload_dir['url'],$wp_upload_dir['path'],$guid);
1512
+			$guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath);
1513
+		} else {
1514
+			$local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid);
1515 1515
 		}
1516 1516
 
1517 1517
 		$attachment = array(
@@ -1521,24 +1521,24 @@  discard block
 block discarded – undo
1521 1521
 		   'post_content' => '',
1522 1522
 		   'post_status' => 'inherit'
1523 1523
 		);
1524
-		$attach_id = wp_insert_attachment( $attachment, $guid );
1525
-		if( ! $attach_id ){
1526
-			$migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"),$guid,$this->_json_encode($attachment)));
1524
+		$attach_id = wp_insert_attachment($attachment, $guid);
1525
+		if ( ! $attach_id) {
1526
+			$migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"), $guid, $this->_json_encode($attachment)));
1527 1527
 			return $attach_id;
1528 1528
 		}
1529 1529
 
1530 1530
 		// you must first include the image.php file
1531 1531
 		// for the function wp_generate_attachment_metadata() to work
1532
-		require_once(ABSPATH . 'wp-admin/includes/image.php');
1532
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1533 1533
 
1534
-		$attach_data = wp_generate_attachment_metadata( $attach_id, $local_filepath );
1535
-		if( ! $attach_data){
1536
-			$migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"),$attach_id,$local_filepath,$guid));
1534
+		$attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1535
+		if ( ! $attach_data) {
1536
+			$migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"), $attach_id, $local_filepath, $guid));
1537 1537
 			return $attach_id;
1538 1538
 		}
1539
-		$metadata_save_result = wp_update_attachment_metadata( $attach_id, $attach_data );
1540
-		if( ! $metadata_save_result ){
1541
-			$migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"),$attach_id,$this->_json_encode($attach_data)));
1539
+		$metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data);
1540
+		if ( ! $metadata_save_result) {
1541
+			$migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"), $attach_id, $this->_json_encode($attach_data)));
1542 1542
 		}
1543 1543
 		return $attach_id;
1544 1544
 	}
@@ -1550,9 +1550,9 @@  discard block
 block discarded – undo
1550 1550
 	 * @param string $guid
1551 1551
 	 * @return int
1552 1552
 	 */
1553
-	private function _get_image_attachment_id_by_GUID($guid){
1553
+	private function _get_image_attachment_id_by_GUID($guid) {
1554 1554
 		global $wpdb;
1555
-		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1",$guid));
1555
+		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid));
1556 1556
 		return $attachment_id;
1557 1557
 	}
1558 1558
 	/**
@@ -1564,20 +1564,20 @@  discard block
 block discarded – undo
1564 1564
 	 * @param string $timezone
1565 1565
 	 * @return string
1566 1566
 	 */
1567
-	public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string,$timezone = null){
1567
+	public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string, $timezone = null) {
1568 1568
 		$original_tz = $timezone;
1569
-		if( ! $timezone){
1569
+		if ( ! $timezone) {
1570 1570
 			$timezone = $this->_get_wp_timezone();
1571 1571
 		}
1572
-		if( ! $timezone){
1573
-			$stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"),$original_tz,$row_of_data));
1572
+		if ( ! $timezone) {
1573
+			$stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"), $original_tz, $row_of_data));
1574 1574
 			$timezone = 'UTC';
1575 1575
 		}
1576
-		try{
1577
-			$date_obj = new DateTime( $DATETIME_string, new DateTimeZone( $timezone ) );
1576
+		try {
1577
+			$date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone));
1578 1578
 			$date_obj->setTimezone(new DateTimeZone('UTC'));
1579
-		}catch(Exception $e){
1580
-			$stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"),$DATETIME_string,$timezone));
1579
+		} catch (Exception $e) {
1580
+			$stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"), $DATETIME_string, $timezone));
1581 1581
 			$date_obj = new DateTime();
1582 1582
 		}
1583 1583
 
@@ -1588,14 +1588,14 @@  discard block
 block discarded – undo
1588 1588
 	 * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset)
1589 1589
 	 * @return string
1590 1590
 	 */
1591
-	private function _get_wp_timezone(){
1592
-		$timezone = empty( $timezone ) ? get_option('timezone_string') : $timezone;
1591
+	private function _get_wp_timezone() {
1592
+		$timezone = empty($timezone) ? get_option('timezone_string') : $timezone;
1593 1593
 
1594 1594
 		//if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
1595
-		if ( empty( $timezone ) ) {
1595
+		if (empty($timezone)) {
1596 1596
 			//let's get a the WordPress UTC offset
1597 1597
 			$offset = get_option('gmt_offset');
1598
-			$timezone = $this->timezone_convert_to_string_from_offset( $offset );
1598
+			$timezone = $this->timezone_convert_to_string_from_offset($offset);
1599 1599
 		}
1600 1600
 		return $timezone;
1601 1601
 	}
@@ -1604,11 +1604,11 @@  discard block
 block discarded – undo
1604 1604
 	 * @param int $offset
1605 1605
 	 * @return boolean
1606 1606
 	 */
1607
-	private function timezone_convert_to_string_from_offset($offset){
1607
+	private function timezone_convert_to_string_from_offset($offset) {
1608 1608
 		//shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable
1609 1609
 		$offset *= 3600; // convert hour offset to seconds
1610 1610
         $abbrarray = timezone_abbreviations_list();
1611
-        foreach ($abbrarray as $abbr){
1611
+        foreach ($abbrarray as $abbr) {
1612 1612
                 foreach ($abbr as $city)
1613 1613
                 {
1614 1614
                         if ($city['offset'] == $offset)
@@ -1622,32 +1622,32 @@  discard block
 block discarded – undo
1622 1622
         return FALSE;
1623 1623
 	}
1624 1624
 
1625
-	public function migration_page_hooks(){
1626
-		add_filter('FHEE__ee_migration_page__header',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1627
-		add_filter('FHEE__ee_migration_page__p_after_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1628
-		add_filter('FHEE__ee_migration_page__option_1_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1629
-		add_filter('FHEE__ee_migration_page__option_1_button_text',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1630
-		add_action('AHEE__ee_migration_page__option_1_extra_details',array($this,'_migration_page_hook_option_1_extra_details'),10,3);
1631
-		add_filter('FHEE__ee_migration_page__option_2_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,4);
1632
-		add_filter('FHEE__ee_migration_page__option_2_button_text',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1633
-		add_filter('FHEE__ee_migration_page__option_2_details',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1634
-		add_action('AHEE__ee_migration_page__after_migration_options_table',array($this,'_migration_page_hook_after_migration_options_table'));
1635
-		add_filter('FHEE__ee_migration_page__done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1636
-		add_filter('FHEE__ee_migration_page__p_after_done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1625
+	public function migration_page_hooks() {
1626
+		add_filter('FHEE__ee_migration_page__header', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1627
+		add_filter('FHEE__ee_migration_page__p_after_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1628
+		add_filter('FHEE__ee_migration_page__option_1_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1629
+		add_filter('FHEE__ee_migration_page__option_1_button_text', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1630
+		add_action('AHEE__ee_migration_page__option_1_extra_details', array($this, '_migration_page_hook_option_1_extra_details'), 10, 3);
1631
+		add_filter('FHEE__ee_migration_page__option_2_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 4);
1632
+		add_filter('FHEE__ee_migration_page__option_2_button_text', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1633
+		add_filter('FHEE__ee_migration_page__option_2_details', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1634
+		add_action('AHEE__ee_migration_page__after_migration_options_table', array($this, '_migration_page_hook_after_migration_options_table'));
1635
+		add_filter('FHEE__ee_migration_page__done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1636
+		add_filter('FHEE__ee_migration_page__p_after_done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1637 1637
 	}
1638 1638
 
1639
-	public function _migrate_page_hook_simplify_version_strings($old_content,$current_db_state,$next_db_state,$ultimate_db_state = NULL){
1640
-		return str_replace(array($current_db_state,$next_db_state,$ultimate_db_state),array(__('EE3','event_espresso'),__('EE4','event_espresso'),  __("EE4", 'event_espresso')),$old_content);
1639
+	public function _migrate_page_hook_simplify_version_strings($old_content, $current_db_state, $next_db_state, $ultimate_db_state = NULL) {
1640
+		return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state), array(__('EE3', 'event_espresso'), __('EE4', 'event_espresso'), __("EE4", 'event_espresso')), $old_content);
1641 1641
 	}
1642
-	public function _migration_page_hook_simplify_next_db_state($old_content,$next_db_state){
1643
-		return str_replace($next_db_state,  __("EE4", 'event_espresso'),$old_content);
1642
+	public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state) {
1643
+		return str_replace($next_db_state, __("EE4", 'event_espresso'), $old_content);
1644 1644
 	}
1645
-	public function _migration_page_hook_option_1_extra_details(){
1646
-		?><p><?php	printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso"));?></p><?php
1645
+	public function _migration_page_hook_option_1_extra_details() {
1646
+		?><p><?php	printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso")); ?></p><?php
1647 1647
 	}
1648
-	public function _migration_page_hook_after_migration_options_table(){
1648
+	public function _migration_page_hook_after_migration_options_table() {
1649 1649
 		?><p class="ee-attention">
1650
-				<strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso");?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso");	?>
1650
+				<strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso"); ?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso"); ?>
1651 1651
 			</p><?php
1652 1652
 	}
1653 1653
 }
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Repository.lib.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 
5 5
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return bool
34 34
 	 */
35
-	public function add( $message, $info = null ) {
36
-		$attached = parent::add( $message );
35
+	public function add($message, $info = null) {
36
+		$attached = parent::add($message);
37 37
 		//ensure $info is an array if not already
38 38
 		$info = $info === null ? $info = array() : (array) $info;
39
-		$data = $this->_init_data( $info, $attached, $message );
40
-		if ( $attached ) {
41
-			$this->set_info( $message, $data );
39
+		$data = $this->_init_data($info, $attached, $message);
40
+		if ($attached) {
41
+			$this->set_info($message, $data);
42 42
 		}
43 43
 		return $attached;
44 44
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @param EE_Message $message
52 52
 	 * @return array
53 53
 	 */
54
-	protected function _init_data( $info, $attached, $message ) {
54
+	protected function _init_data($info, $attached, $message) {
55 55
 		$data = array(
56 56
 			'test_send' => false,
57 57
 			'preview' => false,
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 				'MSG_generation_data' => array()
61 61
 			)
62 62
 		);
63
-		if ( isset( $info['preview'] ) ) {
63
+		if (isset($info['preview'])) {
64 64
 			$data['preview'] = $info['preview'];
65
-			unset( $info['preview'] );
65
+			unset($info['preview']);
66 66
 		}
67
-		if ( isset( $info['test_send'] ) ) {
67
+		if (isset($info['test_send'])) {
68 68
 			$data['test_send'] = $info['test_send'];
69
-			unset( $info['test_send'] );
69
+			unset($info['test_send']);
70 70
 		}
71
-		if ( isset( $info['data_handler_class_name'] ) ) {
71
+		if (isset($info['data_handler_class_name'])) {
72 72
 			$data['data_handler_class_name'] = $info['data_handler_class_name'];
73
-			unset( $info['data_handler_class_name'] );
73
+			unset($info['data_handler_class_name']);
74 74
 		}
75
-		if ( $attached && $message->STS_ID() === EEM_Message::status_incomplete ) {
76
-			$generation_data = isset( $info['MSG_generation_data'] ) ? $info['MSG_generation_data'] : array();
75
+		if ($attached && $message->STS_ID() === EEM_Message::status_incomplete) {
76
+			$generation_data = isset($info['MSG_generation_data']) ? $info['MSG_generation_data'] : array();
77 77
 			//if data isn't in $info...let's see if its available via the message object
78 78
 			$generation_data = ! $generation_data ? $message->get_generation_data() : $generation_data;
79 79
 			//still empty then let's just use info
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function saveAll() {
98 98
 		$this->rewind();
99
-		$save_tracking = array( 'updated' => 0, 'notupdated' => 0, 'errors' => array() );
99
+		$save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array());
100 100
 
101 101
 		//exit early if there is nothing to save.
102
-		if ( ! $this->count() > 0 ) {
102
+		if ( ! $this->count() > 0) {
103 103
 			return $save_tracking;
104 104
 		}
105 105
 
106
-		while( $this->valid() ) {
106
+		while ($this->valid()) {
107 107
 
108 108
 			$saved = $this->current()->save();
109
-			if ( $saved === false ) {
109
+			if ($saved === false) {
110 110
 				$save_tracking['errors'][] = $this->current()->MSG_token();
111
-			} elseif ( $saved ) {
111
+			} elseif ($saved) {
112 112
 				$save_tracking['updated']++;
113 113
 			} else {
114 114
 				$save_tracking['notupdated']++;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 			$this->next();
120 120
 		}
121
-		do_action( 'AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this );
121
+		do_action('AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this);
122 122
 		return $save_tracking;
123 123
 	}
124 124
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 * @param string   $token   Token.
134 134
 	 * @return EE_Message | null
135 135
 	 */
136
-	public function getMessageByToken( $token ) {
136
+	public function getMessageByToken($token) {
137 137
 		$this->rewind();
138
-		while( $this->valid() ) {
139
-			if ( $this->current()->MSG_token() === $token ) {
138
+		while ($this->valid()) {
139
+			if ($this->current()->MSG_token() === $token) {
140 140
 				$message = $this->current();
141 141
 				$this->rewind();
142 142
 				return $message;
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function get_generation_data() {
159 159
 		//first verify we're at a valid iterator point.
160
-		if ( ! $this->valid() ) {
160
+		if ( ! $this->valid()) {
161 161
 			return array();
162 162
 		}
163 163
 		$info = $this->getInfo();
164
-		return isset( $info['data'] ) && isset( $info['data']['MSG_generation_data'] ) ? $info['data']['MSG_generation_data'] : array();
164
+		return isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array();
165 165
 	}
166 166
 
167 167
 
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	 * @return string
173 173
 	 */
174 174
 	public function get_data_handler() {
175
-		if ( ! $this->valid() ) {
175
+		if ( ! $this->valid()) {
176 176
 			return '';
177 177
 		}
178 178
 		$info = $this->getInfo();
179
-		return isset( $info['data_handler_class_name'] ) ? $info['data_handler_class_name'] : '';
179
+		return isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : '';
180 180
 	}
181 181
 
182 182
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return bool
187 187
 	 */
188 188
 	public function is_preview() {
189
-		if ( ! $this->valid() ) {
189
+		if ( ! $this->valid()) {
190 190
 			return false;
191 191
 		}
192 192
 		$info = $this->getInfo();
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @return bool
200 200
 	 */
201 201
 	public function is_test_send() {
202
-		if ( ! $this->valid() ) {
202
+		if ( ! $this->valid()) {
203 203
 			return false;
204 204
 		}
205 205
 		$info = $this->getInfo();
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
 	 *  data is attached for later retrieval (batch generation).
215 215
 	 */
216 216
 	protected function _maybe_persist_attached_data() {
217
-		if ( ! $this->valid() ) {
217
+		if ( ! $this->valid()) {
218 218
 			return;
219 219
 		}
220 220
 
221 221
 		$info = $this->getInfo();
222
-		$data_handler_class_name = isset( $info['data_handler_class_name'] ) ? $info['data_handler_class_name'] : '';
223
-		$data = isset( $info['data'] ) && isset( $info['data']['MSG_generation_data'] ) ? $info['data']['MSG_generation_data'] : array();
224
-		if ( $data && $this->current()->STS_ID() === EEM_Message::status_incomplete ) {
225
-			$this->current()->set_generation_data( $data );
226
-			$this->current()->set_field_or_extra_meta( 'data_handler_class_name', $data_handler_class_name );
222
+		$data_handler_class_name = isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : '';
223
+		$data = isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array();
224
+		if ($data && $this->current()->STS_ID() === EEM_Message::status_incomplete) {
225
+			$this->current()->set_generation_data($data);
226
+			$this->current()->set_field_or_extra_meta('data_handler_class_name', $data_handler_class_name);
227 227
 		}
228 228
 	}
229 229
 
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 	 * @param array $status the optional status(es) that will also be filtered by when priority matches.
237 237
 	 * @return int  count of messages in the queue matching the conditions.
238 238
 	 */
239
-	public function count_by_priority_and_status( $priority, $status = array() ) {
240
-		if ( ! empty( $status ) ) {
241
-			$status = is_array( $status ) ? $status : array( $status );
239
+	public function count_by_priority_and_status($priority, $status = array()) {
240
+		if ( ! empty($status)) {
241
+			$status = is_array($status) ? $status : array($status);
242 242
 		}
243 243
 
244 244
 		$count = 0;
245 245
 		$this->rewind();
246
-		while ( $this->valid() ) {
247
-			if ( $this->current()->priority() === $priority && ( ( $status && in_array( $this->current()->STS_ID(), $status ) ) || ! $status ) ) {
246
+		while ($this->valid()) {
247
+			if ($this->current()->priority() === $priority && (($status && in_array($this->current()->STS_ID(), $status)) || ! $status)) {
248 248
 				$count++;
249 249
 			}
250 250
 			$this->next();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('No direct script access allowed');
4
+}
4 5
 
5 6
 
6 7
 /**
Please login to merge, or discard this patch.
core/db_models/EEM_Payment_Method.model.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  *
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
 	 * @access   protected
38 38
 	 * @return EEM_Payment_Method
39 39
 	 */
40
-	protected function __construct( $timezone = NULL ) {
41
-		$this->singlular_item = __( 'Payment Method', 'event_espresso' );
42
-		$this->plural_item = __( 'Payment Methods', 'event_espresso' );
43
-		$this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) );
40
+	protected function __construct($timezone = NULL) {
41
+		$this->singlular_item = __('Payment Method', 'event_espresso');
42
+		$this->plural_item = __('Payment Methods', 'event_espresso');
43
+		$this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'));
44 44
 		$this->_fields = array(
45 45
 			'Payment_Method' => array(
46
-				'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ),
47
-				'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ),
48
-				'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ),
49
-				'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ),
50
-				'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ),
51
-				'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ),
52
-				'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ),
53
-				'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ),
54
-				'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ),
55
-				'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ),
56
-				'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ),
57
-				'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API'
46
+				'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')),
47
+				'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'),
48
+				'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE),
49
+				'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''),
50
+				'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE),
51
+				'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE),
52
+				'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE),
53
+				'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0),
54
+				'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE),
55
+				'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE),
56
+				'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''),
57
+				'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API'
58 58
 		) );
59 59
 		$this->_model_relations = array(
60 60
  //			'Event'=>new EE_HABTM_Relation('Event_Payment_Method'),
61 61
 			'Payment' => new EE_Has_Many_Relation(),
62
-			'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ),
62
+			'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'),
63 63
 			'Transaction' => new EE_Has_Many_Relation(),
64 64
 			'WP_User' => new EE_Belongs_To_Relation(),
65 65
 		);
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param string $slug
74 74
 	 * @return EE_Payment_Method
75 75
 	 */
76
-	public function get_one_by_slug( $slug ) {
77
-		return $this->get_one( array( array( 'PMD_slug' => $slug ) ) );
76
+	public function get_one_by_slug($slug) {
77
+		return $this->get_one(array(array('PMD_slug' => $slug)));
78 78
 	}
79 79
 
80 80
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		return apply_filters(
89 89
 			'FHEE__EEM_Payment_Method__scopes',
90 90
 			array(
91
-				self::scope_cart 		=> __( "Front-end Registration Page", 'event_espresso' ),
92
-				self::scope_admin 	=> __( "Admin Registration Page (no online processing)", 'event_espresso' )
91
+				self::scope_cart 		=> __("Front-end Registration Page", 'event_espresso'),
92
+				self::scope_admin 	=> __("Admin Registration Page (no online processing)", 'event_espresso')
93 93
 			)
94 94
 		);
95 95
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string $scope like one of EEM_Payment_Method::instance()->scopes()
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function is_valid_scope( $scope ) {
104
+	public function is_valid_scope($scope) {
105 105
 		$scopes = $this->scopes();
106
-		if ( isset( $scopes[ $scope ] ) ) {
106
+		if (isset($scopes[$scope])) {
107 107
 			return TRUE;
108 108
 		} else {
109 109
 			return FALSE;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @throws EE_Error
120 120
 	 * @return EE_Payment_Method[]
121 121
 	 */
122
-	public function get_all_active( $scope = NULL, $query_params = array() ) {
123
-		if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) {
124
-			$query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) );
122
+	public function get_all_active($scope = NULL, $query_params = array()) {
123
+		if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) {
124
+			$query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC'));
125 125
 		}
126
-		return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) );
126
+		return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params));
127 127
 	}
128 128
 
129 129
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param array $query_params
133 133
 	 * @return int
134 134
 	 */
135
-	public function count_active( $scope = NULL, $query_params = array() ){
136
-		return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) );
135
+	public function count_active($scope = NULL, $query_params = array()) {
136
+		return $this->count($this->_get_query_params_for_all_active($scope, $query_params));
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
 	 * @return array like param of EEM_Base::get_all()
145 145
 	 * @throws EE_Error
146 146
 	 */
147
-	protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){
148
-		if ( $scope ) {
149
-			if ( $this->is_valid_scope( $scope ) ) {
150
-				return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params );
147
+	protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) {
148
+		if ($scope) {
149
+			if ($this->is_valid_scope($scope)) {
150
+				return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params);
151 151
 			} else {
152
-				throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) );
152
+				throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope));
153 153
 			}
154 154
 		} else {
155 155
 			$acceptable_scopes = array();
156 156
 			$count = 0;
157
-			foreach ( $this->scopes() as $scope_name => $desc ) {
157
+			foreach ($this->scopes() as $scope_name => $desc) {
158 158
 				$count++;
159
-				$acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' );
159
+				$acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%');
160 160
 			}
161
-			return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params );
161
+			return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params);
162 162
 		}
163 163
 	}
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @return array like param of EEM_Base::get_all()
171 171
 	 * @throws EE_Error
172 172
 	 */
173
-	public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) {
174
-		return $this->_get_query_params_for_all_active( $scope, $query_params );
173
+	public function get_query_params_for_all_active($scope = NULL, $query_params = array()) {
174
+		return $this->_get_query_params_for_all_active($scope, $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param array  $query_params
182 182
 	 * @return EE_Payment_Method
183 183
 	 */
184
-	public function get_one_active( $scope = NULL, $query_params = array() ) {
185
-		return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) );
184
+	public function get_one_active($scope = NULL, $query_params = array()) {
185
+		return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params));
186 186
 	}
187 187
 
188 188
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $type
193 193
 	 * @return EE_Payment_Method
194 194
 	 */
195
-	public function get_one_of_type( $type ) {
196
-		return $this->get_one( array( array( 'PMD_type' => $type ) ) );
195
+	public function get_one_of_type($type) {
196
+		return $this->get_one(array(array('PMD_type' => $type)));
197 197
 	}
198 198
 
199 199
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 	 * @return EE_Payment_Method
207 207
 	 * @throws EE_Error
208 208
 	 */
209
-	public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) {
209
+	public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) {
210 210
 		//first: check if it's a slug
211
-		if( is_string( $base_class_obj_or_id ) ) {
212
-			$obj = $this->get_one_by_slug( $base_class_obj_or_id );
213
-			if( $obj ) {
211
+		if (is_string($base_class_obj_or_id)) {
212
+			$obj = $this->get_one_by_slug($base_class_obj_or_id);
213
+			if ($obj) {
214 214
 				return $obj;
215 215
 			}
216 216
 		}
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219
-			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
219
+			return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db);
220 220
 		}
221
-		catch ( EE_Error $e ) {
221
+		catch (EE_Error $e) {
222 222
 			//handle it outside the catch
223 223
 		}
224
-		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
224
+		throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id));
225 225
 	}
226 226
 
227 227
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 	 * @param mixed $base_obj_or_id_or_slug
233 233
 	 * @return int
234 234
 	 */
235
-	function ensure_is_ID( $base_obj_or_id_or_slug ) {
236
-		if ( is_string( $base_obj_or_id_or_slug ) ) {
235
+	function ensure_is_ID($base_obj_or_id_or_slug) {
236
+		if (is_string($base_obj_or_id_or_slug)) {
237 237
 			//assume it's a slug
238
-			$base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug );
238
+			$base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug);
239 239
 		}
240
-		return parent::ensure_is_ID( $base_obj_or_id_or_slug );
240
+		return parent::ensure_is_ID($base_obj_or_id_or_slug);
241 241
 	}
242 242
 
243 243
 
@@ -246,36 +246,36 @@  discard block
 block discarded – undo
246 246
 	 * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default.
247 247
 	 * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart
248 248
 	 */
249
-	function verify_button_urls( $payment_methods = NULL ) {
250
-		$payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
251
-		foreach ( $payment_methods as $payment_method ) {
249
+	function verify_button_urls($payment_methods = NULL) {
250
+		$payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
251
+		foreach ($payment_methods as $payment_method) {
252 252
 			try {
253 253
 				$current_button_url = $payment_method->button_url();
254
-				$buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
255
-					'current_ssl' => str_replace( "http://", "https://", $current_button_url ),
256
-					'current' => str_replace( "https://", "http://", $current_button_url ),
257
-					'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ),
258
-					'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ),
259
-				) );
260
-				foreach( $buttons_urls_to_try as $button_url_to_try ) {
261
-					if(
254
+				$buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
255
+					'current_ssl' => str_replace("http://", "https://", $current_button_url),
256
+					'current' => str_replace("https://", "http://", $current_button_url),
257
+					'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()),
258
+					'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()),
259
+				));
260
+				foreach ($buttons_urls_to_try as $button_url_to_try) {
261
+					if (
262 262
 							(//this is the current url and it exists, regardless of SSL issues
263 263
 								$button_url_to_try == $current_button_url &&
264 264
 								EEH_URL::remote_file_exists(
265 265
 										$button_url_to_try,
266 266
 										array(
267 267
 											'sslverify' => false,
268
-											'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
268
+											'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
269 269
 											) )
270 270
 							)
271 271
 							||
272 272
 							(//this is NOT the current url and it exists with a working SSL cert
273 273
 								$button_url_to_try != $current_button_url &&
274
-								EEH_URL::remote_file_exists( $button_url_to_try )
274
+								EEH_URL::remote_file_exists($button_url_to_try)
275 275
 							) ) {
276
-						if( $current_button_url != $button_url_to_try ){
277
-							$payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) );
278
-							EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) );
276
+						if ($current_button_url != $button_url_to_try) {
277
+							$payment_method->save(array('PMD_button_url' => $button_url_to_try));
278
+							EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try));
279 279
 						}
280 280
 						//this image exists. So if wasn't set before, now it is;
281 281
 						//or if it was already set, we have nothing to do
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 					}
284 284
 				}
285 285
 			}
286
-			catch ( EE_Error $e ) {
287
-				$payment_method->set_active( FALSE );
286
+			catch (EE_Error $e) {
287
+				$payment_method->set_active(FALSE);
288 288
 			}
289 289
 		}
290 290
 	}
@@ -298,29 +298,29 @@  discard block
 block discarded – undo
298 298
 	 * @param array $rows
299 299
 	 * @return EE_Payment_Method[]
300 300
 	 */
301
-	protected function _create_objects( $rows = array() ) {
302
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
303
-		$payment_methods = parent::_create_objects( $rows );
301
+	protected function _create_objects($rows = array()) {
302
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
303
+		$payment_methods = parent::_create_objects($rows);
304 304
 		/* @var $payment_methods EE_Payment_Method[] */
305 305
 		$usable_payment_methods = array();
306
-		foreach ( $payment_methods as $key => $payment_method ) {
307
-			if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $payment_method->type() ) ) {
308
-				$usable_payment_methods[ $key ] = $payment_method;
306
+		foreach ($payment_methods as $key => $payment_method) {
307
+			if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($payment_method->type())) {
308
+				$usable_payment_methods[$key] = $payment_method;
309 309
 				//some payment methods enqueue their scripts in EE_PMT_*::__construct
310 310
 				//which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue
311 311
 				//its scripts). but for backwards-compat we should continue to do that
312 312
 				$payment_method->type_obj();
313
-			} elseif( $payment_method->active() ) {				
313
+			} elseif ($payment_method->active()) {				
314 314
 				//only deactivate and notify the admin if the payment is active somewhere
315 315
 				$payment_method->deactivate();
316 316
 				$payment_method->save();
317 317
 				EE_Error::add_persistent_admin_notice(
318
-					'auto-deactivated-' . $payment_method->type(),
318
+					'auto-deactivated-'.$payment_method->type(),
319 319
 					sprintf(
320
-						__( 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso' ),
320
+						__('The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso'),
321 321
 						$payment_method->admin_name(),
322 322
 						'<br />',
323
-						'<a href="' . admin_url('plugins.php') . '">',
323
+						'<a href="'.admin_url('plugins.php').'">',
324 324
 						'</a>'
325 325
 					),
326 326
 					true
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 	 * @param string 	$scope @see EEM_Payment_Method::get_all_for_events
341 341
 	 * @return EE_Payment_Method[]
342 342
 	 */
343
-	public function get_all_for_transaction( $transaction, $scope ) {
343
+	public function get_all_for_transaction($transaction, $scope) {
344 344
 		//@todo take relations between events and payment methods into account, once that relation exists
345
-		if ( $transaction instanceof EE_Transaction ) {
345
+		if ($transaction instanceof EE_Transaction) {
346 346
 			//@todo take the relation between transaction and currencies into account
347 347
 		}
348
-		$currencies_for_events = array( EE_Config::instance()->currency->code );
348
+		$currencies_for_events = array(EE_Config::instance()->currency->code);
349 349
 		//give addons a chance to override what payment methods are chosen based on the transaction
350 350
 		return apply_filters(
351 351
 			'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods',
352
-			$this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ),
352
+			$this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))),
353 353
 			$transaction,
354 354
 			$scope
355 355
 		);
@@ -365,16 +365,16 @@  discard block
 block discarded – undo
365 365
 	 * @param EE_Registration|int $registration_or_reg_id  Either the EE_Registration object or the id for the registration.
366 366
 	 * @return EE_Payment|null
367 367
 	 */
368
-	public function get_last_used_for_registration( $registration_or_reg_id ) {
369
-		$registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id );
368
+	public function get_last_used_for_registration($registration_or_reg_id) {
369
+		$registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id);
370 370
 
371 371
 		$query_params = array(
372 372
 			0 => array(
373 373
 				'Payment.Registration.REG_ID' => $registration_id,
374 374
 			),
375
-			'order_by' => array( 'Payment.PAY_ID' => 'DESC' )
375
+			'order_by' => array('Payment.PAY_ID' => 'DESC')
376 376
 		);
377
-		return $this->get_one( $query_params );
377
+		return $this->get_one($query_params);
378 378
 	}
379 379
 
380 380
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Transaction_Shortcodes.lib.php 1 patch
Spacing   +139 added lines, -139 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
 /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 		$this->_shortcodes = array(
43 43
 			'[TXN_ID]' => __('The transaction id for the purchase.', 'event_espresso'),
44 44
 			'[PAYMENT_URL]' => __('This is a link to make a payment for the event', 'event_espresso'),
45
-			'[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>'
46
-				. '<li>' . sprintf( __('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
47
-				. '<li>' . sprintf( __('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
48
-				. '<li>' . sprintf( __('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
45
+			'[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>'
46
+				. '<li>'.sprintf(__('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>'
47
+				. '<li>'.sprintf(__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>'
48
+				. '<li>'.sprintf(__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>'
49 49
 				. '</ul>',
50
-			'[PAYMENT_DUE_DATE_*]' => __( 'This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso' )
50
+			'[PAYMENT_DUE_DATE_*]' => __('This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso')
51 51
 				. '<ul>'
52
-				. '<li>' . sprintf( __( '%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
53
-				. '<li>' . sprintf( __( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
54
-				. '<li>' . sprintf( __( '%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>',
52
+				. '<li>'.sprintf(__('%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>'
53
+				. '<li>'.sprintf(__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>'
54
+				. '<li>'.sprintf(__('%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>',
55 55
 			'[INVOICE_LINK]' => __('This is a full html link to the invoice', 'event_espresso'),
56 56
 			'[INVOICE_URL]' => __('This is just the url for the invoice', 'event_espresso'),
57 57
 			'[INVOICE_LOGO_URL]' => __('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'),
58 58
 			'[INVOICE_LOGO]' => __('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'),
59 59
 			'[INVOICE_PAYEE_NAME]' => __('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
60
-			'[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
61
-			'[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ),
62
-			'[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
63
-			'[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ),
60
+			'[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
61
+			'[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'),
62
+			'[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
63
+			'[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'),
64 64
 			'[TOTAL_COST]' => __('The total cost for the transaction', 'event_espresso'),
65 65
 			'[TXN_STATUS]' => __('The transaction status for the transaction.', 'event_espresso'),
66 66
 			'[TXN_STATUS_ID]' => __('The ID representing the transaction status as saved in the db.  This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'),
@@ -71,52 +71,52 @@  discard block
 block discarded – undo
71 71
 			'[TOTAL_OWING]' => __('The total owing on a transaction with no attributes.', 'event_espresso'),
72 72
 			'[TXN_SUBTOTAL]' => __('The subtotal for all txn line items.', 'event_espresso'),
73 73
 			'[TXN_TAX_SUBTOTAL]' => __('The subtotal for all tax line items.', 'event_espresso'),
74
-			'[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' .
75
-				'<li><strong>still_owing</strong>:' . __('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( __( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' .
76
-				'<li><strong>none_owing</strong>:' . __('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>',
74
+			'[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'.
75
+				'<li><strong>still_owing</strong>:'.__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'.
76
+				'<li><strong>none_owing</strong>:'.__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>',
77 77
 			'[TXN_TOTAL_TICKETS]' => __('The total number of all tickets purchased in a transaction', 'event_espresso'),
78 78
 			'[TKT_QTY_PURCHASED]' => __('The total number of all tickets purchased in a transaction. <strong>NOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.</strong>', 'event_espresso'),
79 79
 			'[TRANSACTION_ADMIN_URL]' => __('The url to the admin page for this transaction', 'event_espresso'),
80 80
 			'[RECEIPT_URL]' => __('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'),
81
-			'[INVOICE_RECEIPT_SWITCHER_URL]' => __( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
-			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( __( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' )
81
+			'[INVOICE_RECEIPT_SWITCHER_URL]' => __('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
+			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>')
83 83
 			);
84 84
 	}
85 85
 
86 86
 
87
-	protected function _parser( $shortcode ) {
87
+	protected function _parser($shortcode) {
88 88
 
89 89
 		//attempt to get the transaction.  Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction.
90 90
 		$transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null;
91
-		$transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction;
91
+		$transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction;
92 92
 
93 93
 		//payment
94 94
 		$payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null;
95
-		$payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment;
95
+		$payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment;
96 96
 
97 97
 
98
-		if ( ! $transaction instanceof EE_Transaction )
98
+		if ( ! $transaction instanceof EE_Transaction)
99 99
 			return '';
100 100
 
101
-		switch ( $shortcode ) {
101
+		switch ($shortcode) {
102 102
 			case '[TXN_ID]' :
103 103
 				return $transaction->ID();
104 104
 				break;
105 105
 
106 106
 			case '[PAYMENT_URL]' :
107 107
 				$payment_url = $transaction->payment_overview_url();
108
-				return empty( $payment_url ) ? __( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
108
+				return empty($payment_url) ? __('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
109 109
 				break;
110 110
 
111 111
 			case '[INVOICE_LINK]' :
112 112
 				$invoice_url = $transaction->invoice_url();
113
-				$invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
-				return sprintf( __('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' );
113
+				$invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
+				return sprintf(__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>');
115 115
 				break; /**/
116 116
 
117 117
 			case '[INVOICE_URL]' :
118 118
 				$invoice_url = $transaction->invoice_url();
119
-				return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
119
+				return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
120 120
 				break;
121 121
 
122 122
 			case '[INVOICE_LOGO_URL]' :
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				break;
125 125
 
126 126
 			case '[INVOICE_LOGO]' :
127
-				return $this->_get_invoice_logo( TRUE );
127
+				return $this->_get_invoice_logo(TRUE);
128 128
 				break;
129 129
 
130 130
 			case '[INVOICE_PAYEE_NAME]' :
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 
147 147
 			case "[TOTAL_COST]" :
148 148
 				$total = $transaction->total();
149
-				return ! empty($total) ? EEH_Template::format_currency( $total ) : '';
149
+				return ! empty($total) ? EEH_Template::format_currency($total) : '';
150 150
 				break;
151 151
 
152 152
 			case "[PAYMENT_STATUS]" :
153 153
 				$status = $transaction->pretty_status();
154
-				return !empty($status) ? $status : __('Unknown', 'event_espresso');
154
+				return ! empty($status) ? $status : __('Unknown', 'event_espresso');
155 155
 				break; /**/
156 156
 
157 157
 			// note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity.
158 158
 			case "[TXN_STATUS]" :
159 159
 				$status = $transaction->pretty_status();
160
-				return !empty( $status ) ? $status : __('Unknown', 'event_espresso');
160
+				return ! empty($status) ? $status : __('Unknown', 'event_espresso');
161 161
 				break;
162 162
 
163 163
 			case "[TXN_STATUS_ID]" :
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 				break;
166 166
 
167 167
 			case "[PAYMENT_GATEWAY]" :
168
-				return $this->_get_payment_gateway( $transaction );
168
+				return $this->_get_payment_gateway($transaction);
169 169
 				break;
170 170
 
171 171
 			case "[AMOUNT_PAID]" :
172 172
 				$amount = $payment instanceof EE_Payment ? $payment->amount() : 0;
173
-				return EEH_Template::format_currency( $amount );
173
+				return EEH_Template::format_currency($amount);
174 174
 				break;
175 175
 
176 176
 			case "[TOTAL_AMOUNT_PAID]" :
177
-				return EEH_Template::format_currency( $transaction->paid() );
177
+				return EEH_Template::format_currency($transaction->paid());
178 178
 				break;
179 179
 
180 180
 			case "[TOTAL_OWING]" :
181 181
 				$total_owing = $transaction->remaining();
182
-				return EEH_Template::format_currency( $total_owing );
182
+				return EEH_Template::format_currency($total_owing);
183 183
 				break;
184 184
 
185 185
 			case "[TXN_SUBTOTAL]" :
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				break;
188 188
 
189 189
 			case "[TXN_TAX_SUBTOTAL]" :
190
-				return EEH_Template::format_currency($this->_get_subtotal( TRUE ));
190
+				return EEH_Template::format_currency($this->_get_subtotal(TRUE));
191 191
 				break;
192 192
 
193 193
 			case "[TKT_QTY_PURCHASED]" :
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 				break;
197 197
 
198 198
 			case "[TRANSACTION_ADMIN_URL]" :
199
-				require_once EE_CORE . 'admin/EE_Admin_Page.core.php';
200
-				$query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() );
201
-				$url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') );
199
+				require_once EE_CORE.'admin/EE_Admin_Page.core.php';
200
+				$query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID());
201
+				$url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php'));
202 202
 				return $url;
203 203
 				break;
204 204
 
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 				//get primary_registration
207 207
 				$reg = $this->_data->primary_reg_obj;
208 208
 
209
-				if ( ! $reg instanceof EE_Registration ) {
209
+				if ( ! $reg instanceof EE_Registration) {
210 210
 					return '';
211 211
 				}
212 212
 				return $reg->receipt_url();
213 213
 				break;
214 214
 
215 215
 			case "[INVOICE_RECEIPT_SWITCHER_URL]" :
216
-				return $this->_get_invoice_receipt_switcher( FALSE );
216
+				return $this->_get_invoice_receipt_switcher(FALSE);
217 217
 				break;
218 218
 
219 219
 			case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" :
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 
224 224
 		}
225 225
 
226
-		if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) {
227
-			return $this->_get_custom_total_oweing( $shortcode );
226
+		if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) {
227
+			return $this->_get_custom_total_oweing($shortcode);
228 228
 		}
229 229
 
230
-		if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) {
231
-			return $this->_get_invoice_payee_tax_number( $shortcode );
230
+		if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) {
231
+			return $this->_get_invoice_payee_tax_number($shortcode);
232 232
 		}
233 233
 
234
-		if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) {
235
-			return $this->_get_payment_link_if_needed( $shortcode );
234
+		if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) {
235
+			return $this->_get_payment_link_if_needed($shortcode);
236 236
 		}
237 237
 
238
-		if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) {
239
-			return $this->_get_payment_due_date( $shortcode, $transaction );
238
+		if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) {
239
+			return $this->_get_payment_due_date($shortcode, $transaction);
240 240
 		}
241 241
 
242 242
 		return '';
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return string parsed.
255 255
 	 */
256
-	private function _get_custom_total_oweing( $shortcode ) {
257
-		$valid_shortcodes = array( 'transaction' );
258
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
256
+	private function _get_custom_total_oweing($shortcode) {
257
+		$valid_shortcodes = array('transaction');
258
+		$attrs = $this->_get_shortcode_attrs($shortcode);
259 259
 
260 260
 		//ensure default is set.
261 261
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
262 262
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
263 263
 
264
-		if ( $total_owing > 0 ) {
265
-			$owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( __( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' );
266
-			$owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
264
+		if ($total_owing > 0) {
265
+			$owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>');
266
+			$owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
267 267
 		} else {
268
-			$owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : '';
268
+			$owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : '';
269 269
 		}
270 270
 
271 271
 		return $owing_content;
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 
274 274
 
275 275
 
276
-	private function _get_payment_gateway( $transaction ) {
277
-		$pm = $this->_get_payment_method( $transaction );
276
+	private function _get_payment_gateway($transaction) {
277
+		$pm = $this->_get_payment_method($transaction);
278 278
 		return $pm instanceof EE_Payment_Method ? $pm->name() : '';
279 279
 	}
280 280
 
@@ -289,37 +289,37 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string url or html
291 291
 	 */
292
-	private function _get_invoice_logo( $img_tags = FALSE ) {
292
+	private function _get_invoice_logo($img_tags = FALSE) {
293 293
 		//try to get the invoice payment method's logo for this transaction image first
294 294
 		$pm = $this->_get_payment_method();
295
-		if ( $pm instanceof EE_Payment_Method ){
296
-			$invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE );
297
-		}else{
295
+		if ($pm instanceof EE_Payment_Method) {
296
+			$invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE);
297
+		} else {
298 298
 			$invoice_logo_url = NULL;
299 299
 		}
300
-		if( empty( $invoice_logo_url ) ){
300
+		if (empty($invoice_logo_url)) {
301 301
 			$invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url;
302 302
 		}
303 303
 
304
-		if ( empty( $invoice_logo_url ) ) {
304
+		if (empty($invoice_logo_url)) {
305 305
 			return '';
306 306
 		}
307 307
 
308
-		if ( ! $img_tags ) {
308
+		if ( ! $img_tags) {
309 309
 			return $invoice_logo_url;
310 310
 		}
311 311
 
312 312
 		//image tags have been requested.
313
-		$image_size = getimagesize( $invoice_logo_url );
313
+		$image_size = getimagesize($invoice_logo_url);
314 314
 		
315 315
 		//if image is wider than 200px, set the wideth to 200
316
-		if ( $image_size[0] > 300 ) {
316
+		if ($image_size[0] > 300) {
317 317
 			$image_width = 300;
318
-		}else{
318
+		} else {
319 319
 			$image_width = $image_size[0];
320 320
 		}
321 321
 
322
-		return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />';
322
+		return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />';
323 323
 	}
324 324
 
325 325
 
@@ -336,26 +336,26 @@  discard block
 block discarded – undo
336 336
 	private function _get_invoice_payee_name() {
337 337
 		$payee_name = NULL;
338 338
 		$pm = $this->_get_payment_method();
339
-		if( $pm instanceof EE_Payment_Method ){
340
-			$payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE );
339
+		if ($pm instanceof EE_Payment_Method) {
340
+			$payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE);
341 341
 		}
342
-		$payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name;
342
+		$payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name;
343 343
 		return $payee_name;
344 344
 	}
345 345
 
346 346
 	/**
347 347
 	 * gets the payment method for this transaction. Otherwise gets a default one.
348 348
 	 */
349
-	private function _get_payment_method( $transaction = null ){
350
-		if( $transaction instanceof EE_Transaction ) {
349
+	private function _get_payment_method($transaction = null) {
350
+		if ($transaction instanceof EE_Transaction) {
351 351
 			$payment_method = $transaction->payment_method();
352
-			if ( empty( $payment_method ) ) {
353
-				return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
352
+			if (empty($payment_method)) {
353
+				return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
354 354
 			}
355 355
 			return $payment_method;
356
-		}else{
356
+		} else {
357 357
 			//get the first payment method we can find
358
-			return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
358
+			return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
359 359
 		}
360 360
 	}
361 361
 
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	private function _get_invoice_payee_email() {
373 373
 		$payee_email = NULL;
374 374
 		$pm = $this->_get_payment_method();
375
-		if( $pm instanceof EE_Payment_Method ){
376
-			$payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE );
375
+		if ($pm instanceof EE_Payment_Method) {
376
+			$payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE);
377 377
 		}
378
-		$payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email;
378
+		$payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email;
379 379
 		return $payee_email;
380 380
 	}
381 381
 
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @return string
393 393
 	 */
394
-	private function _get_invoice_payee_tax_number( $shortcode ) {
394
+	private function _get_invoice_payee_tax_number($shortcode) {
395 395
 		$payee_tax_number = NULL;
396 396
 		$pm = $this->_get_payment_method();
397
-		if( $pm instanceof EE_Payment_Method ){
398
-			$payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE );
397
+		if ($pm instanceof EE_Payment_Method) {
398
+			$payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE);
399 399
 		}
400
-		$payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
400
+		$payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
401 401
 
402
-		if ( empty( $payee_tax_number ) ) {
402
+		if (empty($payee_tax_number)) {
403 403
 			return '';
404 404
 		}
405 405
 
406 406
 		//any attributes?
407
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
407
+		$attrs = $this->_get_shortcode_attrs($shortcode);
408 408
 
409 409
 		//prefix?
410
-		$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : __( 'VAT/Tax Number: ', 'event_espresso' );
411
-		return $prefix . $payee_tax_number;
410
+		$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : __('VAT/Tax Number: ', 'event_espresso');
411
+		return $prefix.$payee_tax_number;
412 412
 	}
413 413
 
414 414
 
@@ -425,22 +425,22 @@  discard block
 block discarded – undo
425 425
 	private function _get_invoice_payee_address() {
426 426
 		$payee_address = NULL;
427 427
 		$pm = $this->_get_payment_method();
428
-		if( $pm instanceof EE_Payment_Method ){
429
-			$payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE );
428
+		if ($pm instanceof EE_Payment_Method) {
429
+			$payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE);
430 430
 		}
431
-		if ( empty( $payee_address ) ) {
431
+		if (empty($payee_address)) {
432 432
 			$organization = EE_Registry::instance()->CFG->organization;
433
-			$payee_address = $organization->get_pretty( 'address_1' ) . '<br>';
434
-			$payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : '';
435
-			$payee_address .= $organization->get_pretty( 'city' ) . '<br>';
433
+			$payee_address = $organization->get_pretty('address_1').'<br>';
434
+			$payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : '';
435
+			$payee_address .= $organization->get_pretty('city').'<br>';
436 436
 
437 437
 			//state
438
-			$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID );
439
-			$payee_address .= $state instanceof EE_State ? $state->name()  : '';
438
+			$state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID);
439
+			$payee_address .= $state instanceof EE_State ? $state->name() : '';
440 440
 
441 441
 			//Country
442
-			$payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : '';
443
-			$payee_address .= ! empty( $organization->zip ) ? $organization->zip : '';
442
+			$payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : '';
443
+			$payee_address .= ! empty($organization->zip) ? $organization->zip : '';
444 444
 		}
445 445
 		return $payee_address;
446 446
 	}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	private function _get_invoice_payment_instructions() {
459 459
 		$instructions = NULL;
460 460
 		$pm = $this->_get_payment_method();
461
-		return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : '';
461
+		return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : '';
462 462
 	}
463 463
 
464 464
 
@@ -472,27 +472,27 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @return string
474 474
 	 */
475
-	protected function _get_invoice_receipt_switcher( $button = TRUE ) {
475
+	protected function _get_invoice_receipt_switcher($button = TRUE) {
476 476
 		$reg = $this->_data->primary_reg_obj;
477
-		$message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : '';
478
-		if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) {
477
+		$message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : '';
478
+		if ( ! $reg instanceof EE_Registration || empty($message_type)) {
479 479
 			return '';
480 480
 		}
481 481
 
482
-		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type  ? true : false;
483
-		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso' ) : __( 'Switch to Invoice', 'event_espresso' );
484
-		$switch_to_label = ! $switch_to_invoice ? __( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label;
482
+		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false;
483
+		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso') : __('Switch to Invoice', 'event_espresso');
484
+		$switch_to_label = ! $switch_to_invoice ? __('Switch to Receipt', 'event_espresso') : $switch_to_label;
485 485
 		$switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url();
486 486
 
487
-		if ( ! $button ) {
487
+		if ( ! $button) {
488 488
 			return $switch_to_url;
489 489
 		}
490 490
 
491
-		if ( ! empty( $switch_to_url ) ) {
491
+		if ( ! empty($switch_to_url)) {
492 492
 
493 493
 			return  '
494
-	<form method="post" action="' . $switch_to_url . '" >
495
-		<input class="print_button" type="submit" value="' . $switch_to_label . '" />
494
+	<form method="post" action="' . $switch_to_url.'" >
495
+		<input class="print_button" type="submit" value="' . $switch_to_label.'" />
496 496
 	</form>
497 497
 			';
498 498
 		}
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 	 *
513 513
 	 * @return string
514 514
 	 */
515
-	private function _get_receipt_url( EE_Transaction $transaction ) {
515
+	private function _get_receipt_url(EE_Transaction $transaction) {
516 516
 		//get primary_registration
517 517
 		$reg = $this->_data->primary_reg_obj;
518 518
 
519
-		if ( ! $reg instanceof EE_Registration ) {
519
+		if ( ! $reg instanceof EE_Registration) {
520 520
 			return '';
521 521
 		}
522 522
 
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return int
534 534
 	 */
535
-	private function _get_subtotal( $tax = FALSE ) {
536
-		$grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL;
535
+	private function _get_subtotal($tax = FALSE) {
536
+		$grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL;
537 537
 
538
-		if ( ! $grand_total instanceof EE_Line_Item ) {
538
+		if ( ! $grand_total instanceof EE_Line_Item) {
539 539
 			return 0;
540 540
 		}
541 541
 
@@ -554,26 +554,26 @@  discard block
 block discarded – undo
554 554
 	 *
555 555
 	 * @return string parsed.
556 556
 	 */
557
-	private function _get_payment_link_if_needed( $shortcode ) {
558
-		$valid_shortcodes = array( 'transaction' );
559
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
557
+	private function _get_payment_link_if_needed($shortcode) {
558
+		$valid_shortcodes = array('transaction');
559
+		$attrs = $this->_get_shortcode_attrs($shortcode);
560 560
 
561 561
 		//ensure default is set.
562 562
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
563 563
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
564 564
 
565
-		if ( $total_owing > 0 ) {
566
-			$class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout';
567
-			$custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
-			$container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p';
569
-			$opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : '';
570
-			$opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag;
571
-			$opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag;
572
-			$closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : '';
573
-			$content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag;
565
+		if ($total_owing > 0) {
566
+			$class = isset($attrs['class']) ? $attrs['class'] : 'callout';
567
+			$custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
+			$container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p';
569
+			$opening_tag = ! empty($container_tag) ? '<'.$container_tag : '';
570
+			$opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag;
571
+			$opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag;
572
+			$closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : '';
573
+			$content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag;
574 574
 
575 575
 			//we need to re run this string through the parser to catch any shortcodes that are in it.
576
-			$owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
576
+			$owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
577 577
 		} else {
578 578
 			return '';
579 579
 		}
@@ -593,31 +593,31 @@  discard block
 block discarded – undo
593 593
 	 * @param EE_Transaction $transaction
594 594
 	 * @return string
595 595
 	 */
596
-	protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) {
596
+	protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) {
597 597
 		//if transaction is paid in full then we can just return an empty string
598
-		if ( $transaction->remaining() === 0 ) {
598
+		if ($transaction->remaining() === 0) {
599 599
 			return '';
600 600
 		}
601 601
 
602
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
603
-		$format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' );
604
-		$days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30;
605
-		$prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : __( 'Payment in full due by: ', 'event_espresso' );
606
-		$transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' );
602
+		$attrs = $this->_get_shortcode_attrs($shortcode);
603
+		$format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format');
604
+		$days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30;
605
+		$prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : __('Payment in full due by: ', 'event_espresso');
606
+		$transaction_created = $transaction->get_DateTime_object('TXN_timestamp');
607 607
 
608 608
 		//setup date due:
609 609
 		try {
610
-			if ( $transaction_created instanceof DateTime ) {
611
-				$date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format );
610
+			if ($transaction_created instanceof DateTime) {
611
+				$date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format);
612 612
 			} else {
613 613
 				throw new Exception();
614 614
 			}
615
-		} catch( Exception $e ) {
615
+		} catch (Exception $e) {
616 616
 			//format was likely invalid.
617 617
 			$date_due = 'Unable to calculate date due, likely the format string is invalid.';
618 618
 		}
619 619
 
620
-		return $prefix_text . $date_due;
620
+		return $prefix_text.$date_due;
621 621
 	}
622 622
 
623 623
 } //end EE_Transaction Shortcodes library
Please login to merge, or discard this patch.
libraries/form_sections/strategies/EE_Form_Input_Strategy_Base.strategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
  * base class for all strategies which operate on form inputs. Generally, they
4 4
  * all need to know about the form input they are operating on.
5 5
  */
6
-abstract class EE_Form_Input_Strategy_Base{
6
+abstract class EE_Form_Input_Strategy_Base {
7 7
 	/**
8 8
 	 * Form Input to display
9 9
 	 * @var EE_Form_Input_Base
10 10
 	 */
11 11
 	protected $_input;
12 12
 	
13
-	function __construct(){
13
+	function __construct() {
14 14
 		
15 15
 	}
16 16
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * The form input on which this strategy is to perform
19 19
 	 * @param EE_Form_Input_Base $form_input
20 20
 	 */
21
-	function _construct_finalize(EE_Form_Input_Base $form_input){
21
+	function _construct_finalize(EE_Form_Input_Base $form_input) {
22 22
 		$this->_input = $form_input;
23 23
 	}
24 24
 	
Please login to merge, or discard this patch.