@@ -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, |
@@ -255,7 +255,6 @@ |
||
255 | 255 | * Get the default date format for a field based on the field ID and the time format setting |
256 | 256 | * |
257 | 257 | * @since 1.14 |
258 | - |
|
259 | 258 | * @param string $time_format The time format ("12" or "24"). Default: "12" {@since 1.14} |
260 | 259 | * @param int $field_id The ID of the field. Used to figure out full time/hours/minutes/am/pm {@since 1.14} |
261 | 260 | * |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
61 | 61 | |
62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
101 | 101 | |
102 | 102 | // If the search is being sorted |
103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
104 | 104 | |
105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
109 | 109 | * @see modify_sort_id() |
110 | 110 | */ |
111 | - if( ! empty( $pieces[1] ) ) { |
|
111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
112 | 112 | |
113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
114 | - $this->_time_format = $pieces[1]; |
|
115 | - $this->_date_format = $pieces[2]; |
|
114 | + $this->_time_format = $pieces[ 1 ]; |
|
115 | + $this->_date_format = $pieces[ 2 ]; |
|
116 | 116 | |
117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
123 | 123 | */ |
124 | - $criteria['sorting']['is_numeric'] = true; |
|
124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
125 | 125 | |
126 | 126 | // Modify the Gravity Forms WP Query |
127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * then we want to modify the query. |
148 | 148 | * @see GFFormsModel::sort_by_field_query() |
149 | 149 | */ |
150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
151 | 151 | |
152 | - if( $this->_time_format === '24' ) { |
|
152 | + if ( $this->_time_format === '24' ) { |
|
153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
154 | 154 | } else { |
155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
195 | 195 | // Set variables |
196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
197 | 197 | |
198 | - if( 'edit' === $context ) { |
|
198 | + if ( 'edit' === $context ) { |
|
199 | 199 | return $field_options; |
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Set default date format based on field ID and Form ID |
204 | 204 | */ |
205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
206 | 206 | |
207 | - $this->add_field_support('date_display', $field_options ); |
|
207 | + $this->add_field_support( 'date_display', $field_options ); |
|
208 | 208 | |
209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
210 | 210 | |
211 | 211 | return $field_options; |
212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function _get_time_format() { |
222 | 222 | global $post; |
223 | 223 | |
224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
225 | 225 | |
226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // GF defaults to 12, so should we. |
241 | 241 | $time_format = '12'; |
242 | 242 | |
243 | - if( $form_id ) { |
|
243 | + if ( $form_id ) { |
|
244 | 244 | $form = GFAPI::get_form( $form_id ); |
245 | 245 | |
246 | 246 | if ( $form ) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $default = 'h:i A'; |
288 | 288 | |
289 | 289 | // This doesn't take into account 24-hour |
290 | - switch( $field_input_id ) { |
|
290 | + switch ( $field_input_id ) { |
|
291 | 291 | // Hours |
292 | 292 | case 1: |
293 | 293 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display hidden field input |
|
4 | - * |
|
5 | - * @see class-search-widget.php |
|
6 | - */ |
|
3 | + * Display hidden field input |
|
4 | + * |
|
5 | + * @see class-search-widget.php |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $search_field = $gravityview_view->search_field; |
@@ -7,4 +7,4 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $search_field = $gravityview_view->search_field; |
10 | -?><div><input type="hidden" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"></div> |
|
11 | 10 | \ No newline at end of file |
11 | +?><div><input type="hidden" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"></div> |
|
12 | 12 | \ No newline at end of file |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * |
70 | 70 | * @since 1.16 |
71 | 71 | * |
72 | - * @param int|string $value Number value for the field |
|
72 | + * @param string $value Number value for the field |
|
73 | 73 | * |
74 | 74 | * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription" |
75 | 75 | */ |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function get_content( $output, $entry, $field_settings, $field ) { |
60 | 60 | |
61 | 61 | /** Overridden by a template. */ |
62 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
62 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
63 | 63 | |
64 | 64 | return $this->get_string_from_value( $output ); |
65 | 65 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | switch ( intval( $value ) ) { |
79 | 79 | case self::ONE_TIME_PAYMENT: |
80 | 80 | default: |
81 | - $return = __('One-Time Payment', 'gravityview'); |
|
81 | + $return = __( 'One-Time Payment', 'gravityview' ); |
|
82 | 82 | break; |
83 | 83 | |
84 | 84 | case self::SUBSCRIPTION: |
85 | - $return = __('Subscription', 'gravityview'); |
|
85 | + $return = __( 'Subscription', 'gravityview' ); |
|
86 | 86 | break; |
87 | 87 | } |
88 | 88 |
@@ -1037,15 +1037,15 @@ |
||
1037 | 1037 | GFForms::register_scripts(); |
1038 | 1038 | |
1039 | 1039 | $scripts = array( |
1040 | - 'sack', |
|
1041 | - 'gform_gravityforms', |
|
1042 | - 'gform_forms', |
|
1043 | - 'gform_form_admin', |
|
1044 | - 'jquery-ui-autocomplete' |
|
1040 | + 'sack', |
|
1041 | + 'gform_gravityforms', |
|
1042 | + 'gform_forms', |
|
1043 | + 'gform_form_admin', |
|
1044 | + 'jquery-ui-autocomplete' |
|
1045 | 1045 | ); |
1046 | 1046 | |
1047 | 1047 | if ( wp_is_mobile() ) { |
1048 | - $scripts[] = 'jquery-touch-punch'; |
|
1048 | + $scripts[] = 'jquery-touch-punch'; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | foreach ($scripts as $script) { |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
39 | + |
|
40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
55 | 55 | |
56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if ( ! is_admin() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if ( ! empty( $forms ) ) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
100 | + <?php foreach ( $forms as $form ) { ?> |
|
101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
134 | 134 | |
135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if ( empty( $connected_views ) ) { |
|
138 | 138 | return $menu_items; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $sub_menu_items = array(); |
142 | 142 | foreach ( (array)$connected_views as $view ) { |
143 | 143 | |
144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
149 | 149 | |
150 | - $sub_menu_items[] = array( |
|
150 | + $sub_menu_items[ ] = array( |
|
151 | 151 | 'label' => esc_attr( $label ), |
152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | // If there were no items added, then let's create the parent menu |
157 | - if( $sub_menu_items ) { |
|
157 | + if ( $sub_menu_items ) { |
|
158 | 158 | |
159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
160 | - $sub_menu_items[] = array( |
|
160 | + $sub_menu_items[ ] = array( |
|
161 | 161 | 'url' => '#', |
162 | 162 | 'label' => '', |
163 | 163 | 'menu_class' => 'hidden', |
164 | 164 | 'capabilities' => '', |
165 | 165 | ); |
166 | 166 | |
167 | - $menu_items['gravityview'] = array( |
|
167 | + $menu_items[ 'gravityview' ] = array( |
|
168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $add = array( 'captcha', 'page' ); |
195 | 195 | |
196 | 196 | // Don't allowing editing the following values: |
197 | - if( $context === 'edit' ) { |
|
198 | - $add[] = 'post_id'; |
|
197 | + if ( $context === 'edit' ) { |
|
198 | + $add[ ] = 'post_id'; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
218 | 218 | foreach ( $default_args as $key => $arg ) { |
219 | 219 | |
220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
222 | 222 | |
223 | 223 | // By default, use `tooltip` if defined. |
224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
225 | 225 | |
226 | 226 | // Otherwise, use the description as a tooltip. |
227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
228 | - $tooltip = $arg['desc']; |
|
227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
228 | + $tooltip = $arg[ 'desc' ]; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // If there's no tooltip set, continue |
232 | - if( empty( $tooltip ) ) { |
|
232 | + if ( empty( $tooltip ) ) { |
|
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Add the tooltip |
237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
238 | - 'title' => $arg['label'], |
|
237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
238 | + 'title' => $arg[ 'label' ], |
|
239 | 239 | 'value' => $tooltip, |
240 | 240 | ); |
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
247 | 247 | ); |
248 | 248 | |
249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | |
255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
256 | 256 | |
257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
258 | 258 | |
259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
274 | 274 | |
275 | 275 | $output = ''; |
276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
294 | 294 | |
295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
296 | 296 | |
297 | 297 | break; |
298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
334 | 334 | |
335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
336 | - if( empty( $form ) ) { |
|
336 | + if ( empty( $form ) ) { |
|
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // The $form is passed as the form ID |
341 | - if( !is_array( $form ) ) { |
|
341 | + if ( ! is_array( $form ) ) { |
|
342 | 342 | $form = gravityview_get_form( $form ); |
343 | 343 | } |
344 | 344 | |
345 | - $form_id = $form['id']; |
|
345 | + $form_id = $form[ 'id' ]; |
|
346 | 346 | $links = array(); |
347 | 347 | |
348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
352 | 352 | } else { |
353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
354 | 354 | } |
355 | 355 | |
356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
359 | 359 | } |
360 | 360 | |
361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
364 | 364 | } |
365 | 365 | |
366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $output = ''; |
372 | 372 | |
373 | - if( !empty( $include_form_link ) ) { |
|
373 | + if ( ! empty( $include_form_link ) ) { |
|
374 | 374 | $output .= $form_link; |
375 | 375 | } |
376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
384 | 384 | |
385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
386 | 386 | |
387 | 387 | return $output; |
388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | // Get the date column and save it for later to add back in. |
397 | 397 | // This adds it after the Data Source column. |
398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
399 | - $date = $columns['date']; |
|
400 | - unset( $columns['date'] ); |
|
399 | + $date = $columns[ 'date' ]; |
|
400 | + unset( $columns[ 'date' ] ); |
|
401 | 401 | |
402 | 402 | $data_source_required_caps = array( |
403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | 'gravityforms_preview_forms', |
409 | 409 | ); |
410 | 410 | |
411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
413 | 413 | } |
414 | 414 | |
415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
416 | 416 | |
417 | 417 | // Add the date back in. |
418 | - $columns['date'] = $date; |
|
418 | + $columns[ 'date' ] = $date; |
|
419 | 419 | |
420 | 420 | return $columns; |
421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function save_postdata( $post_id ) { |
431 | 431 | |
432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | 436 | // validate post_type |
437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
@@ -449,90 +449,90 @@ discard block |
||
449 | 449 | $statii = array(); |
450 | 450 | |
451 | 451 | // check if this is a start fresh View |
452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
453 | 453 | |
454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
455 | 455 | // save form id |
456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
457 | 457 | |
458 | 458 | } |
459 | 459 | |
460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
462 | 462 | return; |
463 | 463 | } |
464 | 464 | |
465 | 465 | // Was this a start fresh? |
466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
468 | 468 | } else { |
469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | // Check if we have a template id |
473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
474 | 474 | |
475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
476 | 476 | |
477 | 477 | // now save template id |
478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | // save View Configuration metabox |
483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
484 | 484 | |
485 | 485 | // template settings |
486 | - if( empty( $_POST['template_settings'] ) ) { |
|
487 | - $_POST['template_settings'] = array(); |
|
486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
487 | + $_POST[ 'template_settings' ] = array(); |
|
488 | 488 | } |
489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
490 | 490 | |
491 | 491 | $fields = array(); |
492 | 492 | |
493 | 493 | // Directory&single Visible Fields |
494 | - if( !empty( $preset_fields ) ) { |
|
494 | + if ( ! empty( $preset_fields ) ) { |
|
495 | 495 | |
496 | 496 | $fields = $preset_fields; |
497 | 497 | |
498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
498 | + } elseif ( ! empty( $_POST[ 'fields' ] ) ) { |
|
499 | 499 | |
500 | - if( !is_array( $_POST['fields'] ) ) { |
|
500 | + if ( ! is_array( $_POST[ 'fields' ] ) ) { |
|
501 | 501 | |
502 | 502 | // Fields are passed as a jQuery-serialized array, created in admin-views.js in the serializeForm method |
503 | 503 | // Not using parse_str due to max_input_vars limitation |
504 | 504 | $fields_holder = array(); |
505 | - GVCommon::gv_parse_str( $_POST['fields'], $fields_holder ); |
|
505 | + GVCommon::gv_parse_str( $_POST[ 'fields' ], $fields_holder ); |
|
506 | 506 | |
507 | - if( isset( $fields_holder['fields'] ) ) { |
|
507 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
508 | 508 | |
509 | 509 | // When parsed, there's a m |
510 | - $fields = $fields_holder['fields']; |
|
510 | + $fields = $fields_holder[ 'fields' ]; |
|
511 | 511 | |
512 | 512 | } else { |
513 | 513 | |
514 | - do_action('gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
|
514 | + do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
|
515 | 515 | |
516 | 516 | } |
517 | 517 | |
518 | 518 | } else { |
519 | 519 | |
520 | - $fields = $_POST['fields']; |
|
520 | + $fields = $_POST[ 'fields' ]; |
|
521 | 521 | |
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
525 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
526 | 526 | |
527 | 527 | // Directory Visible Widgets |
528 | - if( empty( $_POST['widgets'] ) ) { |
|
529 | - $_POST['widgets'] = array(); |
|
528 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
529 | + $_POST[ 'widgets' ] = array(); |
|
530 | 530 | } |
531 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
531 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
532 | 532 | |
533 | 533 | } // end save view configuration |
534 | 534 | |
535 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
535 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | /** |
@@ -564,20 +564,20 @@ discard block |
||
564 | 564 | |
565 | 565 | $output = ''; |
566 | 566 | |
567 | - if( !empty( $fields ) ) { |
|
567 | + if ( ! empty( $fields ) ) { |
|
568 | 568 | |
569 | - foreach( $fields as $id => $details ) { |
|
569 | + foreach ( $fields as $id => $details ) { |
|
570 | 570 | |
571 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
571 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
572 | 572 | continue; |
573 | 573 | } |
574 | 574 | |
575 | 575 | // Edit mode only allows editing the parent fields, not single inputs. |
576 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
576 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
577 | 577 | continue; |
578 | 578 | } |
579 | 579 | |
580 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
580 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
581 | 581 | |
582 | 582 | } // End foreach |
583 | 583 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | echo $output; |
586 | 586 | |
587 | 587 | // For the EDIT view we only want to allow the form fields. |
588 | - if( $context === 'edit' ) { |
|
588 | + if ( $context === 'edit' ) { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | |
@@ -609,16 +609,16 @@ discard block |
||
609 | 609 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
610 | 610 | array( |
611 | 611 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
612 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
612 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
613 | 613 | 'field_id' => 'all-fields', |
614 | 614 | 'label_type' => 'field', |
615 | 615 | 'input_type' => NULL, |
616 | 616 | 'field_options' => NULL, |
617 | 617 | 'settings_html' => NULL, |
618 | 618 | ) |
619 | - )); |
|
619 | + ) ); |
|
620 | 620 | |
621 | - if( !empty( $additional_fields )) { |
|
621 | + if ( ! empty( $additional_fields ) ) { |
|
622 | 622 | foreach ( (array)$additional_fields as $item ) { |
623 | 623 | |
624 | 624 | // Prevent items from not having index set |
@@ -629,16 +629,16 @@ discard block |
||
629 | 629 | 'input_type' => NULL, |
630 | 630 | 'field_options' => NULL, |
631 | 631 | 'settings_html' => NULL, |
632 | - )); |
|
632 | + ) ); |
|
633 | 633 | |
634 | 634 | // Backward compat. |
635 | - if( !empty( $item['field_options'] ) ) { |
|
635 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
636 | 636 | // Use settings_html from now on. |
637 | - $item['settings_html'] = $item['field_options']; |
|
637 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | // Render a label for each of them |
641 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
641 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
642 | 642 | |
643 | 643 | } |
644 | 644 | } |
@@ -651,64 +651,64 @@ discard block |
||
651 | 651 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
652 | 652 | * @return array |
653 | 653 | */ |
654 | - function get_entry_default_fields($form, $zone) { |
|
654 | + function get_entry_default_fields( $form, $zone ) { |
|
655 | 655 | |
656 | 656 | $entry_default_fields = array(); |
657 | 657 | |
658 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
658 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
659 | 659 | |
660 | 660 | $entry_default_fields = array( |
661 | 661 | 'id' => array( |
662 | - 'label' => __('Entry ID', 'gravityview'), |
|
662 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
663 | 663 | 'type' => 'id', |
664 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
664 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
665 | 665 | ), |
666 | 666 | 'date_created' => array( |
667 | - 'label' => __('Entry Date', 'gravityview'), |
|
668 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
667 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
668 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
669 | 669 | 'type' => 'date_created', |
670 | 670 | ), |
671 | 671 | 'source_url' => array( |
672 | - 'label' => __('Source URL', 'gravityview'), |
|
672 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
673 | 673 | 'type' => 'source_url', |
674 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
674 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
675 | 675 | ), |
676 | 676 | 'ip' => array( |
677 | - 'label' => __('User IP', 'gravityview'), |
|
677 | + 'label' => __( 'User IP', 'gravityview' ), |
|
678 | 678 | 'type' => 'ip', |
679 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
679 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
680 | 680 | ), |
681 | 681 | 'created_by' => array( |
682 | - 'label' => __('User', 'gravityview'), |
|
682 | + 'label' => __( 'User', 'gravityview' ), |
|
683 | 683 | 'type' => 'created_by', |
684 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
684 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
685 | 685 | ), |
686 | 686 | |
687 | 687 | /** |
688 | 688 | * @since 1.2 |
689 | 689 | */ |
690 | 690 | 'custom' => array( |
691 | - 'label' => __('Custom Content', 'gravityview'), |
|
691 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
692 | 692 | 'type' => 'custom', |
693 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
693 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
694 | 694 | ), |
695 | 695 | |
696 | 696 | /** |
697 | 697 | * @since 1.7.2 |
698 | 698 | */ |
699 | 699 | 'other_entries' => array( |
700 | - 'label' => __('Other Entries', 'gravityview'), |
|
700 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
701 | 701 | 'type' => 'other_entries', |
702 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
702 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
703 | 703 | ), |
704 | 704 | ); |
705 | 705 | |
706 | 706 | |
707 | - if( 'single' !== $zone) { |
|
707 | + if ( 'single' !== $zone ) { |
|
708 | 708 | |
709 | - $entry_default_fields['entry_link'] = array( |
|
710 | - 'label' => __('Link to Entry', 'gravityview'), |
|
711 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
709 | + $entry_default_fields[ 'entry_link' ] = array( |
|
710 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
711 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
712 | 712 | 'type' => 'entry_link', |
713 | 713 | ); |
714 | 714 | } |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param string|array $form form_ID or form object |
723 | 723 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
724 | 724 | */ |
725 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
725 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | */ |
734 | 734 | function get_available_fields( $form = '', $zone = NULL ) { |
735 | 735 | |
736 | - if( empty( $form ) ) { |
|
736 | + if ( empty( $form ) ) { |
|
737 | 737 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
738 | 738 | return array(); |
739 | 739 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $fields = gravityview_get_form_fields( $form, true ); |
743 | 743 | |
744 | 744 | // get meta fields ( only if form was already created ) |
745 | - if( !is_array( $form ) ) { |
|
745 | + if ( ! is_array( $form ) ) { |
|
746 | 746 | $meta_fields = gravityview_get_entry_meta( $form ); |
747 | 747 | } else { |
748 | 748 | $meta_fields = array(); |
@@ -766,11 +766,11 @@ discard block |
||
766 | 766 | |
767 | 767 | $widgets = $this->get_registered_widgets(); |
768 | 768 | |
769 | - if( !empty( $widgets ) ) { |
|
769 | + if ( ! empty( $widgets ) ) { |
|
770 | 770 | |
771 | - foreach( $widgets as $id => $details ) { |
|
771 | + foreach ( $widgets as $id => $details ) { |
|
772 | 772 | |
773 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
773 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
774 | 774 | |
775 | 775 | } |
776 | 776 | } |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
805 | 805 | global $post; |
806 | 806 | |
807 | - if( $type === 'widget' ) { |
|
807 | + if ( $type === 'widget' ) { |
|
808 | 808 | $button_label = __( 'Add Widget', 'gravityview' ); |
809 | 809 | } else { |
810 | 810 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -813,15 +813,15 @@ discard block |
||
813 | 813 | $available_items = array(); |
814 | 814 | |
815 | 815 | // if saved values, get available fields to label everyone |
816 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
816 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
817 | 817 | |
818 | - if( !empty( $_POST['template_id'] ) ) { |
|
819 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
818 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
819 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
820 | 820 | } else { |
821 | 821 | $form = gravityview_get_form_id( $post->ID ); |
822 | 822 | } |
823 | 823 | |
824 | - if( 'field' === $type ) { |
|
824 | + if ( 'field' === $type ) { |
|
825 | 825 | $available_items = $this->get_available_fields( $form, $zone ); |
826 | 826 | } else { |
827 | 827 | $available_items = $this->get_registered_widgets(); |
@@ -829,39 +829,39 @@ discard block |
||
829 | 829 | |
830 | 830 | } |
831 | 831 | |
832 | - foreach( $rows as $row ) : |
|
833 | - foreach( $row as $col => $areas ) : |
|
834 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
832 | + foreach ( $rows as $row ) : |
|
833 | + foreach ( $row as $col => $areas ) : |
|
834 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
835 | 835 | |
836 | 836 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
837 | 837 | |
838 | - <?php foreach( $areas as $area ) : ?> |
|
838 | + <?php foreach ( $areas as $area ) : ?> |
|
839 | 839 | |
840 | 840 | <div class="gv-droppable-area"> |
841 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
841 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
842 | 842 | |
843 | 843 | <?php // render saved fields |
844 | 844 | |
845 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
845 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
846 | 846 | |
847 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
847 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
848 | 848 | |
849 | 849 | $input_type = NULL; |
850 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
850 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
851 | 851 | |
852 | - if( !$original_item ) { |
|
852 | + if ( ! $original_item ) { |
|
853 | 853 | |
854 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
854 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
855 | 855 | |
856 | 856 | $original_item = $field; |
857 | 857 | } else { |
858 | 858 | |
859 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
859 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
860 | 860 | |
861 | 861 | } |
862 | 862 | |
863 | 863 | // Field options dialog box |
864 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
864 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
865 | 865 | |
866 | 866 | $item = array( |
867 | 867 | 'input_type' => $input_type, |
@@ -870,16 +870,16 @@ discard block |
||
870 | 870 | ); |
871 | 871 | |
872 | 872 | // Merge the values with the current item to pass things like widget descriptions and original field names |
873 | - if( $original_item ) { |
|
873 | + if ( $original_item ) { |
|
874 | 874 | $item = wp_parse_args( $item, $original_item ); |
875 | 875 | } |
876 | 876 | |
877 | - switch( $type ) { |
|
877 | + switch ( $type ) { |
|
878 | 878 | case 'widget': |
879 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
879 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
880 | 880 | break; |
881 | 881 | default: |
882 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
882 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | |
890 | 890 | } // End if zone is not empty ?> |
891 | 891 | |
892 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
892 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
893 | 893 | </div> |
894 | 894 | <div class="gv-droppable-area-action"> |
895 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
896 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
895 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
896 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
897 | 897 | </div> |
898 | 898 | </div> |
899 | 899 | |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
916 | 916 | |
917 | 917 | $widgets = array(); |
918 | - if( !empty( $post_id ) ) { |
|
918 | + if ( ! empty( $post_id ) ) { |
|
919 | 919 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
920 | 920 | |
921 | 921 | } |
@@ -946,19 +946,19 @@ discard block |
||
946 | 946 | */ |
947 | 947 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
948 | 948 | |
949 | - if( empty( $template_id ) ) { |
|
949 | + if ( empty( $template_id ) ) { |
|
950 | 950 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
951 | 951 | return; |
952 | 952 | } |
953 | 953 | |
954 | 954 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
955 | 955 | |
956 | - if( empty( $template_areas ) ) { |
|
956 | + if ( empty( $template_areas ) ) { |
|
957 | 957 | |
958 | 958 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
959 | 959 | $output = '<div>'; |
960 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
961 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
960 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
961 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
962 | 962 | $output .= '</div>'; |
963 | 963 | } else { |
964 | 964 | |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | |
974 | 974 | } |
975 | 975 | |
976 | - if( $echo ) { |
|
976 | + if ( $echo ) { |
|
977 | 977 | echo $output; |
978 | 978 | } |
979 | 979 | |
@@ -993,25 +993,25 @@ discard block |
||
993 | 993 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
994 | 994 | |
995 | 995 | // Add the GV font (with the Astronaut) |
996 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
996 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
997 | 997 | |
998 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
998 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
999 | 999 | |
1000 | 1000 | // Don't process any scripts below here if it's not a GravityView page. |
1001 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
1001 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
1002 | 1002 | |
1003 | 1003 | // Only enqueue the following on single pages |
1004 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
1004 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
1005 | 1005 | |
1006 | 1006 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1007 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1007 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
1008 | 1008 | |
1009 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1009 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1010 | 1010 | |
1011 | 1011 | //enqueue scripts |
1012 | 1012 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
1013 | 1013 | |
1014 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1014 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1015 | 1015 | 'cookiepath' => COOKIEPATH, |
1016 | 1016 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1017 | 1017 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1024,9 +1024,9 @@ discard block |
||
1024 | 1024 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1025 | 1025 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1026 | 1026 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
1027 | - )); |
|
1027 | + ) ); |
|
1028 | 1028 | |
1029 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1029 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1030 | 1030 | |
1031 | 1031 | self::enqueue_gravity_forms_scripts(); |
1032 | 1032 | |
@@ -1045,10 +1045,10 @@ discard block |
||
1045 | 1045 | ); |
1046 | 1046 | |
1047 | 1047 | if ( wp_is_mobile() ) { |
1048 | - $scripts[] = 'jquery-touch-punch'; |
|
1048 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | - foreach ($scripts as $script) { |
|
1051 | + foreach ( $scripts as $script ) { |
|
1052 | 1052 | wp_enqueue_script( $script ); |
1053 | 1053 | } |
1054 | 1054 | } |
@@ -1057,11 +1057,11 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | $filter = current_filter(); |
1059 | 1059 | |
1060 | - if( preg_match('/script/ism', $filter ) ) { |
|
1060 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
1061 | 1061 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
1062 | 1062 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
1063 | 1063 | $registered = array_merge( $registered, $allow_scripts ); |
1064 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
1064 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
1065 | 1065 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
1066 | 1066 | $registered = array_merge( $registered, $allow_styles ); |
1067 | 1067 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
274 | 274 | |
275 | 275 | $output = ''; |
276 | 276 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function save_postdata( $post_id ) { |
431 | 431 | |
432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
432 | + if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * GravityView template tags API |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @license GPL2+ |
|
7 | - * @author Katz Web Services, Inc. |
|
8 | - * @link http://gravityview.co |
|
9 | - * @copyright Copyright 2014, Katz Web Services, Inc. |
|
10 | - * |
|
11 | - * @since 1.0.0 |
|
12 | - */ |
|
3 | + * GravityView template tags API |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @license GPL2+ |
|
7 | + * @author Katz Web Services, Inc. |
|
8 | + * @link http://gravityview.co |
|
9 | + * @copyright Copyright 2014, Katz Web Services, Inc. |
|
10 | + * |
|
11 | + * @since 1.0.0 |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | class GravityView_API { |
15 | 15 | |
@@ -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 |
@@ -214,7 +214,6 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @access public |
216 | 216 | * @param array $entry |
217 | - * @param array $field |
|
218 | 217 | * @return null|string |
219 | 218 | */ |
220 | 219 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
@@ -1000,7 +999,7 @@ discard block |
||
1000 | 999 | * Get the current View ID being rendered |
1001 | 1000 | * |
1002 | 1001 | * @global GravityView_View $gravityview_view |
1003 | - * @return string View context "directory" or "single" |
|
1002 | + * @return integer View context "directory" or "single" |
|
1004 | 1003 | */ |
1005 | 1004 | function gravityview_get_view_id() { |
1006 | 1005 | return GravityView_View::getInstance()->getViewId(); |
@@ -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,20 +219,20 @@ 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 | - $field_id = $field_settings['id']; |
|
228 | + $field_id = $field_settings[ 'id' ]; |
|
229 | 229 | $form = $gravityview_view->getForm(); |
230 | 230 | $field = gravityview_get_field( $form, $field_id ); |
231 | 231 | |
232 | 232 | // Prevent any PHP warnings that may be generated |
233 | 233 | ob_start(); |
234 | 234 | |
235 | - if( $field && is_numeric( $field_id ) ) { |
|
235 | + if ( $field && is_numeric( $field_id ) ) { |
|
236 | 236 | // Used as file name of field template in GV. |
237 | 237 | // Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field |
238 | 238 | $field_type = $field->type; |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | // If a Gravity Forms Field is found, get the field display |
246 | - if( $field ) { |
|
247 | - $display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format ); |
|
246 | + if ( $field ) { |
|
247 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); |
|
248 | 248 | |
249 | 249 | if ( $errors = ob_get_clean() ) { |
250 | 250 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); |
254 | 254 | |
255 | 255 | // prevent the use of merge_tags for non-admin fields |
256 | - if( !empty( $field->adminOnly ) ) { |
|
256 | + if ( ! empty( $field->adminOnly ) ) { |
|
257 | 257 | $display_value = self::replace_variables( $display_value, $form, $entry ); |
258 | 258 | } |
259 | 259 | } else { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | // Check whether the field exists in /includes/fields/{$field_type}.php |
265 | 265 | // This can be overridden by user template files. |
266 | - $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
|
266 | + $field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); |
|
267 | 267 | |
268 | 268 | // Set the field data to be available in the templates |
269 | 269 | $gravityview_view->setCurrentField( array( |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | 'entry' => $entry, |
278 | 278 | 'field_type' => $field_type, /** {@since 1.6} */ |
279 | 279 | 'field_path' => $field_path, /** {@since 1.16} */ |
280 | - )); |
|
280 | + ) ); |
|
281 | 281 | |
282 | - if( ! empty( $field_path ) ) { |
|
282 | + if ( ! empty( $field_path ) ) { |
|
283 | 283 | |
284 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
284 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); |
|
285 | 285 | |
286 | 286 | ob_start(); |
287 | 287 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | // Get the field settings again so that the field template can override the settings |
300 | - $field_settings = $gravityview_view->getCurrentField('field_settings'); |
|
300 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); |
|
301 | 301 | |
302 | 302 | /** |
303 | 303 | * @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` |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
316 | 316 | * |
317 | 317 | */ |
318 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
318 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { |
|
319 | 319 | |
320 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
320 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); |
|
321 | 321 | |
322 | 322 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
323 | 323 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * @param array $field_settings Settings for the particular GV field |
332 | 332 | * @param array $field Current field being displayed |
333 | 333 | */ |
334 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
334 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
362 | 362 | |
363 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
363 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
364 | 364 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
365 | 365 | return NULL; |
366 | 366 | } |
367 | 367 | |
368 | 368 | $href = self::entry_link( $entry ); |
369 | 369 | |
370 | - if( '' === $href ) { |
|
370 | + if ( '' === $href ) { |
|
371 | 371 | return NULL; |
372 | 372 | } |
373 | 373 | |
@@ -390,19 +390,19 @@ discard block |
||
390 | 390 | * @param boolean $wpautop Apply wpautop() to the output? |
391 | 391 | * @return string HTML of "no results" text |
392 | 392 | */ |
393 | - public static function no_results($wpautop = true) { |
|
393 | + public static function no_results( $wpautop = true ) { |
|
394 | 394 | $gravityview_view = GravityView_View::getInstance(); |
395 | 395 | |
396 | 396 | $is_search = false; |
397 | 397 | |
398 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
398 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
399 | 399 | $is_search = true; |
400 | 400 | } |
401 | 401 | |
402 | - if($is_search) { |
|
403 | - $output = __('This search returned no results.', 'gravityview'); |
|
402 | + if ( $is_search ) { |
|
403 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
404 | 404 | } else { |
405 | - $output = __('No entries match your request.', 'gravityview'); |
|
405 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
@@ -410,9 +410,9 @@ discard block |
||
410 | 410 | * @param string $output The existing "No Entries" text |
411 | 411 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
412 | 412 | */ |
413 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
413 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
414 | 414 | |
415 | - return $wpautop ? wpautop($output) : $output; |
|
415 | + return $wpautop ? wpautop( $output ) : $output; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -429,37 +429,37 @@ discard block |
||
429 | 429 | |
430 | 430 | $gravityview_view = GravityView_View::getInstance(); |
431 | 431 | |
432 | - if( empty( $post_id ) ) { |
|
432 | + if ( empty( $post_id ) ) { |
|
433 | 433 | |
434 | 434 | $post_id = false; |
435 | 435 | |
436 | 436 | // DataTables passes the Post ID |
437 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
437 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
438 | 438 | |
439 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
439 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
440 | 440 | |
441 | 441 | } else { |
442 | 442 | |
443 | 443 | // The Post ID has been passed via the shortcode |
444 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
444 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
445 | 445 | |
446 | 446 | $post_id = $gravityview_view->getPostId(); |
447 | 447 | |
448 | 448 | } else { |
449 | 449 | |
450 | 450 | // This is a GravityView post type |
451 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
451 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
452 | 452 | |
453 | 453 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
454 | 454 | |
455 | 455 | } else { |
456 | 456 | |
457 | 457 | // This is an embedded GravityView; use the embedded post's ID as the base. |
458 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
458 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
459 | 459 | |
460 | 460 | $post_id = $post->ID; |
461 | 461 | |
462 | - } elseif( $gravityview_view->getViewId() ) { |
|
462 | + } elseif ( $gravityview_view->getViewId() ) { |
|
463 | 463 | |
464 | 464 | // The GravityView has been embedded in a widget or in a template, and |
465 | 465 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -474,36 +474,36 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | // No post ID, get outta here. |
477 | - if( empty( $post_id ) ) { |
|
477 | + if ( empty( $post_id ) ) { |
|
478 | 478 | return NULL; |
479 | 479 | } |
480 | 480 | |
481 | 481 | // If we've saved the permalink in memory, use it |
482 | 482 | // @since 1.3 |
483 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
483 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
484 | 484 | |
485 | - if( empty( $link ) ) { |
|
485 | + if ( empty( $link ) ) { |
|
486 | 486 | |
487 | 487 | $link = get_permalink( $post_id ); |
488 | 488 | |
489 | 489 | // If not yet saved, cache the permalink. |
490 | 490 | // @since 1.3 |
491 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
491 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
492 | 492 | |
493 | 493 | } |
494 | 494 | |
495 | 495 | // Deal with returning to proper pagination for embedded views |
496 | - if( $link && $add_query_args ) { |
|
496 | + if ( $link && $add_query_args ) { |
|
497 | 497 | |
498 | 498 | $args = array(); |
499 | 499 | |
500 | - if( $pagenum = rgget('pagenum') ) { |
|
501 | - $args['pagenum'] = intval( $pagenum ); |
|
500 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
501 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
502 | 502 | } |
503 | 503 | |
504 | - if( $sort = rgget('sort') ) { |
|
505 | - $args['sort'] = $sort; |
|
506 | - $args['dir'] = rgget('dir'); |
|
504 | + if ( $sort = rgget( 'sort' ) ) { |
|
505 | + $args[ 'sort' ] = $sort; |
|
506 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | $link = add_query_arg( $args, $link ); |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
527 | 527 | |
528 | 528 | // Generate an unique hash to use as the default value |
529 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
529 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
530 | 530 | |
531 | 531 | /** |
532 | 532 | * @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}` |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
538 | 538 | |
539 | 539 | // Make sure we have something - use the original ID as backup. |
540 | - if( empty( $slug ) ) { |
|
540 | + if ( empty( $slug ) ) { |
|
541 | 541 | $slug = $id; |
542 | 542 | } |
543 | 543 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
567 | 567 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
568 | 568 | */ |
569 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
569 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
570 | 570 | |
571 | 571 | // If we're using custom slug... |
572 | 572 | if ( $custom ) { |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | // If it does have a hash set, and the hash is expected, use it. |
581 | 581 | // This check allows users to change the hash structure using the |
582 | 582 | // gravityview_entry_hash filter and have the old hashes expire. |
583 | - if( empty( $value ) || $value !== $hash ) { |
|
583 | + if ( empty( $value ) || $value !== $hash ) { |
|
584 | 584 | |
585 | 585 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); |
586 | 586 | |
@@ -608,12 +608,12 @@ discard block |
||
608 | 608 | * @param boolean $custom Should we process the custom entry slug? |
609 | 609 | */ |
610 | 610 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
611 | - if( $custom ) { |
|
611 | + if ( $custom ) { |
|
612 | 612 | // create the gravityview_unique_id and save it |
613 | 613 | |
614 | 614 | // Get the entry hash |
615 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
616 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
615 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
616 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash ); |
|
617 | 617 | |
618 | 618 | } |
619 | 619 | } |
@@ -630,14 +630,14 @@ discard block |
||
630 | 630 | */ |
631 | 631 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
632 | 632 | |
633 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
633 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
634 | 634 | $entry = GVCommon::get_entry( $entry ); |
635 | - } else if( empty( $entry ) ) { |
|
635 | + } else if ( empty( $entry ) ) { |
|
636 | 636 | $entry = GravityView_frontend::getInstance()->getEntry(); |
637 | 637 | } |
638 | 638 | |
639 | 639 | // Second parameter used to be passed as $field; this makes sure it's not an array |
640 | - if( !is_numeric( $post_id ) ) { |
|
640 | + if ( ! is_numeric( $post_id ) ) { |
|
641 | 641 | $post_id = NULL; |
642 | 642 | } |
643 | 643 | |
@@ -645,19 +645,19 @@ discard block |
||
645 | 645 | $directory_link = self::directory_link( $post_id, false ); |
646 | 646 | |
647 | 647 | // No post ID? Get outta here. |
648 | - if( empty( $directory_link ) ) { |
|
648 | + if ( empty( $directory_link ) ) { |
|
649 | 649 | return ''; |
650 | 650 | } |
651 | 651 | |
652 | 652 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
653 | 653 | |
654 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
654 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
655 | 655 | |
656 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
656 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
657 | 657 | |
658 | 658 | $args = array(); |
659 | 659 | |
660 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; |
|
660 | + $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/'; |
|
661 | 661 | |
662 | 662 | } else { |
663 | 663 | |
@@ -667,18 +667,18 @@ discard block |
||
667 | 667 | /** |
668 | 668 | * @since 1.7.3 |
669 | 669 | */ |
670 | - if( $add_directory_args ) { |
|
670 | + if ( $add_directory_args ) { |
|
671 | 671 | |
672 | - if( !empty( $_GET['pagenum'] ) ) { |
|
673 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
672 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
673 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
677 | 677 | * @since 1.7 |
678 | 678 | */ |
679 | - if( $sort = rgget('sort') ) { |
|
680 | - $args['sort'] = $sort; |
|
681 | - $args['dir'] = rgget('dir'); |
|
679 | + if ( $sort = rgget( 'sort' ) ) { |
|
680 | + $args[ 'sort' ] = $sort; |
|
681 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | } |
@@ -688,8 +688,8 @@ discard block |
||
688 | 688 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
689 | 689 | * @see GravityView_frontend::get_context_view_id() |
690 | 690 | */ |
691 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
692 | - $args['gvid'] = gravityview_get_view_id(); |
|
691 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
692 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | return add_query_arg( $args, $directory_link ); |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | function gv_class( $field, $form = NULL, $entry = array() ) { |
710 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
710 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -729,15 +729,15 @@ discard block |
||
729 | 729 | |
730 | 730 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
731 | 731 | |
732 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
732 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
733 | 733 | $default_css_class .= ' hidden'; |
734 | 734 | } |
735 | 735 | |
736 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
736 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
737 | 737 | $default_css_class .= ' gv-container-no-results'; |
738 | 738 | } |
739 | 739 | |
740 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
740 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
741 | 741 | |
742 | 742 | /** |
743 | 743 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | |
749 | 749 | $css_class = gravityview_sanitize_html_class( $css_class ); |
750 | 750 | |
751 | - if( $echo ) { |
|
751 | + if ( $echo ) { |
|
752 | 752 | echo $css_class; |
753 | 753 | } |
754 | 754 | |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | $value = GravityView_API::field_value( $entry, $field ); |
761 | 761 | |
762 | - if( $value === '' ) { |
|
762 | + if ( $value === '' ) { |
|
763 | 763 | /** |
764 | 764 | * @filter `gravityview_empty_value` What to display when a field is empty |
765 | 765 | * @param string $value (empty string) |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | return GravityView_API::entry_link( $entry, $post_id ); |
779 | 779 | } |
780 | 780 | |
781 | -function gv_no_results($wpautop = true) { |
|
781 | +function gv_no_results( $wpautop = true ) { |
|
782 | 782 | return GravityView_API::no_results( $wpautop ); |
783 | 783 | } |
784 | 784 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | |
792 | 792 | $href = gv_directory_link(); |
793 | 793 | |
794 | - if( empty( $href ) ) { return NULL; } |
|
794 | + if ( empty( $href ) ) { return NULL; } |
|
795 | 795 | |
796 | 796 | // calculate link label |
797 | 797 | $gravityview_view = GravityView_View::getInstance(); |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | |
808 | 808 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
809 | 809 | 'data-viewid' => $gravityview_view->getViewId() |
810 | - )); |
|
810 | + ) ); |
|
811 | 811 | |
812 | 812 | return $link; |
813 | 813 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | */ |
827 | 827 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
828 | 828 | |
829 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
829 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
830 | 830 | |
831 | 831 | // For the complete field value as generated by Gravity Forms |
832 | 832 | return $display_value; |
@@ -856,16 +856,16 @@ discard block |
||
856 | 856 | |
857 | 857 | $terms = explode( ', ', $value ); |
858 | 858 | |
859 | - foreach ($terms as $term_name ) { |
|
859 | + foreach ( $terms as $term_name ) { |
|
860 | 860 | |
861 | 861 | // If we're processing a category, |
862 | - if( $taxonomy === 'category' ) { |
|
862 | + if ( $taxonomy === 'category' ) { |
|
863 | 863 | |
864 | 864 | // Use rgexplode to prevent errors if : doesn't exist |
865 | 865 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
866 | 866 | |
867 | 867 | // The explode was succesful; we have the category ID |
868 | - if( !empty( $term_id )) { |
|
868 | + if ( ! empty( $term_id ) ) { |
|
869 | 869 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
870 | 870 | } else { |
871 | 871 | // We have to fall back to the name |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | } |
879 | 879 | |
880 | 880 | // There's still a tag/category here. |
881 | - if( $term ) { |
|
881 | + if ( $term ) { |
|
882 | 882 | |
883 | 883 | $term_link = get_term_link( $term, $taxonomy ); |
884 | 884 | |
@@ -887,11 +887,11 @@ discard block |
||
887 | 887 | continue; |
888 | 888 | } |
889 | 889 | |
890 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
890 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | |
894 | - return implode(', ', $output ); |
|
894 | + return implode( ', ', $output ); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | /** |
@@ -905,8 +905,8 @@ discard block |
||
905 | 905 | |
906 | 906 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
907 | 907 | |
908 | - if( empty( $link ) ) { |
|
909 | - return strip_tags( $output); |
|
908 | + if ( empty( $link ) ) { |
|
909 | + return strip_tags( $output ); |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | return $output; |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | $fe = GravityView_frontend::getInstance(); |
926 | 926 | |
927 | 927 | // Solve problem when loading content via admin-ajax.php |
928 | - if( ! $fe->getGvOutputData() ) { |
|
928 | + if ( ! $fe->getGvOutputData() ) { |
|
929 | 929 | |
930 | 930 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
931 | 931 | |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | } |
934 | 934 | |
935 | 935 | // Make 100% sure that we're dealing with a properly called situation |
936 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
936 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
937 | 937 | |
938 | 938 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
939 | 939 | |
@@ -953,10 +953,10 @@ discard block |
||
953 | 953 | |
954 | 954 | $fe = GravityView_frontend::getInstance(); |
955 | 955 | |
956 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
956 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
957 | 957 | |
958 | 958 | // If not set, grab the current view ID |
959 | - if( empty( $view_id ) ) { |
|
959 | + if ( empty( $view_id ) ) { |
|
960 | 960 | $view_id = $fe->get_context_view_id(); |
961 | 961 | } |
962 | 962 | |
@@ -1021,11 +1021,11 @@ discard block |
||
1021 | 1021 | */ |
1022 | 1022 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
1023 | 1023 | |
1024 | - if( $is_edit_entry ) { |
|
1024 | + if ( $is_edit_entry ) { |
|
1025 | 1025 | $context = 'edit'; |
1026 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1026 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1027 | 1027 | $context = 'single'; |
1028 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
1028 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
1029 | 1029 | $context = GravityView_View::getInstance()->getContext(); |
1030 | 1030 | } |
1031 | 1031 | |
@@ -1053,12 +1053,12 @@ discard block |
||
1053 | 1053 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
1054 | 1054 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1055 | 1055 | |
1056 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1057 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1056 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1057 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1061 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
1060 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1061 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1136,12 +1136,12 @@ discard block |
||
1136 | 1136 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
1137 | 1137 | |
1138 | 1138 | // Required fields. |
1139 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1139 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1140 | 1140 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
1141 | 1141 | return ''; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1144 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1145 | 1145 | |
1146 | 1146 | /** |
1147 | 1147 | * Create the content variables for replacing. |
@@ -1157,37 +1157,37 @@ discard block |
||
1157 | 1157 | 'field_id' => '', |
1158 | 1158 | ); |
1159 | 1159 | |
1160 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
1160 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
1161 | 1161 | |
1162 | 1162 | // If the value is empty and we're hiding empty, return empty. |
1163 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1163 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1164 | 1164 | return ''; |
1165 | 1165 | } |
1166 | 1166 | |
1167 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1168 | - $context['value'] = wpautop( $context['value'] ); |
|
1167 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1168 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | // Get width setting, if exists |
1172 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
1172 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
1173 | 1173 | |
1174 | 1174 | // If replacing with CSS inline formatting, let's do it. |
1175 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
1175 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
1176 | 1176 | |
1177 | 1177 | // Grab the Class using `gv_class` |
1178 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
1179 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
1178 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1179 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1180 | 1180 | |
1181 | 1181 | // Get field label if needed |
1182 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
1183 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
1182 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
1183 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | // Default Label value |
1187 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
1187 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
1188 | 1188 | |
1189 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1190 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1189 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
1190 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | /** |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | * @param string $markup The HTML for the markup |
1197 | 1197 | * @param array $args All args for the field output |
1198 | 1198 | */ |
1199 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
1199 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
1200 | 1200 | |
1201 | 1201 | /** |
1202 | 1202 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | foreach ( $context as $tag => $value ) { |
1220 | 1220 | |
1221 | 1221 | // If the tag doesn't exist just skip it |
1222 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1222 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1223 | 1223 | continue; |
1224 | 1224 | } |
1225 | 1225 |
@@ -135,7 +135,7 @@ |
||
135 | 135 | * @param bool $url_encode Whether to URL-encode output |
136 | 136 | * @param bool $esc_html Whether to apply `esc_html()` to output |
137 | 137 | * |
138 | - * @return mixed |
|
138 | + * @return string |
|
139 | 139 | */ |
140 | 140 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
141 | 141 |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
112 | 112 | |
113 | - if( $this->_custom_merge_tag ) { |
|
113 | + if ( $this->_custom_merge_tag ) { |
|
114 | 114 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
115 | 115 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
116 | 116 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
134 | 134 | */ |
135 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
135 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
136 | 136 | |
137 | 137 | /** |
138 | 138 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @see GFCommon::replace_variables_prepopulate() |
141 | 141 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
142 | 142 | */ |
143 | - if( false === $form ) { |
|
143 | + if ( false === $form ) { |
|
144 | 144 | return $text; |
145 | 145 | } |
146 | 146 | |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
175 | 175 | |
176 | - foreach( $matches as $match ) { |
|
176 | + foreach ( $matches as $match ) { |
|
177 | 177 | |
178 | - $full_tag = $match[0]; |
|
178 | + $full_tag = $match[ 0 ]; |
|
179 | 179 | |
180 | 180 | // Strip the Merge Tags |
181 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
181 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
182 | 182 | |
183 | 183 | // Replace the value from the entry, if exists |
184 | - if( isset( $entry[ $tag ] ) ) { |
|
184 | + if ( isset( $entry[ $tag ] ) ) { |
|
185 | 185 | |
186 | 186 | $value = $entry[ $tag ]; |
187 | 187 | |
188 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
188 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
189 | 189 | $value = $this->get_content( $value ); |
190 | 190 | } |
191 | 191 | |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function _filter_sortable_fields( $not_sortable ) { |
260 | 260 | |
261 | - if( ! $this->is_sortable ) { |
|
262 | - $not_sortable[] = $this->name; |
|
261 | + if ( ! $this->is_sortable ) { |
|
262 | + $not_sortable[ ] = $this->name; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | return $not_sortable; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | 'date_display' => array( |
289 | 289 | 'type' => 'text', |
290 | 290 | 'label' => __( 'Override Date Format', 'gravityview' ), |
291 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
291 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
292 | 292 | /** |
293 | 293 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
294 | 294 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | $options = $this->field_support_options(); |
315 | 315 | |
316 | - if( isset( $options[ $key ] ) ) { |
|
316 | + if ( isset( $options[ $key ] ) ) { |
|
317 | 317 | $field_options[ $key ] = $options[ $key ]; |
318 | 318 | } |
319 | 319 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | $delete = $this->get_delete_setting(); |
36 | 36 | |
37 | - if( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
37 | + if ( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
38 | 38 | $this->fire_everything(); |
39 | 39 | } |
40 | 40 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | |
98 | 98 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
99 | 99 | |
100 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
101 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
100 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
101 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
102 | 102 | |
103 | 103 | $sql = $wpdb->prepare( " |
104 | 104 | DELETE FROM $notes_table |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | parent::add_hooks(); |
58 | 58 | |
59 | - if( gravityview_is_admin_page() ) { |
|
59 | + if ( gravityview_is_admin_page() ) { |
|
60 | 60 | |
61 | 61 | // Make Yoast metabox go down to the bottom please. |
62 | 62 | add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) ); |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | global $pagenow; |
84 | 84 | |
85 | 85 | // New View page |
86 | - if( $pagenow === 'post-new.php' ) { |
|
87 | - $options['hideeditbox-gravityview'] = true; |
|
86 | + if ( $pagenow === 'post-new.php' ) { |
|
87 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $options; |