Completed
Push — develop ( 0f62fb...a567e4 )
by Zack
17:40 queued 12s
created
includes/admin/class-gravityview-admin-no-conflict.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		if( ! is_admin() ) { return; }
21
+		if ( ! is_admin() ) { return; }
22 22
 		
23 23
 		$this->add_hooks();
24 24
 	}
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	private function add_hooks() {
34 34
 		//Hooks for no-conflict functionality
35
-		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
36
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
35
+		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 );
36
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 );
37 37
 
38
-		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
39
-		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
40
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
41
-		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
38
+		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 );
39
+		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 );
40
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 );
41
+		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 );
42 42
 	}
43 43
 
44 44
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	function no_conflict_scripts() {
52 52
 		global $wp_scripts;
53 53
 
54
-		if( ! gravityview()->request->is_admin( '', null ) ) {
54
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
55 55
 			return;
56 56
 		}
57 57
 
58 58
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
59 59
 
60
-		if( empty( $no_conflict_mode ) ) {
60
+		if ( empty( $no_conflict_mode ) ) {
61 61
 			return;
62 62
 		}
63 63
 
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	function no_conflict_styles() {
117 117
 		global $wp_styles;
118 118
 
119
-		if( ! gravityview()->request->is_admin( '', null ) ) {
119
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
120 120
 			return;
121 121
 		}
122 122
 
123 123
 		// Dequeue other jQuery styles even if no-conflict is off.
124 124
 		// Terrible-looking tabs help no one.
125
-		if( !empty( $wp_styles->registered ) )  {
126
-			foreach ($wp_styles->registered as $key => $style) {
127
-				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
125
+		if ( ! empty( $wp_styles->registered ) ) {
126
+			foreach ( $wp_styles->registered as $key => $style ) {
127
+				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
128 128
 					wp_dequeue_style( $key );
129 129
 				}
130 130
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
134 134
 
135 135
 		// If no conflict is off, jQuery will suffice.
136
-		if( empty( $no_conflict_mode ) ) {
136
+		if ( empty( $no_conflict_mode ) ) {
137 137
 			return;
138 138
 		}
139 139
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		/**
162 162
 		 * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here.
163 163
 		 */
164
-		do_action('gravityview_remove_conflicts_after');
164
+		do_action( 'gravityview_remove_conflicts_after' );
165 165
 	}
166 166
 
167 167
 	/**
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
 		//reset queue
196 196
 		$queue = array();
197
-		foreach( $wp_objects->queue as $object ) {
198
-			if( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
-				$queue[] = $object;
197
+		foreach ( $wp_objects->queue as $object ) {
198
+			if ( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
+				$queue[ ] = $object;
200 200
 			}
201 201
 		}
202 202
 		$wp_objects->queue = $queue;
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
 		//unregistering scripts
207 207
 		$registered = array();
208
-		foreach( $wp_objects->registered as $handle => $script_registration ){
209
-			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){
208
+		foreach ( $wp_objects->registered as $handle => $script_registration ) {
209
+			if ( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) {
210 210
 				$registered[ $handle ] = $script_registration;
211 211
 			}
212 212
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @param array $registered [description]
222 222
 	 * @param array $scripts    [description]
223 223
 	 */
224
-	private function add_script_dependencies($registered, $scripts) {
224
+	private function add_script_dependencies( $registered, $scripts ) {
225 225
 
226 226
 		//gets all dependent scripts linked to the $scripts array passed
227 227
 		do {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 				$deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array();
231 231
 				foreach ( $deps as $dep ) {
232 232
 					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) {
233
-						$dependents[] = $dep;
233
+						$dependents[ ] = $dep;
234 234
 					}
235 235
 				}
236 236
 			}
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		// Dequeue other jQuery styles even if no-conflict is off.
124 124
 		// Terrible-looking tabs help no one.
125
-		if( !empty( $wp_styles->registered ) )  {
125
+		if( !empty( $wp_styles->registered ) ) {
126 126
 			foreach ($wp_styles->registered as $key => $style) {
127 127
 				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
128 128
 					wp_dequeue_style( $key );
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
 		//unregistering scripts
207 207
 		$registered = array();
208
-		foreach( $wp_objects->registered as $handle => $script_registration ){
209
-			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){
208
+		foreach( $wp_objects->registered as $handle => $script_registration ) {
209
+			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) {
210 210
 				$registered[ $handle ] = $script_registration;
211 211
 			}
212 212
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-license-handler.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 			'author'    => self::author,
99 99
 			'language'  => get_locale(),
100 100
 			'url'       => home_url(),
101
-		    'beta'      => $this->settings->get( 'beta' ),
101
+			'beta'      => $this->settings->get( 'beta' ),
102 102
 			'php_version' => phpversion(),
103 103
 			'wp_version' => get_bloginfo( 'version' ),
104 104
 			'gv_version' => \GV\Plugin::$version,
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	private function license_call_update_settings( $license_data, $data ) {
523 523
 		$settings = array();
524 524
 
525
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
525
+		$settings['license_key'] = $license_data->license_key = trim( $data['license'] );
526 526
 		$settings['license_key_status'] = $license_data->license;
527 527
 		$settings['license_key_response'] = (array)$license_data;
528 528
 
@@ -663,14 +663,14 @@  discard block
 block discarded – undo
663 663
 			// Call the custom API.
664 664
 			$response = wp_remote_post( self::url, array(
665 665
 				'timeout'   => 15,
666
-			    'sslverify' => false,
667
-			    'body'      =>  array(
668
-				    'edd_action' => 'check_license',
669
-				    'license'    => trim( $this->settings->get( 'license_key' ) ),
670
-				    'item_name'  => self::name,
671
-				    'url'        => home_url(),
672
-				    'site_data'  => $this->get_site_data(),
673
-			    ),
666
+				'sslverify' => false,
667
+				'body'      =>  array(
668
+					'edd_action' => 'check_license',
669
+					'license'    => trim( $this->settings->get( 'license_key' ) ),
670
+					'item_name'  => self::name,
671
+					'url'        => home_url(),
672
+					'site_data'  => $this->get_site_data(),
673
+				),
674 674
 			));
675 675
 
676 676
 			// make sure the response came back okay
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		);
107 107
 
108 108
 		if ( ! empty( $action ) ) {
109
-			$settings['edd_action'] = esc_attr( $action );
109
+			$settings[ 'edd_action' ] = esc_attr( $action );
110 110
 		}
111 111
 
112 112
 		return array_map( 'urlencode', $settings );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		}
127 127
 
128 128
 		// If doing ajax, get outta here.
129
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
129
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) {
130 130
 			return;
131 131
 		}
132 132
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			'format' => 'json',
174 174
 		) );
175 175
 
176
-		if ( $is_ajax && empty( $data['license'] ) ) {
176
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
177 177
 			die( -1 );
178 178
 		}
179 179
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 
202 202
 			$json = json_encode( $license_data );
203 203
 
204
-			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action');
204
+			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' );
205 205
 
206 206
 			$is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX );
207 207
 
208
-			do_action('gravityview/admin_installer/delete_downloads_data', true );
208
+			do_action( 'gravityview/admin_installer/delete_downloads_data', true );
209 209
 
210 210
 			if ( $is_check_action_button ) {
211 211
 				delete_transient( self::status_transient_key );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			// most likely a mistake.
217 217
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
218 218
 
219
-				if ( ! empty( $data['field_id'] ) ) {
219
+				if ( ! empty( $data[ 'field_id' ] ) ) {
220 220
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
221 221
 				}
222 222
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			$class   = 'hide';
245 245
 			$message = '';
246 246
 		} else {
247
-			if( ! empty( $license_data->error ) ) {
247
+			if ( ! empty( $license_data->error ) ) {
248 248
 				$class = 'error';
249 249
 				$string_key = $license_data->error;
250 250
 			} else { $class = $license_data->license;
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public function license_details( $response = array() ) {
270 270
 
271
-		$response = (array) $response;
271
+		$response = (array)$response;
272 272
 
273 273
 		$return  = '';
274 274
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
275 275
 
276
-		if ( ! empty( $response['license_key'] ) ) {
276
+		if ( ! empty( $response[ 'license_key' ] ) ) {
277 277
 			$return .= '<h3>' . rtrim( esc_html__( 'License Details:', 'gravityview' ), ':' ) . '</h3>';
278 278
 
279 279
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 				}
283 283
 
284 284
 
285
-				$return .= $this->strings( $response['license'], $response );
286
-			} elseif ( ! empty( $response['license_name'] ) ) {
285
+				$return .= $this->strings( $response[ 'license' ], $response );
286
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
287 287
 				$response_keys = array(
288 288
 					'license_name'   => '',
289 289
 					'license_limit'  => '',
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
 				$response = wp_parse_args( $response, $response_keys );
299 299
 
300 300
 				$login_link_class = gravityview()->plugin->is_GF_25() ? 'button button-outline outline' : 'text-link';
301
-				$renews_on = ( 'lifetime' === $response['expires'] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) );
302
-				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
303
-				$local_text       = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
304
-				$license_limit    = empty( $response['license_limit'] ) ? __( 'Unlimited', 'gravityview' ) : (int) $response['license_limit'];
301
+				$renews_on = ( 'lifetime' === $response[ 'expires' ] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) );
302
+				$login_link       = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
303
+				$local_text       = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
304
+				$license_limit    = empty( $response[ 'license_limit' ] ) ? __( 'Unlimited', 'gravityview' ) : (int)$response[ 'license_limit' ];
305 305
 
306 306
 
307 307
 				$details = array(
308
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response['license_name'] ) . '</span>' ),
309
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . '</span>' . $renews_on . $login_link,
310
-					'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response['site_count'] ), esc_html( $license_limit ) ) . '</span>' . $local_text,
311
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
308
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response[ 'license_name' ] ) . '</span>' ),
309
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . '</span>' . $renews_on . $login_link,
310
+					'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response[ 'site_count' ] ), esc_html( $license_limit ) ) . '</span>' . $local_text,
311
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
312 312
 				);
313 313
 
314
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
315
-					unset( $details['upgrade'] );
316
-					$details['licensed_to'] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
314
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
315
+					unset( $details[ 'upgrade' ] );
316
+					$details[ 'licensed_to' ] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
317 317
 				}
318 318
 
319 319
 				$return .= '<ul>';
@@ -345,20 +345,20 @@  discard block
 block discarded – undo
345 345
 		if ( ! empty( $upgrades ) ) {
346 346
 
347 347
 			$locale_parts = explode( '_', get_locale() );
348
-			$is_english = ( 'en' === $locale_parts[0] );
348
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
349 349
 
350 350
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
351 351
 			$output .= '<ul>';
352 352
 
353 353
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
354
-				$upgrade = (object) $upgrade;
354
+				$upgrade = (object)$upgrade;
355 355
 
356 356
 				$anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) );
357 357
 
358 358
 				if ( $is_english && isset( $upgrade->description ) ) {
359 359
 					$message = esc_html( $upgrade->description );
360 360
 				} else {
361
-					switch( $upgrade->price_id ) {
361
+					switch ( $upgrade->price_id ) {
362 362
 						// Interstellar
363 363
 						case 1:
364 364
 						default:
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			'invalid_item_id' => esc_html__( 'This license key does not have access to this plugin.', 'gravityview' ),
438 438
 			'missing' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), // Missing is "the license couldn't be found", not "you submitted an empty license"
439 439
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
440
-			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
440
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
441 441
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
442 442
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
443 443
 			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
 		if ( ! empty( $license_data->renewal_url ) ) {
467 467
 			$renew_license_url = $license_data->renewal_url;
468
-		} elseif( ! empty( $license_data->license_key ) ) {
468
+		} elseif ( ! empty( $license_data->license_key ) ) {
469 469
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
470 470
 		} else {
471 471
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 * @return array|\WP_Error
483 483
 	 */
484 484
 	private function _license_get_remote_response( $data, $license = '' ) {
485
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
485
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
486 486
 
487 487
 		$url = add_query_arg( $api_params, self::url );
488 488
 
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 	private function license_call_update_settings( $license_data, $data ) {
523 523
 		$settings = array();
524 524
 
525
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
526
-		$settings['license_key_status'] = $license_data->license;
527
-		$settings['license_key_response'] = (array)$license_data;
525
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
526
+		$settings[ 'license_key_status' ] = $license_data->license;
527
+		$settings[ 'license_key_response' ] = (array)$license_data;
528 528
 
529 529
 		$this->settings->set( $settings );
530 530
 	}
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 		$status = trim( $this->settings->get( 'license_key_status' ) );
545 545
 		$key = trim( $this->settings->get( 'license_key' ) );
546 546
 
547
-		if (  !empty( $key ) ) {
547
+		if ( ! empty( $key ) ) {
548 548
 			$response = $this->settings->get( 'license_key_response' );
549
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
549
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
550 550
 		} else {
551 551
 			$response = array();
552 552
 		}
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
 
590 590
 		$submit = '<div class="gv-edd-button-wrapper">';
591 591
 		foreach ( $fields as $field ) {
592
-			$field['type'] = 'button';
593
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
594
-			$field['style'] = 'margin-left: 10px;';
595
-			if( $disabled_attribute ) {
596
-				$field['disabled'] = $disabled_attribute;
592
+			$field[ 'type' ] = 'button';
593
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
594
+			$field[ 'style' ] = 'margin-left: 10px;';
595
+			if ( $disabled_attribute ) {
596
+				$field[ 'disabled' ] = $disabled_attribute;
597 597
 			}
598 598
 			$submit .= $this->settings->as_html( $field, $echo );
599 599
 		}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 				    'url'        => home_url(),
672 672
 				    'site_data'  => $this->get_site_data(),
673 673
 			    ),
674
-			));
674
+			) );
675 675
 
676 676
 			// make sure the response came back okay
677 677
 			if ( is_wp_error( $response ) ) {
@@ -701,45 +701,45 @@  discard block
 block discarded – undo
701 701
 		$theme_data = wp_get_theme();
702 702
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
703 703
 
704
-		$data['gv_version']  = Plugin::$version;
705
-		$data['php_version']  = phpversion();
706
-		$data['wp_version']   = get_bloginfo( 'version' );
707
-		$data['gf_version']  = \GFForms::$version;
708
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
709
-		$data['multisite']    = is_multisite();
710
-		$data['theme']        = $theme;
711
-		$data['url']          = home_url();
712
-		$data['license_key']  = $this->settings->get( 'license_key' );
713
-		$data['beta']         = $this->settings->get( 'beta' );
704
+		$data[ 'gv_version' ]  = Plugin::$version;
705
+		$data[ 'php_version' ]  = phpversion();
706
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
707
+		$data[ 'gf_version' ]  = \GFForms::$version;
708
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
709
+		$data[ 'multisite' ]    = is_multisite();
710
+		$data[ 'theme' ]        = $theme;
711
+		$data[ 'url' ]          = home_url();
712
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
713
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
714 714
 
715 715
 		// View Data
716 716
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
717 717
 
718
-		$data['view_count'] = null;
719
-		$data['view_first'] = null;
720
-		$data['view_latest'] = null;
718
+		$data[ 'view_count' ] = null;
719
+		$data[ 'view_first' ] = null;
720
+		$data[ 'view_latest' ] = null;
721 721
 
722 722
 		if ( $gravityview_posts->publish ) {
723
-			$data['view_count'] = $gravityview_posts->publish;
723
+			$data[ 'view_count' ] = $gravityview_posts->publish;
724 724
 
725 725
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
726 726
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
727 727
 
728 728
 			if ( $first = array_shift( $first ) ) {
729
-				$data['view_first'] = $first->post_date;
729
+				$data[ 'view_first' ] = $first->post_date;
730 730
 			}
731 731
 			if ( $latest = array_pop( $latest ) ) {
732
-				$data['view_latest'] = $latest->post_date;
732
+				$data[ 'view_latest' ] = $latest->post_date;
733 733
 			}
734 734
 		}
735 735
 
736 736
 		// Form counts
737 737
 		if ( class_exists( 'GFFormsModel' ) ) {
738 738
 			$form_data = \GFFormsModel::get_form_count();
739
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
740
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
741
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
742
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
739
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
740
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
741
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
742
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
743 743
 		}
744 744
 
745 745
 		// Retrieve current plugin information
@@ -747,13 +747,13 @@  discard block
 block discarded – undo
747 747
 			include ABSPATH . '/wp-admin/includes/plugin.php';
748 748
 		}
749 749
 
750
-		$data['integrations']     = self::get_related_plugins_and_extensions();
751
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
752
-		$data['inactive_plugins'] = array();
753
-		$data['locale']           = get_locale();
750
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
751
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
752
+		$data[ 'inactive_plugins' ] = array();
753
+		$data[ 'locale' ]           = get_locale();
754 754
 
755 755
 		// Validate request on the GV server
756
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
756
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
757 757
 
758 758
 		return $data;
759 759
 	}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
 				$plugin_data = get_plugin_data( $active_plugin );
785 785
 
786
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
786
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
787 787
 			}
788 788
 
789 789
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		}
127 127
 
128 128
 		// If doing ajax, get outta here.
129
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
129
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) {
130 130
 			return;
131 131
 		}
132 132
 
@@ -191,7 +191,8 @@  discard block
 block discarded – undo
191 191
 			if ( empty( $license_data ) ) {
192 192
 				if ( $is_ajax ) {
193 193
 					exit( json_encode( array() ) );
194
-				} else { // Non-ajax call
194
+				} else {
195
+// Non-ajax call
195 196
 					return json_encode( array() );
196 197
 				}
197 198
 			}
@@ -226,7 +227,8 @@  discard block
 block discarded – undo
226 227
 
227 228
 		if ( $is_ajax ) {
228 229
 			exit( $json );
229
-		} else { // Non-ajax call
230
+		} else {
231
+// Non-ajax call
230 232
 			return ( Utils::_GET( 'format', Utils::get( $data, 'format' ) ) === 'object' ) ? $license_data : $json;
231 233
 		}
232 234
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-extension.php 3 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 		$tab = wp_parse_args( $tab_settings, $tab_defaults );
181 181
 
182 182
 		// Force the screen to be GravityView
183
-		$tab['screen'] = 'gravityview';
183
+		$tab[ 'screen' ] = 'gravityview';
184 184
 
185 185
 		if ( class_exists( 'GravityView_Metabox_Tab' ) ) {
186
-			$metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] );
186
+			$metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] );
187 187
 			\GravityView_Metabox_Tabs::add( $metabox );
