@@ -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 } ?> |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the search single CHECKBOX input field ( on/off type) |
|
4 | - * |
|
5 | - * @see class-search-widget.php |
|
6 | - */ |
|
3 | + * Display the search single CHECKBOX input field ( on/off type) |
|
4 | + * |
|
5 | + * @see class-search-widget.php |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $view_id = $gravityview_view->getViewId(); |
@@ -12,8 +12,8 @@ |
||
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class="gv-search-box"> |
15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio"> |
|
16 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>> |
|
17 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { echo esc_html( $search_field['label'] ); } ?> |
|
15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio"> |
|
16 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>> |
|
17 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?> |
|
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | \ No newline at end of file |
@@ -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 |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
373 | 373 | |
374 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
374 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
375 | 375 | |
376 | 376 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
377 | 377 | |
@@ -399,19 +399,19 @@ discard block |
||
399 | 399 | * @param boolean $wpautop Apply wpautop() to the output? |
400 | 400 | * @return string HTML of "no results" text |
401 | 401 | */ |
402 | - public static function no_results($wpautop = true) { |
|
402 | + public static function no_results( $wpautop = true ) { |
|
403 | 403 | $gravityview_view = GravityView_View::getInstance(); |
404 | 404 | |
405 | 405 | $is_search = false; |
406 | 406 | |
407 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
407 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
408 | 408 | $is_search = true; |
409 | 409 | } |
410 | 410 | |
411 | - if($is_search) { |
|
412 | - $output = __('This search returned no results.', 'gravityview'); |
|
411 | + if ( $is_search ) { |
|
412 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
413 | 413 | } else { |
414 | - $output = __('No entries match your request.', 'gravityview'); |
|
414 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -419,9 +419,9 @@ discard block |
||
419 | 419 | * @param string $output The existing "No Entries" text |
420 | 420 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
421 | 421 | */ |
422 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
422 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
423 | 423 | |
424 | - return $wpautop ? wpautop($output) : $output; |
|
424 | + return $wpautop ? wpautop( $output ) : $output; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | /** |
@@ -438,37 +438,37 @@ discard block |
||
438 | 438 | |
439 | 439 | $gravityview_view = GravityView_View::getInstance(); |
440 | 440 | |
441 | - if( empty( $post_id ) ) { |
|
441 | + if ( empty( $post_id ) ) { |
|
442 | 442 | |
443 | 443 | $post_id = false; |
444 | 444 | |
445 | 445 | // DataTables passes the Post ID |
446 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
446 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
447 | 447 | |
448 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
448 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
449 | 449 | |
450 | 450 | } else { |
451 | 451 | |
452 | 452 | // The Post ID has been passed via the shortcode |
453 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
453 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
454 | 454 | |
455 | 455 | $post_id = $gravityview_view->getPostId(); |
456 | 456 | |
457 | 457 | } else { |
458 | 458 | |
459 | 459 | // This is a GravityView post type |
460 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
460 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
461 | 461 | |
462 | 462 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
463 | 463 | |
464 | 464 | } else { |
465 | 465 | |
466 | 466 | // This is an embedded GravityView; use the embedded post's ID as the base. |
467 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
467 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
468 | 468 | |
469 | 469 | $post_id = $post->ID; |
470 | 470 | |
471 | - } elseif( $gravityview_view->getViewId() ) { |
|
471 | + } elseif ( $gravityview_view->getViewId() ) { |
|
472 | 472 | |
473 | 473 | // The GravityView has been embedded in a widget or in a template, and |
474 | 474 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -483,36 +483,36 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | // No post ID, get outta here. |
486 | - if( empty( $post_id ) ) { |
|
486 | + if ( empty( $post_id ) ) { |
|
487 | 487 | return NULL; |
488 | 488 | } |
489 | 489 | |
490 | 490 | // If we've saved the permalink in memory, use it |
491 | 491 | // @since 1.3 |
492 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
492 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
493 | 493 | |
494 | - if( empty( $link ) ) { |
|
494 | + if ( empty( $link ) ) { |
|
495 | 495 | |
496 | 496 | $link = get_permalink( $post_id ); |
497 | 497 | |
498 | 498 | // If not yet saved, cache the permalink. |
499 | 499 | // @since 1.3 |
500 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
500 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
501 | 501 | |
502 | 502 | } |
503 | 503 | |
504 | 504 | // Deal with returning to proper pagination for embedded views |
505 | - if( $link && $add_query_args ) { |
|
505 | + if ( $link && $add_query_args ) { |
|
506 | 506 | |
507 | 507 | $args = array(); |
508 | 508 | |
509 | - if( $pagenum = rgget('pagenum') ) { |
|
510 | - $args['pagenum'] = intval( $pagenum ); |
|
509 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
510 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
511 | 511 | } |
512 | 512 | |
513 | - if( $sort = rgget('sort') ) { |
|
514 | - $args['sort'] = $sort; |
|
515 | - $args['dir'] = rgget('dir'); |
|
513 | + if ( $sort = rgget( 'sort' ) ) { |
|
514 | + $args[ 'sort' ] = $sort; |
|
515 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | $link = add_query_arg( $args, $link ); |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
536 | 536 | |
537 | 537 | // Generate an unique hash to use as the default value |
538 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
538 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
539 | 539 | |
540 | 540 | /** |
541 | 541 | * @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}` |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
547 | 547 | |
548 | 548 | // Make sure we have something - use the original ID as backup. |
549 | - if( empty( $slug ) ) { |
|
549 | + if ( empty( $slug ) ) { |
|
550 | 550 | $slug = $id; |
551 | 551 | } |
552 | 552 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
576 | 576 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
577 | 577 | */ |
578 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
578 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
579 | 579 | |
580 | 580 | // If we're using custom slug... |
581 | 581 | if ( $custom ) { |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | // If it does have a hash set, and the hash is expected, use it. |
590 | 590 | // This check allows users to change the hash structure using the |
591 | 591 | // gravityview_entry_hash filter and have the old hashes expire. |
592 | - if( empty( $value ) || $value !== $hash ) { |
|
592 | + if ( empty( $value ) || $value !== $hash ) { |
|
593 | 593 | |
594 | 594 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); |
595 | 595 | |
@@ -617,12 +617,12 @@ discard block |
||
617 | 617 | * @param boolean $custom Should we process the custom entry slug? |
618 | 618 | */ |
619 | 619 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
620 | - if( $custom ) { |
|
620 | + if ( $custom ) { |
|
621 | 621 | // create the gravityview_unique_id and save it |
622 | 622 | |
623 | 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 ); |
|
624 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
625 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash ); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | } |
@@ -639,14 +639,14 @@ discard block |
||
639 | 639 | */ |
640 | 640 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
641 | 641 | |
642 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
642 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
643 | 643 | $entry = GVCommon::get_entry( $entry ); |
644 | - } else if( empty( $entry ) ) { |
|
644 | + } else if ( empty( $entry ) ) { |
|
645 | 645 | $entry = GravityView_frontend::getInstance()->getEntry(); |
646 | 646 | } |
647 | 647 | |
648 | 648 | // Second parameter used to be passed as $field; this makes sure it's not an array |
649 | - if( !is_numeric( $post_id ) ) { |
|
649 | + if ( ! is_numeric( $post_id ) ) { |
|
650 | 650 | $post_id = NULL; |
651 | 651 | } |
652 | 652 | |
@@ -654,19 +654,19 @@ discard block |
||
654 | 654 | $directory_link = self::directory_link( $post_id, false ); |
655 | 655 | |
656 | 656 | // No post ID? Get outta here. |
657 | - if( empty( $directory_link ) ) { |
|
657 | + if ( empty( $directory_link ) ) { |
|
658 | 658 | return ''; |
659 | 659 | } |
660 | 660 | |
661 | 661 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
662 | 662 | |
663 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
663 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
664 | 664 | |
665 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
665 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
666 | 666 | |
667 | 667 | $args = array(); |
668 | 668 | |
669 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; |
|
669 | + $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/'; |
|
670 | 670 | |
671 | 671 | } else { |
672 | 672 | |
@@ -676,18 +676,18 @@ discard block |
||
676 | 676 | /** |
677 | 677 | * @since 1.7.3 |
678 | 678 | */ |
679 | - if( $add_directory_args ) { |
|
679 | + if ( $add_directory_args ) { |
|
680 | 680 | |
681 | - if( !empty( $_GET['pagenum'] ) ) { |
|
682 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
681 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
682 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /** |
686 | 686 | * @since 1.7 |
687 | 687 | */ |
688 | - if( $sort = rgget('sort') ) { |
|
689 | - $args['sort'] = $sort; |
|
690 | - $args['dir'] = rgget('dir'); |
|
688 | + if ( $sort = rgget( 'sort' ) ) { |
|
689 | + $args[ 'sort' ] = $sort; |
|
690 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | } |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
698 | 698 | * @see GravityView_frontend::get_context_view_id() |
699 | 699 | */ |
700 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
701 | - $args['gvid'] = gravityview_get_view_id(); |
|
700 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
701 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | return add_query_arg( $args, $directory_link ); |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | } |
717 | 717 | |
718 | 718 | function gv_class( $field, $form = NULL, $entry = array() ) { |
719 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
719 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | /** |
@@ -738,11 +738,11 @@ discard block |
||
738 | 738 | |
739 | 739 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
740 | 740 | |
741 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
741 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
742 | 742 | $default_css_class .= ' hidden'; |
743 | 743 | } |
744 | 744 | |
745 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
745 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
746 | 746 | |
747 | 747 | /** |
748 | 748 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | |
754 | 754 | $css_class = gravityview_sanitize_html_class( $css_class ); |
755 | 755 | |
756 | - if( $echo ) { |
|
756 | + if ( $echo ) { |
|
757 | 757 | echo $css_class; |
758 | 758 | } |
759 | 759 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | |
765 | 765 | $value = GravityView_API::field_value( $entry, $field ); |
766 | 766 | |
767 | - if( $value === '') { |
|
767 | + if ( $value === '' ) { |
|
768 | 768 | /** |
769 | 769 | * @filter `gravityview_empty_value` What to display when a field is empty |
770 | 770 | * @param string $value (empty string) |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | return GravityView_API::entry_link( $entry, $post_id ); |
784 | 784 | } |
785 | 785 | |
786 | -function gv_no_results($wpautop = true) { |
|
786 | +function gv_no_results( $wpautop = true ) { |
|
787 | 787 | return GravityView_API::no_results( $wpautop ); |
788 | 788 | } |
789 | 789 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | |
797 | 797 | $href = gv_directory_link(); |
798 | 798 | |
799 | - if( empty( $href ) ) { return NULL; } |
|
799 | + if ( empty( $href ) ) { return NULL; } |
|
800 | 800 | |
801 | 801 | // calculate link label |
802 | 802 | $gravityview_view = GravityView_View::getInstance(); |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | |
813 | 813 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
814 | 814 | 'data-viewid' => $gravityview_view->getViewId() |
815 | - )); |
|
815 | + ) ); |
|
816 | 816 | |
817 | 817 | return $link; |
818 | 818 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | */ |
832 | 832 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
833 | 833 | |
834 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
834 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
835 | 835 | |
836 | 836 | // For the complete field value as generated by Gravity Forms |
837 | 837 | return $display_value; |
@@ -861,16 +861,16 @@ discard block |
||
861 | 861 | |
862 | 862 | $terms = explode( ', ', $value ); |
863 | 863 | |
864 | - foreach ($terms as $term_name ) { |
|
864 | + foreach ( $terms as $term_name ) { |
|
865 | 865 | |
866 | 866 | // If we're processing a category, |
867 | - if( $taxonomy === 'category' ) { |
|
867 | + if ( $taxonomy === 'category' ) { |
|
868 | 868 | |
869 | 869 | // Use rgexplode to prevent errors if : doesn't exist |
870 | 870 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
871 | 871 | |
872 | 872 | // The explode was succesful; we have the category ID |
873 | - if( !empty( $term_id )) { |
|
873 | + if ( ! empty( $term_id ) ) { |
|
874 | 874 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
875 | 875 | } else { |
876 | 876 | // We have to fall back to the name |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | } |
884 | 884 | |
885 | 885 | // There's still a tag/category here. |
886 | - if( $term ) { |
|
886 | + if ( $term ) { |
|
887 | 887 | |
888 | 888 | $term_link = get_term_link( $term, $taxonomy ); |
889 | 889 | |
@@ -892,11 +892,11 @@ discard block |
||
892 | 892 | continue; |
893 | 893 | } |
894 | 894 | |
895 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
895 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | - return implode(', ', $output ); |
|
899 | + return implode( ', ', $output ); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | /** |
@@ -910,8 +910,8 @@ discard block |
||
910 | 910 | |
911 | 911 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
912 | 912 | |
913 | - if( empty( $link ) ) { |
|
914 | - return strip_tags( $output); |
|
913 | + if ( empty( $link ) ) { |
|
914 | + return strip_tags( $output ); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | return $output; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $fe = GravityView_frontend::getInstance(); |
931 | 931 | |
932 | 932 | // Solve problem when loading content via admin-ajax.php |
933 | - if( ! $fe->getGvOutputData() ) { |
|
933 | + if ( ! $fe->getGvOutputData() ) { |
|
934 | 934 | |
935 | 935 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
936 | 936 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | } |
939 | 939 | |
940 | 940 | // Make 100% sure that we're dealing with a properly called situation |
941 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
941 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
942 | 942 | |
943 | 943 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
944 | 944 | |
@@ -958,10 +958,10 @@ discard block |
||
958 | 958 | |
959 | 959 | $fe = GravityView_frontend::getInstance(); |
960 | 960 | |
961 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
961 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
962 | 962 | |
963 | 963 | // If not set, grab the current view ID |
964 | - if( empty( $view_id ) ) { |
|
964 | + if ( empty( $view_id ) ) { |
|
965 | 965 | $view_id = $fe->get_context_view_id(); |
966 | 966 | } |
967 | 967 | |
@@ -1026,11 +1026,11 @@ discard block |
||
1026 | 1026 | */ |
1027 | 1027 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
1028 | 1028 | |
1029 | - if( $is_edit_entry ) { |
|
1029 | + if ( $is_edit_entry ) { |
|
1030 | 1030 | $context = 'edit'; |
1031 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1031 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1032 | 1032 | $context = 'single'; |
1033 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
1033 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
1034 | 1034 | $context = GravityView_View::getInstance()->getContext(); |
1035 | 1035 | } |
1036 | 1036 | |
@@ -1058,12 +1058,12 @@ discard block |
||
1058 | 1058 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
1059 | 1059 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1060 | 1060 | |
1061 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1062 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1061 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1062 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1066 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
1065 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1066 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1141,12 +1141,12 @@ discard block |
||
1141 | 1141 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
1142 | 1142 | |
1143 | 1143 | // Required fields. |
1144 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1144 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1145 | 1145 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
1146 | 1146 | return ''; |
1147 | 1147 | } |
1148 | 1148 | |
1149 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1149 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1150 | 1150 | |
1151 | 1151 | /** |
1152 | 1152 | * Create the content variables for replacing. |
@@ -1162,37 +1162,37 @@ discard block |
||
1162 | 1162 | 'field_id' => '', |
1163 | 1163 | ); |
1164 | 1164 | |
1165 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
1165 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
1166 | 1166 | |
1167 | 1167 | // If the value is empty and we're hiding empty, return empty. |
1168 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1168 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1169 | 1169 | return ''; |
1170 | 1170 | } |
1171 | 1171 | |
1172 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1173 | - $context['value'] = wpautop( $context['value'] ); |
|
1172 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1173 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | // Get width setting, if exists |
1177 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
1177 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
1178 | 1178 | |
1179 | 1179 | // If replacing with CSS inline formatting, let's do it. |
1180 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
1180 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
1181 | 1181 | |
1182 | 1182 | // Grab the Class using `gv_class` |
1183 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
1184 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
1183 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1184 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1185 | 1185 | |
1186 | 1186 | // Get field label if needed |
1187 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
1188 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
1187 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
1188 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Default Label value |
1192 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
1192 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
1193 | 1193 | |
1194 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1195 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1194 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
1195 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | /** |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | * @param string $markup The HTML for the markup |
1202 | 1202 | * @param array $args All args for the field output |
1203 | 1203 | */ |
1204 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
1204 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
1205 | 1205 | |
1206 | 1206 | /** |
1207 | 1207 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -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 |
@@ -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 | ); |
@@ -21,13 +21,13 @@ |
||
21 | 21 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
22 | 22 | ); |
23 | 23 | |
24 | - $field_options['make_clickable'] = array( |
|
25 | - 'type' => 'checkbox', |
|
26 | - 'merge_tags' => false, |
|
27 | - 'value' => 0, |
|
28 | - 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
29 | - 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
30 | - ); |
|
24 | + $field_options['make_clickable'] = array( |
|
25 | + 'type' => 'checkbox', |
|
26 | + 'merge_tags' => false, |
|
27 | + 'value' => 0, |
|
28 | + 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
29 | + 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
30 | + ); |
|
31 | 31 | |
32 | 32 | return $field_options; |
33 | 33 | } |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
27 | 27 | |
28 | - if( 'edit' === $context ) { |
|
28 | + if ( 'edit' === $context ) { |
|
29 | 29 | return $field_options; |
30 | 30 | } |
31 | 31 | |
32 | - $field_options['trim_words'] = array( |
|
32 | + $field_options[ 'trim_words' ] = array( |
|
33 | 33 | 'type' => 'number', |
34 | 34 | 'merge_tags' => false, |
35 | 35 | 'value' => null, |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
38 | 38 | ); |
39 | 39 | |
40 | - $field_options['make_clickable'] = array( |
|
40 | + $field_options[ 'make_clickable' ] = array( |
|
41 | 41 | 'type' => 'checkbox', |
42 | 42 | 'merge_tags' => false, |
43 | 43 | 'value' => 0, |