Completed
Push — develop ( 163154...a78347 )
by Zack
17:43
created
future/includes/class-gv-template-legacy-override.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 		$additional = array();
99 99
 
100 100
 		// form-19-table-body.php
101
-		$additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
101
+		$additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
102 102
 
103 103
 		// view-3-table-body.php
104
-		$additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
104
+		$additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
105 105
 
106 106
 		global $post;
107 107
 		if ( $post ) {
108 108
 			// page-19-table-body.php
109
-			$additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
109
+			$additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
110 110
 		}
111 111
 
112 112
 		// Combine with existing table-body.php and table.php
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		ob_start();
131 131
 
132 132
 		$request = new Mock_Request();
133
-		$request->returns['is_view'] = $this->view;
133
+		$request->returns[ 'is_view' ] = $this->view;
134 134
 
135 135
 		/**
136 136
 		 * You got one shot. One opportunity. To render all the widgets you have ever wanted.
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 		foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) {
145 145
 			/** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */
146 146
 			if ( is_array( $wp_filter[ $hook ] ) ) {
147
-				if ( ! empty( $wp_filter[ $hook ][10] ) ) {
148
-					foreach ( $wp_filter[ $hook ][10] as $function_key => $callback ) {
147
+				if ( ! empty( $wp_filter[ $hook ][ 10 ] ) ) {
148
+					foreach ( $wp_filter[ $hook ][ 10 ] as $function_key => $callback ) {
149 149
 						if ( strpos( $function_key, 'render_widget_hooks' ) ) {
150
-							unset( $wp_filter[ $hook ][10][ $function_key ] );
150
+							unset( $wp_filter[ $hook ][ 10 ][ $function_key ] );
151 151
 						}
152 152
 					}
153 153
 				}
154 154
 			} else {
155
-				foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) {
155
+				foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) {
156 156
 					if ( strpos( $function_key, 'render_widget_hooks' ) ) {
157
-						unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] );
157
+						unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] );
158 158
 					}
159 159
 				}
160 160
 			}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		 */
166 166
 		if ( $this->entry ) {
167 167
 
168
-			$request->returns['is_entry'] = $this->entry;
168
+			$request->returns[ 'is_entry' ] = $this->entry;
169 169
 
170 170
 			global $post;
171 171
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 					'fields' => $this->view->fields->by_visible(),
210 210
 					'in_the_loop' => true,
211 211
 				), empty( $parameters ) ? array() : array(
212
-					'paging' => $parameters['paging'],
213
-					'sorting' => $parameters['sorting'],
212
+					'paging' => $parameters[ 'paging' ],
213
+					'sorting' => $parameters[ 'sorting' ],
214 214
 				), $post ? array(
215 215
 					'post' => $post,
216 216
 				) : array() ) );
Please login to merge, or discard this patch.
future/includes/class-gv-plugin.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	/**
85 85
 	 * @var string The REST API functionality identifier.
86 86
 	 */
87
-	const FEATURE_REST  = 'rest_api';
87
+	const FEATURE_REST = 'rest_api';
88 88
 
89 89
 	/**
90 90
 	 * Get the global instance of \GV\Plugin.
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		include_once $this->dir( 'includes/class-frontend-views.php' );
211 211
 		include_once $this->dir( 'includes/class-gravityview-admin-bar.php' );
212 212
 		include_once $this->dir( 'includes/class-gravityview-entry-list.php' );
213
-		include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */
213
+		include_once $this->dir( 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */
214 214
 		include_once $this->dir( 'includes/class-data.php' );
215 215
 		include_once $this->dir( 'includes/class-gravityview-shortcode.php' );
216 216
 		include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' );
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 
245 245
 			$locale = get_locale();
246 246
 
247
-			if ( function_exists('get_user_locale') && is_admin() ) {
247
+			if ( function_exists( 'get_user_locale' ) && is_admin() ) {
248 248
 				$locale = get_user_locale();
249 249
 			}
250 250
 
251 251
 			$locale = apply_filters( 'plugin_locale', $locale, 'gravityview' );
252
-			$mofile = $this->dir( 'languages' ) . '/gravityview-'. $locale .'.mo';
252
+			$mofile = $this->dir( 'languages' ) . '/gravityview-' . $locale . '.mo';
253 253
 			load_textdomain( 'gravityview', $mofile );
254 254
 		}
255 255
 	}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function is_compatible_wordpress( $version = null ) {
384 384
 
385
-		if( ! $version ) {
385
+		if ( ! $version ) {
386 386
 			$version = self::$min_wp_version;
387 387
 		}
388 388
 
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 	 * @return string The version of PHP.
424 424
 	 */
425 425
 	private function get_php_version() {
426
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
427
-			$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
426
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ?
427
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion();
428 428
 	}
429 429
 
430 430
 	/**
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 	 * @return string The version of WordPress.
436 436
 	 */
437 437
 	private function get_wordpress_version() {
438
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
439
-			$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
438
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ?
439
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ];
440 440
 	}
441 441
 
442 442
 	/**
@@ -447,13 +447,13 @@  discard block
 block discarded – undo
447 447
 	 * @return string|null The version of Gravity Forms or null if inactive.
448 448
 	 */
449 449
 	private function get_gravityforms_version() {
450
-		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) {
450
+		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) {
451 451
 			gravityview()->log->error( 'Gravity Forms is inactive or not installed.' );
452 452
 			return null;
453 453
 		}
454 454
 
455
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
456
-			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
455
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ?
456
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version;
457 457
 	}
458 458
 
459 459
 	/**
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 		$tables = array();
510 510
 
511 511
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
512
-			$tables []= \GFFormsModel::get_entry_meta_table_name();
512
+			$tables [ ] = \GFFormsModel::get_entry_meta_table_name();
513 513
 		}
514
-		$tables []= \GFFormsModel::get_lead_meta_table_name();
514
+		$tables [ ] = \GFFormsModel::get_lead_meta_table_name();
515 515
 
516 516
 		foreach ( $tables as $meta_table ) {
517 517
 			$sql = "
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 		$tables = array();
530 530
 
531 531
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
532
-			$tables[] = \GFFormsModel::get_entry_notes_table_name();
532
+			$tables[ ] = \GFFormsModel::get_entry_notes_table_name();
533 533
 		}
534 534
 
535
-		$tables[] = \GFFormsModel::get_lead_notes_table_name();
535
+		$tables[ ] = \GFFormsModel::get_lead_notes_table_name();
536 536
 
537
-		$disapproved = __('Disapproved the Entry for GravityView', 'gravityview');
538
-		$approved = __('Approved the Entry for GravityView', 'gravityview');
537
+		$disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' );
538
+		$approved = __( 'Approved the Entry for GravityView', 'gravityview' );
539 539
 
540 540
 		$suppress = $wpdb->suppress_errors();
541 541
 		foreach ( $tables as $notes_table ) {
Please login to merge, or discard this patch.
future/includes/class-gv-form-gravityforms.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$self = new self();
56 56
 		$self->form = $form;
57 57
 
58
-		$self->ID = intval( $self->form['id'] );
58
+		$self->ID = intval( $self->form[ 'id' ] );
59 59
 
60 60
 		return $self;
61 61
 	}
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @return \GV\GF_Form|null An instance of this form or null if not found.
71 71
 	 */
