Completed
Pull Request — master (#937)
by Zack
19:41 queued 16:25
created
includes/admin/metaboxes/views/data-source.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' );
11 11
 
12 12
 //current value
13
-$current_form = (int) rgar( (array) $_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
13
+$current_form = (int)rgar( (array)$_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
14 14
 
15 15
 // check for available gravity forms
16
-$forms = gravityview_get_forms('any');
16
+$forms = gravityview_get_forms( 'any' );
17 17
 
18 18
 /**
19 19
  * @param int $current_form Form currently selected in the View (0 if none selected)
@@ -32,24 +32,24 @@  discard block
 block discarded – undo
32 32
 		?>
33 33
 		<a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Use a Form Preset', 'gravityview' ); ?>"><?php esc_html_e( 'Use a Form Preset', 'gravityview' ); ?></a>
34 34
 
35
-		<?php if( !empty( $forms ) ) { ?>
35
+		<?php if ( ! empty( $forms ) ) { ?>
36 36
 			<span>&nbsp;<?php esc_html_e( 'or use an existing form', 'gravityview' ); ?>&nbsp;</span>
37 37
 		<?php }
38 38
 	}
39 39
 
40 40
 	// If there are no forms to select, show no forms.
41
-	if( !empty( $forms ) ) { ?>
41
+	if ( ! empty( $forms ) ) { ?>
42 42
 		<select name="gravityview_form_id" id="gravityview_form_id">
43 43
 			<option value="" <?php selected( '', $current_form, true ); ?>>&mdash; <?php esc_html_e( 'list of forms', 'gravityview' ); ?> &mdash;</option>
44
-			<?php foreach( $forms as $form ) { ?>
45
-				<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
44
+			<?php foreach ( $forms as $form ) { ?>
45
+				<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
46 46
 			<?php } ?>
47 47
 		</select>
48 48
 	<?php } else { ?>
49 49
 		<select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select>
50 50
 	<?php } ?>
51 51
 
52
-	&nbsp;<a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
52
+	&nbsp;<a class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
53 53
 </p>
54 54
 
55 55
 <?php // confirm dialog box ?>
Please login to merge, or discard this patch.
includes/class-oembed.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		add_action( 'init', array( $this, 'register_handler' ) );
36 36
 		add_action( 'init', array( $this, 'add_provider' ) );
37 37
 
38
-		if ( ! empty( $_GET['gv_oembed_provider'] ) && ! empty( $_GET['url'] ) ) {
38
+		if ( ! empty( $_GET[ 'gv_oembed_provider' ] ) && ! empty( $_GET[ 'url' ] ) ) {
39 39
 			add_action( 'template_redirect', array( $this, 'render_provider_request' ) );
40 40
 		}
41 41
 	}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	static function getInstance() {
48 48
 
49
-		if( empty( self::$instance ) ) {
49
+		if ( empty( self::$instance ) ) {
50 50
 			self::$instance = new self;
51 51
 
52 52
 			self::$instance->initialize();
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 * @return void
91 91
 	 */
92 92
 	function render_provider_request() {
93
-		if ( ! empty( $_GET['url'] ) ) {
94
-			$url = $_GET['url'];
93
+		if ( ! empty( $_GET[ 'url' ] ) ) {
94
+			$url = $_GET[ 'url' ];
95 95
 		} else {
96 96
 			header( 'HTTP/1.0 404 Not Found' );
97 97
 			exit;
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 		preg_match( $this->get_handler_regex(), $url, $matches );
101 101
 
102 102
 		// If not using permalinks, re-assign values for matching groups
103
-		if ( ! empty( $matches['entry_slug2'] ) ) {
104
-			$matches['is_cpt'] = $matches['is_cpt2'];
105
-			$matches['slug'] = $matches['slug2'];
106
-			$matches['entry_slug'] = $matches['entry_slug2'];
107
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
103
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
104
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
105
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
106
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
107
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
108 108
 		}
109 109
 
110 110
 		// No Entry was found
111
-		if ( empty( $matches['entry_slug'] ) ) {
112
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
111
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
112
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
113 113
 			header( 'HTTP/1.0 404 Not Found' );
114 114
 			exit;
115 115
 		}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		// Catch either
163 163
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
164 164
 
165
-		return '#'.$match_regex.'#i';
165
+		return '#' . $match_regex . '#i';
166 166
 	}
167 167
 
168 168
 	/**
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$page_on_front = get_option( 'page_on_front' );
185 185
 
186
-		if( (int) $post_id === (int) $page_on_front || empty( $post_id ) ) {
186
+		if ( (int)$post_id === (int)$page_on_front || empty( $post_id ) ) {
187 187
 
188 188
 			$args = array(
189 189
 				'post_status' => 'publish',
190 190
 				'name' => $slug,
191
-				'post_type' => array('any', 'gravityview'),
191
+				'post_type' => array( 'any', 'gravityview' ),
192 192
 			);
193 193
 
194 194
 			$posts = get_posts( $args );
195 195
 
196
-			if( !empty( $posts ) ) {
197
-				$post_id = $posts[0]->ID;
196
+			if ( ! empty( $posts ) ) {
197
+				$post_id = $posts[ 0 ]->ID;
198 198
 			}
199 199
 		}
200 200
 
@@ -227,17 +227,17 @@  discard block
 block discarded – undo
227 227
 	public function render_handler( $matches, $attr, $url, $rawattr ) {
228 228
 
229 229
 		// If not using permalinks, re-assign values for matching groups
230
-		if( !empty( $matches['entry_slug2'] ) ) {
231
-			$matches['is_cpt'] = $matches['is_cpt2'];
232
-			$matches['slug'] = $matches['slug2'];
233
-			$matches['entry_slug'] = $matches['entry_slug2'];
234
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
230
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
231
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
232
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
233
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
234
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
235 235
 		}
236 236
 
237 237
 		// No Entry was found
238
-		if( empty( $matches['entry_slug'] ) ) {
238
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
239 239
 
240
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
240
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
241 241
 
242 242
 			return '';
243 243
 		}
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 		// Setup the data used
248 248
 		$this->set_vars( $matches, $attr, $url, $rawattr );
249 249
 
250
-		if( is_admin() && !$this->is_full_oembed_preview ) {
250
+		if ( is_admin() && ! $this->is_full_oembed_preview ) {
251 251
 			$return = $this->render_admin( $matches, $attr, $url, $rawattr );
252 252
 		} else {
253 253
 
254
-			if( $this->is_full_oembed_preview ) {
254
+			if ( $this->is_full_oembed_preview ) {
255 255
 				$return .= $this->generate_preview_notice();
256 256
 			}
257 257
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	private function generate_preview_notice() {
271 271
 		$floaty = GravityView_Admin::get_floaty();
272 272
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
273
-		$message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
274
-		return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
273
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
274
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
275 275
 	}
276 276
 
277 277
 	/**
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	private function set_vars( $matches, $attr, $url, $rawattr ) {
286 286
 
287
-		$this->entry_id = $matches['entry_slug'];
287
+		$this->entry_id = $matches[ 'entry_slug' ];
288 288
 
289
-		$post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] );
289
+		$post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] );
290 290
 
291 291
 		// The URL didn't have the View Custom Post Type structure.
292
-		if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) {
292
+		if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) {
293 293
 
294
-			do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
294
+			do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
295 295
 
296 296
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && $post = get_post( $post_id ) ) {
297 297
 				$views = \GV\View_Collection::from_post( $post );
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 						}
305 305
 					}
306 306
 
307
-					$this->view_id = $views[0]->ID;
307
+					$this->view_id = $views[ 0 ]->ID;
308 308
 				}
309 309
 			} else {
310 310
 				/** Deprecated. */
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		}
319 319
 
320 320
 		// The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that.
321
-		$this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) );
321
+		$this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
322 322
 	}
323 323
 
324 324
 	/**
@@ -336,15 +336,15 @@  discard block
 block discarded – undo
336 336
 		// Floaty the astronaut
337 337
 		$image = GravityView_Admin::get_floaty();
338 338
 
339
-		$embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id );
339
+		$embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id );
340 340
 
341
-		$embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id );
341
+		$embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id );
342 342
 
343 343
 		return '
344 344
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
345
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
345
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
346 346
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
347
-				'.$embed_text.'
347
+				'.$embed_text . '
348 348
 			</p>
349 349
 			<br style="clear: both;">
350 350
 		</div>';
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 	private function render_frontend( $matches, $attr, $url, $rawattr ) {
400 400
 
401 401
 		// If it's already been parsed, don't re-output it.
402
-		if( !empty( $this->output[ $this->entry_id ] ) ) {
402
+		if ( ! empty( $this->output[ $this->entry_id ] ) ) {
403 403
 			return $this->output[ $this->entry_id ];
404 404
 		}
405 405
 
406 406
 		$entry_output = $this->generate_entry_output();
407 407
 
408 408
 		// Wrap a container div around the output to allow for custom styling
409
-		$output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output );
409
+		$output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output );
410 410
 
411 411
 		/**
412 412
 		 * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		 *  @var string $url The original URL that was matched by the regex. \n
420 420
 		 *  @var array $rawattr The original unmodified attributes.
421 421
 		 */
422
-		$output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
422
+		$output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
423 423
 
424 424
 		unset( $entry_output );
425 425
 
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function get_instance() {
87 87
 
88
-		if( empty( self::$instance ) ) {
88
+		if ( empty( self::$instance ) ) {
89 89
 			self::$instance = new self;
90 90
 		}
91 91
 
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS );
121 121
 
122
-		if( $with_values ) {
122
+		if ( $with_values ) {
123 123
 			$operators_with_values = array();
124
-			foreach( $operators as $key ) {
124
+			foreach ( $operators as $key ) {
125 125
 				$operators_with_values[ $key ] = '';
126 126
 			}
127 127
 			return $operators_with_values;
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	private function set_operation( $operation = '' ) {
140 140
 
141
-		if( empty( $operation ) ) {
141
+		if ( empty( $operation ) ) {
142 142
 			return false;
143 143
 		}
144 144
 
145 145
 		$operators = $this->get_operators( false );
146 146
 
147
-		if( !in_array( $operation, $operators ) ) {
148
-			do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation );
147
+		if ( ! in_array( $operation, $operators ) ) {
148
+			do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation );
149 149
 			return false;
150 150
 		}
151 151
 
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	private function setup_operation_and_comparison() {
167 167
 
168
-		foreach( $this->atts as $key => $value ) {
168
+		foreach ( $this->atts as $key => $value ) {
169 169
 
170 170
 			$valid = $this->set_operation( $key );
171 171
 
172
-			if( $valid ) {
172
+			if ( $valid ) {
173 173
 				$this->comparison = $value;
174 174
 				return true;
175 175
 			}
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 			return null;
196 196
 		}
197 197
 
198
-		if( empty( $atts ) ) {
199
-			do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts );
198
+		if ( empty( $atts ) ) {
199
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts );
200 200
 			return null;
201 201
 		}
202 202
 
@@ -210,16 +210,16 @@  discard block
 block discarded – undo
210 210
 		$this->parse_atts();
211 211
 
212 212
 		// We need an "if"
213
-		if( false === $this->if ) {
214
-			do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts );
213
+		if ( false === $this->if ) {
214
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts );
215 215
 			return null;
216 216
 		}
217 217
 
218 218
 		$setup = $this->setup_operation_and_comparison();
219 219
 
220 220
 		// We need an operation and comparison value
221
-		if( ! $setup ) {
222
-			do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts );
221
+		if ( ! $setup ) {
222
+			do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts );
223 223
 			return null;
224 224
 		}
225 225
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	private function get_output() {
254 254
 
255
-		if( $this->is_match ) {
255
+		if ( $this->is_match ) {
256 256
 			$output = $this->content;
257 257
 		} else {
258 258
 			$output = $this->else_content;
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 		 * @param string $output HTML/text output
267 267
 		 * @param GVLogic_Shortcode $this This class
268 268
 		 */
269
-		$output = apply_filters('gravityview/gvlogic/output', $output, $this );
269
+		$output = apply_filters( 'gravityview/gvlogic/output', $output, $this );
270 270
 
271
-		do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output );
271
+		do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output );
272 272
 
273 273
 		return $output;
274 274
 	}
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 		list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL );
287 287
 		list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL );
288 288
 
289
-		$else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL;
289
+		$else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL;
290 290
 		$else_content = isset( $after_else ) ? $after_else : $else_attr;
291 291
 
292 292
 		// The content is everything OTHER than the [else]
293 293
 		$this->content = $before_else_if;
294 294
 
295 295
 		if ( ! $this->is_match ) {
296
-			if( $elseif_content = $this->process_elseif( $before_else ) ) {
296
+			if ( $elseif_content = $this->process_elseif( $before_else ) ) {
297 297
 				$this->else_content = $elseif_content;
298 298
 			} else {
299 299
 				$this->else_content = $else_content;
@@ -321,16 +321,16 @@  discard block
 block discarded – undo
321 321
 		foreach ( $else_if_matches as $key => $else_if_match ) {
322 322
 
323 323
 			// If $else_if_match[5] exists and has content, check for more shortcodes
324
-			preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER );
324
+			preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER );
325 325
 
326 326
 			// If the logic passes, this is the value that should be used for $this->else_content
327
-			$else_if_value = $else_if_match[5];
328
-			$check_elseif_match = $else_if_match[0];
327
+			$else_if_value = $else_if_match[ 5 ];
328
+			$check_elseif_match = $else_if_match[ 0 ];
329 329
 
330 330
 			// Retrieve the value of the match that is currently being checked, without any other [else] tags
331
-			if( ! empty( $recursive_matches[0][0] ) ) {
332
-				$else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value );
333
-				$check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match );
331
+			if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) {
332
+				$else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value );
333
+				$check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match );
334 334
 			}
335 335
 
336 336
 			$check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match );
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			}
348 348
 
