Completed
Pull Request — develop (#1573)
by Zack
20:26
created
future/includes/class-gv-shortcode-gravityview.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 			'class' => '',
44 44
 		) );
45 45
 
46
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
47
-			if ( $atts['detail'] && $view = $request->is_view() ) {
46
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
47
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
48 48
 				$view_id = $view->ID;
49 49
 			}
50 50
 		}
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 			}
115 115
 		}
116 116
 
117
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
117
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
118 118
 
119 119
 		/**
120 120
 		 * View details.
121 121
 		 */
122
-		if ( $atts['detail'] ) {
122
+		if ( $atts[ 'detail' ] ) {
123 123
 			$entries = $view->get_entries( $request );
124 124
 			return self::_return( $this->detail( $view, $entries, $atts ) );
125 125
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 				return self::_return( '' );
137 137
 			}
138 138
 
139
-			if ( $entry['status'] != 'active' ) {
139
+			if ( $entry[ 'status' ] != 'active' ) {
140 140
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
141 141
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
142 142
 			}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			}
148 148
 
149 149
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
150
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
150
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
151 151
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
152 152
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
153 153
 				}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			$entryset = $entry->is_multi() ? $entry->entries : array( $entry );
171 171
 
172 172
 			foreach ( $entryset as $e ) {
173
-				if ( $e['status'] != 'active' ) {
173
+				if ( $e[ 'status' ] != 'active' ) {
174 174
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
175 175
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
176 176
 				}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 				}
182 182
 
183 183
 				if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
184
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
184
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
185 185
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
186 186
 						return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
187 187
 					}
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 
207 207
 				// Mock the request with the actual View, not the global one
208 208
 				$mock_request = new \GV\Mock_Request();
209
-				$mock_request->returns['is_view'] = $view;
210
-				$mock_request->returns['is_entry'] = $request->is_entry( $view->form ? $view->form->ID : 0 );
211
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
212
-				$mock_request->returns['is_search'] = $request->is_search();
209
+				$mock_request->returns[ 'is_view' ] = $view;
210
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry( $view->form ? $view->form->ID : 0 );
211
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
212
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
213 213
 
214 214
 				$request = $mock_request;
215 215
 			}
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
246 246
 
247 247
 		// Only keep the passed attributes after making sure that they're valid pairs
248
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
248
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
249 249
 
250 250
 		$atts = array();
251 251
 
252
-		foreach( $filtered_atts as $key => $passed_value ) {
252
+		foreach ( $filtered_atts as $key => $passed_value ) {
253 253
 
254 254
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
255 255
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
256 256
 
257
-			switch( $defaults[ $key ]['type'] ) {
257
+			switch ( $defaults[ $key ][ 'type' ] ) {
258 258
 
259 259
 				/**
260 260
 				 * Make sure number fields are numeric.
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
263 263
 				 */
264 264
 				case 'number':
265
-					if( is_numeric( $passed_value ) ) {
265
+					if ( is_numeric( $passed_value ) ) {
266 266
 						$atts[ $key ] = ( $passed_value + 0 );
267 267
 					}
268 268
 					break;
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 				 */
278 278
 				case 'select':
279 279
 				case 'radio':
280
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
281
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
280
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
281
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
282 282
 						$atts[ $key ] = $passed_value;
283 283
 					}
284 284
 					break;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			}
291 291
 		}
292 292
 
293
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
293
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
294 294
 
295 295
 		return $atts;
296 296
 	}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	private function detail( $view, $entries, $atts ) {
308 308
 		$output = '';
309 309
 
310
-		switch ( $key = $atts['detail'] ):
310
+		switch ( $key = $atts[ 'detail' ] ):
311 311
 			case 'total_entries':
312 312
 				$output = number_format_i18n( $entries->total() );
313 313
 				break;
Please login to merge, or discard this patch.
includes/extensions/lightbox/class-gravityview-lightbox-provider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 		add_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10, 3 );
24 24
 		add_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) );
25 25
 
26
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') );
27
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') );
26
+		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
27
+		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
28 28
 
29 29
 		add_action( 'wp_footer', array( $this, 'output_footer' ) );
30 30
 	}
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 		remove_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10 );
45 45
 		remove_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) );
46 46
 
47
-		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') );
48
-		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') );
47
+		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
48
+		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
49 49
 
