Completed
Push — master ( 022e44...5d3455 )
by Zack
08:11 queued 31s
created
includes/class-gravityview-roles-capabilities.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 
36
-		if( ! self::$instance ) {
36
+		if ( ! self::$instance ) {
37 37
 			self::$instance = new self;
38 38
 		}
39 39
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+        add_action( 'admin_init', array( $this, 'add_caps' ) );
60 60
 	}
61 61
 
62 62
 
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 	public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) {
78 78
 
79 79
 		// Empty caps_to_check array
80
-		if( ! $usercaps || ! $caps ) {
80
+		if ( ! $usercaps || ! $caps ) {
81 81
 			return $usercaps;
82 82
 		}
83 83
 
84 84
 		/**
85 85
 		 * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled
86 86
 		 */
87
-		if( ! empty( $usercaps['gravityview_full_access'] ) ) {
87
+		if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) {
88 88
 
89 89
 			$all_gravityview_caps = self::all_caps();
90 90
 
91
-			foreach( $all_gravityview_caps as $gv_cap ) {
91
+			foreach ( $all_gravityview_caps as $gv_cap ) {
92 92
 				$usercaps[ $gv_cap ] = true;
93 93
 			}
94 94
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		$all = $administrator;
305 305
 
306 306
 		// If role is set, return caps_to_check for just that role.
307
-		if( $single_role ) {
307
+		if ( $single_role ) {
308 308
 			$caps = isset( ${$single_role} ) ? ${$single_role} : false;
309 309
 			return $flat_array ? $caps : array( $single_role => $caps );
310 310
 		}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
 		$has_cap = false;
336 336
 
337
-		if( empty( $caps_to_check ) ) {
337
+		if ( empty( $caps_to_check ) ) {
338 338
 			return $has_cap;
339 339
 		}
340 340
 
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 		$caps_to_check = self::maybe_add_full_access_caps( $caps_to_check );
343 343
 
344 344
 		foreach ( $caps_to_check as $cap ) {
345
-			if( ! is_null( $object_id ) ) {
345
+			if ( ! is_null( $object_id ) ) {
346 346
 				$has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id );
347 347
 			} else {
348 348
 				$has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap );
349 349
 			}
350 350
 			// At the first successful response, stop checking
351
-			if( $has_cap ) {
351
+			if ( $has_cap ) {
352 352
 				break;
353 353
 			}
354 354
 		}
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 		$all_gravityview_caps = self::all_caps();
373 373
 
374 374
 		// Are there any $caps_to_check that are from GravityView?
375
-		if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
376
-			$caps_to_check[] = 'gravityview_full_access';
375
+		if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
376
+			$caps_to_check[ ] = 'gravityview_full_access';
377 377
 		}
378 378
 
379 379
 		$all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array();
380 380
 
381 381
 		// Are there any $caps_to_check that are from Gravity Forms?
382
-		if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
383
-			$caps_to_check[] = 'gform_full_access';
382
+		if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
383
+			$caps_to_check[ ] = 'gform_full_access';
384 384
 		}
385 385
 
386 386
 		return array_unique( $caps_to_check );
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			$capabilities = self::all_caps();
403 403
 
404 404
 			// Loop through each role and remove GV caps_to_check
405
-			foreach( $wp_roles->get_names() as $role_slug => $role_name ) {
405
+			foreach ( $wp_roles->get_names() as $role_slug => $role_name ) {
406 406
 				foreach ( $capabilities as $cap ) {
407 407
 					$wp_roles->remove_cap( $role_slug, $cap );
408 408
 				}
Please login to merge, or discard this patch.
includes/class-gv-license-handler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @return GV_License_Handler
35 35
 	 */
36 36
 	public static function get_instance( GravityView_Settings $GFAddOn ) {
37
-		if( empty( self::$instance ) ) {
37
+		if ( empty( self::$instance ) ) {
38 38
 			self::$instance = new self( $GFAddOn );
39 39
 		}
40 40
 		return self::$instance;
@@ -60,37 +60,37 @@  discard block
 block discarded – undo
60 60
 		$status = trim( $this->Addon->get_app_setting( 'license_key_status' ) );
61 61
 		$key = trim( $this->Addon->get_app_setting( 'license_key' ) );
62 62
 
63
-		if( !empty( $key ) ) {
63
+		if ( ! empty( $key ) ) {
64 64
 			$response = $this->Addon->get_app_setting( 'license_key_response' );
65
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
65
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
66 66
 		} else {
67 67
 			$response = array();
68 68
 		}
69 69
 
70 70
 		wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array(
71 71
 			'license_box' => $this->get_license_message( $response )
72
-		));
72
+		) );
73 73
 
74 74
 
75 75
 		$fields = array(
76 76
 			array(
77 77
 				'name'  => 'edd-activate',
78
-				'value' => __('Activate License', 'gravityview'),
79
-				'data-pending_text' => __('Verifying license…', 'gravityview'),
78
+				'value' => __( 'Activate License', 'gravityview' ),
79
+				'data-pending_text' => __( 'Verifying license…', 'gravityview' ),
80 80
 				'data-edd_action' => 'activate_license',
81 81
 				'class' => 'button-primary',
82 82
 			),
83 83
 			array(
84 84
 				'name'  => 'edd-deactivate',
85
-				'value' => __('Deactivate License', 'gravityview'),
86
-				'data-pending_text' => __('Deactivating license…', 'gravityview'),
85
+				'value' => __( 'Deactivate License', 'gravityview' ),
86
+				'data-pending_text' => __( 'Deactivating license…', 'gravityview' ),
87 87
 				'data-edd_action' => 'deactivate_license',
88 88
 				'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ),
89 89
 			),
90 90
 			array(
91 91
 				'name'  => 'edd-check',
92
-				'value' => __('Check License', 'gravityview'),
93
-				'data-pending_text' => __('Verifying license…', 'gravityview'),
92
+				'value' => __( 'Check License', 'gravityview' ),
93
+				'data-pending_text' => __( 'Verifying license…', 'gravityview' ),
94 94
 				'title' => 'Check the license before saving it',
95 95
 				'data-edd_action' => 'check_license',
96 96
 				'class' => 'button-secondary',
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 
101 101
 		$class = 'button gv-edd-action';
102 102
 
103
-		$class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
103
+		$class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
104 104
 
105 105
 		$disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';
106 106
 
107 107
 		$submit = '<div class="gv-edd-button-wrapper">';
108 108
 		foreach ( $fields as $field ) {
109
-			$field['type'] = 'button';
110
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
111
-			$field['style'] = 'margin-left: 10px;';
112
-			if( $disabled_attribute ) {
113
-				$field['disabled'] = $disabled_attribute;
109
+			$field[ 'type' ] = 'button';
110
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
111
+			$field[ 'style' ] = 'margin-left: 10px;';
112
+			if ( $disabled_attribute ) {
113
+				$field[ 'disabled' ] = $disabled_attribute;
114 114
 			}
115 115
 			$submit .= $this->Addon->settings_submit( $field, $echo );
116 116
 		}
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	private function setup_edd() {
128 128
 
129
-		if( !class_exists('EDD_SL_Plugin_Updater') ) {
130
-			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php');
129
+		if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
130
+			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' );
131 131
 		}
132 132
 
133 133
 		// setup the updater
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 			'url'       => home_url(),
164 164
 		);
165 165
 
166
-		if( !empty( $action ) ) {
167
-			$settings['edd_action'] = esc_attr( $action );
166
+		if ( ! empty( $action ) ) {
167
+			$settings[ 'edd_action' ] = esc_attr( $action );
168 168
 		}
169 169
 
170 170
 		$settings = array_map( 'urlencode', $settings );
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	private function _license_get_remote_response( $data, $license = '' ) {
180 180
 
181
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
181
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
182 182
 
183 183
 		$url = add_query_arg( $api_params, self::url );
184 184
 
185 185
 		$response = wp_remote_get( $url, array(
186 186
 			'timeout'   => 15,
187 187
 			'sslverify' => false,
188
-		));
188
+		) );
189 189
 
190 190
 		if ( is_wp_error( $response ) ) {
191 191
 			return array();
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		// Not JSON
197 197
 		if ( empty( $license_data ) ) {
198 198
 
199
-			delete_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid' );
199
+			delete_transient( 'gravityview_' . esc_attr( $data[ 'field_id' ] ) . '_valid' );
200 200
 
201 201
 			// Change status
202 202
 			return array();
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	function get_license_message( $license_data ) {
220 220
 
221
-		if( empty( $license_data ) ) {
221
+		if ( empty( $license_data ) ) {
222 222
 			$class = 'hide';
223 223
 			$message = '';
224 224
 		} else {
225 225
 
226
-			if( ! empty( $license_data->error ) ) {
226
+			if ( ! empty( $license_data->error ) ) {
227 227
 				$class = 'error';
228 228
 				$string_key = $license_data->license;
229 229
 			} else {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				$string_key = $license_data->license;
232 232
 			}
233 233
 
234
-			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) );
234
+			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) );
235 235
 		}
236 236
 
237 237
 		return $this->generate_license_box( $message, $class );
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function license_call( $array = array() ) {
274 274
 
275
-		$is_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
276
-		$data = empty( $array ) ? $_POST['data'] : $array;
275
+		$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
276
+		$data = empty( $array ) ? $_POST[ 'data' ] : $array;
277 277
 		$has_cap = GVCommon::has_cap( 'gravityview_edit_settings' );
278 278
 
279
-		if ( $is_ajax && empty( $data['license'] ) ) {
280
-			die( - 1 );
279
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
280
+			die( -1 );
281 281
 		}
282 282
 
283 283
 		// If the user isn't allowed to edit settings, show an error message
284
-		if( ! $has_cap ) {
284
+		if ( ! $has_cap ) {
285 285
 			$license_data = new stdClass();
286 286
 			$license_data->error = 'capability';
287 287
 			$license_data->message = $this->get_license_message( $license_data );
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 			$json = json_encode( $license_data );
306 306
 
307
-			$update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) );
307
+			$update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) );
308 308
 
309
-			$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );
309
+			$is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX );
310 310
 
311 311
 			// Failed is the response from trying to de-activate a license and it didn't work.
312 312
 			// This likely happened because people entered in a different key and clicked "Deactivate",
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 			// most likely a mistake.
315 315
 			if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) {
316 316
 
317
-				if ( ! empty( $data['field_id'] ) ) {
318
-					set_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid', $license_data, DAY_IN_SECONDS );
317
+				if ( ! empty( $data[ 'field_id' ] ) ) {
318
+					set_transient( 'gravityview_' . esc_attr( $data[ 'field_id' ] ) . '_valid', $license_data, DAY_IN_SECONDS );
319 319
 				}
320 320
 
321 321
 				$this->license_call_update_settings( $license_data, $data );
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		if ( $is_ajax ) {
327 327
 			exit( $json );
328 328
 		} else { // Non-ajax call
329
-			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
329
+			return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json;
330 330
 		}
331 331
 	}
332 332
 
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
 		// Update option with passed data license
341 341
 		$settings = $this->Addon->get_app_settings();
342 342
 
343
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
344
-		$settings['license_key_status'] = $license_data->license;
345
-		$settings['license_key_response'] = (array)$license_data;
343
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
344
+		$settings[ 'license_key_status' ] = $license_data->license;
345
+		$settings[ 'license_key_response' ] = (array)$license_data;
346 346
 
347 347
 		$this->Addon->update_app_settings( $settings );
348 348
 	}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 * @return string Renewal or account URL
355 355
 	 */
356 356
 	private function get_license_renewal_url( $license_data ) {
357
-		$renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key ) : 'https://gravityview.co/account/';
357
+		$renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key ) : 'https://gravityview.co/account/';
358 358
 		return $renew_license_url;
359 359
 	}
360 360
 
@@ -368,30 +368,30 @@  discard block
 block discarded – undo
368 368
 
369 369
 
370 370
 		$strings = array(
371
-			'status' => esc_html__('Status', 'gravityview'),
372
-			'error' => esc_html__('There was an error processing the request.', 'gravityview'),
373
-			'failed'  => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'),
374
-			'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
375
-			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
376
-			'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'),
377
-			'valid' => esc_html__('The license key is valid and active.', 'gravityview'),
378
-			'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'),
379
-			'missing' => esc_html__('The license key was not defined.', 'gravityview'),
380
-			'revoked' => esc_html__('This license key has been revoked.', 'gravityview'),
381
-			'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>' ),
371
+			'status' => esc_html__( 'Status', 'gravityview' ),
372
+			'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ),
373
+			'failed'  => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ),
374
+			'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ),
375
+			'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
376
+			'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ),
377
+			'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ),
378
+			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
379
+			'missing' => esc_html__( 'The license key was not defined.', 'gravityview' ),
380
+			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
381
+			'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>' ),
382 382
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
383 383
 