188 188
 		} else {
189
-			add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] );
189
+			add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] );
190 190
 		}
191 191
 	}
192 192
 
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	protected function is_extension_supported() {
213 213
 
214
-		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible );
214
+		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible );
215 215
 
216 216
 		if ( ! function_exists( 'gravityview' ) ) {
217 217
 			$message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) );
218
-		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) {
219
-			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' );
220
-		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) {
221
-			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' );
218
+		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) {
219
+			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' );
220
+		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) {
221
+			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' );
222 222
 		} else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) {
223 223
 			$message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) );
224 224
 		} else {
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$locale = get_locale();
260 260
 
261
-		if ( function_exists('get_user_locale') && is_admin() ) {
261
+		if ( function_exists( 'get_user_locale' ) && is_admin() ) {
262 262
 			$locale = get_user_locale();
263 263
 		}
264 264
 
265 265
 		// Traditional WordPress plugin locale filter
266
-		$locale = apply_filters( 'plugin_locale',  $locale, $this->_text_domain );
266
+		$locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain );
267 267
 
268 268
 		$mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale );
269 269
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	public function settings() {
292 292
 
293 293
 		// If doing ajax, get outta here.
294
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
294
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) {
295 295
 			return;
296 296
 		}
297 297
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             	'version'	=> $this->_version, // current version number
315 315
             	'license'	=> \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ),