50 50
 		remove_action( 'wp_footer', array( $this, 'output_footer' ) );
51 51
 	}
Please login to merge, or discard this patch.
includes/extensions/lightbox/class-gravityview-lightbox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function set_provider( $provider = null ) {
40 40
 
41
-		if( gravityview()->request->is_admin() ) {
41
+		if ( gravityview()->request->is_admin() ) {
42 42
 			return;
43 43
 		}
44 44
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 
59 59
 		// We're switching providers; remove the hooks that were added.
60
-		if( self::$active_provider ) {
60
+		if ( self::$active_provider ) {
61 61
 			self::$active_provider->remove_hooks();
62 62
 		}
63 63
 
Please login to merge, or discard this patch.
lightbox/fancybox/class-gravityview-lightbox-provider-fancybox.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function allowed_atts( $atts = array() ) {
104 104
 
105
-		$atts['data-fancybox']         = null;
106
-		$atts['data-fancybox-trigger'] = null;
107
-		$atts['data-fancybox-index']   = null;
108
-		$atts['data-src']              = null;
109
-		$atts['data-type']             = null;
110
-		$atts['data-width']            = null;
111
-		$atts['data-height']           = null;
112
-		$atts['data-srcset']           = null;
113
-		$atts['data-caption']          = null;
114
-		$atts['data-options']          = null;
115
-		$atts['data-filter']           = null;
105
+		$atts[ 'data-fancybox' ]         = null;
106
+		$atts[ 'data-fancybox-trigger' ] = null;
107
+		$atts[ 'data-fancybox-index' ]   = null;
108
+		$atts[ 'data-src' ]              = null;
109
+		$atts[ 'data-type' ]             = null;
110
+		$atts[ 'data-width' ]            = null;
111
+		$atts[ 'data-height' ]           = null;
112
+		$atts[ 'data-srcset' ]           = null;
113
+		$atts[ 'data-caption' ]          = null;
114
+		$atts[ 'data-options' ]          = null;
115
+		$atts[ 'data-filter' ]           = null;
116 116
 
117 117
 		return $atts;
118 118
 	}
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
 			return $link_atts;
127 127
 		}
128 128
 
129
-		$link_atts['class'] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox';
129
+		$link_atts[ 'class' ] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox';
130 130
 
131
-		$link_atts['class'] = sanitize_html_class( $link_atts['class'] );
131
+		$link_atts[ 'class' ] = sanitize_html_class( $link_atts[ 'class' ] );
132 132
 
133 133
 		if ( $context && ! empty( $context->field->field ) ) {
134 134
 			if ( $context->field->field->multipleFiles ) {
135 135
 				$entry = $context->entry->as_entry();
136
-				$link_atts['data-fancybox'] = 'gallery-' . sprintf( "%s-%s-%s", $entry['form_id'], $context->field->ID, $context->entry->get_slug() );
136
+				$link_atts[ 'data-fancybox' ] = 'gallery-' . sprintf( "%s-%s-%s", $entry[ 'form_id' ], $context->field->ID, $context->entry->get_slug() );
137 137
 			}
138 138
 		}
139 139
 
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-gravityforms.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	function __construct() {
15 15
 
16
-		$this->widget_description = __('Display a Gravity Forms form.', 'gravityview' );
16
+		$this->widget_description = __( 'Display a Gravity Forms form.', 'gravityview' );
17 17
 
18 18
 		$default_values = array(
19 19
 			'header' => 1,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 		add_filter( 'gravityview/widget/hide_until_searched/whitelist', array( $this, 'add_to_allowlist' ) );
56 56
 
57
-		parent::__construct( __( 'Gravity Forms', 'gravityview' ) , 'gravityforms', $default_values, $settings );
57
+		parent::__construct( __( 'Gravity Forms', 'gravityview' ), 'gravityforms', $default_values, $settings );
58 58
 	}
59 59
 
60 60
 	/**
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 		 * gravityview_get_forms() is currently running too early as widgets_init runs before init and
82 82
 		 * when most Gravity Forms plugins register their own fields like GP Terms of Service.
83 83
 		 */
84
-		if( $doing_ajax || ( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) ) {
84
+		if ( $doing_ajax || ( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) ) {
85 85
 
86 86
 			// check for available gravity forms
87 87
 			$forms = gravityview_get_forms();
88 88
 
89 89
 			foreach ( $forms as $form ) {
90
-				$choices[ $form['id'] ] = $form['title'];
90
+				$choices[ $form[ 'id' ] ] = $form[ 'title' ];
91 91
 			}
92 92
 		}
93 93
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	function add_to_allowlist( $allowlist ) {
105 105
 
106
-		$allowlist[] = 'gravityforms';
106
+		$allowlist[ ] = 'gravityforms';
107 107
 
108 108
 		return $allowlist;
109 109
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param string $content
114 114
 	 * @param string $context
115 115
 	 */
116
-	public function render_frontend( $widget_args, $content = '', $context = '') {
116
+	public function render_frontend( $widget_args, $content = '', $context = '' ) {
117 117
 
118 118
 		if ( ! $this->pre_render_frontend() ) {
119 119
 			return;
Please login to merge, or discard this patch.
future/lib/EDD_SL_Plugin_Updater.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 		$this->api_data    = $_api_data;
49 49
 		$this->name        = plugin_basename( $_plugin_file );
50 50
 		$this->slug        = basename( $_plugin_file, '.php' );
51
-		$this->version     = $_api_data['version'];
52
-		$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
53
-		$this->beta        = ! empty( $this->api_data['beta'] ) ? true : false;
54
-		$this->cache_key   = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
51
+		$this->version     = $_api_data[ 'version' ];
52
+		$this->wp_override = isset( $_api_data[ 'wp_override' ] ) ? (bool)$_api_data[ 'wp_override' ] : false;
53
+		$this->beta        = ! empty( $this->api_data[ 'beta' ] ) ? true : false;
54
+		$this->cache_key   = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) );
55 55
 
56 56
 		$edd_plugin_data[ $this->slug ] = $this->api_data;
57 57
 
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 			return;
171 171
 		}
172 172
 
173
-		if( ! current_user_can( 'update_plugins' ) ) {
173
+		if ( ! current_user_can( 'update_plugins' ) ) {
174 174
 			return;
175 175
 		}
176 176
 
177
-		if( ! is_multisite() ) {
177
+		if ( ! is_multisite() ) {
178 178
 			return;
179 179
 		}
180 180
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
282 282
 					esc_html( $version_info->new_version ),
283 283
 					'</a>',
284
-					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
284
+					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">',
285 285
 					'</a>'
286 286
 				);
287 287
 			}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			$_data->contributors = $this->convert_object_to_array( $_data->contributors );
366 366
 		}
367 367
 
368
-		if( ! isset( $_data->plugin ) ) {
368
+		if ( ! isset( $_data->plugin ) ) {
369 369
 			$_data->plugin = $this->name;
370 370
 		}
371 371
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 
405 405
 		$verify_ssl = $this->verify_ssl();
406 406
 		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
407
-			$args['sslverify'] = $verify_ssl;
407
+			$args[ 'sslverify' ] = $verify_ssl;
408 408
 		}
409 409
 		return $args;
410 410
 
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
 		if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
433 433
 			$test_url_parts = parse_url( $this->api_url );
434 434
 
435
-			$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme']     : 'http';
436
-			$host   = ! empty( $test_url_parts['host'] )   ? $test_url_parts['host']       : '';
437
-			$port   = ! empty( $test_url_parts['port'] )   ? ':' . $test_url_parts['port'] : '';
435
+			$scheme = ! empty( $test_url_parts[ 'scheme' ] ) ? $test_url_parts[ 'scheme' ] : 'http';
436
+			$host   = ! empty( $test_url_parts[ 'host' ] ) ? $test_url_parts[ 'host' ] : '';
437
+			$port   = ! empty( $test_url_parts[ 'port' ] ) ? ':' . $test_url_parts[ 'port' ] : '';
438 438
 
439 439
 			if ( empty( $host ) ) {
440 440
 				$edd_plugin_url_available[ $store_hash ] = false;
@@ -451,27 +451,27 @@  discard block
 block discarded – undo
451 451
 
452 452
 		$data = array_merge( $this->api_data, $_data );
453 453
 
454
-		if ( $data['slug'] != $this->slug ) {
454
+		if ( $data[ 'slug' ] != $this->slug ) {
455 455
 			return;
456 456
 		}
457 457
 
458
-		if( $this->api_url == trailingslashit ( home_url() ) ) {
458
+		if ( $this->api_url == trailingslashit( home_url() ) ) {
459 459
 			return false; // Don't allow a plugin to ping itself
460 460
 		}
461 461
 
462 462
 		$api_params = array(
463 463
 			'edd_action' => 'get_version',
464
-			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
465
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
466
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
467
-			'version'    => isset( $data['version'] ) ? $data['version'] : false,
468
-			'slug'       => $data['slug'],
469
-			'author'     => $data['author'],
464
+			'license'    => ! empty( $data[ 'license' ] ) ? $data[ 'license' ] : '',
465
+			'item_name'  => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false,
466
+			'item_id'    => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false,
467
+			'version'    => isset( $data[ 'version' ] ) ? $data[ 'version' ] : false,
468
+			'slug'       => $data[ 'slug' ],
469
+			'author'     => $data[ 'author' ],
470 470
 			'url'        => home_url(),
471
-			'beta'       => ! empty( $data['beta'] ),
471
+			'beta'       => ! empty( $data[ 'beta' ] ),
472 472
 		);
473 473
 
474
-		$request    = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
474
+		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
475 475
 
476 476
 		if ( ! is_wp_error( $request ) ) {
477 477
 			$request = json_decode( wp_remote_retrieve_body( $request ) );
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 			$request->icons = maybe_unserialize( $request->icons );
492 492
 		}
493 493
 
494
-		if( ! empty( $request->sections ) ) {
495
-			foreach( $request->sections as $key => $section ) {
496
-				$request->$key = (array) $section;
494
+		if ( ! empty( $request->sections ) ) {
495
+			foreach ( $request->sections as $key => $section ) {
496
+				$request->$key = (array)$section;
497 497
 			}
498 498
 		}
499 499
 
@@ -507,35 +507,35 @@  discard block
 block discarded – undo
507 507
 
508 508
 		global $edd_plugin_data;
509 509
 
510
-		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
510
+		if ( empty( $_REQUEST[ 'edd_sl_action' ] ) || 'view_plugin_changelog' != $_REQUEST[ 'edd_sl_action' ] ) {
511 511
 			return;
512 512
 		}
513 513
 
514
-		if( empty( $_REQUEST['plugin'] ) ) {
514
+		if ( empty( $_REQUEST[ 'plugin' ] ) ) {
515 515
 			return;
516 516
 		}
517 517
 
518
-		if( empty( $_REQUEST['slug'] ) ) {
518
+		if ( empty( $_REQUEST[ 'slug' ] ) ) {
519 519
 			return;
520 520
 		}
521 521
 
522
-		if( ! current_user_can( 'update_plugins' ) ) {
522
+		if ( ! current_user_can( 'update_plugins' ) ) {
523 523
 			wp_die( __( 'You do not have permission to install plugin updates', 'gravityview' ), __( 'Error', 'gravityview' ), array( 'response' => 403 ) );
524 524
 		}
525 525
 
526
-		$data         = $edd_plugin_data[ $_REQUEST['slug'] ];
526
+		$data         = $edd_plugin_data[ $_REQUEST[ 'slug' ] ];
527 527
 		$version_info = $this->get_cached_version_info();
528 528
 
529
-		if( false === $version_info ) {
529
+		if ( false === $version_info ) {
530 530
 
531 531
 			$api_params = array(
532 532
 				'edd_action' => 'get_version',
533
-				'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
534
-				'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
535
-				'slug'       => $_REQUEST['slug'],
536
-				'author'     => $data['author'],
533
+				'item_name'  => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false,
534
+				'item_id'    => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false,
535
+				'slug'       => $_REQUEST[ 'slug' ],
536
+				'author'     => $data[ 'author' ],
537 537
 				'url'        => home_url(),
538
-				'beta'       => ! empty( $data['beta'] )
538
+				'beta'       => ! empty( $data[ 'beta' ] )
539 539
 			);
540 540
 
541 541
 			$verify_ssl = $this->verify_ssl();
@@ -551,22 +551,22 @@  discard block
 block discarded – undo
551 551
 				$version_info = false;
552 552
 			}
553 553
 
554
-			if( ! empty( $version_info ) ) {
555
-				foreach( $version_info->sections as $key => $section ) {
556
-					$version_info->$key = (array) $section;
554
+			if ( ! empty( $version_info ) ) {
555
+				foreach ( $version_info->sections as $key => $section ) {
556
+					$version_info->$key = (array)$section;
557 557
 				}
558 558
 			}
559 559
 
560 560
 			$this->set_version_info_cache( $version_info );
561 561
 
562 562
 			// Delete the unneeded option
563
-			delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) );
563
+			delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST[ 'plugin' ] ) . '_' . $this->beta . '_version_info' ) );
564 564
 		}
565 565
 
566 566
 		if ( isset( $version_info->sections ) ) {
567 567
 			$sections = $this->convert_object_to_array( $version_info->sections );
568
-			if ( ! empty( $sections['changelog'] ) ) {
569
-				echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
568
+			if ( ! empty( $sections[ 'changelog' ] ) ) {
569
+				echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections[ 'changelog' ] ) . '</div>';
570 570
 			}
571 571
 		}
572 572
 
@@ -581,25 +581,25 @@  discard block
 block discarded – undo
581 581
 	 */
582 582
 	public function get_cached_version_info( $cache_key = '' ) {
583 583
 
584
-		if( empty( $cache_key ) ) {
584
+		if ( empty( $cache_key ) ) {
585 585
 			$cache_key = $this->cache_key;
586 586
 		}
587 587
 
588 588
 		$cache = get_option( $cache_key );
589 589
 
590
-		if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
590
+		if ( empty( $cache[ 'timeout' ] ) || time() > $cache[ 'timeout' ] ) {
591 591
 			return false; // Cache is expired
592 592
 		}
593 593
 
594 594
 		// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
595
-		$cache['value'] = json_decode( $cache['value'] );
596
-		if ( ! empty( $cache['value']->icons ) ) {
597
-			$cache['value']->icons = (array) $cache['value']->icons;
595
+		$cache[ 'value' ] = json_decode( $cache[ 'value' ] );
596
+		if ( ! empty( $cache[ 'value' ]->icons ) ) {
597
+			$cache[ 'value' ]->icons = (array)$cache[ 'value' ]->icons;
598 598
 		} else {
599
-			$cache['value']->icons = array();
599
+			$cache[ 'value' ]->icons = array();
600 600
 		}
601 601
 
602
-		return $cache['value'];
602
+		return $cache[ 'value' ];
603 603
 
604 604
 	}
605 605
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	 */
612 612
 	public function set_version_info_cache( $value = '', $cache_key = '' ) {
613 613
 
614
-		if( empty( $cache_key ) ) {
614
+		if ( empty( $cache_key ) ) {
615 615
 			$cache_key = $this->cache_key;
616 616
 		}
617 617
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 		update_option( $cache_key, $data, 'no' );
624 624
 
625 625
 		// Delete the duplicate option
626
-		delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
626
+		delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ) );
627 627
 	}
628 628
 
629 629
 	/**
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 * @return bool
634 634
 	 */
635 635
 	private function verify_ssl() {
636
-		return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
636
+		return (bool)apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
637 637
 	}
638 638
 
639 639
 }
Please login to merge, or discard this patch.
includes/load-plugin-and-theme-hooks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
 $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' );
22 22
 
23 23
 // Load all plugin files automatically
24
-foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) {
24
+foreach ( (array)$plugin_hooks_files as $plugin_hooks_file ) {
25 25
 	include $plugin_hooks_file;
26 26
 }
27 27
 
28 28
 $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' );
29 29
 
30 30
 // Load all theme files automatically
31
-foreach ( (array) $theme_hooks_files as $theme_hooks_file ) {
31
+foreach ( (array)$theme_hooks_files as $theme_hooks_file ) {
32 32
 	include $theme_hooks_file;
33 33
 }
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 		add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) );
66 66
 
67
-		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') );
67
+		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) );
68 68
 	}
69 69
 
70 70
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	function filter_gravityview_back_link( $link ) {
85 85
 		global $wpml_url_filters;
86 86
 
87
-		if( $wpml_url_filters ) {
87
+		if ( $wpml_url_filters ) {
88 88
 			$link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() );
89 89
 		}
90 90
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	private function remove_url_hooks() {
102 102
 		global $wpml_url_filters;
103 103
 
104
-		if( ! $wpml_url_filters ) {
104
+		if ( ! $wpml_url_filters ) {
105 105
 			return;
106 106
 		}
107 107
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	private function add_url_hooks() {
130 130
 		global $wpml_url_filters;
131 131
 
132
-		if( ! $wpml_url_filters ) {
132
+		if ( ! $wpml_url_filters ) {
133 133
 			return;
134 134
 		}
135 135
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					break;
227 227
 			}
228 228
 
229
-			$languages[ $lang_code ]['url'] = $entry_link;
229
+			$languages[ $lang_code ][ 'url' ] = $entry_link;
230 230
 		}
231 231
 
232 232
 		$this->add_url_hooks();
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-time.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 		add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 );
64 64
 
65
-		add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
65
+		add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
66 66
 	}
67 67
 
68 68
 	/**
@@ -103,35 +103,35 @@  discard block
 block discarded – undo
103 103
 	public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) {
104 104
 
105 105
 		// If the search is not being sorted, return early
106
-		if( empty( $criteria['sorting']['key'] ) ) {
106
+		if ( empty( $criteria[ 'sorting' ][ 'key' ] ) ) {
107 107
 			return $criteria;
108 108
 		}
109 109
 
110
-		$pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] );
110
+		$pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] );
111 111
 
112 112
 		/**
113 113
 		 * If the sort key does not match the key set in modify_sort_id(), do not modify the Gravity Forms query SQL
114 114
 		 * @see modify_sort_id()
115 115
 		 */
116
-		if( empty( $pieces[1] ) ) {
116
+		if ( empty( $pieces[ 1 ] ) ) {
117 117
 			return $criteria;
118 118
 		}
119 119
 
120 120
 		// Pass these to the _modify_query_sort_by_time_hack() method
121
-		$this->_time_format = $pieces[1];
122
-		$this->_date_format = $pieces[2];
121
+		$this->_time_format = $pieces[ 1 ];
122
+		$this->_date_format = $pieces[ 2 ];
123 123
 
124 124
 		// Remove fake input IDs (5.1 doesn't exist. Use 5)
125
-		$criteria['sorting']['key'] = floor( $pieces[0] );
125
+		$criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] );
126 126
 
127 127
 		/**
128 128
 		 * Make sure sorting is numeric (# of seconds). IMPORTANT.
129 129
 		 * @see GVCommon::is_field_numeric() is_numeric should also be set here
130 130
 		 */
131
-		$criteria['sorting']['is_numeric'] = true;
131
+		$criteria[ 'sorting' ][ 'is_numeric' ] = true;
132 132
 
133 133
 		// Modify the Gravity Forms WP Query
134
-		add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) );
134
+		add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) );
135 135
 
136 136
 		return $criteria;
137 137
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 		 * then we want to modify the query.
153 153
 		 * @see GFFormsModel::sort_by_field_query()
154 154
 		 */
155
-		if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
155
+		if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
156 156
 
157
-			if( $this->_time_format === '24' ) {
157
+			if ( $this->_time_format === '24' ) {
158 158
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )";
159 159
 			} else {
160 160
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )";
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 		// Set variables
201 201
 		parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
202 202
 
203
-		if( 'edit' === $context ) {
203
+		if ( 'edit' === $context ) {
204 204
 			return $field_options;
205 205
 		}
206 206
 
207 207
 		/**
208 208
 		 * Set default date format based on field ID and Form ID
209 209
 		 */
210
-		add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
210
+		add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
211 211
 
212
-		$this->add_field_support('date_display', $field_options );
212
+		$this->add_field_support( 'date_display', $field_options );
213 213
 
214
-		remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
214
+		remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
215 215
 
216 216
 		return $field_options;
217 217
 	}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	private function _get_time_format() {
227 227
 		global $post;
228 228
 
229
-		$current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID );
229
+		$current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID );
230 230
 
231 231
 		return self::_get_time_format_for_field( $this->_field_id, $current_form );
232 232
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		// GF defaults to 12, so should we.
246 246
 		$time_format = '12';
247 247
 
248
-		if( $form_id ) {
248
+		if ( $form_id ) {
249 249
 			$form = GFAPI::get_form( $form_id );
250 250
 
251 251
 			if ( $form ) {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 		$default = 'h:i A';
293 293
 
294 294
 		// This doesn't take into account 24-hour
295
-		switch( $field_input_id ) {
295
+		switch ( $field_input_id ) {
296 296
 			// Hours
297 297
 			case 1:
298 298
 				return ( $time_format === '12' ) ? 'h' : 'H';
Please login to merge, or discard this patch.