Completed
Push — master ( 45ba98...c3b0cd )
by Stephanie
04:13
created
classes/helpers/FrmAppHelper.php 2 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -57,6 +57,9 @@  discard block
 block discarded – undo
57 57
         return get_option('blogname');
58 58
     }
59 59
 
60
+	/**
61
+	 * @param string $url
62
+	 */
60 63
 	public static function make_affiliate_url( $url ) {
61 64
 		$affiliate_id = apply_filters( 'frm_affiliate_link', '' );
62 65
 		$allowed_affiliates = array('Mojo');
@@ -752,6 +755,9 @@  discard block
 block discarded – undo
752 755
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
753 756
     }
754 757
 
758
+	/**
759
+	 * @param string $function
760
+	 */
755 761
 	public static function recursive_function_map( $value, $function ) {
756 762
 		if ( is_array( $value ) ) {
757 763
 			$original_function = $function;
@@ -1179,6 +1185,9 @@  discard block
 block discarded – undo
1179 1185
         return $sub . (($len < $original_len) ? $continue : '');
1180 1186
     }
1181 1187
 
1188
+	/**
1189
+	 * @param string[] $function_names
1190
+	 */
1182 1191
 	public static function mb_function( $function_names, $args ) {
1183 1192
 		$mb_function_name = $function_names[0];
1184 1193
 		$function_name = $function_names[1];
@@ -1212,6 +1221,9 @@  discard block
 block discarded – undo
1212 1221
         return $formatted;
1213 1222
     }
1214 1223
 
1224
+	/**
1225
+	 * @param string $time_format
1226
+	 */
1215 1227
 	private static function add_time_to_date( $time_format, $date ) {
1216 1228
 		if ( empty( $time_format ) ) {
1217 1229
 			$time_format = get_option('time_format');
Please login to merge, or discard this patch.
Spacing   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
     }
24 24
 
25 25
     public static function plugin_folder() {
26
-        return basename(self::plugin_path());
26
+        return basename( self::plugin_path() );
27 27
     }
28 28
 
29 29
     public static function plugin_path() {
30
-        return dirname(dirname(dirname(__FILE__)));
30
+        return dirname( dirname( dirname( __FILE__ ) ) );
31 31
     }
32 32
 
33 33
     public static function plugin_url() {
34 34
         //prevously FRM_URL constant
35
-        return plugins_url( '', self::plugin_path() .'/formidable.php' );
35
+        return plugins_url( '', self::plugin_path() . '/formidable.php' );
36 36
     }
37 37
 
38 38
 	public static function relative_plugin_url() {
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
      * @return string
55 55
      */
56 56
     public static function site_name() {
57
-        return get_option('blogname');
57
+        return get_option( 'blogname' );
58 58
     }
59 59
 
60 60
 	public static function make_affiliate_url( $url ) {
61 61
 		$affiliate_id = apply_filters( 'frm_affiliate_link', '' );
62
-		$allowed_affiliates = array('Mojo');
62
+		$allowed_affiliates = array( 'Mojo' );
63 63
 		if ( in_array( $affiliate_id, $allowed_affiliates ) ) {
64 64
 			$url .= '?aff=' . $affiliate_id;
65 65
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public static function get_settings() {
78 78
         global $frm_settings;
79
-        if ( empty($frm_settings) ) {
79
+        if ( empty( $frm_settings ) ) {
80 80
             $frm_settings = new FrmSettings();
81 81
         }
82 82
         return $frm_settings;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     }
93 93
 
94 94
     public static function pro_is_installed() {
95
-        return apply_filters('frm_pro_installed', false);
95
+        return apply_filters( 'frm_pro_installed', false );
96 96
     }
97 97
 
98 98
     /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @return boolean
137 137
      */
138 138
     public static function doing_ajax() {
139
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
139
+        return defined( 'DOING_AJAX' ) && DOING_AJAX && ! self::is_preview_page();
140 140
     }
141 141
 
142 142
 	/**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @return boolean
157 157
      */
158 158
     public static function is_admin() {
159
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
159
+        return is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX );
160 160
     }
161 161
 
162 162
     /**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @return string
183 183
      */
184 184
 	public static function get_server_value( $value ) {
185
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
185
+        return isset( $_SERVER[$value] ) ? wp_strip_all_tags( $_SERVER[$value] ) : '';
186 186
     }
187 187
 
188 188
     /**
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
             'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
198 198
             'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
199 199
         ) as $key ) {
200
-            if ( ! isset( $_SERVER[ $key ] ) ) {
200
+            if ( ! isset( $_SERVER[$key] ) ) {
201 201
                 continue;
202 202
             }
203 203
 
204
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
205
-                $ip = trim($ip); // just to be safe
204
+            foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
205
+                $ip = trim( $ip ); // just to be safe
206 206
 
207
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
207
+                if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
208 208
                     return $ip;
209 209
                 }
210 210
             }
@@ -214,15 +214,15 @@  discard block
 block discarded – undo
214 214
     }
215 215
 
216 216
     public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
217
-        if ( strpos($param, '[') ) {
218
-            $params = explode('[', $param);
217
+        if ( strpos( $param, '[' ) ) {
218
+            $params = explode( '[', $param );
219 219
             $param = $params[0];
220 220
         }
221 221
 
222 222
 		if ( $src == 'get' ) {
223
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
224
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
225
-                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
223
+            $value = isset( $_POST[$param] ) ? stripslashes_deep( $_POST[$param] ) : ( isset( $_GET[$param] ) ? stripslashes_deep( $_GET[$param] ) : $default );
224
+            if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
225
+                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[$param] ) ) );
226 226
             }
227 227
 			self::sanitize_value( $sanitize, $value );
228 228
 		} else {
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 
232 232
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
233 233
             foreach ( $params as $k => $p ) {
234
-                if ( ! $k || ! is_array($value) ) {
234
+                if ( ! $k || ! is_array( $value ) ) {
235 235
                     continue;
236 236
                 }
237 237
 
238
-                $p = trim($p, ']');
239
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
238
+                $p = trim( $p, ']' );
239
+                $value = isset( $value[$p] ) ? $value[$p] : $default;
240 240
             }
241 241
         }
242 242
 
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 
279 279
 		$value = $args['default'];
280 280
 		if ( $args['type'] == 'get' ) {
281
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
282
-				$value = $_GET[ $args['param'] ];
281
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
282
+				$value = $_GET[$args['param']];
283 283
 			}
284 284
 		} else if ( $args['type'] == 'post' ) {
285
-			if ( isset( $_POST[ $args['param'] ] ) ) {
286
-				$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
285
+			if ( isset( $_POST[$args['param']] ) ) {
286
+				$value = stripslashes_deep( maybe_unserialize( $_POST[$args['param']] ) );
287 287
 			}
288 288
 		} else {
289
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
290
-				$value = $_REQUEST[ $args['param'] ];
289
+			if ( isset( $_REQUEST[$args['param']] ) ) {
290
+				$value = $_REQUEST[$args['param']];
291 291
 			}
292 292
 		}
293 293
 
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
     public static function sanitize_request( $sanitize_method, &$values ) {
324 324
         $temp_values = $values;
325 325
         foreach ( $temp_values as $k => $val ) {
326
-            if ( isset( $sanitize_method[ $k ] ) ) {
327
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
326
+            if ( isset( $sanitize_method[$k] ) ) {
327
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
328 328
             }
329 329
         }
330 330
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	public static function sanitize_array( &$values ) {
333 333
 		$temp_values = $values;
334 334
 		foreach ( $temp_values as $k => $val ) {
335
-			$values[ $k ] = wp_kses_post( $val );
335
+			$values[$k] = wp_kses_post( $val );
336 336
 		}
337 337
 	}
338 338
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 		$allowed_html = array();
354 354
 		foreach ( $allowed as $a ) {
355
-			$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
355
+			$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
356 356
 		}
357 357
 
358 358
 		return wp_kses( $value, $allowed_html );
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
      * @since 2.0
364 364
      */
365 365
     public static function remove_get_action() {
366
-        if ( ! isset($_GET) ) {
366
+        if ( ! isset( $_GET ) ) {
367 367
             return;
368 368
         }
369 369
 
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
         }
386 386
 
387 387
         global $wp_query;
388
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
389
-            $value = $wp_query->query_vars[ $param ];
388
+        if ( isset( $wp_query->query_vars[$param] ) ) {
389
+            $value = $wp_query->query_vars[$param];
390 390
         }
391 391
 
392 392
         return $value;
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
      */
398 398
     public static function trigger_hook_load( $type, $object = null ) {
399 399
         // only load the form hooks once
400
-        $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
400
+        $hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
401 401
         if ( ! $hooks_loaded ) {
402
-            do_action('frm_load_'. $type .'_hooks');
402
+            do_action( 'frm_load_' . $type . '_hooks' );
403 403
         }
404 404
     }
405 405
 
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
      * @return mixed $results The cache or query results
416 416
      */
417 417
     public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
418
-        $results = wp_cache_get($cache_key, $group);
419
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
418
+        $results = wp_cache_get( $cache_key, $group );
419
+        if ( ! self::is_empty_value( $results, false ) || empty( $query ) ) {
420 420
             return $results;
421 421
         }
422 422
 
423 423
         if ( 'get_posts' == $type ) {
424
-            $results = get_posts($query);
424
+            $results = get_posts( $query );
425 425
         } else {
426 426
             global $wpdb;
427
-            $results = $wpdb->{$type}($query);
427
+            $results = $wpdb->{$type}( $query );
428 428
         }
429 429
 
430 430
 		if ( ! self::prevent_caching() ) {
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
         }
449 449
 
450 450
         // then check the transient
451
-        $results = get_transient($cache_key);
451
+        $results = get_transient( $cache_key );
452 452
         if ( $results ) {
453
-            wp_cache_set($cache_key, $results);
453
+            wp_cache_set( $cache_key, $results );
454 454
         }
455 455
 
456 456
         return $results;
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
      * @param string $cache_key
462 462
      */
463 463
 	public static function delete_cache_and_transient( $cache_key ) {
464
-        delete_transient($cache_key);
465
-        wp_cache_delete($cache_key);
464
+        delete_transient( $cache_key );
465
+        wp_cache_delete( $cache_key );
466 466
     }
467 467
 
468 468
     /**
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
 	public static function cache_delete_group( $group ) {
477 477
     	global $wp_object_cache;
478 478
 
479
-        if ( isset( $wp_object_cache->cache[ $group ] ) ) {
480
-            foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
481
-                wp_cache_delete($k, $group);
479
+        if ( isset( $wp_object_cache->cache[$group] ) ) {
480
+            foreach ( $wp_object_cache->cache[$group] as $k => $v ) {
481
+                wp_cache_delete( $k, $group );
482 482
             }
483 483
             return true;
484 484
         }
@@ -509,29 +509,29 @@  discard block
 block discarded – undo
509 509
 	public static function load_scripts( $scripts ) {
510 510
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
511 511
         foreach ( (array) $scripts as $s ) {
512
-            wp_enqueue_script($s);
512
+            wp_enqueue_script( $s );
513 513
         }
514 514
     }
515 515
 
516 516
 	public static function load_styles( $styles ) {
517 517
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
518 518
         foreach ( (array) $styles as $s ) {
519
-            wp_enqueue_style($s);
519
+            wp_enqueue_style( $s );
520 520
         }
521 521
     }
522 522
 
523 523
     public static function get_pages() {
524
-		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
524
+		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => - 1, 'orderby' => 'title', 'order' => 'ASC' ) );
525 525
     }
526 526
 
527 527
     public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
528 528
         $pages = self::get_pages();
529 529
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
530 530
     ?>
531
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
531
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
532 532
             <option value=""> </option>
533 533
             <?php foreach ( $pages as $page ) { ?>
534
-				<option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
534
+				<option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $selected, $page->ID ) ?>>
535 535
 					<?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
536 536
 				</option>
537 537
             <?php } ?>
@@ -540,26 +540,26 @@  discard block
 block discarded – undo
540 540
     }
541 541
 
542 542
 	public static function post_edit_link( $post_id ) {
543
-        $post = get_post($post_id);
543
+        $post = get_post( $post_id );
544 544
         if ( $post ) {
545
-            return '<a href="'. esc_url(admin_url('post.php') .'?post='. $post_id .'&action=edit') .'">'. self::truncate($post->post_title, 50) .'</a>';
545
+            return '<a href="' . esc_url( admin_url( 'post.php' ) . '?post=' . $post_id . '&action=edit' ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
546 546
         }
547 547
         return '';
548 548
     }
549 549
 
550 550
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
551 551
     ?>
552
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
552
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" <?php
553 553
             echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
554 554
             ?> class="frm_multiselect">
555
-            <?php self::roles_options($capability); ?>
555
+            <?php self::roles_options( $capability ); ?>
556 556
         </select>
557 557
     <?php
558 558
     }
559 559
 
560 560
 	public static function roles_options( $capability ) {
561 561
         global $frm_vars;
562
-        if ( isset($frm_vars['editable_roles']) ) {
562
+        if ( isset( $frm_vars['editable_roles'] ) ) {
563 563
             $editable_roles = $frm_vars['editable_roles'];
564 564
         } else {
565 565
             $editable_roles = get_editable_roles();
@@ -567,10 +567,10 @@  discard block
 block discarded – undo
567 567
         }
568 568
 
569 569
         foreach ( $editable_roles as $role => $details ) {
570
-            $name = translate_user_role($details['name'] ); ?>
571
-        <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
570
+            $name = translate_user_role( $details['name'] ); ?>
571
+        <option value="<?php echo esc_attr( $role ) ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ) ?> </option>
572 572
 <?php
573
-            unset($role, $details);
573
+            unset( $role, $details );
574 574
         }
575 575
     }
576 576
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     public static function maybe_add_permissions() {
627 627
 		self::force_capability( 'frm_view_entries' );
628 628
 
629
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
629
+        if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
630 630
             return;
631 631
         }
632 632
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
         $frm_roles = self::frm_capabilities();
636 636
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
637 637
 			$user->add_cap( $frm_role );
638
-            unset($frm_role, $frm_role_description);
638
+            unset( $frm_role, $frm_role_description );
639 639
         }
640 640
     }
641 641
 
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
      * @param string $permission
661 661
      */
662 662
 	public static function permission_check( $permission, $show_message = 'show' ) {
663
-        $permission_error = self::permission_nonce_error($permission);
663
+        $permission_error = self::permission_nonce_error( $permission );
664 664
         if ( $permission_error !== false ) {
665 665
             if ( 'hide' == $show_message ) {
666 666
                 $permission_error = '';
667 667
             }
668
-            wp_die($permission_error);
668
+            wp_die( $permission_error );
669 669
         }
670 670
     }
671 671
 
@@ -682,11 +682,11 @@  discard block
 block discarded – undo
682 682
 		}
683 683
 
684 684
 		$error = false;
685
-        if ( empty($nonce_name) ) {
685
+        if ( empty( $nonce_name ) ) {
686 686
             return $error;
687 687
         }
688 688
 
689
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
689
+        if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $_REQUEST[$nonce_name], $nonce ) ) ) {
690 690
             $frm_settings = self::get_settings();
691 691
             $error = $frm_settings->admin_permission;
692 692
         }
@@ -702,9 +702,9 @@  discard block
 block discarded – undo
702 702
 
703 703
 	public static function check_selected( $values, $current ) {
704 704
         $values = self::recursive_function_map( $values, 'trim' );
705
-        $current = trim($current);
705
+        $current = trim( $current );
706 706
 
707
-        return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
707
+        return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
708 708
     }
709 709
 
710 710
     /**
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 			} else {
766 766
 				foreach ( $value as $k => $v ) {
767 767
 					if ( ! is_array( $v ) ) {
768
-						$value[ $k ] = call_user_func( $original_function, $v );
768
+						$value[$k] = call_user_func( $original_function, $v );
769 769
 					}
770 770
 				}
771 771
 			}
@@ -786,11 +786,11 @@  discard block
 block discarded – undo
786 786
 	public static function array_flatten( $array, $keys = 'keep' ) {
787 787
         $return = array();
788 788
         foreach ( $array as $key => $value ) {
789
-            if ( is_array($value) ) {
789
+            if ( is_array( $value ) ) {
790 790
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
791 791
             } else {
792 792
 				if ( $keys == 'keep' ) {
793
-					$return[ $key ] = $value;
793
+					$return[$key] = $value;
794 794
 				} else {
795 795
 					$return[] = $value;
796 796
 				}
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
     }
801 801
 
802 802
     public static function esc_textarea( $text ) {
803
-        $safe_text = str_replace('&quot;', '"', $text);
803
+        $safe_text = str_replace( '&quot;', '"', $text );
804 804
         $safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
805 805
     	return apply_filters( 'esc_textarea', $safe_text, $text );
806 806
     }
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
      * @since 2.0
811 811
      */
812 812
 	public static function use_wpautop( $content ) {
813
-        if ( apply_filters('frm_use_wpautop', true) ) {
814
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
813
+        if ( apply_filters( 'frm_use_wpautop', true ) ) {
814
+            $content = wpautop( str_replace( '<br>', '<br />', $content ) );
815 815
         }
816 816
         return $content;
817 817
     }
@@ -829,8 +829,8 @@  discard block
 block discarded – undo
829 829
      * @return string The base Google APIS url for the current version of jQuery UI
830 830
      */
831 831
     public static function jquery_ui_base_url() {
832
-        $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
833
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
832
+        $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core' );
833
+        $url = apply_filters( 'frm_jquery_ui_base_url', $url );
834 834
         return $url;
835 835
     }
836 836
 
@@ -845,11 +845,11 @@  discard block
 block discarded – undo
845 845
 
846 846
         $ver = 0;
847 847
 
848
-        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
848
+        if ( ! isset( $wp_scripts->registered[$handle] ) ) {
849 849
             return $ver;
850 850
         }
851 851
 
852
-        $query = $wp_scripts->registered[ $handle ];
852
+        $query = $wp_scripts->registered[$handle];
853 853
     	if ( is_object( $query ) ) {
854 854
     	    $ver = $query->ver;
855 855
     	}
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
     }
863 863
 
864 864
 	public static function get_user_id_param( $user_id ) {
865
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
865
+        if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
866 866
             return $user_id;
867 867
         }
868 868
 
@@ -870,29 +870,29 @@  discard block
 block discarded – undo
870 870
             $user_ID = get_current_user_id();
871 871
             $user_id = $user_ID;
872 872
 		} else {
873
-            if ( is_email($user_id) ) {
874
-                $user = get_user_by('email', $user_id);
873
+            if ( is_email( $user_id ) ) {
874
+                $user = get_user_by( 'email', $user_id );
875 875
             } else {
876
-                $user = get_user_by('login', $user_id);
876
+                $user = get_user_by( 'login', $user_id );
877 877
             }
878 878
 
879 879
             if ( $user ) {
880 880
                 $user_id = $user->ID;
881 881
             }
882
-            unset($user);
882
+            unset( $user );
883 883
         }
884 884
 
885 885
         return $user_id;
886 886
     }
887 887
 
888 888
 	public static function get_file_contents( $filename, $atts = array() ) {
889
-        if ( ! is_file($filename) ) {
889
+        if ( ! is_file( $filename ) ) {
890 890
             return false;
891 891
         }
892 892
 
893
-        extract($atts);
893
+        extract( $atts );
894 894
         ob_start();
895
-        include($filename);
895
+        include( $filename );
896 896
         $contents = ob_get_contents();
897 897
         ob_end_clean();
898 898
         return $contents;
@@ -908,28 +908,28 @@  discard block
 block discarded – undo
908 908
         $key = '';
909 909
 
910 910
         if ( ! empty( $name ) ) {
911
-            $key = sanitize_key($name);
911
+            $key = sanitize_key( $name );
912 912
         }
913 913
 
914 914
 		if ( empty( $key ) ) {
915
-            $max_slug_value = pow(36, $num_chars);
915
+            $max_slug_value = pow( 36, $num_chars );
916 916
             $min_slug_value = 37; // we want to have at least 2 characters in the slug
917
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
917
+            $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
918 918
         }
919 919
 
920
-		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
921
-            $key = $key .'a';
920
+		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
921
+            $key = $key . 'a';
922 922
         }
923 923
 
924 924
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
925 925
 
926
-        if ( $key_check || is_numeric($key_check) ) {
926
+        if ( $key_check || is_numeric( $key_check ) ) {
927 927
             $suffix = 2;
928 928
 			do {
929 929
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
930 930
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
931
-				$suffix++;
932
-			} while ($key_check || is_numeric($key_check));
931
+				$suffix ++;
932
+			} while ( $key_check || is_numeric( $key_check ) );
933 933
 			$key = $alt_post_name;
934 934
         }
935 935
         return $key;
@@ -947,32 +947,32 @@  discard block
 block discarded – undo
947 947
 
948 948
         global $frm_vars;
949 949
 
950
-        if ( empty($post_values) ) {
951
-            $post_values = stripslashes_deep($_POST);
950
+        if ( empty( $post_values ) ) {
951
+            $post_values = stripslashes_deep( $_POST );
952 952
         }
953 953
 
954 954
 		$values = array( 'id' => $record->id, 'fields' => array() );
955 955
 
956 956
 		foreach ( array( 'name', 'description' ) as $var ) {
957
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
958
-            $values[ $var ] = self::get_param( $var, $default_val );
959
-            unset($var, $default_val);
957
+            $default_val = isset( $record->{$var}) ? $record->{$var} : '';
958
+            $values[$var] = self::get_param( $var, $default_val );
959
+            unset( $var, $default_val );
960 960
         }
961 961
 
962
-        $values['description'] = self::use_wpautop($values['description']);
962
+        $values['description'] = self::use_wpautop( $values['description'] );
963 963
         $frm_settings = self::get_settings();
964
-        $is_form_builder = self::is_admin_page('formidable' );
964
+        $is_form_builder = self::is_admin_page( 'formidable' );
965 965
 
966 966
         foreach ( (array) $fields as $field ) {
967 967
             // Make sure to filter default values (for placeholder text), but not on the form builder page
968 968
             if ( ! $is_form_builder ) {
969
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
969
+                $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
970 970
             }
971 971
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
972
-			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
972
+			self::fill_field_defaults( $field, $record, $values, compact( 'default', 'post_values', 'frm_settings', 'parent_form_id' ) );
973 973
         }
974 974
 
975
-        self::fill_form_opts($record, $table, $post_values, $values);
975
+        self::fill_form_opts( $record, $table, $post_values, $values );
976 976
 
977 977
         if ( $table == 'entries' ) {
978 978
             $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
         if ( $args['default'] ) {
990 990
             $meta_value = $field->default_value;
991 991
         } else {
992
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
993
-                if ( ! isset($field->field_options['custom_field']) ) {
992
+            if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
993
+                if ( ! isset( $field->field_options['custom_field'] ) ) {
994 994
                     $field->field_options['custom_field'] = '';
995 995
                 }
996 996
 				$meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array( 'truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field ) );
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
             }
1000 1000
         }
1001 1001
 
1002
-        $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1003
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1002
+        $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
1003
+        $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value;
1004 1004
 
1005 1005
         $field_array = array(
1006 1006
             'id'            => $field->id,
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
             'default_value' => $field->default_value,
1009 1009
             'name'          => $field->name,
1010 1010
             'description'   => $field->description,
1011
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1011
+            'type'          => apply_filters( 'frm_field_type', $field_type, $field, $new_value ),
1012 1012
             'options'       => $field->options,
1013 1013
             'required'      => $field->required,
1014 1014
             'field_key'     => $field->field_key,
@@ -1018,38 +1018,38 @@  discard block
 block discarded – undo
1018 1018
         );
1019 1019
 
1020 1020
         $args['field_type'] = $field_type;
1021
-        self::fill_field_opts($field, $field_array, $args);
1021
+        self::fill_field_opts( $field, $field_array, $args );
1022 1022
 
1023
-        $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1023
+        $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'] );
1024 1024
 
1025
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1025
+        if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1026 1026
             $field_array['unique_msg'] = '';
1027 1027
         }
1028 1028
 
1029 1029
         $field_array = array_merge( $field->field_options, $field_array );
1030 1030
 
1031
-        $values['fields'][ $field->id ] = $field_array;
1031
+        $values['fields'][$field->id] = $field_array;
1032 1032
     }
1033 1033
 
1034 1034
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1035 1035
         $post_values = $args['post_values'];
1036
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1036
+        $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
1037 1037
 
1038 1038
         foreach ( $opt_defaults as $opt => $default_opt ) {
1039
-            $field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt .'_'. $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt .'_'. $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1040
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1041
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1042
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1039
+            $field_array[$opt] = ( $post_values && isset( $post_values['field_options'][$opt . '_' . $field->id] ) ) ? maybe_unserialize( $post_values['field_options'][$opt . '_' . $field->id] ) : ( isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default_opt );
1040
+            if ( $opt == 'blank' && $field_array[$opt] == '' ) {
1041
+                $field_array[$opt] = $args['frm_settings']->blank_msg;
1042
+            } else if ( $opt == 'invalid' && $field_array[$opt] == '' ) {
1043 1043
                 if ( $args['field_type'] == 'captcha' ) {
1044
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1044
+                    $field_array[$opt] = $args['frm_settings']->re_msg;
1045 1045
                 } else {
1046
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1046
+                    $field_array[$opt] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1047 1047
                 }
1048 1048
             }
1049 1049
         }
1050 1050
 
1051 1051
         if ( $field_array['custom_html'] == '' ) {
1052
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1052
+            $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $args['field_type'] );
1053 1053
         }
1054 1054
     }
1055 1055
 
@@ -1068,18 +1068,18 @@  discard block
 block discarded – undo
1068 1068
             return;
1069 1069
         }
1070 1070
 
1071
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1071
+        $values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1072 1072
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1073 1073
 
1074
-        if ( ! is_array($form->options) ) {
1074
+        if ( ! is_array( $form->options ) ) {
1075 1075
             return;
1076 1076
         }
1077 1077
 
1078 1078
         foreach ( $form->options as $opt => $value ) {
1079
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1079
+            $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value;
1080 1080
         }
1081 1081
 
1082
-        self::fill_form_defaults($post_values, $values);
1082
+        self::fill_form_defaults( $post_values, $values );
1083 1083
     }
1084 1084
 
1085 1085
     /**
@@ -1089,23 +1089,23 @@  discard block
 block discarded – undo
1089 1089
         $form_defaults = FrmFormsHelper::get_default_opts();
1090 1090
 
1091 1091
         foreach ( $form_defaults as $opt => $default ) {
1092
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1093
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1092
+            if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1093
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1094 1094
             }
1095 1095
 
1096
-            unset($opt, $defaut);
1096
+            unset( $opt, $defaut );
1097 1097
         }
1098 1098
 
1099
-        if ( ! isset($values['custom_style']) ) {
1099
+        if ( ! isset( $values['custom_style'] ) ) {
1100 1100
             $frm_settings = self::get_settings();
1101 1101
 			$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
1102 1102
         }
1103 1103
 
1104 1104
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1105
-            if ( ! isset( $values[ $h .'_html' ] ) ) {
1106
-                $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1105
+            if ( ! isset( $values[$h . '_html'] ) ) {
1106
+                $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1107 1107
             }
1108
-            unset($h);
1108
+            unset( $h );
1109 1109
         }
1110 1110
     }
1111 1111
 
@@ -1121,9 +1121,9 @@  discard block
 block discarded – undo
1121 1121
         }
1122 1122
     ?>
1123 1123
 <li>
1124
-    <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['id']) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1125
-    <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['key']) ?>" >[<?php echo esc_attr( self::truncate($args['key'], 10) ) ?>]</a>
1126
-    <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr($args['id']) ?>" ><?php echo esc_attr( self::truncate($args['name'], 60) ) ?></a>
1124
+    <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['id'] ) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1125
+    <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['key'] ) ?>" >[<?php echo esc_attr( self::truncate( $args['key'], 10 ) ) ?>]</a>
1126
+    <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['id'] ) ?>" ><?php echo esc_attr( self::truncate( $args['name'], 60 ) ) ?></a>
1127 1127
 </li>
1128 1128
     <?php
1129 1129
     }
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
             return '';
1152 1152
         } else if ( $length <= 10 ) {
1153 1153
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1154
-            return $sub . (($length < $original_len) ? $continue : '');
1154
+            return $sub . ( ( $length < $original_len ) ? $continue : '' );
1155 1155
         }
1156 1156
 
1157 1157
         $sub = '';
@@ -1160,23 +1160,23 @@  discard block
 block discarded – undo
1160 1160
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1161 1161
 
1162 1162
 		foreach ( $words as $word ) {
1163
-            $part = (($sub != '') ? ' ' : '') . $word;
1163
+            $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1164 1164
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1165
-            if ( $total_len > $length && str_word_count($sub) ) {
1165
+            if ( $total_len > $length && str_word_count( $sub ) ) {
1166 1166
                 break;
1167 1167
             }
1168 1168
 
1169 1169
             $sub .= $part;
1170 1170
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1171 1171
 
1172
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1172
+            if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1173 1173
                 break;
1174 1174
             }
1175 1175
 
1176
-            unset($total_len, $word);
1176
+            unset( $total_len, $word );
1177 1177
         }
1178 1178
 
1179
-        return $sub . (($len < $original_len) ? $continue : '');
1179
+        return $sub . ( ( $len < $original_len ) ? $continue : '' );
1180 1180
     }
1181 1181
 
1182 1182
 	public static function mb_function( $function_names, $args ) {
@@ -1189,17 +1189,17 @@  discard block
 block discarded – undo
1189 1189
 	}
1190 1190
 
1191 1191
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1192
-        if ( empty($date) ) {
1192
+        if ( empty( $date ) ) {
1193 1193
             return $date;
1194 1194
         }
1195 1195
 
1196
-        if ( empty($date_format) ) {
1197
-            $date_format = get_option('date_format');
1196
+        if ( empty( $date_format ) ) {
1197
+            $date_format = get_option( 'date_format' );
1198 1198
         }
1199 1199
 
1200
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1200
+        if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1201 1201
             $frmpro_settings = new FrmProSettings();
1202
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1202
+            $date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1203 1203
         }
1204 1204
 
1205 1205
 		$formatted = self::get_localized_date( $date_format, $date );
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 	private static function add_time_to_date( $time_format, $date ) {
1216 1216
 		if ( empty( $time_format ) ) {
1217
-			$time_format = get_option('time_format');
1217
+			$time_format = get_option( 'time_format' );
1218 1218
 		}
1219 1219
 
1220 1220
 		$trimmed_format = trim( $time_format );
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
      * @return string The time ago in words
1239 1239
      */
1240 1240
     public static function human_time_diff( $from, $to = '' ) {
1241
-    	if ( empty($to) ) {
1241
+    	if ( empty( $to ) ) {
1242 1242
     	    		$to = time();
1243 1243
     	}
1244 1244
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
     	);
1255 1255
 
1256 1256
     	// Difference in seconds
1257
-    	$diff = (int) ($to - $from);
1257
+    	$diff = (int) ( $to - $from );
1258 1258
 
1259 1259
     	// Something went wrong with date calculation and we ended up with a negative date.
1260 1260
 		if ( $diff < 1 ) {
@@ -1271,17 +1271,17 @@  discard block
 block discarded – undo
1271 1271
         $count = 0;
1272 1272
 
1273 1273
     	//Step one: the first chunk
1274
-		for ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {
1275
-    		$seconds = $chunks[ $i ][0];
1274
+		for ( $i = 0, $j = count( $chunks ); $i < $j; $i ++ ) {
1275
+    		$seconds = $chunks[$i][0];
1276 1276
 
1277 1277
     		// Finding the biggest chunk (if the chunk fits, break)
1278
-    		if ( ( $count = floor($diff / $seconds) ) != 0 ) {
1278
+    		if ( ( $count = floor( $diff / $seconds ) ) != 0 ) {
1279 1279
     		    			break;
1280 1280
     		}
1281 1281
     	}
1282 1282
 
1283 1283
     	// Set output var
1284
-    	$output = ( 1 == $count ) ? '1 '. $chunks[ $i ][1] : $count . ' ' . $chunks[ $i ][2];
1284
+    	$output = ( 1 == $count ) ? '1 ' . $chunks[$i][1] : $count . ' ' . $chunks[$i][2];
1285 1285
 
1286 1286
     	if ( ! (int) trim( $output ) ) {
1287 1287
     		$output = '0 ' . __( 'seconds', 'formidable' );
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
      */
1301 1301
 	public static function esc_like( $term ) {
1302 1302
         global $wpdb;
1303
-        if ( method_exists($wpdb, 'esc_like') ) {
1303
+        if ( method_exists( $wpdb, 'esc_like' ) ) {
1304 1304
 			// WP 4.0
1305 1305
             $term = $wpdb->esc_like( $term );
1306 1306
         } else {
@@ -1314,17 +1314,17 @@  discard block
 block discarded – undo
1314 1314
      * @param string $order_query
1315 1315
      */
1316 1316
 	public static function esc_order( $order_query ) {
1317
-        if ( empty($order_query) ) {
1317
+        if ( empty( $order_query ) ) {
1318 1318
             return '';
1319 1319
         }
1320 1320
 
1321 1321
         // remove ORDER BY before santizing
1322
-        $order_query = strtolower($order_query);
1323
-        if ( strpos($order_query, 'order by') !== false ) {
1324
-            $order_query = str_replace('order by', '', $order_query);
1322
+        $order_query = strtolower( $order_query );
1323
+        if ( strpos( $order_query, 'order by' ) !== false ) {
1324
+            $order_query = str_replace( 'order by', '', $order_query );
1325 1325
         }
1326 1326
 
1327
-        $order_query = explode(' ', trim($order_query));
1327
+        $order_query = explode( ' ', trim( $order_query ) );
1328 1328
 
1329 1329
         $order_fields = array(
1330 1330
             'id', 'form_key', 'name', 'description',
@@ -1332,18 +1332,18 @@  discard block
 block discarded – undo
1332 1332
             'default_template', 'status', 'created_at',
1333 1333
         );
1334 1334
 
1335
-        $order = trim(trim(reset($order_query), ','));
1336
-        if ( ! in_array($order, $order_fields) ) {
1335
+        $order = trim( trim( reset( $order_query ), ',' ) );
1336
+        if ( ! in_array( $order, $order_fields ) ) {
1337 1337
             return '';
1338 1338
         }
1339 1339
 
1340 1340
         $order_by = '';
1341
-        if ( count($order_query) > 1 ) {
1341
+        if ( count( $order_query ) > 1 ) {
1342 1342
 			$order_by = end( $order_query );
1343 1343
 			self::esc_order_by( $order_by );
1344 1344
         }
1345 1345
 
1346
-        return ' ORDER BY '. $order . ' '. $order_by;
1346
+        return ' ORDER BY ' . $order . ' ' . $order_by;
1347 1347
     }
1348 1348
 
1349 1349
 	/**
@@ -1360,24 +1360,24 @@  discard block
 block discarded – undo
1360 1360
      * @param string $limit
1361 1361
      */
1362 1362
 	public static function esc_limit( $limit ) {
1363
-        if ( empty($limit) ) {
1363
+        if ( empty( $limit ) ) {
1364 1364
             return '';
1365 1365
         }
1366 1366
 
1367
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1368
-        if ( is_numeric($limit) ) {
1369
-            return ' LIMIT '. $limit;
1367
+        $limit = trim( str_replace( ' limit', '', strtolower( $limit ) ) );
1368
+        if ( is_numeric( $limit ) ) {
1369
+            return ' LIMIT ' . $limit;
1370 1370
         }
1371 1371
 
1372
-        $limit = explode(',', trim($limit));
1372
+        $limit = explode( ',', trim( $limit ) );
1373 1373
         foreach ( $limit as $k => $l ) {
1374 1374
             if ( is_numeric( $l ) ) {
1375
-                $limit[ $k ] = $l;
1375
+                $limit[$k] = $l;
1376 1376
             }
1377 1377
         }
1378 1378
 
1379
-        $limit = implode(',', $limit);
1380
-        return ' LIMIT '. $limit;
1379
+        $limit = implode( ',', $limit );
1380
+        return ' LIMIT ' . $limit;
1381 1381
     }
1382 1382
 
1383 1383
     /**
@@ -1385,12 +1385,12 @@  discard block
 block discarded – undo
1385 1385
      * @since 2.0
1386 1386
      */
1387 1387
     public static function prepare_array_values( $array, $type = '%s' ) {
1388
-        $placeholders = array_fill(0, count($array), $type);
1389
-        return implode(', ', $placeholders);
1388
+        $placeholders = array_fill( 0, count( $array ), $type );
1389
+        return implode( ', ', $placeholders );
1390 1390
     }
1391 1391
 
1392 1392
     public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1393
-        if ( empty($where) ) {
1393
+        if ( empty( $where ) ) {
1394 1394
             return '';
1395 1395
         }
1396 1396
 
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 
1437 1437
     public static function get_referer_info() {
1438 1438
         _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1439
-        return self::get_server_value('HTTP_REFERER');
1439
+        return self::get_server_value( 'HTTP_REFERER' );
1440 1440
     }
1441 1441
 
1442 1442
 	/**
@@ -1445,19 +1445,19 @@  discard block
 block discarded – undo
1445 1445
 	public static function json_to_array( $json_vars ) {
1446 1446
         $vars = array();
1447 1447
         foreach ( $json_vars as $jv ) {
1448
-            $jv_name = explode('[', $jv['name']);
1449
-            $last = count($jv_name) - 1;
1448
+            $jv_name = explode( '[', $jv['name'] );
1449
+            $last = count( $jv_name ) - 1;
1450 1450
             foreach ( $jv_name as $p => $n ) {
1451
-                $name = trim($n, ']');
1452
-                if ( ! isset($l1) ) {
1451
+                $name = trim( $n, ']' );
1452
+                if ( ! isset( $l1 ) ) {
1453 1453
                     $l1 = $name;
1454 1454
                 }
1455 1455
 
1456
-                if ( ! isset($l2) ) {
1456
+                if ( ! isset( $l2 ) ) {
1457 1457
                     $l2 = $name;
1458 1458
                 }
1459 1459
 
1460
-                if ( ! isset($l3) ) {
1460
+                if ( ! isset( $l3 ) ) {
1461 1461
                     $l3 = $name;
1462 1462
                 }
1463 1463
 
@@ -1471,24 +1471,24 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
                     case 1:
1473 1473
                         $l2 = $name;
1474
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1474
+                        self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1475 1475
                     break;
1476 1476
 
1477 1477
                     case 2:
1478 1478
                         $l3 = $name;
1479
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1479
+                        self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1480 1480
                     break;
1481 1481
 
1482 1482
                     case 3:
1483 1483
                         $l4 = $name;
1484
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1484
+                        self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1485 1485
                     break;
1486 1486
                 }
1487 1487
 
1488
-                unset($this_val, $n);
1488
+                unset( $this_val, $n );
1489 1489
             }
1490 1490
 
1491
-            unset($last, $jv);
1491
+            unset( $last, $jv );
1492 1492
         }
1493 1493
 
1494 1494
         return $vars;
@@ -1501,8 +1501,8 @@  discard block
 block discarded – undo
1501 1501
     public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1502 1502
         if ( $name == '' ) {
1503 1503
             $vars[] = $val;
1504
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1505
-            $vars[ $l1 ] = $val;
1504
+        } else if ( ! isset( $vars[$l1] ) ) {
1505
+            $vars[$l1] = $val;
1506 1506
         }
1507 1507
     }
1508 1508
 
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
             'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1518 1518
         );
1519 1519
 
1520
-        if ( ! isset( $tooltips[ $name ] ) ) {
1520
+        if ( ! isset( $tooltips[$name] ) ) {
1521 1521
             return;
1522 1522
         }
1523 1523
 
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
             echo ' class="frm_help"';
1528 1528
         }
1529 1529
 
1530
-        echo ' title="'. esc_attr( $tooltips[ $name ] );
1530
+        echo ' title="' . esc_attr( $tooltips[$name] );
1531 1531
 
1532 1532
         if ( 'open' != $class ) {
1533 1533
             echo '"';
@@ -1579,13 +1579,13 @@  discard block
 block discarded – undo
1579 1579
     }
1580 1580
 
1581 1581
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1582
-		if ( ! isset( $post_content[ $key ] ) ) {
1582
+		if ( ! isset( $post_content[$key] ) ) {
1583 1583
 			return;
1584 1584
 		}
1585 1585
 
1586 1586
 		if ( is_array( $val ) ) {
1587 1587
 			foreach ( $val as $k1 => $v1 ) {
1588
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1588
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1589 1589
 				unset( $k1, $v1 );
1590 1590
 			}
1591 1591
 		} else {
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 			$val = stripslashes( $val );
1594 1594
 
1595 1595
 			// Add backslashes before double quotes and forward slashes only
1596
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1596
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1597 1597
 		}
1598 1598
 	}
1599 1599
 
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 		$settings['post_content'] = FrmAppHelper::prepare_and_encode( $settings['post_content'] );
1611 1611
 
1612 1612
 		if ( empty( $settings['ID'] ) ) {
1613
-			unset( $settings['ID']);
1613
+			unset( $settings['ID'] );
1614 1614
 		}
1615 1615
 
1616 1616
 		// delete all caches for this group
@@ -1644,17 +1644,17 @@  discard block
 block discarded – undo
1644 1644
 	}
1645 1645
 
1646 1646
 	public static function maybe_json_decode( $string ) {
1647
-        if ( is_array($string) ) {
1647
+        if ( is_array( $string ) ) {
1648 1648
             return $string;
1649 1649
         }
1650 1650
 
1651
-        $new_string = json_decode($string, true);
1652
-        if ( function_exists('json_last_error') ) {
1651
+        $new_string = json_decode( $string, true );
1652
+        if ( function_exists( 'json_last_error' ) ) {
1653 1653
 			// php 5.3+
1654 1654
             if ( json_last_error() == JSON_ERROR_NONE ) {
1655 1655
                 $string = $new_string;
1656 1656
             }
1657
-        } else if ( isset($new_string) ) {
1657
+        } else if ( isset( $new_string ) ) {
1658 1658
 			// php < 5.3 fallback
1659 1659
             $string = $new_string;
1660 1660
         }
@@ -1670,11 +1670,11 @@  discard block
 block discarded – undo
1670 1670
 	public static function maybe_highlight_menu( $post_type ) {
1671 1671
         global $post, $pagenow;
1672 1672
 
1673
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1673
+        if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1674 1674
             return;
1675 1675
         }
1676 1676
 
1677
-        if ( is_object($post) && $post->post_type != $post_type ) {
1677
+        if ( is_object( $post ) && $post->post_type != $post_type ) {
1678 1678
             return;
1679 1679
         }
1680 1680
 
@@ -1772,11 +1772,11 @@  discard block
 block discarded – undo
1772 1772
         $frm_version = self::plugin_version();
1773 1773
 
1774 1774
         // check if Formidable meets minimum requirements
1775
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1775
+        if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1776 1776
             return;
1777 1777
         }
1778 1778
 
1779
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1779
+        $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1780 1780
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1781 1781
         __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1782 1782
         '</div></td></tr>';
@@ -1784,38 +1784,38 @@  discard block
 block discarded – undo
1784 1784
 
1785 1785
     public static function locales( $type = 'date' ) {
1786 1786
         $locales = array(
1787
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1788
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1789
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1787
+            'en' => __( 'English', 'formidable' ), '' => __( 'English/Western', 'formidable' ),
1788
+            'af' => __( 'Afrikaans', 'formidable' ), 'sq' => __( 'Albanian', 'formidable' ),
1789
+            'ar' => __( 'Arabic', 'formidable' ), 'hy' => __( 'Armenian', 'formidable' ),
1790 1790
             'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1791
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1792
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1791
+            'bs' => __( 'Bosnian', 'formidable' ), 'bg' => __( 'Bulgarian', 'formidable' ),
1792
+            'ca' => __( 'Catalan', 'formidable' ), 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1793 1793
             'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1794
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1795
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1794
+            'hr' => __( 'Croatian', 'formidable' ), 'cs' => __( 'Czech', 'formidable' ),
1795
+            'da' => __( 'Danish', 'formidable' ), 'nl' => __( 'Dutch', 'formidable' ),
1796 1796
             'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1797
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1797
+            'et' => __( 'Estonian', 'formidable' ), 'fo' => __( 'Faroese', 'formidable' ),
1798 1798
             'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1799
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1799
+            'fi' => __( 'Finnish', 'formidable' ), 'fr' => __( 'French', 'formidable' ),
1800 1800
             'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1801
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1801
+            'de' => __( 'German', 'formidable' ), 'de-AT' => __( 'German/Austria', 'formidable' ),
1802 1802
             'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1803
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1804
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1805
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1806
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1807
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1803
+            'he' => __( 'Hebrew', 'formidable' ), 'iw' => __( 'Hebrew', 'formidable' ),
1804
+            'hi' => __( 'Hindi', 'formidable' ), 'hu' => __( 'Hungarian', 'formidable' ),
1805
+            'is' => __( 'Icelandic', 'formidable' ), 'id' => __( 'Indonesian', 'formidable' ),
1806
+            'it' => __( 'Italian', 'formidable' ), 'ja' => __( 'Japanese', 'formidable' ),
1807
+            'ko' => __( 'Korean', 'formidable' ), 'lv' => __( 'Latvian', 'formidable' ),
1808 1808
             'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1809
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1809
+            'no' => __( 'Norwegian', 'formidable' ), 'pl' => __( 'Polish', 'formidable' ),
1810 1810
             'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1811 1811
             'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1812
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1812
+            'ru' => __( 'Russian', 'formidable' ), 'sr' => __( 'Serbian', 'formidable' ),
1813 1813
             'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1814
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1814
+            'sl' => __( 'Slovenian', 'formidable' ), 'es' => __( 'Spanish', 'formidable' ),
1815 1815
             'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1816
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1817
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1818
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1816
+            'ta' => __( 'Tamil', 'formidable' ), 'th' => __( 'Thai', 'formidable' ),
1817
+            'tu' => __( 'Turkish', 'formidable' ), 'tr' => __( 'Turkish', 'formidable' ),
1818
+            'uk' => __( 'Ukranian', 'formidable' ), 'vi' => __( 'Vietnamese', 'formidable' ),
1819 1819
         );
1820 1820
 
1821 1821
         if ( $type == 'captcha' ) {
@@ -1834,8 +1834,8 @@  discard block
 block discarded – undo
1834 1834
             );
1835 1835
         }
1836 1836
 
1837
-        $locales = array_diff_key($locales, array_flip($unset));
1838
-        $locales = apply_filters('frm_locales', $locales);
1837
+        $locales = array_diff_key( $locales, array_flip( $unset ) );
1838
+        $locales = apply_filters( 'frm_locales', $locales );
1839 1839
 
1840 1840
         return $locales;
1841 1841
     }
Please login to merge, or discard this patch.
classes/models/FrmPointers.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	/**
46 46
 	 * Get the singleton instance of this class
47 47
 	 *
48
-	 * @return object
48
+	 * @return FrmPointers
49 49
 	 */
50 50
 	public static function get_instance() {
51 51
 		if ( ! ( self::$instance instanceof self ) ) {
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	private function start_tour_pointer() {
165 165
 		$selector = 'li.toplevel_page_formidable';
166 166
 		$content  = '<h3>' . __( 'Congratulations!', 'formidable' ) . '</h3>'
167
-		            .'<p>' . sprintf( __( 'You&#8217;ve just installed new forms! Click &#8220;Start Tour&#8221; to view a quick introduction of this plugin&#8217;s core functionality.' ), 'formidable' ) . '</p>';
167
+					.'<p>' . sprintf( __( 'You&#8217;ve just installed new forms! Click &#8220;Start Tour&#8221; to view a quick introduction of this plugin&#8217;s core functionality.' ), 'formidable' ) . '</p>';
168 168
 		$opt_arr  = array(
169 169
 			'content'  => $content,
170 170
 			'position' => array( 'edge' => 'top', 'align' => 'center' ),
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 
226 226
 		return array(
227 227
 			'content'   => '<h3>' . __( 'Forms', 'formidable' ) . '</h3>'
228
-			               . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>'
229
-			               . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>'
230
-			               . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>'
231
-			               . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&amp;id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">'
232
-			               . '<p>'
233
-			               . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>'
228
+						   . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>'
229
+						   . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>'
230
+						   . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>'
231
+						   . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&amp;id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">'
232
+						   . '<p>'
233
+						   . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>'
234 234
 						   . '<input type="hidden" name="group[4505]" value="4" />'
235
-			               . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>'
236
-			               . '</p>'
237
-			               . '</form>',
235
+						   . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>'
236
+						   . '</p>'
237
+						   . '</form>',
238 238
 			'next_page' => 'entries',
239 239
 		);
240 240
 	}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	private function entries_pointer() {
248 248
 		return array(
249 249
 			'content'   => '<h3>' . __( 'Entries', 'formidable' ) . '</h3>'
250
-			               . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>',
250
+						   . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>',
251 251
 			'prev_page' => '',
252 252
 			'next_page' => 'styles',
253 253
 		);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	private function styles_pointer() {
262 262
 		return array(
263 263
 			'content'   => '<h3>' . __( 'Styles', 'formidable' ) . '</h3>'
264
-			               . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>',
264
+						   . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>',
265 265
 			'prev_page' => 'entries',
266 266
 			'next_page' => 'import',
267 267
 		);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	private function import_pointer() {
276 276
 		return array(
277 277
 			'content'   => '<h3>' . __( 'Import/Export', 'formidable' ) . '</h3>'
278
-			               . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>',
278
+						   . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>',
279 279
 			'prev_page' => 'styles',
280 280
 			'next_page' => 'settings',
281 281
 		);
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 				. __( 'Turn stylesheets and scripts off, set which user roles have access to change and create forms, setup your reCaptcha, and set default messages for new forms and fields.', 'formidable' )
294 294
 				. '<p><strong>' . __( 'Plugin Licenses', 'formidable' ) . '</strong><br/>'
295 295
 				. sprintf( __( 'Once you&#8217;ve purchased %1$s or any addons, you&#8217;ll have to enter a license key to get access to all of their powerful features. A Plugin Licenses tab will appear here for you to enter your license key.', 'formidable' ), 'Formidable Pro' )
296
-           	    . '</p>',
296
+		   		. '</p>',
297 297
 			'prev_page' => 'import',
298 298
 			'next_page' => 'addons',
299 299
 		);
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 	private function addons_pointer() {
308 308
 		return array(
309 309
 			'content'   => '<h3>' . __( 'Addons', 'formidable' ) . '</h3>'
310
-			               . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' )
310
+						   . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' )
311 311
 						   . '</p>'
312
-			               . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we&#8217;ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>'
313
-			               . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>',
312
+						   . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we&#8217;ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>'
313
+						   . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>',
314 314
 			'prev_page' => 'settings',
315 315
 		);
316 316
 	}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@
 block discarded – undo
184 184
 	private function do_page_pointer( $page ) {
185 185
 		$selector = 'h2';
186 186
 
187
-		$pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) );
187
+		$pointer = call_user_func( array( $this, $this->admin_pages[$page] ) );
188 188
 
189 189
 		$opt_arr = array(
190 190
 			'content'      => $pointer['content'],
Please login to merge, or discard this patch.
classes/views/frm-settings/license_box.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1
-<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ($a == 'general_settings') ? 'frm_block' : 'frm_hidden'; ?>">
1
+<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ( $a == 'general_settings' ) ? 'frm_block' : 'frm_hidden'; ?>">
2 2
 <?php if ( ! is_multisite() || is_super_admin() ) { ?>
3 3
     <div class="postbox">
4 4
         <div class="inside">
5
-			<p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> &#187;</p>
5
+			<p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> &#187;</p>
6 6
 			<p><?php _e( 'Ready to take your forms to the next level?<br/>Formidable Forms will help you create views, manage data, and get reports.', 'formidable' ) ?></p>
7 7
 
8 8
 			<p>Already signed up? <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/knowledgebase/install-formidable-forms/' ) ) ?>" target="_blank"><?php _e( 'Click here', 'formidable' ) ?></a> to get installation instructions and download the pro version.</p>
Please login to merge, or discard this patch.
classes/controllers/FrmEntriesController.php 2 patches
Indentation   +360 added lines, -360 removed lines patch added patch discarded remove patch
@@ -2,200 +2,200 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmEntriesController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+		add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11
-            $frm_settings = FrmAppHelper::get_settings();
11
+			$frm_settings = FrmAppHelper::get_settings();
12 12
 			add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13 13
 			add_filter( 'get_user_option_manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14 14
 			add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
-        }
16
-    }
15
+		}
16
+	}
17 17
 
18
-    /* Display in Back End */
19
-    public static function route() {
18
+	/* Display in Back End */
19
+	public static function route() {
20 20
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
21 21
 
22
-        switch ( $action ) {
23
-            case 'show':
24
-            case 'destroy':
25
-            case 'destroy_all':
26
-                return self::$action();
22
+		switch ( $action ) {
23
+			case 'show':
24
+			case 'destroy':
25
+			case 'destroy_all':
26
+				return self::$action();
27 27
 
28
-            default:
29
-                do_action( 'frm_entry_action_route', $action );
30
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
-                    return;
32
-                }
28
+			default:
29
+				do_action( 'frm_entry_action_route', $action );
30
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
+					return;
32
+				}
33 33
 
34
-                return self::display_list();
35
-        }
36
-    }
34
+				return self::display_list();
35
+		}
36
+	}
37 37
 
38 38
 	public static function contextual_help( $help, $screen_id, $screen ) {
39
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
-            return $help;
42
-        }
39
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
+			return $help;
42
+		}
43 43
 
44 44
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
45 45
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
46 46
 		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
47
-            return $help;
48
-        }
47
+			return $help;
48
+		}
49 49
 
50 50
 		unset( $action, $page );
51 51
 
52
-        $screen->add_help_tab( array(
53
-            'id'      => 'formidable-entries-tab',
54
-            'title'   => __( 'Overview', 'formidable' ),
52
+		$screen->add_help_tab( array(
53
+			'id'      => 'formidable-entries-tab',
54
+			'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+		));
57 57
 
58
-        $screen->set_help_sidebar(
58
+		$screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61 61
 			'<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
-    	);
62
+		);
63 63
 
64
-        return $help;
65
-    }
64
+		return $help;
65
+	}
66 66
 
67 67
 	public static function manage_columns( $columns ) {
68
-        global $frm_vars, $wpdb;
68
+		global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-        $columns[ $form_id .'_id' ] = 'ID';
71
+		$columns[ $form_id .'_id' ] = 'ID';
72 72
 		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74
-        if ( ! $form_id ) {
75
-            return $columns;
76
-        }
74
+		if ( ! $form_id ) {
75
+			return $columns;
76
+		}
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+		$form_cols = FrmField::get_all_for_form($form_id, '', 'include');
79 79
 
80
-        foreach ( $form_cols as $form_col ) {
80
+		foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
82
-                continue;
83
-            }
82
+				continue;
83
+			}
84 84
 
85
-            if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
85
+			if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
86 86
 				$sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] );
87 87
 
88
-                if ( $sub_form_cols ) {
89
-                    foreach ( $sub_form_cols as $k => $sub_form_col ) {
88
+				if ( $sub_form_cols ) {
89
+					foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
92
-                            continue;
93
-                        }
91
+							unset( $sub_form_cols[ $k ] );
92
+							continue;
93
+						}
94 94
 						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
96
-                    }
97
-                }
98
-                unset($sub_form_cols);
99
-            } else {
100
-                $col_id = $form_col->field_key;
101
-                if ( $form_col->form_id != $form_id ) {
102
-                    $col_id .= '-_-form'. $form_col->form_id;
103
-                }
104
-
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
-                    $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
-                }
108
-                $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
-            }
110
-        }
111
-
112
-        $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
113
-        $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
114
-        $columns[ $form_id .'_ip' ] = 'IP';
115
-
116
-        $frm_vars['cols'] = $columns;
95
+						unset($sub_form_col);
96
+					}
97
+				}
98
+				unset($sub_form_cols);
99
+			} else {
100
+				$col_id = $form_col->field_key;
101
+				if ( $form_col->form_id != $form_id ) {
102
+					$col_id .= '-_-form'. $form_col->form_id;
103
+				}
104
+
105
+				if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
+					$columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
+				}
108
+				$columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
+			}
110
+		}
111
+
112
+		$columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
113
+		$columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
114
+		$columns[ $form_id .'_ip' ] = 'IP';
115
+
116
+		$frm_vars['cols'] = $columns;
117 117
 
118 118
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
119 119
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
120 120
 			add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) );
121
-        }
121
+		}
122 122
 