316 316
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
317
-            	'item_name' => $this->_title,  // name of this plugin
318
-            	'author' 	=> strip_tags( $this->_author ),  // author of this plugin
317
+            	'item_name' => $this->_title, // name of this plugin
318
+            	'author' 	=> strip_tags( $this->_author ), // author of this plugin
319 319
 	            'php_version' => phpversion(),
320 320
 	            'wp_version' => get_bloginfo( 'version' ),
321 321
 	            'gv_version' => \GV\Plugin::$version,
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public static function add_notice( $notice = array() ) {
349 349
 
350
-		if ( is_array( $notice ) && empty( $notice['message'] ) ) {
350
+		if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) {
351 351
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
352 352
 			return;
353 353
 		} else if ( is_string( $notice ) ) {
354 354
 			$notice = array( 'message' => $notice );
355 355
 		}
356 356
 
357
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
357
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
358 358
 
359
-		self::$admin_notices []= $notice;
359
+		self::$admin_notices [ ] = $notice;
360 360
 	}
361 361
 
362 362
 	/**
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 		}
371 371
 
372 372
 		foreach ( self::$admin_notices as $key => $notice ) {
373
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
374
-			echo wpautop( $notice['message'] );
373
+			echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">';
374
+			echo wpautop( $notice[ 'message' ] );
375 375
 			echo '<div class="clear"></div>';
376 376
 			echo '</div>';
377 377
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -291,7 +291,7 @@
 block discarded – undo
291 291
 	public function settings() {
292 292
 
293 293
 		// If doing ajax, get outta here.
294
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
294
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) {
295 295
 			return;
296 296
 		}
297 297
 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -311,17 +311,17 @@
 block discarded – undo
311 311
 			$this->_remote_update_url,
312 312
 			$this->_path,
313 313
 			array(
314
-            	'version'	=> $this->_version, // current version number
315
-            	'license'	=> \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ),
316
-	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
317
-            	'item_name' => $this->_title,  // name of this plugin
318
-            	'author' 	=> strip_tags( $this->_author ),  // author of this plugin
319
-	            'php_version' => phpversion(),
320
-	            'wp_version' => get_bloginfo( 'version' ),
321
-	            'gv_version' => \GV\Plugin::$version,
322
-	            'environment' => function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : 'production',
323
-          	)
324
-        );
314
+				'version'	=> $this->_version, // current version number
315
+				'license'	=> \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ),
316
+				'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
317
+				'item_name' => $this->_title,  // name of this plugin
318
+				'author' 	=> strip_tags( $this->_author ),  // author of this plugin
319
+				'php_version' => phpversion(),
320
+				'wp_version' => get_bloginfo( 'version' ),
321
+				'gv_version' => \GV\Plugin::$version,
322
+				'environment' => function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : 'production',
323
+		  	)
324
+		);
325 325
 	}
326 326
 
327 327
 	/**
Please login to merge, or discard this patch.
includes/wordpress-widgets/class-gravityview-recent-entries-widget.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	function __construct( ) {
14 14
 
15
-		$name = __('GravityView Recent Entries', 'gravityview');
15
+		$name = __( 'GravityView Recent Entries', 'gravityview' );
16 16
 
17 17
 		$widget_options = array(
18 18
 			'description' => __( 'Display the most recent entries for a View', 'gravityview' ),
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	private function initialize() {
27 27
 
28
-		add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') );
28
+		add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
29 29
 
30 30
 		add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) );
31 31
 
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	function ajax_get_view_merge_tag_data() {
40 40
 
41
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) {
41
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) {
42 42
 			exit( false );
43 43
 		}
44 44
 
45
-		$form_id  = gravityview_get_form_id( $_POST['view_id'] );
45
+		$form_id = gravityview_get_form_id( $_POST[ 'view_id' ] );
46 46
 
47 47
 		$form = RGFormsModel::get_form_meta( $form_id );
48 48
 
49 49
 		$output = array(
50 50
 			'form' => array(
51
-				'id' => $form['id'],
52
-				'title' => $form['title'],
53
-				'fields' => $form['fields'],
51
+				'id' => $form[ 'id' ],
52
+				'title' => $form[ 'title' ],
53
+				'fields' => $form[ 'fields' ],
54 54
 			),
55
-			'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ),
55
+			'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ),
56 56
 		);
57 57
 
58 58
 		echo json_encode( $output );
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 	function admin_enqueue_scripts() {
69 69
 		global $pagenow;
70 70
 
71
-		if( $pagenow === 'widgets.php' ) {
71
+		if ( $pagenow === 'widgets.php' ) {
72 72
 
73
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
73
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
74 74
 
75
-			wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
75
+			wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
76 76
 
77 77
 			wp_localize_script( 'gravityview_widgets', 'GVWidgets', array(
78 78
 				'nonce' => wp_create_nonce( 'gravityview_ajax_widget' )
79
-			));
79
+			) );
80 80
 
81
-			wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version );
81
+			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version );
82 82
 		}
83 83
 
84 84
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	function widget( $args, $instance ) {
94 94
 
95 95
 		// Don't have the Customizer render too soon.
96
-		if( empty( $instance['view_id'] ) ) {
96
+		if ( empty( $instance[ 'view_id' ] ) ) {
97 97
 			return;
98 98
 		}
99 99
 
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 			return false;
102 102
 		}
103 103
 
104
-		$args['id']        = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries';
105
-		$instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : '';
104
+		$args[ 'id' ]        = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries';
105
+		$instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : '';
106 106
 
107
-		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] );
107
+		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] );
108 108
 
109
-		echo $args['before_widget'];
109
+		echo $args[ 'before_widget' ];
110 110
 
111
-		if ( !empty( $title ) ) {
112
-			echo $args['before_title'] . $title . $args['after_title'];
111
+		if ( ! empty( $title ) ) {
112
+			echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
113 113
 		}
114 114
 
115 115
 		/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		 */
