Completed
Pull Request — master (#1399)
by Zack
18:10 queued 15:05
created
includes/extensions/edit-entry/class-edit-entry-locking.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			return;
57 57
 		}
58 58
 
59
-		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET['gform_debug'] ) ? '' : '.min';
59
+		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET[ 'gform_debug' ] ) ? '' : '.min';
60 60
 		$locking_path = GFCommon::get_base_url() . '/includes/locking/';
61 61
 
62 62
 		wp_enqueue_script( 'gforms_locking', $locking_path . "js/locking{$min}.js", array( 'jquery', 'heartbeat' ), GFCommon::$version );
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 		$translations = array_map( 'wp_strip_all_tags', $this->get_strings() );
66 66
 
67 67
 		$strings = array(
68
-			'noResponse'    => $translations['no_response'],
69
-			'requestAgain'  => $translations['request_again'],
70
-			'requestError'  => $translations['request_error'],
71
-			'gainedControl' => $translations['gained_control'],
72
-			'rejected'      => $translations['request_rejected'],
73
-			'pending'       => $translations['request_pending'],
68
+			'noResponse'    => $translations[ 'no_response' ],
69
+			'requestAgain'  => $translations[ 'request_again' ],
70
+			'requestError'  => $translations[ 'request_error' ],
71
+			'gainedControl' => $translations[ 'gained_control' ],
72
+			'rejected'      => $translations[ 'request_rejected' ],
73
+			'pending'       => $translations[ 'request_pending' ],
74 74
 		);
75 75
 
76
-		$lock_user_id = $this->check_lock( $entry['id'] );
76
+		$lock_user_id = $this->check_lock( $entry[ 'id' ] );
77 77
 
78 78
 		$vars = array(
79 79
 			'hasLock'    => ! $lock_user_id ? 1 : 0,
80 80
 			'lockUI'     => $this->get_lock_ui( $lock_user_id ),
81
-			'objectID'   => $entry['id'],
81
+			'objectID'   => $entry[ 'id' ],
82 82
 			'objectType' => 'entry',
83 83
 			'strings'    => $strings,
84 84
 		);
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 
207 207
 		$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );
208 208
 
209
-		if ( isset( $_GET['get-edit-lock'] ) ) {
209
+		if ( isset( $_GET[ 'get-edit-lock' ] ) ) {
210 210
 			$this->set_lock( $entry_id );
211 211
 			echo '<script>window.location = ' . json_encode( remove_query_arg( 'get-edit-lock', $current_url ) ) . ';</script>';
212 212
 			exit();
213
-		} else if ( isset( $_GET['release-edit-lock'] ) ) {
213
+		} else if ( isset( $_GET[ 'release-edit-lock' ] ) ) {
214 214
 			$this->delete_lock_meta( $entry_id );
215 215
 			$current_url = remove_query_arg( 'edit', $current_url );
216 216
 			echo '<script>window.location = ' . json_encode( remove_query_arg( 'release-edit-lock', $current_url ) ) . ';</script>';
Please login to merge, or discard this patch.
includes/class-gravityview-logging.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 	function __construct() {
9 9
 
10
-		add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 );
10
+		add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 );
11 11
 
12
-		add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 );
12
+		add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 );
13 13
 
14 14
 		// Enable debug with Gravity Forms Logging Add-on
15 15
 	    add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) );
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' );
35 35
 		}
36 36
 
37
-		$panels[] = new GravityView_Debug_Bar;
37
+		$panels[ ] = new GravityView_Debug_Bar;
38 38
 
39 39
 		return $panels;
40 40
 	}
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param array $supported_plugins List of plugins
45 45
 	 */
46 46
 	public function enable_gform_logging( $supported_plugins ) {
47
-	    $supported_plugins['gravityview'] = 'GravityView';
47
+	    $supported_plugins[ 'gravityview' ] = 'GravityView';
48 48
 	    return $supported_plugins;
49 49
 	}
50 50
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @return string "print_r" or "var_export"
73 73
 	 */