123
-        return $columns;
124
-    }
123
+		return $columns;
124
+	}
125 125
 
126 126
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127
-        $frm_settings = FrmAppHelper::get_settings();
128
-        if ( $meta_key != 'manage'.  sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
129
-            return $check;
130
-        }
127
+		$frm_settings = FrmAppHelper::get_settings();
128
+		if ( $meta_key != 'manage'.  sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
129
+			return $check;
130
+		}
131 131
 
132 132
 		if ( empty( $prev_value ) ) {
133 133
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
134 134
 		}
135 135
 
136
-        global $frm_vars;
137
-        //add a check so we don't create a loop
138
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
136
+		global $frm_vars;
137
+		//add a check so we don't create a loop
138
+		$frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
139 139
 
140
-        return $check;
141
-    }
140
+		return $check;
141
+	}
142 142
 
143
-    //add hidden columns back from other forms
143
+	//add hidden columns back from other forms
144 144
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
145
-        $frm_settings = FrmAppHelper::get_settings();
146
-
147
-        $sanitized = sanitize_title($frm_settings->menu);
148
-        if ( $meta_key != 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden' ) {
149
-            return;
150
-        }
151
-
152
-        global $frm_vars;
153
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
154
-            return; //don't continue if there's no previous value
155
-        }
156
-
157
-        foreach ( $meta_value as $mk => $mv ) {
158
-            //remove blank values
159
-            if ( empty( $mv )  ) {
160
-                unset( $meta_value[ $mk ] );
161
-            }
162
-        }
163
-
164
-        $cur_form_prefix = reset($meta_value);
165
-        $cur_form_prefix = explode('_', $cur_form_prefix);
166
-        $cur_form_prefix = $cur_form_prefix[0];
167
-        $save = false;
168
-
169
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
145
+		$frm_settings = FrmAppHelper::get_settings();
146
+
147
+		$sanitized = sanitize_title($frm_settings->menu);
148
+		if ( $meta_key != 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden' ) {
149
+			return;
150
+		}
151
+
152
+		global $frm_vars;
153
+		if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
154
+			return; //don't continue if there's no previous value
155
+		}
156
+
157
+		foreach ( $meta_value as $mk => $mv ) {
158
+			//remove blank values
159
+			if ( empty( $mv )  ) {
160
+				unset( $meta_value[ $mk ] );
161
+			}
162
+		}
163
+
164
+		$cur_form_prefix = reset($meta_value);
165
+		$cur_form_prefix = explode('_', $cur_form_prefix);
166
+		$cur_form_prefix = $cur_form_prefix[0];
167
+		$save = false;
168
+
169
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
170 170
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
171
-                //don't add blank cols or process included cols
172
-                continue;
173
-            }
171
+				//don't add blank cols or process included cols
172
+				continue;
173
+			}
174 174
 