130 130
 		do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance );
131 131
 
132
-		echo $args['after_widget'];
132
+		echo $args[ 'after_widget' ];
133 133
 	}
134 134
 
135 135
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	private function get_output( $instance ) {
145 145
 
146
-		$form_id = gravityview_get_form_id( $instance['view_id'] );
146
+		$form_id = gravityview_get_form_id( $instance[ 'view_id' ] );
147 147
 
148 148
 		$form = gravityview_get_form( $form_id );
149 149
 
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 		 * @since 1.6.1
154 154
 		 * @var int $entry_link_post_id The ID to use as the parent post for the entry
155 155
 		 */
156
-		$entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id'];
156
+		$entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ];
157 157
 
158 158
 		/**
159 159
 		 * Generate list output
160 160
 		 * @since 1.7.2
161 161
 		 */
162
-		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget', null, $instance['view_id'] );
162
+		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget', null, $instance[ 'view_id' ] );
163 163
 
164 164
 		$output = $List->get_output();
165 165
 
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	private function get_entries( $instance, $form_id ) {
186 186
 
187
-		$view = \GV\View::by_id( $instance['view_id'] );
187
+		$view = \GV\View::by_id( $instance[ 'view_id' ] );
188 188
 
189
-		$limit = isset( $instance['limit'] ) ? $instance['limit'] : 10;
189
+		$limit = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10;
190 190
 
191 191
 		$view->settings->set( 'page_size', $limit );
192 192
 
@@ -209,23 +209,23 @@  discard block
 block discarded – undo
209 209
 		$instance = $new_instance;
210 210
 
211 211
 		// Force positive number
212
-		$instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] );
212
+		$instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] );
213 213
 
