Completed
Branch old/BUG-7514-7935-7936-price-o... (518ae6)
by
unknown
25:14 queued 22:51
created
caffeinated/modules/recaptcha/EED_Recaptcha.module.php 2 patches
Spacing   +129 added lines, -130 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Recaptcha
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function set_hooks() {
58 58
 		// use_captcha ?
59
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
59
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
60 60
 			EED_Recaptcha::set_definitions();
61 61
 			EED_Recaptcha::enqueue_styles_and_scripts();
62
-			add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 );
63
-			add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 );
64
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
65
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
66
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
62
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
63
+			add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0);
64
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
65
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
66
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
67 67
 		}
68 68
 	}
69 69
 
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 	public static function set_hooks_admin() {
79 79
 		EED_Recaptcha::set_definitions();
80 80
 		// use_captcha ?
81
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
81
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
82 82
 			EED_Recaptcha::enqueue_styles_and_scripts();
83
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
84
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
85
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
83
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
84
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
85
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
86 86
 		}
87 87
 		// admin settings
88
-		add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 );
89
-		add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 );
88
+		add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1);
89
+		add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1);
90 90
 	}
91 91
 
92 92
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 *  @return 	void
99 99
 	 */
100 100
 	public static function set_definitions() {
101
-		if ( is_user_logged_in() ) {
101
+		if (is_user_logged_in()) {
102 102
 			EED_Recaptcha::$_not_a_robot = true;
103 103
 		}
104
-		define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
105
-		define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ ));
104
+		define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
105
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
106 106
 	}
107 107
 
108 108
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	public static function set_late_hooks() {
117 117
 		add_filter(
118 118
 			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
119
-			array( 'EED_Recaptcha', 'not_a_robot' )
119
+			array('EED_Recaptcha', 'not_a_robot')
120 120
 		);
121 121
 	}
122 122
 
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	 *  @return 	void
130 130
 	 */
131 131
 	public static function enqueue_styles_and_scripts() {
132
-		wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE );
133
-		wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE );
134
-		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' );
135
-		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' );
136
-		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' );
132
+		wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE);
133
+		wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE);
134
+		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso');
135
+		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso');
136
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso');
137 137
 	}
138 138
 
139 139
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @access    public
145 145
 	 * @param \WP $WP
146 146
 	 */
147
-	public function run( $WP ) {
147
+	public function run($WP) {
148 148
 	}
149 149
 
150 150
 
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
 	 *  @return boolean
155 155
 	 */
156 156
 	public static function not_a_robot() {
157
-		$not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot :
158
-			EED_Recaptcha::recaptcha_passed();
157
+		$not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed();
159 158
 		return $not_a_robot;
160 159
 	}
161 160
 
@@ -171,23 +170,23 @@  discard block
 block discarded – undo
171 170
 	 */
172 171
 	public static function display_recaptcha() {
173 172
 		// logged in means you have already passed a turing test of sorts
174
-		if ( is_user_logged_in() ) {
173
+		if (is_user_logged_in()) {
175 174
 			return;
176 175
 		}
177 176
 		// don't display if not using recaptcha or user is logged in
178
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
177
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
179 178
 			// only display if they have NOT passed the test yet
180
-			if ( ! EED_Recaptcha::$_not_a_robot ) {
181
-				EE_Registry::instance()->load_helper( 'Template' );
179
+			if ( ! EED_Recaptcha::$_not_a_robot) {
180
+				EE_Registry::instance()->load_helper('Template');
182 181
 				EEH_Template::display_template(
183
-					RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php',
182
+					RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php',
184 183
 					array(
185 184
 						'recaptcha_publickey' 	=> EE_Registry::instance()->CFG->registration->recaptcha_publickey,
186 185
 						'recaptcha_theme' 		=> EE_Registry::instance()->CFG->registration->recaptcha_theme,
187 186
 						'recaptcha_type' 			=> EE_Registry::instance()->CFG->registration->recaptcha_type
188 187
 					)
189 188
 				);
190
-				wp_enqueue_script( 'google_recaptcha' );
189
+				wp_enqueue_script('google_recaptcha');
191 190
 			}
192 191
 		}
193 192
 	}
@@ -205,17 +204,17 @@  discard block
 block discarded – undo
205 204
 	 */
206 205
 	public static function recaptcha_passed() {
207 206
 		// logged in means you have already passed a turing test of sorts
208
-		if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) {
207
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
209 208
 			return TRUE;
210 209
 		}
211 210
 		// was test already passed?
212
-		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' );
213
-		$recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN );
211
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
212
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
214 213
 		// verify recaptcha
215 214
 		EED_Recaptcha::_get_recaptcha_response();
216
-		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) {
215
+		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
217 216
 			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
218
-			EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed ));
217
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
219 218
 			EE_Registry::instance()->SSN->update();
220 219
 		}
221 220
 		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
@@ -231,8 +230,8 @@  discard block
 block discarded – undo
231 230
 	 * @param array $recaptcha_response
232 231
 	 * @return boolean
233 232
 	 */