175 175
 			$form_prefix = explode( '_', $prev_hidden );
176
-            $form_prefix = $form_prefix[0];
177
-            if ( $form_prefix == $cur_form_prefix ) {
178
-                //don't add back columns that are meant to be hidden
179
-                continue;
180
-            }
176
+			$form_prefix = $form_prefix[0];
177
+			if ( $form_prefix == $cur_form_prefix ) {
178
+				//don't add back columns that are meant to be hidden
179
+				continue;
180
+			}
181 181
 
182
-            $meta_value[] = $prev_hidden;
183
-            $save = true;
184
-            unset($form_prefix);
185
-        }
182
+			$meta_value[] = $prev_hidden;
183
+			$save = true;
184
+			unset($form_prefix);
185
+		}
186 186
 
187 187
 		if ( $save ) {
188
-            $user = wp_get_current_user();
189
-            update_user_option( $user->ID, 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true );
190
-        }
191
-    }
188
+			$user = wp_get_current_user();
189
+			update_user_option( $user->ID, 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true );
190
+		}
191
+	}
192 192
 
193 193
 	public static function save_per_page( $save, $option, $value ) {
194
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
195
-            $save = (int) $value;
196
-        }
197
-        return $save;
198
-    }
194
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
195
+			$save = (int) $value;
196
+		}
197
+		return $save;
198
+	}
199 199
 