384
-			'verifying_license' => esc_html__('Verifying license&hellip;', 'gravityview'),
385
-			'activate_license' => esc_html__('Activate License', 'gravityview'),
386
-			'deactivate_license' => esc_html__('Deactivate License', 'gravityview'),
387
-			'check_license' => esc_html__('Verify License', 'gravityview'),
384
+			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
385
+			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
386
+			'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ),
387
+			'check_license' => esc_html__( 'Verify License', 'gravityview' ),
388 388
 		);
389 389
 
390
-		if( empty( $status ) ) {
390
+		if ( empty( $status ) ) {
391 391
 			return $strings;
392 392
 		}
393 393
 
394
-		if( isset( $strings[ $status ] ) ) {
394
+		if ( isset( $strings[ $status ] ) ) {
395 395
 			return $strings[ $status ];
396 396
 		}
397 397
 
@@ -401,19 +401,19 @@  discard block
 block discarded – undo
401 401
 	public function validate_license_key( $value, $field ) {
402 402
 
403 403
 		// No license? No status.
404
-		if( empty( $value ) ) {
404
+		if ( empty( $value ) ) {
405 405
 			return NULL;
406 406
 		}
407 407
 
408
-		$response = $this->license_call(array(
408
+		$response = $this->license_call( array(
409 409
 			'license' => $this->Addon->get_app_setting( 'license_key' ),
410 410
 			'edd_action' => 'check_license',
411
-			'field_id' => $field['name'],
412
-		));
411
+			'field_id' => $field[ 'name' ],
412
+		) );
413 413
 
414 414
 		$response = is_string( $response ) ? json_decode( $response, true ) : $response;
415 415
 
416
-		switch( $response['license'] ) {
416
+		switch ( $response[ 'license' ] ) {
417 417
 			case 'valid':
418 418
 				$return = true;
419 419
 				break;
Please login to merge, or discard this patch.
includes/class-gravityview-admin-bar.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			$wp_admin_bar->add_menu( array(
63 63
 				'id' => 'edit-entry',
64 64
 				'title' => __( 'Edit Entry', 'gravityview' ),
65
-				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ),
65
+				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ),
66 66
 			) );
67 67
 
68 68
 		}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		/** @var WP_Admin_Bar $wp_admin_bar */
79 79
 		global $wp_admin_bar;
80 80
 
81
-		if( GVCommon::has_cap('edit_gravityviews') ) {
81
+		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
82 82
 
83 83
 			$view_data = GravityView_View_Data::getInstance();
84 84
 
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 			if ( ! $this->gravityview_view->isGravityviewPostType() && ! empty( $views ) && ! $view_data->has_multiple_views() ) {
90 90
 				$view = reset( $views );
91 91
 
92
-				if( GVCommon::has_cap( 'edit_gravityview', $view['id'] ) ) {
92
+				if ( GVCommon::has_cap( 'edit_gravityview', $view[ 'id' ] ) ) {
93 93
 					$wp_admin_bar->add_menu( array(
94 94
 						'id'    => 'edit-view',
95 95
 						'title' => __( 'Edit View', 'gravityview' ),
96
-						'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view['id'] ) ) ),
96
+						'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view[ 'id' ] ) ) ),
97 97
 					) );
98 98
 				}
99 99
 			}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
112 112
 
113
-		if( $this->_custom_merge_tag ) {
113
+		if ( $this->_custom_merge_tag ) {
114 114
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
115 115
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
116 116
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
134 134
 	 */
135
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
135
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
136 136
 
137 137
 		/**
138 138
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		 * @see GFCommon::replace_variables_prepopulate()
141 141
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
142 142
 		 */
143
-		if( false === $form ) {
143
+		if ( false === $form ) {
144 144
 			return $text;
145 145
 		}
146 146
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
175 175
 
176
-		foreach( $matches as $match ) {
176
+		foreach ( $matches as $match ) {
177 177
 
178
-			$full_tag = $match[0];
178
+			$full_tag = $match[ 0 ];
179 179
 
180 180
 			// Strip the Merge Tags
181
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
181
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
182 182
 
183 183
 			// Replace the value from the entry, if exists
184
-			if( isset( $entry[ $tag ] ) ) {
184
+			if ( isset( $entry[ $tag ] ) ) {
185 185
 
186 186
 				$value = $entry[ $tag ];
187 187
 
188
-				if( is_callable( array( $this, 'get_content') ) ) {
188
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
189 189
 					$value = $this->get_content( $value );
190 190
 				}
191 191
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function _filter_sortable_fields( $not_sortable ) {
260 260
 
261
-		if( ! $this->is_sortable ) {
262
-			$not_sortable[] = $this->name;
261
+		if ( ! $this->is_sortable ) {
262
+			$not_sortable[ ] = $this->name;
263 263
 		}
264 264
 
265 265
 		return $not_sortable;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			'date_display' => array(
289 289
 				'type' => 'text',
290 290
 				'label' => __( 'Override Date Format', 'gravityview' ),
291
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
291
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
292 292
 				/**
293 293
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
294 294
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 		$options = $this->field_support_options();
315 315
 
316
-		if( isset( $options[ $key ] ) ) {
316
+		if ( isset( $options[ $key ] ) ) {
317 317
 			$field_options[ $key ] = $options[ $key ];
318 318
 		}
319 319
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-radio.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 	var $name = 'radio';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Radio';
15 15
 
Please login to merge, or discard this patch.
includes/presets/default-edit/class-gravityview-default-template-edit.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 			'slug' => 'edit',
25 25
 			'type' => 'internal',
26 26
 			'label' =>  __( 'Edit Table', 'gravityview' ),
27
-			'description' => __('Display items in a table view.', 'gravityview'),
28
-			'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE),
29
-			'css_source' => plugins_url('templates/css/table-view.css', GRAVITYVIEW_FILE),
27
+			'description' => __( 'Display items in a table view.', 'gravityview' ),
28
+			'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ),
29
+			'css_source' => plugins_url( 'templates/css/table-view.css', GRAVITYVIEW_FILE ),
30 30
 		);
31 31
 
32 32
 		$settings = wp_parse_args( $settings, $edit_settings );
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				'1-1' => array(
43 43
 					array(
44 44
 						'areaid' => 'edit-fields',
45
-						'title' => __('Visible Edit Fields', 'gravityview' )
45
+						'title' => __( 'Visible Edit Fields', 'gravityview' )
46 46
 					)
47 47
 				)
48 48
 			)
Please login to merge, or discard this patch.
includes/admin/field-types/type_radio.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
 		</div>
13 13
 		<?php
14 14
 			echo $this->get_tooltip();
15
-			echo $this->get_field_desc().'&nbsp;';
15
+			echo $this->get_field_desc() . '&nbsp;';
16 16
 
17 17
 			$this->render_input();
18 18
 
19 19
 	}
20 20
 
21 21
 	function render_input( $override_input = null ) {
22
-		if( isset( $override_input ) ) {
22
+		if ( isset( $override_input ) ) {
23 23
 			echo $override_input;
24 24
 			return;
25 25
 		}
26 26
 
27
-		foreach( $this->field['options'] as $value => $label ) : ?>
27
+		foreach ( $this->field[ 'options' ] as $value => $label ) : ?>
28 28
 		<label class="<?php echo $this->get_label_class(); ?>">
29 29
 			<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr( $value ); ?>" type="radio" value="<?php echo esc_attr( $value ); ?>" <?php checked( $value, $this->value, true ); ?> />&nbsp;<?php echo esc_html( $label ); ?>
30 30
 		</label>
Please login to merge, or discard this patch.
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param  bool       $esc_html     Pass return value through `esc_html()`
42 42
 	 * @return string                  Text with variables maybe replaced
43 43
 	 */
44
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
44
+	public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
45 45
 
46 46
 		/**
47 47
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @internal Reported to GF Support on 12/3
66 66
 		 */
67
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
68
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
69
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
67
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
68
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
69
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
70 70
 
71 71
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
72 72
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return mixed
88 88
 	 */
89
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
89
+	public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
90 90
 
91 91
 		/**
92 92
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		 * @see GFCommon::replace_variables_prepopulate()
95 95
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
96 96
 		 */
97
-		if( false === $form ) {
97
+		if ( false === $form ) {
98 98
 			return $text;
99 99
 		}
100 100
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
127 127
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
128 128
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
129
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
129
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
130 130
 		);
131 131
 
132 132
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
190 190
 
191 191
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
192
-		if( empty( $matches ) ) {
192
+		if ( empty( $matches ) ) {
193 193
 			return $text;
194 194
 		}
195 195
 
196 196
 		foreach ( $matches as $match ) {
197 197
 
198
-			$full_tag = $match[0];
199
-			$property = $match[1];
198
+			$full_tag = $match[ 0 ];
199
+			$property = $match[ 1 ];
200 200
 
201 201
 			$value = stripslashes_deep( rgget( $property ) );
202 202
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			 * @since 1.15
221 221
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
222 222
 			 */
223
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
223
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
224 224
 
225 225
 			$value = $esc_html ? esc_html( $value ) : $value;
226 226
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			 * @param[in] array $form Gravity Forms form array
232 232
 			 * @param[in] array $entry Entry array
233 233
 			 */
234
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
234
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
235 235
 
236 236
 			$text = str_replace( $full_tag, $value, $text );
237 237
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-notes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		// Make sure the keys are all set
53 53
 		$note = wp_parse_args( $note, $default_note );
54 54
 
55
-		GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) );
55
+		GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) );
56 56
 	}
57 57
 
58 58
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public static function delete_notes( $note_ids = array() ) {
74 74
 
75
-		if( !is_array( $note_ids ) ) {
75
+		if ( ! is_array( $note_ids ) ) {
76 76
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Note IDs not an array', $note_ids );
77 77
 		}
78 78
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public static function filter_avatar( $avatar = '', $note ) {
113 113
 
114
-		if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
115
-			$avatar =  sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
114
+		if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
115
+			$avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
116 116
 		}
117 117
 
118 118
 		return $avatar;
Please login to merge, or discard this patch.