Completed
Push — develop ( 578953...555ad7 )
by Zack
26:20 queued 13:08
created
includes/fields/class-gravityview-field-list.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function remove_columns_from_searchable_fields( $fields ) {
61 61
 
62 62
 		foreach ( $fields as $key => $field ) {
63
-			if ( isset( $field['parent'] ) && $field['parent'] instanceof \GF_Field_List ) {
63
+			if ( isset( $field[ 'parent' ] ) && $field[ 'parent' ] instanceof \GF_Field_List ) {
64 64
 				unset( $fields[ $key ] );
65 65
 			}
66 66
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		// Add the list columns
87 87
 		foreach ( $list_fields as $list_field ) {
88 88
 
89
-			if( empty( $list_field->enableColumns ) ) {
89
+			if ( empty( $list_field->enableColumns ) ) {
90 90
 				continue;
91 91
 			}
92 92
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			}
108 108
 
109 109
 			// If there are columns, add them under the parent field
110
-			if( ! empty( $list_columns ) ) {
110
+			if ( ! empty( $list_columns ) ) {
111 111
 
112 112
 				$index = array_search( $list_field->id, array_keys( $fields ) ) + 1;
113 113
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 				 * Merge the $list_columns into the $fields array at $index
116 116
 				 * @see https://stackoverflow.com/a/1783125
117 117
 				 */
118
-				$fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true);
118
+				$fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true );
119 119
 			}
120 120
 
121 121
 			unset( $list_columns, $index, $input_id );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
 		$list_rows = maybe_unserialize( $field_value );
144 144
 
145
-		if( ! is_array( $list_rows ) ) {
145
+		if ( ! is_array( $list_rows ) ) {
146 146
 			gravityview()->log->error( '$field_value did not unserialize', array( 'data' => $field_value ) );
147 147
 			return null;
148 148
 		}
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 		// Each list row
153 153
 		foreach ( $list_rows as $list_row ) {
154 154
 			$current_column = 0;
155
-			foreach ( (array) $list_row as $column_key => $column_value ) {
155
+			foreach ( (array)$list_row as $column_key => $column_value ) {
156 156
 
157 157
 				// If the label of the column matches $column_id, or the numeric key value matches, add the value
158
-				if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
159
-					$column_values[] = $column_value;
158
+				if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
159
+					$column_values[ ] = $column_value;
160 160
 				}
161 161
 				$current_column++;
162 162
 			}
163 163
 		}
164 164
 
165 165
 		// Return the array of values
166
-		if( 'raw' === $format ) {
166
+		if ( 'raw' === $format ) {
167 167
 			return $column_values;
168 168
 		}
169 169
 		// Return the Gravity Forms Field output
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function _filter_field_label( $label, $field, $form, $entry ) {
188 188
 
189
-		$field_object = RGFormsModel::get_field( $form, $field['id'] );
189
+		$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
190 190
 
191 191
 		// Not a list field
192
-		if( ! $field_object || 'list' !== $field_object->type ) {
192
+		if ( ! $field_object || 'list' !== $field_object->type ) {
193 193
 			return $label;
194 194
 		}
195 195
 
196 196
 		// Custom label is defined, so use it
197
-		if( ! empty( $field['custom_label'] ) ) {
197
+		if ( ! empty( $field[ 'custom_label' ] ) ) {
198 198
 			return $label;
199 199
 		}
200 200
 
201
-		$column_id = gravityview_get_input_id_from_id( $field['id'] );
201
+		$column_id = gravityview_get_input_id_from_id( $field[ 'id' ] );
202 202
 
203 203
 		// Parent field, not column field
204
-		if( false === $column_id ) {
204
+		if ( false === $column_id ) {
205 205
 			return $label;
206 206
 		}
207 207
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) {
223 223
 
224 224
 		// Doesn't have columns enabled
225
-		if( ! isset( $field->choices ) || ! $field->enableColumns ) {
225
+		if ( ! isset( $field->choices ) || ! $field->enableColumns ) {
226 226
 			return $backup_label;
227 227
 		}
228 228
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-workflow_final_status.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) {
43 43
 
44
-		if( ! empty( $output ) ) {
44
+		if ( ! empty( $output ) ) {
45 45
 			$output = gravity_flow()->translate_status_label( $output );
46 46
 		}
47 47
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 		foreach ( $search_fields as & $search_field ) {
66 66
 			if ( $this->name === \GV\Utils::get( $search_field, 'key' ) ) {
67
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
67
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
68 68
 			}
69 69
 		}
70 70
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     static function getInstance() {
57 57
 
58
-        if( empty( self::$instance ) ) {
58
+        if ( empty( self::$instance ) ) {
59 59
             self::$instance = new GravityView_Edit_Entry;
60 60
         }
61 61
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
     private function add_hooks() {
82 82
 
83 83
         // Add front-end access to Gravity Forms delete file action
84
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
84
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
85 85
 
86 86
         // Make sure this hook is run for non-admins
87
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
87
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
88 88
 
89 89
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90 90
 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	private function addon_specific_hooks() {
101 101
 
102
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
103
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
102
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
103
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
104 104
 		}
105 105
 
106 106
 	}
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
148 148
 
149
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
149
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
150 150
 
151
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
151
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
152 152
 
153 153
         $url = add_query_arg( array(
154 154
             'edit' => wp_create_nonce( $nonce_key )
155 155
         ), $base );
156 156
 
157
-        if( $post_id ) {
157
+        if ( $post_id ) {
158 158
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
159 159
         }
160 160
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	     * Allow passing params to dynamically populate entry with values
163 163
 	     * @since 1.9.2
164 164
 	     */
165
-	    if( !empty( $field_values ) ) {
165
+	    if ( ! empty( $field_values ) ) {
166 166
 
167
-		    if( is_array( $field_values ) ) {
167
+		    if ( is_array( $field_values ) ) {
168 168
 			    // If already an array, no parse_str() needed
169 169
 			    $params = $field_values;
170 170
 		    } else {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
187 187
 
188
-		if( empty( $context ) || $context !== 'edit' ) {
188
+		if ( empty( $context ) || $context !== 'edit' ) {
189 189
 			return $fields;
190 190
 		}
191 191
 
@@ -246,25 +246,25 @@  discard block
 block discarded – undo
246 246
         // If they can edit any entries (as defined in Gravity Forms)
247 247
         // Or if they can edit other people's entries
248 248
         // Then we're good.
249
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
249
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
250 250
 
251 251
             gravityview()->log->debug( 'User has ability to edit all entries.' );
252 252
 
253 253
             $user_can_edit = true;
254 254
 
255
-        } else if( !isset( $entry['created_by'] ) ) {
255
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
256 256
 
257
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
257
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
258 258
 
259 259
             $user_can_edit = false;
260 260
 
261 261
         } else {
262 262
 
263 263
             // get user_edit setting
264
-            if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
264
+            if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
265 265
                 // if View ID not specified or is the current view
266 266
 				// @deprecated path
267
-                $user_edit = GravityView_View::getInstance()->getAtts('user_edit');
267
+                $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' );
268 268
             } else {
269 269
                 // in case is specified and not the current view
270 270
                 $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             $current_user = wp_get_current_user();
274 274
 
275 275
             // User edit is disabled
276
-            if( empty( $user_edit ) ) {
276
+            if ( empty( $user_edit ) ) {
277 277
 
278 278
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
279 279
 
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
             }
282 282
 
283 283
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
284
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
284
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
285 285
 
286 286
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
287 287
 
288 288
                 $user_can_edit = true;
289 289
 
290
-            } else if( ! is_user_logged_in() ) {
290
+            } else if ( ! is_user_logged_in() ) {
291 291
 
292 292
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
293 293
             }
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/view-configuration.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,32 +10,32 @@  discard block
 block discarded – undo
10 10
 
11 11
 		<div id="directory-fields" class="gv-section">
12 12
 
13
-			<h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4>
13
+			<h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview' ); ?></span></h4>
14 14
 
15
-			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
15
+			<?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
16 16
 
17
-			<h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4>
17
+			<h4><?php esc_html_e( 'Entries Fields', 'gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview' ); ?></span></h4>
18 18
 
19 19
 			<div id="directory-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
20
-				<?php if(!empty( $curr_template ) ) {
21
-					do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
20
+				<?php if ( ! empty( $curr_template ) ) {
21
+					do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
22 22
 				} ?>
23 23
 			</div>
24 24
 
25
-			<h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4>
25
+			<h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview' ); ?></span></h4>
26 26
 
27 27
 			<?php
28 28
 
29
-                do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
29
+                do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
30 30
 
31
-    			do_action('gravityview_render_field_pickers', 'directory' );
31
+    			do_action( 'gravityview_render_field_pickers', 'directory' );
32 32
 
33 33
             ?>
34 34
 
35 35
 			<?php // list of available widgets to be shown in the popup ?>
36 36
             <div id="directory-available-widgets" class="hide-if-js gv-tooltip">
37 37
                 <span class="close"><i class="dashicons dashicons-dismiss"></i></span>
38
-				<?php do_action('gravityview_render_available_widgets' ); ?>
38
+				<?php do_action( 'gravityview_render_available_widgets' ); ?>
39 39
             </div>
40 40
 
41 41
 		</div>
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 
52 52
 		<div id="single-fields" class="gv-section">
53 53
 
54
-			<h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4>
54
+			<h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview' ); ?></h4>
55 55
 
56 56
 			<div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
57 57
 				<?php
58
-                if(!empty( $curr_template ) ) {
59
-				    do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
58
+                if ( ! empty( $curr_template ) ) {
59
+				    do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
60 60
                 }
61 61
 			    ?>
62 62
 			</div>
63 63
             <?php
64
-                do_action('gravityview_render_field_pickers', 'single' );
64
+                do_action( 'gravityview_render_field_pickers', 'single' );
65 65
 			?>
66 66
 		</div>
67 67
 
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 
72 72
 		<div id="edit-fields" class="gv-section">
73 73
 
74
-			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4>
74
+			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gravityview' ); ?></span></h4>
75 75
 
76 76
 			<div id="edit-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
77 77
 				<?php
78
-				do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
78
+				do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
79 79
 				?>
80 80
 			</div>
81 81
 
82 82
 			<?php
83
-			    do_action('gravityview_render_field_pickers', 'edit' );
83
+			    do_action( 'gravityview_render_field_pickers', 'edit' );
84 84
 			?>
85 85
 
86 86
 		</div>
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.