200 200
 	public static function sortable_columns() {
201 201
 		$form_id = FrmForm::get_current_form_id();
@@ -221,226 +221,226 @@  discard block
 block discarded – undo
221 221
 	}
222 222
 
223 223
 	public static function hidden_columns( $result ) {
224
-        global $frm_vars;
224
+		global $frm_vars;
225 225
 
226 226
 		$form_id = FrmForm::get_current_form_id();
227 227
 
228
-        $return = false;
229
-        foreach ( (array) $result as $r ) {
230
-            if ( ! empty( $r ) ) {
231
-                $form_prefix = explode( '_', $r );
232
-                $form_prefix = $form_prefix[0];
228
+		$return = false;
229
+		foreach ( (array) $result as $r ) {
230
+			if ( ! empty( $r ) ) {
231
+				$form_prefix = explode( '_', $r );
232
+				$form_prefix = $form_prefix[0];
233 233
 
234
-                if ( (int) $form_prefix == (int) $form_id ) {
235
-                    $return = true;
236
-                    break;
237
-                }
234
+				if ( (int) $form_prefix == (int) $form_id ) {
235
+					$return = true;
236
+					break;
237
+				}
238 238
 
239
-                unset($form_prefix);
240
-            }
241
-        }
239
+				unset($form_prefix);
240
+			}
241
+		}
242 242
 
243
-        if ( $return ) {
243
+		if ( $return ) {
244 244
 			return $result;
245 245
 		}
246 246
 
247
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
248
-        $max_columns = 8;
249
-        if ( $i <= $max_columns ) {
247
+		$i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
248
+		$max_columns = 8;
249
+		if ( $i <= $max_columns ) {
250 250
 			return $result;
251 251
 		}
252 252
 
253
-        global $frm_vars;
254
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
255
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
256
-        }
253
+		global $frm_vars;
254
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
255
+			$frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
256
+		}
257 257
 
258
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
259
-            $result = $frm_vars['current_form']->options['hidden_cols'];
260
-        } else {
261
-            $cols = $frm_vars['cols'];
262
-            $cols = array_reverse($cols, true);
258
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
259
+			$result = $frm_vars['current_form']->options['hidden_cols'];
260
+		} else {
261
+			$cols = $frm_vars['cols'];
262
+			$cols = array_reverse($cols, true);
263 263
 
264
-            $result[] = $form_id .'_id';
265
-            $i--;
264
+			$result[] = $form_id .'_id';
265
+			$i--;
266 266
 
267
-            $result[] = $form_id .'_item_key';
268
-            $i--;
267
+			$result[] = $form_id .'_item_key';
268
+			$i--;
269 269
 
270 270
 			foreach ( $cols as $col_key => $col ) {
271
-                if ( $i > $max_columns ) {
271
+				if ( $i > $max_columns ) {
272 272
 					$result[] = $col_key;
273 273
 				}
274
-                //remove some columns by default
275
-                $i--;
276
-                unset($col_key, $col);
277
-            }
278
-        }
274
+				//remove some columns by default
275
+				$i--;
276
+				unset($col_key, $col);
277
+			}
278
+		}
279 279
 