234
-	public static function recaptcha_response( $recaptcha_response = array() ) {
235
-		if ( EED_Recaptcha::_bypass_recaptcha() ) {
233
+	public static function recaptcha_response($recaptcha_response = array()) {
234
+		if (EED_Recaptcha::_bypass_recaptcha()) {
236 235
 			$recaptcha_response['bypass_recaptcha'] = TRUE;
237 236
 			$recaptcha_response['recaptcha_passed'] = TRUE;
238 237
 		} else {
@@ -252,16 +251,16 @@  discard block
 block discarded – undo
252 251
 	 */
253 252
 	private static function _bypass_recaptcha() {
254 253
 		// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY
255
-		$bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() );
254
+		$bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array());
256 255
 		// does $bypass_request_params_array have any values ?
257
-		if ( empty( $bypass_request_params_array )) {
256
+		if (empty($bypass_request_params_array)) {
258 257
 			return FALSE;
259 258
 		}
260 259
 		// initially set bypass to TRUE
261 260
 		$bypass_recaptcha = TRUE;
262
-		foreach ( $bypass_request_params_array as $key => $value ) {
261
+		foreach ($bypass_request_params_array as $key => $value) {
263 262
 			// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass
264
-			$bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE;
263
+			$bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE;
265 264
 		}
266 265
 		return $bypass_recaptcha;
267 266
 	}
@@ -276,7 +275,7 @@  discard block
 block discarded – undo
276 275
 	 * 	@return 	boolean
277 276
 	 */
278 277
 	private static function _get_recaptcha_response() {
279
-		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
278
+		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false);
280 279
 	}
281 280
 
282 281
 
@@ -290,22 +289,22 @@  discard block
 block discarded – undo
290 289
 	 */
291 290
 	private static function _process_recaptcha_response() {
292 291
 		// verify library is loaded
293
-		if ( ! class_exists( 'ReCaptcha' )) {
294
-			require_once( RECAPTCHA_BASE_PATH . 'recaptchalib.php' );
292
+		if ( ! class_exists('ReCaptcha')) {
293
+			require_once(RECAPTCHA_BASE_PATH.'recaptchalib.php');
295 294
 		}
296 295
 		// The response from reCAPTCHA
297 296
 		EED_Recaptcha::_get_recaptcha_response();
298 297
 		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
299 298
 		// Was there a reCAPTCHA response?
300
-		if ( $recaptcha_response ) {
301
-			$reCaptcha = new ReCaptcha( EE_Registry::instance()->CFG->registration->recaptcha_privatekey );
299
+		if ($recaptcha_response) {
300
+			$reCaptcha = new ReCaptcha(EE_Registry::instance()->CFG->registration->recaptcha_privatekey);
302 301
 			$recaptcha_response = $reCaptcha->verifyResponse(
303 302
 				$_SERVER['REMOTE_ADDR'],
304 303
 				EED_Recaptcha::$_recaptcha_response
305 304
 			);
306 305
 		}
307 306
 		// sorry... it appears you can't read gibberish chicken scratches !!!
308
-		if ( $recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success ) {
307
+		if ($recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success) {
309 308
 			return TRUE;
310 309
 		}
311 310
 		return FALSE;
@@ -339,8 +338,8 @@  discard block
 block discarded – undo
339 338
 	 */
340 339
 	protected static function _recaptcha_settings_form() {
341 340
 
342
-		EE_Registry::instance()->load_helper( 'HTML' );
343
-		EE_Registry::instance()->load_helper( 'Template' );
341
+		EE_Registry::instance()->load_helper('HTML');
342
+		EE_Registry::instance()->load_helper('Template');
344 343
 
345 344
 		return new EE_Form_Section_Proper(
346 345
 			array(
@@ -350,12 +349,12 @@  discard block
 block discarded – undo
350 349
 				'subsections' 			=> apply_filters(
351 350
 					'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections',
352 351
 					array(
353
-						'main_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))),
352
+						'main_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))),
354 353
 						'main_settings' 						=> EED_Recaptcha::_recaptcha_main_settings(),
355
-						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Appearance', 'event_espresso' ) )),
354
+						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Appearance', 'event_espresso'))),
356 355
 						'appearance_settings' 			=> EED_Recaptcha::_recaptcha_appearance_settings(),
357 356
 						// 'recaptcha_example' 				=> new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ),
358
-						'required_fields_note' 			=> new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ))
357
+						'required_fields_note' 			=> new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))
359 358
 					)
360 359
 				)
361 360
 			)
@@ -382,28 +381,28 @@  discard block
 block discarded – undo
382 381
 					array(
383 382
 						'use_captcha' 				=> new EE_Yes_No_Input(
384 383
 							array(
385
-								'html_label_text'	 	=> __( 'Use reCAPTCHA', 'event_espresso' ),
384
+								'html_label_text'	 	=> __('Use reCAPTCHA', 'event_espresso'),
386 385
 								'html_help_text' 		=> sprintf(
387
-									__( 'reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ),
386
+									__('reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'),
388 387
 									'<a href="https://www.google.com/recaptcha/intro/index.html">',
389 388
 									'</a>'
390 389
 								),
391
-								'default' 								=> isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
390
+								'default' 								=> isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
392 391
 								'display_html_label_text' 	=> FALSE
393 392
 							)
394 393
 						),
395 394
 						'recaptcha_publickey' 		=> new EE_Text_Input(
396 395
 							array(
397
-								'html_label_text'	 	=> __( 'Site Key', 'event_espresso' ),
398
-								'html_help_text' 		=> __( 'The site key is used to display the widget on your site.', 'event_espresso' ),
399
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''
396
+								'html_label_text'	 	=> __('Site Key', 'event_espresso'),
397
+								'html_help_text' 		=> __('The site key is used to display the widget on your site.', 'event_espresso'),
398
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''
400 399
 							)
401 400
 						),
402 401
 						'recaptcha_privatekey' 		=> new EE_Text_Input(
403 402
 							array(
404
-								'html_label_text'	 	=> __( 'Secret Key', 'event_espresso' ),
405
-								'html_help_text' 		=> __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ),
406
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''
403
+								'html_label_text'	 	=> __('Secret Key', 'event_espresso'),
404
+								'html_help_text' 		=> __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'),
405
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''
407 406
 							)
408 407
 						)
409 408
 					)
@@ -435,81 +434,81 @@  discard block
 block discarded – undo
435 434
 					array(
436 435
 						'recaptcha_theme' 		=> new EE_Radio_Button_Input(
437 436
 							array(
438
-								'light' => __( 'Light', 'event_espresso' ),
439
-								'dark' => __( 'Dark', 'event_espresso' )
437
+								'light' => __('Light', 'event_espresso'),
438
+								'dark' => __('Dark', 'event_espresso')
440 439
 							),
441 440
 							array(
442
-								'html_label_text'	 	=> __( 'Theme', 'event_espresso' ),
443
-								'html_help_text' 		=> __( 'The color theme of the widget.', 'event_espresso' ),
444
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
441
+								'html_label_text'	 	=> __('Theme', 'event_espresso'),
442
+								'html_help_text' 		=> __('The color theme of the widget.', 'event_espresso'),
443
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
445 444
 								'display_html_label_text' => FALSE
446 445
 							)
447 446
 						),
448 447
 						'recaptcha_type' 		=> new EE_Radio_Button_Input(
449 448
 							array(
450
-								'image' => __( 'Image', 'event_espresso' ),
451
-								'audio' => __( 'Audio', 'event_espresso' )
449
+								'image' => __('Image', 'event_espresso'),
450
+								'audio' => __('Audio', 'event_espresso')
452 451
 							),
453 452
 							array(
454
-								'html_label_text'	 	=> __( 'Type', 'event_espresso' ),
455
-								'html_help_text' 		=> __( 'The type of CAPTCHA to serve.', 'event_espresso' ),
456
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
453
+								'html_label_text'	 	=> __('Type', 'event_espresso'),
454
+								'html_help_text' 		=> __('The type of CAPTCHA to serve.', 'event_espresso'),
455
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
457 456
 								'display_html_label_text' =>FALSE
458 457
 							)
459 458
 						),
460 459
 						'recaptcha_language' 		=> new EE_Select_Input(
461 460
 							array(
462
-								 'ar' 			=> __( 'Arabic', 'event_espresso' ),
463
-								 'bg' 		=> __( 'Bulgarian', 'event_espresso' ),
464
-								 'ca' 			=> __( 'Catalan', 'event_espresso' ),
465
-								 'zh-CN' 	=>  __( 'Chinese (Simplified)', 'event_espresso' ),
466
-								 'zh-TW' 	=>  __( 'Chinese (Traditional)	', 'event_espresso' ),
467
-								 'hr' 			=> __( 'Croatian', 'event_espresso' ),
468
-								 'cs' 			=> __( 'Czech', 'event_espresso' ),
469
-								 'da' 			=> __( 'Danish', 'event_espresso' ),
470
-								 'nl' 			=> __( 'Dutch', 'event_espresso' ),
471
-								 'en-GB' 	=>  __( 'English (UK)', 'event_espresso' ),
472
-								 'en' 			=> __( 'English (US)', 'event_espresso' ),
473
-								 'fil' 			=> __( 'Filipino', 'event_espresso' ),
474
-								 'fi' 			=> __( 'Finnish', 'event_espresso' ),
475
-								 'fr' 			=> __( 'French', 'event_espresso' ),
476
-								 'fr-CA' 	=>  __( 'French (Canadian)', 'event_espresso' ),
477
-								 'de' 			=> __( 'German', 'event_espresso' ),
478
-								 'de-AT' 	=>  __( 'German (Austria)', 'event_espresso' ),
479
-								 'de-CH' 	=>  __( 'German (Switzerland)', 'event_espresso' ),
480
-								 'el' 			=> __( 'Greek', 'event_espresso' ),
481
-								 'iw' 			=> __( 'Hebrew', 'event_espresso' ),
482
-								 'hi' 			=> __( 'Hindi', 'event_espresso' ),
483
-								 'hu' 		=> __( 'Hungarian', 'event_espresso' ),
484
-								 'id' 			=> __( 'Indonesian', 'event_espresso' ),
485
-								 'it' 			=> __( 'Italian', 'event_espresso' ),
486
-								 'ja' 			=> __( 'Japanese', 'event_espresso' ),
487
-								 'ko' 			=> __( 'Korean', 'event_espresso' ),
488
-								 'lv' 			=> __( 'Latvian', 'event_espresso' ),
489
-								 'lt' 			=> __( 'Lithuanian', 'event_espresso' ),
490
-								 'no' 		=> __( 'Norwegian', 'event_espresso' ),
491
-								 'fa' 			=> __( 'Persian', 'event_espresso' ),
492
-								 'pl' 			=> __( 'Polish', 'event_espresso' ),
493
-								 'pt' 			=> __( 'Portuguese', 'event_espresso' ),
494
-								 'pt-BR' 	=>  __( 'Portuguese (Brazil)', 'event_espresso' ),
495
-								 'pt-PT' 	=>  __( 'Portuguese (Portugal)', 'event_espresso' ),
496
-								 'ro' 			=> __( 'Romanian', 'event_espresso' ),
497
-								 'ru' 			=> __( 'Russian', 'event_espresso' ),
498
-								 'sr' 			=> __( 'Serbian', 'event_espresso' ),
499
-								 'sk' 			=> __( 'Slovak', 'event_espresso' ),
500
-								 'sl' 			=> __( 'Slovenian', 'event_espresso' ),
501
-								 'es' 			=> __( 'Spanish', 'event_espresso' ),
502
-								 'es-419' 	=>  __( 'Spanish (Latin America)', 'event_espresso' ),
503
-								 'sv' 			=> __( 'Swedish', 'event_espresso' ),
504
-								 'th' 			=> __( 'Thai', 'event_espresso' ),
505
-								 'tr' 			=> __( 'Turkish', 'event_espresso' ),
506
-								 'uk' 			=> __( 'Ukrainian', 'event_espresso' ),
507
-								 'vi' 			=> __( 'Vietnamese', 'event_espresso')
461
+								 'ar' 			=> __('Arabic', 'event_espresso'),
462
+								 'bg' 		=> __('Bulgarian', 'event_espresso'),
463
+								 'ca' 			=> __('Catalan', 'event_espresso'),
464
+								 'zh-CN' 	=>  __('Chinese (Simplified)', 'event_espresso'),
465
+								 'zh-TW' 	=>  __('Chinese (Traditional)	', 'event_espresso'),
466
+								 'hr' 			=> __('Croatian', 'event_espresso'),
467
+								 'cs' 			=> __('Czech', 'event_espresso'),
468
+								 'da' 			=> __('Danish', 'event_espresso'),
469
+								 'nl' 			=> __('Dutch', 'event_espresso'),
470
+								 'en-GB' 	=>  __('English (UK)', 'event_espresso'),
471
+								 'en' 			=> __('English (US)', 'event_espresso'),
472
+								 'fil' 			=> __('Filipino', 'event_espresso'),
473
+								 'fi' 			=> __('Finnish', 'event_espresso'),
474
+								 'fr' 			=> __('French', 'event_espresso'),
475
+								 'fr-CA' 	=>  __('French (Canadian)', 'event_espresso'),
476
+								 'de' 			=> __('German', 'event_espresso'),
477
+								 'de-AT' 	=>  __('German (Austria)', 'event_espresso'),
478
+								 'de-CH' 	=>  __('German (Switzerland)', 'event_espresso'),
479
+								 'el' 			=> __('Greek', 'event_espresso'),
480
+								 'iw' 			=> __('Hebrew', 'event_espresso'),
481
+								 'hi' 			=> __('Hindi', 'event_espresso'),
482
+								 'hu' 		=> __('Hungarian', 'event_espresso'),
483
+								 'id' 			=> __('Indonesian', 'event_espresso'),
484
+								 'it' 			=> __('Italian', 'event_espresso'),
485
+								 'ja' 			=> __('Japanese', 'event_espresso'),
486
+								 'ko' 			=> __('Korean', 'event_espresso'),
487
+								 'lv' 			=> __('Latvian', 'event_espresso'),
488
+								 'lt' 			=> __('Lithuanian', 'event_espresso'),
489
+								 'no' 		=> __('Norwegian', 'event_espresso'),
490
+								 'fa' 			=> __('Persian', 'event_espresso'),
491
+								 'pl' 			=> __('Polish', 'event_espresso'),
492
+								 'pt' 			=> __('Portuguese', 'event_espresso'),
493
+								 'pt-BR' 	=>  __('Portuguese (Brazil)', 'event_espresso'),
494
+								 'pt-PT' 	=>  __('Portuguese (Portugal)', 'event_espresso'),
495
+								 'ro' 			=> __('Romanian', 'event_espresso'),
496
+								 'ru' 			=> __('Russian', 'event_espresso'),
497
+								 'sr' 			=> __('Serbian', 'event_espresso'),
498
+								 'sk' 			=> __('Slovak', 'event_espresso'),
499
+								 'sl' 			=> __('Slovenian', 'event_espresso'),
500
+								 'es' 			=> __('Spanish', 'event_espresso'),
501
+								 'es-419' 	=>  __('Spanish (Latin America)', 'event_espresso'),
502
+								 'sv' 			=> __('Swedish', 'event_espresso'),
503
+								 'th' 			=> __('Thai', 'event_espresso'),
504
+								 'tr' 			=> __('Turkish', 'event_espresso'),
505
+								 'uk' 			=> __('Ukrainian', 'event_espresso'),
506
+								 'vi' 			=> __('Vietnamese', 'event_espresso')
508 507
 							),
509 508
 							array(
510
-								'html_label_text'	 	=> __( 'Language', 'event_espresso' ),
511
-								'html_help_text' 		=> __( 'Forces the widget to render in a specific language.', 'event_espresso' ),
512
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
509
+								'html_label_text'	 	=> __('Language', 'event_espresso'),
510
+								'html_help_text' 		=> __('Forces the widget to render in a specific language.', 'event_espresso'),
511
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
513 512
 							)
514 513
 						)
515 514
 					)
@@ -557,25 +556,25 @@  discard block
 block discarded – undo
557 556
 	 * @param EE_Registration_Config $EE_Registration_Config
558 557
 	 * @return array
559 558
 	 */
560
-	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
559
+	public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) {
561 560
 		try {
562 561
 			$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form();
563 562
 			// if not displaying a form, then check for form submission
564
-			if ( $recaptcha_settings_form->was_submitted() ) {
563
+			if ($recaptcha_settings_form->was_submitted()) {
565 564
 				// capture form data
566 565
 				$recaptcha_settings_form->receive_form_submission();
567 566
 				// validate form data
568
-				if ( $recaptcha_settings_form->is_valid() ) {
567
+				if ($recaptcha_settings_form->is_valid()) {
569 568
 					// grab validated data from form
570 569
 					$valid_data = $recaptcha_settings_form->valid_data();
571 570
 					// user proofing recaptcha:  If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message.
572 571
 					if (
573
-						apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config )
572
+						apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config)
574 573
 						&& $valid_data['main_settings']['use_captcha']
575
-						&& ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] )))
574
+						&& ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))
576 575
 					) {
577 576
 						$valid_data['main_settings']['use_captcha'] = FALSE;
578
-						EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
577
+						EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
579 578
 					}
580 579
 					$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha'];
581 580
 					$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey'];
@@ -584,12 +583,12 @@  discard block
 block discarded – undo
584 583
 					$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme'];
585 584
 					$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language'];
586 585
 				} else {
587
-					if ( $recaptcha_settings_form->submission_error_message() != '' ) {
588
-						EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
586
+					if ($recaptcha_settings_form->submission_error_message() != '') {
587
+						EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
589 588
 					}
590 589
 				}
591 590
 			}
592
-		} catch( EE_Error $e ) {
591
+		} catch (EE_Error $e) {
593 592
 			$e->get_error();
594 593
 		}
595 594
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Event_Strategy.core.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @param 	array 	$arguments
40 40
 	 * @return 	\EE_CPT_Event_Strategy
41 41
 	 */
42
-	public function __construct( $arguments = array() ) {
43
-		$this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL;
44
-		$WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL;
42
+	public function __construct($arguments = array()) {
43
+		$this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL;
44
+		$WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL;
45 45
 
46 46
 		// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
47 47
 		// here's the list of available filters in the WP_Query object
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 		// 'posts_fields'
56 56
 		// 'posts_join'
57 57
 		$this->_add_filters();
58
-		if ( $WP_Query instanceof WP_Query ) {
59
-			$WP_Query->is_espresso_event_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE;
58
+		if ($WP_Query instanceof WP_Query) {
59
+			$WP_Query->is_espresso_event_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE;
60 60
 			$WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events') ? TRUE : FALSE;
61
-			$WP_Query->is_espresso_event_taxonomy = is_tax( 'espresso_event_categories' ) ? TRUE : FALSE;
61
+			$WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories') ? TRUE : FALSE;
62 62
 		}
63 63
 
64 64
 	}
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * (which will get removed in case the next call to get_posts ISN'T
71 71
 	 * for event CPTs)
72 72
 	 */
73
-	protected function _add_filters(){
74
-		add_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 );
75
-		add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 );
76
-		add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 );
77
-		add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
78
-		add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 );
79
-		add_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 );
73
+	protected function _add_filters() {
74
+		add_filter('posts_fields', array($this, 'posts_fields'), 1, 2);
75
+		add_filter('posts_join', array($this, 'posts_join'), 1, 2);
76
+		add_filter('posts_where', array($this, 'posts_where'), 10, 2);
77
+		add_filter('the_posts', array($this, 'the_posts'), 1, 2);
78
+		add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2);
79
+		add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2);
80 80
 	}
81 81
 
82 82
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 * This is to avoid applying this CPT strategy for other posts or CPTs (eg,
87 87
 	 * we don't want to join to the datetime table when querying for venues, do we!?)
88 88
 	 */
89
-	protected function _remove_filters(){
90
-		remove_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 );
91
-		remove_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 );
92
-		remove_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 );
93
-		remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
94
-		remove_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 );
95
-		remove_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 );
89
+	protected function _remove_filters() {
90
+		remove_filter('posts_fields', array($this, 'posts_fields'), 1, 2);
91
+		remove_filter('posts_join', array($this, 'posts_join'), 1, 2);
92
+		remove_filter('posts_where', array($this, 'posts_where'), 10, 2);
93
+		remove_filter('the_posts', array($this, 'the_posts'), 1, 2);
94
+		remove_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2);
95
+		remove_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2);
96 96
 	}
97 97
 
98 98
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param WP_Query $wp_query
106 106
 	 * @return    string
107 107
 	 */
108
-	public function posts_fields( $SQL, WP_Query $wp_query ) {
108
+	public function posts_fields($SQL, WP_Query $wp_query) {
109 109
 		if (
110 110
 			$wp_query instanceof WP_Query
111 111
 			&&
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			)
117 117
 		) {
118 118
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
119
-			$SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ' ;
119
+			$SQL .= ', '.EEM_Datetime::instance()->table().'.* ';
120 120
 		}
121 121
 		return $SQL;
122 122
 	}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * @internal  param \WP_Query $WP_Query
133 133
 	 * @return    string
134 134
 	 */
135
-	public function posts_join( $SQL, WP_Query $wp_query ) {
135
+	public function posts_join($SQL, WP_Query $wp_query) {
136 136
 		if (
137 137
 			$wp_query instanceof WP_Query
138 138
 			&&
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			)
144 144
 		) {
145 145
 			// adds something like " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
146
-			$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) ';
146
+			$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name().' ) ';
147 147
 		}
148 148
 		return $SQL;
149 149
 	}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @param WP_Query $wp_query
159 159
 	 * @return    string
160 160
 	 */
161
-	public function posts_where( $SQL, WP_Query $wp_query ) {
161
+	public function posts_where($SQL, WP_Query $wp_query) {
162 162
 //		global $wpdb;
163 163
 		if (
164 164
 			$wp_query instanceof WP_Query
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 				|| $wp_query->is_espresso_event_taxonomy
169 169
 			)
170 170
 		) {
171
-			if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive ) || ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) {
172
-				$SQL .=  ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ';
171
+			if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive) || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) {
172
+				$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ';
173 173
 			}
174 174
 		}