349 349
 			// Process any remaining [else] tags
350
-			return $this->process_elseif( $else_if_match[5] );
350
+			return $this->process_elseif( $else_if_match[ 5 ] );
351 351
 		}
352 352
 
353 353
 		return false;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 		$this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts;
374 374
 
375 375
 		// Strip whitespace if it's not default false
376
-		$this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false;
376
+		$this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false;
377 377
 
378 378
 		/**
379 379
 		 * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		do_action( 'gravityview/gvlogic/parse_atts/after', $this );
385 385
 
386 386
 		// Make sure the "if" isn't processed in self::setup_operation_and_comparison()
387
-		unset( $this->atts['if'] );
387
+		unset( $this->atts[ 'if' ] );
388 388
 	}
389 389
 }
390 390
 
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-plugin-hooks-acf.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			return $meta_keys;
50 50
 		}
51 51
 
52
-		if( isset( $wp_filter['acf/format_value/type=wysiwyg'] ) && is_object( $wp_filter['acf/format_value/type=wysiwyg'] ) ) {
53
-			$backup_filters = clone( $wp_filter['acf/format_value/type=wysiwyg'] );
52
+		if ( isset( $wp_filter[ 'acf/format_value/type=wysiwyg' ] ) && is_object( $wp_filter[ 'acf/format_value/type=wysiwyg' ] ) ) {
53
+			$backup_filters = clone( $wp_filter[ 'acf/format_value/type=wysiwyg' ] );
54 54
 		}
55 55
 
56 56
 		// Prevent infinite loop by removing filters
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 		$acf_keys = get_field_objects( $post_id, array( 'load_value' => false ) );
60 60
 
61 61
 		// Restore existing filters
62
-		if( ! empty( $backup_filters ) ) {
63
-			$wp_filter['acf/format_value/type=wysiwyg'] = $backup_filters;
62
+		if ( ! empty( $backup_filters ) ) {
63
+			$wp_filter[ 'acf/format_value/type=wysiwyg' ] = $backup_filters;
64 64
 		}
65 65
 
66
-		if( $acf_keys ) {
66
+		if ( $acf_keys ) {
67 67
 			return array_merge( array_keys( $acf_keys ), $meta_keys );
68 68
 		}
69 69
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @return void
79 79
 	 */