280
-        return $result;
281
-    }
280
+		return $result;
281
+	}
282 282
 
283 283
 	public static function display_list( $message = '', $errors = array() ) {
284
-        global $wpdb, $frm_vars;
284
+		global $wpdb, $frm_vars;
285 285
 
286 286
 		$form = FrmForm::get_current_form();
287 287
 		$params = FrmForm::get_admin_params( $form );
288 288
 
289
-        if ( $form ) {
290
-            $params['form'] = $form->id;
291
-            $frm_vars['current_form'] = $form;
289
+		if ( $form ) {
290
+			$params['form'] = $form->id;
291
+			$frm_vars['current_form'] = $form;
292 292
 
293
-	        if ( 'trash' == $form->status ) {
294
-	            $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
295
-	            $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
296
-	            $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
297
-	            unset( $time_to_delete, $delete_timestamp );
298
-	        }
293
+			if ( 'trash' == $form->status ) {
294
+				$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
295
+				$time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
296
+				$errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
297
+				unset( $time_to_delete, $delete_timestamp );
298
+			}
299 299
 		}
300 300
 
301
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
301
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
302 302
 
303
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
303
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
304 304
 
305
-        $pagenum = $wp_list_table->get_pagenum();
305
+		$pagenum = $wp_list_table->get_pagenum();
306 306
 
307
-        $wp_list_table->prepare_items();
307
+		$wp_list_table->prepare_items();
308 308
 
309
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
310
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
309
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
310
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
311 311
 			$url = add_query_arg( 'paged', $total_pages );
312
-            if ( headers_sent() ) {
313
-                echo FrmAppHelper::js_redirect($url);
314
-            } else {
315
-                wp_redirect( esc_url_raw( $url ) );
316
-            }
317
-            die();
318
-        }
319
-
320
-        if ( empty($message) && isset($_GET['import-message']) ) {
321
-            $message = __( 'Your import is complete', 'formidable' );
322
-        }
323
-
324
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
325
-    }
326
-
327
-    /* Back End CRUD */
312
+			if ( headers_sent() ) {
313
+				echo FrmAppHelper::js_redirect($url);
314
+			} else {
315
+				wp_redirect( esc_url_raw( $url ) );
316
+			}
317
+			die();
318
+		}
319
+
320
+		if ( empty($message) && isset($_GET['import-message']) ) {
321
+			$message = __( 'Your import is complete', 'formidable' );
322
+		}
323
+
324
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
325
+	}
326
+
327
+	/* Back End CRUD */
328 328
 	public static function show( $id = 0 ) {
329
-        FrmAppHelper::permission_check('frm_view_entries');
329
+		FrmAppHelper::permission_check('frm_view_entries');
330 330
 
331
-        if ( ! $id ) {
331
+		if ( ! $id ) {
332 332
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
333 333
 
334
-            if ( ! $id ) {
334
+			if ( ! $id ) {
335 335
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
336
-            }
337
-        }
336
+			}
337
+		}
338 338
 
339
-        $entry = FrmEntry::getOne($id, true);
339
+		$entry = FrmEntry::getOne($id, true);
340 340
 
341
-        $data = maybe_unserialize($entry->description);
341
+		$data = maybe_unserialize($entry->description);
342 342
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
343 343
 			$data = array( 'referrer' => $data );
344 344
 		}