74 74
 	static function get_print_function() {
75
-		if( ob_get_level() > 0 ) {
75
+		if ( ob_get_level() > 0 ) {
76 76
 			$function = 'var_export';
77 77
 		} else {
78 78
 			$function = 'print_r';
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 			'data' => $data,
91 91
 		);
92 92
 
93
-		if( !in_array( $notice, self::$notices ) ) {
94
-			self::$notices[] = $notice;
93
+		if ( ! in_array( $notice, self::$notices ) ) {
94
+			self::$notices[ ] = $notice;
95 95
 		}
96 96
 
97
-		if ( class_exists("GFLogging") ) {
97
+		if ( class_exists( "GFLogging" ) ) {
98 98
 			GFLogging::include_logger();
99
-	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG );
99
+	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG );
100 100
 	    }
101 101
 	}
102 102
 
103
-	static function log_error( $message = '', $data = null  ) {
103
+	static function log_error( $message = '', $data = null ) {
104 104
 
105 105
 		$function = self::get_print_function();
106 106
 
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 			'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '',
111 111
 		);
112 112
 
113
-		if( !in_array( $error, self::$errors ) ) {
114
-			self::$errors[] = $error;
113
+		if ( ! in_array( $error, self::$errors ) ) {
114
+			self::$errors[ ] = $error;
115 115
 		}
116 116
 
117
-		if ( class_exists("GFLogging") ) {
117
+		if ( class_exists( "GFLogging" ) ) {
118 118
 		    GFLogging::include_logger();
119
-		    GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR );
119
+		    GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $error, true ), KLogger::ERROR );
120 120
 		}
121 121
 	}
122 122
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	static function is_logging_active( $plugin = 'gravityview' ) {
135 135
 
136
-		if( ! class_exists( 'GFLogging') ) {
136
+		if ( ! class_exists( 'GFLogging' ) ) {
137 137
 			return false;
138 138
 		}
139 139
 
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
248 248
 
249
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
249
+		$base = GravityView_API::directory_link( $post_id ? : $view_id, true );
250 250
 
251 251
 		if ( empty( $base ) ) {
252 252
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			'action'	=> 'duplicate',
258 258
 			'entry_id'	=> $entry['id'],
259 259
 			'gvid' => $view_id,
260
-            'view_id' => $view_id,
260
+			'view_id' => $view_id,
261 261
 		), $base );
262 262
 
263 263
 		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		 * @since 2.5
461 461
 		 * @param  array $duplicated_entry The duplicated entry
462 462
 		 * @param  array $entry The original entry
463
-		*/
463
+		 */
464 464
 		do_action( 'gravityview/duplicate-entry/duplicated', $duplicated_entry, $entry );
465 465
 
466 466
 		gravityview()->log->debug( 'Duplicate response: {duplicate_response}', array( 'duplicate_response' => $duplicate_response ) );
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
116 116
 
117 117
 		// Always a link, never a filter, always same window
118
-		unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] );
118
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] );
119 119
 
120 120
 		// Duplicate Entry link should only appear to visitors capable of editing entries
121
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
121
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
122 122
 