80 80
 	private function fix_posted_fields() {
81
-		if( is_admin() && isset( $_POST['action'] ) && isset( $_POST['post_type'] ) ) {
82
-			if( 'editpost' === $_POST['action'] && 'gravityview' === $_POST['post_type'] ) {
83
-				$_POST['fields'] = _gravityview_process_posted_fields();
81
+		if ( is_admin() && isset( $_POST[ 'action' ] ) && isset( $_POST[ 'post_type' ] ) ) {
82
+			if ( 'editpost' === $_POST[ 'action' ] && 'gravityview' === $_POST[ 'post_type' ] ) {
83
+				$_POST[ 'fields' ] = _gravityview_process_posted_fields();
84 84
 			}
85 85
 		}
86 86
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-html-elements.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 
43 43
 		$args = wp_parse_args( $args, $defaults );
44 44
 
45
-		$forms = gravityview_get_forms( (bool) $args['active'], (bool) $args['trash'] );
45
+		$forms = gravityview_get_forms( (bool)$args[ 'active' ], (bool)$args[ 'trash' ] );
46 46
 
47
-		if( array() === $args['options'] ) {
47
+		if ( array() === $args[ 'options' ] ) {
48 48
 			foreach ( $forms as $form ) {
49 49
 
50
-				if ( in_array( $form['id'], $args['exclude'] ) ) {
50
+				if ( in_array( $form[ 'id' ], $args[ 'exclude' ] ) ) {
51 51
 					continue;
52 52
 				}
53 53
 
54
-				$args['options'][ $form['id'] ] = esc_html( $form['title'] );
54
+				$args[ 'options' ][ $form[ 'id' ] ] = esc_html( $form[ 'title' ] );
55 55
 			}
56 56
 		}
57 57
 
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 
84 84
 		$args = wp_parse_args( $args, $defaults );
85 85
 
86
-		if( empty( $args['form_id'] ) ) {
86
+		if ( empty( $args[ 'form_id' ] ) ) {
87 87
 			return '';
88 88
 		}
89 89
 
90
-		$fields = GVCommon::get_sortable_fields_array( $args['form_id'] );
90
+		$fields = GVCommon::get_sortable_fields_array( $args[ 'form_id' ] );
91 91
 
92
-		if( array() === $args['options'] ) {
92
+		if ( array() === $args[ 'options' ] ) {
93 93
 			foreach ( $fields as $field_id => $field ) {
94
-				$args['options'][ $field_id ] = esc_html( $field['label'] );
94
+				$args[ 'options' ][ $field_id ] = esc_html( $field[ 'label' ] );
95 95
 			}
96 96
 		}
97 97
 
@@ -127,43 +127,43 @@  discard block
 block discarded – undo
127 127
 		$args = wp_parse_args( $args, $defaults );
128 128
 
129 129
 		$data_elements = '';
130
-		foreach ( $args['data'] as $key => $value ) {
130
+		foreach ( $args[ 'data' ] as $key => $value ) {
131 131
 			$data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
132 132
 		}
133 133
 
134
-		if( $args['multiple'] ) {
134
+		if ( $args[ 'multiple' ] ) {
135 135
 			$multiple = ' MULTIPLE';
136 136
 		} else {
137 137
 			$multiple = '';
138 138
 		}
139 139
 
140
-		if( $args['placeholder'] ) {
141
-			$placeholder = $args['placeholder'];
140
+		if ( $args[ 'placeholder' ] ) {
141
+			$placeholder = $args[ 'placeholder' ];
142 142
 		} else {
143 143
 			$placeholder = '';
144 144
 		}
145 145
 
146
-		$disabled = $args['disabled'] ? ' disabled="disabled"' : '';
147
-		$class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
148
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"'. $data_elements . '>';
146
+		$disabled = $args[ 'disabled' ] ? ' disabled="disabled"' : '';
147
+		$class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[ 'class' ] ) ) );
148
+		$output = '<select name="' . esc_attr( $args[ 'name' ] ) . '" id="' . esc_attr( str_replace( '-', '_', $args[ 'id' ] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>';
149 149
 
150
-		if ( ! empty( $args['options'] ) ) {
150
+		if ( ! empty( $args[ 'options' ] ) ) {
151 151
 
152
-			if ( $args['show_option_none'] ) {
153
-				if( $args['multiple'] ) {
154
-					$selected = selected( true, in_array( -1, $args['selected'] ), false );
152
+			if ( $args[ 'show_option_none' ] ) {
153
+				if ( $args[ 'multiple' ] ) {
154
+					$selected = selected( true, in_array( -1, $args[ 'selected' ] ), false );
155 155
 				} else {
156
-					$selected = selected( $args['selected'], -1, false );
156
+					$selected = selected( $args[ 'selected' ], -1, false );
157 157
 				}
158
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
158
+				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args[ 'show_option_none' ] ) . '</option>';
159 159
 			}
160 160
 
161
-			foreach( $args['options'] as $key => $option ) {
161
+			foreach ( $args[ 'options' ] as $key => $option ) {
162 162
 
163
-				if( $args['multiple'] && is_array( $args['selected'] ) ) {
164
-					$selected = selected( true, in_array( $key, $args['selected'], true ), false );
163
+				if ( $args[ 'multiple' ] && is_array( $args[ 'selected' ] ) ) {
164
+					$selected = selected( true, in_array( $key, $args[ 'selected' ], true ), false );
165 165
 				} else {
166
-					$selected = selected( $args['selected'], $key, false );
166
+					$selected = selected( $args[ 'selected' ], $key, false );
167 167
 				}
168 168
 
169 169
 				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
Please login to merge, or discard this patch.
future/includes/class-gv-settings-view.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 		$default_settings = array(
36 36
 			'id' => array(
37
-				'label' => __('View ID', 'gravityview'),
37
+				'label' => __( 'View ID', 'gravityview' ),
38 38
 				'type' => 'number',
39 39
 				'group'	=> 'default',
40 40
 				'value' => NULL,
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				'show_in_shortcode' => false,
43 43
 			),
44 44
 			'page_size' => array(
45
-				'label' 	=> __('Number of entries per page', 'gravityview'),
45
+				'label' 	=> __( 'Number of entries per page', 'gravityview' ),
46 46
 				'type' => 'number',
47 47
 				'class'	=> 'small-text',
48 48
 				'group'	=> 'default',
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				'show_in_shortcode' => true,
51 51
 			),
52 52
 			'offset' => array(
53
-				'label' 	=> __('Offset entries starting from', 'gravityview'),
53
+				'label' 	=> __( 'Offset entries starting from', 'gravityview' ),
54 54
 				'type' => 'number',
55 55
 				'class'	=> 'small-text',
56 56
 				'group'	=> 'default',
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 			),
75 75
 			'admin_show_all_statuses' => array(
76 76
 				'label' => __( 'Show all entries to administrators', 'gravityview' ),
77
-				'desc'	=> __('Administrators will be able to see entries with any approval status.', 'gravityview'),
78
-				'tooltip' => __('Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview'),
77
+				'desc'	=> __( 'Administrators will be able to see entries with any approval status.', 'gravityview' ),
78
+				'tooltip' => __( 'Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview' ),
79 79
 				'requires' => 'show_only_approved',
80 80
 				'type' => 'checkbox',
81 81
 				'group'	=> 'default',
@@ -100,40 +100,40 @@  discard block
 block discarded – undo
100 100
 			'user_edit' => array(
101 101
 				'label'	=> __( 'Allow User Edit', 'gravityview' ),
102 102
 				'group'	=> 'default',
103
-				'desc'	=> __('Allow logged-in users to edit entries they created.', 'gravityview'),
103
+				'desc'	=> __( 'Allow logged-in users to edit entries they created.', 'gravityview' ),
104 104
 				'value'	=> 0,
105
-				'tooltip' => __('Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview'),
105
+				'tooltip' => __( 'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview' ),
106 106
 				'type'	=> 'checkbox',
107 107
 				'show_in_shortcode' => true,
108 108
 			),
109 109
 			'user_delete' => array(
110 110
 				'label'	=> __( 'Allow User Delete', 'gravityview' ),
111 111
 				'group'	=> 'default',
112
-				'desc'	=> __('Allow logged-in users to delete entries they created.', 'gravityview'),
112
+				'desc'	=> __( 'Allow logged-in users to delete entries they created.', 'gravityview' ),
113 113
 				'value'	=> 0,
114
-				'tooltip' => __('Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview'),
114
+				'tooltip' => __( 'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview' ),
115 115
 				'type'	=> 'checkbox',
116 116
 				'show_in_shortcode' => true,
117 117
 			),
118 118
 			'sort_field' => array(
119
-				'label'	=> __('Sort by field', 'gravityview'),
119
+				'label'	=> __( 'Sort by field', 'gravityview' ),
120 120
 				'type' => 'select',
121 121
 				'value' => '',
122 122
 				'group'	=> 'sort',
123 123
 				'options' => array(
124
-					'' => __( 'Default', 'gravityview'),
125
-					'date_created' => __( 'Date Created', 'gravityview'),
124
+					'' => __( 'Default', 'gravityview' ),
125
+					'date_created' => __( 'Date Created', 'gravityview' ),
126 126
 				),
127 127
 				'show_in_shortcode' => true,
128 128
 			),
129 129
 			'sort_direction' => array(
130
-				'label' 	=> __('Sort direction', 'gravityview'),
130
+				'label' 	=> __( 'Sort direction', 'gravityview' ),
131 131
 				'type' => 'select',
132 132
 				'value' => 'ASC',
133 133
 				'group'	=> 'sort',
134 134
 				'options' => array(
135
-					'ASC' => __('ASC', 'gravityview'),
136
-					'DESC' => __('DESC', 'gravityview'),
135
+					'ASC' => __( 'ASC', 'gravityview' ),
136
+					'DESC' => __( 'DESC', 'gravityview' ),
137 137
 				),
138 138
 				'show_in_shortcode' => true,
139 139
 			),
@@ -148,69 +148,69 @@  discard block
 block discarded – undo
148 148
 				'show_in_template' => array( 'default_table', 'preset_business_data', 'preset_issue_tracker', 'preset_resume_board', 'preset_job_board' ),
149 149
 			),
150 150
 			'start_date' => array(
151
-				'label' 	=> __('Filter by Start Date', 'gravityview'),
151
+				'label' 	=> __( 'Filter by Start Date', 'gravityview' ),
152 152
 				'class'	=> 'gv-datepicker',
153
-				'desc'	=> __('Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ),
153
+				'desc'	=> __( 'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ),
154 154
 				'type' => 'text',
155 155
 				'value' => '',
156 156
 				'group'	=> 'filter',
157 157
 				'show_in_shortcode' => true,
158 158
 			),
159 159
 			'end_date' => array(
160
-				'label' 	=> __('Filter by End Date', 'gravityview'),
160
+				'label' 	=> __( 'Filter by End Date', 'gravityview' ),
161 161
 				'class'	=> 'gv-datepicker',
162
-				'desc'	=> __('Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ),
162
+				'desc'	=> __( 'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ),
163 163
 				'type' => 'text',
164 164
 				'value' => '',
165 165
 				'group'	=> 'filter',
166 166
 				'show_in_shortcode' => true,
167 167
 			),
168 168
 			'class' => array(
169
-				'label' 	=> __('CSS Class', 'gravityview'),
170
-				'desc'	=> __('CSS class to add to the wrapping HTML container.', 'gravityview'),
169
+				'label' 	=> __( 'CSS Class', 'gravityview' ),
170
+				'desc'	=> __( 'CSS class to add to the wrapping HTML container.', 'gravityview' ),
171 171
 				'group'	=> 'default',
172 172
 				'type' => 'text',
173 173
 				'value' => '',
174 174
 				'show_in_shortcode' => false,
175 175
 			),
176 176
 			'search_value' => array(
177
-				'label' 	=> __('Search Value', 'gravityview'),
178
-				'desc'	=> __('Define a default search value for the View', 'gravityview'),
177
+				'label' 	=> __( 'Search Value', 'gravityview' ),
178
+				'desc'	=> __( 'Define a default search value for the View', 'gravityview' ),
179 179
 				'type' => 'text',
180 180
 				'value' => '',
181 181
 				'group'	=> 'filter',
182 182
 				'show_in_shortcode' => false,
183 183
 			),
184 184
 			'search_field' => array(
185
-				'label' 	=> __('Search Field', 'gravityview'),
186
-				'desc'	=> __('If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview'),
185
+				'label' 	=> __( 'Search Field', 'gravityview' ),
186
+				'desc'	=> __( 'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview' ),
187 187
 				'type' => 'number',
188 188
 				'value' => '',
189 189
 				'group'	=> 'filter',
190 190
 				'show_in_shortcode' => false,
191 191
 			),
192 192
 			'single_title' => array(
193
-				'label'	=> __('Single Entry Title', 'gravityview'),
193
+				'label'	=> __( 'Single Entry Title', 'gravityview' ),
194 194
 				'type'	=> 'text',
195
-				'desc'	=> __('When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview'),
195
+				'desc'	=> __( 'When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview' ),
196 196
 				'group'	=> 'default',
197 197
 				'value'	=> '',
198 198
 				'show_in_shortcode' => false,
199 199
 				'full_width' => true,
200 200
 			),
201 201
 			'back_link_label' => array(
202
-				'label'	=> __('Back Link Label', 'gravityview'),
202
+				'label'	=> __( 'Back Link Label', 'gravityview' ),
203 203
 				'group'	=> 'default',
204
-				'desc'	=> __('The text of the link that returns to the multiple entries view.', 'gravityview'),
204
+				'desc'	=> __( 'The text of the link that returns to the multiple entries view.', 'gravityview' ),
205 205
 				'type'	=> 'text',
206 206
 				'value'	=> '',
207 207
 				'show_in_shortcode' => false,
208 208
 				'full_width' => true,
209 209
 			),
210 210
 			'embed_only' => array(
211
-				'label'	=> __('Prevent Direct Access', 'gravityview'),
211
+				'label'	=> __( 'Prevent Direct Access', 'gravityview' ),
212 212
 				'group'	=> 'default',
213
-				'desc'	=> __('Only allow access to this View when embedded using the shortcode.', 'gravityview'),
213
+				'desc'	=> __( 'Only allow access to this View when embedded using the shortcode.', 'gravityview' ),
214 214
 				'type'	=> 'checkbox',
215 215
 				'value'	=> '',
216 216
 				'tooltip' => false,
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		);
226 226
 
227 227
 		if ( version_compare( \GFFormsModel::get_database_version(), '2.3-beta-4', '>=' ) ) {
228
-			$default_settings['sort_direction']['options']['RAND'] = __( 'Random', 'gravityview' );
228
+			$default_settings[ 'sort_direction' ][ 'options' ][ 'RAND' ] = __( 'Random', 'gravityview' );
229 229
 		}
230 230
 
231 231
 		/**
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 		// By default, we only want the key => value pairing, not the whole array.
246 246
 		if ( ! $detailed ) {
247 247
 			$defaults = array();
248
-			foreach( $default_settings as $key => $value ) {
249
-				$defaults[ $key ] = $value['value'];
248
+			foreach ( $default_settings as $key => $value ) {
249
+				$defaults[ $key ] = $value[ 'value' ];
250 250
 			}
251 251
 			return $defaults;
252 252
 
253 253
 		// But sometimes, we want all the details.
254 254
 		} else {
255
-			foreach ($default_settings as $key => $value) {
255
+			foreach ( $default_settings as $key => $value ) {
256 256
 
257 257
 				// If the $group argument is set for the method,
258 258
 				// ignore any settings that aren't in that group.
259 259
 				if ( ! empty( $group ) && is_string( $group ) ) {
260
-					if ( empty( $value['group'] ) || $value['group'] !== $group ) {
260
+					if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) {
261 261
 						unset( $default_settings[ $key ] );
262 262
 					}
263 263
 				}
Please login to merge, or discard this patch.