345 345
 
346 346
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
347
-        $to_emails = array();
347
+		$to_emails = array();
348 348
 
349
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
350
-    }
349
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
350
+	}
351 351
 
352
-    public static function destroy() {
353
-        FrmAppHelper::permission_check('frm_delete_entries');
352
+	public static function destroy() {
353
+		FrmAppHelper::permission_check('frm_delete_entries');
354 354
 
355 355
 		$params = FrmForm::get_admin_params();
356 356
 
357
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
358
-            //unlink entry from post
359
-            global $wpdb;
357
+		if ( isset($params['keep_post']) && $params['keep_post'] ) {
358
+			//unlink entry from post
359
+			global $wpdb;
360 360
 			$wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
361
-        }
361
+		}
362 362
 
363
-        $message = '';
364
-        if ( FrmEntry::destroy( $params['id'] ) ) {
365
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
366
-        }
363
+		$message = '';
364
+		if ( FrmEntry::destroy( $params['id'] ) ) {
365
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
366
+		}
367 367
 
368
-        self::display_list( $message );
369
-    }
368
+		self::display_list( $message );
369
+	}
370 370
 
371
-    public static function destroy_all() {
372
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
373
-            $frm_settings = FrmAppHelper::get_settings();
374
-            wp_die( $frm_settings->admin_permission );
375
-        }
371
+	public static function destroy_all() {
372
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
373
+			$frm_settings = FrmAppHelper::get_settings();
374
+			wp_die( $frm_settings->admin_permission );
375
+		}
376 376
 