214
-		$instance['view_id'] = intval( $instance['view_id'] );
214
+		$instance[ 'view_id' ] = intval( $instance[ 'view_id' ] );
215 215
 
216
-		$instance['link_format'] = trim( rtrim( $instance['link_format'] ) );
216
+		$instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) );
217 217
 
218
-		$instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format'];
218
+		$instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ];
219 219
 
220
-		$instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] );
220
+		$instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] );
221 221
 
222
-		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true );
222
+		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true );
223 223
 
224 224
 		//check if post_id is a valid post with embedded View
225
-		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
225
+		$instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
226 226
 
227 227
 		// Share that the widget isn't brand new
228
-		$instance['updated']  = 1;
228
+		$instance[ 'updated' ] = 1;
229 229
 
230 230
 		/**
231 231
 		 * Modify the updated instance. This will allow for validating any added instance settings externally.
@@ -247,22 +247,22 @@  discard block
 block discarded – undo
247 247
 
248 248
 		// Set up some default widget settings.
249 249
 		$defaults = array(
250
-			'title' 			=> __('Recent Entries', 'gravityview'),
250
+			'title' 			=> __( 'Recent Entries', 'gravityview' ),
251 251
 			'view_id'           => NULL,
252 252
 			'post_id'           => NULL,
253 253
 			'limit'            => 10,
254
-			'link_format'       => __('Entry #{entry_id}', 'gravityview'),
254
+			'link_format'       => __( 'Entry #{entry_id}', 'gravityview' ),
255 255
 			'after_link'        => ''
256 256
 		);
257 257
 
258
-		$instance = wp_parse_args( (array) $instance, $defaults );
258
+		$instance = wp_parse_args( (array)$instance, $defaults );
259 259
 
260 260
 		?>
261 261
 
262 262
 		<!-- Title -->
263 263
 		<p>
264 264
 			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label>
265
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
265
+			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" />
266 266
 		</p>
267 267
 
268 268
 		<!-- Download -->
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$views = get_posts( $args );
276 276
 
277 277
 		// If there are no views set up yet, we get outta here.
278
-		if( empty( $views ) ) {
278
+		if ( empty( $views ) ) {
279 279
 			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>';
280 280
 			return;
281 281
 		}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		 * Display errors generated for invalid embed IDs
288 288
 		 * @see GravityView_View_Data::is_valid_embed_id
289 289
 		 */
