Completed
Branch FET-8162-relation-exists (8f4753)
by
unknown
32:32 queued 23:52
created
core/helpers/EEH_Parse_Shortcodes.helper.php 2 patches
Spacing   +38 added lines, -38 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
 /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param INT 					 $GRP_ID 	       The message template grp_id for the specific template being parsed.
84 84
 	 * @return string                   The parsed template string
85 85
 	 */
86
-	public function parse_message_template( $template, EE_Messages_Addressee $data, $valid_shortcodes, EE_message_type $message_type, EE_messenger $messenger, $context, $GRP_ID ) {
86
+	public function parse_message_template($template, EE_Messages_Addressee $data, $valid_shortcodes, EE_message_type $message_type, EE_messenger $messenger, $context, $GRP_ID) {
87 87
 		$extra_data = array(
88 88
 			'messenger' => $messenger,
89 89
 			'message_type' => $message_type,
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			'GRP_ID' => $GRP_ID
92 92
 			);
93 93
 
94
-		$this->_init_data( $template, $data, $valid_shortcodes, $extra_data );
94
+		$this->_init_data($template, $data, $valid_shortcodes, $extra_data);
95 95
 
96 96
 
97 97
 		$this->_template = is_array($template) ? $template['main'] : $template;
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 
104 104
 
105
-	public function parse_attendee_list_template( $template, EE_Registration $registration, $valid_shortcodes, $extra_data = array() ) {
105
+	public function parse_attendee_list_template($template, EE_Registration $registration, $valid_shortcodes, $extra_data = array()) {
106 106
 
107
-		$this->_init_data( $template, $registration, $valid_shortcodes, $extra_data );
107
+		$this->_init_data($template, $registration, $valid_shortcodes, $extra_data);
108 108
 
109 109
 		$this->_template = is_array($template) ? $template['attendee_list'] : $template;
110 110
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 		return $parsed;
113 113
 	}
114 114
 
115
-	public function parse_event_list_template( $template, EE_Event $event, $valid_shortcodes, $extra_data = array() ) {
116
-		$this->_init_data( $template, $event, $valid_shortcodes, $extra_data );
115
+	public function parse_event_list_template($template, EE_Event $event, $valid_shortcodes, $extra_data = array()) {
116
+		$this->_init_data($template, $event, $valid_shortcodes, $extra_data);
117 117
 
118 118
 		$this->_template = is_array($template) ? $template['event_list'] : $template;
119 119
 
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 
124 124
 
125
-	public function parse_ticket_list_template( $template, EE_Ticket $ticket, $valid_shortcodes, $extra_data = array() ) {
126
-		$this->_init_data( $template, $ticket, $valid_shortcodes, $extra_data );
125
+	public function parse_ticket_list_template($template, EE_Ticket $ticket, $valid_shortcodes, $extra_data = array()) {
126
+		$this->_init_data($template, $ticket, $valid_shortcodes, $extra_data);
127 127
 
128 128
 		$this->_template = is_array($template) ? $template['ticket_list'] : $template;
129 129
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 
134 134
 
135 135
 
136
-	public function parse_line_item_list_template( $template, EE_Line_Item $line_item, $valid_shortcodes, $extra_data = array() ) {
137
-		$this->_init_data( $template, $line_item, $valid_shortcodes, $extra_data );
138
-		$this->_template = is_array( $template ) ? $template['ticket_line_item_no_pms'] : $template;
136
+	public function parse_line_item_list_template($template, EE_Line_Item $line_item, $valid_shortcodes, $extra_data = array()) {
137
+		$this->_init_data($template, $line_item, $valid_shortcodes, $extra_data);
138
+		$this->_template = is_array($template) ? $template['ticket_line_item_no_pms'] : $template;
139 139
 
140 140
 		$parsed = $this->_parse_message_template();
141 141
 		return $parsed;
142 142
 	}
143 143
 
144 144
 
145
-	public function parse_payment_list_template( $template, EE_Payment $payment_item, $valid_shortcodes, $extra_data = array() ) {
146
-		$this->_init_data( $template, $payment_item, $valid_shortcodes, $extra_data );
147
-		$this->_template = is_array( $template ) ? $template['payment_list'] : $template;
145
+	public function parse_payment_list_template($template, EE_Payment $payment_item, $valid_shortcodes, $extra_data = array()) {
146
+		$this->_init_data($template, $payment_item, $valid_shortcodes, $extra_data);
147
+		$this->_template = is_array($template) ? $template['payment_list'] : $template;
148 148
 
149 149
 		$parsed = $this->_parse_message_template();
150 150
 		return $parsed;
151 151
 	}
152 152
 
153 153
 
154
-	public function parse_datetime_list_template( $template, EE_Datetime $datetime, $valid_shortcodes, $extra_data = array() ) {
155
-		$this->_init_data( $template, $datetime, $valid_shortcodes, $extra_data );
154
+	public function parse_datetime_list_template($template, EE_Datetime $datetime, $valid_shortcodes, $extra_data = array()) {
155
+		$this->_init_data($template, $datetime, $valid_shortcodes, $extra_data);
156 156
 
157 157
 		$this->_template = is_array($template) ? $template['datetime_list'] : $template;
158 158
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	}
162 162
 
163 163
 
164
-	public function parse_question_list_template( $template, EE_Answer $answer, $valid_shortcodes, $extra_data = array() ) {
165
-		$this->_init_data( $template, $answer, $valid_shortcodes, $extra_data );
164
+	public function parse_question_list_template($template, EE_Answer $answer, $valid_shortcodes, $extra_data = array()) {
165
+		$this->_init_data($template, $answer, $valid_shortcodes, $extra_data);
166 166
 
167 167
 		$this->_template = is_array($template) ? $template['question_list'] : $template;
168 168
 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 
174
-	private function _init_data( $template, $data, $valid_shortcodes, $extra_data = array() ) {
174
+	private function _init_data($template, $data, $valid_shortcodes, $extra_data = array()) {
175 175
 		$this->_reset_props();
176 176
 		$this->_data['template'] = $template;
177 177
 		$this->_data['data'] = $data;
178 178
 		$this->_data['extra_data'] = $extra_data;
179 179
 
180
-		$this->_set_shortcodes( $valid_shortcodes );
180
+		$this->_set_shortcodes($valid_shortcodes);
181 181
 	}
182 182
 
183 183
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 
198 198
 		//now let's get a list of shortcodes that are found in the given template
199
-		$possible_shortcodes = preg_match_all( '/(\[.+?\])/', $this->_template, $matches );
199
+		$possible_shortcodes = preg_match_all('/(\[.+?\])/', $this->_template, $matches);
200 200
 		$shortcodes = (array) $matches[0]; //this should be an array of shortcodes in the template string.
201 201
 
202 202
 		$matched_code = array();
@@ -221,31 +221,31 @@  discard block
 block discarded – undo
221 221
 			'[PAYMENT_LIST_*]'
222 222
 			);
223 223
 
224
-		$list_type_shortcodes = apply_filters( 'FHEE__EEH_Parse_Shortcodes___parse_message_template__list_type_shortcodes', $list_type_shortcodes );
224
+		$list_type_shortcodes = apply_filters('FHEE__EEH_Parse_Shortcodes___parse_message_template__list_type_shortcodes', $list_type_shortcodes);
225 225
 
226 226
 		//now lets go ahead and loop through our parsers for each shortcode and setup the values
227
-		foreach ( $shortcodes as $shortcode ) {
227
+		foreach ($shortcodes as $shortcode) {
228 228
 
229
-			foreach ( $this->_shortcode_objs as $sc_obj ) {
229
+			foreach ($this->_shortcode_objs as $sc_obj) {
230 230
 				$data_send = '';
231 231
 
232 232
 				//we need to setup any dynamic shortcodes so that they work with the array_key_exists
233
-				$sc = preg_match_all( '/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches );
234
-				$sc_to_verify = !empty($matches[0] ) ? $matches[0][0] . ']' : $shortcode;
233
+				$sc = preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches);
234
+				$sc_to_verify = ! empty($matches[0]) ? $matches[0][0].']' : $shortcode;
235 235
 
236
-				if ( !array_key_exists( $sc_to_verify, $sc_obj->get_shortcodes() ) ) {
236
+				if ( ! array_key_exists($sc_to_verify, $sc_obj->get_shortcodes())) {
237 237
 					continue; //the given shortcode isn't in this object
238 238
 				}
239 239
 
240 240
 				//if this isn't  a "list" type shortcode then we'll send along the data vanilla instead of in an array.
241
-				if ( ! in_array( $sc_to_verify, $list_type_shortcodes ) ) {
242
-					$data_send = !is_object($this->_data) && isset($this->_data['data']) ? $this->_data['data'] : $this->_data;
241
+				if ( ! in_array($sc_to_verify, $list_type_shortcodes)) {
242
+					$data_send = ! is_object($this->_data) && isset($this->_data['data']) ? $this->_data['data'] : $this->_data;
243 243
 				} else {
244 244
 					$data_send = $this->_data;
245 245
 				}
246 246
 
247 247
 
248
-				$parsed = $sc_obj->parser( $shortcode, $data_send, $this->_data['extra_data'] );
248
+				$parsed = $sc_obj->parser($shortcode, $data_send, $this->_data['extra_data']);
249 249
 
250 250
 				$matched_code[] = $shortcode;
251 251
 				$sc_values[] = $parsed;
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 	 * @param array $valid_shortcodes an array of strings corresponding to EE_Shortcode Library objects
268 268
 	 * @return void
269 269
 	 */
270
-	private function _set_shortcodes( $valid_shortcodes ) {
271
-		foreach ( $valid_shortcodes as $shortcode_ref ) {
272
-			$ref = ucwords( str_replace('_', ' ', $shortcode_ref ) );
273
-			$ref = str_replace( ' ', '_', $ref );
274
-			$classname = 'EE_' . $ref . '_Shortcodes';
275
-			if ( class_exists( $classname ) ) {
276
-				$a = new ReflectionClass( $classname );
270
+	private function _set_shortcodes($valid_shortcodes) {
271
+		foreach ($valid_shortcodes as $shortcode_ref) {
272
+			$ref = ucwords(str_replace('_', ' ', $shortcode_ref));
273
+			$ref = str_replace(' ', '_', $ref);
274
+			$classname = 'EE_'.$ref.'_Shortcodes';
275
+			if (class_exists($classname)) {
276
+				$a = new ReflectionClass($classname);
277 277
 				$this->_shortcode_objs[] = $a->newInstance();
278 278
 			}
279 279
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
core/helpers/EEH_Sideloader.helper.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 
30 30
 
31
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
31
+require_once(EE_HELPERS.'EEH_Base.helper.php');
32 32
 class EEH_Sideloader extends EEH_Base {
33 33
 
34 34
 	private $_upload_to;
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @access public
44 44
 	 * @param array $init array fo initializing the sideloader if keys match the properties.
45 45
 	 */
46
-	public function __construct( $init = array() ) {
47
-		$this->_init( $init );
46
+	public function __construct($init = array()) {
47
+		$this->_init($init);
48 48
 	}
49 49
 
50 50
 
@@ -55,24 +55,24 @@  discard block
 block discarded – undo
55 55
 	 * @param  array  $init array on init (keys match properties others ignored)
56 56
 	 * @return void
57 57
 	 */
58
-	private function _init( $init ) {
58
+	private function _init($init) {
59 59
 		$defaults = array(
60 60
 			'_upload_to' => $this->_get_wp_uploads_dir(),
61 61
 			'_upload_from' => '',
62 62
 			'_permissions' => 0644,
63
-			'_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default'
63
+			'_new_file_name' => 'EE_Sideloader_'.uniqid().'.default'
64 64
 			);
65 65
 
66
-		$props = array_merge( $defaults, $init );
66
+		$props = array_merge($defaults, $init);
67 67
 
68
-		foreach ( $props as $key => $val ) {
69
-			if ( EEH_Class_Tools::has_property( $this, $key ) ) {
68
+		foreach ($props as $key => $val) {
69
+			if (EEH_Class_Tools::has_property($this, $key)) {
70 70
 				$this->$key = $val;
71 71
 			}
72 72
 		}
73 73
 
74 74
 		//make sure we include the required wp file for needed functions
75
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
75
+		require_once(ABSPATH.'wp-admin/includes/file.php');
76 76
 	}
77 77
 
78 78
 
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 	private function _get_wp_uploads_dir() {}
81 81
 
82 82
 	//setters
83
-	public function set_upload_to( $upload_to_folder ) {
83
+	public function set_upload_to($upload_to_folder) {
84 84
 		$this->_upload_to = $upload_to_folder;
85 85
 	}
86
-	public function set_upload_from( $upload_from_folder ) {
86
+	public function set_upload_from($upload_from_folder) {
87 87
 		$this->_upload_from_folder = $upload_from_folder;
88 88
 	}
89
-	public function set_permissions( $permissions ) {
89
+	public function set_permissions($permissions) {
90 90
 		$this->_permissions = $permissions;
91 91
 	}
92
-	public function set_new_file_name( $new_file_name ) {
92
+	public function set_new_file_name($new_file_name) {
93 93
 		$this->_new_file_name = $new_file_name;
94 94
 	}
95 95
 
@@ -111,34 +111,34 @@  discard block
 block discarded – undo
111 111
 	//upload methods
112 112
 	public function sideload() {
113 113
 		//setup temp dir
114
-		$temp_file = wp_tempnam( $this->_upload_from );
114
+		$temp_file = wp_tempnam($this->_upload_from);
115 115
 
116
-		if ( !$temp_file ) {
117
-			EE_Error::add_error( __('Something went wrong with the upload.  Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
116
+		if ( ! $temp_file) {
117
+			EE_Error::add_error(__('Something went wrong with the upload.  Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
118 118
 			return false;
119 119
 		}
120 120
 
121
-		do_action( 'AHEE__EEH_Sideloader__sideload__before', $this, $temp_file );
121
+		do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file);
122 122
 
123
-		$wp_remote_args = apply_filters( 'FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file );
123
+		$wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array('timeout' => 500, 'stream' => true, 'filename' => $temp_file), $this, $temp_file);
124 124
 
125
-		$response = wp_safe_remote_get( $this->_upload_from, $wp_remote_args );
125
+		$response = wp_safe_remote_get($this->_upload_from, $wp_remote_args);
126 126
 
127
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
128
-			unlink( $temp_file );
129
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
130
-				EE_Error::add_error( sprintf( __('Unable to upload the file.  Either the path given to upload from is incorrect, or something else happened.  Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export( $response, true ), $this->_upload_from ), __FILE__, __FUNCTION__, __LINE__ );
127
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
128
+			unlink($temp_file);
129
+			if (defined('WP_DEBUG') && WP_DEBUG) {
130
+				EE_Error::add_error(sprintf(__('Unable to upload the file.  Either the path given to upload from is incorrect, or something else happened.  Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export($response, true), $this->_upload_from), __FILE__, __FUNCTION__, __LINE__);
131 131
 			}
132 132
 			return false;
133 133
 		}
134 134
 
135 135
 		//possible md5 check
136
-		$content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
137
-		if ( $content_md5 ) {
138
-			$md5_check = verify_file_md5( $temp_file, $content_md5 );
139
-			if ( is_wp_error( $md5_check ) ) {
140
-				unlink( $temp_file );
141
-				EE_Error::add_error( $md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
136
+		$content_md5 = wp_remote_retrieve_header($response, 'content-md5');
137
+		if ($content_md5) {
138
+			$md5_check = verify_file_md5($temp_file, $content_md5);
139
+			if (is_wp_error($md5_check)) {
140
+				unlink($temp_file);
141
+				EE_Error::add_error($md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
142 142
 				return false;
143 143
 			}
144 144
 		}
@@ -146,24 +146,24 @@  discard block
 block discarded – undo
146 146
 		$file = $temp_file;
147 147
 
148 148
 		//now we have the file, let's get it in the right directory with the right name.
149
-		$path = apply_filters( 'FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this );
149
+		$path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to.$this->_new_file_name, $this);
150 150
 
151 151
 		//move file in
152
-		if ( false === @ rename( $file, $path ) ) {
153
-			unlink( $temp_file );
154
-			EE_Error::add_error(  sprintf( __('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso' ), $path ), __FILE__, __FUNCTION__, __LINE__ );
152
+		if (false === @ rename($file, $path)) {
153
+			unlink($temp_file);
154
+			EE_Error::add_error(sprintf(__('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso'), $path), __FILE__, __FUNCTION__, __LINE__);
155 155
 			return false;
156 156
 		}
157 157
 
158 158
 		//set permissions
159
-		$permissions = apply_filters( 'FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this );
160
-		chmod( $path, $permissions );
159
+		$permissions = apply_filters('FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this);
160
+		chmod($path, $permissions);
161 161
 
162 162
 		//that's it.  let's allow for actions after file uploaded.
163
-		do_action( 'AHEE__EE_Sideloader__sideload_after', $this, $path );
163
+		do_action('AHEE__EE_Sideloader__sideload_after', $this, $path);
164 164
 
165 165
 		//unlink tempfile
166
-		@unlink( $temp_file );
166
+		@unlink($temp_file);
167 167
 		return true;
168 168
 	}
169 169
 
Please login to merge, or discard this patch.
core/helpers/EEH_URL.helper.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 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
  * EEH_URL helper
4 6
  * Helper class for URL-related PHP functions
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
 				isset($results['response']['code']) &&
63 65
 				$results['response']['code'] == '200'){
64 66
 			return true;
65
-		}else{
67
+		} else{
66 68
 			return false;
67 69
 		}
68 70
 	}
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * ------------------------------------------------------------------------
11 11
  */
12
-class EEH_URL{
12
+class EEH_URL {
13 13
 
14 14
 	/**
15 15
 	 * _add_query_arg
@@ -20,26 +20,26 @@  discard block
 block discarded – undo
20 20
 	 * @param string $url
21 21
 	 * @return string
22 22
 	 */
23
-	public static function add_query_args_and_nonce( $args = array(), $url = '' ) {
24
-		if ( empty( $url )) {
25
-			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso' );
26
-			$dev_msg = $user_msg . "\n" . sprintf(
27
-					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso' ),
23
+	public static function add_query_args_and_nonce($args = array(), $url = '') {
24
+		if (empty($url)) {
25
+			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso');
26
+			$dev_msg = $user_msg."\n".sprintf(
27
+					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso'),
28 28
 					__CLASS__
29 29
 				);
30
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
30
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
31 31
 		}
32 32
 		// check that an action exists
33
-		if ( isset( $args['action'] ) && ! empty( $args['action'] )) {
34
-			$args = array_merge( $args, array( $args['action'] . '_nonce' => wp_create_nonce( $args['action'] . '_nonce' )));
33
+		if (isset($args['action']) && ! empty($args['action'])) {
34
+			$args = array_merge($args, array($args['action'].'_nonce' => wp_create_nonce($args['action'].'_nonce')));
35 35
 		} else {
36
-			$args = array_merge( $args, array( 'action' => 'default', 'default_nonce' => wp_create_nonce( 'default_nonce' )));
36
+			$args = array_merge($args, array('action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce')));
37 37
 		}
38 38
 
39 39
 		//finally, let's always add a return address (if present) :)
40
-		$args = !empty( $_REQUEST['action'] ) ? array_merge( $args, array( 'return' => $_REQUEST['action'] ) ) : $args;
40
+		$args = ! empty($_REQUEST['action']) ? array_merge($args, array('return' => $_REQUEST['action'])) : $args;
41 41
 
42
-		return add_query_arg( $args, $url );
42
+		return add_query_arg($args, $url);
43 43
 
44 44
 	}
45 45
 
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 	 * @param string $url
52 52
 	 * @return boolean
53 53
 	 */
54
-	public static function remote_file_exists($url){
55
-		$results = wp_remote_request($url,array(
54
+	public static function remote_file_exists($url) {
55
+		$results = wp_remote_request($url, array(
56 56
 			'method'=>'GET',
57 57
 			'redirection'=>1,
58 58
 		));
59
-		if( ! $results instanceof WP_Error &&
59
+		if ( ! $results instanceof WP_Error &&
60 60
 				isset($results['response']) &&
61 61
 				isset($results['response']['code']) &&
62
-				$results['response']['code'] == '200'){
62
+				$results['response']['code'] == '200') {
63 63
 			return true;
64
-		}else{
64
+		} else {
65 65
 			return false;
66 66
 		}
67 67
 	}
@@ -77,29 +77,29 @@  discard block
 block discarded – undo
77 77
 	 * @param bool   $base_url_only - TRUE will only return the scheme and host with no other parameters
78 78
 	 * @return string
79 79
 	 */
80
-	public static function refactor_url( $url = '', $remove_query = TRUE, $base_url_only = FALSE ) {
80
+	public static function refactor_url($url = '', $remove_query = TRUE, $base_url_only = FALSE) {
81 81
 		// break apart incoming URL
82
-		$url_bits = parse_url( $url );
82
+		$url_bits = parse_url($url);
83 83
 		// HTTP or HTTPS ?
84
-		$scheme = isset( $url_bits[ 'scheme' ] ) ? $url_bits[ 'scheme' ] . '://' : 'http://';
84
+		$scheme = isset($url_bits['scheme']) ? $url_bits['scheme'].'://' : 'http://';
85 85
 		// domain
86
-		$host = isset( $url_bits[ 'host' ] ) ? $url_bits[ 'host' ] : '';
86
+		$host = isset($url_bits['host']) ? $url_bits['host'] : '';
87 87
 		// if only the base URL is requested, then return that now
88
-		if ( $base_url_only ) {
89
-			return $scheme . $host;
88
+		if ($base_url_only) {
89
+			return $scheme.$host;
90 90
 		}
91
-		$port = isset( $url_bits[ 'port' ] ) ? ':' . $url_bits[ 'port' ] : '';
92
-		$user = isset( $url_bits[ 'user' ] ) ? $url_bits[ 'user' ] : '';
93
-		$pass = isset( $url_bits[ 'pass' ] ) ? ':' . $url_bits[ 'pass' ] : '';
94
-		$pass = ( $user || $pass ) ? $pass . '@' : '';
95
-		$path = isset( $url_bits[ 'path' ] ) ? $url_bits[ 'path' ] : '';
91
+		$port = isset($url_bits['port']) ? ':'.$url_bits['port'] : '';
92
+		$user = isset($url_bits['user']) ? $url_bits['user'] : '';
93
+		$pass = isset($url_bits['pass']) ? ':'.$url_bits['pass'] : '';
94
+		$pass = ($user || $pass) ? $pass.'@' : '';
95
+		$path = isset($url_bits['path']) ? $url_bits['path'] : '';
96 96
 		// if the query string is not required, then return what we have so far
97
-		if ( $remove_query ) {
98
-			return $scheme . $user . $pass . $host . $port . $path;
97
+		if ($remove_query) {
98
+			return $scheme.$user.$pass.$host.$port.$path;
99 99
 		}
100
-		$query = isset( $url_bits[ 'query' ] ) ? '?' . $url_bits[ 'query' ] : '';
101
-		$fragment = isset( $url_bits[ 'fragment' ] ) ? '#' . $url_bits[ 'fragment' ] : '';
102
-		return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
100
+		$query = isset($url_bits['query']) ? '?'.$url_bits['query'] : '';
101
+		$fragment = isset($url_bits['fragment']) ? '#'.$url_bits['fragment'] : '';
102
+		return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
103 103
 	}
104 104
 
105 105
 
@@ -112,29 +112,29 @@  discard block
 block discarded – undo
112 112
 	 * @param bool   $as_array TRUE (default) will return query params as an array of key value pairs, FALSE will simply return the query string
113 113
 	 * @return string|array
114 114
 	 */
115
-	public static function get_query_string( $url = '', $as_array = TRUE ) {
115
+	public static function get_query_string($url = '', $as_array = TRUE) {
116 116
 		// break apart incoming URL
117
-		$url_bits = parse_url( $url );
117
+		$url_bits = parse_url($url);
118 118
 		// grab query string from URL
119
-		$query = isset( $url_bits[ 'query' ] ) ? $url_bits[ 'query' ] : '';
119
+		$query = isset($url_bits['query']) ? $url_bits['query'] : '';
120 120
 		// if we don't want the query string formatted into an array of key => value pairs, then just return it as is
121
-		if ( ! $as_array ) {
121
+		if ( ! $as_array) {
122 122
 			return $query;
123 123
 		}
124 124
 		// if no query string exists then just return an empty array now
125
-		if ( empty( $query )) {
125
+		if (empty($query)) {
126 126
 			return array();
127 127
 		}
128 128
 		// empty array to hold results
129 129
 		$query_params = array();
130 130
 		// now break apart the query string into separate params
131
-		$query = explode( '&', $query );
131
+		$query = explode('&', $query);
132 132
 		// loop thru our query params
133
-		foreach ( $query as $query_args ) {
133
+		foreach ($query as $query_args) {
134 134
 			// break apart the key value pairs
135
-			$query_args = explode( '=', $query_args );
135
+			$query_args = explode('=', $query_args);
136 136
 			// and add to our results array
137
-			$query_params[ $query_args[0] ] = $query_args[1];
137
+			$query_params[$query_args[0]] = $query_args[1];
138 138
 		}
139 139
 		return $query_params;
140 140
 	}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * prevent_prefetching
146 146
 	 * @return void
147 147
 	 */
148
-	public static function prevent_prefetching(){
148
+	public static function prevent_prefetching() {
149 149
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
150 150
 		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
151 151
 	}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * add_nocache_headers
157 157
 	 * @return void
158 158
 	 */
159
-	public static function add_nocache_headers(){
159
+	public static function add_nocache_headers() {
160 160
 		// add no cache headers
161 161
 //		add_action( 'wp_head' , array( 'EED_Single_Page_Checkout', 'nocache_headers' ), 10 );
162 162
 		// plus a little extra for nginx
Please login to merge, or discard this patch.
core/libraries/form_sections/EE_Sample_Form.form.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class EE_Sample_Form extends EE_Form_Section_Proper{
3
-	function __construct(){
2
+class EE_Sample_Form extends EE_Form_Section_Proper {
3
+	function __construct() {
4 4
 		$this->_subsections = array(
5 5
 			'h1'=>new EE_Form_Section_HTML('hello wordl'),
6
-			'name'=>new EE_Text_Input(array('required'=>true,'default'=>'your name here')),
6
+			'name'=>new EE_Text_Input(array('required'=>true, 'default'=>'your name here')),
7 7
 			'email'=>new EE_Email_Input(array('required'=>false)),
8
-			'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=>  __("Small", "event_espresso"),'m'=>  __("Medium", "event_espresso"),'l'=>  __("Large", "event_espresso")),array('required'=>true,'default'=>'s')),
8
+			'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=>  __("Small", "event_espresso"), 'm'=>  __("Medium", "event_espresso"), 'l'=>  __("Large", "event_espresso")), array('required'=>true, 'default'=>'s')),
9 9
 			'month_normal'=>new EE_Month_Input(),
10 10
 			'month_leading_zero'=>new EE_Month_Input(true),
11 11
 			'year_2'=>new EE_Year_Input(false, 1, 1),
12
-			'year_4'=>new EE_Year_Input(true, 0,10,array('default'=>'2017')),
12
+			'year_4'=>new EE_Year_Input(true, 0, 10, array('default'=>'2017')),
13 13
 			'yes_no'=>new EE_Yes_No_Input(array('html_label_text'=>  __("Yes or No", "event_espresso"))),
14 14
 			'credit_card'=>new EE_Credit_Card_Input(),
15 15
 			'image_1'=>new EE_Admin_File_Uploader_Input(),
16 16
 			'image_2'=>new EE_Admin_File_Uploader_Input(),
17
-			'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP','mysql'=>'MYSQL'),array('default'=>array('php'))),
17
+			'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP', 'mysql'=>'MYSQL'), array('default'=>array('php'))),
18 18
 			'float'=>new EE_Float_Input(),
19 19
 			'essay'=>new EE_Text_Area_Input(),
20 20
 			'amenities'=>new EE_Select_Multiple_Input(
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 	 * Extra validation for the 'name' input.
41 41
 	 * @param EE_Text_Input $form_input
42 42
 	 */
43
-	function _validate_name($form_input){
44
-		if($form_input->raw_value() != 'Mike'){
43
+	function _validate_name($form_input) {
44
+		if ($form_input->raw_value() != 'Mike') {
45 45
 			$form_input->add_validation_error(__("You are not mike. You must be brent or darren. Thats ok, I guess", 'event_espresso'), 'not-mike');
46 46
 		}
47 47
 	}
48 48
 
49
-	function _validate(){
49
+	function _validate() {
50 50
 		parent::_validate();
51
-		if($this->_subsections['shirt_size']->normalized_value() =='s'
52
-				&& $this->_subsections['year_4']->normalized_value() < 2010){
51
+		if ($this->_subsections['shirt_size']->normalized_value() == 's'
52
+				&& $this->_subsections['year_4']->normalized_value() < 2010) {
53 53
 			$this->add_validation_error(__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old');
54 54
 		}
55 55
 	}
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_HTML.form.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@
 block discarded – undo
2 2
 if (!defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 /**
5
- * EE_Form_Section_HTML
6
- * HTML to be laid out like a proper subsection
7
- *
8
- *
9
- * @package			Event Espresso
10
- * @subpackage
11
- * @author				Mike Nelson
12
- *
13
- * ------------------------------------------------------------------------
14
- */
5
+	 * EE_Form_Section_HTML
6
+	 * HTML to be laid out like a proper subsection
7
+	 *
8
+	 *
9
+	 * @package			Event Espresso
10
+	 * @subpackage
11
+	 * @author				Mike Nelson
12
+	 *
13
+	 * ------------------------------------------------------------------------
14
+	 */
15 15
 class EE_Form_Section_HTML extends EE_Form_Section_Base{
16 16
 
17 17
 	protected $_html = '';
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 /**
5 5
  * EE_Form_Section_HTML
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  *
13 13
  * ------------------------------------------------------------------------
14 14
  */
15
-class EE_Form_Section_HTML extends EE_Form_Section_Base{
15
+class EE_Form_Section_HTML extends EE_Form_Section_Base {
16 16
 
17 17
 	protected $_html = '';
18 18
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param string $html
23 23
 	 * @param array $options_array
24 24
 	 */
25
-	public function __construct( $html = '', $options_array = array() ) {
25
+	public function __construct($html = '', $options_array = array()) {
26 26
 		$this->_html = $html;
27
-		parent::__construct( $options_array );
27
+		parent::__construct($options_array);
28 28
 	}
29 29
 
30 30
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('No direct script access allowed');
4
+}
4 5
 /**
5 6
  * EE_Form_Section_HTML
6 7
  * HTML to be laid out like a proper subsection
Please login to merge, or discard this patch.
libraries/form_sections/base/EE_Form_Section_HTML_From_Template.form.php 2 patches
Spacing   +4 added lines, -4 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,10 +25,10 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML{
29
-	public function __construct($template_file,$args = array(), $options_array = array()) {
28
+class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML {
29
+	public function __construct($template_file, $args = array(), $options_array = array()) {
30 30
 		EE_Registry::instance()->load_helper('Template');
31
-		$html = EEH_Template::locate_template( $template_file, $args );
31
+		$html = EEH_Template::locate_template($template_file, $args);
32 32
 
33 33
 //		echo " filepath:$template_file html $html";
34 34
 		parent::__construct($html, $options_array);
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.
core/libraries/form_sections/base/EE_Form_Section_Validatable.form.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 
5 5
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  *
35 35
  * ------------------------------------------------------------------------
36 36
  */
37
-abstract class EE_Form_Section_Validatable extends EE_Form_Section_Base{
37
+abstract class EE_Form_Section_Validatable extends EE_Form_Section_Base {
38 38
 
39 39
 	/**
40 40
 	 * Array of validation errors in this section. Does not contain validation errors in subsections, however.
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * called get_validation_errors_accumulated
50 50
 	 * @return EE_Validation_Error[]
51 51
 	 */
52
-	public function get_validation_errors(){
52
+	public function get_validation_errors() {
53 53
 		return $this->_validation_errors;
54 54
 	}
55 55
 	/**
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 	 * If we want this to be customizable, we may decide to create a strategy for displaying it.
58 58
 	 * @return string
59 59
 	 */
60
-	public function get_validation_error_string(){
60
+	public function get_validation_error_string() {
61 61
 		$validation_error_messages = array();
62
-		if($this->get_validation_errors()){
63
-			foreach($this->get_validation_errors() as $validation_error){
64
-				if ( $validation_error instanceof EE_Validation_Error ) {
65
-					$validation_error_messages[] =$validation_error->getMessage();
62
+		if ($this->get_validation_errors()) {
63
+			foreach ($this->get_validation_errors() as $validation_error) {
64
+				if ($validation_error instanceof EE_Validation_Error) {
65
+					$validation_error_messages[] = $validation_error->getMessage();
66 66
 				}
67 67
 			}
68 68
 		}
69
-		return implode(", ",$validation_error_messages);
69
+		return implode(", ", $validation_error_messages);
70 70
 	}
71 71
 
72 72
 
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 * @return boolean
83 83
 	 */
84 84
 	public function is_valid() {
85
-		if(count($this->_validation_errors)){
85
+		if (count($this->_validation_errors)) {
86 86
 			return false;
87
-		}else{
87
+		} else {
88 88
 			return true;
89 89
 		}
90 90
 	}
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 * @param Exception $previous_exception if there was an exception that caused the error, that exception
110 110
 	 * @return void
111 111
 	 */
112
-	function add_validation_error( $message_or_object, $error_code = NULL, $previous_exception = NULL ){
113
-		if($message_or_object instanceof EE_Validation_Error){
114
-			$validation_error= $message_or_object;
112
+	function add_validation_error($message_or_object, $error_code = NULL, $previous_exception = NULL) {
113
+		if ($message_or_object instanceof EE_Validation_Error) {
114
+			$validation_error = $message_or_object;
115 115
 			$validation_error->set_form_section($this);
116
-		}else{
116
+		} else {
117 117
 			$validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception);
118 118
 		}
119 119
 		$this->_validation_errors[] = $validation_error;
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('No direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -84,7 +85,7 @@  discard block
 block discarded – undo
84 85
 	public function is_valid() {
85 86
 		if(count($this->_validation_errors)){
86 87
 			return false;
87
-		}else{
88
+		} else{
88 89
 			return true;
89 90
 		}
90 91
 	}
@@ -113,7 +114,7 @@  discard block
 block discarded – undo
113 114
 		if($message_or_object instanceof EE_Validation_Error){
114 115
 			$validation_error= $message_or_object;
115 116
 			$validation_error->set_form_section($this);
116
-		}else{
117
+		} else{
117 118
 			$validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception);
118 119
 		}
119 120
 		$this->_validation_errors[] = $validation_error;
Please login to merge, or discard this patch.
core/libraries/form_sections/helpers/EE_Validation_Error.error.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class EE_Validation_Error extends Exception{
3
+class EE_Validation_Error extends Exception {
4 4
 	/**
5 5
 	 * Form Section from which this error originated.
6 6
 	 * @var EE_Form_Section
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param EE_Form_Section_Validatable $form_section
21 21
 	 * @param Exception $previous if there was an exception that caused this exception
22 22
 	 */
23
-	function __construct( $message = null, $string_code = null,$form_section = null, $previous = null){
23
+	function __construct($message = null, $string_code = null, $form_section = null, $previous = null) {
24 24
 		$this->_form_section = $form_section;
25 25
 		$this->_string_code = $string_code;
26 26
 		parent::__construct($message, 500, $previous);
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * returns teh form section which caused the error.
31 31
 	 * @return EE_Form_Section_Validatable
32 32
 	 */
33
-	public function get_form_section(){
33
+	public function get_form_section() {
34 34
 		return $this->_form_section;
35 35
 	}
36 36
 	/**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param EE_Form_Section_Validatable $form_section
39 39
 	 * @return void
40 40
 	 */
41
-	public function set_form_section($form_section){
41
+	public function set_form_section($form_section) {
42 42
 		$this->_form_section = $form_section;
43 43
 	}
44 44
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Admin_File_Uploader_Input.input.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@
 block discarded – undo
8 8
  * @since                4.6
9 9
  *
10 10
  */
11
-class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base{
11
+class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base {
12 12
 
13 13
 	/**
14 14
 	 * @param array $input_settings
15 15
 	 */
16
-	function __construct($input_settings = array()){
16
+	function __construct($input_settings = array()) {
17 17
 		$this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy());
18 18
 		$this->_set_normalization_strategy(new EE_Text_Normalization());
19
-		$this->_add_validation_strategy(new EE_URL_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) );
19
+		$this->_add_validation_strategy(new EE_URL_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL));
20 20
 		parent::__construct($input_settings);
21 21
 	}
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.