377
-        global $wpdb;
377
+		global $wpdb;
378 378
 		$params = FrmForm::get_admin_params();
379
-        $message = '';
380
-        $errors = array();
381
-        $form_id = (int) $params['form'];
379
+		$message = '';
380
+		$errors = array();
381
+		$form_id = (int) $params['form'];
382 382
 
383
-        if ( $form_id ) {
384
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
383
+		if ( $form_id ) {
384
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
385 385
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
386 386
 
387
-            if ( $action ) {
388
-                // this action takes a while, so only trigger it if there are posts to delete
389
-                foreach ( $entry_ids as $entry_id ) {
390
-                    do_action( 'frm_before_destroy_entry', $entry_id );
391
-                    unset( $entry_id );
392
-                }
393
-            }
394
-
395
-            $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
396
-            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
397
-            if ( $results ) {
398
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
399
-            }
400
-        } else {
401
-            $errors = __( 'No entries were specified', 'formidable' );
402
-        }
403
-
404
-        self::display_list( $message, $errors );
405
-    }
406
-
407
-    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
408
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
409
-        return FrmFormsController::show_form( $id, $key, $title, $description );
410
-    }
411
-
412
-    public static function get_form( $filename, $form, $title, $description ) {
413
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
414
-        return FrmFormsController::get_form( $form, $title, $description );
415
-    }
416
-
417
-    public static function process_entry( $errors = '', $ajax = false ) {
387
+			if ( $action ) {
388
+				// this action takes a while, so only trigger it if there are posts to delete
389
+				foreach ( $entry_ids as $entry_id ) {
390
+					do_action( 'frm_before_destroy_entry', $entry_id );
391
+					unset( $entry_id );
392
+				}
393
+			}
394
+
395
+			$wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
396
+			$results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
397
+			if ( $results ) {
398
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
399
+			}
400
+		} else {
401
+			$errors = __( 'No entries were specified', 'formidable' );
402
+		}
403
+
404
+		self::display_list( $message, $errors );
405
+	}
406
+
407
+	public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
408
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
409
+		return FrmFormsController::show_form( $id, $key, $title, $description );
410
+	}
411
+
412
+	public static function get_form( $filename, $form, $title, $description ) {
413
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
414
+		return FrmFormsController::get_form( $form, $title, $description );
415
+	}
416
+
417
+	public static function process_entry( $errors = '', $ajax = false ) {
418 418
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
419 419
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
420
-            return;
421
-        }
420
+			return;
421
+		}
422 422
 
423
-        global $frm_vars;
423
+		global $frm_vars;
424 424
 
425 425
 		$form = FrmForm::getOne( $form_id );
426
-        if ( ! $form ) {
427
-            return;
428
-        }
426
+		if ( ! $form ) {
427
+			return;
428
+		}
429 429
 
430 430
 		$params = FrmForm::get_params( $form );
431 431
 
432
-        if ( ! isset( $frm_vars['form_params'] ) ) {
433
-            $frm_vars['form_params'] = array();
434
-        }
432
+		if ( ! isset( $frm_vars['form_params'] ) ) {
433
+			$frm_vars['form_params'] = array();
434
+		}
435 435
 		$frm_vars['form_params'][ $form->id ] = $params;
436 436
 
437 437
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
438
-            return;
439
-        }
438
+			return;
439
+		}
440 440
 
441
-        if ( $errors == '' ) {
441
+		if ( $errors == '' ) {
442 442
 			$errors = FrmEntryValidate::validate( $_POST );
443
-        }
443
+		}
444 444
 
445 445
 		/**
446 446
 		 * Use this filter to add trigger actions and add errors after
@@ -451,102 +451,102 @@  discard block
 block discarded – undo
451 451
 
452 452
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
453 453
 
454
-        if ( empty( $errors ) ) {
454
+		if ( empty( $errors ) ) {
455 455
 			$_POST['frm_skip_cookie'] = 1;
456
-            if ( $params['action'] == 'create' ) {
456
+			if ( $params['action'] == 'create' ) {
457 457
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
458 458
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
459
-                }
460
-            }
459
+				}
460
+			}
461 461
 
462
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
462
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
463 463
 			unset( $_POST['frm_skip_cookie'] );
464
-        }
465
-    }
466
-
467
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
468
-        self::_delete_entry( $atts['id'], $form );
469
-        return $url;
470
-    }
471
-
472
-    //Delete entry if not redirected
473
-    public static function delete_entry_after_save( $atts ) {
474
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
475
-    }
476
-
477
-    private static function _delete_entry( $entry_id, $form ) {
478
-        if ( ! $form ) {
479
-            return;
480
-        }
481
-
482
-        $form->options = maybe_unserialize( $form->options );
483
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
484
-            FrmEntry::destroy( $entry_id );
485
-        }
486
-    }
464
+		}
465
+	}
466
+
467
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
468
+		self::_delete_entry( $atts['id'], $form );
469
+		return $url;
470
+	}
471
+
472
+	//Delete entry if not redirected
473
+	public static function delete_entry_after_save( $atts ) {
474
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
475
+	}
476
+
477
+	private static function _delete_entry( $entry_id, $form ) {
478
+		if ( ! $form ) {
479
+			return;
480
+		}
481
+
482
+		$form->options = maybe_unserialize( $form->options );
483
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
484
+			FrmEntry::destroy( $entry_id );
485
+		}
486
+	}
487 487
 
488 488
 	public static function show_entry_shortcode( $atts ) {
489 489
 		return FrmEntryFormat::show_entry( $atts );
490 490
 	}
491 491
 
492
-    public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
493
-        $field = FrmField::getOne($meta->field_id);
494
-        if ( ! $field ) {
495
-            return $value;
496
-        }
492
+	public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
493
+		$field = FrmField::getOne($meta->field_id);
494
+		if ( ! $field ) {
495
+			return $value;
496
+		}
497 497
 
498
-        $value = self::filter_display_value($value, $field, $atts);
499
-        return $value;
500
-    }
498
+		$value = self::filter_display_value($value, $field, $atts);
499
+		return $value;
500
+	}
501 501
 
502 502
 	public static function &filter_shortcode_value( $value, $tag, $atts, $field ) {
503
-        $plain_text = add_filter('frm_plain_text_email', true);
503
+		$plain_text = add_filter('frm_plain_text_email', true);
504 504
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
505 505
 
506
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
507
-            return $value;
508
-        }
506
+		if ( isset($atts['show']) && $atts['show'] == 'value' ) {
507
+			return $value;
508
+		}
509 509
 
510
-        return self::filter_display_value($value, $field, $atts);
511
-    }
510
+		return self::filter_display_value($value, $field, $atts);
511
+	}
512 512
 
513
-    public static function &filter_display_value( $value, $field, $atts = array() ) {
514
-        $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
513
+	public static function &filter_display_value( $value, $field, $atts = array() ) {
514
+		$saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
515 515
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
516
-            return $value;
517
-        }
518
-
519
-        $f_values = $f_labels = array();
520
-
521
-        foreach ( $field->options as $opt_key => $opt ) {
522
-            if ( ! is_array($opt) ) {
523
-                continue;
524
-            }
525
-
526
-            $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
527
-            $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
528
-            if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
529
-                unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
530
-            }
531
-            unset($opt_key, $opt);
532
-        }
533
-
534
-        if ( ! empty($f_values) ) {
535
-            foreach ( (array) $value as $v_key => $val ) {
536
-                if ( in_array($val, $f_values) ) {
537
-                    $opt = array_search($val, $f_values);
538
-                    if ( is_array($value) ) {
539
-                        $value[ $v_key ] = $f_labels[ $opt ];
540
-                    } else {
541
-                        $value = $f_labels[ $opt ];
542
-                    }
543
-                }
544
-                unset($v_key, $val);
545
-            }
546
-        }
547
-
548
-        return $value;
549
-    }
516
+			return $value;
517
+		}
518
+
519
+		$f_values = $f_labels = array();
520
+
521
+		foreach ( $field->options as $opt_key => $opt ) {
522
+			if ( ! is_array($opt) ) {
523
+				continue;
524
+			}
525
+
526
+			$f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
527
+			$f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
528
+			if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
529
+				unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
530
+			}
531
+			unset($opt_key, $opt);
532
+		}
533
+
534
+		if ( ! empty($f_values) ) {
535
+			foreach ( (array) $value as $v_key => $val ) {
536
+				if ( in_array($val, $f_values) ) {
537
+					$opt = array_search($val, $f_values);
538
+					if ( is_array($value) ) {
539
+						$value[ $v_key ] = $f_labels[ $opt ];
540
+					} else {
541
+						$value = $f_labels[ $opt ];
542
+					}
543
+				}
544
+				unset($v_key, $val);
545
+			}
546
+		}
547
+
548
+		return $value;
549
+	}
550 550
 
551 551
 	public static function get_params( $form = null ) {
552 552
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' );
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
 	}
555 555
 
556 556
 	public static function entry_sidebar( $entry ) {
557
-        $data = maybe_unserialize($entry->description);
558
-        $date_format = get_option('date_format');
559
-        $time_format = get_option('time_format');
557
+		$data = maybe_unserialize($entry->description);
558
+		$date_format = get_option('date_format');
559
+		$time_format = get_option('time_format');
560 560
 		if ( isset( $data['browser'] ) ) {
561 561
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
562 562
 		}
563 563
 
564
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
565
-    }
564
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
565
+	}
566 566
 }
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
             $frm_settings = FrmAppHelper::get_settings();
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
         $screen->add_help_tab( array(
53 53
             'id'      => 'formidable-entries-tab',
54 54
             'title'   => __( 'Overview', 'formidable' ),
55
-			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
55
+			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
+        ) );
57 57
 
58 58
         $screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61
-			'<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
61
+			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62 62
     	);
63 63
 
64 64
         return $help;
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
         global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-        $columns[ $form_id .'_id' ] = 'ID';
72
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
71
+        $columns[$form_id . '_id'] = 'ID';
72
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74 74
         if ( ! $form_id ) {
75 75
             return $columns;
76 76
         }
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+        $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
79 79
 
80 80
         foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
@@ -88,30 +88,30 @@  discard block
 block discarded – undo
88 88
                 if ( $sub_form_cols ) {
89 89
                     foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
91
+                            unset( $sub_form_cols[$k] );
92 92
                             continue;
93 93
                         }
94
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
94
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
+                        unset( $sub_form_col );
96 96
                     }
97 97
                 }
98
-                unset($sub_form_cols);
98
+                unset( $sub_form_cols );
99 99
             } else {
100 100
                 $col_id = $form_col->field_key;
101 101
                 if ( $form_col->form_id != $form_id ) {
102
-                    $col_id .= '-_-form'. $form_col->form_id;
102
+                    $col_id .= '-_-form' . $form_col->form_id;
103 103
                 }
104 104
 
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
-                    $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
105
+                if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) {
106
+                    $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
107 107
                 }
108
-                $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
108
+                $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
109 109
             }
110 110
         }
111 111
 
112
-        $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
113
-        $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
114
-        $columns[ $form_id .'_ip' ] = 'IP';
112
+        $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
113
+        $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
114
+        $columns[$form_id . '_ip'] = 'IP';
115 115
 
116 116
         $frm_vars['cols'] = $columns;
117 117
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127 127
         $frm_settings = FrmAppHelper::get_settings();
128
-        if ( $meta_key != 'manage'.  sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
128
+        if ( $meta_key != 'manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
129 129
             return $check;
130 130
         }
131 131
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         global $frm_vars;
137 137
         //add a check so we don't create a loop
138
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
138
+        $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
139 139
 
140 140
         return $check;
141 141
     }
@@ -144,25 +144,25 @@  discard block
 block discarded – undo
144 144
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
145 145
         $frm_settings = FrmAppHelper::get_settings();
146 146
 
147
-        $sanitized = sanitize_title($frm_settings->menu);
148
-        if ( $meta_key != 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden' ) {
147
+        $sanitized = sanitize_title( $frm_settings->menu );
148
+        if ( $meta_key != 'manage' . $sanitized . '_page_formidable-entriescolumnshidden' ) {
149 149
             return;
150 150
         }
151 151
 
152 152
         global $frm_vars;
153
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
153
+        if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
154 154
             return; //don't continue if there's no previous value
155 155
         }
156 156
 
157 157
         foreach ( $meta_value as $mk => $mv ) {
158 158
             //remove blank values
159
-            if ( empty( $mv )  ) {
160
-                unset( $meta_value[ $mk ] );
159
+            if ( empty( $mv ) ) {
160
+                unset( $meta_value[$mk] );
161 161
             }
162 162
         }
163 163
 
164
-        $cur_form_prefix = reset($meta_value);
165
-        $cur_form_prefix = explode('_', $cur_form_prefix);
164
+        $cur_form_prefix = reset( $meta_value );
165
+        $cur_form_prefix = explode( '_', $cur_form_prefix );
166 166
         $cur_form_prefix = $cur_form_prefix[0];
167 167
         $save = false;
168 168
 
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 
182 182
             $meta_value[] = $prev_hidden;
183 183
             $save = true;
184
-            unset($form_prefix);
184
+            unset( $form_prefix );
185 185
         }
186 186
 
187 187
 		if ( $save ) {
188 188
             $user = wp_get_current_user();
189
-            update_user_option( $user->ID, 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true );
189
+            update_user_option( $user->ID, 'manage' . $sanitized . '_page_formidable-entriescolumnshidden', $meta_value, true );
190 190
         }
191 191
     }
192 192
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		foreach ( $fields as $field ) {
214 214
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
215 215
 				// Can't sort on checkboxes because they are stored serialized, or post fields
216
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
216
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
217 217
 			}
218 218
 		}
219 219
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                     break;
237 237
                 }
238 238
 
239
-                unset($form_prefix);
239
+                unset( $form_prefix );
240 240
             }
241 241
         }
242 242
 
@@ -244,36 +244,36 @@  discard block
 block discarded – undo
244 244
 			return $result;
245 245
 		}
246 246
 
247
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
247
+        $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
248 248
         $max_columns = 8;
249 249
         if ( $i <= $max_columns ) {
250 250
 			return $result;
251 251
 		}
252 252
 
253 253
         global $frm_vars;
254
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
255
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
254
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) {
255
+            $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options );
256 256
         }
257 257
 
258
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
258
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) {
259 259
             $result = $frm_vars['current_form']->options['hidden_cols'];
260 260
         } else {
261 261
             $cols = $frm_vars['cols'];
262
-            $cols = array_reverse($cols, true);
262
+            $cols = array_reverse( $cols, true );
263 263
 
264
-            $result[] = $form_id .'_id';
265
-            $i--;
264
+            $result[] = $form_id . '_id';
265
+            $i --;
266 266
 
267
-            $result[] = $form_id .'_item_key';
268
-            $i--;
267
+            $result[] = $form_id . '_item_key';
268
+            $i --;
269 269
 
270 270
 			foreach ( $cols as $col_key => $col ) {
271 271
                 if ( $i > $max_columns ) {
272 272
 					$result[] = $col_key;
273 273
 				}
274 274
                 //remove some columns by default
275
-                $i--;
276
-                unset($col_key, $col);
275
+                $i --;
276
+                unset( $col_key, $col );
277 277
             }
278 278
         }
279 279
 
@@ -310,23 +310,23 @@  discard block
 block discarded – undo
310 310
         if ( $pagenum > $total_pages && $total_pages > 0 ) {
311 311
 			$url = add_query_arg( 'paged', $total_pages );
312 312
             if ( headers_sent() ) {
313
-                echo FrmAppHelper::js_redirect($url);
313
+                echo FrmAppHelper::js_redirect( $url );
314 314
             } else {
315 315
                 wp_redirect( esc_url_raw( $url ) );
316 316
             }
317 317
             die();
318 318
         }
319 319
 
320
-        if ( empty($message) && isset($_GET['import-message']) ) {
320
+        if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
321 321
             $message = __( 'Your import is complete', 'formidable' );
322 322
         }
323 323
 
324
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
324
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
325 325
     }
326 326
 
327 327
     /* Back End CRUD */
