Completed
Push — master ( ebef7a...94d09a )
by Zack
20:55 queued 16:56
created
includes/fields/class-gravityview-field-post-category.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 	var $name = 'post_category';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Post_Category';
15 15
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$entry = GFAPI::get_entry( $entry_id );
43 43
 		$post_id = rgar( $entry, 'post_id' );
44 44
 
45
-		if( empty( $post_id ) ) {
45
+		if ( empty( $post_id ) ) {
46 46
 			return false;
47 47
 		}
48 48
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 		$post_category_fields = GFAPI::get_fields_by_type( $form, 'post_category' );
52 52
 
53
-		if( $post_category_fields ) {
53
+		if ( $post_category_fields ) {
54 54
 
55 55
 			$updated_categories = array();
56 56
 
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return mixed
119 119
 	 */
120
-	function edit_entry_post_category_choices( $choices, $field, $form_id  ) {
120
+	function edit_entry_post_category_choices( $choices, $field, $form_id ) {
121 121
 
122
-		$entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry();
122
+		$entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry();
123 123
 
124 124
 		// $entry['post_id'] should always be set, but we check to make sure.
125
-		if( $entry && isset( $entry['post_id'] ) && $post_id = $entry['post_id'] ) {
125
+		if ( $entry && isset( $entry[ 'post_id' ] ) && $post_id = $entry[ 'post_id' ] ) {
126 126
 
127 127
 			$post_categories = wp_get_post_categories( $post_id, array( 'fields' => 'ids' ) );
128 128
 
129 129
 			// Always use the live value
130 130
 			foreach ( $choices as &$choice ) {
131
-				$choice['isSelected'] = in_array( $choice['value'], array_values( $post_categories ) );
131
+				$choice[ 'isSelected' ] = in_array( $choice[ 'value' ], array_values( $post_categories ) );
132 132
 			}
133 133
 		}
134 134
 
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 
138 138
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
139 139
 
140
-		if( 'edit' === $context ) {
140
+		if ( 'edit' === $context ) {
141 141
 			return $field_options;
142 142
 		}
143 143
 
144
-		$this->add_field_support('dynamic_data', $field_options );
145
-		$this->add_field_support('link_to_term', $field_options );
144
+		$this->add_field_support( 'dynamic_data', $field_options );
145
+		$this->add_field_support( 'link_to_term', $field_options );
146 146
 
147 147
 		return $field_options;
148 148
 	}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
     function load() {
113 113
 
114 114
         /** @define "GRAVITYVIEW_DIR" "../../../" */
115
-        include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
115
+        include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
116 116
 
117 117
         // Don't display an embedded form when editing an entry
118 118
         add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
119 119
         add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
120 120
 
121 121
         // Stop Gravity Forms processing what is ours!
122
-        add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
122
+        add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
123 123
 
124
-        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
124
+        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
125 125
 
126 126
         add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
127 127
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
133 133
 
134 134
         // Add fields expected by GFFormDisplay::validate()
135
-        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
135
+        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
136 136
 
137 137
     }
138 138
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
      * @return void
148 148
      */
149 149
     function prevent_render_form() {
150
-        if( $this->is_edit_entry() ) {
151
-            if( 'wp_head' === current_filter() ) {
150
+        if ( $this->is_edit_entry() ) {
151
+            if ( 'wp_head' === current_filter() ) {
152 152
                 add_filter( 'gform_shortcode_form', '__return_empty_string' );
153 153
             } else {
154 154
                 remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
      */
164 164
     function prevent_maybe_process_form() {
165 165
 
166
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
166
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
167 167
 
168
-        if( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
169
-            remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
168
+        if ( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
169
+            remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
170 170
         }
171 171
     }
172 172
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function is_edit_entry() {
178 178
 
179
-        $gf_page = function_exists('rgpost') && ( 'entry' === rgget( 'view' ) && isset( $_GET['edit'] ) || rgpost( 'action' ) === 'update' );
179
+        $gf_page = function_exists( 'rgpost' ) && ( 'entry' === rgget( 'view' ) && isset( $_GET[ 'edit' ] ) || rgpost( 'action' ) === 'update' );
180 180
 
181 181
         return $gf_page;
182 182
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @return boolean
188 188
 	 */
189 189
 	public function is_edit_entry_submission() {
190
-		return !empty( $_POST[ self::$nonce_field ] );
190
+		return ! empty( $_POST[ self::$nonce_field ] );
191 191
 	}
192 192
 
193 193
     /**
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 
199 199
 
200 200
         $entries = $gravityview_view->getEntries();
201
-        $this->entry = $entries[0];
201
+        $this->entry = $entries[ 0 ];
202 202
 
203 203
         $this->original_form = $this->form = $gravityview_view->getForm();
204 204
         $this->form_id = $gravityview_view->getFormId();
205 205
         $this->view_id = $gravityview_view->getViewId();
206 206
 
207
-        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
207
+        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
208 208
     }
209 209
 
210 210
 
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
         $this->setup_vars();
225 225
 
226 226
         // Multiple Views embedded, don't proceed if nonce fails
227
-        if( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
227
+        if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
228 228
             return;
229 229
         }
230 230
 
231 231
         // Sorry, you're not allowed here.
232
-        if( false === $this->user_can_edit_entry( true ) ) {
232
+        if ( false === $this->user_can_edit_entry( true ) ) {
233 233
             return;
234 234
         }
235 235
 
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
     function print_scripts() {
250 250
         $gravityview_view = GravityView_View::getInstance();
251 251
 
252
-        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
252
+        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
253 253
 
254
-        GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false);
254
+        GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
255 255
 
256 256
         // Sack is required for images
257 257
         wp_print_scripts( array( 'sack', 'gform_gravityforms' ) );
@@ -263,32 +263,32 @@  discard block
 block discarded – undo
263 263
      */
264 264
     function process_save() {
265 265
 
266
-        if( empty( $_POST ) ) {
266
+        if ( empty( $_POST ) ) {
267 267
             return;
268 268
         }
269 269
 
270 270
         // Make sure the entry, view, and form IDs are all correct
271 271
         $valid = $this->verify_nonce();
272 272
 
273
-        if( !$valid ) {
274
-            do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
273
+        if ( ! $valid ) {
274
+            do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
275 275
             return;
276 276
         }
277 277
 
278
-        if( $this->entry['id'] !== $_POST['lid'] ) {
279
-            do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
278
+        if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
279
+            do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
280 280
             return;
281 281
         }
282 282
 
283
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
283
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
284 284
 
285 285
         $this->process_save_process_files( $this->form_id );
286 286
 
287 287
         $this->validate();
288 288
 
289
-        if( $this->is_valid ) {
289
+        if ( $this->is_valid ) {
290 290
 
291
-            do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
291
+            do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
292 292
 
293 293
             /**
294 294
              * @hack This step is needed to unset the adminOnly from form fields, to add the calculation fields
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
             /**
299 299
              * @hack to avoid the capability validation of the method save_lead for GF 1.9+
300 300
              */
301
-            unset( $_GET['page'] );
301
+            unset( $_GET[ 'page' ] );
302 302
 
303 303
             GFFormsModel::save_lead( $form, $this->entry );
304 304
 
305 305
             // If there's a post associated with the entry, process post fields
306
-            if( !empty( $this->entry['post_id'] ) ) {
306
+            if ( ! empty( $this->entry[ 'post_id' ] ) ) {
307 307
                 $this->maybe_update_post_fields( $form );
308 308
             }
309 309
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
              * @param array $form Gravity Forms form array
319 319
              * @param string $entry_id Numeric ID of the entry that was updated
320 320
              */
321
-            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'] );
321
+            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ] );
322 322
         }
323 323
 
324 324
     } // process_save
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
      * @return mixed
353 353
      */
354 354
     public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
355
-        if( ! $this->is_edit_entry() ) {
355
+        if ( ! $this->is_edit_entry() ) {
356 356
             return $plupload_init;
357 357
         }
358 358
 
359
-        $plupload_init['gf_vars']['max_files'] = 0;
359
+        $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
360 360
 
361 361
         return $plupload_init;
362 362
     }
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 
371 371
         $form = $this->form;
372 372
 
373
-        foreach( $form['fields'] as $k => &$field ) {
373
+        foreach ( $form[ 'fields' ] as $k => &$field ) {
374 374
 
375 375
             // Remove the fields with calculation formulas before save to avoid conflicts with GF logic
376 376
             // @since 1.16.3
377
-            if( $field->has_calculation() ) {
378
-                unset( $form['fields'][ $k ] );
377
+            if ( $field->has_calculation() ) {
378
+                unset( $form[ 'fields' ][ $k ] );
379 379
             }
380 380
 
381 381
             $field->adminOnly = false;
382 382
 
383
-            if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
384
-                foreach( $field->inputs as $key => $input ) {
385
-                    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
383
+            if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
384
+                foreach ( $field->inputs as $key => $input ) {
385
+                    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
386 386
                 }
387 387
             }
388 388
         }
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
         $update = false;
397 397
 
398 398
         // get the most up to date entry values
399
-        $entry = GFAPI::get_entry( $this->entry['id'] );
399
+        $entry = GFAPI::get_entry( $this->entry[ 'id' ] );
400 400
 
401
-        if( !empty( $this->fields_with_calculation ) ) {
401
+        if ( ! empty( $this->fields_with_calculation ) ) {
402 402
             $update = true;
403 403
             foreach ( $this->fields_with_calculation as $calc_field ) {
404 404
                 $inputs = $calc_field->get_entry_inputs();
405 405
                 if ( is_array( $inputs ) ) {
406 406
                     foreach ( $inputs as $input ) {
407
-                        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
408
-                        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
407
+                        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
408
+                        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
409 409
                     }
410 410
                 } else {
411
-                    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
412
-                    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
411
+                    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
412
+                    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
413 413
                 }
414 414
             }
415 415
 
@@ -419,16 +419,16 @@  discard block
 block discarded – undo
419 419
         if ( ! empty( $this->total_fields ) ) {
420 420
             $update = true;
421 421
             foreach ( $this->total_fields as $total_field ) {
422
-                $input_name = 'input_' . str_replace( '.', '_', $total_field->id);
423
-                $entry[ strval( $total_field->id ) ] = RGFormsModel::prepare_value( $form, $total_field, '', $input_name, $entry['id'], $entry );
422
+                $input_name = 'input_' . str_replace( '.', '_', $total_field->id );
423
+                $entry[ strval( $total_field->id ) ] = RGFormsModel::prepare_value( $form, $total_field, '', $input_name, $entry[ 'id' ], $entry );
424 424
             }
425 425
         }
426 426
 
427
-        if( $update ) {
427
+        if ( $update ) {
428 428
 
429 429
             $return_entry = GFAPI::update_entry( $entry );
430 430
 
431
-            if( is_wp_error( $return_entry ) ) {
431
+            if ( is_wp_error( $return_entry ) ) {
432 432
                 do_action( 'gravityview_log_error', 'Updating the entry calculation and total fields failed', $return_entry );
433 433
             } else {
434 434
                 do_action( 'gravityview_log_debug', 'Updating the entry calculation and total fields succeeded' );
@@ -459,18 +459,18 @@  discard block
 block discarded – undo
459 459
 
460 460
         $input_name = 'input_' . $field_id;
461 461
 
462
-        if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
462
+        if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
463 463
 
464 464
             // We have a new image
465 465
 
466
-            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
466
+            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
467 467
 
468 468
             $ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
469 469
             $img_url = rgar( $ary, 0 );
470 470
 
471
-            $img_title       = count( $ary ) > 1 ? $ary[1] : '';
472
-            $img_caption     = count( $ary ) > 2 ? $ary[2] : '';
473
-            $img_description = count( $ary ) > 3 ? $ary[3] : '';
471
+            $img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
472
+            $img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
473
+            $img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
474 474
 
475 475
             $image_meta = array(
476 476
                 'post_excerpt' => $img_caption,
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
             //adding title only if it is not empty. It will default to the file name if it is not in the array
481 481
             if ( ! empty( $img_title ) ) {
482
-                $image_meta['post_title'] = $img_title;
482
+                $image_meta[ 'post_title' ] = $img_title;
483 483
             }
484 484
 
485 485
             /**
@@ -494,22 +494,22 @@  discard block
 block discarded – undo
494 494
                 set_post_thumbnail( $post_id, $media_id );
495 495
             }
496 496
 
497
-        } elseif ( !empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
497
+        } elseif ( ! empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
498 498
 
499 499
             // Same image although the image title, caption or description might have changed
500 500
 
501 501
             $ary = array();
502
-            if( ! empty( $entry[ $field_id ] ) ) {
502
+            if ( ! empty( $entry[ $field_id ] ) ) {
503 503
                 $ary = is_array( $entry[ $field_id ] ) ? $entry[ $field_id ] : explode( '|:|', $entry[ $field_id ] );
504 504
             }
505 505
             $img_url = rgar( $ary, 0 );
506 506
 
507 507
             // is this really the same image or something went wrong ?
508
-            if( $img_url === $_POST[ $input_name ] ) {
508
+            if ( $img_url === $_POST[ $input_name ] ) {
509 509
 
510
-                $img_title       = rgar( $value, $field_id .'.1' );
511
-                $img_caption     = rgar( $value, $field_id .'.4' );
512
-                $img_description = rgar( $value, $field_id .'.7' );
510
+                $img_title       = rgar( $value, $field_id . '.1' );
511
+                $img_caption     = rgar( $value, $field_id . '.4' );
512
+                $img_description = rgar( $value, $field_id . '.7' );
513 513
 
514 514
                 $value = ! empty( $img_url ) ? $img_url . "|:|" . $img_title . "|:|" . $img_caption . "|:|" . $img_description : '';
515 515
 
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
      */
550 550
     private function maybe_update_post_fields( $form ) {
551 551
 
552
-        $post_id = $this->entry['post_id'];
552
+        $post_id = $this->entry[ 'post_id' ];
553 553
 
554 554
         // Security check
555
-        if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
556
-            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id );
555
+        if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
556
+            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id );
557 557
             return;
558 558
         }
559 559
 
@@ -565,25 +565,25 @@  discard block
 block discarded – undo
565 565
 
566 566
             $field = RGFormsModel::get_field( $form, $field_id );
567 567
 
568
-            if( ! $field ) {
568
+            if ( ! $field ) {
569 569
                 continue;
570 570
             }
571 571
 
572
-            if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
572
+            if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
573 573
 
574 574
                 // Get the value of the field, including $_POSTed value
575 575
                 $value = RGFormsModel::get_field_value( $field );
576 576
 
577 577
                 // Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
578 578
                 $entry_tmp = $this->entry;
579
-                $entry_tmp["{$field_id}"] = $value;
579
+                $entry_tmp[ "{$field_id}" ] = $value;
580 580
 
581
-                switch( $field->type ) {
581
+                switch ( $field->type ) {
582 582
 
583 583
                     case 'post_title':
584 584
                         $post_title = $value;
585
-                        if( rgar( $form, 'postTitleTemplateEnabled' ) ) {
586
-                            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
585
+                        if ( rgar( $form, 'postTitleTemplateEnabled' ) ) {
586
+                            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
587 587
                         }
588 588
                         $updated_post->post_title = $post_title;
589 589
                         $updated_post->post_name  = $post_title;
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
 
593 593
                     case 'post_content':
594 594
                         $post_content = $value;
595
-                        if( rgar( $form, 'postContentTemplateEnabled' ) ) {
596
-                            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
595
+                        if ( rgar( $form, 'postContentTemplateEnabled' ) ) {
596
+                            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
597 597
                         }
598 598
                         $updated_post->post_content = $post_content;
599 599
                         unset( $post_content );
@@ -607,19 +607,19 @@  discard block
 block discarded – undo
607 607
                     case 'post_category':
608 608
                         break;
609 609
                     case 'post_custom_field':
610
-                        if( ! empty( $field->customFieldTemplateEnabled ) ) {
610
+                        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
611 611
                             $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
612 612
                         }
613 613
 
614 614
                         $input_type = RGFormsModel::get_input_type( $field );
615 615
 
616 616
                         // Only certain custom field types are supported
617
-                        switch( $input_type ) {
617
+                        switch ( $input_type ) {
618 618
                             case 'fileupload':
619 619
                             case 'list':
620 620
                             case 'multiselect':
621
-                                if( ! is_string( $value ) ) {
622
-                                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
621
+                                if ( ! is_string( $value ) ) {
622
+                                    $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value );
623 623
                                 }
624 624
                             // break; left intentionally out
625 625
                             default:
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
                 }
636 636
 
637 637
                 // update entry after
638
-                $this->entry["{$field_id}"] = $value;
638
+                $this->entry[ "{$field_id}" ] = $value;
639 639
 
640 640
                 $update_entry = true;
641 641
 
@@ -644,25 +644,25 @@  discard block
 block discarded – undo
644 644
 
645 645
         }
646 646
 
647
-        if( $update_entry ) {
647
+        if ( $update_entry ) {
648 648
 
649 649
             $return_entry = GFAPI::update_entry( $this->entry );
650 650
 
651
-            if( is_wp_error( $return_entry ) ) {
651
+            if ( is_wp_error( $return_entry ) ) {
652 652
                do_action( 'gravityview_log_error', 'Updating the entry post fields failed', array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) );
653 653
             } else {
654
-                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' );
654
+                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' );
655 655
             }
656 656
 
657 657
         }
658 658
 
659 659
         $return_post = wp_update_post( $updated_post, true );
660 660
 
661
-        if( is_wp_error( $return_post ) ) {
661
+        if ( is_wp_error( $return_post ) ) {
662 662
             $return_post->add_data( $updated_post, '$updated_post' );
663 663
             do_action( 'gravityview_log_error', 'Updating the post content failed', compact( 'updated_post', 'return_post' ) );
664 664
         } else {
665
-            do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded', $updated_post );
665
+            do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded', $updated_post );
666 666
         }
667 667
     }
668 668
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
         $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
693 693
 
694 694
         // replace conditional shortcodes
695
-        if( $do_shortcode ) {
695
+        if ( $do_shortcode ) {
696 696
             $output = do_shortcode( $output );
697 697
         }
698 698
 
@@ -711,18 +711,18 @@  discard block
 block discarded – undo
711 711
      */
712 712
     function after_update() {
713 713
 
714
-        do_action( 'gform_after_update_entry', $this->form, $this->entry['id'] );
715
-        do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'] );
714
+        do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ] );
715
+        do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ] );
716 716
 
717 717
         // Re-define the entry now that we've updated it.
718
-        $entry = RGFormsModel::get_lead( $this->entry['id'] );
718
+        $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
719 719
 
720 720
         $entry = GFFormsModel::set_entry_meta( $entry, $this->form );
721 721
 
722 722
         // We need to clear the cache because Gravity Forms caches the field values, which
723 723
         // we have just updated.
724
-        foreach ($this->form['fields'] as $key => $field) {
725
-            GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
724
+        foreach ( $this->form[ 'fields' ] as $key => $field ) {
725
+            GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
726 726
         }
727 727
 
728 728
         $this->entry = $entry;
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
         <div class="gv-edit-entry-wrapper"><?php
742 742
 
743
-            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
743
+            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
744 744
 
745 745
             /**
746 746
              * Fixes weird wpautop() issue
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
                      * @param string $edit_entry_title Modify the "Edit Entry" title
757 757
                      * @param GravityView_Edit_Entry_Render $this This object
758 758
                      */
759
-                    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
759
+                    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
760 760
 
761 761
                     echo esc_attr( $edit_entry_title );
762 762
             ?></span>
@@ -796,20 +796,20 @@  discard block
 block discarded – undo
796 796
      */
797 797
     private function maybe_print_message() {
798 798
 
799
-        if( rgpost('action') === 'update' ) {
799
+        if ( rgpost( 'action' ) === 'update' ) {
800 800
 
801 801
             $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
802 802
 
803
-            if( ! $this->is_valid ){
803
+            if ( ! $this->is_valid ) {
804 804
 
805 805
                 // Keeping this compatible with Gravity Forms.
806
-                $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
807
-                $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
806
+                $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
807
+                $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
808 808
 
809
-                echo GVCommon::generate_notice( $message , 'gv-error' );
809
+                echo GVCommon::generate_notice( $message, 'gv-error' );
810 810
 
811 811
             } else {
812
-                $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
812
+                $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
813 813
 
814 814
                 /**
815 815
                  * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
                  * @param array $entry Gravity Forms entry array
820 820
                  * @param string $back_link URL to return to the original entry. @since 1.6
821 821
                  */
822
-                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
822
+                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
823 823
 
824 824
                 echo GVCommon::generate_notice( $message );
825 825
             }
@@ -843,24 +843,24 @@  discard block
 block discarded – undo
843 843
          */
844 844
         do_action( 'gravityview/edit-entry/render/before', $this );
845 845
 
846
-        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
847
-        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
846
+        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
847
+        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
848 848
         add_filter( 'gform_disable_view_counter', '__return_true' );
849 849
 
850 850
         add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
851 851
         add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
852 852
 
853
-        add_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value'), 10, 3 );
853
+        add_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value' ), 10, 3 );
854 854
 
855 855
         // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
856
-        unset( $_GET['page'] );
856
+        unset( $_GET[ 'page' ] );
857 857
 
858 858
         // TODO: Verify multiple-page forms
859 859
         // TODO: Product fields are not editable
860 860
 
861
-        $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
861
+        $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
862 862
 
863
-        remove_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value'), 10 );
863
+        remove_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value' ), 10 );
864 864
 	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
865 865
         remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
866 866
         remove_filter( 'gform_disable_view_counter', '__return_true' );
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
      */
892 892
     function fix_survey_fields_value( $value, $field, $name ) {
893 893
         
894
-        if( 'survey' === $field->type ) {
894
+        if ( 'survey' === $field->type ) {
895 895
 
896 896
 	        // We need to run through each survey row until we find a match for expected values
897 897
 	        foreach ( $this->entry as $field_id => $field_value ) {
@@ -900,11 +900,11 @@  discard block
 block discarded – undo
900 900
 			        continue;
901 901
 		        }
902 902
 
903
-		        if( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) {
903
+		        if ( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) {
904 904
 			        list( $row_val, $col_val ) = explode( ':', $field_value, 2 );
905 905
 
906 906
 		            // If the $name matches the $row_val, we are processing the correct row
907
-			        if( $row_val === $name ) {
907
+			        if ( $row_val === $name ) {
908 908
 				        $value = $field_value;
909 909
 				        break;
910 910
 			        }
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
      * @return string
926 926
      */
927 927
     public function render_form_buttons() {
928
-        return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
928
+        return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
929 929
     }
930 930
 
931 931
 
@@ -945,17 +945,17 @@  discard block
 block discarded – undo
945 945
     public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
946 946
 
947 947
         // In case we have validated the form, use it to inject the validation results into the form render
948
-        if( isset( $this->form_after_validation ) ) {
948
+        if ( isset( $this->form_after_validation ) ) {
949 949
             $form = $this->form_after_validation;
950 950
         } else {
951
-            $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
951
+            $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
952 952
         }
953 953
 
954 954
         $form = $this->filter_conditional_logic( $form );
955 955
 
956 956
         // for now we don't support Save and Continue feature.
957
-        if( ! self::$supports_save_and_continue ) {
958
-	        unset( $form['save'] );
957
+        if ( ! self::$supports_save_and_continue ) {
958
+	        unset( $form[ 'save' ] );
959 959
         }
960 960
 
961 961
         return $form;
@@ -976,29 +976,29 @@  discard block
 block discarded – undo
976 976
      */
977 977
     function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
978 978
 
979
-        if( GFCommon::is_post_field( $field ) ) {
979
+        if ( GFCommon::is_post_field( $field ) ) {
980 980
 
981 981
             $message = null;
982 982
 
983 983
             // First, make sure they have the capability to edit the post.
984
-            if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
984
+            if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
985 985
 
986 986
                 /**
987 987
                  * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
988 988
                  * @param string $message The existing "You don't have permission..." text
989 989
                  */
990
-                $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
990
+                $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
991 991
 
992
-            } elseif( null === get_post( $this->entry['post_id'] ) ) {
992
+            } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
993 993
                 /**
994 994
                  * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
995 995
                  * @param string $message The existing "This field is not editable; the post no longer exists." text
996 996
                  */
997
-                $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
997
+                $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
998 998
             }
999 999
 
1000
-            if( $message ) {
1001
-                $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1000
+            if ( $message ) {
1001
+                $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1002 1002
             }
1003 1003
         }
1004 1004
 
@@ -1023,8 +1023,8 @@  discard block
 block discarded – undo
1023 1023
 
1024 1024
         // If the form has been submitted, then we don't need to pre-fill the values,
1025 1025
         // Except for fileupload type and when a field input is overridden- run always!!
1026
-        if(
1027
-            ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1026
+        if (
1027
+            ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1028 1028
             && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1029 1029
             || ! empty( $field_content )
1030 1030
             || GFCommon::is_product_field( $field->type ) // Prevent product fields from appearing editable
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
         }
1034 1034
 
1035 1035
         // Turn on Admin-style display for file upload fields only
1036
-        if( 'fileupload' === $field->type ) {
1037
-            $_GET['page'] = 'gf_entries';
1036
+        if ( 'fileupload' === $field->type ) {
1037
+            $_GET[ 'page' ] = 'gf_entries';
1038 1038
         }
1039 1039
 
1040 1040
         // SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1061,12 +1061,12 @@  discard block
 block discarded – undo
1061 1061
          * @param mixed $field_value field value used to populate the input
1062 1062
          * @param GF_Field $field Gravity Forms field object
1063 1063
          */
1064
-        $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field );
1064
+        $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field );
1065 1065
 
1066 1066
 	    // Prevent any PHP warnings, like undefined index
1067 1067
 	    ob_start();
1068 1068
 
1069
-        if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1069
+        if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1070 1070
             /** @var GF_Field $gv_field */
1071 1071
             $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1072 1072
         } else {
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 	    // If there was output, it's an error
1078 1078
 	    $warnings = ob_get_clean();
1079 1079
 
1080
-	    if( !empty( $warnings ) ) {
1080
+	    if ( ! empty( $warnings ) ) {
1081 1081
 		    do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value );
1082 1082
 	    }
1083 1083
 
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
          * We need the fileupload html field to render with the proper id
1087 1087
          *  ( <li id="field_80_16" ... > )
1088 1088
          */
1089
-        unset( $_GET['page'] );
1089
+        unset( $_GET[ 'page' ] );
1090 1090
 
1091 1091
         return $return;
1092 1092
     }
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
         $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1110 1110
 
1111 1111
         // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1112
-        if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1112
+        if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1113 1113
 
1114 1114
             $field_value = array();
1115 1115
 
@@ -1118,10 +1118,10 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
             foreach ( (array)$field->inputs as $input ) {
1120 1120
 
1121
-                $input_id = strval( $input['id'] );
1121
+                $input_id = strval( $input[ 'id' ] );
1122 1122
                 
1123 1123
                 if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1124
-                    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1124
+                    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1125 1125
                     $allow_pre_populated = false;
1126 1126
                 }
1127 1127
 
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
             $pre_value = $field->get_value_submission( array(), false );
1131 1131
 
1132
-            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1132
+            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1133 1133
 
1134 1134
         } else {
1135 1135
 
@@ -1140,13 +1140,13 @@  discard block
 block discarded – undo
1140 1140
 
1141 1141
             // saved field entry value (if empty, fallback to the pre-populated value, if exists)
1142 1142
             // or pre-populated value if not empty and set to override saved value
1143
-            $field_value = !gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1143
+            $field_value = ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1144 1144
 
1145 1145
             // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1146
-            if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1146
+            if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1147 1147
                 $categories = array();
1148 1148
                 foreach ( explode( ',', $field_value ) as $cat_string ) {
1149
-                    $categories[] = GFCommon::format_post_category( $cat_string, true );
1149
+                    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1150 1150
                 }
1151 1151
                 $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1152 1152
             }
@@ -1171,12 +1171,12 @@  discard block
 block discarded – undo
1171 1171
      */
1172 1172
     function gform_pre_validation( $form ) {
1173 1173
 
1174
-        if( ! $this->verify_nonce() ) {
1174
+        if ( ! $this->verify_nonce() ) {
1175 1175
             return $form;
1176 1176
         }
1177 1177
 
1178 1178
         // Fix PHP warning regarding undefined index.
1179
-        foreach ( $form['fields'] as &$field) {
1179
+        foreach ( $form[ 'fields' ] as &$field ) {
1180 1180
 
1181 1181
             // This is because we're doing admin form pretending to be front-end, so Gravity Forms
1182 1182
             // expects certain field array items to be set.
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
                 $field['emailConfirmEnabled'] = '';
1190 1190
             }*/
1191 1191
 
1192
-            switch( RGFormsModel::get_input_type( $field ) ) {
1192
+            switch ( RGFormsModel::get_input_type( $field ) ) {
1193 1193
 
1194 1194
                 /**
1195 1195
                  * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend.
@@ -1203,37 +1203,37 @@  discard block
 block discarded – undo
1203 1203
                     // Set the previous value
1204 1204
                     $entry = $this->get_entry();
1205 1205
 
1206
-                    $input_name = 'input_'.$field->id;
1207
-                    $form_id = $form['id'];
1206
+                    $input_name = 'input_' . $field->id;
1207
+                    $form_id = $form[ 'id' ];
1208 1208
 
1209 1209
                     $value = NULL;
1210 1210
 
1211 1211
                     // Use the previous entry value as the default.
1212
-                    if( isset( $entry[ $field->id ] ) ) {
1212
+                    if ( isset( $entry[ $field->id ] ) ) {
1213 1213
                         $value = $entry[ $field->id ];
1214 1214
                     }
1215 1215
 
1216 1216
                     // If this is a single upload file
1217
-                    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1218
-                        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1219
-                        $value = $file_path['url'];
1217
+                    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1218
+                        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1219
+                        $value = $file_path[ 'url' ];
1220 1220
 
1221 1221
                     } else {
1222 1222
 
1223 1223
                         // Fix PHP warning on line 1498 of form_display.php for post_image fields
1224 1224
                         // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1225
-                        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1225
+                        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1226 1226
 
1227 1227
                     }
1228 1228
 
1229
-                    if( rgar($field, "multipleFiles") ) {
1229
+                    if ( rgar( $field, "multipleFiles" ) ) {
1230 1230
 
1231 1231
                         // If there are fresh uploads, process and merge them.
1232 1232
                         // Otherwise, use the passed values, which should be json-encoded array of URLs
1233
-                        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1233
+                        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1234 1234
                             $value = empty( $value ) ? '[]' : $value;
1235 1235
                             $value = stripslashes_deep( $value );
1236
-                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1236
+                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1237 1237
                         }
1238 1238
 
1239 1239
                     } else {
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
 
1252 1252
                 case 'number':
1253 1253
                     // Fix "undefined index" issue at line 1286 in form_display.php
1254
-                    if( !isset( $_POST['input_'.$field->id ] ) ) {
1255
-                        $_POST['input_'.$field->id ] = NULL;
1254
+                    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1255
+                        $_POST[ 'input_' . $field->id ] = NULL;
1256 1256
                     }
1257 1257
                     break;
1258 1258
                 case 'captcha':
1259 1259
                     // Fix issue with recaptcha_check_answer() on line 1458 in form_display.php
1260
-                    $_POST['recaptcha_challenge_field'] = NULL;
1261
-                    $_POST['recaptcha_response_field'] = NULL;
1260
+                    $_POST[ 'recaptcha_challenge_field' ] = NULL;
1261
+                    $_POST[ 'recaptcha_response_field' ] = NULL;
1262 1262
                     break;
1263 1263
             }
1264 1264
 
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
          * You can enter whatever you want!
1295 1295
          * We try validating, and customize the results using `self::custom_validation()`
1296 1296
          */
1297
-        add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1297
+        add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1298 1298
 
1299 1299
         // Needed by the validate funtion
1300 1300
         $failed_validation_page = NULL;
@@ -1302,14 +1302,14 @@  discard block
 block discarded – undo
1302 1302
 
1303 1303
         // Prevent entry limit from running when editing an entry, also
1304 1304
         // prevent form scheduling from preventing editing
1305
-        unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1305
+        unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1306 1306
 
1307 1307
         // Hide fields depending on Edit Entry settings
1308
-        $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1308
+        $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1309 1309
 
1310 1310
         $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1311 1311
 
1312
-        remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1312
+        remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1313 1313
     }
1314 1314
 
1315 1315
 
@@ -1326,13 +1326,13 @@  discard block
 block discarded – undo
1326 1326
      */
1327 1327
     function custom_validation( $validation_results ) {
1328 1328
 
1329
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1329
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1330 1330
 
1331
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1331
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1332 1332
 
1333 1333
         $gv_valid = true;
1334 1334
 
1335
-        foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1335
+        foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1336 1336
 
1337 1337
             $value = RGFormsModel::get_field_value( $field );
1338 1338
             $field_type = RGFormsModel::get_input_type( $field );
@@ -1345,35 +1345,35 @@  discard block
 block discarded – undo
1345 1345
                 case 'post_image':
1346 1346
 
1347 1347
                     // in case nothing is uploaded but there are already files saved
1348
-                    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1348
+                    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1349 1349
                         $field->failed_validation = false;
1350 1350
                         unset( $field->validation_message );
1351 1351
                     }
1352 1352
 
1353 1353
                     // validate if multi file upload reached max number of files [maxFiles] => 2
1354
-                    if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1354
+                    if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) {
1355 1355
 
1356 1356
                         $input_name = 'input_' . $field->id;
1357 1357
                         //uploaded
1358
-                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1358
+                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1359 1359
 
1360 1360
                         //existent
1361 1361
                         $entry = $this->get_entry();
1362 1362
                         $value = NULL;
1363
-                        if( isset( $entry[ $field->id ] ) ) {
1363
+                        if ( isset( $entry[ $field->id ] ) ) {
1364 1364
                             $value = json_decode( $entry[ $field->id ], true );
1365 1365
                         }
1366 1366
 
1367 1367
                         // count uploaded files and existent entry files
1368 1368
                         $count_files = count( $file_names ) + count( $value );
1369 1369
 
1370
-                        if( $count_files > $field->maxFiles ) {
1370
+                        if ( $count_files > $field->maxFiles ) {
1371 1371
                             $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1372 1372
                             $field->failed_validation = 1;
1373 1373
                             $gv_valid = false;
1374 1374
 
1375 1375
                             // in case of error make sure the newest upload files are removed from the upload input
1376
-                            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1376
+                            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1377 1377
                         }
1378 1378
 
1379 1379
                     }
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
             }
1385 1385
 
1386 1386
             // This field has failed validation.
1387
-            if( !empty( $field->failed_validation ) ) {
1387
+            if ( ! empty( $field->failed_validation ) ) {
1388 1388
 
1389 1389
                 do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) );
1390 1390
 
@@ -1402,32 +1402,32 @@  discard block
 block discarded – undo
1402 1402
                 }
1403 1403
 
1404 1404
                 // You can't continue inside a switch, so we do it after.
1405
-                if( empty( $field->failed_validation ) ) {
1405
+                if ( empty( $field->failed_validation ) ) {
1406 1406
                     continue;
1407 1407
                 }
1408 1408
 
1409 1409
                 // checks if the No Duplicates option is not validating entry against itself, since
1410 1410
                 // we're editing a stored entry, it would also assume it's a duplicate.
1411
-                if( !empty( $field->noDuplicates ) ) {
1411
+                if ( ! empty( $field->noDuplicates ) ) {
1412 1412
 
1413 1413
                     $entry = $this->get_entry();
1414 1414
 
1415 1415
                     // If the value of the entry is the same as the stored value
1416 1416
                     // Then we can assume it's not a duplicate, it's the same.
1417
-                    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1417
+                    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1418 1418
                         //if value submitted was not changed, then don't validate
1419 1419
                         $field->failed_validation = false;
1420 1420
 
1421 1421
                         unset( $field->validation_message );
1422 1422
 
1423
-                        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1423
+                        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1424 1424
 
1425 1425
                         continue;
1426 1426
                     }
1427 1427
                 }
1428 1428
 
1429 1429
                 // if here then probably we are facing the validation 'At least one field must be filled out'
1430
-                if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1430
+                if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1431 1431
                     unset( $field->validation_message );
1432 1432
 	                $field->validation_message = false;
1433 1433
                     continue;
@@ -1439,12 +1439,12 @@  discard block
 block discarded – undo
1439 1439
 
1440 1440
         }
1441 1441
 
1442
-        $validation_results['is_valid'] = $gv_valid;
1442
+        $validation_results[ 'is_valid' ] = $gv_valid;
1443 1443
 
1444
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1444
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1445 1445
 
1446 1446
         // We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1447
-        $this->form_after_validation = $validation_results['form'];
1447
+        $this->form_after_validation = $validation_results[ 'form' ];
1448 1448
 
1449 1449
         return $validation_results;
1450 1450
     }
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
      */
1458 1458
     public function get_entry() {
1459 1459
 
1460
-        if( empty( $this->entry ) ) {
1460
+        if ( empty( $this->entry ) ) {
1461 1461
             // Get the database value of the entry that's being edited
1462 1462
             $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1463 1463
         }
@@ -1484,13 +1484,13 @@  discard block
 block discarded – undo
1484 1484
         $properties = GravityView_View_Data::getInstance()->get_fields( $view_id );
1485 1485
 
1486 1486
         // If edit tab not yet configured, show all fields
1487
-        $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1487
+        $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1488 1488
 
1489 1489
         // Show hidden fields as text fields
1490 1490
         $form = $this->fix_survey_fields( $form );
1491 1491
 
1492 1492
         // Hide fields depending on admin settings
1493
-        $fields = $this->filter_fields( $form['fields'], $edit_fields );
1493
+        $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1494 1494
 
1495 1495
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1496 1496
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
     private function fix_survey_fields( $form ) {
1521 1521
 
1522 1522
         /** @var GF_Field $field */
1523
-        foreach( $form['fields'] as &$field ) {
1523
+        foreach ( $form[ 'fields' ] as &$field ) {
1524 1524
             $field->allowsPrepopulate = true;
1525 1525
         }
1526 1526
 
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
      */
1542 1542
     private function filter_fields( $fields, $configured_fields ) {
1543 1543
 
1544
-        if( empty( $fields ) || !is_array( $fields ) ) {
1544
+        if ( empty( $fields ) || ! is_array( $fields ) ) {
1545 1545
             return $fields;
1546 1546
         }
1547 1547
 
@@ -1558,13 +1558,13 @@  discard block
 block discarded – undo
1558 1558
 	     */
1559 1559
 	    $hide_product_fields = apply_filters( 'gravityview/edit_entry/hide-product-fields', empty( self::$supports_product_fields ) );
1560 1560
 
1561
-	    if( $hide_product_fields ) {
1562
-		    $field_type_blacklist[] = 'option';
1563
-		    $field_type_blacklist[] = 'quantity';
1564
-            $field_type_blacklist[] = 'product';
1565
-            $field_type_blacklist[] = 'total';
1566
-            $field_type_blacklist[] = 'shipping';
1567
-            $field_type_blacklist[] = 'calculation';
1561
+	    if ( $hide_product_fields ) {
1562
+		    $field_type_blacklist[ ] = 'option';
1563
+		    $field_type_blacklist[ ] = 'quantity';
1564
+            $field_type_blacklist[ ] = 'product';
1565
+            $field_type_blacklist[ ] = 'total';
1566
+            $field_type_blacklist[ ] = 'shipping';
1567
+            $field_type_blacklist[ ] = 'calculation';
1568 1568
 	    }
1569 1569
 
1570 1570
         // First, remove blacklist or calculation fields
@@ -1572,24 +1572,24 @@  discard block
 block discarded – undo
1572 1572
 
1573 1573
             // Remove the fields that have calculation properties and keep them to be used later
1574 1574
             // @since 1.16.2
1575
-            if( $field->has_calculation() ) {
1576
-                $this->fields_with_calculation[] = $field;
1575
+            if ( $field->has_calculation() ) {
1576
+                $this->fields_with_calculation[ ] = $field;
1577 1577
                 // don't remove the calculation fields on form render.
1578 1578
             }
1579 1579
 
1580 1580
             // process total field after all fields have been saved
1581 1581
             if ( $field->type == 'total' ) {
1582
-                $this->total_fields[] = $field;
1582
+                $this->total_fields[ ] = $field;
1583 1583
                 unset( $fields[ $key ] );
1584 1584
             }
1585 1585
 
1586
-            if( in_array( $field->type, $field_type_blacklist ) ) {
1586
+            if ( in_array( $field->type, $field_type_blacklist ) ) {
1587 1587
                 unset( $fields[ $key ] );
1588 1588
             }
1589 1589
         }
1590 1590
 
1591 1591
         // The Edit tab has not been configured, so we return all fields by default.
1592
-        if( empty( $configured_fields ) ) {
1592
+        if ( empty( $configured_fields ) ) {
1593 1593
             return $fields;
1594 1594
         }
1595 1595
 
@@ -1599,8 +1599,8 @@  discard block
 block discarded – undo
1599 1599
 	        /** @var GF_Field $field */
1600 1600
 	        foreach ( $fields as $field ) {
1601 1601
 
1602
-                if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1603
-                    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1602
+                if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1603
+                    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1604 1604
                     break;
1605 1605
                 }
1606 1606
 
@@ -1623,14 +1623,14 @@  discard block
 block discarded – undo
1623 1623
 
1624 1624
         $return_field = $field;
1625 1625
 
1626
-        if( empty( $field_setting['show_label'] ) ) {
1626
+        if ( empty( $field_setting[ 'show_label' ] ) ) {
1627 1627
             $return_field->label = '';
1628
-        } elseif ( !empty( $field_setting['custom_label'] ) ) {
1629
-            $return_field->label = $field_setting['custom_label'];
1628
+        } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1629
+            $return_field->label = $field_setting[ 'custom_label' ];
1630 1630
         }
1631 1631
 
1632
-        if( !empty( $field_setting['custom_class'] ) ) {
1633
-            $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1632
+        if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1633
+            $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1634 1634
         }
1635 1635
 
1636 1636
         /**
@@ -1668,16 +1668,16 @@  discard block
 block discarded – undo
1668 1668
 	     */
1669 1669
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1670 1670
 
1671
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1672
-            foreach( $fields as $k => $field ) {
1673
-                if( $field->adminOnly ) {
1671
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1672
+            foreach ( $fields as $k => $field ) {
1673
+                if ( $field->adminOnly ) {
1674 1674
                     unset( $fields[ $k ] );
1675 1675
                 }
1676 1676
             }
1677 1677
             return $fields;
1678 1678
         }
1679 1679
 
1680
-	    foreach( $fields as &$field ) {
1680
+	    foreach ( $fields as &$field ) {
1681 1681
 		    $field->adminOnly = false;
1682 1682
         }
1683 1683
 
@@ -1704,16 +1704,16 @@  discard block
 block discarded – undo
1704 1704
          */
1705 1705
         $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1706 1706
 
1707
-        if( $use_conditional_logic ) {
1707
+        if ( $use_conditional_logic ) {
1708 1708
             return $form;
1709 1709
         }
1710 1710
 
1711
-        foreach( $form['fields'] as &$field ) {
1711
+        foreach ( $form[ 'fields' ] as &$field ) {
1712 1712
             /* @var GF_Field $field */
1713 1713
             $field->conditionalLogic = null;
1714 1714
         }
1715 1715
 
1716
-        unset( $form['button']['conditionalLogic'] );
1716
+        unset( $form[ 'button' ][ 'conditionalLogic' ] );
1717 1717
 
1718 1718
         return $form;
1719 1719
 
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
      */
1731 1731
     function manage_conditional_logic( $has_conditional_logic, $form ) {
1732 1732
 
1733
-        if( ! $this->is_edit_entry() ) {
1733
+        if ( ! $this->is_edit_entry() ) {
1734 1734
             return $has_conditional_logic;
1735 1735
         }
1736 1736
 
@@ -1761,44 +1761,44 @@  discard block
 block discarded – undo
1761 1761
          *  2. There are two entries embedded using oEmbed
1762 1762
          *  3. One of the entries has just been saved
1763 1763
          */
1764
-        if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1764
+        if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1765 1765
 
1766 1766
             $error = true;
1767 1767
 
1768 1768
         }
1769 1769
 
1770
-        if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1770
+        if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1771 1771
 
1772 1772
             $error = true;
1773 1773
 
1774
-        } elseif( ! $this->verify_nonce() ) {
1774
+        } elseif ( ! $this->verify_nonce() ) {
1775 1775
 
1776 1776
             /**
1777 1777
              * If the Entry is embedded, there may be two entries on the same page.
1778 1778
              * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1779 1779
              */
1780
-            if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1780
+            if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1781 1781
                 $error = true;
1782 1782
             } else {
1783
-                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1783
+                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1784 1784
             }
1785 1785
 
1786 1786
         }
1787 1787
 
1788
-        if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1789
-            $error = __( 'You do not have permission to edit this entry.', 'gravityview');
1788
+        if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1789
+            $error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1790 1790
         }
1791 1791
 
1792
-        if( $this->entry['status'] === 'trash' ) {
1793
-            $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1792
+        if ( $this->entry[ 'status' ] === 'trash' ) {
1793
+            $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1794 1794
         }
1795 1795
 
1796 1796
         // No errors; everything's fine here!
1797
-        if( empty( $error ) ) {
1797
+        if ( empty( $error ) ) {
1798 1798
             return true;
1799 1799
         }
1800 1800
 
1801
-        if( $echo && $error !== true ) {
1801
+        if ( $echo && $error !== true ) {
1802 1802
 
1803 1803
 	        $error = esc_html( $error );
1804 1804
 
@@ -1806,13 +1806,13 @@  discard block
 block discarded – undo
1806 1806
 	         * @since 1.9
1807 1807
 	         */
1808 1808
 	        if ( ! empty( $this->entry ) ) {
1809
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1809
+		        $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1810 1810
 	        }
1811 1811
 
1812
-            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1812
+            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1813 1813
         }
1814 1814
 
1815
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1815
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1816 1816
 
1817 1817
         return false;
1818 1818
     }
@@ -1829,20 +1829,20 @@  discard block
 block discarded – undo
1829 1829
 
1830 1830
         $error = NULL;
1831 1831
 
1832
-        if( ! $this->check_user_cap_edit_field( $field ) ) {
1833
-            $error = __( 'You do not have permission to edit this field.', 'gravityview');
1832
+        if ( ! $this->check_user_cap_edit_field( $field ) ) {
1833
+            $error = __( 'You do not have permission to edit this field.', 'gravityview' );
1834 1834
         }
1835 1835
 
1836 1836
         // No errors; everything's fine here!
1837
-        if( empty( $error ) ) {
1837
+        if ( empty( $error ) ) {
1838 1838
             return true;
1839 1839
         }
1840 1840
 
1841
-        if( $echo ) {
1842
-            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1841
+        if ( $echo ) {
1842
+            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1843 1843
         }
1844 1844
 
1845
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1845
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1846 1846
 
1847 1847
         return false;
1848 1848
 
@@ -1860,15 +1860,15 @@  discard block
 block discarded – undo
1860 1860
     private function check_user_cap_edit_field( $field ) {
1861 1861
 
1862 1862
         // If they can edit any entries (as defined in Gravity Forms), we're good.
1863
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1863
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1864 1864
             return true;
1865 1865
         }
1866 1866
 
1867
-        $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1867
+        $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1868 1868
 
1869 1869
         // If the field has custom editing capaibilities set, check those
1870
-        if( $field_cap ) {
1871
-            return GVCommon::has_cap( $field['allow_edit_cap'] );
1870
+        if ( $field_cap ) {
1871
+            return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1872 1872
         }
1873 1873
 
1874 1874
         return false;
@@ -1882,17 +1882,17 @@  discard block
 block discarded – undo
1882 1882
     public function verify_nonce() {
1883 1883
 
1884 1884
         // Verify form submitted for editing single
1885
-        if( $this->is_edit_entry_submission() ) {
1885
+        if ( $this->is_edit_entry_submission() ) {
1886 1886
             $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
1887 1887
         }
1888 1888
 
1889 1889
         // Verify
1890
-        else if( ! $this->is_edit_entry() ) {
1890
+        else if ( ! $this->is_edit_entry() ) {
1891 1891
             $valid = false;
1892 1892
         }
1893 1893
 
1894 1894
         else {
1895
-            $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
1895
+            $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
1896 1896
         }
1897 1897
 
1898 1898
         /**
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-checkbox.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 	var $name = 'checkbox';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Checkbox';
15 15
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
40 40
 
41 41
 		// It's not the parent field; it's an input
42
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
42
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
43 43
 
44
-			if( $this->is_choice_value_enabled() ) {
44
+			if ( $this->is_choice_value_enabled() ) {
45 45
 
46 46
 				$desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' );
47 47
 				$default = 'value';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 				);
60 60
 			}
61 61
 
62
-			$field_options['choice_display'] = array(
62
+			$field_options[ 'choice_display' ] = array(
63 63
 				'type'    => 'radio',
64 64
 				'class'   => 'vertical',
65 65
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/class-admin-views.php 1 patch
Spacing   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -28,30 +28,30 @@  discard block
 block discarded – undo
28 28
 		add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 );
29 29
 
30 30
 		// Tooltips
31
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
31
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
32 32
 
33 33
 		// adding styles and scripts
34
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
35
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
36
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
38
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
39
-
40
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
41
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
42
-		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 );
43
-		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') );
44
-		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 );
34
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
35
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
36
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
38
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
39
+
40
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
41
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
42
+		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 );
43
+		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) );
44
+		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 );
45 45
 
46 46
 		// @todo check if this hook is needed..
47 47
 		//add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 );
48 48
 
49 49
 		// Add Connected Form column
50
-		add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) );
50
+		add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) );
51 51
 
52 52
 		add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
53 53
 
54
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
54
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
55 55
 
56 56
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
57 57
 
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	public function filter_pre_get_posts_by_gravityview_form_id( &$query ) {
67 67
 		global $pagenow;
68 68
 
69
-		if ( !is_admin() ) {
69
+		if ( ! is_admin() ) {
70 70
 			return;
71 71
 		}
72 72
 
73
-		if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) {
73
+		if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) {
74 74
 			return;
75 75
 		}
76 76
 
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	function add_view_dropdown() {
88 88
 		$current_screen = get_current_screen();
89 89
 
90
-		if( 'gravityview' !== $current_screen->post_type ) {
90
+		if ( 'gravityview' !== $current_screen->post_type ) {
91 91
 			return;
92 92
 		}
93 93
 
94 94
 		$forms = gravityview_get_forms();
95 95
 		$current_form = rgget( 'gravityview_form_id' );
96 96
 		// If there are no forms to select, show no forms.
97
-		if( !empty( $forms ) ) { ?>
97
+		if ( ! empty( $forms ) ) { ?>
98 98
 			<select name="gravityview_form_id" id="gravityview_form_id">
99 99
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
100
-				<?php foreach( $forms as $form ) { ?>
101
-					<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
100
+				<?php foreach ( $forms as $form ) { ?>
101
+					<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
102 102
 				<?php } ?>
103 103
 			</select>
104 104
 		<?php }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
113 113
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
114
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
114
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
115 115
 	}
116 116
 
117 117
 	/**
@@ -134,37 +134,37 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$connected_views = gravityview_get_connected_views( $id );
136 136
 
137
-		if( empty( $connected_views ) ) {
137
+		if ( empty( $connected_views ) ) {
138 138
 			return $menu_items;
139 139
 		}
140 140
 
141 141
 		$sub_menu_items = array();
142 142
 		foreach ( (array)$connected_views as $view ) {
143 143
 
144
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
144
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
145 145
 				continue;
146 146
 			}
147 147
 
148
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
148
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
149 149
 
150
-			$sub_menu_items[] = array(
150
+			$sub_menu_items[ ] = array(
151 151
 				'label' => esc_attr( $label ),
152
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
152
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
153 153
 			);
154 154
 		}
155 155
 
156 156
 		// If there were no items added, then let's create the parent menu
157
-		if( $sub_menu_items ) {
157
+		if ( $sub_menu_items ) {
158 158
 
159 159
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
160
-			$sub_menu_items[] = array(
160
+			$sub_menu_items[ ] = array(
161 161
 				'url' => '#',
162 162
 				'label' => '',
163 163
 				'menu_class' => 'hidden',
164 164
 				'capabilities' => '',
165 165
 			);
166 166
 
167
-			$menu_items['gravityview'] = array(
167
+			$menu_items[ 'gravityview' ] = array(
168 168
 				'label'          => __( 'Connected Views', 'gravityview' ),
169 169
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
170 170
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 		$add = array( 'captcha', 'page' );
195 195
 
196 196
 		// Don't allowing editing the following values:
197
-		if( $context === 'edit' ) {
198
-			$add[] = 'post_id';
197
+		if ( $context === 'edit' ) {
198
+			$add[ ] = 'post_id';
199 199
 		}
200 200
 
201 201
 		$return = array_merge( $array, $add );
@@ -218,32 +218,32 @@  discard block
 block discarded – undo
218 218
 		foreach ( $default_args as $key => $arg ) {
219 219
 
220 220
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
221
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
221
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
222 222
 
223 223
 			// By default, use `tooltip` if defined.
224
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
224
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
225 225
 
226 226
 			// Otherwise, use the description as a tooltip.
227
-			if( empty( $tooltip ) && !empty( $arg['desc'] ) ) {
228
-				$tooltip = $arg['desc'];
227
+			if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) {
228
+				$tooltip = $arg[ 'desc' ];
229 229
 			}
230 230
 
231 231
 			// If there's no tooltip set, continue
232
-			if( empty( $tooltip ) ) {
232
+			if ( empty( $tooltip ) ) {
233 233
 				continue;
234 234
 			}
235 235
 
236 236
 			// Add the tooltip
237
-			$gv_tooltips[ 'gv_'.$key ] = array(
238
-				'title'	=> $arg['label'],
237
+			$gv_tooltips[ 'gv_' . $key ] = array(
238
+				'title'	=> $arg[ 'label' ],
239 239
 				'value'	=> $tooltip,
240 240
 			);
241 241
 
242 242
 		}
243 243
 
244
-		$gv_tooltips['gv_css_merge_tags'] = array(
245
-			'title' => __('CSS Merge Tags', 'gravityview'),
246
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
244
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
245
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
246
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
247 247
 		);
248 248
 
249 249
 		/**
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 
255 255
 		foreach ( $gv_tooltips as $key => $tooltip ) {
256 256
 
257
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
257
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
258 258
 
259
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
259
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
260 260
 		}
261 261
 
262 262
 		return $tooltips;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return void
272 272
 	 */
273
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
273
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
274 274
 
275 275
 		$output = '';
276 276
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
293 293
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
294 294
 
295
-				$output = $template ? $template['label'] : $template_id_pretty;
295
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
296 296
 
297 297
 				break;
298 298
 
@@ -333,44 +333,44 @@  discard block
 block discarded – undo
333 333
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
334 334
 
335 335
 		// Either the form is empty or the form ID is 0, not yet set.
336
-		if( empty( $form ) ) {
336
+		if ( empty( $form ) ) {
337 337
 			return '';
338 338
 		}
339 339
 
340 340
 		// The $form is passed as the form ID
341
-		if( !is_array( $form ) ) {
341
+		if ( ! is_array( $form ) ) {
342 342
 			$form = gravityview_get_form( $form );
343 343
 		}
344 344
 
345
-		$form_id = $form['id'];
345
+		$form_id = $form[ 'id' ];
346 346
 		$links = array();
347 347
 
348
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
348
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
349 349
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
350
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
351
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
350
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
351
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
352 352
 		} else {
353
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
353
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
354 354
 		}
355 355
 
356
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
356
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
357 357
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
358
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
358
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
359 359
 		}
360 360
 
361
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
361
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
362 362
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
363
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
363
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
364 364
 		}
365 365
 
366
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
366
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
367 367
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
368
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
368
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
369 369
 		}
370 370
 
371 371
 		$output = '';
372 372
 
373
-		if( !empty( $include_form_link ) ) {
373
+		if ( ! empty( $include_form_link ) ) {
374 374
 			$output .= $form_link;
375 375
 		}
376 376
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		 */
383 383
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
384 384
 
385
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
385
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
386 386
 
387 387
 		return $output;
388 388
 	}
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 		// Get the date column and save it for later to add back in.
397 397
 		// This adds it after the Data Source column.
398 398
 		// This way, we don't need to do array_slice, array_merge, etc.
399
-		$date = $columns['date'];
400
-		unset( $columns['date'] );
399
+		$date = $columns[ 'date' ];
400
+		unset( $columns[ 'date' ] );
401 401
 
402 402
 		$data_source_required_caps = array(
403 403
 			'gravityforms_edit_forms',
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
 			'gravityforms_preview_forms',
409 409
 		);
410 410
 
411
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
412
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
411
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
412
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
413 413
 		}
414 414
 
415
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
415
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
416 416
 
417 417
 		// Add the date back in.
418
-		$columns['date'] = $date;
418
+		$columns[ 'date' ] = $date;
419 419
 
420 420
 		return $columns;
421 421
 	}
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 */
430 430
 	function save_postdata( $post_id ) {
431 431
 
432
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
432
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
433 433
 			return;
434 434
 		}
435 435
 
436 436
 		// validate post_type
437
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
437
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
438 438
 			return;
439 439
 		}
440 440
 
@@ -449,67 +449,67 @@  discard block
 block discarded – undo
449 449
 		$statii = array();
450 450
 
451 451
 		// check if this is a start fresh View
452
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
452
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
453 453
 
454
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
454
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
455 455
 			// save form id
456
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
456
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
457 457
 
458 458
 		}
459 459
 
460
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
460
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
461 461
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() );
462 462
 			return;
463 463
 		}
464 464
 
465 465
 		// Was this a start fresh?
466
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
467
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
466
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
467
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
468 468
 		} else {
469
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
469
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
470 470
 		}
471 471
 
472 472
 		// Check if we have a template id
473
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
473
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
474 474
 
475
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
475
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
476 476
 
477 477
 			// now save template id
478
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
478
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
479 479
 		}
480 480
 
481 481
 
482 482
 		// save View Configuration metabox
483
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
483
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
484 484
 
485 485
 			// template settings
486
-			if( empty( $_POST['template_settings'] ) ) {
487
-				$_POST['template_settings'] = array();
486
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
487
+				$_POST[ 'template_settings' ] = array();
488 488
 			}
489
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
489
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
490 490
 
491 491
 			$fields = array();
492 492
 
493 493
 			// Directory&single Visible Fields
494
-			if( !empty( $preset_fields ) ) {
494
+			if ( ! empty( $preset_fields ) ) {
495 495
 
496 496
 				$fields = $preset_fields;
497 497
 
498
-			} elseif( !empty( $_POST['fields'] ) ) {
498
+			} elseif ( ! empty( $_POST[ 'fields' ] ) ) {
499 499
 				$fields = _gravityview_process_posted_fields();
500 500
 			}
501 501
 
502
-			$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
502
+			$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
503 503
 
504 504
 			// Directory Visible Widgets
505
-			if( empty( $_POST['widgets'] ) ) {
506
-				$_POST['widgets'] = array();
505
+			if ( empty( $_POST[ 'widgets' ] ) ) {
506
+				$_POST[ 'widgets' ] = array();
507 507
 			}
508
-			$statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] );
508
+			$statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] );
509 509
 
510 510
 		} // end save view configuration
511 511
 
512
-		do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) );
512
+		do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) );
513 513
 	}
514 514
 
515 515
 	/**
@@ -541,20 +541,20 @@  discard block
 block discarded – undo
541 541
 
542 542
 		$output = '';
543 543
 
544
-		if( !empty( $fields ) ) {
544
+		if ( ! empty( $fields ) ) {
545 545
 
546
-			foreach( $fields as $id => $details ) {
546
+			foreach ( $fields as $id => $details ) {
547 547
 
548
-				if( in_array( $details['type'], $blacklist_field_types ) ) {
548
+				if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) {
549 549
 					continue;
550 550
 				}
551 551
 
552 552
 				// Edit mode only allows editing the parent fields, not single inputs.
553
-				if( $context === 'edit' && !empty( $details['parent'] ) ) {
553
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
554 554
 					continue;
555 555
 				}
556 556
 
557
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details );
557
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details );
558 558
 
559 559
 			} // End foreach
560 560
 		}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 		echo $output;
563 563
 
564 564
 		// For the EDIT view we only want to allow the form fields.
565
-		if( $context === 'edit' ) {
565
+		if ( $context === 'edit' ) {
566 566
 			return;
567 567
 		}
568 568
 
@@ -586,16 +586,16 @@  discard block
 block discarded – undo
586 586
 		$additional_fields = apply_filters( 'gravityview_additional_fields', array(
587 587
 			array(
588 588
 				'label_text' => __( '+ Add All Fields', 'gravityview' ),
589
-				'desc' => __('Add all the available fields at once.', 'gravityview'),
589
+				'desc' => __( 'Add all the available fields at once.', 'gravityview' ),
590 590
 				'field_id' => 'all-fields',
591 591
 				'label_type' => 'field',
592 592
 				'input_type' => NULL,
593 593
 				'field_options' => NULL,
594 594
 				'settings_html'	=> NULL,
595 595
 			)
596
-		));
596
+		) );
597 597
 
598
-		if( !empty( $additional_fields )) {
598
+		if ( ! empty( $additional_fields ) ) {
599 599
 			foreach ( (array)$additional_fields as $item ) {
600 600
 
601 601
 				// Prevent items from not having index set
@@ -606,16 +606,16 @@  discard block
 block discarded – undo
606 606
 					'input_type' => NULL,
607 607
 					'field_options' => NULL,
608 608
 					'settings_html'	=> NULL,
609
-				));
609
+				) );
610 610
 
611 611
 				// Backward compat.
612
-				if( !empty( $item['field_options'] ) ) {
612
+				if ( ! empty( $item[ 'field_options' ] ) ) {
613 613
 					// Use settings_html from now on.
614
-					$item['settings_html'] = $item['field_options'];
614
+					$item[ 'settings_html' ] = $item[ 'field_options' ];
615 615
 				}
616 616
 
617 617
 				// Render a label for each of them
618
-				echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item );
618
+				echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item );
619 619
 
620 620
 			}
621 621
 		}
@@ -628,63 +628,63 @@  discard block
 block discarded – undo
628 628
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
629 629
 	 * @return array
630 630
 	 */
631
-	function get_entry_default_fields($form, $zone) {
631
+	function get_entry_default_fields( $form, $zone ) {
632 632
 
633 633
 		$entry_default_fields = array();
634 634
 
635
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
635
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
636 636
 
637 637
 			$entry_default_fields = array(
638 638
 				'id' => array(
639
-					'label' => __('Entry ID', 'gravityview'),
639
+					'label' => __( 'Entry ID', 'gravityview' ),
640 640
 					'type' => 'id',
641
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
641
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
642 642
 				),
643 643
 				'date_created' => array(
644
-					'label' => __('Entry Date', 'gravityview'),
645
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
644
+					'label' => __( 'Entry Date', 'gravityview' ),
645
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
646 646
 					'type' => 'date_created',
647 647
 				),
648 648
 				'source_url' => array(
649
-					'label' => __('Source URL', 'gravityview'),
649
+					'label' => __( 'Source URL', 'gravityview' ),
650 650
 					'type' => 'source_url',
651
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
651
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
652 652
 				),
653 653
 				'ip' => array(
654
-					'label' => __('User IP', 'gravityview'),
654
+					'label' => __( 'User IP', 'gravityview' ),
655 655
 					'type' => 'ip',
656
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
656
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
657 657
 				),
658 658
 				'created_by' => array(
659
-					'label' => __('User', 'gravityview'),
659
+					'label' => __( 'User', 'gravityview' ),
660 660
 					'type' => 'created_by',
661
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
661
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
662 662
 				),
663 663
 
664 664
 				/**
665 665
 				 * @since  1.2
666 666
 				 */
667 667
 				'custom'	=> array(
668
-					'label'	=> __('Custom Content', 'gravityview'),
668
+					'label'	=> __( 'Custom Content', 'gravityview' ),
669 669
 					'type'	=> 'custom',
670
-					'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
670
+					'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
671 671
 				),
672 672
 
673 673
 				/**
674 674
 				 * @since 1.7.2
675 675
 				 */
676 676
 			    'other_entries' => array(
677
-				    'label'	=> __('Other Entries', 'gravityview'),
677
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
678 678
 				    'type'	=> 'other_entries',
679
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
679
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
680 680
 			    ),
681 681
 	        );
682 682
 
683
-			if( 'single' !== $zone) {
683
+			if ( 'single' !== $zone ) {
684 684
 
685
-				$entry_default_fields['entry_link'] = array(
686
-					'label' => __('Link to Entry', 'gravityview'),
687
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
685
+				$entry_default_fields[ 'entry_link' ] = array(
686
+					'label' => __( 'Link to Entry', 'gravityview' ),
687
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
688 688
 					'type' => 'entry_link',
689 689
 				);
690 690
 			}
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 		 * @param  string|array $form form_ID or form object
699 699
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
700 700
 		 */
701
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
701
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
702 702
 	}
703 703
 
704 704
 	/**
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 */
710 710
 	function get_available_fields( $form = '', $zone = NULL ) {
711 711
 
712
-		if( empty( $form ) ) {
712
+		if ( empty( $form ) ) {
713 713
 			do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' );
714 714
 			return array();
715 715
 		}
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		$fields = gravityview_get_form_fields( $form, true );
719 719
 
720 720
 		// get meta fields ( only if form was already created )
721
-		if( !is_array( $form ) ) {
721
+		if ( ! is_array( $form ) ) {
722 722
 			$meta_fields = gravityview_get_entry_meta( $form );
723 723
 		} else {
724 724
 			$meta_fields = array();
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 
743 743
 		$widgets = $this->get_registered_widgets();
744 744
 
745
-		if( !empty( $widgets ) ) {
745
+		if ( ! empty( $widgets ) ) {
746 746
 
747
-			foreach( $widgets as $id => $details ) {
747
+			foreach ( $widgets as $id => $details ) {
748 748
 
749
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
749
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
750 750
 
751 751
 			}
752 752
 		}
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
781 781
 		global $post;
782 782
 
783
-		if( $type === 'widget' ) {
783
+		if ( $type === 'widget' ) {
784 784
 			$button_label = __( 'Add Widget', 'gravityview' );
785 785
 		} else {
786 786
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -789,15 +789,15 @@  discard block
 block discarded – undo
789 789
 		$available_items = array();
790 790
 
791 791
 		// if saved values, get available fields to label everyone
792
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
792
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
793 793
 
794
-			if( !empty( $_POST['template_id'] ) ) {
795
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
794
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
795
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
796 796
 			} else {
797 797
 				$form = gravityview_get_form_id( $post->ID );
798 798
 			}
799 799
 
800
-			if( 'field' === $type ) {
800
+			if ( 'field' === $type ) {
801 801
 				$available_items = $this->get_available_fields( $form, $zone );
802 802
 			} else {
803 803
 				$available_items = $this->get_registered_widgets();
@@ -805,39 +805,39 @@  discard block
 block discarded – undo
805 805
 
806 806
 		}
807 807
 
808
-		foreach( $rows as $row ) :
809
-			foreach( $row as $col => $areas ) :
810
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
808
+		foreach ( $rows as $row ) :
809
+			foreach ( $row as $col => $areas ) :
810
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
811 811
 
812 812
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
813 813
 
814
-					<?php foreach( $areas as $area ) : 	?>
814
+					<?php foreach ( $areas as $area ) : 	?>
815 815
 
816 816
 						<div class="gv-droppable-area">
817
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
817
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
818 818
 
819 819
 								<?php // render saved fields
820 820
 
821
-								if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
821
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
822 822
 
823
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
823
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
824 824
 
825 825
 										$input_type = NULL;
826
-										$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
826
+										$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
827 827
 
828
-										if( !$original_item ) {
828
+										if ( ! $original_item ) {
829 829
 
830
-											do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field ));
830
+											do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) );
831 831
 
832 832
 											$original_item = $field;
833 833
 										} else {
834 834
 
835
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
835
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
836 836
 
837 837
 										}
838 838
 
839 839
 										// Field options dialog box
840
-										$field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item );
840
+										$field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item );
841 841
 
842 842
 										$item = array(
843 843
 											'input_type' => $input_type,
@@ -846,16 +846,16 @@  discard block
 block discarded – undo
846 846
 										);
847 847
 
848 848
 										// Merge the values with the current item to pass things like widget descriptions and original field names
849
-										if( $original_item ) {
849
+										if ( $original_item ) {
850 850
 											$item = wp_parse_args( $item, $original_item );
851 851
 										}
852 852
 
853
-										switch( $type ) {
853
+										switch ( $type ) {
854 854
 											case 'widget':
855
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
855
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
856 856
 												break;
857 857
 											default:
858
-												echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field );
858
+												echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field );
859 859
 										}
860 860
 
861 861
 
@@ -865,11 +865,11 @@  discard block
 block discarded – undo
865 865
 
866 866
 								} // End if zone is not empty ?>
867 867
 
868
-								<span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span>
868
+								<span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span>
869 869
 							</div>
870 870
 							<div class="gv-droppable-area-action">
871
-								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a>
872
-								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p>
871
+								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a>
872
+								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p>
873 873
 							</div>
874 874
 						</div>
875 875
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 		$default_widget_areas = GravityView_Plugin::get_default_widget_areas();
892 892
 
893 893
 		$widgets = array();
894
-		if( !empty( $post_id ) ) {
894
+		if ( ! empty( $post_id ) ) {
895 895
 			$widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true );
896 896
 
897 897
 		}
@@ -922,19 +922,19 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
924 924
 
925
-		if( empty( $template_id ) ) {
925
+		if ( empty( $template_id ) ) {
926 926
 			do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' );
927 927
 			return;
928 928
 		}
929 929
 
930 930
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
931 931
 
932
-		if( empty( $template_areas ) ) {
932
+		if ( empty( $template_areas ) ) {
933 933
 
934 934
 			do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id );
935 935
 			$output = '<div>';
936
-			$output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>';
937
-			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>';
936
+			$output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>';
937
+			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>';
938 938
 			$output .= '</div>';
939 939
 		} else {
940 940
 
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 
950 950
 		}
951 951
 
952
-		if( $echo ) {
952
+		if ( $echo ) {
953 953
 			echo $output;
954 954
 		}
955 955
 
@@ -969,25 +969,25 @@  discard block
 block discarded – undo
969 969
 		$is_widgets_page = ( $pagenow === 'widgets.php' );
970 970
 
971 971
 		// Add the GV font (with the Astronaut)
972
-		wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
972
+		wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
973 973
 
974
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true );
974
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
975 975
 
976 976
 		// Don't process any scripts below here if it's not a GravityView page.
977
-		if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; }
977
+		if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; }
978 978
 
979 979
 		// Only enqueue the following on single pages
980
-		if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) {
980
+		if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) {
981 981
 
982 982
 			wp_enqueue_script( 'jquery-ui-datepicker' );
983
-			wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version );
983
+			wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version );
984 984
 
985
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
985
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
986 986
 
987 987
 			//enqueue scripts
988 988
 			wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version );
989 989
 
990
-			wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
990
+			wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
991 991
 				'cookiepath' => COOKIEPATH,
992 992
 				'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
993 993
 				'label_viewname' => __( 'Enter View name here', 'gravityview' ),
@@ -1000,9 +1000,9 @@  discard block
 block discarded – undo
1000 1000
 				'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1001 1001
 				'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1002 1002
 				'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1003
-			));
1003
+			) );
1004 1004
 
1005
-			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1005
+			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1006 1006
 
1007 1007
 			self::enqueue_gravity_forms_scripts();
1008 1008
 
@@ -1021,10 +1021,10 @@  discard block
 block discarded – undo
1021 1021
 		);
1022 1022
 
1023 1023
 		if ( wp_is_mobile() ) {
1024
-				    $scripts[] = 'jquery-touch-punch';
1024
+				    $scripts[ ] = 'jquery-touch-punch';
1025 1025
 		}
1026 1026
 
1027
-		foreach ($scripts as $script) {
1027
+		foreach ( $scripts as $script ) {
1028 1028
 			wp_enqueue_script( $script );
1029 1029
 		}
1030 1030
 	}
@@ -1033,11 +1033,11 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
 		$filter = current_filter();
1035 1035
 
1036
-		if( preg_match('/script/ism', $filter ) ) {
1036
+		if ( preg_match( '/script/ism', $filter ) ) {
1037 1037
 			$allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker',
1038 1038
 			'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' );
1039 1039
 			$registered = array_merge( $registered, $allow_scripts );
1040
-		} elseif( preg_match('/style/ism', $filter ) ) {
1040
+		} elseif ( preg_match( '/style/ism', $filter ) ) {
1041 1041
 			$allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' );
1042 1042
 			$registered = array_merge( $registered, $allow_styles );
1043 1043
 		}
Please login to merge, or discard this patch.
includes/extensions/entry-notes/class-gravityview-field-notes.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
 
64 64
 		add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) );
65 65
 
66
-		add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 );
67
-		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') );
68
-		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') );
66
+		add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 );
67
+		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
68
+		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
69 69
 
70
-		add_action( 'wp', array( $this, 'maybe_add_note'), 1000 );
71
-		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') );
72
-		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') );
70
+		add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 );
71
+		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) );
72
+		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) );
73 73
 
74 74
 		// add template path to check for field
75 75
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
76 76
 
77
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
77
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
78 78
 		add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) );
79 79
 		
80 80
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 );
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function add_entry_default_field( $entry_default_fields, $form, $zone ) {
98 98
 
99
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
100
-			$entry_default_fields['notes'] = array(
99
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
100
+			$entry_default_fields[ 'notes' ] = array(
101 101
 				'label' => __( 'Entry Notes', 'gravityview' ),
102 102
 				'type'  => 'notes',
103 103
 				'desc'  => __( 'Display, add, and delete notes for an entry.', 'gravityview' ),
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 	public function enqueue_scripts() {
131 131
 		global $wp_actions;
132 132
 
133
-		if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
133
+		if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
134 134
 			wp_enqueue_style( 'gravityview-notes' );
135 135
 			wp_enqueue_script( 'gravityview-notes' );
136 136
 		}
137 137
 
138
-		if( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
138
+		if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
139 139
 
140 140
 			$strings = self::strings();
141 141
 
142 142
 			wp_localize_script( 'gravityview-notes', 'GVNotes', array(
143 143
 				'ajaxurl' => admin_url( 'admin-ajax.php' ),
144 144
 				'text' => array(
145
-					'processing' => $strings['processing'],
146
-					'delete_confirm' => $strings['delete-confirm'],
147
-					'note_added' => $strings['added-note'],
148
-					'error_invalid' => $strings['error-invalid'],
149
-					'error_empty_note' => $strings['error-empty-note'],
145
+					'processing' => $strings[ 'processing' ],
146
+					'delete_confirm' => $strings[ 'delete-confirm' ],
147
+					'note_added' => $strings[ 'added-note' ],
148
+					'error_invalid' => $strings[ 'error-invalid' ],
149
+					'error_empty_note' => $strings[ 'error-empty-note' ],
150 150
 				),
151 151
 			) );
152 152
 		}
@@ -163,22 +163,22 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	function maybe_add_note() {
165 165
 
166
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
166
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
167 167
 			do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
168 168
 			return;
169 169
 		}
170 170
 
171
-		if( 'gv_note_add' === rgpost('action') ) {
171
+		if ( 'gv_note_add' === rgpost( 'action' ) ) {
172 172
 
173 173
 			$post = wp_unslash( $_POST );
174 174
 
175
-			if( $this->doing_ajax ) {
176
-				parse_str( $post['data'], $data );
175
+			if ( $this->doing_ajax ) {
176
+				parse_str( $post[ 'data' ], $data );
177 177
 			} else {
178 178
 				$data = $post;
179 179
 			}
180 180
 
181
-			$this->process_add_note( (array) $data );
181
+			$this->process_add_note( (array)$data );
182 182
 		}
183 183
 	}
184 184
 
@@ -205,23 +205,23 @@  discard block
 block discarded – undo
205 205
 		$error = false;
206 206
 		$success = false;
207 207
 
208
-		if( empty( $data['entry-slug'] ) ) {
208
+		if ( empty( $data[ 'entry-slug' ] ) ) {
209 209
 
210
-			$error = self::strings('error-invalid');
210
+			$error = self::strings( 'error-invalid' );
211 211
 			do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' );
212 212
 
213 213
 		} else {
214 214
 
215
-			$valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] );
215
+			$valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] );
216 216
 			
217 217
 			$has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' );
218 218
 
219
-			if( ! $has_cap ) {
219
+			if ( ! $has_cap ) {
220 220
 				$error = self::strings( 'error-cap-add' );
221 221
 				do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' );
222 222
 			} elseif ( $valid ) {
223 223
 
224
-				$entry = gravityview_get_entry( $data['entry-slug'], true, false );
224
+				$entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false );
225 225
 
226 226
 				$added = $this->add_note( $entry, $data );
227 227
 
@@ -239,22 +239,22 @@  discard block
 block discarded – undo
239 239
 					$this->maybe_send_entry_notes( $note, $entry, $data );
240 240
 
241 241
 					if ( $note ) {
242
-						$success = self::display_note( $note, ! empty( $data['show-delete'] ) );
243
-						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') );
242
+						$success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) );
243
+						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) );
244 244
 					} else {
245
-						$error = self::strings('error-add-note');
246
-						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') );
245
+						$error = self::strings( 'error-add-note' );
246
+						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) );
247 247
 					}
248 248
 				}
249 249
 			} else {
250
-				$error = self::strings('error-invalid');
250
+				$error = self::strings( 'error-invalid' );
251 251
 				do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' );
252 252
 			}
253 253
 		}
254 254
 
255 255
 
256
-		if( $this->doing_ajax ) {
257
-			if( $success ) {
256
+		if ( $this->doing_ajax ) {
257
+			if ( $success ) {
258 258
 				wp_send_json_success( array( 'html' => $success ) );
259 259
 			} else {
260 260
 				$error = $error ? $error : self::strings( 'error-invalid' );
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 			return;
281 281
 		}
282 282
 
283
-		if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) {
283
+		if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) {
284 284
 
285 285
 			$post = wp_unslash( $_POST );
286 286
 			if ( $this->doing_ajax ) {
287
-				parse_str( $post['data'], $data );
287
+				parse_str( $post[ 'data' ], $data );
288 288
 			} else {
289 289
 				$data = $post;
290 290
 			}
@@ -315,18 +315,18 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	function process_delete_notes( $data ) {
317 317
 
318
-		$valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] );
318
+		$valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] );
319 319
 		$has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' );
320 320
 		$success = false;
321 321
 
322 322
 		if ( $valid && $has_cap ) {
323
-			GravityView_Entry_Notes::delete_notes( $data['note'] );
323
+			GravityView_Entry_Notes::delete_notes( $data[ 'note' ] );
324 324
 			$success = true;
325 325
 		}
326 326
 
327
-		if( $this->doing_ajax ) {
327
+		if ( $this->doing_ajax ) {
328 328
 
329
-			if( $success ) {
329
+			if ( $success ) {
330 330
 				wp_send_json_success();
331 331
 			} else {
332 332
 				if ( ! $valid ) {
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
 
360 360
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
361 361
 
362
-		unset( $field_options['show_as_link'] );
362
+		unset( $field_options[ 'show_as_link' ] );
363 363
 
364 364
 		$notes_options = array(
365 365
 			'notes' => array(
366 366
 				'type' => 'checkboxes',
367
-				'label' => __('Note Settings', 'gravityview'),
368
-				'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
367
+				'label' => __( 'Note Settings', 'gravityview' ),
368
+				'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
369 369
 				'options' => array(
370 370
 					'view' => array(
371 371
 						'label' => __( 'Display notes?', 'gravityview' ),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 			'processing' => __( 'Processing&hellip;', 'gravityview' ),
418 418
 			'other-email' => __( 'Other email address', 'gravityview' ),
419 419
 			'email-label' => __( 'Email address', 'gravityview' ),
420
-			'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'),
420
+			'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ),
421 421
 			'subject-label' => __( 'Subject', 'gravityview' ),
422 422
 			'subject' => __( 'Email subject', 'gravityview' ),
423 423
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		 */
437 437
 		$strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' );
438 438
 
439
-		if( $key ) {
439
+		if ( $key ) {
440 440
 			return isset( $strings[ $key ] ) ? $strings[ $key ] : '';
441 441
 		}
442 442
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 	 */
456 456
 	static public function display_note( $note, $show_delete = false ) {
457 457
 
458
-		if( ! is_object( $note ) ) {
458
+		if ( ! is_object( $note ) ) {
459 459
 			return '';
460 460
 		}
461 461
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		$note_row = ob_get_clean();
497 497
 
498 498
 		$replacements = array(
499
-			'{note_id}' => $note_content['note_id'],
499
+			'{note_id}' => $note_content[ 'note_id' ],
500 500
 			'{row_class}' => 'gv-note',
501 501
 			'{note_detail}' => $note_detail_html
502 502
 		);
@@ -528,13 +528,13 @@  discard block
 block discarded – undo
528 528
 
529 529
 		$user_data = get_userdata( $current_user->ID );
530 530
 
531
-		$note_content = trim( $data['gv-note-content'] );
531
+		$note_content = trim( $data[ 'gv-note-content' ] );
532 532
 
533
-		if( empty( $note_content ) ) {
533
+		if ( empty( $note_content ) ) {
534 534
 			return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) );
535 535
 		}
536 536
 
537
-		$return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
537
+		$return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
538 538
 
539 539
 		return $return;
540 540
 	}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	 */
551 551
 	public static function get_add_note_part() {
552 552
 
553
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
553
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
554 554
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' );
555 555
 			return '';
556 556
 		}
@@ -563,19 +563,19 @@  discard block
 block discarded – undo
563 563
 
564 564
 		$visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
565 565
 		$entry = $gravityview_view->getCurrentEntry();
566
-		$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
566
+		$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
567 567
 		$nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false );
568 568
 
569 569
 		// Only generate the dropdown if the field settings allow it
570 570
 		$email_fields = '';
571
-		if( ! empty( $visibility_settings['email'] ) ) {
571
+		if ( ! empty( $visibility_settings[ 'email' ] ) ) {
572 572
 			$email_fields = self::get_note_email_fields( $entry_slug );
573 573
 		}
574 574
 
575 575
 		$add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html );
576 576
 		$add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html );
577
-		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html );
578
-		$add_note_html   = str_replace( '{email_fields}', $email_fields, $add_note_html );
577
+		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html );
578
+		$add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html );
579 579
 
580 580
 		return $add_note_html;
581 581
 	}
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
 		$note_emails = array();
600 600
 
601 601
 		foreach ( $email_fields as $email_field ) {
602
-			if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) {
603
-				$note_emails[] = $entry["{$email_field->id}"];
602
+			if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) {
603
+				$note_emails[ ] = $entry[ "{$email_field->id}" ];
604 604
 			}
605 605
 		}
606 606
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 		 */
613 613
 		$note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry );
614 614
 
615
-		return (array) $note_emails;
615
+		return (array)$note_emails;
616 616
 	}
617 617
 
618 618
 	/**
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 */
629 629
 	private static function get_note_email_fields( $entry_slug = '' ) {
630 630
 
631
-		if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
631
+		if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
632 632
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' );
633 633
 			return '';
634 634
 		}
@@ -650,27 +650,27 @@  discard block
 block discarded – undo
650 650
 
651 651
 		if ( ! empty( $note_emails ) || $include_custom ) { ?>
652 652
 			<div class="gv-note-email-container">
653
-				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email'];  ?></label>
653
+				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label>
654 654
 				<select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>">
655
-					<option value=""><?php echo $strings['also-email'];  ?></option>
655
+					<option value=""><?php echo $strings[ 'also-email' ]; ?></option>
656 656
 					<?php foreach ( $note_emails as  $email ) {
657 657
 						?>
658 658
 						<option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option>
659 659
 					<?php }
660
-					if( $include_custom ) { ?>
661
-					<option value="custom"><?php echo self::strings('other-email'); ?></option>
660
+					if ( $include_custom ) { ?>
661
+					<option value="custom"><?php echo self::strings( 'other-email' ); ?></option>
662 662
 					<?php } ?>
663 663
 				</select>
664 664
 				<fieldset class="gv-note-to-container">
665
-					<?php if( $include_custom ) { ?>
665
+					<?php if ( $include_custom ) { ?>
666 666
 					<div class='gv-note-to-custom-container'>
667
-						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label>
668
-						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
667
+						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label>
668
+						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
669 669
 					</div>
670 670
 					<?php } ?>
671 671
 		            <div class='gv-note-subject-container'>
672
-		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label>
673
-		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
672
+		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label>
673
+		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
674 674
 		            </div>
675 675
 				</fieldset>
676 676
 			</div>
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 */
694 694
 	private function maybe_send_entry_notes( $note = false, $entry, $data ) {
695 695
 
696
-		if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) {
696
+		if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
697 697
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note );
698 698
 			return;
699 699
 		}
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data );
702 702
 
703 703
 		//emailing notes if configured
704
-		if ( ! empty( $data['gv-note-to'] ) ) {
704
+		if ( ! empty( $data[ 'gv-note-to' ] ) ) {
705 705
 
706 706
 			$default_data = array(
707 707
 				'gv-note-to' => '',
@@ -710,11 +710,11 @@  discard block
 block discarded – undo
710 710
 				'gv-note-content' => '',
711 711
 			);
712 712
 
713
-			$current_user  = wp_get_current_user();
713
+			$current_user = wp_get_current_user();
714 714
 			$email_data = wp_parse_args( $data, $default_data );
715 715
 
716
-			$from    = $current_user->user_email;
717
-			$to = $email_data['gv-note-to'];
716
+			$from = $current_user->user_email;
717
+			$to = $email_data[ 'gv-note-to' ];
718 718
 
719 719
 			/**
720 720
 			 * Documented in get_note_email_fields
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
 			 */
723 723
 			$include_custom = apply_filters( 'gravityview/field/notes/custom-email', true );
724 724
 
725
-			if( 'custom' === $to && $include_custom ) {
726
-				$to = $email_data['gv-note-to-custom'];
725
+			if ( 'custom' === $to && $include_custom ) {
726
+				$to = $email_data[ 'gv-note-to-custom' ];
727 727
 				do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to );
728 728
 			}
729 729
 
@@ -734,12 +734,12 @@  discard block
 block discarded – undo
734 734
 
735 735
 			$bcc = false;
736 736
 			$reply_to = $from;
737
-			$subject = trim( $email_data['gv-note-subject'] );
737
+			$subject = trim( $email_data[ 'gv-note-subject' ] );
738 738
 
739 739
 			// We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF
740 740
 			$subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject;
741
-			$message = $email_data['gv-note-content'];
742
-			$from_name     = $current_user->display_name;
741
+			$message = $email_data[ 'gv-note-content' ];
742
+			$from_name = $current_user->display_name;
743 743
 			$message_format = 'html';
744 744
 
745 745
 			/**
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 
755 755
 			GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false );
756 756
 
757
-			$form  = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array();
757
+			$form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array();
758 758
 
759 759
 			/**
760 760
 			 * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	// If there's an overriding CSS file in the current template folder, use it.
33 33
 	$template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file;
34 34
 
35
-	if( file_exists( $template_css_path ) ) {
35
+	if ( file_exists( $template_css_path ) ) {
36 36
 		$path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file;
37
-		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' );
37
+		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . esc_attr( $css_file ) . ')' );
38 38
 	} else {
39 39
 		// Default: use GravityView CSS file
40 40
 
41 41
 		// If no path is provided, assume default plugin templates CSS folder
42
-		if( '' === $dir_path ) {
42
+		if ( '' === $dir_path ) {
43 43
 			$dir_path = GRAVITYVIEW_DIR . 'templates/css/';
44 44
 		}
45 45
 		
46 46
 		// plugins_url() expects a path to a file, not directory. We append a file to be stripped.
47
-		$path = plugins_url( $css_file, trailingslashit( $dir_path )  . 'stripped-by-plugin_basename.php' );
47
+		$path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' );
48 48
 	}
49 49
 
50 50
 	return $path;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 	$parsed_permalink = parse_url( get_permalink( $id ) );
84 84
 
85
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
85
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
86 86
 
87
-	if( empty( $permalink_args ) ) {
87
+	if ( empty( $permalink_args ) ) {
88 88
 		return array();
89 89
 	}
90 90
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
110 110
 
111 111
 	$output = '';
112
-	if( is_array( $current ) ) {
113
-		if( in_array( $value, $current ) ) {
112
+	if ( is_array( $current ) ) {
113
+		if ( in_array( $value, $current ) ) {
114 114
 			$output = __checked_selected_helper( true, true, false, $type );
115 115
 		}
116 116
 	} else {
117 117
 		$output = __checked_selected_helper( $value, $current, false, $type );
118 118
 	}
119 119
 
120
-	if( $echo ) {
120
+	if ( $echo ) {
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 }
126 126
 
127 127
 
128
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
128
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
129 129
 
130 130
 	/**
131 131
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function gravityview_strip_whitespace( $string ) {
173 173
 	$string = normalize_whitespace( $string );
174
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
174
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
175 175
 }
176 176
 
177 177
 /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string Included file contents
186 186
  */
187 187
 function gravityview_ob_include( $file_path, $object = NULL ) {
188
-	if( ! file_exists( $file_path ) ) {
188
+	if ( ! file_exists( $file_path ) ) {
189 189
 		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
190 190
 		return '';
191 191
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
 	$width = $height * 0.7586206897;
205 205
 
206
-	if( function_exists('is_rtl') && is_rtl() ) {
206
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
207 207
 		$style = 'margin:10px 10px 10px 0;';
208 208
 		$class = 'alignright';
209 209
 	} else {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$class = 'alignleft';
212 212
 	}
213 213
 
214
-	return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
214
+	return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
215 215
 }
216 216
 
217 217
 /**
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 function gravityview_number_format( $number, $decimals = '' ) {
235 235
 	global $wp_locale;
236 236
 
237
-	if( '' === $decimals ) {
237
+	if ( '' === $decimals ) {
238 238
 
239
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
239
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
240 240
 
241 241
 		/**
242 242
 		 * Calculate the position of the decimal point in the number
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	$parts = parse_url( $value );
266 266
 
267 267
 	// No domain? Strange...show the original text.
268
-	if( empty( $parts['host'] ) ) {
268
+	if ( empty( $parts[ 'host' ] ) ) {
269 269
 		return $value;
270 270
 	}
271 271
 
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
279 279
 	 * If true: `http://example.com => example.com`
280 280
 	 */
281
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
281
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
282 282
 
283
-		if( isset( $parts['scheme'] ) ) {
284
-			$return .= $parts['scheme'];
283
+		if ( isset( $parts[ 'scheme' ] ) ) {
284
+			$return .= $parts[ 'scheme' ];
285 285
 		}
286 286
 
287 287
 	}
288 288
 
289 289
 	// The domain, which may contain a subdomain
290
-	$domain = $parts['host'];
290
+	$domain = $parts[ 'host' ];
291 291
 
292 292
 	/**
293 293
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
296 296
 	 * If true: `www.example.com => example.com`
297 297
 	 */
298
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
298
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
299 299
 
300
-	if( $strip_www ) {
301
-		$domain = str_replace('www.', '', $domain );
300
+	if ( $strip_www ) {
301
+		$domain = str_replace( 'www.', '', $domain );
302 302
 	}
303 303
 
304 304
 	/**
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 	 * If true: `http://demo.example.com => example.com` \n
309 309
 	 * If false: `http://demo.example.com => demo.example.com`
310 310
 	 */
311
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
311
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
312 312
 
313
-	if( $strip_subdomains ) {
313
+	if ( $strip_subdomains ) {
314 314
 
315
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
315
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
316 316
 
317 317
 	}
318 318
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
327 327
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
328 328
 	 */
329
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
329
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
330 330
 
331
-	if( empty( $root_only ) ) {
331
+	if ( empty( $root_only ) ) {
332 332
 
333
-		if( isset( $parts['path'] ) ) {
334
-			$return .= $parts['path'];
333
+		if ( isset( $parts[ 'path' ] ) ) {
334
+			$return .= $parts[ 'path' ];
335 335
 		}
336 336
 	}
337 337
 
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
342 342
 	 * If true: `http://example.com/?query=example => example.com`
343 343
 	 */
344
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
344
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
345 345
 
346
-	if( empty( $strip_query_string ) ) {
346
+	if ( empty( $strip_query_string ) ) {
347 347
 
348
-		if( isset( $parts['query'] ) ) {
349
-			$return .= '?'.$parts['query'];
348
+		if ( isset( $parts[ 'query' ] ) ) {
349
+			$return .= '?' . $parts[ 'query' ];
350 350
 		}
351 351
 
352 352
 	}
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
  */
364 364
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
365 365
 
366
-	if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
367
-		return $matches['domain'];
366
+	if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
367
+		return $matches[ 'domain' ];
368 368
 	} else {
369 369
 		return $string_maybe_has_subdomain;
370 370
 	}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) {
387 387
 
388
-	if(
388
+	if (
389 389
 		! isset( $value ) // If it's not set, it's empty!
390 390
 		|| false === $value
391 391
 		|| null === $value
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 		return true;
397 397
 	}
398 398
 
399
-	if( is_string( $value ) && $allow_string_booleans ) {
399
+	if ( is_string( $value ) && $allow_string_booleans ) {
400 400
 
401 401
 		$value = trim( $value );
402 402
 		$value = strtolower( $value );
403 403
 
404 404
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
405 405
 			$value = true;
406
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
406
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
407 407
 			$value = false;
408 408
 		}
409 409
 	}
410 410
 
411 411
 	// If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false.
412
-	if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
412
+	if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
413 413
 		return false;
414 414
 	}
415 415
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 	// Use the original function, if exists.
434 434
 	// Requires WP 4.4+
435
-	if( function_exists( 'map_deep') ) {
435
+	if ( function_exists( 'map_deep' ) ) {
436 436
 		return map_deep( $value, $callback );
437 437
 	}
438 438
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
 	$exploded = explode( '.', "{$field_id}" );
499 499
 
500
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : false;
500
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false;
501 501
 }
502 502
 
503 503
 /**
@@ -538,13 +538,13 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
540 540
 
541
-	$terms = get_terms( $args['taxonomy'], $args );
541
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
542 542
 
543 543
 	$choices = array();
544 544
 
545 545
 	if ( is_array( $terms ) ) {
546 546
 		foreach ( $terms as $term_id => $term_name ) {
547
-			$choices[] = array(
547
+			$choices[ ] = array(
548 548
 				'text'  => $term_name,
549 549
 				'value' => $term_id
550 550
 			);
@@ -568,21 +568,21 @@  discard block
 block discarded – undo
568 568
 function _gravityview_process_posted_fields() {
569 569
 	$fields = array();
570 570
 
571
-	if( !empty( $_POST['fields'] ) ) {
572
-		if ( ! is_array( $_POST['fields'] ) ) {
571
+	if ( ! empty( $_POST[ 'fields' ] ) ) {
572
+		if ( ! is_array( $_POST[ 'fields' ] ) ) {
573 573
 
574 574
 			// We are not using parse_str() due to max_input_vars limitation with large View configurations
575 575
 			$fields_holder = array();
576
-			GVCommon::gv_parse_str( $_POST['fields'], $fields_holder );
576
+			GVCommon::gv_parse_str( $_POST[ 'fields' ], $fields_holder );
577 577
 
578
-			if ( isset( $fields_holder['fields'] ) ) {
579
-				$fields = $fields_holder['fields'];
578
+			if ( isset( $fields_holder[ 'fields' ] ) ) {
579
+				$fields = $fields_holder[ 'fields' ];
580 580
 			} else {
581 581
 				do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder );
582 582
 			}
583 583
 
584 584
 		} else {
585
-			$fields = $_POST['fields'];
585
+			$fields = $_POST[ 'fields' ];
586 586
 		}
587 587
 	}
588 588
 
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$label = '';
32 32
 
33
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
33
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
34 34
 
35
-			$label = $field['label'];
35
+			$label = $field[ 'label' ];
36 36
 
37 37
 			// Support Gravity Forms 1.9+
38
-			if( class_exists( 'GF_Field' ) ) {
38
+			if ( class_exists( 'GF_Field' ) ) {
39 39
 
40
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
40
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
41 41
 
42
-				if( $field_object ) {
42
+				if ( $field_object ) {
43 43
 
44
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
44
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
45 45
 
46 46
 					// This is a complex field, with labels on a per-input basis
47
-					if( $input ) {
47
+					if ( $input ) {
48 48
 
49 49
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
50
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
50
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
51 51
 
52 52
 					} else {
53 53
 
54 54
 						// This is a field with one label
55
-						$label = $field_object->get_field_label( true, $field['label'] );
55
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
56 56
 
57 57
 					}
58 58
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 			}
62 62
 
63 63
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
64
-			if ( !empty( $field['custom_label'] ) ) {
64
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
65 65
 
66
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
66
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
67 67
 
68 68
 			}
69 69
 
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$width = NULL;
119 119
 
120
-		if( !empty( $field['width'] ) ) {
121
-			$width = absint( $field['width'] );
120
+		if ( ! empty( $field[ 'width' ] ) ) {
121
+			$width = absint( $field[ 'width' ] );
122 122
 
123 123
 			// If using percentages, limit to 100%
124
-			if( '%d%%' === $format && $width > 100 ) {
124
+			if ( '%d%%' === $format && $width > 100 ) {
125 125
 				$width = 100;
126 126
 			}
127 127
 
@@ -144,39 +144,39 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$classes = array();
146 146
 
147
-		if( !empty( $field['custom_class'] ) ) {
147
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
148 148
 
149
-            $custom_class = $field['custom_class'];
149
+            $custom_class = $field[ 'custom_class' ];
150 150
 
151
-            if( !empty( $entry ) ) {
151
+            if ( ! empty( $entry ) ) {
152 152
 
153 153
                 // We want the merge tag to be formatted as a class. The merge tag may be
154 154
                 // replaced by a multiple-word value that should be output as a single class.
155 155
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
156
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
156
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
157 157
 
158
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
158
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
159 159
 
160 160
                 // And then we want life to return to normal
161
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
161
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
162 162
             }
163 163
 
164 164
 			// And now we want the spaces to be handled nicely.
165
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
165
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
166 166
 
167 167
 		}
168 168
 
169
-		if(!empty($field['id'])) {
170
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
171
-				$form_id = '-'.$form['id'];
169
+		if ( ! empty( $field[ 'id' ] ) ) {
170
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
171
+				$form_id = '-' . $form[ 'id' ];
172 172
 			} else {
173
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
173
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
174 174
 			}
175 175
 
176
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
176
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
177 177
 		}
178 178
 
179
-		return esc_attr(implode(' ', $classes));
179
+		return esc_attr( implode( ' ', $classes ) );
180 180
 	}
181 181
 
182 182
 	/**
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
195 195
 		$gravityview_view = GravityView_View::getInstance();
196
-		$id = $field['id'];
196
+		$id = $field[ 'id' ];
197 197
 
198 198
 		if ( ! empty( $id ) ) {
199
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
200
-				$form_id = '-' . $form['id'];
199
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
200
+				$form_id = '-' . $form[ 'id' ];
201 201
 			} else {
202 202
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
203 203
 			}
204 204
 
205
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
205
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
206 206
 		}
207 207
 
208 208
 		return esc_attr( $id );
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public static function field_value( $entry, $field_settings, $format = 'html' ) {
221 221
 
222
-		if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
222
+		if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
223 223
 			return NULL;
224 224
 		}
225 225
 
226 226
 		$gravityview_view = GravityView_View::getInstance();
227 227
 
228
-		$field_id = $field_settings['id'];
228
+		$field_id = $field_settings[ 'id' ];
229 229
 		$form = $gravityview_view->getForm();
230 230
 		$field = gravityview_get_field( $form, $field_id );
231 231
 
232
-		if( $field && is_numeric( $field_id ) ) {
232
+		if ( $field && is_numeric( $field_id ) ) {
233 233
 			// Used as file name of field template in GV.
234 234
 			// Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field
235 235
 			$field_type = $field->type;
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 		}
241 241
 
242 242
 		// If a Gravity Forms Field is found, get the field display
243
-		if( $field ) {
243
+		if ( $field ) {
244 244
 
245 245
 			// Prevent any PHP warnings that may be generated
246 246
 			ob_start();
247 247
 
248
-			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format );
248
+			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format );
249 249
 
250 250
 			if ( $errors = ob_get_clean() ) {
251 251
 				do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors );
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			$display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form );
255 255
 
256 256
 			// prevent the use of merge_tags for non-admin fields
257
-			if( !empty( $field->adminOnly ) ) {
257
+			if ( ! empty( $field->adminOnly ) ) {
258 258
 				$display_value = self::replace_variables( $display_value, $form, $entry );
259 259
 			}
260 260
 		} else {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 		// Check whether the field exists in /includes/fields/{$field_type}.php
266 266
 		// This can be overridden by user template files.
267
-		$field_path = $gravityview_view->locate_template("fields/{$field_type}.php");
267
+		$field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" );
268 268
 
269 269
 		// Set the field data to be available in the templates
270 270
 		$gravityview_view->setCurrentField( array(
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 			'entry' => $entry,
279 279
 			'field_type' => $field_type, /** {@since 1.6} */
280 280
 		    'field_path' => $field_path, /** {@since 1.16} */
281
-		));
281
+		) );
282 282
 
283
-		if( ! empty( $field_path ) ) {
283
+		if ( ! empty( $field_path ) ) {
284 284
 
285
-			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) );
285
+			do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) );
286 286
 
287 287
 			ob_start();
288 288
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		}
299 299
 
300 300
 		// Get the field settings again so that the field template can override the settings
301
-		$field_settings = $gravityview_view->getCurrentField('field_settings');
301
+		$field_settings = $gravityview_view->getCurrentField( 'field_settings' );
302 302
 
303 303
 		/**
304 304
 		 * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link`
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
 		 * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.
317 317
 		 *
318 318
 		 */
319
-		if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) {
319
+		if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) {
320 320
 
321
-			$link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' );
321
+			$link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' );
322 322
 
323 323
 			$output = self::entry_link_html( $entry, $output, $link_atts, $field_settings );
324 324
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		 * @param  array $field_settings Settings for the particular GV field
333 333
 		 * @param array $field Current field being displayed
334 334
 		 */
335
-		$output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
335
+		$output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
336 336
 
337 337
 		/**
338 338
 		 * @filter `gravityview_field_entry_value` Modify the field value output for all field types
@@ -361,14 +361,14 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) {
363 363
 
364
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
364
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
365 365
 			do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry );
366 366
 			return NULL;
367 367
 		}
368 368
 
369 369
 		$href = self::entry_link( $entry );
370 370
 
371
-		if( '' === $href ) {
371
+		if ( '' === $href ) {
372 372
 			return NULL;
373 373
 		}
374 374
 
@@ -391,19 +391,19 @@  discard block
 block discarded – undo
391 391
 	 * @param  boolean     $wpautop Apply wpautop() to the output?
392 392
 	 * @return string               HTML of "no results" text
393 393
 	 */
394
-	public static function no_results($wpautop = true) {
394
+	public static function no_results( $wpautop = true ) {
395 395
 		$gravityview_view = GravityView_View::getInstance();
396 396
 
397 397
 		$is_search = false;
398 398
 
399
-		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
399
+		if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
400 400
 			$is_search = true;
401 401
 		}
402 402
 
403
-		if($is_search) {
404
-			$output = __('This search returned no results.', 'gravityview');
403
+		if ( $is_search ) {
404
+			$output = __( 'This search returned no results.', 'gravityview' );
405 405
 		} else {
406
-			$output = __('No entries match your request.', 'gravityview');
406
+			$output = __( 'No entries match your request.', 'gravityview' );
407 407
 		}
408 408
 
409 409
 		/**
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
 		 * @param string $output The existing "No Entries" text
412 412
 		 * @param boolean $is_search Is the current page a search result, or just a multiple entries screen?
413 413
 		 */
414
-		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search);
414
+		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search );
415 415
 
416
-		return $wpautop ? wpautop($output) : $output;
416
+		return $wpautop ? wpautop( $output ) : $output;
417 417
 	}
418 418
 
419 419
 	/**
@@ -430,37 +430,37 @@  discard block
 block discarded – undo
430 430
 
431 431
 		$gravityview_view = GravityView_View::getInstance();
432 432
 
433
-		if( empty( $post_id ) ) {
433
+		if ( empty( $post_id ) ) {
434 434
 
435 435
 			$post_id = false;
436 436
 
437 437
 			// DataTables passes the Post ID
438
-			if( defined('DOING_AJAX') && DOING_AJAX ) {
438
+			if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
439 439
 
440
-				$post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false;
440
+				$post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false;
441 441
 
442 442
 			} else {
443 443
 
444 444
 				// The Post ID has been passed via the shortcode
445
-				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
445
+				if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
446 446
 
447 447
 					$post_id = $gravityview_view->getPostId();
448 448
 
449 449
 				} else {
450 450
 
451 451
 					// This is a GravityView post type
452
-					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
452
+					if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
453 453
 
454 454
 						$post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID;
455 455
 
456 456
 					} else {
457 457
 
458 458
 						// This is an embedded GravityView; use the embedded post's ID as the base.
459
-						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
459
+						if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
460 460
 
461 461
 							$post_id = $post->ID;
462 462
 
463
-						} elseif( $gravityview_view->getViewId() ) {
463
+						} elseif ( $gravityview_view->getViewId() ) {
464 464
 
465 465
 							// The GravityView has been embedded in a widget or in a template, and
466 466
 							// is not in the current content. Thus, we defer to the View's own ID.
@@ -475,36 +475,36 @@  discard block
 block discarded – undo
475 475
 		}
476 476
 
477 477
 		// No post ID, get outta here.
478
-		if( empty( $post_id ) ) {
478
+		if ( empty( $post_id ) ) {
479 479
 			return NULL;
480 480
 		}
481 481
 
482 482
 		// If we've saved the permalink in memory, use it
483 483
 		// @since 1.3
484
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
484
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
485 485
 
486
-		if( empty( $link ) ) {
486
+		if ( empty( $link ) ) {
487 487
 
488 488
 			$link = get_permalink( $post_id );
489 489
 
490 490
 			// If not yet saved, cache the permalink.
491 491
 			// @since 1.3
492
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
492
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
493 493
 
494 494
 		}
495 495
 
496 496
 		// Deal with returning to proper pagination for embedded views
497
-		if( $link && $add_query_args ) {
497
+		if ( $link && $add_query_args ) {
498 498
 
499 499
 			$args = array();
500 500
 
501
-			if( $pagenum = rgget('pagenum') ) {
502
-				$args['pagenum'] = intval( $pagenum );
501
+			if ( $pagenum = rgget( 'pagenum' ) ) {
502
+				$args[ 'pagenum' ] = intval( $pagenum );
503 503
 			}
504 504
 
505
-			if( $sort = rgget('sort') ) {
506
-				$args['sort'] = $sort;
507
-				$args['dir'] = rgget('dir');
505
+			if ( $sort = rgget( 'sort' ) ) {
506
+				$args[ 'sort' ] = $sort;
507
+				$args[ 'dir' ] = rgget( 'dir' );
508 508
 			}
509 509
 
510 510
 			$link = add_query_arg( $args, $link );
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
528 528
 
529 529
 		// Generate an unique hash to use as the default value
530
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
530
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
531 531
 
532 532
 		/**
533 533
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
539 539
 
540 540
 		// Make sure we have something - use the original ID as backup.
541
-		if( empty( $slug ) ) {
541
+		if ( empty( $slug ) ) {
542 542
 			$slug = $id;
543 543
 		}
544 544
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
568 568
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
569 569
 		 */
570
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
570
+		$custom = apply_filters( 'gravityview_custom_entry_slug', false );
571 571
 
572 572
 		// If we're using custom slug...
573 573
 		if ( $custom ) {
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 			// If it does have a hash set, and the hash is expected, use it.
582 582
 			// This check allows users to change the hash structure using the
583 583
 			// gravityview_entry_hash filter and have the old hashes expire.
584
-			if( empty( $value ) || $value !== $hash ) {
585
-				do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$id_or_string.'": ' . $hash );
584
+			if ( empty( $value ) || $value !== $hash ) {
585
+				do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $id_or_string . '": ' . $hash );
586 586
 				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
587 587
 			}
588 588
 
@@ -608,15 +608,15 @@  discard block
 block discarded – undo
608 608
          * @param boolean $custom Should we process the custom entry slug?
609 609
          */
610 610
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
611
-        if( $custom ) {
611
+        if ( $custom ) {
612 612
             // create the gravityview_unique_id and save it
613 613
 
614 614
             // Get the entry hash
615
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
615
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
616 616
 
617
-	        do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash );
617
+	        do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $entry[ 'id' ] . '": ' . $hash );
618 618
 
619
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
619
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
620 620
 
621 621
         }
622 622
     }
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) {
635 635
 
636
-		if( ! empty( $entry ) && ! is_array( $entry ) ) {
636
+		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
637 637
 			$entry = GVCommon::get_entry( $entry );
638
-		} else if( empty( $entry ) ) {
638
+		} else if ( empty( $entry ) ) {
639 639
 			$entry = GravityView_frontend::getInstance()->getEntry();
640 640
 		}
641 641
 
642 642
 		// Second parameter used to be passed as $field; this makes sure it's not an array
643
-		if( !is_numeric( $post_id ) ) {
643
+		if ( ! is_numeric( $post_id ) ) {
644 644
 			$post_id = NULL;
645 645
 		}
646 646
 
@@ -648,15 +648,15 @@  discard block
 block discarded – undo
648 648
 		$directory_link = self::directory_link( $post_id, false );
649 649
 
650 650
 		// No post ID? Get outta here.
651
-		if( empty( $directory_link ) ) {
651
+		if ( empty( $directory_link ) ) {
652 652
 			return '';
653 653
 		}
654 654
 
655 655
 		$query_arg_name = GravityView_Post_Types::get_entry_var_name();
656 656
 
657
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
657
+		$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
658 658
 
659
-		if( get_option('permalink_structure') && !is_preview() ) {
659
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
660 660
 
661 661
 			$args = array();
662 662
 
@@ -666,9 +666,9 @@  discard block
 block discarded – undo
666 666
 			 */
667 667
 			$link_parts = explode( '?', $directory_link );
668 668
 
669
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
669
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
670 670
 
671
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
671
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
672 672
 
673 673
 		} else {
674 674
 
@@ -678,18 +678,18 @@  discard block
 block discarded – undo
678 678
 		/**
679 679
 		 * @since 1.7.3
680 680
 		 */
681
-		if( $add_directory_args ) {
681
+		if ( $add_directory_args ) {
682 682
 
683
-			if( !empty( $_GET['pagenum'] ) ) {
684
-				$args['pagenum'] = intval( $_GET['pagenum'] );
683
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
684
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
685 685
 			}
686 686
 
687 687
 			/**
688 688
 			 * @since 1.7
689 689
 			 */
690
-			if( $sort = rgget('sort') ) {
691
-				$args['sort'] = $sort;
692
-				$args['dir'] = rgget('dir');
690
+			if ( $sort = rgget( 'sort' ) ) {
691
+				$args[ 'sort' ] = $sort;
692
+				$args[ 'dir' ] = rgget( 'dir' );
693 693
 			}
694 694
 
695 695
 		}
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 		 * has the view id so that Advanced Filters can be applied correctly when rendering the single view
700 700
 		 * @see GravityView_frontend::get_context_view_id()
701 701
 		 */
702
-		if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
703
-			$args['gvid'] = gravityview_get_view_id();
702
+		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
703
+			$args[ 'gvid' ] = gravityview_get_view_id();
704 704
 		}
705 705
 
706 706
 		return add_query_arg( $args, $directory_link );
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 }
719 719
 
720 720
 function gv_class( $field, $form = NULL, $entry = array() ) {
721
-	return GravityView_API::field_class( $field, $form, $entry  );
721
+	return GravityView_API::field_class( $field, $form, $entry );
722 722
 }
723 723
 
724 724
 /**
@@ -740,15 +740,15 @@  discard block
 block discarded – undo
740 740
 
741 741
 	$default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container';
742 742
 
743
-	if( GravityView_View::getInstance()->isHideUntilSearched() ) {
743
+	if ( GravityView_View::getInstance()->isHideUntilSearched() ) {
744 744
 		$default_css_class .= ' hidden';
745 745
 	}
746 746
 
747
-	if( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
747
+	if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
748 748
 		$default_css_class .= ' gv-container-no-results';
749 749
 	}
750 750
 
751
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
751
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
752 752
 
753 753
 	/**
754 754
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 
760 760
 	$css_class = gravityview_sanitize_html_class( $css_class );
761 761
 
762
-	if( $echo ) {
762
+	if ( $echo ) {
763 763
 		echo $css_class;
764 764
 	}
765 765
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
 	$value = GravityView_API::field_value( $entry, $field );
772 772
 
773
-	if( $value === '' ) {
773
+	if ( $value === '' ) {
774 774
 		/**
775 775
 		 * @filter `gravityview_empty_value` What to display when a field is empty
776 776
 		 * @param string $value (empty string)
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	return GravityView_API::entry_link( $entry, $post_id );
790 790
 }
791 791
 
792
-function gv_no_results($wpautop = true) {
792
+function gv_no_results( $wpautop = true ) {
793 793
 	return GravityView_API::no_results( $wpautop );
794 794
 }
795 795
 
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 
803 803
 	$href = gv_directory_link();
804 804
 
805
-	if( empty( $href ) ) { return NULL; }
805
+	if ( empty( $href ) ) { return NULL; }
806 806
 
807 807
 	// calculate link label
808 808
 	$gravityview_view = GravityView_View::getInstance();
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 
819 819
 	$link = gravityview_get_link( $href, esc_html( $label ), array(
820 820
 		'data-viewid' => $gravityview_view->getViewId()
821
-	));
821
+	) );
822 822
 
823 823
 	return $link;
824 824
 }
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
  */
838 838
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
839 839
 
840
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
840
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
841 841
 
842 842
 		// For the complete field value as generated by Gravity Forms
843 843
 		return $display_value;
@@ -867,16 +867,16 @@  discard block
 block discarded – undo
867 867
 
868 868
 	$terms = explode( ', ', $value );
869 869
 
870
-	foreach ($terms as $term_name ) {
870
+	foreach ( $terms as $term_name ) {
871 871
 
872 872
 		// If we're processing a category,
873
-		if( $taxonomy === 'category' ) {
873
+		if ( $taxonomy === 'category' ) {
874 874
 
875 875
 			// Use rgexplode to prevent errors if : doesn't exist
876 876
 			list( $term_name, $term_id ) = rgexplode( ':', $value, 2 );
877 877
 
878 878
 			// The explode was succesful; we have the category ID
879
-			if( !empty( $term_id )) {
879
+			if ( ! empty( $term_id ) ) {
880 880
 				$term = get_term_by( 'id', $term_id, $taxonomy );
881 881
 			} else {
882 882
 			// We have to fall back to the name
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 		}
890 890
 
891 891
 		// There's still a tag/category here.
892
-		if( $term ) {
892
+		if ( $term ) {
893 893
 
894 894
 			$term_link = get_term_link( $term, $taxonomy );
895 895
 
@@ -898,11 +898,11 @@  discard block
 block discarded – undo
898 898
 			    continue;
899 899
 			}
900 900
 
901
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
901
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
902 902
 		}
903 903
 	}
904 904
 
905
-	return implode(', ', $output );
905
+	return implode( ', ', $output );
906 906
 }
907 907
 
908 908
 /**
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 
917 917
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
918 918
 
919
-	if( empty( $link ) ) {
920
-		return strip_tags( $output);
919
+	if ( empty( $link ) ) {
920
+		return strip_tags( $output );
921 921
 	}
922 922
 
923 923
 	return $output;
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	$fe = GravityView_frontend::getInstance();
937 937
 
938 938
 	// Solve problem when loading content via admin-ajax.php
939
-	if( ! $fe->getGvOutputData() ) {
939
+	if ( ! $fe->getGvOutputData() ) {
940 940
 
941 941
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' );
942 942
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	}
945 945
 
946 946
 	// Make 100% sure that we're dealing with a properly called situation
947
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
947
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
948 948
 
949 949
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() );
950 950
 
@@ -964,10 +964,10 @@  discard block
 block discarded – undo
964 964
 
965 965
 	$fe = GravityView_frontend::getInstance();
966 966
 
967
-	if( ! $fe->getGvOutputData() ) { return array(); }
967
+	if ( ! $fe->getGvOutputData() ) { return array(); }
968 968
 
969 969
 	// If not set, grab the current view ID
970
-	if( empty( $view_id ) ) {
970
+	if ( empty( $view_id ) ) {
971 971
 		$view_id = $fe->get_context_view_id();
972 972
 	}
973 973
 
@@ -1032,11 +1032,11 @@  discard block
 block discarded – undo
1032 1032
 	 */
1033 1033
 	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
1034 1034
 
1035
-	if( $is_edit_entry ) {
1035
+	if ( $is_edit_entry ) {
1036 1036
 		$context = 'edit';
1037
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1037
+	} else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1038 1038
 		$context = 'single';
1039
-	} else if( class_exists( 'GravityView_View' ) ) {
1039
+	} else if ( class_exists( 'GravityView_View' ) ) {
1040 1040
 		$context = GravityView_View::getInstance()->getContext();
1041 1041
 	}
1042 1042
 
@@ -1064,12 +1064,12 @@  discard block
 block discarded – undo
1064 1064
 function gravityview_get_files_array( $value, $gv_class = '' ) {
1065 1065
 	/** @define "GRAVITYVIEW_DIR" "../" */
1066 1066
 
1067
-	if( !class_exists( 'GravityView_Field' ) ) {
1068
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1067
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1068
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1069 1069
 	}
1070 1070
 
1071
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1072
-		include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' );
1071
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1072
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' );
1073 1073
 	}
1074 1074
 
1075 1075
 	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class );
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
 	$args = apply_filters( 'gravityview/field_output/args', $args, $passed_args );
1148 1148
 
1149 1149
 	// Required fields.
1150
-	if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1150
+	if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1151 1151
 		do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args );
1152 1152
 		return '';
1153 1153
 	}
1154 1154
 
1155
-	$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1155
+	$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1156 1156
 
1157 1157
 	/**
1158 1158
 	 * Create the content variables for replacing.
@@ -1168,37 +1168,37 @@  discard block
 block discarded – undo
1168 1168
 		'field_id' => '',
1169 1169
 	);
1170 1170
 
1171
-	$context['value'] = gv_value( $entry, $args['field'] );
1171
+	$context[ 'value' ] = gv_value( $entry, $args[ 'field' ] );
1172 1172
 
1173 1173
 	// If the value is empty and we're hiding empty, return empty.
1174
-	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1174
+	if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1175 1175
 		return '';
1176 1176
 	}
1177 1177
 
1178
-	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1179
-		$context['value'] = wpautop( $context['value'] );
1178
+	if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1179
+		$context[ 'value' ] = wpautop( $context[ 'value' ] );
1180 1180
 	}
1181 1181
 
1182 1182
 	// Get width setting, if exists
1183
-	$context['width'] = GravityView_API::field_width( $args['field'] );
1183
+	$context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] );
1184 1184
 
1185 1185
 	// If replacing with CSS inline formatting, let's do it.
1186
-	$context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' );
1186
+	$context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' );
1187 1187
 
1188 1188
 	// Grab the Class using `gv_class`
1189
-	$context['class'] = gv_class( $args['field'], $args['form'], $entry );
1190
-	$context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry );
1189
+	$context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry );
1190
+	$context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry );
1191 1191
 
1192 1192
 	// Get field label if needed
1193
-	if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) {
1194
-		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1193
+	if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) {
1194
+		$context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] );
1195 1195
 	}
1196 1196
 
1197 1197
 	// Default Label value
1198
-	$context['label_value'] = gv_label( $args['field'], $entry );
1198
+	$context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry );
1199 1199
 
1200
-	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){
1201
-		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1200
+	if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) {
1201
+		$context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1202 1202
 	}
1203 1203
 
1204 1204
 	/**
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 	 * @param string $markup The HTML for the markup
1208 1208
 	 * @param array $args All args for the field output
1209 1209
 	 */
1210
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args );
1210
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args );
1211 1211
 
1212 1212
 	/**
1213 1213
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 	foreach ( $context as $tag => $value ) {
1231 1231
 
1232 1232
 		// If the tag doesn't exist just skip it
1233
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1233
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1234 1234
 			continue;
1235 1235
 		}
1236 1236
 
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 		/** gf_entries page - entries table screen */
44 44
 
45 45
 		// capture bulk actions
46
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
46
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
47 47
 
48 48
 		// add hidden field with approve status
49 49
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
50 50
 
51 51
 		// process ajax approve entry requests
52
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
52
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
53 53
 
54 54
 		// when using the User opt-in field, check on entry submission
55 55
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
56 56
 
57 57
 		// in case entry is edited (on admin or frontend)
58
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
58
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
59 59
 
60 60
 
61 61
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
62 62
 
63 63
 		// adding styles and scripts
64
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
64
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
65 65
 		// bypass Gravity Forms no-conflict mode
66 66
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
67 67
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
91 91
 		 * @param array $form GF Form object of current form
92 92
 		 */
93
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
93
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
94 94
 			return $filter_links;
95 95
 		}
96 96
 
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
 		$approved_count = $disapproved_count = 0;
112 112
 
113 113
 		// Only count if necessary
114
-		if( $include_counts ) {
115
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
114
+		if ( $include_counts ) {
115
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
117 117
 		}
118 118
 
119
-		$filter_links[] = array(
119
+		$filter_links[ ] = array(
120 120
 			'id'            => 'gv_approved',
121 121
 			'field_filters' => $field_filters_approved,
122 122
 			'count'         => $approved_count,
123 123
 			'label'         => esc_html__( 'Approved', 'gravityview' ),
124 124
 		);
125 125
 
126
-		$filter_links[] = array(
126
+		$filter_links[ ] = array(
127 127
 			'id'            => 'gv_disapproved',
128 128
 			'field_filters' => $field_filters_disapproved,
129 129
 			'count'         => $disapproved_count,
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function tooltips( $tooltips ) {
144 144
 
145
-		$tooltips['form_gravityview_fields'] = array(
146
-			'title' => __('GravityView Fields', 'gravityview'),
147
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
145
+		$tooltips[ 'form_gravityview_fields' ] = array(
146
+			'title' => __( 'GravityView Fields', 'gravityview' ),
147
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
148 148
 		);
149 149
 
150 150
 		return $tooltips;
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$gv_bulk_action = false;
257 257
 
258
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
-			$bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2');
258
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
+			$bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' );
260 260
 		} else {
261 261
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
262
-			$bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2');
262
+			$bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' );
263 263
 		}
264 264
 
265 265
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
266
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
266
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
267 267
 			$gv_bulk_action = $bulk_action;
268 268
 		}
269 269
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		
289 289
 		// gforms_entry_list is the nonce that confirms we're on the right page
290 290
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
291
-		if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) {
291
+		if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
292 292
 
293 293
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
294 294
 
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 			}
307 307
 
308 308
 			// All entries are set to be updated, not just the visible ones
309
-			if ( ! empty( $_POST['all_entries'] ) ) {
309
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
310 310
 
311 311
 				// Convert the current entry search into GF-formatted search criteria
312 312
 				$search = array(
313
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
314
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
315
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
313
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
314
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
315
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
316 316
 				);
317 317
 
318 318
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			} else {
324 324
 
325 325
 				// Changed from 'lead' to 'entry' in 2.0
326
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
326
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
327 327
 
328 328
 			}
329 329
 
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
336 336
 
337 337
 			switch ( $approved_status ) {
338
-				case $this->bulk_action_prefixes['approve']:
338
+				case $this->bulk_action_prefixes[ 'approve' ]:
339 339
 					self::update_bulk( $entries, 1, $form_id );
340 340
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
341 341
 					break;
342 342
 
343
-				case $this->bulk_action_prefixes['unapprove']:
343
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
344 344
 					self::update_bulk( $entries, 0, $form_id );
345 345
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
346 346
 					break;
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	private static function update_bulk( $entries, $approved, $form_id ) {
366 366
 
367
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
367
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
368 368
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
369 369
 			return false;
370 370
 		}
371 371
 
372
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
372
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
373 373
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
374 374
 			return false;
375 375
 		}
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		// calculate approved field id once instead of looping through in the update_approved() method
380 380
 		$approved_column_id = self::get_approved_column( $form_id );
381 381
 
382
-		foreach( $entries as $entry_id ) {
382
+		foreach ( $entries as $entry_id ) {
383 383
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
384 384
 		}
385 385
 	}
@@ -398,14 +398,14 @@  discard block
 block discarded – undo
398 398
 	 * @param int $approvedcolumn (default: 0)
399 399
 	 * @return boolean True: It worked; False: it failed
400 400
 	 */
401
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
401
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
402 402
 
403
-		if( !class_exists( 'GFAPI' ) ) {
403
+		if ( ! class_exists( 'GFAPI' ) ) {
404 404
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
405 405
 			return false;
406 406
 		}
407 407
 
408
-		if( empty( $approvedcolumn ) ) {
408
+		if ( empty( $approvedcolumn ) ) {
409 409
 			$approvedcolumn = self::get_approved_column( $form_id );
410 410
 		}
411 411
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		self::update_approved_meta( $entry_id, $approved, $form_id );
425 425
 
426 426
 		// add note to entry
427
-		if( $result === true ) {
427
+		if ( $result === true ) {
428 428
 
429 429
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
430 430
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			 */
436 436
 			$add_note = apply_filters( 'gravityview/approve_entries/add-note', true );
437 437
 
438
-			if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
438
+			if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
439 439
 				$current_user = wp_get_current_user();
440 440
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
441 441
 			}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			 */
448 448
 			do_action( 'gravityview_clear_form_cache', $form_id );
449 449
 
450
-		} else if( is_wp_error( $result ) ) {
450
+		} else if ( is_wp_error( $result ) ) {
451 451
 
452 452
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
453 453
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @param $form array Gravity Forms form object
469 469
 	 */
470 470
 	public function after_submission( $entry, $form ) {
471
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
471
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
472 472
 	}
473 473
 
474 474
 
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
486 486
 
487
-		$approvedcolumn = self::get_approved_column( $form['id'] );
487
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
488 488
 
489 489
         /**
490 490
          * If the form doesn't contain the approve field, don't assume anything.
491 491
          */
492
-        if( empty( $approvedcolumn ) ) {
492
+        if ( empty( $approvedcolumn ) ) {
493 493
             return;
494 494
         }
495 495
 
496 496
 		$entry = GFAPI::get_entry( $entry_id );
497 497
 
498
-		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form['id'] );
498
+		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form[ 'id' ] );
499 499
 
500 500
 	}
501 501
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		$is_approved = empty( $is_approved ) ? 0 : 'Approved';
521 521
 
522 522
 		// update entry meta
523
-		if( function_exists('gform_update_meta') ) {
523
+		if ( function_exists( 'gform_update_meta' ) ) {
524 524
 
525 525
 			gform_update_meta( $entry_id, 'is_approved', $is_approved, $form_id );
526 526
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 			 */
533 533
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
534 534
 
535
-			if( empty( $is_approved ) ) {
535
+			if ( empty( $is_approved ) ) {
536 536
 
537 537
 				/**
538 538
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 		} else {
556 556
 
557
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
557
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
558 558
 
559 559
 		}
560 560
 	}
@@ -566,21 +566,21 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	public function ajax_update_approved() {
568 568
 
569
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
569
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
570 570
 
571 571
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
572 572
 
573 573
 			$result = false;
574 574
 		}
575 575
 
576
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
576
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
577 577
 
578 578
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
579 579
 
580 580
 			$result = false;
581 581
 		}
582 582
 
583
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
583
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
584 584
 
585 585
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
586 586
 
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
 
590 590
 		else {
591 591
 
592
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
592
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
593 593
 
594
-			if( is_wp_error( $result ) ) {
594
+			if ( is_wp_error( $result ) ) {
595 595
 				/** @var WP_Error $result */
596
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
596
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
597 597
 				$result = false;
598 598
 			}
599 599
 
@@ -613,29 +613,29 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	static public function get_approved_column( $form ) {
615 615
 
616
-        if( empty( $form ) ) {
616
+        if ( empty( $form ) ) {
617 617
             return null;
618 618
         }
619 619
 
620
-        if( !is_array( $form ) ) {
620
+        if ( ! is_array( $form ) ) {
621 621
             $form = GVCommon::get_form( $form );
622 622
         }
623 623
 
624
-		foreach( $form['fields'] as $key => $field ) {
624
+		foreach ( $form[ 'fields' ] as $key => $field ) {
625 625
 
626
-            $field = (array) $field;
626
+            $field = (array)$field;
627 627
 
628
-			if( !empty( $field['gravityview_approved'] ) ) {
629
-				if( !empty($field['inputs'][0]['id']) ) {
630
-					return $field['inputs'][0]['id'];
628
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
629
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
630
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
631 631
 				}
632 632
 			}
633 633
 
634 634
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
635
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
636
-                foreach ( $field['inputs'] as $key2 => $input ) {
637
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
638
-                        return $input['id'];
635
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
636
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
637
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
638
+                        return $input[ 'id' ];
639 639
                     }
640 640
                 }
641 641
             }
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
 	 *
658 658
 	 * @return void
659 659
 	 */
660
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
660
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
661 661
 
662
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
662
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
663 663
 			return;
664 664
 		}
665 665
 
666
-		if( empty( $entry['id'] ) ) {
666
+		if ( empty( $entry[ 'id' ] ) ) {
667 667
 			return;
668 668
 		}
669 669
 
670
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
671
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
670
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
671
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
672 672
 		}
673 673
 	}
674 674
 
@@ -681,13 +681,13 @@  discard block
 block discarded – undo
681 681
 	 */
682 682
 	private function get_form_id() {
683 683
 
684
-		$form_id = GFForms::get('id');
684
+		$form_id = GFForms::get( 'id' );
685 685
 
686 686
 		// If there are no forms identified, use the first form. That's how GF does it.
687
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
687
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
688 688
 			$forms = gravityview_get_forms();
689
-			if( !empty( $forms ) ) {
690
-				$form_id = $forms[0]['id'];
689
+			if ( ! empty( $forms ) ) {
690
+				$form_id = $forms[ 0 ][ 'id' ];
691 691
 			}
692 692
 		}
693 693
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 
698 698
 	function add_scripts_and_styles( $hook ) {
699 699
 
700
-		if( ! class_exists( 'RGForms' ) ) {
700
+		if ( ! class_exists( 'RGForms' ) ) {
701 701
 
702 702
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
703 703
 
@@ -706,29 +706,29 @@  discard block
 block discarded – undo
706 706
 
707 707
 		// enqueue styles & scripts gf_entries
708 708
 		// But only if we're on the main Entries page, not on reports pages
709
-		if( GFForms::get_page() !== 'entry_list' ) {
709
+		if ( GFForms::get_page() !== 'entry_list' ) {
710 710
 			return;
711 711
 		}
712 712
 
713 713
 		$form_id = $this->get_form_id();
714 714
 
715
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
715
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
716 716
 
717
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
717
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
718 718
 
719
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
719
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
720 720
 
721 721
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
722
-			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
722
+			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
723 723
 			'form_id' => $form_id,
724 724
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
725 725
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
726 726
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
727 727
 			'bulk_message' => $this->bulk_update_message,
728
-			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
729
-			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
730
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
731
-			'column_link' => esc_url( add_query_arg( array('sort' => self::get_approved_column( $form_id ) ) ) ),
728
+			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
729
+			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
730
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
731
+			'column_link' => esc_url( add_query_arg( array( 'sort' => self::get_approved_column( $form_id ) ) ) ),
732 732
 		) );
733 733
 
734 734
 	}
@@ -748,11 +748,11 @@  discard block
 block discarded – undo
748 748
 			'GravityView' => array(
749 749
 				array(
750 750
 					'label' => __( 'Approve', 'gravityview' ),
751
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
751
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
752 752
 				),
753 753
 				array(
754 754
 					'label' => __( 'Disapprove', 'gravityview' ),
755
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
755
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
756 756
 				),
757 757
 			),
758 758
 		);
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 		// Sanitize the values, just to be sure.
770 770
 		foreach ( $bulk_actions as $key => $group ) {
771 771
 			foreach ( $group as $i => $action ) {
772
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
773
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
772
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
773
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
774 774
 			}
775 775
 		}
776 776
 
@@ -795,13 +795,13 @@  discard block
 block discarded – undo
795 795
 		 * @since 1.7.2
796 796
 		 * @param boolean $hide_if_no_connections
797 797
 		 */
798
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
798
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
799 799
 
800
-		if( $hide_if_no_connections ) {
800
+		if ( $hide_if_no_connections ) {
801 801
 
802 802
 			$connected_views = gravityview_get_connected_views( $form_id );
803 803
 
804
-			if( empty( $connected_views ) ) {
804
+			if ( empty( $connected_views ) ) {
805 805
 				$show_approve_column = false;
806 806
 			}
807 807
 		}
@@ -811,18 +811,18 @@  discard block
 block discarded – undo
811 811
 		 * @param boolean $show_approve_column Whether the column will be shown
812 812
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
813 813
 		 */
814
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
814
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
815 815
 
816 816
 		return $show_approve_column;
817 817
 	}
818 818
 
819 819
 	function register_gform_noconflict_script( $scripts ) {
820
-		$scripts[] = 'gravityview_gf_entries_scripts';
820
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
821 821
 		return $scripts;
822 822
 	}
823 823
 
824 824
 	function register_gform_noconflict_style( $styles ) {
825
-		$styles[] = 'gravityview_entries_list';
825
+		$styles[ ] = 'gravityview_entries_list';
826 826
 		return $styles;
827 827
 	}
828 828
 
Please login to merge, or discard this patch.