72 72
 	public static function from_form( $form ) {
73
-		if ( empty( $form['id'] ) ) {
73
+		if ( empty( $form[ 'id' ] ) ) {
74 74
 			return null;
75 75
 		}
76 76
 
77 77
 		$self = new self();
78 78
 		$self->form = $form;
79
-		$self->ID = $self->form['id'];
79
+		$self->ID = $self->form[ 'id' ];
80 80
 
81 81
 		return $self;
82 82
 	}
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 
120 120
 			/** The offset and limit */
121 121
 			if ( ! empty( $offset->limit ) ) {
122
-				$paging['page_size'] = $offset->limit;
122
+				$paging[ 'page_size' ] = $offset->limit;
123 123
 			}
124 124
 
125 125
 			if ( ! empty( $offset->offset ) ) {
126
-				$paging['offset'] = $offset->offset;
126
+				$paging[ 'offset' ] = $offset->offset;
127 127
 			}
128 128
 
129 129
 			foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) {
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function get_fields() {
182 182
 		$fields = array();
183
-		foreach ( $this['fields'] as $field ) {
184
-			foreach ( empty( $field['inputs'] ) ? array( $field['id'] ) : wp_list_pluck( $field['inputs'], 'id' ) as $id ) {
183
+		foreach ( $this[ 'fields' ] as $field ) {
184
+			foreach ( empty( $field[ 'inputs' ] ) ? array( $field[ 'id' ] ) : wp_list_pluck( $field[ 'inputs' ], 'id' ) as $id ) {
185 185
 				if ( is_numeric( $id ) ) {
186 186
 					$fields[ $id ] = self::get_field( $this, $id );
187 187
 				} else {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return bool Whether the offset exists or not.
219 219
 	 */
220 220
 	public function offsetExists( $offset ) {
221
-		return isset( $this->form[$offset] );
221
+		return isset( $this->form[ $offset ] );
222 222
 	}
223 223
 
224 224
 	/**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @return mixed The value of the requested form data.
234 234
 	 */
235 235
 	public function offsetGet( $offset ) {
236
-		return $this->form[$offset];
236
+		return $this->form[ $offset ];
237 237
 	}
238 238
 
239 239
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-entry-gravityforms.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	 * @return \GV\GF_Entry|null An instance of this entry or null if not found.
106 106
 	 */
107 107
 	public static function from_entry( $entry ) {
108
-		if ( empty( $entry['id'] ) ) {
108
+		if ( empty( $entry[ 'id' ] ) ) {
109 109
 			return null;
110 110
 		}
111 111
 
112 112
 		$self = new self();
113 113
 		$self->entry = $entry;
114 114
 
115
-		$self->ID = $self->entry['id'];
115
+		$self->ID = $self->entry[ 'id' ];
116 116
 		$self->slug = \GravityView_API::get_entry_slug( $self->ID, $self->as_entry() );
117 117
 
118 118
 		return $self;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return bool Whether the offset exists or not.
128 128
 	 */
129 129
 	public function offsetExists( $offset ) {
130
-		return isset( $this->entry[$offset] );
130
+		return isset( $this->entry[ $offset ] );
131 131
 	}
132 132
 
133 133
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return mixed The value of the requested entry data.
143 143
 	 */
144 144
 	public function offsetGet( $offset ) {
145
-		return $this->entry[$offset];
145
+		return $this->entry[ $offset ];
146 146
 	}
147 147
 
148 148
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-oembed.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		wp_embed_register_handler( 'gravityview_entry', self::get_entry_regex(), array( __CLASS__, 'render' ), 20000 );
27 27
 		wp_oembed_add_provider( self::get_entry_regex(), self::$provider_url, true );
28 28
 
29
-		if ( ! empty( $_GET['gv_oembed_provider'] ) && ! empty( $_GET['url'] ) ) {
29
+		if ( ! empty( $_GET[ 'gv_oembed_provider' ] ) && ! empty( $_GET[ 'url' ] ) ) {
30 30
 			add_action( 'template_redirect', array( __CLASS__, 'render_provider_request' ) );
31 31
 		}
32 32
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @return void
44 44
 	 */
45 45
 	public static function render_provider_request() {
46
-		if ( ! empty( $_GET['url'] ) ) {
47
-			$url = $_GET['url'];
46
+		if ( ! empty( $_GET[ 'url' ] ) ) {
47
+			$url = $_GET[ 'url' ];
48 48
 		} else {
49 49
 			header( 'HTTP/1.0 404 Not Found' );
50 50
 			exit;
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	private static function parse_matches( $matches, $url ) {
113 113
 		// If not using permalinks, re-assign values for matching groups
114
-		if ( ! empty( $matches['entry_slug2'] ) ) {
115
-			$matches['is_cpt'] = $matches['is_cpt2'];
116
-			$matches['slug'] = $matches['slug2'];
117
-			$matches['entry_slug'] = $matches['entry_slug2'];
118
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
114
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
115
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
116
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
117
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
118
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
119 119
 		}
120 120
 
121
-		if ( empty( $matches['entry_slug'] ) ) {
121
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
122 122
 			gravityview()->log->error( 'Entry slug not parsed by regex.', array( 'data' => $matches ) );
123 123
 			return null;
124 124
 		} else {
125
-			$entry_id = $matches['entry_slug'];
125
+			$entry_id = $matches[ 'entry_slug' ];
126 126
 		}
127 127
 
128 128
 		if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) {
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 		if ( ! $view ) {
143 143
 
144 144
 			// If the slug doesn't work, maybe using Plain permalinks and not the slug, only ID
145
-			if( is_numeric( $matches['slug'] ) ) {
146
-				$view = \GV\View::by_id( $matches['slug'] );
145
+			if ( is_numeric( $matches[ 'slug' ] ) ) {
146
+				$view = \GV\View::by_id( $matches[ 'slug' ] );
147 147
 			}
148 148
 
149
-			if( ! $view ) {
150
-				$view = \GV\View::from_post( get_page_by_path( $matches['slug'], OBJECT, 'gravityview' ) );
149
+			if ( ! $view ) {
150
+				$view = \GV\View::from_post( get_page_by_path( $matches[ 'slug' ], OBJECT, 'gravityview' ) );
151 151
 			}
152 152
 		}
153 153
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
 		return '
180 180
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
181
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
181
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
182 182
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
183
-				'.$embed_text.'
183
+				'.$embed_text . '
184 184
 			</p>
185 185
 			<br style="clear: both;">
186 186
 		</div>';
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	private static function render_preview_notice() {
195 195
 		$floaty = \GravityView_Admin::get_floaty();
196 196
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
197
-		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
198
-		return '<div class="updated notice">'.$floaty.'<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
197
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
198
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
199 199
 	}
200 200
 
201 201
 	/**
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 			return __( 'You are not allowed to view this content.', 'gravityview' );
215 215
 		}
216 216
 
217
-		if ( $entry && 'active' !== $entry['status'] ) {
217
+		if ( $entry && 'active' !== $entry[ 'status' ] ) {
218 218
 			gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
219 219
 			return __( 'You are not allowed to view this content.', 'gravityview' );
220 220
 		}
221 221
 
222 222
 		if ( $view->settings->get( 'show_only_approved' ) ) {
223
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
223
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
224 224
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
225 225
 				return __( 'You are not allowed to view this content.', 'gravityview' );
226 226
 			}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		// Catch either
286 286
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
287 287
 
288
-		return '#'.$match_regex.'#i';
288
+		return '#' . $match_regex . '#i';
289 289
 	}
290 290
 
291 291
 	/**
Please login to merge, or discard this patch.
includes/extensions/delete-entry/class-delete-entry.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 		add_action( 'wp', array( $this, 'process_delete' ), 10000 );
44 44
 
45
-		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field'), 10, 3 );
45
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
46 46
 
47 47
 		add_action( 'gravityview_before', array( $this, 'display_message' ) );
48 48
 
49 49
 		// For the Delete Entry Link, you don't want visible to all users.
50
-		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps'), 10, 5 );
50
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
51 51
 
52 52
 		// Modify the field options based on the name of the field type
53 53
 		add_filter( 'gravityview_template_delete_link_options', array( $this, 'delete_link_field_options' ), 10, 5 );
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 		// add template path to check for field
56 56
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
57 57
 
58
-		add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button'), 10, 4 );
58
+		add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button' ), 10, 4 );
59 59
 
60
-		add_action ( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 );
61
-		add_action ( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 );
60
+		add_action( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 );
61
+		add_action( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 );
62 62
 	}
63 63
 
64 64
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	static function getInstance() {
71 71
 
72
-		if( empty( self::$instance ) ) {
72
+		if ( empty( self::$instance ) ) {
73 73
 			self::$instance = new self;
74 74
 		}
75 75
 
@@ -105,20 +105,20 @@  discard block
 block discarded – undo
105 105
 	function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
106 106
 
107 107
 		// Always a link, never a filter
108
-		unset( $field_options['show_as_link'], $field_options['search_filter'] );
108
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
109 109
 
110 110
 		// Delete Entry link should only appear to visitors capable of editing entries
111
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
111
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
112 112
 
113
-		$add_option['delete_link'] = array(
113
+		$add_option[ 'delete_link' ] = array(
114 114
 			'type' => 'text',
115 115
 			'label' => __( 'Delete Link Text', 'gravityview' ),
116 116
 			'desc' => NULL,
117
-			'value' => __('Delete Entry', 'gravityview'),
117
+			'value' => __( 'Delete Entry', 'gravityview' ),
118 118
 			'merge_tags' => true,
119 119
 		);
120 120
 
121
-		$field_options['allow_edit_cap'] = array(
121
+		$field_options[ 'allow_edit_cap' ] = array(
122 122
 			'type' => 'select',
123 123
 			'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ),
124 124
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
144 144
 
145
-		if( 'edit' !== $zone ) {
146
-			$entry_default_fields['delete_link'] = array(
145
+		if ( 'edit' !== $zone ) {
146
+			$entry_default_fields[ 'delete_link' ] = array(
147 147
 				'label' => __( 'Delete Entry', 'gravityview' ),
148 148
 				'type'  => 'delete_link',
149 149
 				'desc'  => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ),
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	function add_available_field( $available_fields = array() ) {
162 162
 
163
-		$available_fields['delete_link'] = array(
163
+		$available_fields[ 'delete_link' ] = array(
164 164
 			'label_text' => __( 'Delete Entry', 'gravityview' ),
165 165
 			'field_id' => 'delete_link',
166 166
 			'label_type' => 'field',
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 		$caps = $visibility_caps;
189 189
 
190 190
 		// If we're configuring fields in the edit context, we want a limited selection
191
-		if( $field_id === 'delete_link' ) {
191
+		if ( $field_id === 'delete_link' ) {
192 192
 
193 193
 			// Remove other built-in caps.
194
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
194
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] );
195 195
 
196
-			$caps['read'] = _x('Entry Creator', 'User capability', 'gravityview');
196
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
197 197
 		}
198 198
 
199 199
 		return $caps;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @param [type] $entry [description]
207 207
 	 */
208 208
 	function set_entry( $entry = null ) {
209
-		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry;
209
+		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry;
210 210
 	}
211 211
 
212 212
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 		self::getInstance()->set_entry( $entry );
241 241
 
242
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
242
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
243 243
 
244 244
 		if ( empty( $base ) ) {
245 245
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		}
248 248
 
249 249
 		// Use the slug instead of the ID for consistent security
250
-		$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
250
+		$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
251 251
 
252 252
 		$actionurl = add_query_arg( array(
253 253
 			'action'	=> 'delete',
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             'view_id' => $view_id,
257 257
 		), $base );
258 258
 
259
-		$url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' );
259
+		$url = wp_nonce_url( $actionurl, 'delete_' . $entry_slug, 'delete' );
260 260
 
261 261
 		return $url;
262 262
 	}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	public function add_delete_button( $form = array(), $entry = array(), $view_id = null, $post_id = null ) {
279 279
 
280 280
 		// Only show the link to those who are allowed to see it.
281
-		if( !self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
281
+		if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
282 282
 			return;
283 283
 		}
284 284
 
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
 		$show_delete_button = apply_filters( 'gravityview/delete-entry/show-delete-button', true );
290 290
 
291 291
 		// If the button is hidden by the filter, don't show.
292
-		if( !$show_delete_button ) {
292
+		if ( ! $show_delete_button ) {
293 293
 			return;
294 294
 		}
295 295
 
296 296
 		$attributes = array(
297 297
 			'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete',
298
-			'tabindex' => ( GFCommon::$tab_index ++ ),
298
+			'tabindex' => ( GFCommon::$tab_index++ ),
299 299
 			'onclick' => self::get_confirm_dialog(),
300 300
 		);
301 301
 
@@ -319,27 +319,27 @@  discard block
 block discarded – undo
319 319
 	function process_delete() {
320 320
 
321 321
 		// If the form is submitted
322
-		if( isset( $_GET['action'] ) && 'delete' === $_GET['action'] && isset( $_GET['entry_id'] ) ) {
322
+		if ( isset( $_GET[ 'action' ] ) && 'delete' === $_GET[ 'action' ] && isset( $_GET[ 'entry_id' ] ) ) {
323 323
 
324 324
 			// Make sure it's a GravityView request
325
-			$valid_nonce_key = wp_verify_nonce( $_GET['delete'], self::get_nonce_key( $_GET['entry_id'] ) );
325
+			$valid_nonce_key = wp_verify_nonce( $_GET[ 'delete' ], self::get_nonce_key( $_GET[ 'entry_id' ] ) );
326 326
 
327
-			if( ! $valid_nonce_key ) {
327
+			if ( ! $valid_nonce_key ) {
328 328
 				gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' );
329 329
 				return;
330 330
 			}
331 331
 
332 332
 			// Get the entry slug
333
-			$entry_slug = esc_attr( $_GET['entry_id'] );
333
+			$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
334 334
 
335 335
 			// See if there's an entry there
336 336
 			$entry = gravityview_get_entry( $entry_slug, true, false );
337 337
 
338
-			if( $entry ) {
338
+			if ( $entry ) {
339 339
 
340 340
 				$has_permission = $this->user_can_delete_entry( $entry );
341 341
 
342
-				if( is_wp_error( $has_permission ) ) {
342
+				if ( is_wp_error( $has_permission ) ) {
343 343
 
344 344
 					$messages = array(
345 345
 						'message' => urlencode( $has_permission->get_error_message() ),
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 					// Delete the entry
352 352
 					$delete_response = $this->delete_or_trash_entry( $entry );
353 353
 
354
-					if( is_wp_error( $delete_response ) ) {
354
+					if ( is_wp_error( $delete_response ) ) {
355 355
 
356 356
 						$messages = array(
357 357
 							'message' => urlencode( $delete_response->get_error_message() ),
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				gravityview()->log->debug( 'Delete entry failed: there was no entry with the entry slug {entry_slug}', array( 'entry_slug' => $entry_slug ) );
374 374
 
375 375
 				$messages = array(
376
-					'message' => urlencode( __('The entry does not exist.', 'gravityview') ),
376
+					'message' => urlencode( __( 'The entry does not exist.', 'gravityview' ) ),
377 377
 					'status' => 'error',
378 378
 				);
379 379
 			}
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 	 */
414 414
 	private function delete_or_trash_entry( $entry ) {
415 415
 
416
-		$entry_id = $entry['id'];
416
+		$entry_id = $entry[ 'id' ];
417 417
 		
418 418
 		$mode = $this->get_delete_mode();
419 419
 
420
-		if( 'delete' === $mode ) {
420
+		if ( 'delete' === $mode ) {
421 421
 
422 422
 			gravityview()->log->debug( 'Starting delete entry: {entry_id}', array( 'entry_id' => $entry_id ) );
423 423
 
424 424
 			// Delete the entry
425 425
 			$delete_response = GFAPI::delete_entry( $entry_id );
426 426
 
427
-			if( ! is_wp_error( $delete_response ) ) {
427
+			if ( ! is_wp_error( $delete_response ) ) {
428 428
 				$delete_response = 'deleted';
429 429
 
430 430
 				/**
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 			$trashed = GFAPI::update_entry_property( $entry_id, 'status', 'trash' );
446 446
 			new GravityView_Cache;
447 447
 
448
-			if( ! $trashed ) {
449
-				$delete_response = new WP_Error( 'trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview' ) );
448
+			if ( ! $trashed ) {
449
+				$delete_response = new WP_Error( 'trash_entry_failed', __( 'Moving the entry to the trash failed.', 'gravityview' ) );
450 450
 			} else {
451 451
 
452 452
 				/**
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	public function process_connected_posts( $entry_id = 0, $entry = array() ) {
478 478
 
479 479
 		// The entry had no connected post
480
-		if( empty( $entry['post_id'] ) ) {
480
+		if ( empty( $entry[ 'post_id' ] ) ) {
481 481
 			return;
482 482
 		}
483 483
 
@@ -488,19 +488,19 @@  discard block
 block discarded – undo
488 488
 		 */
489 489
 		$delete_post = apply_filters( 'gravityview/delete-entry/delete-connected-post', true );
490 490
 		
491
-		if( false === $delete_post ) {
491
+		if ( false === $delete_post ) {
492 492
 			return;
493 493
 		}
494 494
 
495 495
 		$action = current_action();
496 496
 
497
-		if( 'gravityview/delete-entry/deleted' === $action ) {
498
-			$result = wp_delete_post( $entry['post_id'], true );
497
+		if ( 'gravityview/delete-entry/deleted' === $action ) {
498
+			$result = wp_delete_post( $entry[ 'post_id' ], true );
499 499
 		} else {
500
-			$result = wp_trash_post( $entry['post_id'] );
500
+			$result = wp_trash_post( $entry[ 'post_id' ] );
501 501
 		}
502 502
 
503
-		if( false === $result ) {
503
+		if ( false === $result ) {
504 504
 			gravityview()->log->error( '(called by {action}): Error processing the Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) );
505 505
 		} else {
506 506
 			gravityview()->log->debug( '(called by {action}): Successfully processed Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) );
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
 	public function verify_nonce() {
517 517
 
518 518
 		// No delete entry request was made
519
-		if( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) {
519
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) {
520 520
 			return false;
521 521
 		}
522 522
 
523
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
523
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
524 524
 
525
-		$valid = wp_verify_nonce( $_GET['delete'], $nonce_key );
525
+		$valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key );
526 526
 
527 527
 		/**
528 528
 		 * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid.
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	 */
545 545
 	public static function get_confirm_dialog() {
546 546
 
547
-		$confirm = __('Are you sure you want to delete this entry? This cannot be undone.', 'gravityview');
547
+		$confirm = __( 'Are you sure you want to delete this entry? This cannot be undone.', 'gravityview' );
548 548
 
549 549
 		/**
550 550
 		 * @filter `gravityview/delete-entry/confirm-text` Modify the Delete Entry Javascript confirmation text
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		 */
553 553
 		$confirm = apply_filters( 'gravityview/delete-entry/confirm-text', $confirm );
554 554
 
555
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
555
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
556 556
 	}
557 557
 
558 558
 	/**
@@ -570,16 +570,16 @@  discard block
 block discarded – undo
570 570
 
571 571
 		$error = NULL;
572 572
 
573
-		if( ! $this->verify_nonce() ) {
574
-			$error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview');
573
+		if ( ! $this->verify_nonce() ) {
574
+			$error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview' );
575 575
 		}
576 576
 
577
-		if( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
578
-			$error = __( 'You do not have permission to delete this entry.', 'gravityview');
577
+		if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
578
+			$error = __( 'You do not have permission to delete this entry.', 'gravityview' );
579 579
 		}
580 580
 
581
-		if( $entry['status'] === 'trash' ) {
582
-			if( 'trash' === $this->get_delete_mode() ) {
581
+		if ( $entry[ 'status' ] === 'trash' ) {
582
+			if ( 'trash' === $this->get_delete_mode() ) {
583 583
 				$error = __( 'The entry is already in the trash.', 'gravityview' );
584 584
 			} else {
585 585
 				$error = __( 'You cannot delete the entry; it is already in the trash.', 'gravityview' );
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		}
588 588
 
589 589
 		// No errors; everything's fine here!
590
-		if( empty( $error ) ) {
590
+		if ( empty( $error ) ) {
591 591
 			return true;
592 592
 		}
593 593
 
@@ -616,10 +616,10 @@  discard block
 block discarded – undo
616 616
 
617 617
 		$current_user = wp_get_current_user();
618 618
 
619
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL;
619
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL;
620 620
 
621 621
 		// Or if they can delete any entries (as defined in Gravity Forms), we're good.
622
-		if( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
622
+		if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
623 623
 
624 624
 			gravityview()->log->debug( 'Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' );
625 625
 
@@ -628,20 +628,20 @@  discard block
 block discarded – undo
628 628
 
629 629
 
630 630
 		// If field options are passed, check if current user can view the link
631
-		if( !empty( $field ) ) {
631
+		if ( ! empty( $field ) ) {
632 632
 
633 633
 			// If capability is not defined, something is not right!
634
-			if( empty( $field['allow_edit_cap'] ) ) {
634
+			if ( empty( $field[ 'allow_edit_cap' ] ) ) {
635 635
 
636 636
 				gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) );
637 637
 
638 638
 				return false;
639 639
 			}
640 640
 
641
-			if( GVCommon::has_cap( $field['allow_edit_cap'] ) ) {
641
+			if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) {
642 642
 
643 643
 				// Do not return true if cap is read, as we need to check if the current user created the entry
644
-				if( $field['allow_edit_cap'] !== 'read' ) {
644
+				if ( $field[ 'allow_edit_cap' ] !== 'read' ) {
645 645
 					return true;
646 646
 				}
647 647
 
@@ -654,21 +654,21 @@  discard block
 block discarded – undo
654 654
 
655 655
 		}
656 656
 
657
-		if( !isset( $entry['created_by'] ) ) {
657
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
658 658
 
659
-			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
659
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
660 660
 
661 661
 			return false;
662 662
 		}
663 663
 
664 664
 		// Only checks user_delete view option if view is already set
665
-		if( $view_id ) {
665
+		if ( $view_id ) {
666 666
 
667 667
 			$current_view = gravityview_get_current_view_data( $view_id );
668 668
 
669
-			$user_delete = isset( $current_view['atts']['user_delete'] ) ? $current_view['atts']['user_delete'] : false;
669
+			$user_delete = isset( $current_view[ 'atts' ][ 'user_delete' ] ) ? $current_view[ 'atts' ][ 'user_delete' ] : false;
670 670
 
671
-			if( empty( $user_delete ) ) {
671
+			if ( empty( $user_delete ) ) {
672 672
 
673 673
 				gravityview()->log->debug( 'User Delete is disabled. Returning false.' );
674 674
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		}
678 678
 
679 679
 		// If the logged-in user is the same as the user who created the entry, we're good.
680
-		if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
680
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
681 681
 
682 682
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
683 683
 
@@ -702,16 +702,16 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public function display_message( $current_view_id = 0 ) {
704 704
 
705
-		if( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
705
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
706 706
 			return;
707 707
 		}
708 708
 
709 709
 		// Entry wasn't deleted from current View
710
-		if( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) {
710
+		if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) {
711 711
 			return;
712 712
 		}
713 713
 
714
-		$status = esc_attr( $_GET['status'] );
714
+		$status = esc_attr( $_GET[ 'status' ] );
715 715
 		$message_from_url = \GV\Utils::_GET( 'message' );
716 716
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
717 717
 		$class = '';
@@ -719,14 +719,14 @@  discard block
 block discarded – undo
719 719
 		switch ( $status ) {
720 720
 			case 'error':
721 721
 				$class = ' gv-error error';
722
-				$error_message = __('There was an error deleting the entry: %s', 'gravityview');
722
+				$error_message = __( 'There was an error deleting the entry: %s', 'gravityview' );
723 723
 				$message = sprintf( $error_message, $message_from_url );
724 724
 				break;
725 725
 			case 'trashed':
726
-				$message = __('The entry was successfully moved to the trash.', 'gravityview');
726
+				$message = __( 'The entry was successfully moved to the trash.', 'gravityview' );
727 727
 				break;
728 728
 			default:
729
-				$message = __('The entry was successfully deleted.', 'gravityview');
729
+				$message = __( 'The entry was successfully deleted.', 'gravityview' );
730 730
 				break;
731 731
 		}
732 732
 
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 		$message = apply_filters( 'gravityview/delete-entry/message', esc_attr( $message ), $status, $message_from_url );
741 741
 
742 742
 		// DISPLAY ERROR/SUCCESS MESSAGE
743
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
743
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
744 744
 	}
745 745
 
746 746
 
Please login to merge, or discard this patch.
includes/class-gravityview-migrate.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		$disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) );
74 74
 
75
-		if( false === $approved_result || false === $disapproved_result ) {
75
+		if ( false === $approved_result || false === $disapproved_result ) {
76 76
 			gravityview()->log->error( 'There was an error processing the query. {error}', array( 'error' => $wpdb->last_error ) );
77 77
 		} else {
78 78
 			// All done: Meta values are migrated
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 		$redux_settings = $this->get_redux_settings();
106 106
 
107 107
 		// No need to process
108
-		if( false === $redux_settings ) {
108
+		if ( false === $redux_settings ) {
109 109
 			return;
110 110
 		}
111 111
 
112
-		if( empty(  $redux_settings['license_key_status'] ) ) {
112
+		if ( empty( $redux_settings[ 'license_key_status' ] ) ) {
113 113
 			$redux_settings = $this->get_redux_license_status( $redux_settings );
114 114
 		}
115 115
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		gravityview()->plugin->settings->update( $updated_settings );
124 124
 
125 125
 		// And now remove the previous option, so this is a one-time thing.
126
-		delete_option('gravityview_settings');
127
-		delete_option('gravityview_settings-transients');
126
+		delete_option( 'gravityview_settings' );
127
+		delete_option( 'gravityview_settings-transients' );
128 128
 	}
129 129
 
130 130
 	/**
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 
148 148
 		$license_call = \GV\License_Handler::get()->license_call( $data );
149 149
 
150
-		if( is_object( $license_call ) && isset( $license_call->license ) ) {
151
-			$redux_settings['license_key_status'] = $license_call->license;
152
-			$redux_settings['license_key_response'] = json_encode( $license_call );
150
+		if ( is_object( $license_call ) && isset( $license_call->license ) ) {
151
+			$redux_settings[ 'license_key_status' ] = $license_call->license;
152
+			$redux_settings[ 'license_key_response' ] = json_encode( $license_call );
153 153
 		}
154 154
 
155 155
 		return $redux_settings;
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	function get_redux_settings() {
164 164
 
165 165
 		// Previous settings set by Redux
166
-		$redux_option = get_option('gravityview_settings');
166
+		$redux_option = get_option( 'gravityview_settings' );
167 167
 
168 168
 		// No Redux settings? Don't proceed.
169
-		if( false === $redux_option ) {
169
+		if ( false === $redux_option ) {
170 170
 			return false;
171 171
 		}
172 172
 
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
 
179 179
 		if ( $license_array = \GV\Utils::get( $redux_option, 'license' ) ) {
180 180
 
181
-			$redux_settings['license_key'] = $license_key = \GV\Utils::get( $license_array, 'license' );
181
+			$redux_settings[ 'license_key' ] = $license_key = \GV\Utils::get( $license_array, 'license' );
182 182
 
183
-			$redux_last_changed_values = get_option('gravityview_settings-transients');
183
+			$redux_last_changed_values = get_option( 'gravityview_settings-transients' );
184 184
 
185 185
 			// This contains the last response for license validation
186
-			if( !empty( $redux_last_changed_values ) && $saved_values = \GV\Utils::get( $redux_last_changed_values, 'changed_values' ) ) {
186
+			if ( ! empty( $redux_last_changed_values ) && $saved_values = \GV\Utils::get( $redux_last_changed_values, 'changed_values' ) ) {
187 187
 
188 188
 				$saved_license = \GV\Utils::get( $saved_values, 'license' );
189 189
 
190 190
 				// Only use the last-saved values if they are for the same license
191
-				if( $saved_license && \GV\Utils::get( $saved_license, 'license' ) === $license_key ) {
192
-					$redux_settings['license_key_status'] = \GV\Utils::get( $saved_license, 'status' );
193
-					$redux_settings['license_key_response'] = \GV\Utils::get( $saved_license, 'response' );
191
+				if ( $saved_license && \GV\Utils::get( $saved_license, 'license' ) === $license_key ) {
192
+					$redux_settings[ 'license_key_status' ] = \GV\Utils::get( $saved_license, 'status' );
193
+					$redux_settings[ 'license_key_response' ] = \GV\Utils::get( $saved_license, 'response' );
194 194
 				}
195 195
 			}
196 196
 		}
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	/** ----  Migrate from old search widget to new search widget  ---- */
203 203
 	function update_search_on_views() {
204 204
 
205
-		if( !class_exists('GravityView_Widget_Search') ) {
206
-			include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' );
205
+		if ( ! class_exists( 'GravityView_Widget_Search' ) ) {
206
+			include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' );
207 207
 		}
208 208
 
209 209
 		// Loop through all the views
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 
216 216
 		$views = get_posts( $query_args );
217 217
 
218
-		foreach( $views as $view ) {
218
+		foreach ( $views as $view ) {
219 219
 
220 220
 			$widgets = gravityview_get_directory_widgets( $view->ID );
221 221
 			$search_fields = null;
222 222
 
223
-			if( empty( $widgets ) || !is_array( $widgets ) ) { continue; }
223
+			if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; }
224 224
 
225 225
 			gravityview()->log->debug( '[GravityView_Migrate/update_search_on_views] Loading View ID: {view_id}', array( 'view_id' => $view->ID ) );
226 226
 
227
-			foreach( $widgets as $area => $ws ) {
228
-				foreach( $ws as $k => $widget ) {
229
-					if( $widget['id'] !== 'search_bar' ) { continue; }
227
+			foreach ( $widgets as $area => $ws ) {
228
+				foreach ( $ws as $k => $widget ) {
229
+					if ( $widget[ 'id' ] !== 'search_bar' ) { continue; }
230 230
 
231
-					if( is_null( $search_fields ) ) {
231
+					if ( is_null( $search_fields ) ) {
232 232
 						$search_fields = $this->get_search_fields( $view->ID );
233 233
 					}
234 234
 
@@ -236,24 +236,24 @@  discard block
 block discarded – undo
236 236
 					//  [search_free] => 1
237 237
 			        //  [search_date] => 1
238 238
 			        $search_generic = array();
239
-					if( !empty( $widget['search_free'] ) ) {
240
-						$search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' );
239
+					if ( ! empty( $widget[ 'search_free' ] ) ) {
240
+						$search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' );
241 241
 					}
242
-					if( !empty( $widget['search_date'] ) ) {
243
-						$search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' );
242
+					if ( ! empty( $widget[ 'search_date' ] ) ) {
243
+						$search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' );
244 244
 					}
245 245
 
246 246
 					$search_config = array_merge( $search_generic, $search_fields );
247 247
 
248 248
 					// don't throw '[]' when json_encode an empty array
249
-					if( empty( $search_config ) ) {
249
+					if ( empty( $search_config ) ) {
250 250
 						$search_config = '';
251 251
 					} else {
252 252
 						$search_config = json_encode( $search_config );
253 253
 					}
254 254
 
255
-					$widgets[ $area ][ $k ]['search_fields'] = $search_config;
256
-					$widgets[ $area ][ $k ]['search_layout'] = 'horizontal';
255
+					$widgets[ $area ][ $k ][ 'search_fields' ] = $search_config;
256
+					$widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal';
257 257
 
258 258
 					gravityview()->log->debug( '[GravityView_Migrate/update_search_on_views] Updated Widget: ', array( 'data' => $widgets[ $area ][ $k ] ) );
259 259
 				}
@@ -281,26 +281,26 @@  discard block
 block discarded – undo
281 281
 		// check view fields' settings
282 282
 		$fields = gravityview_get_directory_fields( $view_id, false );
283 283
 
284
-		if( !empty( $fields ) && is_array( $fields ) ) {
284
+		if ( ! empty( $fields ) && is_array( $fields ) ) {
285 285
 
286
-			foreach( $fields as $t => $fs ) {
286
+			foreach ( $fields as $t => $fs ) {
287 287
 
288
-				foreach( $fs as $k => $field ) {
288
+				foreach ( $fs as $k => $field ) {
289 289
 					// is field a search_filter ?
290
-					if( empty( $field['search_filter'] ) ) { continue; }
290
+					if ( empty( $field[ 'search_filter' ] ) ) { continue; }
291 291
 
292 292
 					// get field type & calculate the input type (by default)
293
-					$form_field = gravityview_get_field( $form, $field['id'] );
293
+					$form_field = gravityview_get_field( $form, $field[ 'id' ] );
294 294
 
295
-					if( empty( $form_field['type'] ) ) {
295
+					if ( empty( $form_field[ 'type' ] ) ) {
296 296
 						continue;
297 297
 					}
298 298
 
299 299
 					// depending on the field type assign a group of possible search field types
300
-					$type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] );
300
+					$type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] );
301 301
 
302 302
 					// add field to config
303
-					$search_fields[] = array( 'field' => $field['id'], 'input' => $type );
303
+					$search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type );
304 304
 
305 305
 				}
306 306
 			}
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		/** gf_entries page - entries table screen */
45 45
 
46 46
 		// capture bulk actions
47
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
47
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
48 48
 
49 49
 		// add hidden field with approve status
50 50
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) );
53 53
 
54 54
 		// adding styles and scripts
55
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
55
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
56 56
 		// bypass Gravity Forms no-conflict mode
57 57
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
58 58
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
82 82
 		 * @param array $form GF Form object of current form
83 83
 		 */
84
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
84
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
85 85
 			return $filter_links;
86 86
 		}
87 87
 
@@ -109,27 +109,27 @@  discard block
 block discarded – undo
109 109
 		$approved_count = $disapproved_count = $unapproved_count = 0;
110 110
 
111 111
 		// Only count if necessary
112
-		if( $include_counts ) {
113
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
114
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
115
-			$unapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) );
112
+		if ( $include_counts ) {
113
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
114
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
115
+			$unapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) );
116 116
 		}
117 117
 
118
-		$filter_links[] = array(
118
+		$filter_links[ ] = array(
119 119
 			'id'            => 'gv_approved',
120 120
 			'field_filters' => $field_filters_approved,
121 121
 			'count'         => $approved_count,
122 122
 			'label'         => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ),
123 123
 		);
124 124
 
125
-		$filter_links[] = array(
125
+		$filter_links[ ] = array(
126 126
 			'id'            => 'gv_disapproved',
127 127
 			'field_filters' => $field_filters_disapproved,
128 128
 			'count'         => $disapproved_count,
129 129
 			'label'         => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::DISAPPROVED ),
130 130
 		);
131 131
 
132
-		$filter_links[] = array(
132
+		$filter_links[ ] = array(
133 133
 			'id'            => 'gv_unapproved',
134 134
 			'field_filters' => $field_filters_unapproved,
135 135
 			'count'         => $unapproved_count,
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	function tooltips( $tooltips ) {
150 150
 
151
-		$tooltips['form_gravityview_fields'] = array(
152
-			'title' => __('GravityView Fields', 'gravityview'),
153
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
151
+		$tooltips[ 'form_gravityview_fields' ] = array(
152
+			'title' => __( 'GravityView Fields', 'gravityview' ),
153
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
154 154
 		);
155 155
 
156 156
 		return $tooltips;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		$gv_bulk_action = false;
263 263
 
264
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
264
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
265 265
 			$bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' );
266 266
 		} else {
267 267
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		}
270 270
 
271 271
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
272
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
272
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
273 273
 			$gv_bulk_action = $bulk_action;
274 274
 		}
275 275
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		
295 295
 		// gforms_entry_list is the nonce that confirms we're on the right page
296 296
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
297
-		if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) {
297
+		if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
298 298
 
299 299
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
300 300
 
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 			}
313 313
 
314 314
 			// All entries are set to be updated, not just the visible ones
315
-			if ( ! empty( $_POST['all_entries'] ) ) {
315
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
316 316
 
317 317
 				// Convert the current entry search into GF-formatted search criteria
318 318
 				$search = array(
319
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
320
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
321
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
319
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
320
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
321
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
322 322
 				);
323 323
 
324 324
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 			} else {
330 330
 
331 331
 				// Changed from 'lead' to 'entry' in 2.0
332
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
332
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
333 333
 
334 334
 			}
335 335
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
342 342
 
343 343
 			switch ( $approved_status ) {
344
-				case $this->bulk_action_prefixes['approve']:
344
+				case $this->bulk_action_prefixes[ 'approve' ]:
345 345
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id );
346 346
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
347 347
 					break;
348
-				case $this->bulk_action_prefixes['unapprove']:
348
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
349 349
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id );
350 350
 					$this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
351 351
 					break;
352
-				case $this->bulk_action_prefixes['disapprove']:
352
+				case $this->bulk_action_prefixes[ 'disapprove' ]:
353 353
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id );
354 354
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
355 355
 					break;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      *
372 372
 	 * @return boolean True: It worked; False: it failed
373 373
 	 */
374
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
374
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
375 375
 		return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn );
376 376
 	}
377 377
 
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
 	 *
402 402
 	 * @return void
403 403
 	 */
404
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
404
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
405 405
 
406
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
406
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
407 407
 			return;
408 408
 		}
409 409
 
410
-		if( empty( $entry['id'] ) ) {
410
+		if ( empty( $entry[ 'id' ] ) ) {
411 411
 			return;
412 412
 		}
413 413
 
414 414
 		$status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' );
415 415
 
416
-		if( $status_value ) {
417
-			echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />';
416
+		if ( $status_value ) {
417
+			echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />';
418 418
 		}
419 419
 	}
420 420
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	 */
428 428
 	private function get_form_id() {
429 429
 
430
-		$form_id = GFForms::get('id');
430
+		$form_id = GFForms::get( 'id' );
431 431
 
432 432
 		// If there are no forms identified, use the first form. That's how GF does it.
433
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
433
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
434 434
 			$form_id = $this->get_first_form_id();
435 435
 		}
436 436
 
@@ -450,14 +450,14 @@  discard block
 block discarded – undo
450 450
 
451 451
 		$forms = RGFormsModel::get_forms( null, 'title' );
452 452
 
453
-		if( ! isset( $forms[0] ) ) {
453
+		if ( ! isset( $forms[ 0 ] ) ) {
454 454
 			gravityview()->log->error( 'No forms were found' );
455 455
 			return 0;
456 456
 		}
457 457
 
458
-		$first_form = $forms[0];
458
+		$first_form = $forms[ 0 ];
459 459
 
460
-		$form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
460
+		$form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ];
461 461
 
462 462
 		return intval( $form_id );
463 463
 	}
@@ -465,33 +465,33 @@  discard block
 block discarded – undo
465 465
 
466 466
 	function add_scripts_and_styles( $hook ) {
467 467
 
468
-		if( ! class_exists( 'GFForms' ) ) {
468
+		if ( ! class_exists( 'GFForms' ) ) {
469 469
 			gravityview()->log->error( 'GFForms does not exist.' );
470 470
 			return;
471 471
 		}
472 472
 
473 473
 		// enqueue styles & scripts gf_entries
474 474
 		// But only if we're on the main Entries page, not on reports pages
475
-		if( GFForms::get_page() !== 'entry_list' ) {
475
+		if ( GFForms::get_page() !== 'entry_list' ) {
476 476
 			return;
477 477
 		}
478 478
 
479 479
 		$form_id = $this->get_form_id();
480 480
 
481 481
 		// Things are broken; no forms were found
482
-		if( empty( $form_id ) ) {
482
+		if ( empty( $form_id ) ) {
483 483
 			return;
484 484
 		}
485 485
 
486
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
486
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
487 487
 
488
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
488
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
489 489
 
490
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
490
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
491 491
 
492 492
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
493
-			'nonce' => wp_create_nonce( 'gravityview_entry_approval'),
494
-			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'),
493
+			'nonce' => wp_create_nonce( 'gravityview_entry_approval' ),
494
+			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ),
495 495
 			'form_id' => $form_id,
496 496
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
497 497
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
@@ -500,10 +500,10 @@  discard block
 block discarded – undo
500 500
 			'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED,
501 501
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
502 502
 			'bulk_message' => $this->bulk_update_message,
503
-			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
504
-            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
505
-			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
506
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
503
+			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ),
504
+            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ),
505
+			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ),
506
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
507 507
 			'column_link' => esc_url( $this->get_sort_link() ),
508 508
 		) );
509 509
 
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
 		$bulk_actions = array(
546 546
 			'GravityView' => array(
547 547
 				array(
548
-					'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
549
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
548
+					'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ),
549
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
550 550
 				),
551 551
 				array(
552
-					'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
553
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ),
552
+					'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ),
553
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ),
554 554
 				),
555 555
 				array(
556
-					'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
557
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
556
+					'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ),
557
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
558 558
 				),
559 559
 			),
560 560
 		);
@@ -571,13 +571,13 @@  discard block
 block discarded – undo
571 571
 		// Sanitize the values, just to be sure.
572 572
 		foreach ( $bulk_actions as $key => $group ) {
573 573
 
574
-		    if( empty( $group ) ) {
574
+		    if ( empty( $group ) ) {
575 575
 		        continue;
576 576
 		    }
577 577
 
578 578
 			foreach ( $group as $i => $action ) {
579
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
580
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
579
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
580
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
581 581
 			}
582 582
 		}
583 583
 
@@ -602,13 +602,13 @@  discard block
 block discarded – undo
602 602
 		 * @since 1.7.2
603 603
 		 * @param boolean $hide_if_no_connections
604 604
 		 */
605
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
605
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
606 606
 
607
-		if( $hide_if_no_connections ) {
607
+		if ( $hide_if_no_connections ) {
608 608
 
609 609
 			$connected_views = gravityview_get_connected_views( $form_id );
610 610
 
611
-			if( empty( $connected_views ) ) {
611
+			if ( empty( $connected_views ) ) {
612 612
 				$show_approve_column = false;
613 613
 			}
614 614
 		}
@@ -618,18 +618,18 @@  discard block
 block discarded – undo
618 618
 		 * @param boolean $show_approve_column Whether the column will be shown
619 619
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
620 620
 		 */
621
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
621
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
622 622
 
623 623
 		return $show_approve_column;
624 624
 	}
625 625
 
626 626
 	function register_gform_noconflict_script( $scripts ) {
627
-		$scripts[] = 'gravityview_gf_entries_scripts';
627
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
628 628
 		return $scripts;
629 629
 	}
630 630
 
631 631
 	function register_gform_noconflict_style( $styles ) {
632
-		$styles[] = 'gravityview_entries_list';
632
+		$styles[ ] = 'gravityview_entries_list';
633 633
 		return $styles;
634 634
 	}
635 635
 
Please login to merge, or discard this patch.
future/includes/class-gv-extension.php 1 patch
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
 
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 			$this->_path,
307 307
 			array(
308 308
             	'version'	=> $this->_version, // current version number
309
-            	'license'	=> \GV\Utils::get( $license, 'license_key', $license['license'] ),
309
+            	'license'	=> \GV\Utils::get( $license, 'license_key', $license[ 'license' ] ),
310 310
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
311
-            	'item_name' => $this->_title,  // name of this plugin
311
+            	'item_name' => $this->_title, // name of this plugin
312 312
             	'author' 	=> strip_tags( $this->_author )  // author of this plugin
313 313
           	)
314 314
         );
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	public static function add_notice( $notice = array() ) {
339 339
 
340
-		if ( is_array( $notice ) && empty( $notice['message'] ) ) {
340
+		if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) {
341 341
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
342 342
 			return;
343 343
 		} else if ( is_string( $notice ) ) {
344 344
 			$notice = array( 'message' => $notice );
345 345
 		}
346 346
 
347
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
347
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
348 348
 
349
-		self::$admin_notices []= $notice;
349
+		self::$admin_notices [ ] = $notice;
350 350
 	}
351 351
 
352 352
 	/**
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 		}
361 361
 
362 362
 		foreach ( self::$admin_notices as $key => $notice ) {
363
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
364
-			echo wpautop( $notice['message'] );
363
+			echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">';
364
+			echo wpautop( $notice[ 'message' ] );
365 365
 			echo '<div class="clear"></div>';
366 366
 			echo '</div>';
367 367
 		}
Please login to merge, or discard this patch.