290
-		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
290
+		if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) {
291 291
 			?>
292 292
 			<div class="error inline hide-on-view-change">
293
-				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
293
+				<p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p>
294 294
 			</div>
295 295
 			<?php
296 296
 			unset ( $error );
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
 		?>
299 299
 
300 300
 		<p>
301
-			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label>
301
+			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label>
302 302
 			<select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>">
303 303
 				<option value=""><?php esc_html_e( '&mdash; Select a View as Entries Source &mdash;', 'gravityview' ); ?></option>
304 304
 				<?php
305 305
 
306
-				foreach( $views as $view ) {
307
-					$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
308
-					echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
306
+				foreach ( $views as $view ) {
307
+					$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
308
+					echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
309 309
 				}
310 310
 
311 311
 				?>
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 		 * Display errors generated for invalid embed IDs
318 318
 		 * @see GravityView_View_Data::is_valid_embed_id
319 319
 		 */
320
-		if( !empty( $instance['error_post_id'] ) ) {
320
+		if ( ! empty( $instance[ 'error_post_id' ] ) ) {
321 321
 			?>
322 322
 			<div class="error inline">
323
-				<p><?php echo $instance['error_post_id']; ?></p>
323
+				<p><?php echo $instance[ 'error_post_id' ]; ?></p>
324 324
 			</div>
325 325
 			<?php
326 326
 			unset ( $error );
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 		?>
329 329
 
330 330
 		<p>
331
-			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
332
-			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" />
331
+			<label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
332
+			<input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" />
333 333
 			<span class="howto"><?php
334
-				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
335
-				echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
334
+				esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
335
+				echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more&hellip;', 'gravityview' ), 'target=_blank' );
336 336
 				?></span>
337 337
 		</p>
338 338
 
@@ -340,21 +340,21 @@  discard block
 block discarded – undo
340 340
 			<label for="<?php echo $this->get_field_id( 'limit' ); ?>">
341 341
 				<span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span>
342 342
 			</label>
343
-			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" />
343
+			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" />
344 344
 		</p>
345 345
 
346 346
 		<p>
347 347
 			<label for="<?php echo $this->get_field_id( 'link_format' ); ?>">
348 348
 				<span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span>
349 349
 			</label>
350
-			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
350
+			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
351 351
 		</p>
352 352
 
353 353
 		<p>
354 354
 			<label for="<?php echo $this->get_field_id( 'after_link' ); ?>">
355 355
 				<span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span>
356 356
 			</label>
357
-			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea>
357
+			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea>
358 358
 		</p>
359 359
 
360 360
 		<?php
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		 * @param GravityView_Recent_Entries_Widget $this WP_Widget object
365 365
 		 * @param array $instance Current widget instance
366 366
 		 */
367
-		do_action( 'gravityview_recent_entries_widget_form' , $this, $instance );
367
+		do_action( 'gravityview_recent_entries_widget_form', $this, $instance );
368 368
 
369 369
 		?>
370 370
 
Please login to merge, or discard this patch.
includes/wordpress-widgets/class-gravityview-search-wp-widget.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 		$widget_ops = array(
13 13
 			'classname' => 'widget_gravityview_search',
14
-			'description' => __( 'A search form for a specific GravityView.', 'gravityview')
14
+			'description' => __( 'A search form for a specific GravityView.', 'gravityview' )
15 15
 		);
16 16
 
17 17
 		$widget_display = array(
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	}
35 35
 
36 36
 	private function load_required_files() {
37
-		if( !class_exists( 'GravityView_Widget_Search' ) ) {
37
+		if ( ! class_exists( 'GravityView_Widget_Search' ) ) {
38 38
 			gravityview_register_gravityview_widgets();
39 39
 		}
40 40
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 
59 59
 		// Don't show unless a View ID has been set.
60
-		if( empty( $instance['view_id'] ) ) {
60
+		if ( empty( $instance[ 'view_id' ] ) ) {
61 61
 
62 62
 			gravityview()->log->debug( 'No View ID has been defined. Not showing the widget.', array( 'data' => $instance ) );
63 63
 
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
70 70
 		}
71 71
 
72 72
 		/** This filter is documented in wp-includes/default-widgets.php */
73
-		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
73
+		$title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base );
74 74
 
75
-		echo $args['before_widget'];
75
+		echo $args[ 'before_widget' ];
76 76
 
77 77
 		if ( $title ) {
78
-			echo $args['before_title'] . $title . $args['after_title'];
78
+			echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
79 79
 		}
80 80
 
81 81
 		// @todo Add to the widget configuration form
82
-		$instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance );
82
+		$instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance );
83 83
 
84
-		$instance['context'] = 'wp_widget';
84
+		$instance[ 'context' ] = 'wp_widget';
85 85
 
86 86
 		// form
87
-		$instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] );
88
-		$instance['form'] = GVCommon::get_form( $instance['form_id'] );
87
+		$instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] );
88
+		$instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] );
89 89
 