175 175
 		return $SQL;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @param 	WP_Query $wp_query
186 186
 	 * @return 	string
187 187
 	 */
188
-	public function posts_orderby( $SQL, WP_Query $wp_query ) {
188
+	public function posts_orderby($SQL, WP_Query $wp_query) {
189 189
 		if (
190 190
 			$wp_query instanceof WP_Query
191 191
 			&&
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 				|| $wp_query->is_espresso_event_taxonomy
195 195
 			)
196 196
 		) {
197
-			$SQL = EEM_Datetime::instance()->table() . '.DTT_EVT_start ASC';
197
+			$SQL = EEM_Datetime::instance()->table().'.DTT_EVT_start ASC';
198 198
 		}
199 199
 		return $SQL;
200 200
 	}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @param WP_Query $wp_query
210 210
 	 * @return    string
211 211
 	 */
212
-	public function posts_groupby( $SQL, WP_Query $wp_query ) {
212
+	public function posts_groupby($SQL, WP_Query $wp_query) {
213 213
 		if (
214 214
 			$wp_query instanceof WP_Query
215 215
 			&&
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			// we're joining to the datetimes table, where there can be MANY datetimes for a single event, but we want to only show each event only once
223 223
 			// (whereas if we didn't group them by the post's ID, then we would end up with many repeats)
224 224
 			global $wpdb;
225
-			$SQL = $wpdb->posts . '.ID';
225
+			$SQL = $wpdb->posts.'.ID';
226 226
 		}
227 227
 		return $SQL;
228 228
 	}
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @param WP_Query $wp_query
238 238
 	 * @return    array
239 239
 	 */
240
-	public function the_posts( $posts, WP_Query $wp_query ) {
241
-		if ( $wp_query instanceof WP_Query && isset( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'espresso_events' ) {
240
+	public function the_posts($posts, WP_Query $wp_query) {
241
+		if ($wp_query instanceof WP_Query && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') {
242 242
 			// automagically load the EEH_Event_View helper so that it's functions are available
243 243
 			EE_Registry::instance()->load_helper('Event_View');
244 244
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @param      $single
258 258
 	 * @return    string
259 259
 	 */
260
-	public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) {
260
+	public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) {
261 261
 		return $meta_value;
262 262
 	}
263 263
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/EE_Addon.core.php 2 patches
Spacing   +60 added lines, -60 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
  *
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * @param mixed $version
75 75
 	 */
76
-	public function set_version( $version = NULL ) {
76
+	public function set_version($version = NULL) {
77 77
 		$this->_version = $version;
78 78
 	}
79 79
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	/**
92 92
 	 * @param mixed $min_core_version
93 93
 	 */
94
-	public function set_min_core_version( $min_core_version = NULL ) {
94
+	public function set_min_core_version($min_core_version = NULL) {
95 95
 		$this->_min_core_version = $min_core_version;
96 96
 	}
97 97
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @param string $addon_name
113 113
 	 * @return boolean
114 114
 	 */
115
-	function set_name( $addon_name ) {
115
+	function set_name($addon_name) {
116 116
 		return $this->_addon_name = $addon_name;
117 117
 	}
118 118
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		do_action("AHEE__{$classname}__new_install");
139 139
 		do_action("AHEE__EE_Addon__new_install", $this);
140 140
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
141
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
141
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
142 142
 	}
143 143
 
144 144
 
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 		do_action("AHEE__{$classname}__reactivation");
154 154
 		do_action("AHEE__EE_Addon__reactivation", $this);
155 155
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
156
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
156
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
157 157
 	}
158 158
 
159
-	public function deactivation(){
159
+	public function deactivation() {
160 160
 		$classname = get_class($this);
161 161
 //		echo "Deactivating $classname";die;
162 162
 		do_action("AHEE__{$classname}__deactivation");
163 163
 		do_action("AHEE__EE_Addon__deactivation", $this);
164 164
 		//check if the site no longer needs to be in maintenance mode
165
-		EE_Register_Addon::deregister( $this->name() );
165
+		EE_Register_Addon::deregister($this->name());
166 166
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
167 167
 	}
168 168
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 * @return void
176 176
 	 */
177 177
 	public function initialize_db_if_no_migrations_required() {
178
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
178
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
179 179
 			$this->initialize_db();
180 180
 			$this->initialize_default_data();
181 181
 			//@todo: this will probably need to be adjusted in 4.4 as the array changed formats I believe
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 */
189 189
 			EE_Registry::instance()->load_helper('Activation');
190 190
 			EEH_Activation::initialize_db_content();
191
-			update_option( 'ee_flush_rewrite_rules', TRUE );
192
-		}else{
191
+			update_option('ee_flush_rewrite_rules', TRUE);
192
+		} else {
193 193
 			//ask the data migration manager to init this addon's data
194 194
 			//when migrations are finished because we can't do it now
195
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( $this->name() );
195
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for($this->name());
196 196
 		}
197 197
 	}
198 198
 
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function initialize_db() {
208 208
 		//find the migration script that sets the database to be compatible with the code
209
-		$current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms( $this->name() );
210
-		if( $current_dms_name ){
211
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $current_dms_name );
212
-			$current_data_migration_script->set_migrating( FALSE );
209
+		$current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms($this->name());
210
+		if ($current_dms_name) {
211
+			$current_data_migration_script = EE_Registry::instance()->load_dms($current_dms_name);
212
+			$current_data_migration_script->set_migrating(FALSE);
213 213
 			$current_data_migration_script->schema_changes_before_migration();
214 214
 			$current_data_migration_script->schema_changes_after_migration();
215
-			if ( $current_data_migration_script->get_errors() ) {
216
-				foreach( $current_data_migration_script->get_errors() as $error ) {
217
-					EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
215
+			if ($current_data_migration_script->get_errors()) {
216
+				foreach ($current_data_migration_script->get_errors() as $error) {
217
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
218 218
 				}
219 219
 			}
220 220
 		}
221 221
 		//if not DMS was found that should be ok. This addon just doesn't require any database changes
222
-		EE_Data_Migration_Manager::instance()->update_current_database_state_to( array( 'slug' => $this->name(), 'version' => $this->version() ) );
222
+		EE_Data_Migration_Manager::instance()->update_current_database_state_to(array('slug' => $this->name(), 'version' => $this->version()));
223 223
 	}
224 224
 
225 225
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * default data)
242 242
 		 * @param EE_Addon $addon the addon that called this
243 243
 		 */
244
-		do_action( 'AHEE__EE_Addon__initialize_default_data__begin', $this );
244
+		do_action('AHEE__EE_Addon__initialize_default_data__begin', $this);
245 245
 		//override to insert default data. It is safe to use the models here
246 246
 		//because the site should not be in maintenance mode
247 247
 	}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		do_action("AHEE__EE_Addon__upgrade", $this);
261 261
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
262 262
 		//also it's possible there is new default data that needs to be added
263
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
263
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
264 264
 	}
265 265
 
266 266
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		do_action("AHEE__{$classname}__downgrade");
274 274
 		do_action("AHEE__EE_Addon__downgrade", $this);
275 275
 		//it's possible there's old default data that needs to be double-checked
276
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
276
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
277 277
 	}
278 278
 
279 279
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * plugin activation only. In the future, we'll want to do it on plugin updates too
285 285
 	 * @return bool
286 286
 	 */
287
-	public function set_db_update_option_name(){
287
+	public function set_db_update_option_name() {
288 288
 		EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Addon::set_db_update_option_name was renamed to EE_Addon::set_activation_indicator_option', 'event_espresso'), '4.3.0.alpha.016');
289 289
 		//let's just handle this on the next request, ok? right now we're just not really ready
290 290
 		return $this->set_activation_indicator_option();
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	public function set_activation_indicator_option() {
314 314
 		// let's just handle this on the next request, ok? right now we're just not really ready
315
-		return update_option( $this->get_activation_indicator_option_name(), TRUE );
315
+		return update_option($this->get_activation_indicator_option_name(), TRUE);
316 316
 	}
317 317
 
318 318
 
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * Gets the name of the wp option which is used to temporarily indicate that this addon was activated
321 321
 	 * @return string
322 322
 	 */
323
-	public function get_activation_indicator_option_name(){
324
-		return 'ee_activation_' . $this->name();
323
+	public function get_activation_indicator_option_name() {
324
+		return 'ee_activation_'.$this->name();
325 325
 	}
326 326
 
327 327
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 * Used by EE_System to set the request type of this addon. Should not be used by addon developers
332 332
 	 * @param int $req_type
333 333
 	 */
334
-	function set_req_type( $req_type ) {
334
+	function set_req_type($req_type) {
335 335
 		$this->_req_type = $req_type;
336 336
 	}
337 337
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * of addons
343 343
 	 */
344 344
 	function detect_req_type() {
345
-		if( ! $this->_req_type ){
345
+		if ( ! $this->_req_type) {
346 346
 			$this->detect_activation_or_upgrade();
347 347
 		}
348 348
 		return $this->_req_type;
@@ -355,36 +355,36 @@  discard block
 block discarded – undo
355 355
 	 * Should only be called once per request
356 356
 	 * @return void
357 357
 	 */
358
-	function detect_activation_or_upgrade(){
358
+	function detect_activation_or_upgrade() {
359 359
 		$activation_history_for_addon = $this->get_activation_history();
360 360
 //		d($activation_history_for_addon);
361 361
 		$request_type = EE_System::detect_req_type_given_activation_history($activation_history_for_addon, $this->get_activation_indicator_option_name(), $this->version());
362 362
 		$this->set_req_type($request_type);
363 363
 		$classname = get_class($this);
364
-		switch($request_type){
364
+		switch ($request_type) {
365 365
 			case EE_System::req_type_new_activation:
366
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__new_activation" );
367
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__new_activation", $this );
366
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__new_activation");
367
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__new_activation", $this);
368 368
 				$this->new_install();
369
-				$this->update_list_of_installed_versions( $activation_history_for_addon );
369
+				$this->update_list_of_installed_versions($activation_history_for_addon);
370 370
 				break;
371 371
 			case EE_System::req_type_reactivation:
372
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__reactivation" );
373
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__reactivation", $this );
372
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__reactivation");
373
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__reactivation", $this);
374 374
 				$this->reactivation();
375
-				$this->update_list_of_installed_versions( $activation_history_for_addon );
375
+				$this->update_list_of_installed_versions($activation_history_for_addon);
376 376
 				break;
377 377
 			case EE_System::req_type_upgrade:
378
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__upgrade" );
379
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__upgrade", $this );
378
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__upgrade");
379
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__upgrade", $this);
380 380
 				$this->upgrade();
381
-				$this->update_list_of_installed_versions($activation_history_for_addon );
381
+				$this->update_list_of_installed_versions($activation_history_for_addon);
382 382
 				break;
383 383
 			case EE_System::req_type_downgrade:
384
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__downgrade" );
385
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__downgrade", $this );
384
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__downgrade");
385
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__downgrade", $this);
386 386
 				$this->downgrade();
387
-				$this->update_list_of_installed_versions($activation_history_for_addon );
387
+				$this->update_list_of_installed_versions($activation_history_for_addon);
388 388
 				break;
389 389
 			case EE_System::req_type_normal:
390 390
 			default:
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				break;
393 393
 		}
394 394
 
395
-		do_action( "AHEE__{$classname}__detect_if_activation_or_upgrade__complete" );
395
+		do_action("AHEE__{$classname}__detect_if_activation_or_upgrade__complete");
396 396
 	}
397 397
 
398 398
 	/**
@@ -401,17 +401,17 @@  discard block
 block discarded – undo
401 401
 	 * @param string $current_version_to_add
402 402
 	 * @return boolean success
403 403
 	 */
404
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
405
-		if( ! $version_history ) {
404
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
405
+		if ( ! $version_history) {
406 406
 			$version_history = $this->get_activation_history();
407 407
 		}
408
-		if( $current_version_to_add == NULL){
408
+		if ($current_version_to_add == NULL) {
409 409
 			$current_version_to_add = $this->version();
410 410
 		}
411
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
411
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
412 412
 		// resave
413 413
 //		echo "updating list of installed versions:".$this->get_activation_history_option_name();d($version_history);
414
-		return update_option( $this->get_activation_history_option_name(), $version_history );
414
+		return update_option($this->get_activation_history_option_name(), $version_history);
415 415
 	}
416 416
 
417 417
 	/**
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 * of this addon
420 420
 	 * @return string
421 421
 	 */
422
-	function get_activation_history_option_name(){
423
-		return self::ee_addon_version_history_option_prefix . $this->name();
422
+	function get_activation_history_option_name() {
423
+		return self::ee_addon_version_history_option_prefix.$this->name();
424 424
 	}
425 425
 
426 426
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * Gets the wp option which stores the activation history for this addon
430 430
 	 * @return array
431 431
 	 */
432
-	function get_activation_history(){
432
+	function get_activation_history() {
433 433
 		return get_option($this->get_activation_history_option_name(), NULL);
434 434
 	}
435 435
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	/**
439 439
 	 * @param string $config_section
440 440
 	 */
441
-	public function set_config_section( $config_section = '' ) {
442
-		$this->_config_section = ! empty( $config_section ) ? $config_section : 'addons';
441
+	public function set_config_section($config_section = '') {
442
+		$this->_config_section = ! empty($config_section) ? $config_section : 'addons';
443 443
 	}
444 444
 	/**
445 445
 	 *	filepath to the main file, which can be used for register_activation_hook, register_deactivation_hook, etc.
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 	 * Sets the filepath to the main plugin file
453 453
 	 * @param string $filepath
454 454
 	 */
455
-	public function set_main_plugin_file( $filepath ) {
455
+	public function set_main_plugin_file($filepath) {
456 456
 		$this->_main_plugin_file = $filepath;
457 457
 	}
458 458
 	/**
459 459
 	 * gets the filepath to teh main file
460 460
 	 * @return string
461 461
 	 */
462
-	public function get_main_plugin_file(){
462
+	public function get_main_plugin_file() {
463 463
 		return $this->_main_plugin_file;
464 464
 	}
465 465
 
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 */
471 471
 	public function get_main_plugin_file_basename() {
472
-		return plugin_basename( $this->get_main_plugin_file() );
472
+		return plugin_basename($this->get_main_plugin_file());
473 473
 	}
474 474
 
475 475
 	/**
476 476
 	 * Gets the folder name which contains the main plugin file
477 477
 	 * @return string
478 478
 	 */
479
-	public function get_main_plugin_file_dirname(){
480
-		return dirname( $this->get_main_plugin_file() );
479
+	public function get_main_plugin_file_dirname() {
480
+		return dirname($this->get_main_plugin_file());
481 481
 	}
482 482
 
483 483
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@
 block discarded – undo
189 189
 			EE_Registry::instance()->load_helper('Activation');
190 190
 			EEH_Activation::initialize_db_content();
191 191
 			update_option( 'ee_flush_rewrite_rules', TRUE );
192
-		}else{
192
+		} else{
193 193
 			//ask the data migration manager to init this addon's data
194 194
 			//when migrations are finished because we can't do it now
195 195
 			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( $this->name() );
Please login to merge, or discard this patch.
core/EE_Configurable.core.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @param string $config_section
54 54
 	 */
55
-	public function set_config_section( $config_section = '' ) {
56
-		$this->_config_section = ! empty( $config_section ) ? $config_section : 'modules';
55
+	public function set_config_section($config_section = '') {
56
+		$this->_config_section = ! empty($config_section) ? $config_section : 'modules';
57 57
 	}
58 58
 
59 59
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	/**
71 71
 	 * @param string $config_class
72 72
 	 */
73
-	public function set_config_class( $config_class = '' ) {
73
+	public function set_config_class($config_class = '') {
74 74
 		$this->_config_class = $config_class;
75 75
 	}
76 76
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * @param mixed $config_name
90 90
 	 */
91
-	public function set_config_name( $config_name ) {
92
-		$this->_config_name = ! empty( $config_name ) ? $config_name : get_called_class();
91
+	public function set_config_name($config_name) {
92
+		$this->_config_name = ! empty($config_name) ? $config_name : get_called_class();
93 93
 	}
94 94
 
95 95
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @param 	EE_Config_Base 	$config_obj
113 113
 	 * @return 	mixed 	EE_Config_Base | NULL
114 114
 	 */
115
-	protected function _set_config( EE_Config_Base $config_obj = NULL ) {
116
-		return EE_Config::instance()->set_config( $this->config_section(), $this->config_name(), $this->config_class(), $config_obj );
115
+	protected function _set_config(EE_Config_Base $config_obj = NULL) {
116
+		return EE_Config::instance()->set_config($this->config_section(), $this->config_name(), $this->config_class(), $config_obj);
117 117
 	}
118 118
 
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @param 	EE_Config_Base 	$config_obj
127 127
 	 * @return 	mixed 	EE_Config_Base | NULL
128 128
 	 */
129
-	protected function _update_config( EE_Config_Base $config_obj = NULL ) {
130
-		$this->_config = EE_Config::instance()->update_config( $this->config_section(), $this->config_name(), $config_obj );
129
+	protected function _update_config(EE_Config_Base $config_obj = NULL) {
130
+		$this->_config = EE_Config::instance()->update_config($this->config_section(), $this->config_name(), $config_obj);
131 131
 		return $this->_config;
132 132
 	}
133 133
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 * @return EE_Config_Base
140 140
 	 */
141 141
 	public function config() {
142
-		if ( empty( $this->_config )) {
143
-			$this->_config = EE_Config::instance()->get_config( $this->config_section(), $this->config_name(), $this->config_class() );
142
+		if (empty($this->_config)) {
143
+			$this->_config = EE_Config::instance()->get_config($this->config_section(), $this->config_name(), $this->config_class());
144 144
 		}
145 145
 		return $this->_config;
146 146
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/EE_Cron_Tasks.core.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @return EE_Cron_Tasks
23 23
 	 */
24 24
 	public static function instance() {
25
-		if ( ! self::$_instance instanceof EE_Cron_Tasks ) {
25
+		if ( ! self::$_instance instanceof EE_Cron_Tasks) {
26 26
 			self::$_instance = new self();
27 27
 		}
28 28
 		return self::$_instance;
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 		// UPDATE TRANSACTION WITH PAYMENT
39 39
 		add_action(
40 40
 			'AHEE__EE_Cron_Tasks__update_transaction_with_payment',
41
-			array( 'EE_Cron_Tasks', 'setup_update_for_transaction_with_payment' ),
41
+			array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'),
42 42
 			10, 2
43 43
 		);
44 44
 		// FINALIZE ABANDONED TRANSACTIONS
45 45
 		add_action(
46 46
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
47
-			array( 'EE_Cron_Tasks', 'check_for_abandoned_transactions' ),
47
+			array('EE_Cron_Tasks', 'check_for_abandoned_transactions'),
48 48
 			10, 1
49 49
 		);
50 50
 	}
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 		$payment
80 80
 	) {
81 81
 		// validate $TXN_ID and $timestamp
82
-		$TXN_ID = absint( $TXN_ID );
83
-		$timestamp = absint( $timestamp );
84
-		if ( $TXN_ID && $timestamp ) {
82
+		$TXN_ID = absint($TXN_ID);
83
+		$timestamp = absint($timestamp);
84
+		if ($TXN_ID && $timestamp) {
85 85
 			wp_schedule_single_event(
86 86
 				$timestamp,
87 87
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment',
88
-				array( $TXN_ID, $payment )
88
+				array($TXN_ID, $payment)
89 89
 			);
90 90
 		}
91 91
 	}
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
 	 * @param int  $TXN_ID
108 108
 	 * @param null $payment
109 109
 	 */
110
-	public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $payment = null ) {
111
-		if ( absint( $TXN_ID )) {
112
-			self::$_update_transactions_with_payment[ $TXN_ID ] = $payment;
110
+	public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $payment = null) {
111
+		if (absint($TXN_ID)) {
112
+			self::$_update_transactions_with_payment[$TXN_ID] = $payment;
113 113
 			add_action(
114 114
 				'shutdown',
115
-				array( 'EE_Cron_Tasks', 'update_transaction_with_payment' ),
115
+				array('EE_Cron_Tasks', 'update_transaction_with_payment'),
116 116
 				5
117 117
 			);
118 118
 		}
@@ -130,31 +130,31 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public static function update_transaction_with_payment() {
132 132
 		// are there any TXNs that need cleaning up ?
133
-		if ( ! empty( self::$_update_transactions_with_payment ) ) {
133
+		if ( ! empty(self::$_update_transactions_with_payment)) {
134 134
 			/** @type EE_Payment_Processor $payment_processor */
135
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
135
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
136 136
 			// set revisit flag for payment processor
137
-			$payment_processor->set_revisit( false );
137
+			$payment_processor->set_revisit(false);
138 138
 			// load EEM_Transaction
139
-			EE_Registry::instance()->load_model( 'Transaction' );
140
-			foreach ( self::$_update_transactions_with_payment as $TXN_ID => $payment ) {
139
+			EE_Registry::instance()->load_model('Transaction');
140
+			foreach (self::$_update_transactions_with_payment as $TXN_ID => $payment) {
141 141
 				// reschedule the cron if we can't hit the db right now
142
-				if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
142
+				if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
143 143
 					// reset cron job for updating the TXN
144 144
 					EE_Cron_Tasks::schedule_update_transaction_with_payment(
145
-						time() + ( 10 * MINUTE_IN_SECONDS ) + 1,
145
+						time() + (10 * MINUTE_IN_SECONDS) + 1,
146 146
 						$TXN_ID,
147 147
 						$payment
148 148
 					);
149 149
 					continue;
150 150
 				}
151
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
151
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
152 152
 				// verify transaction
153
-				if ( $transaction instanceof EE_Transaction ) {
153
+				if ($transaction instanceof EE_Transaction) {
154 154
 					// now try to update the TXN with any payments
155
-					$payment_processor->update_txn_based_on_payment( $transaction, $payment, true, true );
155
+					$payment_processor->update_txn_based_on_payment($transaction, $payment, true, true);
156 156
 				}
157
-				unset( self::$_update_transactions_with_payment[ $TXN_ID ] );
157
+				unset(self::$_update_transactions_with_payment[$TXN_ID]);
158 158
 			}
159 159
 		}
160 160
 	}
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 		$TXN_ID
192 192
 	) {
193 193
 		// validate $TXN_ID and $timestamp
194
-		$TXN_ID = absint( $TXN_ID );
195
-		$timestamp = absint( $timestamp );
196
-		if ( $TXN_ID && $timestamp ) {
194
+		$TXN_ID = absint($TXN_ID);
195
+		$timestamp = absint($timestamp);
196
+		if ($TXN_ID && $timestamp) {
197 197
 			wp_schedule_single_event(
198 198
 				$timestamp,
199 199
 				'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
200
-				array( $TXN_ID )
200
+				array($TXN_ID)
201 201
 			);
202 202
 		}
203 203
 	}
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
 	 *
220 220
 	 * @param int $TXN_ID
221 221
 	 */
222
-	public static function check_for_abandoned_transactions(	$TXN_ID = 0 ) {
223
-		if ( absint( $TXN_ID )) {
224
-			self::$_abandoned_transactions[]  = $TXN_ID;
222
+	public static function check_for_abandoned_transactions($TXN_ID = 0) {
223
+		if (absint($TXN_ID)) {
224
+			self::$_abandoned_transactions[] = $TXN_ID;
225 225
 			add_action(
226 226
 				'shutdown',
227
-				array( 'EE_Cron_Tasks', 'finalize_abandoned_transactions' ),
227
+				array('EE_Cron_Tasks', 'finalize_abandoned_transactions'),
228 228
 				5
229 229
 			);
230 230
 		}
@@ -242,38 +242,38 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	public static function finalize_abandoned_transactions() {
244 244
 		// are there any TXNs that need cleaning up ?
245
-		if ( ! empty( self::$_abandoned_transactions ) ) {
245
+		if ( ! empty(self::$_abandoned_transactions)) {
246 246
 			/** @type EE_Transaction_Processor $transaction_processor */
247
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
247
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
248 248
 			// set revisit flag for txn processor
249
-			$transaction_processor->set_revisit( false );
249
+			$transaction_processor->set_revisit(false);
250 250
 			/** @type EE_Transaction_Payments $transaction_payments */
251
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
251
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
252 252
 			// load EEM_Transaction
253
-			EE_Registry::instance()->load_model( 'Transaction' );
254
-			foreach ( self::$_abandoned_transactions as $TXN_ID ) {
253
+			EE_Registry::instance()->load_model('Transaction');
254
+			foreach (self::$_abandoned_transactions as $TXN_ID) {
255 255
 				// reschedule the cron if we can't hit the db right now
256
-				if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
256
+				if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
257 257
 					// reset cron job for finalizing the TXN
258 258
 					EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
259
-						time() + ( 10 * MINUTE_IN_SECONDS ) + 1,
259
+						time() + (10 * MINUTE_IN_SECONDS) + 1,
260 260
 						$TXN_ID
261 261
 					);
262 262
 					continue;
263 263
 				}
264
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
264
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
265 265
 				// verify transaction
266
-				if ( $transaction instanceof EE_Transaction ) {
266
+				if ($transaction instanceof EE_Transaction) {
267 267
 					// or have had all of their reg steps completed
268
-					if ( $transaction_processor->all_reg_steps_completed(	$transaction ) === true ) {
268
+					if ($transaction_processor->all_reg_steps_completed($transaction) === true) {
269 269
 						continue;
270 270
 					}
271 271
 					// maybe update status, but don't save transaction just yet
272
-					$transaction_payments	->update_transaction_status_based_on_total_paid( $transaction, false );
272
+					$transaction_payments	->update_transaction_status_based_on_total_paid($transaction, false);
273 273
 					// check if enough Reg Steps have been completed to warrant finalizing the TXN
274
-					if ( $transaction_processor->all_reg_steps_completed_except_final_step( $transaction ) ) {
274
+					if ($transaction_processor->all_reg_steps_completed_except_final_step($transaction)) {
275 275
 						// and if it hasn't already been set as being started...
276
-						$transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
276
+						$transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
277 277
 					}
278 278
 					// now update the TXN and trigger notifications
279 279
 					$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 						$transaction->last_payment()
282 282
 					);
283 283
 				}
284
-				unset( self::$_abandoned_transactions[ $TXN_ID ] );
284
+				unset(self::$_abandoned_transactions[$TXN_ID]);
285 285
 			}
286 286
 		}
287 287
 	}
Please login to merge, or discard this patch.
core/EE_Front_Controller.core.php 2 patches
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public static function instance() {
63 63
 		// check if class object is instantiated, and instantiated properly
64
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof  EE_Front_Controller )) {
64
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof  EE_Front_Controller)) {
65 65
 			self::$_instance = new self();
66 66
 		}
67 67
 		return self::$_instance;
@@ -79,35 +79,35 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	private function __construct() {
81 81
 		// make sure template tags are loaded immediately so that themes don't break
82
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 );
82
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
83 83
 		// determine how to integrate WP_Query with the EE models
84
-		add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' ));
84
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
85 85
 		// load other resources and begin to actually run shortcodes and modules
86
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 );
86
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
87 87
 		// analyse the incoming WP request
88
-		add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 );
88
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
89 89
 		// process any content shortcodes
90
-		add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 );
90
+		add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
91 91
 		// process request with module factory
92
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 );
92
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
93 93
 		// before headers sent
94
-		add_action( 'wp', array( $this, 'wp' ), 5 );
94
+		add_action('wp', array($this, 'wp'), 5);
95 95
 		// load css and js
96
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 5 );
96
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 5);
97 97
 		// header
98
-		add_action('wp_head', array( $this, 'header_meta_tag' ), 5 );
99
-		add_filter( 'template_include', array( $this, 'template_include' ), 1 );
98
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
99
+		add_filter('template_include', array($this, 'template_include'), 1);
100 100
 		// display errors
101
-		add_action('loop_start', array( $this, 'display_errors' ), 2 );
101
+		add_action('loop_start', array($this, 'display_errors'), 2);
102 102
 		// the content
103
-		add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
103
+		add_filter('the_content', array($this, 'the_content'), 5, 1);
104 104
 
105 105
 		//exclude our private cpt comments
106
-		add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 );
106
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
107 107
 		//make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
108
-		add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 );
108
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
109 109
 		// action hook EE
110
-		do_action( 'AHEE__EE_Front_Controller__construct__done',$this );
110
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
111 111
 	}
112 112
 
113 113
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * 	@return void
127 127
 	 */
128 128
 	public function load_espresso_template_tags() {
129
-		if ( is_readable( EE_PUBLIC . 'template_tags.php' )) {
130
-			require_once( EE_PUBLIC . 'template_tags.php' );
129
+		if (is_readable(EE_PUBLIC.'template_tags.php')) {
130
+			require_once(EE_PUBLIC.'template_tags.php');
131 131
 		}
132 132
 	}
133 133
 
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
143 143
 	 * @return array array of comment clauses with modifications.
144 144
 	 */
145
-	public function filter_wp_comments( $clauses ) {
145
+	public function filter_wp_comments($clauses) {
146 146
 		global $wpdb;
147
-		if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) {
147
+		if (strpos($clauses['join'], $wpdb->posts) !== FALSE) {
148 148
 			$cpts = EE_Register_CPTs::get_private_CPTs();
149
-			foreach ( $cpts as $cpt => $details ) {
150
-				$clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt );
149
+			foreach ($cpts as $cpt => $details) {
150
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
151 151
 			}
152 152
 		}
153 153
 		return $clauses;
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 *  @return 	void
165 165
 	 */
166 166
 	public function employ_CPT_Strategy() {
167
-		if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){
168
-			EE_Registry::instance()->load_core( 'CPT_Strategy' );
167
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
168
+			EE_Registry::instance()->load_core('CPT_Strategy');
169 169
 		}
170 170
 	}
171 171
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	 * @param  string $url    incoming url
178 178
 	 * @return string         final assembled url
179 179
 	 */
180
-	public function maybe_force_admin_ajax_ssl( $url ) {
181
-		if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) {
182
-			$url = str_replace( 'http://', 'https://', $url );
180
+	public function maybe_force_admin_ajax_ssl($url) {
181
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
182
+			$url = str_replace('http://', 'https://', $url);
183 183
 		}
184 184
 		return $url;
185 185
 	}
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	 * @param WP $WP
217 217
 	 * @return void
218 218
 	 */
219
-	public function get_request( WP $WP ) {
220
-		do_action( 'AHEE__EE_Front_Controller__get_request__start' );
221
-		EE_Registry::instance()->load_core( 'Request_Handler', $WP );
222
-		do_action( 'AHEE__EE_Front_Controller__get_request__complete' );
219
+	public function get_request(WP $WP) {
220
+		do_action('AHEE__EE_Front_Controller__get_request__start');
221
+		EE_Registry::instance()->load_core('Request_Handler', $WP);
222
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
223 223
 	}
224 224
 
225 225
 
@@ -231,22 +231,22 @@  discard block
 block discarded – undo
231 231
 	 * @param WP $WP
232 232
 	 * @return    void
233 233
 	 */
234
-	public function _initialize_shortcodes( WP $WP ) {
235
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this );
234
+	public function _initialize_shortcodes(WP $WP) {
235
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
236 236
 		// grab post_name from request
237
-		$current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get( 'post_name' ));
237
+		$current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get('post_name'));
238 238
 		// if it's not set, then check if frontpage is blog
239
-		if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'posts' ) {
239
+		if (empty($current_post) && get_option('show_on_front') == 'posts') {
240 240
 			// yup.. this is the posts page, prepare to load all shortcode modules
241 241
 			$current_post = 'posts';
242
-		} else if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'page' ) {
242
+		} else if (empty($current_post) && get_option('show_on_front') == 'page') {
243 243
 			// some other page is set as the homepage
244
-			$page_on_front = get_option( 'page_on_front' );
245
-			if ( $page_on_front ) {
244
+			$page_on_front = get_option('page_on_front');
245
+			if ($page_on_front) {
246 246
 				// k now we need to find the post_name for this page
247 247
 				global $wpdb;
248 248
 				$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d";
249
-				$page_on_front = $wpdb->get_var( $wpdb->prepare( $SQL, $page_on_front ));
249
+				$page_on_front = $wpdb->get_var($wpdb->prepare($SQL, $page_on_front));
250 250
 				// set the current post slug to what it actually is
251 251
 				$current_post = $page_on_front ? $page_on_front : $current_post;
252 252
 			}
@@ -254,58 +254,58 @@  discard block
 block discarded – undo
254 254
 		// where are posts being displayed ?
255 255
 		$page_for_posts = EE_Config::get_page_for_posts();
256 256
 		// in case $current_post is hierarchical like: /parent-page/current-page
257
-		$current_post = basename( $current_post );
257
+		$current_post = basename($current_post);
258 258
 		// are we on a category page?
259
-		$term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars );
259
+		$term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars);
260 260
 		// make sure shortcodes are set
261
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes )) {
261
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes)) {
262 262
 			// d( EE_Registry::instance()->CFG->core->post_shortcodes );
263 263
 			// cycle thru all posts with shortcodes set
264
-			foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) {
264
+			foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
265 265
 				// filter shortcodes so
266
-				$post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes );
266
+				$post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes);
267 267
 				// now cycle thru shortcodes
268
-				foreach ( $post_shortcodes as $shortcode_class => $post_id ) {
268
+				foreach ($post_shortcodes as $shortcode_class => $post_id) {
269 269
 					// are we on this page, or on the blog page, or an EE CPT category page ?
270
-					if ( $current_post == $post_name || $term_exists ) {
270
+					if ($current_post == $post_name || $term_exists) {
271 271
 						// verify shortcode is in list of registered shortcodes
272
-						if ( ! isset( EE_Registry::instance()->shortcodes->$shortcode_class )) {
273
-							if ( $current_post != $page_for_posts && current_user_can( 'edit_post', $post_id )) {
274
-								$msg = sprintf( __( 'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso' ), $shortcode_class );
275
-								EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
276
-								add_filter( 'FHEE_run_EE_the_content', '__return_true' );
272
+						if ( ! isset(EE_Registry::instance()->shortcodes->$shortcode_class)) {
273
+							if ($current_post != $page_for_posts && current_user_can('edit_post', $post_id)) {
274
+								$msg = sprintf(__('The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso'), $shortcode_class);
275
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
276
+								add_filter('FHEE_run_EE_the_content', '__return_true');
277 277
 							}
278
-							add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' ));
278
+							add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
279 279
 							break;
280 280
 						}
281 281
 						// is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
282
-						if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $current_post ] ) || $term_exists || $current_post == $page_for_posts ) {
282
+						if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$current_post]) || $term_exists || $current_post == $page_for_posts) {
283 283
 							// let's pause to reflect on this...
284
-							$sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class );
284
+							$sc_reflector = new ReflectionClass('EES_'.$shortcode_class);
285 285
 							// ensure that class is actually a shortcode
286
-							if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) && defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE ) {
287
-								$msg = sprintf( __( 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso' ), $shortcode_class );
288
-								EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
289
-								add_filter( 'FHEE_run_EE_the_content', '__return_true' );
286
+							if ( ! $sc_reflector->isSubclassOf('EES_Shortcode') && defined('WP_DEBUG') && WP_DEBUG === TRUE) {
287
+								$msg = sprintf(__('The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso'), $shortcode_class);
288
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
289
+								add_filter('FHEE_run_EE_the_content', '__return_true');
290 290
 								break;
291 291
 							}
292 292
 							// and pass the request object to the run method
293 293
 							EE_Registry::instance()->shortcodes->$shortcode_class = $sc_reflector->newInstance();
294 294
 							// fire the shortcode class's run method, so that it can activate resources
295
-							EE_Registry::instance()->shortcodes->$shortcode_class->run( $WP );
295
+							EE_Registry::instance()->shortcodes->$shortcode_class->run($WP);
296 296
 						}
297 297
 					// if this is NOT the "Posts page" and we have a valid entry for the "Posts page" in our tracked post_shortcodes array
298
-					} else if ( $post_name != $page_for_posts && isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) {
298
+					} else if ($post_name != $page_for_posts && isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
299 299
 						// and the shortcode is not being tracked for this page
300
-						if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )) {
300
+						if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])) {
301 301
 							// then remove the "fallback" shortcode processor
302
-							remove_shortcode( $shortcode_class );
302
+							remove_shortcode($shortcode_class);
303 303
 						}
304 304
 					}
305 305
 				}
306 306
 			}
307 307
 		}
308
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this );
308
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
309 309
 	}
310 310
 
311 311
 
@@ -317,20 +317,20 @@  discard block
 block discarded – undo
317 317
 	 * @param   WP_Query    $WP_Query
318 318
 	 * @return    void
319 319
 	 */
320
-	public function pre_get_posts( $WP_Query ) {
320
+	public function pre_get_posts($WP_Query) {
321 321
 		// only load Module_Request_Router if this is the main query
322
-		if ( $WP_Query->is_main_query() ) {
322
+		if ($WP_Query->is_main_query()) {
323 323
 			// load module request router
324
-			$Module_Request_Router = EE_Registry::instance()->load_core( 'Module_Request_Router' );
324
+			$Module_Request_Router = EE_Registry::instance()->load_core('Module_Request_Router');
325 325
 			// verify object
326
-			if ( $Module_Request_Router instanceof EE_Module_Request_Router ) {
326
+			if ($Module_Request_Router instanceof EE_Module_Request_Router) {
327 327
 				// cycle thru module routes
328
-				while ( $route = $Module_Request_Router->get_route( $WP_Query )) {
328
+				while ($route = $Module_Request_Router->get_route($WP_Query)) {
329 329
 					// determine module and method for route
330
-					$module = $Module_Request_Router->resolve_route( $route[0], $route[1] );
331
-					if( $module instanceof EED_Module ) {
330
+					$module = $Module_Request_Router->resolve_route($route[0], $route[1]);
331
+					if ($module instanceof EED_Module) {
332 332
 						// get registered view for route
333
-						$this->_template_path = $Module_Request_Router->get_view( $route );
333
+						$this->_template_path = $Module_Request_Router->get_view($route);
334 334
 						// grab module name
335 335
 						$module_name = $module->module_name();
336 336
 						// map the module to the module objects
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 *  @return 	void
358 358
 	 */
359 359
 	public function wp() {
360
-		EE_Registry::instance()->load_helper( 'Template' );
360
+		EE_Registry::instance()->load_helper('Template');
361 361
 	}
362 362
 
363 363
 
@@ -375,30 +375,30 @@  discard block
 block discarded – undo
375 375
 	public function wp_enqueue_scripts() {
376 376
 
377 377
 		// css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
378
-		if ( apply_filters( 'FHEE_load_css', TRUE ) ) {
378
+		if (apply_filters('FHEE_load_css', TRUE)) {
379 379
 
380 380
 			EE_Registry::instance()->CFG->template_settings->enable_default_style = TRUE;
381 381
 			//Load the ThemeRoller styles if enabled
382
-			if ( isset( EE_Registry::instance()->CFG->template_settings->enable_default_style ) && EE_Registry::instance()->CFG->template_settings->enable_default_style ) {
382
+			if (isset(EE_Registry::instance()->CFG->template_settings->enable_default_style) && EE_Registry::instance()->CFG->template_settings->enable_default_style) {
383 383
 
384 384
 				//Load custom style sheet if available
385
-				if ( isset( EE_Registry::instance()->CFG->template_settings->custom_style_sheet )) {
386
-					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION );
385
+				if (isset(EE_Registry::instance()->CFG->template_settings->custom_style_sheet)) {
386
+					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION);
387 387
 					wp_enqueue_style('espresso_custom_css');
388 388
 				}
389 389
 
390
-				EE_Registry::instance()->load_helper( 'File' );
391
-				if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) {
392
-					wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
390
+				EE_Registry::instance()->load_helper('File');
391
+				if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) {
392
+					wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
393 393
 				} else {
394
-					wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
394
+					wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
395 395
 				}
396 396
 				wp_enqueue_style('espresso_default');
397 397
 
398
-				if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) {
399
-					wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
398
+				if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) {
399
+					wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
400 400
 				} else {
401
-					wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
401
+					wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
402 402
 				}
403 403
 
404 404
 			}
@@ -406,28 +406,28 @@  discard block
 block discarded – undo
406 406
 		}
407 407
 
408 408
 		// js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
409
-		if ( apply_filters( 'FHEE_load_js', TRUE ) ) {
409
+		if (apply_filters('FHEE_load_js', TRUE)) {
410 410
 
411
-			wp_enqueue_script( 'jquery' );
411
+			wp_enqueue_script('jquery');
412 412
 			//let's make sure that all required scripts have been setup
413
-			if ( function_exists( 'wp_script_is' )) {
414
-				if ( ! wp_script_is( 'jquery' )) {
413
+			if (function_exists('wp_script_is')) {
414
+				if ( ! wp_script_is('jquery')) {
415 415
 					$msg = sprintf(
416
-						__( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ),
416
+						__('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'),
417 417
 						'<em><br />',
418 418
 						'</em>'
419 419
 					);
420
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
420
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
421 421
 				}
422 422
 			}
423 423
 			// load core js
424
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
425
-			wp_enqueue_script( 'espresso_core' );
424
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
425
+			wp_enqueue_script('espresso_core');
426 426
 
427 427
 		}
428 428
 
429 429
 		//qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
430
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
430
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
431 431
 			EE_Registry::instance()->load_helper('Qtip_Loader');
432 432
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
433 433
 		}
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
 
436 436
 		//accounting.js library
437 437
 		// @link http://josscrowcroft.github.io/accounting.js/
438
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
439
-			$acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
440
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
441
-			wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE );
442
-			wp_enqueue_script( 'ee-accounting' );
438
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
439
+			$acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js';
440
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
441
+			wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE);
442
+			wp_enqueue_script('ee-accounting');
443 443
 
444 444
 			$currency_config = array(
445 445
 				'currency' => array(
@@ -462,21 +462,21 @@  discard block
 block discarded – undo
462 462
 			wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
463 463
 		}
464 464
 
465
-		if ( ! function_exists( 'wp_head' )) {
465
+		if ( ! function_exists('wp_head')) {
466 466
 			$msg = sprintf(
467
-				__( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
467
+				__('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
468 468
 				'<em><br />',
469 469
 				'</em>'
470 470
 			);
471
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
471
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
472 472
 		}
473
-		if ( ! function_exists( 'wp_footer' )) {
473
+		if ( ! function_exists('wp_footer')) {
474 474
 			$msg = sprintf(
475
-				__( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
475
+				__('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
476 476
 				'<em><br />',
477 477
 				'</em>'
478 478
 			);
479
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
479
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
480 480
 		}
481 481
 
482 482
 	}
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 *  @return 	void
491 491
 	 */
492 492
 	public function header_meta_tag() {
493
-		print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />"));
493
+		print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />"));
494 494
 	}
495 495
 
496 496
 
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 	 * @param   $the_content
505 505
 	 * @return    string
506 506
 	 */
507
-	public function the_content( $the_content ) {
507
+	public function the_content($the_content) {
508 508
 		// nothing gets loaded at this point unless other systems turn this hookpoint on by using:  add_filter( 'FHEE_run_EE_the_content', '__return_true' );
509
-		if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) {
509
+		if (apply_filters('FHEE_run_EE_the_content', FALSE)) {
510 510
 		}
511 511
 		return $the_content;
512 512
 	}
@@ -531,14 +531,14 @@  discard block
 block discarded – undo
531 531
 	 */
532 532
 	public function display_errors() {
533 533
 		static $shown_already = FALSE;
534
-		do_action( 'AHEE__EE_Front_Controller__display_errors__begin' );
535
-		if ( apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) && ! $shown_already && is_main_query() && ! is_feed() && in_the_loop() ) {
534
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
535
+		if (apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) && ! $shown_already && is_main_query() && ! is_feed() && in_the_loop()) {
536 536
 			echo EE_Error::get_notices();
537 537
 			$shown_already = TRUE;
538
-			EE_Registry::instance()->load_helper( 'Template' );
539
-			EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' );
538
+			EE_Registry::instance()->load_helper('Template');
539
+			EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php');
540 540
 		}
541
-		do_action( 'AHEE__EE_Front_Controller__display_errors__end' );
541
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
542 542
 	}
543 543
 
544 544
 
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
 	 * @param   string $template_include_path
554 554
 	 * @return    string
555 555
 	 */
556
-	public function template_include( $template_include_path = NULL ) {
557
-		if ( EE_Registry::instance()->REQ->is_espresso_page() ) {
558
-			$this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path );
559
-			$template_path = EEH_Template::locate_template( $this->_template_path, array(), false );
560
-			$this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path;
561
-			$this->_template = basename( $this->_template_path );
556
+	public function template_include($template_include_path = NULL) {
557
+		if (EE_Registry::instance()->REQ->is_espresso_page()) {
558
+			$this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
559
+			$template_path = EEH_Template::locate_template($this->_template_path, array(), false);
560
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
561
+			$this->_template = basename($this->_template_path);
562 562
 			return $this->_template_path;
563 563
 		}
564 564
 		return $template_include_path;
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 	 * @param bool $with_path
574 574
 	 * @return    string
575 575
 	 */
576
-	public function get_selected_template( $with_path = FALSE ) {
576
+	public function get_selected_template($with_path = FALSE) {
577 577
 		return $with_path ? $this->_template_path : $this->_template;
578 578
 	}
579 579
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Payment_Processor extends EE_Processor_Base {
15 15
 	/**
16
-     * 	@var EE_Payment_Processor $_instance
16
+	 * 	@var EE_Payment_Processor $_instance
17 17
 	 * 	@access 	private
18
-     */
18
+	 */
19 19
 	private static $_instance = NULL;
20 20
 
21 21
 
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -60,32 +60,32 @@  discard block
 block discarded – undo
60 60
 	 * @param boolean              				$update_txn  	whether or not to call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()
61 61
 	 * @return EE_Payment | NULL
62 62
 	 */
63
-	public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE ) {
63
+	public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE) {
64 64
 		// verify payment method
65
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
65
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
66 66
 		// verify transaction
67
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
68
-		$transaction->set_payment_method_ID( $payment_method->ID() );
67
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
68
+		$transaction->set_payment_method_ID($payment_method->ID());
69 69
 		// verify payment method type
70
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ){
70
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
71 71
 			$payment = $payment_method->type_obj()->process_payment(
72 72
 				$transaction,
73
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
73
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
74 74
 				$billing_form,
75 75
 				$return_url,
76
-				add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
76
+				add_query_arg(array('ee_cancel_payment' => true), $return_url),
77 77
 				$method,
78 78
 				$by_admin
79 79
 			);
80 80
 			//offline gateways DON'T return a payment object, so check it
81
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
81
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
82 82
 			return $payment;
83 83
 		} else {
84 84
 			EE_Error::add_error(
85 85
 				sprintf(
86
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
86
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
87 87
 					'<br/>',
88
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
88
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
89 89
 				), __FILE__, __FUNCTION__, __LINE__
90 90
 			);
91 91
 			return NULL;
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 	 * @throws EE_Error
102 102
 	 * @return string
103 103
 	 */
104
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
104
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
105 105
 		/** @type EE_Transaction $transaction */
106
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
106
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
107 107
 		$primary_reg = $transaction->primary_registration();
108
-		if( ! $primary_reg instanceof EE_Registration ){
109
-			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID()));
108
+		if ( ! $primary_reg instanceof EE_Registration) {
109
+			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID()));
110 110
 		}
111
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
111
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
112 112
 		$url = add_query_arg(
113 113
 			array(
114 114
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -133,80 +133,80 @@  discard block
 block discarded – undo
133 133
 	 * @throws Exception
134 134
 	 * @return EE_Payment
135 135
 	 */
136
-	public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true ){
137
-		EE_Registry::instance()->load_model( 'Change_Log' );
138
-		EE_Processor_Base::set_IPN( true );
139
-		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
140
-			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
141
-		}elseif( $payment_method instanceof EE_Payment ){
136
+	public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true) {
137
+		EE_Registry::instance()->load_model('Change_Log');
138
+		EE_Processor_Base::set_IPN(true);
139
+		if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) {
140
+			$obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc')));
141
+		}elseif ($payment_method instanceof EE_Payment) {
142 142
 			$obj_for_log = $payment_method;
143
-		}elseif( $transaction instanceof EE_Transaction ){
143
+		}elseif ($transaction instanceof EE_Transaction) {
144 144
 			$obj_for_log = $transaction;
145
-		}else{
145
+		} else {
146 146
 			$obj_for_log = null;
147 147
 		}
148 148
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
149
-		try{
149
+		try {
150 150
 			/**
151 151
 			 * @var EE_Payment $payment
152 152
 			 */
153 153
 			$payment = NULL;
154
-			if($transaction && $payment_method){
154
+			if ($transaction && $payment_method) {
155 155
 				/** @type EE_Transaction $transaction */
156 156
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
157 157
 				/** @type EE_Payment_Method $payment_method */
158 158
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
159
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
160
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
159
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
160
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
161 161
 						$log->set_object($payment);
162 162
 				} else {
163 163
 					// not a payment
164 164
 					EE_Error::add_error(
165 165
 						sprintf(
166
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
166
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
167 167
 							'<br/>',
168
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
168
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
169 169
 						),
170 170
 						__FILE__, __FUNCTION__, __LINE__
171 171
 					);
172 172
 				}
173
-			}else{
173
+			} else {
174 174
 				//that's actually pretty ok. The IPN just wasn't able
175 175
 				//to identify which transaction or payment method this was for
176 176
 				// give all active payment methods a chance to claim it
177 177
 				$active_pms = EEM_Payment_Method::instance()->get_all_active();
178
-				foreach( $active_pms as $payment_method ){
179
-					try{
180
-						$payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
178
+				foreach ($active_pms as $payment_method) {
179
+					try {
180
+						$payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
181 181
 						EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment);
182 182
 						break;
183
-					} catch( EE_Error $e ) {
183
+					} catch (EE_Error $e) {
184 184
 						//that's fine- it apparently couldn't handle the IPN
185 185
 					}
186 186
 				}
187 187
 
188 188
 			}
189 189
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
190
-			if( $payment instanceof EE_Payment){
190
+			if ($payment instanceof EE_Payment) {
191 191
 				$payment->save();
192 192
 				//  update the TXN
193
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, true );
194
-			}else{
193
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, true);
194
+			} else {
195 195
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
196
-				if($payment_method){
196
+				if ($payment_method) {
197 197
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
198
-				}elseif($transaction){
198
+				}elseif ($transaction) {
199 199
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
200 200
 				}
201 201
 			}
202 202
 			return $payment;
203 203
 
204
-		} catch( EE_Error $e ) {
204
+		} catch (EE_Error $e) {
205 205
 			do_action(
206 206
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
207 207
 					"Error occurred while receiving IPN. Transaction: %s, req data: %s. The error was '%s'",
208
-					print_r( $transaction, TRUE ),
209
-					print_r( $_req_data, TRUE ),
208
+					print_r($transaction, TRUE),
209
+					print_r($_req_data, TRUE),
210 210
 					$e->getMessage()
211 211
 				)
212 212
 			);
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 * @throws \EE_Error
231 231
 	 * @return EE_Payment
232 232
 	 */
233
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
233
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
234 234
 		/** @var $transaction EE_Transaction */
235
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
235
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
236 236
 		$last_payment_method = $transaction->payment_method();
237
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
238
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
239
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
237
+		if ($last_payment_method instanceof EE_Payment_Method) {
238
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
239
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
240 240
 			return $payment;
241 241
 		} else {
242 242
 			return NULL;
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 	 * @internal param float $amount
254 254
 	 * @return EE_Payment
255 255
 	 */
256
-	public function process_refund( $payment_method, $payment_to_refund, $refund_info = array() ){
256
+	public function process_refund($payment_method, $payment_to_refund, $refund_info = array()) {
257 257
 		/** @type EE_Payment_Method $payment_method */
258 258
 		$payment_method = EEM_Payment_Method::instance()->ensure_is_ID($payment_method);
259
-		if ( $payment_method->type_obj()->supports_sending_refunds() ) {
260
-			$payment_method->do_direct_refund( $payment_to_refund,$refund_info );
261
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
259
+		if ($payment_method->type_obj()->supports_sending_refunds()) {
260
+			$payment_method->do_direct_refund($payment_to_refund, $refund_info);
261
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
262 262
 		}
263 263
 		return $payment_to_refund;
264 264
 	}
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
 	 *                        TXN is locked before updating
295 295
 	 * @throws \EE_Error
296 296
 	 */
297
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
297
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
298 298
 		$do_action = FALSE;
299 299
 		/** @type EE_Transaction $transaction */
300
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
300
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
301 301
 		// can we freely update the TXN at this moment?
302
-		if ( $IPN && $transaction->is_locked() ) {
302
+		if ($IPN && $transaction->is_locked()) {
303 303
 			// don't update the transaction at this exact moment
304 304
 			// because the TXN is active in another request
305 305
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 			);
310 310
 		} else {
311 311
 			// verify payment
312
-			if ( $payment instanceof EE_Payment ) {
313
-				if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){
314
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
312
+			if ($payment instanceof EE_Payment) {
313
+				if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) {
314
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
315 315
 				}
316 316
 				// we need to save this payment in order for transaction to be updated correctly
317 317
 				// because it queries the DB to find the total amount paid, and saving puts the payment into the DB
@@ -330,23 +330,23 @@  discard block
 block discarded – undo
330 330
 						'PMD_ID' 				=> $transaction->payment_method_ID()
331 331
 					)
332 332
 				);
333
-				$transaction->set_status( EEM_Transaction::incomplete_status_code );
333
+				$transaction->set_status(EEM_Transaction::incomplete_status_code);
334 334
 				// send out notifications
335
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
335
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
336 336
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
337 337
 			}
338
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
338
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
339 339
 				/** @type EE_Transaction_Payments $transaction_payments */
340
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
340
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
341 341
 				// set new value for total paid
342
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
342
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
343 343
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
344
-				if ( $update_txn ) {
345
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
344
+				if ($update_txn) {
345
+					$this->_post_payment_processing($transaction, $payment, $IPN);
346 346
 				}
347 347
 				// and set a hook point for others to use?
348
-				if ( $do_action ) {
349
-					do_action( $do_action, $transaction, $payment );
348
+				if ($do_action) {
349
+					do_action($do_action, $transaction, $payment);
350 350
 				}
351 351
 			}
352 352
 		}
@@ -365,40 +365,40 @@  discard block
 block discarded – undo
365 365
 	 * @param EE_Payment     $payment
366 366
 	 * @param bool           $IPN
367 367
 	 */
368
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
368
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
369 369
 		/** @type EE_Transaction_Processor $transaction_processor */
370
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
370
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
371 371
 		// is the Payment Options Reg Step completed ?
372
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
372
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
373 373
 		// if the Payment Options Reg Step is completed...
374 374
 		$revisit = $payment_options_step_completed !== false ? true : false;
375 375
 		// then this is kinda sorta a revisit with regards to payments at least
376
-		$transaction_processor->set_revisit( $revisit );
376
+		$transaction_processor->set_revisit($revisit);
377 377
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
378 378
 		if (
379 379
 			$IPN &&
380 380
 			$payment_options_step_completed !== true &&
381
-			( $payment->is_approved() || $payment->is_pending() )
381
+			($payment->is_approved() || $payment->is_pending())
382 382
 		) {
383
-			$transaction_processor->set_reg_step_completed( $transaction, 'payment_options' );
383
+			$transaction_processor->set_reg_step_completed($transaction, 'payment_options');
384 384
 		}
385 385
 		// DEBUG LOG
386 386
 		//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
387 387
 		/** @type EE_Transaction_Payments $transaction_payments */
388
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
388
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
389 389
 		// maybe update status, but don't save transaction just yet
390
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
390
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
391 391
 		//check if enough Reg Steps have been completed to warrant finalizing the TXN
392
-		$finalized = $transaction_processor->all_reg_steps_completed_except_final_step( $transaction );
392
+		$finalized = $transaction_processor->all_reg_steps_completed_except_final_step($transaction);
393 393
 		//  if this is an IPN and the final step has not been initiated
394
-		if ( $IPN && $finalized === false ) {
394
+		if ($IPN && $finalized === false) {
395 395
 			// and if it hasn't already been set as being started...
396
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
396
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
397 397
 		}
398 398
 		// because the above will return false if the final step was not fully completed, we need to check again...
399
-		if ( $IPN && $finalized ) {
399
+		if ($IPN && $finalized) {
400 400
 			// and if we are all good to go, then send out notifications
401
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
401
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
402 402
 			// DEBUG LOG
403 403
 			//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
404 404
 		}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		//	)
419 419
 		//);
420 420
 		//ok, now process the transaction according to the payment
421
-		$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
421
+		$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
422 422
 	}
423 423
 
424 424
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 		EE_Processor_Base::set_IPN( true );
139 139
 		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
140 140
 			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
141
-		}elseif( $payment_method instanceof EE_Payment ){
141
+		} elseif( $payment_method instanceof EE_Payment ){
142 142
 			$obj_for_log = $payment_method;
143
-		}elseif( $transaction instanceof EE_Transaction ){
143
+		} elseif( $transaction instanceof EE_Transaction ){
144 144
 			$obj_for_log = $transaction;
145
-		}else{
145
+		} else{
146 146
 			$obj_for_log = null;
147 147
 		}
148 148
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 						__FILE__, __FUNCTION__, __LINE__
171 171
 					);
172 172
 				}
173
-			}else{
173
+			} else{
174 174
 				//that's actually pretty ok. The IPN just wasn't able
175 175
 				//to identify which transaction or payment method this was for
176 176
 				// give all active payment methods a chance to claim it
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 				$payment->save();
192 192
 				//  update the TXN
193 193
 				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, true );
194
-			}else{
194
+			} else{
195 195
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
196 196
 				if($payment_method){
197 197
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
198
-				}elseif($transaction){
198
+				} elseif($transaction){
199 199
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
200 200
 				}
201 201
 			}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php 2 patches
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
308 308
 					$num_records_actually_migrated += $records_migrated_during_stage;
309 309
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
310
-				}catch(Exception $e){
310
+				} catch(Exception $e){
311 311
 					//yes if we catch an exception here, we consider that migration stage borked.
312 312
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
313 313
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 			//this migration script apparently has NO stages... which is super weird, but whatever
334 334
 			$this->set_completed();
335 335
 			$this->_maybe_do_schema_changes(false);
336
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
336
+		} else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
337 337
 			//apparently we're done, because we couldn't migrate the number we intended to
338 338
 			$this->set_completed();
339 339
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
340 340
 			//do schema changes for after the migration now
341 341
 			//first double-check we haven't already done this
342 342
 			$this->_maybe_do_schema_changes(false);
343
-		}else{
343
+		} else{
344 344
 			//update feedback message, keeping in mind that we show them with the most recent at the top
345 345
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
346 346
 		}
@@ -379,12 +379,12 @@  discard block
 block discarded – undo
379 379
 				ob_start();
380 380
 				if($before){
381 381
 					$this->schema_changes_before_migration();
382
-				}else{
382
+				} else{
383 383
 					$this->schema_changes_after_migration();
384 384
 				}
385 385
 				$output = ob_get_contents();
386 386
 				ob_end_clean();
387
-			}catch(Exception $e){
387
+			} catch(Exception $e){
388 388
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
389 389
 				throw $e;
390 390
 			}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 				EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
426 426
 		if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $currently_migrating ){
427 427
 			$drop_pre_existing_tables = true;
428
-		}else{
428
+		} else{
429 429
 			$drop_pre_existing_tables = false;
430 430
 		}
431 431
 		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 
449 449
 		if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
450 450
 			$drop_pre_existing_tables = true;
451
-		}else{
451
+		} else{
452 452
 			$drop_pre_existing_tables = false;
453 453
 		}
454 454
 		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		EE_Registry::instance()->load_helper('Activation');
466 466
 		try{
467 467
 			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
468
-		}catch( EE_Error $e ) {
468
+		} catch( EE_Error $e ) {
469 469
 			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
470 470
 			$this->add_error( $message  );
471 471
 			$this->_feedback_message .= $message;
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
483 483
 		if($this->slug() == 'Core'){
484 484
 			return EE_System::instance()->detect_req_type();
485
-		}else{//it must be for an addon
485
+		} else{//it must be for an addon
486 486
 			$addon_name = $this->slug();
487 487
 			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
488 488
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
489
-			}else{
489
+			} else{
490 490
 				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
491 491
 			}
492 492
 		}
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	 * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences!
118 118
 	 */
119 119
 	public function __construct() {
120
-		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages);
121
-		foreach($this->_migration_stages as $migration_stage){
122
-			if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) {
120
+		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages);
121
+		foreach ($this->_migration_stages as $migration_stage) {
122
+			if ($migration_stage instanceof EE_Data_Migration_Script_Stage) {
123 123
 				$migration_stage->_construct_finalize($this);
124 124
 			}
125 125
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * Place to add hooks and filters for tweaking the migrations page, in order
133 133
 	 * to customize it
134 134
 	 */
135
-	public function migration_page_hooks(){
135
+	public function migration_page_hooks() {
136 136
 		//by default none are added because we normally like the default look of the migration page
137 137
 	}
138 138
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @param int|string $new_pk eg posts.ID
148 148
 	 * @return void
149 149
 	 */
150
-	public function set_mapping($old_table,$old_pk,$new_table,$new_pk){
150
+	public function set_mapping($old_table, $old_pk, $new_table, $new_pk) {
151 151
 		//make sure it has the needed keys
152
-		if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){
152
+		if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) {
153 153
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
154 154
 		}
155 155
 		$this->_mappings[$old_table][$new_table][$old_pk] = $new_pk;
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts
166 166
 	 * @return mixed the primary key on the new table
167 167
 	 */
168
-	public function get_mapping_new_pk($old_table,$old_pk,$new_table){
169
-		if( ! isset($this->_mappings[$old_table]) ||
170
-			! isset($this->_mappings[$old_table][$new_table])){
168
+	public function get_mapping_new_pk($old_table, $old_pk, $new_table) {
169
+		if ( ! isset($this->_mappings[$old_table]) ||
170
+			! isset($this->_mappings[$old_table][$new_table])) {
171 171
 			//try fetching the option
172 172
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
173 173
 		}
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 	 * @param mixed $new_pk
185 185
 	 * @return mixed
186 186
 	 */
187
-	public function get_mapping_old_pk($old_table,$new_table,$new_pk){
188
-		if( ! isset($this->_mappings[$old_table]) ||
189
-			! isset($this->_mappings[$old_table][$new_table])){
187
+	public function get_mapping_old_pk($old_table, $new_table, $new_pk) {
188
+		if ( ! isset($this->_mappings[$old_table]) ||
189
+			! isset($this->_mappings[$old_table][$new_table])) {
190 190
 			//try fetching the option
191 191
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
192 192
 		}
193
-		if(isset($this->_mappings[$old_table][$new_table])){
193
+		if (isset($this->_mappings[$old_table][$new_table])) {
194 194
 			$new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]);
195
-			if(isset($new_pk_to_old_pk[$new_pk])){
195
+			if (isset($new_pk_to_old_pk[$new_pk])) {
196 196
 				return $new_pk_to_old_pk[$new_pk];
197 197
 			}
198 198
 		}
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $new_table_name
208 208
 	 * @return array
209 209
 	 */
210
-	protected function _get_mapping_option($old_table_name,$new_table_name){
211
-		$option =  get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array());
210
+	protected function _get_mapping_option($old_table_name, $new_table_name) {
211
+		$option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array());
212 212
 		return $option;
213 213
 	}
214 214
 
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	 * @param array $mapping_array
222 222
 	 * @return boolean success of updating option
223 223
 	 */
224
-	protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){
224
+	protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) {
225 225
 //		echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>";
226
-		$success =  update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array);
226
+		$success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array);
227 227
 		return $success;
228 228
 	}
229 229
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param string $new_table_name
236 236
 	 * @return string
237 237
 	 */
238
-	protected function _get_mapping_option_name($old_table_name,$new_table_name){
238
+	protected function _get_mapping_option_name($old_table_name, $new_table_name) {
239 239
 		global $wpdb;
240
-		$old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name);
241
-		$new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name);
240
+		$old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name);
241
+		$new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name);
242 242
 		$migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
243
-		return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 );
243
+		return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64);
244 244
 	}
245 245
 
246 246
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete.
258 258
 	 * @return int
259 259
 	 */
260
-	protected function _count_records_to_migrate(){
260
+	protected function _count_records_to_migrate() {
261 261
 		$count = 0;
262
-		foreach($this->stages() as $stage){
263
-			$count+= $stage->count_records_to_migrate();
262
+		foreach ($this->stages() as $stage) {
263
+			$count += $stage->count_records_to_migrate();
264 264
 		}
265 265
 		return $count;
266 266
 	}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 	 * by just setting a transient and updating it after each migration_step
273 273
 	 * @return int
274 274
 	 */
275
-	public function count_records_migrated(){
275
+	public function count_records_migrated() {
276 276
 		$count = 0;
277
-		foreach($this->stages() as $stage){
278
-			$count+= $stage->count_records_migrated();
277
+		foreach ($this->stages() as $stage) {
278
+			$count += $stage->count_records_migrated();
279 279
 		}
280 280
 		$this->_records_migrated = $count;
281 281
 		return $count;
@@ -289,24 +289,24 @@  discard block
 block discarded – undo
289 289
 	 * @throws EE_Error
290 290
 	 * @throws Exception
291 291
 	 */
292
-	public function migration_step($num_records_to_migrate_limit){
292
+	public function migration_step($num_records_to_migrate_limit) {
293 293
 		//reset the feedback message
294 294
 		$this->_feedback_message = '';
295 295
 		//if we haven't yet done the 1st schema changes, do them now. buffer any output
296 296
 		$this->_maybe_do_schema_changes(true);
297 297
 
298
-		$num_records_actually_migrated =0;
298
+		$num_records_actually_migrated = 0;
299 299
 		$records_migrated_per_stage = array();
300 300
 		//setup the 'stage' variable, which should hold the last run stage of the migration  (or none at all if nothing runs)
301 301
 		$stage = null;
302 302
 		//get the next stage that isn't complete
303
-		foreach($this->stages() as $stage){
304
-			if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){
305
-				try{
303
+		foreach ($this->stages() as $stage) {
304
+			if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) {
305
+				try {
306 306
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
307 307
 					$num_records_actually_migrated += $records_migrated_during_stage;
308 308
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
309
-				}catch(Exception $e){
309
+				} catch (Exception $e) {
310 310
 					//yes if we catch an exception here, we consider that migration stage borked.
311 311
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
312 312
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 					throw $e;
315 315
 				}
316 316
 				//check that the migration stage didn't mark itself as having a fatal error
317
-				if($stage->is_broken()){
317
+				if ($stage->is_broken()) {
318 318
 					$this->set_broken();
319 319
 					throw new EE_Error($stage->get_last_error());
320 320
 				}
@@ -322,24 +322,24 @@  discard block
 block discarded – undo
322 322
 			//once we've migrated all the number we intended to (possibly from different stages), stop migrating
323 323
 			//or if we had a fatal error
324 324
 			//or if the current script stopped early- its not done, but it's done all it thinks we should do on this step
325
-			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){
325
+			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) {
326 326
 				break;
327 327
 			}
328 328
 		}
329 329
 		//check if we're all done this data migration...
330 330
 		//which is indicated by being done early AND the last stage claims to be done
331
-		if($stage == NULL){
331
+		if ($stage == NULL) {
332 332
 			//this migration script apparently has NO stages... which is super weird, but whatever
333 333
 			$this->set_completed();
334 334
 			$this->_maybe_do_schema_changes(false);
335
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
335
+		} else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) {
336 336
 			//apparently we're done, because we couldn't migrate the number we intended to
337 337
 			$this->set_completed();
338 338
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
339 339
 			//do schema changes for after the migration now
340 340
 			//first double-check we haven't already done this
341 341
 			$this->_maybe_do_schema_changes(false);
342
-		}else{
342
+		} else {
343 343
 			//update feedback message, keeping in mind that we show them with the most recent at the top
344 344
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
345 345
 		}
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
 	 * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage
354 354
 	 * @return void
355 355
 	 */
356
-	private function _update_feedback_message($records_migrated_per_stage){
356
+	private function _update_feedback_message($records_migrated_per_stage) {
357 357
 		$feedback_message_array = array();
358
-		foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){
359
-			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ;
358
+		foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) {
359
+			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name);
360 360
 		}
361
-		$this->_feedback_message .= implode("<br>",$feedback_message_array);
361
+		$this->_feedback_message .= implode("<br>", $feedback_message_array);
362 362
 	}
363 363
 
364 364
 
@@ -370,27 +370,27 @@  discard block
 block discarded – undo
370 370
 	 * @throws Exception
371 371
 	 * @return void
372 372
 	 */
373
-	private function _maybe_do_schema_changes($before = true){
373
+	private function _maybe_do_schema_changes($before = true) {
374 374
 		//so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran
375
-		$property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran';
376
-		if ( ! $this->$property_name ){
377
-			try{
375
+		$property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran';
376
+		if ( ! $this->$property_name) {
377
+			try {
378 378
 				ob_start();
379
-				if($before){
379
+				if ($before) {
380 380
 					$this->schema_changes_before_migration();
381
-				}else{
381
+				} else {
382 382
 					$this->schema_changes_after_migration();
383 383
 				}
384 384
 				$output = ob_get_contents();
385 385
 				ob_end_clean();
386
-			}catch(Exception $e){
386
+			} catch (Exception $e) {
387 387
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
388 388
 				throw $e;
389 389
 			}
390 390
 			//record that we've done these schema changes
391 391
 			$this->$property_name = true;
392 392
 			//if there were any warnings etc, record them as non-fatal errors
393
-			if( $output ){
393
+			if ($output) {
394 394
 				//there were some warnings
395 395
 				$this->_errors[] = $output;
396 396
 			}
@@ -417,17 +417,17 @@  discard block
 block discarded – undo
417 417
 	 * @param string $table_definition_sql
418 418
 	 * @param string $engine_string
419 419
 	 */
420
-	protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){
420
+	protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') {
421 421
 		//we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM)
422 422
 		$currently_migrating = $this->_migrating &&
423
-				$this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) &&
423
+				$this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) &&
424 424
 				EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
425
-		if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $currently_migrating ){
425
+		if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $currently_migrating) {
426 426
 			$drop_pre_existing_tables = true;
427
-		}else{
427
+		} else {
428 428
 			$drop_pre_existing_tables = false;
429 429
 		}
430
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
430
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
431 431
 	}
432 432
 
433 433
 
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
 	 * @param string $table_definition_sql
444 444
 	 * @param string $engine_string
445 445
 	 */
446
-	protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
446
+	protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
447 447
 
448
-		if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
448
+		if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) {
449 449
 			$drop_pre_existing_tables = true;
450
-		}else{
450
+		} else {
451 451
 			$drop_pre_existing_tables = false;
452 452
 		}
453
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
453
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
454 454
 	}
455 455
 
456 456
 	/**
@@ -460,13 +460,13 @@  discard block
 block discarded – undo
460 460
 	 * @param string $engine_string
461 461
 	 * @param boolean $drop_pre_existing_tables
462 462
 	 */
463
-	private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){
463
+	private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) {
464 464
 		EE_Registry::instance()->load_helper('Activation');
465
-		try{
466
-			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
467
-		}catch( EE_Error $e ) {
468
-			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
469
-			$this->add_error( $message  );
465
+		try {
466
+			EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
467
+		} catch (EE_Error $e) {
468
+			$message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString();
469
+			$this->add_error($message);
470 470
 			$this->_feedback_message .= $message;
471 471
 		}
472 472
 	}
@@ -478,15 +478,15 @@  discard block
 block discarded – undo
478 478
 	 * @return int one of EE_System::_req_type_* constants
479 479
 	 * @throws EE_Error
480 480
 	 */
481
-	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
482
-		if($this->slug() == 'Core'){
481
+	private function _get_req_type_for_plugin_corresponding_to_this_dms() {
482
+		if ($this->slug() == 'Core') {
483 483
 			return EE_System::instance()->detect_req_type();
484
-		}else{//it must be for an addon
484
+		} else {//it must be for an addon
485 485
 			$addon_name = $this->slug();
486
-			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
486
+			if (EE_Registry::instance()->get_addon_by_name($addon_name)) {
487 487
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
488
-			}else{
489
-				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
488
+			} else {
489
+				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name()))));
490 490
 			}
491 491
 		}
492 492
 	}
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 	 * returns an array of strings describing errors by all the script's stages
498 498
 	 * @return array
499 499
 	 */
500
-	public function get_errors(){
500
+	public function get_errors() {
501 501
 		$all_errors = $this->_errors;
502
-		if( ! is_array($all_errors)){
502
+		if ( ! is_array($all_errors)) {
503 503
 			$all_errors = array();
504 504
 		}
505
-		foreach($this->stages() as $stage){
506
-			$all_errors = array_merge($stage->get_errors(),$all_errors);
505
+		foreach ($this->stages() as $stage) {
506
+			$all_errors = array_merge($stage->get_errors(), $all_errors);
507 507
 		}
508 508
 		return $all_errors;
509 509
 	}
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * Indicates whether or not this migration script should continue
515 515
 	 * @return boolean
516 516
 	 */
517
-	public function can_continue(){
518
-		return in_array($this->get_status(),  EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
517
+	public function can_continue() {
518
+		return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
519 519
 	}
520 520
 
521 521
 
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 * get ordered by the indexes
528 528
 	 * @return EE_Data_Migration_Script_Stage[]
529 529
 	 */
530
-	protected function stages(){
531
-		$stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages );
530
+	protected function stages() {
531
+		$stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages);
532 532
 		ksort($stages);
533 533
 		return $stages;
534 534
 	}
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 * can be displayed to the user
541 541
 	 * @return string
542 542
 	 */
543
-	public function get_feedback_message(){
543
+	public function get_feedback_message() {
544 544
 		return $this->_feedback_message;
545 545
 	}
546 546
 
@@ -552,16 +552,16 @@  discard block
 block discarded – undo
552 552
 	 * possible that this class is defined when it goes to sleep, but NOT available when it
553 553
 	 * awakes (eg, this class is part of an addon that is deactivated at some point).
554 554
 	 */
555
-	public function properties_as_array(){
555
+	public function properties_as_array() {
556 556
 		$properties = parent::properties_as_array();
557 557
 		$properties['_migration_stages'] = array();
558
-		foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){
558
+		foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) {
559 559
 			$properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array();
560 560
 		}
561 561
 		unset($properties['_mappings']);
562 562
 
563
-		foreach($this->_mappings as $old_table_name => $mapping_to_new_table){
564
-			foreach($mapping_to_new_table as $new_table_name => $mapping){
563
+		foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) {
564
+			foreach ($mapping_to_new_table as $new_table_name => $mapping) {
565 565
 				$this->_set_mapping_option($old_table_name, $new_table_name, $mapping);
566 566
 			}
567 567
 		}
@@ -576,19 +576,19 @@  discard block
 block discarded – undo
576 576
 	 * @param array $array_of_properties like what's produced from properties_as_array() method
577 577
 	 * @return void
578 578
 	 */
579
-	public function instantiate_from_array_of_properties($array_of_properties){
579
+	public function instantiate_from_array_of_properties($array_of_properties) {
580 580
 		$stages_properties_arrays = $array_of_properties['_migration_stages'];
581 581
 		unset($array_of_properties['_migration_stages']);
582 582
 		unset($array_of_properties['class']);
583
-		foreach($array_of_properties as $property_name => $property_value){
583
+		foreach ($array_of_properties as $property_name => $property_value) {
584 584
 			$this->$property_name = $property_value;
585 585
 		}
586 586
 		//_migration_stages are already instantiated, but have only default data
587
-		foreach($this->_migration_stages as $stage){
588
-			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays);
587
+		foreach ($this->_migration_stages as $stage) {
588
+			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays);
589 589
 			//SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by
590 590
 			//an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet)
591
-			if($stage_data){
591
+			if ($stage_data) {
592 592
 				$stage->instantiate_from_array_of_properties($stage_data);
593 593
 			}
594 594
 		}
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 	 * @param array $migration_stage_data_arrays
605 605
 	 * @return null
606 606
 	 */
607
-	private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){
608
-		foreach($migration_stage_data_arrays as $migration_stage_data_array){
609
-			if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){
607
+	private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) {
608
+		foreach ($migration_stage_data_arrays as $migration_stage_data_array) {
609
+			if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) {
610 610
 				return $migration_stage_data_array;
611 611
 			}
612 612
 		}
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 	 * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin
623 623
 	 * that will be updated to. Eg array('Core','4.1.0')
624 624
 	 */
625
-	public final function migrates_to_version(){
626
-		return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) );
625
+	public final function migrates_to_version() {
626
+		return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
627 627
 	}
628 628
 
629 629
 
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 	 * Or 'Core' for core (non-addon).
636 636
 	 * @return string
637 637
 	 */
638
-	public function slug(){
638
+	public function slug() {
639 639
 		$migrates_to_version_info = $this->migrates_to_version();
640 640
 		//the slug is the first part of the array
641
-		return $migrates_to_version_info[ 'slug' ];
641
+		return $migrates_to_version_info['slug'];
642 642
 	}
643 643
 
644 644
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 * the database up so it can run), then you can set "A" to priority 3 or something.
653 653
 	 * @return int
654 654
 	 */
655
-	public function priority(){
655
+	public function priority() {
656 656
 		return $this->_priority;
657 657
 	}
658 658
 
@@ -665,18 +665,18 @@  discard block
 block discarded – undo
665 665
 	 * @param boolean $migrating
666 666
 	 * @return void
667 667
 	 */
668
-	public function set_migrating( $migrating = TRUE ){
668
+	public function set_migrating($migrating = TRUE) {
669 669
 		$this->_migrating = $migrating;
670 670
 	}
671 671
 
672 672
 	/**
673 673
 	 * Marks that we think this migration class can continue to migrate
674 674
 	 */
675
-	public function reattempt(){
675
+	public function reattempt() {
676 676
 		parent::reattempt();
677 677
 		//also, we want to reattempt any stages that were marked as borked
678
-		foreach( $this->stages() as $stage ) {
679
-			if( $stage->is_broken() ) {
678
+		foreach ($this->stages() as $stage) {
679
+			if ($stage->is_broken()) {
680 680
 				$stage->reattempt();
681 681
 			}
682 682
 		}
Please login to merge, or discard this patch.
core/db_classes/EE_Currency.class.php 2 patches
Spacing   +9 added lines, -9 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
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_Currency extends EE_Base_Class{
28
+class EE_Currency extends EE_Base_Class {
29 29
 	
30 30
 		/** Currency COde @var CUR_code*/ protected $_CUR_code = NULL;
31 31
 		/** Currency Name Singular @var CUR_single*/ protected $_CUR_single = NULL;
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 * @param type $props_n_values
40 40
 	 * @return EE_Answer
41 41
 	 */
42
-	public static function new_instance( $props_n_values = array() ) {
42
+	public static function new_instance($props_n_values = array()) {
43 43
 		$classname = __CLASS__;
44
-		$has_object = parent::_check_for_object( $props_n_values, $classname );
44
+		$has_object = parent::_check_for_object($props_n_values, $classname);
45 45
 //		d( $has_object );
46
-		return $has_object ? $has_object : new self( $props_n_values);
46
+		return $has_object ? $has_object : new self($props_n_values);
47 47
 	}
48 48
 
49 49
 	/**
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	 * @param type $props_n_values
52 52
 	 * @return EE_Answer
53 53
 	 */
54
-	public static function new_instance_from_db ( $props_n_values = array() ) {
54
+	public static function new_instance_from_db($props_n_values = array()) {
55 55
 		$classname = __CLASS__;
56 56
 //		$mapped_object = parent::_get_object_from_entity_mapper($props_n_values, $classname);
57 57
 //		d( $mapped_object );
58 58
 //		return $mapped_object ? $mapped_object : new self( $props_n_values, TRUE );
59
-		return new self( $props_n_values, TRUE );
59
+		return new self($props_n_values, TRUE);
60 60
 	}
61 61
 	/**
62 62
 	 * Gets code
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * Gets a prettier name
159 159
 	 * @return string
160 160
 	 */
161
-	function name(){
162
-		return sprintf(__("%s (%s)", "event_espresso"),$this->code(),$this->plural_name());
161
+	function name() {
162
+		return sprintf(__("%s (%s)", "event_espresso"), $this->code(), $this->plural_name());
163 163
 	}
164 164
 
165 165
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 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 7
 /**
7 8
  * Event Espresso
Please login to merge, or discard this patch.