328 328
 	public static function show( $id = 0 ) {
329
-        FrmAppHelper::permission_check('frm_view_entries');
329
+        FrmAppHelper::permission_check( 'frm_view_entries' );
330 330
 
331 331
         if ( ! $id ) {
332 332
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
             }
337 337
         }
338 338
 
339
-        $entry = FrmEntry::getOne($id, true);
339
+        $entry = FrmEntry::getOne( $id, true );
340 340
 
341
-        $data = maybe_unserialize($entry->description);
341
+        $data = maybe_unserialize( $entry->description );
342 342
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
343 343
 			$data = array( 'referrer' => $data );
344 344
 		}
@@ -346,18 +346,18 @@  discard block
 block discarded – undo
346 346
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
347 347
         $to_emails = array();
348 348
 
349
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
349
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
350 350
     }
351 351
 
352 352
     public static function destroy() {
353
-        FrmAppHelper::permission_check('frm_delete_entries');
353
+        FrmAppHelper::permission_check( 'frm_delete_entries' );
354 354
 
355 355
 		$params = FrmForm::get_admin_params();
356 356
 
357
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
357
+        if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
358 358
             //unlink entry from post
359 359
             global $wpdb;
360
-			$wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
360
+			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
361 361
         }
362 362
 
363 363
         $message = '';
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
         if ( ! isset( $frm_vars['form_params'] ) ) {
433 433
             $frm_vars['form_params'] = array();
434 434
         }
435
-		$frm_vars['form_params'][ $form->id ] = $params;
435
+		$frm_vars['form_params'][$form->id] = $params;
436 436
 
437
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
437
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
438 438
             return;
439 439
         }
440 440
 
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
 		 */
450 450
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
451 451
 
452
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
452
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
453 453
 
454 454
         if ( empty( $errors ) ) {
455 455
 			$_POST['frm_skip_cookie'] = 1;
456 456
             if ( $params['action'] == 'create' ) {
457
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
458
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
457
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
458
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
459 459
                 }
460 460
             }
461 461
 
@@ -490,28 +490,28 @@  discard block
 block discarded – undo
490 490
 	}
491 491
 
492 492
     public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
493
-        $field = FrmField::getOne($meta->field_id);
493
+        $field = FrmField::getOne( $meta->field_id );
494 494
         if ( ! $field ) {
495 495
             return $value;
496 496
         }
497 497
 
498
-        $value = self::filter_display_value($value, $field, $atts);
498
+        $value = self::filter_display_value( $value, $field, $atts );
499 499
         return $value;
500 500
     }
501 501
 
502 502
 	public static function &filter_shortcode_value( $value, $tag, $atts, $field ) {
503
-        $plain_text = add_filter('frm_plain_text_email', true);
503
+        $plain_text = add_filter( 'frm_plain_text_email', true );
504 504
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
505 505
 
506
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
506
+        if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) {
507 507
             return $value;
508 508
         }
509 509
 
510
-        return self::filter_display_value($value, $field, $atts);
510
+        return self::filter_display_value( $value, $field, $atts );
511 511
     }
512 512
 
513 513
     public static function &filter_display_value( $value, $field, $atts = array() ) {
514
-        $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
514
+        $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false;
515 515
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
516 516
             return $value;
517 517
         }
@@ -519,29 +519,29 @@  discard block
 block discarded – undo
519 519
         $f_values = $f_labels = array();
520 520
 
521 521
         foreach ( $field->options as $opt_key => $opt ) {
522
-            if ( ! is_array($opt) ) {
522
+            if ( ! is_array( $opt ) ) {
523 523
                 continue;
524 524
             }
525 525
 
526
-            $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
527
-            $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
528
-            if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
529
-                unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
526
+            $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
527
+            $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key];
528
+            if ( $f_labels[$opt_key] == $f_values[$opt_key] ) {
529
+                unset( $f_values[$opt_key], $f_labels[$opt_key] );
530 530
             }
531
-            unset($opt_key, $opt);
531
+            unset( $opt_key, $opt );
532 532
         }
533 533
 
534
-        if ( ! empty($f_values) ) {
534
+        if ( ! empty( $f_values ) ) {
535 535
             foreach ( (array) $value as $v_key => $val ) {
536
-                if ( in_array($val, $f_values) ) {
537
-                    $opt = array_search($val, $f_values);
538
-                    if ( is_array($value) ) {
539
-                        $value[ $v_key ] = $f_labels[ $opt ];
536
+                if ( in_array( $val, $f_values ) ) {
537
+                    $opt = array_search( $val, $f_values );
538
+                    if ( is_array( $value ) ) {
539
+                        $value[$v_key] = $f_labels[$opt];
540 540
                     } else {
541
-                        $value = $f_labels[ $opt ];
541
+                        $value = $f_labels[$opt];
542 542
                     }
543 543
                 }
544
-                unset($v_key, $val);
544
+                unset( $v_key, $val );
545 545
             }
546 546
         }
547 547
 
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
 	}
555 555
 
556 556
 	public static function entry_sidebar( $entry ) {
557
-        $data = maybe_unserialize($entry->description);
558
-        $date_format = get_option('date_format');
559
-        $time_format = get_option('time_format');
557
+        $data = maybe_unserialize( $entry->description );
558
+        $date_format = get_option( 'date_format' );
559
+        $time_format = get_option( 'time_format' );
560 560
 		if ( isset( $data['browser'] ) ) {
561 561
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
562 562
 		}
563 563
 
564
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
564
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
565 565
     }
566 566
 }
Please login to merge, or discard this patch.