90 90
 		// We don't want to overwrite existing context, etc.
91 91
 		$previous_view = GravityView_View::getInstance();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 */
102 102
 		new GravityView_View( $previous_view );
103 103
 
104
-		echo $args['after_widget'];
104
+		echo $args[ 'after_widget' ];
105 105
 	}
106 106
 
107 107
 	/**
@@ -111,27 +111,27 @@  discard block
 block discarded – undo
111 111
 
112 112
 		$instance = $old_instance;
113 113
 
114
-		if( $this->is_preview() ) {
114
+		if ( $this->is_preview() ) {
115 115
 			//Oh! Sorry but still not fully compatible with customizer
116 116
 			return $instance;
117 117
 		}
118 118
 
119
-		$new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() );
119
+		$new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() );
120 120
 
121
-		$instance['title'] = strip_tags( $new_instance['title'] );
122
-		$instance['view_id'] = absint( $new_instance['view_id'] );
123
-		$instance['search_fields'] = $new_instance['search_fields'];
124
-		$instance['post_id'] = $new_instance['post_id'];
125
-		$instance['search_clear'] = $new_instance['search_clear'];
126
-		$instance['search_mode'] = $new_instance['search_mode'];
121
+		$instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
122
+		$instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] );
123
+		$instance[ 'search_fields' ] = $new_instance[ 'search_fields' ];
124
+		$instance[ 'post_id' ] = $new_instance[ 'post_id' ];
125
+		$instance[ 'search_clear' ] = $new_instance[ 'search_clear' ];
126
+		$instance[ 'search_mode' ] = $new_instance[ 'search_mode' ];
127 127
 
128
-		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true );
128
+		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true );
129 129
 
130 130
 		//check if post_id is a valid post with embedded View
131
-		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
131
+		$instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
132 132
 
133 133
 		// Share that the widget isn't brand new
134
-		$instance['updated']  = 1;
134
+		$instance[ 'updated' ] = 1;
135 135
 
136 136
 		return $instance;
137 137
 	}
@@ -142,28 +142,28 @@  discard block
 block discarded – undo
142 142
 	public function form( $instance ) {
143 143
 
144 144
 		// @todo Make compatible with Customizer
145
-		if( $this->is_preview() ) {
145
+		if ( $this->is_preview() ) {
146 146
 
147
-			$warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' );
147
+			$warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' );
148 148
 
149 149
 			echo wpautop( GravityView_Admin::get_floaty() . $warning );
150 150
 
151 151
 			return;
152 152
 		}
153 153
 
154
-		$instance = wp_parse_args( (array) $instance, self::get_defaults() );
154
+		$instance = wp_parse_args( (array)$instance, self::get_defaults() );
155 155
 
156
-		$title    = $instance['title'];
157
-		$view_id  = $instance['view_id'];
158
-		$post_id  = $instance['post_id'];
159
-		$search_fields = $instance['search_fields'];
160
-		$search_clear = $instance['search_clear'];
161
-		$search_mode = $instance['search_mode'];
156
+		$title    = $instance[ 'title' ];
157
+		$view_id  = $instance[ 'view_id' ];
158
+		$post_id  = $instance[ 'post_id' ];
159
+		$search_fields = $instance[ 'search_fields' ];
160
+		$search_clear = $instance[ 'search_clear' ];
161
+		$search_mode = $instance[ 'search_mode' ];
162 162
 
163 163
 		$views = GVCommon::get_all_views();
164 164
 
165 165
 		// If there are no views set up yet, we get outta here.
166
-		if( empty( $views ) ) { ?>
166
+		if ( empty( $views ) ) { ?>
167 167
 			<div id="select_gravityview_view">
168 168
 				<div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div>
169 169
 			</div>
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 		?>
173 173
 
174
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
174
+		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
175 175
 
176 176
 		<?php
177 177
 		/**
178 178
 		 * Display errors generated for invalid embed IDs
179 179
 		 * @see GravityView_View_Data::is_valid_embed_id
180 180
 		 */