123
-		$add_option['duplicate_link'] = array(
123
+		$add_option[ 'duplicate_link' ] = array(
124 124
 			'type' => 'text',
125 125
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
126 126
 			'desc' => NULL,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			'merge_tags' => true,
129 129
 		);
130 130
 
131
-		$field_options['allow_duplicate_cap'] = array(
131
+		$field_options[ 'allow_duplicate_cap' ] = array(
132 132
 			'type' => 'select',
133 133
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
134 134
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
156 156
 
157 157
 		if ( 'edit' !== $zone ) {
158
-			$entry_default_fields['duplicate_link'] = array(
158
+			$entry_default_fields[ 'duplicate_link' ] = array(
159 159
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
160 160
 				'type'  => 'duplicate_link',
161 161
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function add_available_field( $available_fields = array() ) {
178 178
 
179
-		$available_fields['duplicate_link'] = array(
179
+		$available_fields[ 'duplicate_link' ] = array(
180 180
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
181 181
 			'field_id' => 'duplicate_link',
182 182
 			'label_type' => 'field',
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 		if ( 'duplicate_link' === $field_id ) {
210 210
 
211 211
 			// Remove other built-in caps.
212
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
212
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
213 213
 
214
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
214
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
215 215
 		}
216 216
 
217 217
 		return $caps;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
248 248
 
249
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
249
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
250 250
 
251 251
 		if ( empty( $base ) ) {
252 252
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$actionurl = add_query_arg( array(
257 257
 			'action'	=> 'duplicate',
258
-			'entry_id'	=> $entry['id'],
258
+			'entry_id'	=> $entry[ 'id' ],
259 259
 			'gvid' => $view_id,
260 260
             'view_id' => $view_id,
261 261
 		), $base );
262 262
 
263
-		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
263
+		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl );
264 264
 	}
265 265
 
266 266
 	/**
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
 	public function process_duplicate() {
282 282
 
283 283
 		// If the form is submitted
284
-		if ( ! isset( $_GET['action'] ) || 'duplicate' !== $_GET['action'] || ! isset( $_GET['entry_id'] ) ) {
284
+		if ( ! isset( $_GET[ 'action' ] ) || 'duplicate' !== $_GET[ 'action' ] || ! isset( $_GET[ 'entry_id' ] ) ) {
285 285
 			return;
286 286
 		}
287 287
 
288 288
 		// Make sure it's a GravityView request
289
-		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) );
289
+		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) );
290 290
 
291 291
 		if ( ! $valid_nonce_key ) {
292 292
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		}
295 295
 
296 296
 		// Get the entry slug
297
-		$entry_slug = esc_attr( $_GET['entry_id'] );
297
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
298 298
 
299 299
 		// See if there's an entry there
300 300
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -388,15 +388,15 @@  discard block
 block discarded – undo
388 388
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gravityview' ) );
389 389
 		}
390 390
 
391
-		$row['id'] = null;
392
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
393
-		$row['date_updated'] = $row['date_created'];
394
-		$row['is_starred'] = false;
395
-		$row['is_read'] = false;
396
-		$row['ip'] = GFFormsModel::get_ip();
397
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid' ) ) );
398
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
399
-		$row['created_by'] = wp_get_current_user()->ID;
391
+		$row[ 'id' ] = null;
392
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
393
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
394
+		$row[ 'is_starred' ] = false;
395
+		$row[ 'is_read' ] = false;
396
+		$row[ 'ip' ] = GFFormsModel::get_ip();
397
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid' ) ) );
398
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
399
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
400 400
 
401 401
 		/**
402 402
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -424,15 +424,15 @@  discard block
 block discarded – undo
424 424
 
425 425
 		$save_this_meta = array();
426 426
 		foreach ( $duplicate_meta->get_output() as $m ) {
427
-			$save_this_meta[] = array(
428
-				'meta_key' => $m['meta_key'],
429
-				'meta_value' => $m['meta_value'],
430
-				'item_index' => $m['item_index'],
427
+			$save_this_meta[ ] = array(
428
+				'meta_key' => $m[ 'meta_key' ],
429
+				'meta_value' => $m[ 'meta_value' ],
430
+				'item_index' => $m[ 'item_index' ],
431 431
 			);
432 432
 		}
433 433
 
434 434
 		// Update the row ID for later usage
435
-		$row['id'] = $duplicated_id;
435
+		$row[ 'id' ] = $duplicated_id;
436 436
 
437 437
 		/**
438 438
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
444 444
 
445 445
 		foreach ( $save_this_meta as $data ) {
446
-			$data['form_id'] = $entry['form_id'];
447
-			$data['entry_id'] = $duplicated_id;
446
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
447
+			$data[ 'entry_id' ] = $duplicated_id;
448 448
 
449 449
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
450 450
 				return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gravityview' ) );
@@ -478,13 +478,13 @@  discard block
 block discarded – undo
478 478
 	public function verify_nonce() {
479 479
 
480 480
 		// No duplicate entry request was made
481
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
481
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
482 482
 			return false;
483 483
 		}
484 484
 
485
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
485
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
486 486
 
487
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
487
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
488 488
 
489 489
 		/**
490 490
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 			return '';
521 521
 		}
522 522
 
523
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
523
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
524 524
 	}
525 525
 
526 526
 	/**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) {
575 575
 		$current_user = wp_get_current_user();
576 576
 
577
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
577
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
578 578
 
579 579
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
580 580
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) {
@@ -589,17 +589,17 @@  discard block
 block discarded – undo
589 589
 		if ( ! empty( $field ) ) {
590 590
 
591 591
 			// If capability is not defined, something is not right!
592
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
592
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
593 593
 
594 594
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
595 595
 
596 596
 				return false;
597 597
 			}
598 598
 
599
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
599
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
600 600
 
601 601
 				// Do not return true if cap is read, as we need to check if the current user created the entry
602
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
602
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
603 603
 					return true;
604 604
 				}
605 605
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
 		}
614 614
 
615
-		if ( ! isset( $entry['created_by'] ) ) {
615
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
616 616
 
617 617
 			gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' );
618 618
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 		}
638 638
 
639 639
 		// If the logged-in user is the same as the user who created the entry, we're good.
640
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
640
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
641 641
 
642 642
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
643 643
 
@@ -662,16 +662,16 @@  discard block
 block discarded – undo
662 662
 	 */
663 663
 	public function display_message( $current_view_id = 0 ) {
664 664
 
665
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
665
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
666 666
 			return;
667 667
 		}
668 668
 
669 669
 		// Entry wasn't duplicated from current View
670
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
670
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
671 671
 			return;
672 672
 		}
673 673
 
674
-		$status = esc_attr( $_GET['status'] );
674
+		$status = esc_attr( $_GET[ 'status' ] );
675 675
 		$message_from_url = \GV\Utils::_GET( 'message' );
676 676
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
677 677
 		$class = '';
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
698 698
 
699 699
 		// DISPLAY ERROR/SUCCESS MESSAGE
700
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
700
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
701 701
 	}
702 702
 
703 703
 	/**
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		?>
726 726
 		<span class="duplicate">
727 727
 			|
728
-			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
728
+			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
729 729
 		</span>
730 730
 		<?php
731 731
 	}
@@ -747,9 +747,9 @@  discard block
 block discarded – undo
747 747
 
748 748
 		if ( 'success' === \GV\Utils::_GET( 'result' ) ) {
749 749
 			add_filter( 'gform_admin_messages', function( $messages ) {
750
-				$messages = (array) $messages;
750
+				$messages = (array)$messages;
751 751
 
752
-				$messages[] = esc_html__( 'Entry duplicated.', 'gravityview' );
752
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gravityview' );
753 753
 				return $messages;
754 754
 			} );
755 755
 		}
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 			$check_logs_message = '';
762 762
 
763
-			if( $is_logging_active ) {
763
+			if ( $is_logging_active ) {
764 764
 				$check_logs_message = sprintf( ' <a href="%s">%s</a>',
765 765
 					esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravityformslogging' ) ),
766 766
 					esc_html_x( 'Check the GravityView logs for more information.', 'Error message links to logging page', 'gravityview' )
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 			}
769 769
 
770 770
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
771
-				$messages = (array) $messages;
771
+				$messages = (array)$messages;
772 772
 
773
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
773
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
774 774
 
775 775
 				return $messages;
776 776
 			} );
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected $form_id;
46 46
 
47
-	function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null) {
47
+	function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null ) {
48 48
 
49 49
 		// Backward compat
50
-		if ( ! empty( $item['type'] ) ) {
51
-			$item['input_type'] = $item['type'];
52
-			unset( $item['type'] );
50
+		if ( ! empty( $item[ 'type' ] ) ) {
51
+			$item[ 'input_type' ] = $item[ 'type' ];
52
+			unset( $item[ 'type' ] );
53 53
 		}
54 54
 
55 55
 		if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$this->id         = $item_id;
76 76
 		$this->form_id    = $form_id;
77 77
 		$this->settings   = $settings;
78
-		$this->label_type = $item['label_type'];
78
+		$this->label_type = $item[ 'label_type' ];
79 79
 	}
80 80
 
81 81
 	/**
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 
120 120
 			foreach ( $field_info_items as $item ) {
121 121
 
122
-				if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
122
+				if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
123 123
 					continue;
124 124
 				}
125 125
 
126
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
126
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
127 127
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
128 128
 				$output .= '<span class="' . $class . '">';
129
-				$output .= esc_html( $item['value'] );
129
+				$output .= esc_html( $item[ 'value' ] );
130 130
 				$output .= '</span>';
131 131
 			}
132 132
 
@@ -154,21 +154,21 @@  discard block
 block discarded – undo
154 154
 
155 155
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
156 156
 		// TODO: Un-hack this
157
-		$hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
158
-		$settings_link      = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
157
+		$hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
158
+		$settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
159 159
 
160 160
 		// Should we show the icon that the field is being used as a link to single entry?
161
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
161
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
162 162
 		$show_as_link            = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
163 163
 
164 164
 		// When a field label is empty, use the Field ID
165 165
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
166 166
 
167 167
 		// If there's a custom label, and show label is checked, use that as the field heading
168
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
169
-			$label = $this->settings['custom_label'];
170
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
171
-			$label = $this->item['customLabel'];
168
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
169
+			$label = $this->settings[ 'custom_label' ];
170
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
171
+			$label = $this->item[ 'customLabel' ];
172 172
 		}
173 173
 		$label = esc_attr( $label );
174 174
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$output .= '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
178 178
 
179
-		if ( ! empty( $this->item['parent'] ) ) {
180
-			$label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>';
179
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
180
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
181 181
 		}
182 182
 
183 183
 		// Name of field / widget
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 
194 194
 		$output .= '</h5>';
195 195
 
196
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
197
-		$data_form_id   = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
196
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
197
+		$data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
198 198
 
199
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
199
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
200 200
 
201 201
 		return $output;
202 202
 	}
Please login to merge, or discard this patch.