@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * GravityView preset template |
|
4 | - * |
|
5 | - * @file class-gravityview-preset-resume-board.php |
|
6 | - * @package GravityView |
|
7 | - * @license GPL2+ |
|
8 | - * @author Katz Web Services, Inc. |
|
9 | - * @link http://gravityview.co |
|
10 | - * @copyright Copyright 2015, Katz Web Services, Inc. |
|
11 | - * |
|
12 | - * @since 1.15 |
|
13 | - */ |
|
3 | + * GravityView preset template |
|
4 | + * |
|
5 | + * @file class-gravityview-preset-resume-board.php |
|
6 | + * @package GravityView |
|
7 | + * @license GPL2+ |
|
8 | + * @author Katz Web Services, Inc. |
|
9 | + * @link http://gravityview.co |
|
10 | + * @copyright Copyright 2015, Katz Web Services, Inc. |
|
11 | + * |
|
12 | + * @since 1.15 |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class GravityView_Preset_Resume_Board extends GravityView_Default_Template_Table { |
16 | 16 |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the search RADIO input field |
|
4 | - * |
|
5 | - * @see class-search-widget.php |
|
6 | - */ |
|
3 | + * Display the search RADIO input field |
|
4 | + * |
|
5 | + * @see class-search-widget.php |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $view_id = $gravityview_view->getViewId(); |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-radio.php - No choices for field' ); |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | + do_action( 'gravityview_log_debug', 'search-field-radio.php - No choices for field' ); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
25 | 25 | |
26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
27 | + <input type="radio" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php checked( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>> |
|
28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
29 | 29 | </label> |
30 | 30 | |
31 | 31 | <?php } ?> |
@@ -28,10 +28,10 @@ |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | - } |
|
34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | + } |
|
34 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
35 | 35 | |
36 | 36 | ?> |
37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | * number input type |
4 | 4 | */ |
5 | 5 | |
6 | -if( !class_exists('GravityView_FieldType_text') ) { |
|
6 | +if ( ! class_exists( 'GravityView_FieldType_text' ) ) { |
|
7 | 7 | include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' ); |
8 | 8 | } |
9 | 9 | class GravityView_FieldType_number extends GravityView_FieldType_text { |
10 | 10 | |
11 | 11 | function render_input( $override_input = null ) { |
12 | - if( isset( $override_input ) ) { |
|
12 | + if ( isset( $override_input ) ) { |
|
13 | 13 | echo $override_input; |
14 | 14 | return; |
15 | 15 | } |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | $show_mt = $this->show_merge_tags(); |
20 | 20 | |
21 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
21 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
22 | 22 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
23 | 23 | } |
24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
24 | + $class .= ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat'; |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -4,7 +4,9 @@ |
||
4 | 4 | //set_site_transient( 'update_plugins', null ); |
5 | 5 | |
6 | 6 | // Exit if accessed directly |
7 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
7 | +if ( ! defined( 'ABSPATH' ) ) { |
|
8 | + exit; |
|
9 | +} |
|
8 | 10 | |
9 | 11 | /** |
10 | 12 | * Allows plugins to use their own update API. |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * @since 1.0 |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
37 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
38 | 38 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
39 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
40 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
39 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
40 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | // Add help page to GravityView menu |
54 | 54 | add_submenu_page( |
55 | 55 | 'edit.php?post_type=gravityview', |
56 | - __('GravityView: Getting Started', 'gravityview'), |
|
57 | - __('Getting Started', 'gravityview'), |
|
56 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
57 | + __( 'Getting Started', 'gravityview' ), |
|
58 | 58 | $this->minimum_capability, |
59 | 59 | 'gv-getting-started', |
60 | 60 | array( $this, 'getting_started_screen' ) |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return boolean $is_page True: yep; false: nope |
89 | 89 | */ |
90 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
90 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
91 | 91 | global $plugin_page; |
92 | 92 | |
93 | - if($is_page) { return $is_page; } |
|
93 | + if ( $is_page ) { return $is_page; } |
|
94 | 94 | |
95 | 95 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
109 | 109 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
110 | 110 | |
111 | - if( !$this->is_dashboard_page() ) { return; } |
|
111 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
112 | 112 | |
113 | 113 | ?> |
114 | 114 | <style type="text/css" media="screen"> |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | // Don't fetch -beta, etc. |
142 | 142 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
143 | 143 | |
144 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
144 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
145 | 145 | ?> |
146 | 146 | |
147 | 147 | <h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1> |
148 | 148 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
149 | 149 | |
150 | 150 | <h2 class="nav-tab-wrapper clear"> |
151 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
151 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
152 | 152 | <?php _e( "Getting Started", 'gravityview' ); ?> |
153 | 153 | </a> |
154 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
154 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
155 | 155 | <?php _e( "List of Changes", 'gravityview' ); ?> |
156 | 156 | </a> |
157 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
157 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
158 | 158 | <?php _e( 'Credits', 'gravityview' ); ?> |
159 | 159 | </a> |
160 | 160 | </h2> |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | <h2>Create a View</h2> |
191 | 191 | |
192 | 192 | <ol class="ol-decimal"> |
193 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
193 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
194 | 194 | <li>If you want to <strong>create a new form</strong>, click the "Start Fresh" button</li> |
195 | 195 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
196 | 196 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | </ul> |
526 | 526 | |
527 | 527 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
528 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
528 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
529 | 529 | </div> |
530 | 530 | </div> |
531 | 531 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | global $plugin_page; |
566 | 566 | |
567 | 567 | // Bail if we're just editing the plugin |
568 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
568 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
569 | 569 | |
570 | 570 | // Bail if no activation redirect |
571 | 571 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
577 | 577 | |
578 | 578 | // Don't do anything if they've already seen the new version info |
579 | - if( $upgrade === GravityView_Plugin::version ) { |
|
579 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
585 | 585 | |
586 | 586 | // Bail if activating from network, or bulk |
587 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
587 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
588 | 588 | |
589 | 589 | // First time install |
590 | - if( ! $upgrade ) { |
|
590 | + if ( ! $upgrade ) { |
|
591 | 591 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
592 | 592 | } |
593 | 593 | // Update |
@@ -158,6 +158,7 @@ |
||
158 | 158 | /** |
159 | 159 | * important! Override this class if needed |
160 | 160 | * outputs the field setting html |
161 | + * @param string $override_input |
|
161 | 162 | */ |
162 | 163 | function render_setting( $override_input = NULL ) { |
163 | 164 |
@@ -10,159 +10,159 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @var string |
12 | 12 | */ |
13 | - protected $name; |
|
13 | + protected $name; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Field settings |
17 | 17 | * |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - protected $field; |
|
20 | + protected $field; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Field current value |
24 | 24 | * |
25 | 25 | * @var mixed |
26 | 26 | */ |
27 | - protected $value; |
|
28 | - |
|
29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | - |
|
31 | - $this->name = $name; |
|
32 | - |
|
33 | - $defaults = self::get_field_defaults(); |
|
34 | - |
|
35 | - // Backward compatibility |
|
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
39 | - } |
|
40 | - |
|
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
42 | - |
|
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | - |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the default details for a field option |
|
49 | - * |
|
50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | - * - desc // option description |
|
52 | - * - value // the option default value |
|
53 | - * - label // the option label |
|
54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | - * - id // the field id |
|
56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | - * - merge_tags // if the option supports merge tags feature |
|
59 | - * - class // (new) define extra classes for the field |
|
60 | - * - tooltip // |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public static function get_field_defaults() { |
|
65 | - return array( |
|
66 | - 'desc' => '', |
|
67 | - 'value' => NULL, |
|
68 | - 'label' => '', |
|
69 | - 'left_label' => NULL, |
|
70 | - 'id' => NULL, |
|
71 | - 'type' => 'text', |
|
72 | - 'options' => NULL, |
|
73 | - 'merge_tags' => true, |
|
74 | - 'class' => '', |
|
75 | - 'tooltip' => NULL |
|
76 | - ); |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - function get_tooltip() { |
|
81 | - if( !function_exists('gform_tooltip') ) { |
|
82 | - return NULL; |
|
83 | - } |
|
84 | - |
|
85 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Build input id based on the name |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - function get_field_id() { |
|
93 | - if( isset( $this->field['id'] ) ) { |
|
94 | - return esc_attr( $this->field['id'] ); |
|
95 | - } |
|
96 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Retrieve field label |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function get_field_label() { |
|
104 | - return esc_html( trim( $this->field['label'] ) ); |
|
105 | - } |
|
27 | + protected $value; |
|
28 | + |
|
29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | + |
|
31 | + $this->name = $name; |
|
32 | + |
|
33 | + $defaults = self::get_field_defaults(); |
|
34 | + |
|
35 | + // Backward compatibility |
|
36 | + if( !empty( $field['choices'] ) ) { |
|
37 | + $field['options'] = $field['choices']; |
|
38 | + unset( $field['choices'] ); |
|
39 | + } |
|
40 | + |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | + |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | + |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the default details for a field option |
|
49 | + * |
|
50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | + * - desc // option description |
|
52 | + * - value // the option default value |
|
53 | + * - label // the option label |
|
54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | + * - id // the field id |
|
56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | + * - merge_tags // if the option supports merge tags feature |
|
59 | + * - class // (new) define extra classes for the field |
|
60 | + * - tooltip // |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public static function get_field_defaults() { |
|
65 | + return array( |
|
66 | + 'desc' => '', |
|
67 | + 'value' => NULL, |
|
68 | + 'label' => '', |
|
69 | + 'left_label' => NULL, |
|
70 | + 'id' => NULL, |
|
71 | + 'type' => 'text', |
|
72 | + 'options' => NULL, |
|
73 | + 'merge_tags' => true, |
|
74 | + 'class' => '', |
|
75 | + 'tooltip' => NULL |
|
76 | + ); |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + function get_tooltip() { |
|
81 | + if( !function_exists('gform_tooltip') ) { |
|
82 | + return NULL; |
|
83 | + } |
|
84 | + |
|
85 | + return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Build input id based on the name |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + function get_field_id() { |
|
93 | + if( isset( $this->field['id'] ) ) { |
|
94 | + return esc_attr( $this->field['id'] ); |
|
95 | + } |
|
96 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Retrieve field label |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function get_field_label() { |
|
104 | + return esc_html( trim( $this->field['label'] ) ); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Retrieve field left label |
109 | - * |
|
110 | - * @since 1.7 |
|
111 | - * |
|
109 | + * |
|
110 | + * @since 1.7 |
|
111 | + * |
|
112 | 112 | * @return string |
113 | 113 | */ |
114 | 114 | function get_field_left_label() { |
115 | 115 | return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
116 | 116 | } |
117 | 117 | |
118 | - /** |
|
119 | - * Retrieve field label class |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - function get_label_class() { |
|
123 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * Retrieve field description |
|
129 | - * @return string |
|
130 | - */ |
|
131 | - function get_field_desc() { |
|
132 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * Verify if field should have merge tags |
|
138 | - * @return boolean |
|
139 | - */ |
|
140 | - function show_merge_tags() { |
|
141 | - // Show the merge tags if the field is a list view |
|
142 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
143 | - // Or is a single entry view |
|
144 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
145 | - |
|
146 | - return ( $is_single || $is_list ); |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * important! Override this class |
|
153 | - * outputs the field option html |
|
154 | - */ |
|
155 | - function render_option() { |
|
156 | - // to replace on each field |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * important! Override this class if needed |
|
161 | - * outputs the field setting html |
|
162 | - */ |
|
163 | - function render_setting( $override_input = NULL ) { |
|
164 | - |
|
165 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
118 | + /** |
|
119 | + * Retrieve field label class |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + function get_label_class() { |
|
123 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * Retrieve field description |
|
129 | + * @return string |
|
130 | + */ |
|
131 | + function get_field_desc() { |
|
132 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * Verify if field should have merge tags |
|
138 | + * @return boolean |
|
139 | + */ |
|
140 | + function show_merge_tags() { |
|
141 | + // Show the merge tags if the field is a list view |
|
142 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
143 | + // Or is a single entry view |
|
144 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
145 | + |
|
146 | + return ( $is_single || $is_list ); |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * important! Override this class |
|
153 | + * outputs the field option html |
|
154 | + */ |
|
155 | + function render_option() { |
|
156 | + // to replace on each field |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * important! Override this class if needed |
|
161 | + * outputs the field setting html |
|
162 | + */ |
|
163 | + function render_setting( $override_input = NULL ) { |
|
164 | + |
|
165 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
166 | 166 | <th scope="row" colspan="2"> |
167 | 167 | <div> |
168 | 168 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | </td> |
183 | 183 | <?php } |
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * important! Override this class |
|
189 | - * outputs the input html part |
|
190 | - */ |
|
191 | - function render_input( $override_input ) { |
|
192 | - echo ''; |
|
193 | - } |
|
187 | + /** |
|
188 | + * important! Override this class |
|
189 | + * outputs the input html part |
|
190 | + */ |
|
191 | + function render_input( $override_input ) { |
|
192 | + echo ''; |
|
193 | + } |
|
194 | 194 | |
195 | 195 | } |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | $defaults = self::get_field_defaults(); |
34 | 34 | |
35 | 35 | // Backward compatibility |
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
36 | + if ( ! empty( $field[ 'choices' ] ) ) { |
|
37 | + $field[ 'options' ] = $field[ 'choices' ]; |
|
38 | + unset( $field[ 'choices' ] ); |
|
39 | 39 | } |
40 | 40 | |
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | 42 | |
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value; |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | |
79 | 79 | |
80 | 80 | function get_tooltip() { |
81 | - if( !function_exists('gform_tooltip') ) { |
|
81 | + if ( ! function_exists( 'gform_tooltip' ) ) { |
|
82 | 82 | return NULL; |
83 | 83 | } |
84 | 84 | |
85 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
85 | + return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . gform_tooltip( $this->field[ 'tooltip' ], false, true ) : NULL; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @return string |
91 | 91 | */ |
92 | 92 | function get_field_id() { |
93 | - if( isset( $this->field['id'] ) ) { |
|
94 | - return esc_attr( $this->field['id'] ); |
|
93 | + if ( isset( $this->field[ 'id' ] ) ) { |
|
94 | + return esc_attr( $this->field[ 'id' ] ); |
|
95 | 95 | } |
96 | 96 | return esc_attr( sanitize_html_class( $this->name ) ); |
97 | 97 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return string |
102 | 102 | */ |
103 | 103 | function get_field_label() { |
104 | - return esc_html( trim( $this->field['label'] ) ); |
|
104 | + return esc_html( trim( $this->field[ 'label' ] ) ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @return string |
113 | 113 | */ |
114 | 114 | function get_field_left_label() { |
115 | - return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
115 | + return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @return string |
121 | 121 | */ |
122 | 122 | function get_label_class() { |
123 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
123 | + return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return string |
130 | 130 | */ |
131 | 131 | function get_field_desc() { |
132 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
132 | + return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : ''; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function render_setting( $override_input = NULL ) { |
164 | 164 | |
165 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
165 | + if ( ! empty( $this->field[ 'full_width' ] ) ) { ?> |
|
166 | 166 | <th scope="row" colspan="2"> |
167 | 167 | <div> |
168 | 168 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -214,7 +214,6 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @access public |
216 | 216 | * @param array $entry |
217 | - * @param integer $field |
|
218 | 217 | * @return null|string |
219 | 218 | */ |
220 | 219 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
@@ -967,7 +966,7 @@ discard block |
||
967 | 966 | * Get the current View ID being rendered |
968 | 967 | * |
969 | 968 | * @global GravityView_View $gravityview_view |
970 | - * @return string View context "directory" or "single" |
|
969 | + * @return integer View context "directory" or "single" |
|
971 | 970 | */ |
972 | 971 | function gravityview_get_view_id() { |
973 | 972 | return GravityView_View::getInstance()->getViewId(); |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | |
147 | 147 | if( !empty( $field['custom_class'] ) ) { |
148 | 148 | |
149 | - $custom_class = $field['custom_class']; |
|
149 | + $custom_class = $field['custom_class']; |
|
150 | 150 | |
151 | - if( !empty( $entry ) ) { |
|
151 | + if( !empty( $entry ) ) { |
|
152 | 152 | |
153 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | - // replaced by a multiple-word value that should be output as a single class. |
|
155 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
153 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | + // replaced by a multiple-word value that should be output as a single class. |
|
155 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
156 | + add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
157 | 157 | |
158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
159 | 159 | |
160 | - // And then we want life to return to normal |
|
161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | - } |
|
160 | + // And then we want life to return to normal |
|
161 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | // And now we want the spaces to be handled nicely. |
165 | 165 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | 'format' => $format, |
293 | 293 | 'entry' => $entry, |
294 | 294 | 'field_type' => $field_type, /** {@since 1.6} */ |
295 | - 'field_path' => $field_path, /** {@since 1.16} */ |
|
295 | + 'field_path' => $field_path, /** {@since 1.16} */ |
|
296 | 296 | )); |
297 | 297 | |
298 | 298 | if( ! empty( $field_path ) ) { |
@@ -603,29 +603,29 @@ discard block |
||
603 | 603 | return sanitize_title( $slug ); |
604 | 604 | } |
605 | 605 | |
606 | - /** |
|
607 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
608 | - * |
|
609 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
610 | - * |
|
611 | - * @param $entry array Gravity Forms entry object |
|
612 | - * @param $form array Gravity Forms form object |
|
613 | - */ |
|
614 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
615 | - /** |
|
616 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
617 | - * @param boolean $custom Should we process the custom entry slug? |
|
618 | - */ |
|
619 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | - if( $custom ) { |
|
621 | - // create the gravityview_unique_id and save it |
|
606 | + /** |
|
607 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
608 | + * |
|
609 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
610 | + * |
|
611 | + * @param $entry array Gravity Forms entry object |
|
612 | + * @param $form array Gravity Forms form object |
|
613 | + */ |
|
614 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
615 | + /** |
|
616 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
617 | + * @param boolean $custom Should we process the custom entry slug? |
|
618 | + */ |
|
619 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | + if( $custom ) { |
|
621 | + // create the gravityview_unique_id and save it |
|
622 | 622 | |
623 | - // Get the entry hash |
|
624 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
625 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
623 | + // Get the entry hash |
|
624 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
625 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
626 | 626 | |
627 | - } |
|
628 | - } |
|
627 | + } |
|
628 | + } |
|
629 | 629 | |
630 | 630 | |
631 | 631 | |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | |
890 | 890 | // If there was an error, continue to the next term. |
891 | 891 | if ( is_wp_error( $term_link ) ) { |
892 | - continue; |
|
892 | + continue; |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | // Default Label value |
1192 | 1192 | $context['label_value'] = gv_label( $args['field'], $entry ); |
1193 | 1193 | |
1194 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1194 | + if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ) { |
|
1195 | 1195 | $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
1196 | 1196 | } |
1197 | 1197 | |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | foreach ( $context as $tag => $value ) { |
1225 | 1225 | |
1226 | 1226 | // If the tag doesn't exist just skip it |
1227 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1227 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1228 | 1228 | continue; |
1229 | 1229 | } |
1230 | 1230 |
@@ -30,29 +30,29 @@ discard block |
||
30 | 30 | |
31 | 31 | $label = ''; |
32 | 32 | |
33 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
33 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
34 | 34 | |
35 | - $label = $field['label']; |
|
35 | + $label = $field[ 'label' ]; |
|
36 | 36 | |
37 | 37 | // Support Gravity Forms 1.9+ |
38 | - if( class_exists( 'GF_Field' ) ) { |
|
38 | + if ( class_exists( 'GF_Field' ) ) { |
|
39 | 39 | |
40 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
40 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
41 | 41 | |
42 | - if( $field_object ) { |
|
42 | + if ( $field_object ) { |
|
43 | 43 | |
44 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
44 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
45 | 45 | |
46 | 46 | // This is a complex field, with labels on a per-input basis |
47 | - if( $input ) { |
|
47 | + if ( $input ) { |
|
48 | 48 | |
49 | 49 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
50 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
50 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
51 | 51 | |
52 | 52 | } else { |
53 | 53 | |
54 | 54 | // This is a field with one label |
55 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
55 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
64 | - if ( !empty( $field['custom_label'] ) ) { |
|
64 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
65 | 65 | |
66 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
66 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | |
118 | 118 | $width = NULL; |
119 | 119 | |
120 | - if( !empty( $field['width'] ) ) { |
|
121 | - $width = absint( $field['width'] ); |
|
120 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
121 | + $width = absint( $field[ 'width' ] ); |
|
122 | 122 | |
123 | 123 | // If using percentages, limit to 100% |
124 | - if( '%d%%' === $format && $width > 100 ) { |
|
124 | + if ( '%d%%' === $format && $width > 100 ) { |
|
125 | 125 | $width = 100; |
126 | 126 | } |
127 | 127 | |
@@ -144,39 +144,39 @@ discard block |
||
144 | 144 | |
145 | 145 | $classes = array(); |
146 | 146 | |
147 | - if( !empty( $field['custom_class'] ) ) { |
|
147 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
148 | 148 | |
149 | - $custom_class = $field['custom_class']; |
|
149 | + $custom_class = $field[ 'custom_class' ]; |
|
150 | 150 | |
151 | - if( !empty( $entry ) ) { |
|
151 | + if ( ! empty( $entry ) ) { |
|
152 | 152 | |
153 | 153 | // We want the merge tag to be formatted as a class. The merge tag may be |
154 | 154 | // replaced by a multiple-word value that should be output as a single class. |
155 | 155 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
156 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
157 | 157 | |
158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
159 | 159 | |
160 | 160 | // And then we want life to return to normal |
161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
161 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // And now we want the spaces to be handled nicely. |
165 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
165 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | - if(!empty($field['id'])) { |
|
170 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
171 | - $form_id = '-'.$form['id']; |
|
169 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
170 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
171 | + $form_id = '-' . $form[ 'id' ]; |
|
172 | 172 | } else { |
173 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
173 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
174 | 174 | } |
175 | 175 | |
176 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
176 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
177 | 177 | } |
178 | 178 | |
179 | - return esc_attr(implode(' ', $classes)); |
|
179 | + return esc_attr( implode( ' ', $classes ) ); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
195 | 195 | $gravityview_view = GravityView_View::getInstance(); |
196 | - $id = $field['id']; |
|
196 | + $id = $field[ 'id' ]; |
|
197 | 197 | |
198 | 198 | if ( ! empty( $id ) ) { |
199 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
200 | - $form_id = '-' . $form['id']; |
|
199 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
200 | + $form_id = '-' . $form[ 'id' ]; |
|
201 | 201 | } else { |
202 | 202 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
203 | 203 | } |
204 | 204 | |
205 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
205 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return esc_attr( $id ); |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
221 | 221 | |
222 | - if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
222 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
223 | 223 | return NULL; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $gravityview_view = GravityView_View::getInstance(); |
227 | 227 | |
228 | - if( class_exists( 'GFCache' ) ) { |
|
228 | + if ( class_exists( 'GFCache' ) ) { |
|
229 | 229 | /** |
230 | 230 | * Gravity Forms' GFCache function was thrashing the database, causing double the amount of time for the field_value() method to run. |
231 | 231 | * |
@@ -240,46 +240,46 @@ discard block |
||
240 | 240 | * @param boolean false Tell Gravity Forms not to store this as a transient |
241 | 241 | * @param int 0 Time to store the value. 0 is maximum amount of time possible. |
242 | 242 | */ |
243 | - GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry["id"] . "_" . $field_settings["id"], false, false, 0 ); |
|
243 | + GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry[ "id" ] . "_" . $field_settings[ "id" ], false, false, 0 ); |
|
244 | 244 | } |
245 | 245 | |
246 | - $field_id = $field_settings['id']; |
|
246 | + $field_id = $field_settings[ 'id' ]; |
|
247 | 247 | |
248 | 248 | $form = $gravityview_view->getForm(); |
249 | 249 | |
250 | 250 | $field = gravityview_get_field( $form, $field_id ); |
251 | 251 | |
252 | - $field_type = RGFormsModel::get_input_type($field); |
|
252 | + $field_type = RGFormsModel::get_input_type( $field ); |
|
253 | 253 | |
254 | - if( $field_type ) { |
|
255 | - $field_type = $field['type']; |
|
256 | - $value = RGFormsModel::get_lead_field_value($entry, $field); |
|
254 | + if ( $field_type ) { |
|
255 | + $field_type = $field[ 'type' ]; |
|
256 | + $value = RGFormsModel::get_lead_field_value( $entry, $field ); |
|
257 | 257 | } else { |
258 | 258 | // For non-integer field types (`id`, `date_created`, etc.) |
259 | 259 | $field_type = $field_id; |
260 | - $field['type'] = $field_id; |
|
261 | - $value = isset($entry[$field_type]) ? $entry[$field_type] : NULL; |
|
260 | + $field[ 'type' ] = $field_id; |
|
261 | + $value = isset( $entry[ $field_type ] ) ? $entry[ $field_type ] : NULL; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Prevent any PHP warnings that may be generated |
265 | 265 | ob_start(); |
266 | 266 | |
267 | - $display_value = GFCommon::get_lead_field_display($field, $value, $entry["currency"], false, $format); |
|
267 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); |
|
268 | 268 | |
269 | - if( $errors = ob_get_clean() ) { |
|
269 | + if ( $errors = ob_get_clean() ) { |
|
270 | 270 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
271 | 271 | } |
272 | 272 | |
273 | - $display_value = apply_filters("gform_entry_field_value", $display_value, $field, $entry, $form); |
|
273 | + $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); |
|
274 | 274 | |
275 | 275 | // prevent the use of merge_tags for non-admin fields |
276 | - if( !empty( $field['adminOnly'] ) ) { |
|
276 | + if ( ! empty( $field[ 'adminOnly' ] ) ) { |
|
277 | 277 | $display_value = self::replace_variables( $display_value, $form, $entry ); |
278 | 278 | } |
279 | 279 | |
280 | 280 | // Check whether the field exists in /includes/fields/{$field_type}.php |
281 | 281 | // This can be overridden by user template files. |
282 | - $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
|
282 | + $field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); |
|
283 | 283 | |
284 | 284 | // Set the field data to be available in the templates |
285 | 285 | $gravityview_view->setCurrentField( array( |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | 'entry' => $entry, |
294 | 294 | 'field_type' => $field_type, /** {@since 1.6} */ |
295 | 295 | 'field_path' => $field_path, /** {@since 1.16} */ |
296 | - )); |
|
296 | + ) ); |
|
297 | 297 | |
298 | - if( ! empty( $field_path ) ) { |
|
298 | + if ( ! empty( $field_path ) ) { |
|
299 | 299 | |
300 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
300 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); |
|
301 | 301 | |
302 | 302 | ob_start(); |
303 | 303 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | } |
314 | 314 | |
315 | - $field_settings = $gravityview_view->getCurrentField('field_settings'); |
|
315 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); |
|
316 | 316 | |
317 | 317 | /** |
318 | 318 | * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link` |
@@ -330,9 +330,9 @@ discard block |
||
330 | 330 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
331 | 331 | * |
332 | 332 | */ |
333 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
333 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { |
|
334 | 334 | |
335 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
335 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); |
|
336 | 336 | |
337 | 337 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
338 | 338 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param array $field_settings Settings for the particular GV field |
347 | 347 | * @param array $field Current field being displayed |
348 | 348 | */ |
349 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
349 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
377 | 377 | |
378 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
378 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
379 | 379 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
380 | 380 | return NULL; |
381 | 381 | } |
382 | 382 | |
383 | 383 | $href = self::entry_link( $entry ); |
384 | 384 | |
385 | - if( '' === $href ) { |
|
385 | + if ( '' === $href ) { |
|
386 | 386 | return NULL; |
387 | 387 | } |
388 | 388 | |
@@ -405,19 +405,19 @@ discard block |
||
405 | 405 | * @param boolean $wpautop Apply wpautop() to the output? |
406 | 406 | * @return string HTML of "no results" text |
407 | 407 | */ |
408 | - public static function no_results($wpautop = true) { |
|
408 | + public static function no_results( $wpautop = true ) { |
|
409 | 409 | $gravityview_view = GravityView_View::getInstance(); |
410 | 410 | |
411 | 411 | $is_search = false; |
412 | 412 | |
413 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
413 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
414 | 414 | $is_search = true; |
415 | 415 | } |
416 | 416 | |
417 | - if($is_search) { |
|
418 | - $output = __('This search returned no results.', 'gravityview'); |
|
417 | + if ( $is_search ) { |
|
418 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
419 | 419 | } else { |
420 | - $output = __('No entries match your request.', 'gravityview'); |
|
420 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | * @param string $output The existing "No Entries" text |
426 | 426 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
427 | 427 | */ |
428 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
428 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
429 | 429 | |
430 | - return $wpautop ? wpautop($output) : $output; |
|
430 | + return $wpautop ? wpautop( $output ) : $output; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
@@ -444,37 +444,37 @@ discard block |
||
444 | 444 | |
445 | 445 | $gravityview_view = GravityView_View::getInstance(); |
446 | 446 | |
447 | - if( empty( $post_id ) ) { |
|
447 | + if ( empty( $post_id ) ) { |
|
448 | 448 | |
449 | 449 | $post_id = false; |
450 | 450 | |
451 | 451 | // DataTables passes the Post ID |
452 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
452 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
453 | 453 | |
454 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
454 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
455 | 455 | |
456 | 456 | } else { |
457 | 457 | |
458 | 458 | // The Post ID has been passed via the shortcode |
459 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
459 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
460 | 460 | |
461 | 461 | $post_id = $gravityview_view->getPostId(); |
462 | 462 | |
463 | 463 | } else { |
464 | 464 | |
465 | 465 | // This is a GravityView post type |
466 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
466 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
467 | 467 | |
468 | 468 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
469 | 469 | |
470 | 470 | } else { |
471 | 471 | |
472 | 472 | // This is an embedded GravityView; use the embedded post's ID as the base. |
473 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
473 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
474 | 474 | |
475 | 475 | $post_id = $post->ID; |
476 | 476 | |
477 | - } elseif( $gravityview_view->getViewId() ) { |
|
477 | + } elseif ( $gravityview_view->getViewId() ) { |
|
478 | 478 | |
479 | 479 | // The GravityView has been embedded in a widget or in a template, and |
480 | 480 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -489,36 +489,36 @@ discard block |
||
489 | 489 | } |
490 | 490 | |
491 | 491 | // No post ID, get outta here. |
492 | - if( empty( $post_id ) ) { |
|
492 | + if ( empty( $post_id ) ) { |
|
493 | 493 | return NULL; |
494 | 494 | } |
495 | 495 | |
496 | 496 | // If we've saved the permalink in memory, use it |
497 | 497 | // @since 1.3 |
498 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
498 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
499 | 499 | |
500 | - if( empty( $link ) ) { |
|
500 | + if ( empty( $link ) ) { |
|
501 | 501 | |
502 | 502 | $link = get_permalink( $post_id ); |
503 | 503 | |
504 | 504 | // If not yet saved, cache the permalink. |
505 | 505 | // @since 1.3 |
506 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
506 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
507 | 507 | |
508 | 508 | } |
509 | 509 | |
510 | 510 | // Deal with returning to proper pagination for embedded views |
511 | - if( $link && $add_query_args ) { |
|
511 | + if ( $link && $add_query_args ) { |
|
512 | 512 | |
513 | 513 | $args = array(); |
514 | 514 | |
515 | - if( $pagenum = rgget('pagenum') ) { |
|
516 | - $args['pagenum'] = intval( $pagenum ); |
|
515 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
516 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
517 | 517 | } |
518 | 518 | |
519 | - if( $sort = rgget('sort') ) { |
|
520 | - $args['sort'] = $sort; |
|
521 | - $args['dir'] = rgget('dir'); |
|
519 | + if ( $sort = rgget( 'sort' ) ) { |
|
520 | + $args[ 'sort' ] = $sort; |
|
521 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | $link = add_query_arg( $args, $link ); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
542 | 542 | |
543 | 543 | // Generate an unique hash to use as the default value |
544 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
544 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
545 | 545 | |
546 | 546 | /** |
547 | 547 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
553 | 553 | |
554 | 554 | // Make sure we have something - use the original ID as backup. |
555 | - if( empty( $slug ) ) { |
|
555 | + if ( empty( $slug ) ) { |
|
556 | 556 | $slug = $id; |
557 | 557 | } |
558 | 558 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
582 | 582 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
583 | 583 | */ |
584 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
584 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
585 | 585 | |
586 | 586 | // If we're using custom slug... |
587 | 587 | if ( $custom ) { |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | // If it does have a hash set, and the hash is expected, use it. |
596 | 596 | // This check allows users to change the hash structure using the |
597 | 597 | // gravityview_entry_hash filter and have the old hashes expire. |
598 | - if( empty( $value ) || $value !== $hash ) { |
|
598 | + if ( empty( $value ) || $value !== $hash ) { |
|
599 | 599 | |
600 | 600 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); |
601 | 601 | |
@@ -623,12 +623,12 @@ discard block |
||
623 | 623 | * @param boolean $custom Should we process the custom entry slug? |
624 | 624 | */ |
625 | 625 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
626 | - if( $custom ) { |
|
626 | + if ( $custom ) { |
|
627 | 627 | // create the gravityview_unique_id and save it |
628 | 628 | |
629 | 629 | // Get the entry hash |
630 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
631 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
630 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
631 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash ); |
|
632 | 632 | |
633 | 633 | } |
634 | 634 | } |
@@ -645,14 +645,14 @@ discard block |
||
645 | 645 | */ |
646 | 646 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
647 | 647 | |
648 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
648 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
649 | 649 | $entry = GVCommon::get_entry( $entry ); |
650 | - } else if( empty( $entry ) ) { |
|
650 | + } else if ( empty( $entry ) ) { |
|
651 | 651 | $entry = GravityView_frontend::getInstance()->getEntry(); |
652 | 652 | } |
653 | 653 | |
654 | 654 | // Second parameter used to be passed as $field; this makes sure it's not an array |
655 | - if( !is_numeric( $post_id ) ) { |
|
655 | + if ( ! is_numeric( $post_id ) ) { |
|
656 | 656 | $post_id = NULL; |
657 | 657 | } |
658 | 658 | |
@@ -660,19 +660,19 @@ discard block |
||
660 | 660 | $directory_link = self::directory_link( $post_id, false ); |
661 | 661 | |
662 | 662 | // No post ID? Get outta here. |
663 | - if( empty( $directory_link ) ) { |
|
663 | + if ( empty( $directory_link ) ) { |
|
664 | 664 | return ''; |
665 | 665 | } |
666 | 666 | |
667 | 667 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
668 | 668 | |
669 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
669 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
670 | 670 | |
671 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
671 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
672 | 672 | |
673 | 673 | $args = array(); |
674 | 674 | |
675 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; |
|
675 | + $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/'; |
|
676 | 676 | |
677 | 677 | } else { |
678 | 678 | |
@@ -682,18 +682,18 @@ discard block |
||
682 | 682 | /** |
683 | 683 | * @since 1.7.3 |
684 | 684 | */ |
685 | - if( $add_directory_args ) { |
|
685 | + if ( $add_directory_args ) { |
|
686 | 686 | |
687 | - if( !empty( $_GET['pagenum'] ) ) { |
|
688 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
687 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
688 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | /** |
692 | 692 | * @since 1.7 |
693 | 693 | */ |
694 | - if( $sort = rgget('sort') ) { |
|
695 | - $args['sort'] = $sort; |
|
696 | - $args['dir'] = rgget('dir'); |
|
694 | + if ( $sort = rgget( 'sort' ) ) { |
|
695 | + $args[ 'sort' ] = $sort; |
|
696 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | } |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
704 | 704 | * @see GravityView_frontend::get_context_view_id() |
705 | 705 | */ |
706 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
707 | - $args['gvid'] = gravityview_get_view_id(); |
|
706 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
707 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | return add_query_arg( $args, $directory_link ); |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | } |
723 | 723 | |
724 | 724 | function gv_class( $field, $form = NULL, $entry = array() ) { |
725 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
725 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -744,11 +744,11 @@ discard block |
||
744 | 744 | |
745 | 745 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
746 | 746 | |
747 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
747 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
748 | 748 | $default_css_class .= ' hidden'; |
749 | 749 | } |
750 | 750 | |
751 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
751 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
752 | 752 | |
753 | 753 | /** |
754 | 754 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | $css_class = gravityview_sanitize_html_class( $css_class ); |
761 | 761 | |
762 | - if( $echo ) { |
|
762 | + if ( $echo ) { |
|
763 | 763 | echo $css_class; |
764 | 764 | } |
765 | 765 | |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | $value = GravityView_API::field_value( $entry, $field ); |
772 | 772 | |
773 | - if( $value === '') { |
|
773 | + if ( $value === '' ) { |
|
774 | 774 | /** |
775 | 775 | * @filter `gravityview_empty_value` What to display when a field is empty |
776 | 776 | * @param string $value (empty string) |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | return GravityView_API::entry_link( $entry, $post_id ); |
790 | 790 | } |
791 | 791 | |
792 | -function gv_no_results($wpautop = true) { |
|
792 | +function gv_no_results( $wpautop = true ) { |
|
793 | 793 | return GravityView_API::no_results( $wpautop ); |
794 | 794 | } |
795 | 795 | |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | |
803 | 803 | $href = gv_directory_link(); |
804 | 804 | |
805 | - if( empty( $href ) ) { return NULL; } |
|
805 | + if ( empty( $href ) ) { return NULL; } |
|
806 | 806 | |
807 | 807 | // calculate link label |
808 | 808 | $gravityview_view = GravityView_View::getInstance(); |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
820 | 820 | 'data-viewid' => $gravityview_view->getViewId() |
821 | - )); |
|
821 | + ) ); |
|
822 | 822 | |
823 | 823 | return $link; |
824 | 824 | } |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | */ |
838 | 838 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
839 | 839 | |
840 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
840 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
841 | 841 | |
842 | 842 | // For the complete field value as generated by Gravity Forms |
843 | 843 | return $display_value; |
@@ -867,16 +867,16 @@ discard block |
||
867 | 867 | |
868 | 868 | $terms = explode( ', ', $value ); |
869 | 869 | |
870 | - foreach ($terms as $term_name ) { |
|
870 | + foreach ( $terms as $term_name ) { |
|
871 | 871 | |
872 | 872 | // If we're processing a category, |
873 | - if( $taxonomy === 'category' ) { |
|
873 | + if ( $taxonomy === 'category' ) { |
|
874 | 874 | |
875 | 875 | // Use rgexplode to prevent errors if : doesn't exist |
876 | 876 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
877 | 877 | |
878 | 878 | // The explode was succesful; we have the category ID |
879 | - if( !empty( $term_id )) { |
|
879 | + if ( ! empty( $term_id ) ) { |
|
880 | 880 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
881 | 881 | } else { |
882 | 882 | // We have to fall back to the name |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | } |
890 | 890 | |
891 | 891 | // There's still a tag/category here. |
892 | - if( $term ) { |
|
892 | + if ( $term ) { |
|
893 | 893 | |
894 | 894 | $term_link = get_term_link( $term, $taxonomy ); |
895 | 895 | |
@@ -898,11 +898,11 @@ discard block |
||
898 | 898 | continue; |
899 | 899 | } |
900 | 900 | |
901 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
901 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
902 | 902 | } |
903 | 903 | } |
904 | 904 | |
905 | - return implode(', ', $output ); |
|
905 | + return implode( ', ', $output ); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | /** |
@@ -916,8 +916,8 @@ discard block |
||
916 | 916 | |
917 | 917 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
918 | 918 | |
919 | - if( empty( $link ) ) { |
|
920 | - return strip_tags( $output); |
|
919 | + if ( empty( $link ) ) { |
|
920 | + return strip_tags( $output ); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | return $output; |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $fe = GravityView_frontend::getInstance(); |
937 | 937 | |
938 | 938 | // Solve problem when loading content via admin-ajax.php |
939 | - if( ! $fe->getGvOutputData() ) { |
|
939 | + if ( ! $fe->getGvOutputData() ) { |
|
940 | 940 | |
941 | 941 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
942 | 942 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | } |
945 | 945 | |
946 | 946 | // Make 100% sure that we're dealing with a properly called situation |
947 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
947 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
948 | 948 | |
949 | 949 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
950 | 950 | |
@@ -964,10 +964,10 @@ discard block |
||
964 | 964 | |
965 | 965 | $fe = GravityView_frontend::getInstance(); |
966 | 966 | |
967 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
967 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
968 | 968 | |
969 | 969 | // If not set, grab the current view ID |
970 | - if( empty( $view_id ) ) { |
|
970 | + if ( empty( $view_id ) ) { |
|
971 | 971 | $view_id = $fe->get_context_view_id(); |
972 | 972 | } |
973 | 973 | |
@@ -1032,11 +1032,11 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
1034 | 1034 | |
1035 | - if( $is_edit_entry ) { |
|
1035 | + if ( $is_edit_entry ) { |
|
1036 | 1036 | $context = 'edit'; |
1037 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1037 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1038 | 1038 | $context = 'single'; |
1039 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
1039 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
1040 | 1040 | $context = GravityView_View::getInstance()->getContext(); |
1041 | 1041 | } |
1042 | 1042 | |
@@ -1064,12 +1064,12 @@ discard block |
||
1064 | 1064 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
1065 | 1065 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1066 | 1066 | |
1067 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1068 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1067 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1068 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1072 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
1071 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1072 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1147,12 +1147,12 @@ discard block |
||
1147 | 1147 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
1148 | 1148 | |
1149 | 1149 | // Required fields. |
1150 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1150 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1151 | 1151 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
1152 | 1152 | return ''; |
1153 | 1153 | } |
1154 | 1154 | |
1155 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1155 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1156 | 1156 | |
1157 | 1157 | /** |
1158 | 1158 | * Create the content variables for replacing. |
@@ -1168,37 +1168,37 @@ discard block |
||
1168 | 1168 | 'field_id' => '', |
1169 | 1169 | ); |
1170 | 1170 | |
1171 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
1171 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
1172 | 1172 | |
1173 | 1173 | // If the value is empty and we're hiding empty, return empty. |
1174 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1174 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1175 | 1175 | return ''; |
1176 | 1176 | } |
1177 | 1177 | |
1178 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1179 | - $context['value'] = wpautop( $context['value'] ); |
|
1178 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1179 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | // Get width setting, if exists |
1183 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
1183 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
1184 | 1184 | |
1185 | 1185 | // If replacing with CSS inline formatting, let's do it. |
1186 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
1186 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
1187 | 1187 | |
1188 | 1188 | // Grab the Class using `gv_class` |
1189 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
1190 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
1189 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1190 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1191 | 1191 | |
1192 | 1192 | // Get field label if needed |
1193 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
1194 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
1193 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
1194 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | // Default Label value |
1198 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
1198 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
1199 | 1199 | |
1200 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1201 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1200 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
1201 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | * @param string $markup The HTML for the markup |
1208 | 1208 | * @param array $args All args for the field output |
1209 | 1209 | */ |
1210 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
1210 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
1211 | 1211 | |
1212 | 1212 | /** |
1213 | 1213 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | foreach ( $context as $tag => $value ) { |
1231 | 1231 | |
1232 | 1232 | // If the tag doesn't exist just skip it |
1233 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1233 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1234 | 1234 | continue; |
1235 | 1235 | } |
1236 | 1236 |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @package GravityView |
|
4 | - * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | - * @global $post |
|
6 | - */ |
|
3 | + * @package GravityView |
|
4 | + * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | + * @global $post |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | global $post; |
9 | 9 | ?> |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param GF_Field_List $field Gravity Forms field |
27 | 27 | * @param string|array $field_value Serialized or unserialized array value for the field |
28 | - * @param int|string $column_id The numeric key of the column (0-index) or the label of the column |
|
28 | + * @param integer $column_id The numeric key of the column (0-index) or the label of the column |
|
29 | 29 | * @param string $format If set to 'raw', return an array of values for the column. Otherwise, allow Gravity Forms to render using `html` or `text` |
30 | 30 | * |
31 | 31 | * @return array|string|null Returns null if the $field_value passed wasn't an array or serialized array |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $list_rows = maybe_unserialize( $field_value ); |
62 | 62 | |
63 | - if( ! is_array( $list_rows ) ) { |
|
63 | + if ( ! is_array( $list_rows ) ) { |
|
64 | 64 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
65 | 65 | return null; |
66 | 66 | } |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | foreach ( $list_row as $column_key => $column_value ) { |
74 | 74 | |
75 | 75 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
76 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
77 | - $column_values[] = $column_value; |
|
76 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
77 | + $column_values[ ] = $column_value; |
|
78 | 78 | } |
79 | 79 | $current_column++; |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | 83 | // Return the array of values |
84 | - if( 'raw' === $format ) { |
|
84 | + if ( 'raw' === $format ) { |
|
85 | 85 | return $column_values; |
86 | 86 | } |
87 | 87 | // Return the Gravity Forms Field output |
@@ -104,26 +104,26 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function _filter_field_label( $label, $field, $form, $entry ) { |
106 | 106 | |
107 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
107 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
108 | 108 | |
109 | 109 | // Not a list field |
110 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
110 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
111 | 111 | return $label; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Custom label is defined, so use it |
115 | - if( ! empty( $field['custom_label'] ) ) { |
|
115 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
116 | 116 | return $label; |
117 | 117 | } |
118 | 118 | |
119 | - $field_id_array = explode( '.', $field['id'] ); |
|
119 | + $field_id_array = explode( '.', $field[ 'id' ] ); |
|
120 | 120 | |
121 | 121 | // Parent field, not column field |
122 | - if( ! isset( $field_id_array[1] ) ) { |
|
122 | + if ( ! isset( $field_id_array[ 1 ] ) ) { |
|
123 | 123 | return $label; |
124 | 124 | } |
125 | 125 | |
126 | - $column_id = intval( $field_id_array[1] ); |
|
126 | + $column_id = intval( $field_id_array[ 1 ] ); |
|
127 | 127 | |
128 | 128 | return self::get_column_label( $field_object, $column_id, $label ); |
129 | 129 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
143 | 143 | |
144 | 144 | // Doesn't have columns enabled |
145 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
145 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
146 | 146 | return $backup_label; |
147 | 147 | } |
148 | 148 |
@@ -227,7 +227,7 @@ |
||
227 | 227 | */ |
228 | 228 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField() ); |
229 | 229 | |
230 | - $content = gravityview_get_link( $link, $content, $link_atts ); |
|
230 | + $content = gravityview_get_link( $link, $content, $link_atts ); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $output_arr[] = array( |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | |
21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
22 | 22 | |
23 | - unset( $field_options['search_filter'] ); |
|
23 | + unset( $field_options[ 'search_filter' ] ); |
|
24 | 24 | |
25 | - if( 'edit' === $context ) { |
|
25 | + if ( 'edit' === $context ) { |
|
26 | 26 | return $field_options; |
27 | 27 | } |
28 | 28 | |
29 | - $add_options['link_to_file'] = array( |
|
29 | + $add_options[ 'link_to_file' ] = array( |
|
30 | 30 | 'type' => 'checkbox', |
31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
33 | 33 | 'value' => false, |
34 | 34 | 'merge_tags' => false, |
35 | 35 | ); |
@@ -59,22 +59,22 @@ discard block |
||
59 | 59 | $output_arr = array(); |
60 | 60 | |
61 | 61 | // Get an array of file paths for the field. |
62 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
62 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
63 | 63 | |
64 | 64 | // Process each file path |
65 | - foreach( $file_paths as $file_path ) { |
|
65 | + foreach ( $file_paths as $file_path ) { |
|
66 | 66 | |
67 | 67 | // If the site is HTTPS, use HTTPS |
68 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
68 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
69 | 69 | |
70 | 70 | // This is from Gravity Forms's code |
71 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
71 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
72 | 72 | |
73 | 73 | // If the field is set to link to the single entry, link to it. |
74 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
74 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
75 | 75 | |
76 | 76 | // Get file path information |
77 | - $file_path_info = pathinfo($file_path); |
|
77 | + $file_path_info = pathinfo( $file_path ); |
|
78 | 78 | |
79 | 79 | $html_format = NULL; |
80 | 80 | |
@@ -83,30 +83,30 @@ discard block |
||
83 | 83 | $disable_wrapped_link = false; |
84 | 84 | |
85 | 85 | // Is this an image? |
86 | - $image = new GravityView_Image(array( |
|
86 | + $image = new GravityView_Image( array( |
|
87 | 87 | 'src' => $file_path, |
88 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
89 | - 'alt' => $field_settings['label'], |
|
90 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
91 | - )); |
|
88 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
89 | + 'alt' => $field_settings[ 'label' ], |
|
90 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
91 | + ) ); |
|
92 | 92 | |
93 | 93 | $content = $image->html(); |
94 | 94 | |
95 | 95 | // The new default content is the image, if it exists. If not, use the file name as the content. |
96 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
96 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
97 | 97 | |
98 | 98 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
99 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
99 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
100 | 100 | |
101 | 101 | |
102 | - switch( true ) { |
|
102 | + switch ( true ) { |
|
103 | 103 | |
104 | 104 | // Audio file |
105 | 105 | case in_array( $extension, wp_get_audio_extensions() ): |
106 | 106 | |
107 | 107 | $disable_lightbox = true; |
108 | 108 | |
109 | - if( shortcode_exists( 'audio' ) ) { |
|
109 | + if ( shortcode_exists( 'audio' ) ) { |
|
110 | 110 | |
111 | 111 | $disable_wrapped_link = true; |
112 | 112 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | */ |
118 | 118 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
119 | 119 | 'src' => $file_path, |
120 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
121 | - )); |
|
120 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
121 | + ) ); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Generate the audio shortcode |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | $disable_lightbox = true; |
138 | 138 | |
139 | - if( shortcode_exists( 'video' ) ) { |
|
139 | + if ( shortcode_exists( 'video' ) ) { |
|
140 | 140 | |
141 | 141 | $disable_wrapped_link = true; |
142 | 142 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | */ |
148 | 148 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
149 | 149 | 'src' => $file_path, |
150 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
151 | - )); |
|
150 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
151 | + ) ); |
|
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Generate the video shortcode |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | break; |
171 | 171 | |
172 | 172 | // if not image, do not set the lightbox (@since 1.5.3) |
173 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
173 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
174 | 174 | |
175 | 175 | $disable_lightbox = true; |
176 | 176 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | |
181 | 181 | // If using Link to File, override the content. |
182 | 182 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
183 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
183 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
184 | 184 | |
185 | 185 | // Force the content to be the file name |
186 | - $content = $file_path_info["basename"]; |
|
186 | + $content = $file_path_info[ "basename" ]; |
|
187 | 187 | |
188 | 188 | // Restore the wrapped link |
189 | 189 | $disable_wrapped_link = false; |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | // Whether to use lightbox or not |
194 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
194 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
195 | 195 | |
196 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
196 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
197 | 197 | |
198 | 198 | } else { |
199 | 199 | |
200 | 200 | $link_atts = array( |
201 | - 'rel' => sprintf( "%s-%s", $gv_class, $entry['id'] ), |
|
201 | + 'rel' => sprintf( "%s-%s", $gv_class, $entry[ 'id' ] ), |
|
202 | 202 | 'target' => '_blank', |
203 | 203 | 'class' => 'thickbox', |
204 | 204 | ); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
223 | 223 | |
224 | 224 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
225 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
225 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Modify the link text (defaults to the file name) |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $content = gravityview_get_link( $link, $content, $link_atts ); |
238 | 238 | } |
239 | 239 | |
240 | - $output_arr[] = array( |
|
240 | + $output_arr[ ] = array( |
|
241 | 241 | 'file_path' => $file_path, |
242 | 242 | 'content' => $content |
243 | 243 | ); |