181
-		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
181
+		if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) {
182 182
 			?>
183 183
 			<div class="error inline hide-on-view-change">
184
-				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
184
+				<p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p>
185 185
 			</div>
186 186
 			<?php
187 187
 			unset ( $error );
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 
191 191
 		<p>
192 192
 			<label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label>
193
-			<select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat">
193
+			<select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat">
194 194
 				<option value=""><?php esc_html_e( '&mdash; Select a View &mdash;', 'gravityview' ); ?></option>
195 195
 				<?php
196
-				foreach( $views as $view_option ) {
197
-					$title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title;
198
-					echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>';
196
+				foreach ( $views as $view_option ) {
197
+					$title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title;
198
+					echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>';
199 199
 				}
200 200
 				?>
201 201
 			</select>
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 		 * Display errors generated for invalid embed IDs
208 208
 		 * @see GravityView_View_Data::is_valid_embed_id
209 209
 		 */
210
-		if( !empty( $instance['error_post_id'] ) ) {
210
+		if ( ! empty( $instance[ 'error_post_id' ] ) ) {
211 211
 			?>
212 212
 			<div class="error inline">
213
-				<p><?php echo $instance['error_post_id']; ?></p>
213
+				<p><?php echo $instance[ 'error_post_id' ]; ?></p>
214 214
 			</div>
215 215
 			<?php
216 216
 			unset ( $error );
@@ -218,40 +218,40 @@  discard block
 block discarded – undo
218 218
 		?>
219 219
 
220 220
 		<p>
221
-			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
222
-			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" />
221
+			<label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
222
+			<input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" />
223 223
 			<span class="howto"><?php
224
-				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
225
-				echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
224
+				esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
225
+				echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more&hellip;', 'gravityview' ), 'target=_blank' );
226 226
 				?></span>
227 227
 		</p>
228 228
 
229 229
 		<p>
230
-			<label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label>
231
-			<input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0">
232
-			<input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>>
230
+			<label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label>
231
+			<input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0">
232
+			<input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>>
233 233
 		</p>
234 234
 
235 235
 		<p>
236 236
 			<label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label>
237
-			<label for="<?php echo $this->get_field_id('search_mode'); ?>_any">
238
-				<input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>>
237
+			<label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any">
238
+				<input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>>
239 239
 				<?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?>
240 240
 			</label>
241
-			<label for="<?php echo $this->get_field_id('search_mode'); ?>_all">
242
-				<input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>>
241
+			<label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all">
242
+				<input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>>
243 243
 				<?php esc_html_e( 'Match All Fields', 'gravityview' ); ?>
244 244
 			</label>
245
-			<span class="howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span
245
+			<span class="howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span
246 246
 		</p>
247 247
 
248 248
 		<hr />
249 249
 
250 250
 		<?php // @todo: move style to CSS ?>
251 251
 		<div style="margin-bottom: 1em;">
252
-			<label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label>
253
-			<div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>">
254
-				<input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value">
252
+			<label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label>
253
+			<div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>">
254
+				<input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value">
255 255
 			</div>
256 256
 
257 257
 		</div>
Please login to merge, or discard this patch.
trustedlogin/autoload-classmap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 // autoload-classmap.php @generated by Strauss
4 4
 
5
-$trustedlogin = dirname(__FILE__);
5
+$trustedlogin = dirname( __FILE__ );
6 6
 
7 7
 return array(
8 8
    'GravityView\Psr\Log\LoggerAwareTrait' => $trustedlogin . '/psr/log/Psr/Log/LoggerAwareTrait.php',
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 
153 153
 		add_filter( 'gravityview/sortable/field_blocklist', array( $this, '_filter_sortable_fields' ), 1 );
154 154
 
155
-		if( $this->entry_meta_key ) {
155
+		if ( $this->entry_meta_key ) {
156 156
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
157 157
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
158 158
 		}
159 159
 
160
-		if( $this->_custom_merge_tag ) {
160
+		if ( $this->_custom_merge_tag ) {
161 161
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
162 162
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
163 163
 		}
164 164
 
165
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
165
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
166 166
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
167 167
 		}
168 168
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 * Auto-assign label from Gravity Forms label, if exists
171 171
 		 * @since 1.20
172 172
 		 */
173
-		if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
173
+		if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
174 174
 			$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() );
175 175
 		}
176 176
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			'type'  => $this->name
217 217
 		);
218 218
 
219
-		$fields["{$this->entry_meta_key}"] = $added_field;
219
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
220 220
 
221 221
 		return $fields;
222 222
 	}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
238 238
 
239
-		if( $this->name === $field['field'] && '' === $label ) {
239
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
240 240
 			$label = esc_html( $this->default_search_label );
241 241
 		}
242 242
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
259 259
 	 */
260
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
260
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
261 261
 
262 262
 		// Is there is field merge tag? Strip whitespace off the ned, too.
263 263
 		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
 	 */
291 291
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
292 292
 
293
-		foreach( $matches as $match ) {
293
+		foreach ( $matches as $match ) {
294 294
 
295
-			$full_tag = $match[0];
295
+			$full_tag = $match[ 0 ];
296 296
 
297 297
 			// Strip the Merge Tags
298
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
298
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
299 299
 
300 300
 			// Replace the value from the entry, if exists
301
-			if( isset( $entry[ $tag ] ) ) {
301
+			if ( isset( $entry[ $tag ] ) ) {
302 302
 
303 303
 				$value = $entry[ $tag ];
304 304
 
305
-				if( is_callable( array( $this, 'get_content') ) ) {
305
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
306 306
 					$value = $this->get_content( $value );
307 307
 				}
308 308
 
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	public function _filter_sortable_fields( $not_sortable ) {
377 377
 
378
-		if( ! $this->is_sortable ) {
379
-			$not_sortable[] = $this->name;
378
+		if ( ! $this->is_sortable ) {
379
+			$not_sortable[ ] = $this->name;
380 380
 		}
381 381
 
382 382
 		return $not_sortable;
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	function add_entry_meta( $entry_meta ) {
395 395
 
396
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
396
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
397 397
 
398 398
 			$added_meta = array(
399 399
 				'label'             => $this->label,
@@ -402,13 +402,13 @@  discard block
 block discarded – undo
402 402
 			);
403 403
 
404 404
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
405
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
405
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
406 406
 			}
407 407
 
408
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
408
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
409 409
 
410 410
 		} else {
411
-			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta["{$this->entry_meta_key}"] ) );
411
+			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta[ "{$this->entry_meta_key}" ] ) );
412 412
 		}
413 413
 
414 414
 		return $entry_meta;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 			'date_display' => array(
444 444
 				'type' => 'text',
445 445
 				'label' => __( 'Override Date Format', 'gravityview' ),
446
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ),
446
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ),
447 447
 				/**
448 448
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
449 449
 				 * @param null|string $date_format Date Format (default: null)
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
 		$options = $this->field_support_options();
481 481
 
482
-		if( isset( $options[ $key ] ) ) {
482
+		if ( isset( $options[ $key ] ) ) {
483 483
 			$field_options[ $key ] = $options[ $key ];
484 484
 		}
485 485
 
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 		$connected_form = \GV\Utils::_POST( 'form_id' );
544 544
 
545 545
 		// Otherwise, get the Form ID from the Post page
546
-		if( empty( $connected_form ) ) {
546
+		if ( empty( $connected_form ) ) {
547 547
 			$connected_form = gravityview_get_form_id( get_the_ID() );
548 548
 		}
549 549
 
550
-		if( empty( $connected_form ) ) {
550
+		if ( empty( $connected_form ) ) {
551 551
 			gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) );
552 552
 			return false;
553 553
 		}
Please login to merge, or discard this patch.