@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 ); |
12 | 12 | |
13 | 13 | // Add script to enable edit link |
14 | - add_action( 'admin_head', array( $this, 'add_edit_script') ); |
|
14 | + add_action( 'admin_head', array( $this, 'add_edit_script' ) ); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | 'page' => 'gf_entries', |
61 | 61 | 'view' => 'entry', |
62 | 62 | 'id' => (int)$form_id, |
63 | - 'lid' => (int)$lead["id"], |
|
63 | + 'lid' => (int)$lead[ "id" ], |
|
64 | 64 | 'screen_mode' => 'edit', |
65 | 65 | ); |
66 | 66 | ?> |
67 | 67 | |
68 | 68 | <span class="edit edit_entry"> |
69 | 69 | | |
70 | - <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
70 | + <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview' ); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page=' . $query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
71 | 71 | </span> |
72 | 72 | <?php |
73 | 73 | } |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | |
27 | 27 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
28 | 28 | |
29 | - unset( $field_options['search_filter'] ); |
|
29 | + unset( $field_options[ 'search_filter' ] ); |
|
30 | 30 | |
31 | - if( 'edit' === $context ) { |
|
31 | + if ( 'edit' === $context ) { |
|
32 | 32 | return $field_options; |
33 | 33 | } |
34 | 34 | |
35 | - $add_options['link_to_file'] = array( |
|
35 | + $add_options[ 'link_to_file' ] = array( |
|
36 | 36 | 'type' => 'checkbox', |
37 | 37 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
38 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
38 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
39 | 39 | 'value' => false, |
40 | 40 | 'merge_tags' => false, |
41 | 41 | ); |
42 | 42 | |
43 | - $add_options['image_width'] = array( |
|
43 | + $add_options[ 'image_width' ] = array( |
|
44 | 44 | 'type' => 'text', |
45 | 45 | 'label' => __( 'Custom Width:', 'gravityview' ), |
46 | 46 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | $base_id = null; |
130 | 130 | |
131 | 131 | $is_single = gravityview_get_context() === 'single'; |
132 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
132 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
133 | 133 | $field_compat = $gravityview_view->getCurrentField(); |
134 | 134 | } |
135 | 135 | |
136 | 136 | $output_arr = array(); |
137 | 137 | |
138 | 138 | // Get an array of file paths for the field. |
139 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
139 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
140 | 140 | |
141 | 141 | // The $value JSON was probably truncated; let's check lead_detail_long. |
142 | 142 | if ( ! is_array( $file_paths ) ) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $rendered = null; |
157 | 157 | |
158 | 158 | // If the site is HTTPS, use HTTPS |
159 | - if ( function_exists('set_url_scheme') ) { |
|
159 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
160 | 160 | $file_path = set_url_scheme( $file_path ); |
161 | 161 | } |
162 | 162 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | $file_path_info = pathinfo( $file_path ); |
168 | 168 | |
169 | 169 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
170 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
171 | - $basename = $file_path_info['basename']; |
|
170 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
171 | + $basename = $file_path_info[ 'basename' ]; |
|
172 | 172 | |
173 | 173 | // Get the secure download URL |
174 | 174 | $is_secure = false; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
210 | 210 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
211 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
211 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
212 | 212 | ), $context ); |
213 | 213 | |
214 | 214 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
246 | 246 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
247 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
247 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
248 | 248 | ), $context ); |
249 | 249 | |
250 | 250 | /** |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | $file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path ); |
276 | 276 | } |
277 | 277 | |
278 | - $field_settings['link_to_file'] = true; |
|
278 | + $field_settings[ 'link_to_file' ] = true; |
|
279 | 279 | |
280 | 280 | // Images |
281 | 281 | } else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) { |
282 | 282 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
283 | 283 | $image_atts = array( |
284 | 284 | 'src' => $file_path, |
285 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
286 | - 'alt' => $field_settings['label'], |
|
287 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
285 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
286 | + 'alt' => $field_settings[ 'label' ], |
|
287 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
288 | 288 | ); |
289 | 289 | |
290 | 290 | if ( $is_secure ) { |
291 | - $image_atts['validate_src'] = false; |
|
291 | + $image_atts[ 'validate_src' ] = false; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | unset( $gv_entry ); |
311 | 311 | |
312 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
312 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
313 | 313 | $lightbox_link_atts = array( |
314 | 314 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
315 | 315 | 'class' => '', |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | } |
324 | 324 | |
325 | 325 | // Show as link should render the image regardless. |
326 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
326 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
327 | 327 | $text = $rendered; |
328 | 328 | } |
329 | 329 | } |
330 | 330 | // For all other non-media file types (ZIP, for example), always show as a link regardless of setting. |
331 | 331 | else { |
332 | - $field_settings['link_to_file'] = true; |
|
332 | + $field_settings[ 'link_to_file' ] = true; |
|
333 | 333 | $disable_lightbox = true; |
334 | 334 | } |
335 | 335 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
346 | 346 | |
347 | 347 | // Output textualized content where |
348 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
348 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
349 | 349 | /** |
350 | 350 | * Modify the link text (defaults to the file name) |
351 | 351 | * |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
360 | 360 | |
361 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
361 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
362 | 362 | /** |
363 | 363 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
364 | 364 | * @since 2.0 Added $context |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $content = empty( $rendered ) ? $text : $rendered; |
380 | 380 | } |
381 | 381 | |
382 | - $output_arr[] = array( |
|
382 | + $output_arr[ ] = array( |
|
383 | 383 | 'file_path' => $file_path, |
384 | 384 | 'content' => $content |
385 | 385 | ); |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | 'GravityView_DataTables_Template' => array( |
60 | 60 | 'slug' => 'dt_placeholder', |
61 | 61 | 'label' => __( 'DataTables Table', 'gv-datatables', 'gravityview' ), |
62 | - 'description' => __('Display items in a dynamic table powered by DataTables.', 'gravityview'), |
|
63 | - 'logo' => plugins_url('assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ), |
|
62 | + 'description' => __( 'Display items in a dynamic table powered by DataTables.', 'gravityview' ), |
|
63 | + 'logo' => plugins_url( 'assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ), |
|
64 | 64 | 'buy_source' => 'https://gravityview.co/pricing/?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=datatables', |
65 | 65 | 'preview' => 'https://try.gravityview.co/demo/view/datatables/?utm_source=plugin&utm_medium=try_demo&utm_campaign=view_type&utm_term=datatables', |
66 | 66 | 'license' => esc_html__( 'All Access', 'gravityview' ), |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | |
105 | - $license_price_id = (int) \GV\Utils::get( $license, 'price_id', 0 ); |
|
106 | - $placeholder_price_id = (int) \GV\Utils::get( $placeholder, 'price_id' ); |
|
105 | + $license_price_id = (int)\GV\Utils::get( $license, 'price_id', 0 ); |
|
106 | + $placeholder_price_id = (int)\GV\Utils::get( $placeholder, 'price_id' ); |
|
107 | 107 | |
108 | - $placeholder['type'] = 'custom'; |
|
109 | - $placeholder['included'] = ( $license_price_id >= $placeholder_price_id ); |
|
108 | + $placeholder[ 'type' ] = 'custom'; |
|
109 | + $placeholder[ 'included' ] = ( $license_price_id >= $placeholder_price_id ); |
|
110 | 110 | |
111 | - new GravityView_Placeholder_Template( $placeholder['slug'], $placeholder ); |
|
111 | + new GravityView_Placeholder_Template( $placeholder[ 'slug' ], $placeholder ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | } catch ( Exception $exception ) { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function load() { |
26 | 26 | |
27 | - if( !is_admin() ) { |
|
27 | + if ( ! is_admin() ) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
39 | 39 | |
40 | 40 | // add tooltips |
41 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
41 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) ); |
|
42 | 42 | |
43 | 43 | // custom fields' options for zone EDIT |
44 | 44 | add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | */ |
78 | 78 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
79 | 79 | |
80 | - if( $zone !== 'edit' ) { |
|
80 | + if ( $zone !== 'edit' ) { |
|
81 | 81 | |
82 | - $entry_default_fields['edit_link'] = array( |
|
83 | - 'label' => __('Link to Edit Entry', 'gravityview'), |
|
82 | + $entry_default_fields[ 'edit_link' ] = array( |
|
83 | + 'label' => __( 'Link to Edit Entry', 'gravityview' ), |
|
84 | 84 | 'type' => 'edit_link', |
85 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
85 | + 'desc' => __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ), |
|
86 | 86 | 'icon' => 'dashicons-welcome-write-blog', |
87 | 87 | ); |
88 | 88 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | $caps = $visibility_caps; |
108 | 108 | |
109 | 109 | // If we're configuring fields in the edit context, we want a limited selection |
110 | - if( $context === 'edit' ) { |
|
110 | + if ( $context === 'edit' ) { |
|
111 | 111 | |
112 | 112 | // Remove other built-in caps. |
113 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
113 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
114 | 114 | |
115 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
115 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return $caps; |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
133 | 133 | |
134 | 134 | // Always a link, never a filter |
135 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
135 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
136 | 136 | |
137 | 137 | // Edit Entry link should only appear to visitors capable of editing entries |
138 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
138 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
139 | 139 | |
140 | - $add_option['edit_link'] = array( |
|
140 | + $add_option[ 'edit_link' ] = array( |
|
141 | 141 | 'type' => 'text', |
142 | 142 | 'label' => __( 'Edit Link Text', 'gravityview' ), |
143 | 143 | 'desc' => NULL, |
144 | - 'value' => __('Edit Entry', 'gravityview'), |
|
144 | + 'value' => __( 'Edit Entry', 'gravityview' ), |
|
145 | 145 | 'merge_tags' => true, |
146 | 146 | ); |
147 | 147 | |
148 | - $add_option['new_window'] = array( |
|
148 | + $add_option[ 'new_window' ] = array( |
|
149 | 149 | 'type' => 'checkbox', |
150 | 150 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
151 | 151 | 'value' => false, |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $return = $tooltips; |
167 | 167 | |
168 | - $return['allow_edit_cap'] = array( |
|
169 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
170 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
168 | + $return[ 'allow_edit_cap' ] = array( |
|
169 | + 'title' => __( 'Limiting Edit Access', 'gravityview' ), |
|
170 | + 'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ), |
|
171 | 171 | ); |
172 | 172 | |
173 | 173 | return $return; |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
189 | 189 | |
190 | 190 | // We only want to modify the settings for the edit context |
191 | - if( 'edit' !== $context ) { |
|
191 | + if ( 'edit' !== $context ) { |
|
192 | 192 | return $field_options; |
193 | 193 | } |
194 | 194 | |
195 | 195 | // Entry field is only for logged in users |
196 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
196 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
197 | 197 | |
198 | 198 | $add_options = array( |
199 | 199 | 'allow_edit_cap' => array( |
@@ -10,42 +10,42 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | if ( ! defined( 'WPINC' ) ) { |
13 | - die; |
|
13 | + die; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | |
17 | 17 | class GravityView_Edit_Entry_Admin { |
18 | 18 | |
19 | - protected $loader; |
|
19 | + protected $loader; |
|
20 | 20 | |
21 | - function __construct( GravityView_Edit_Entry $loader ) { |
|
22 | - $this->loader = $loader; |
|
23 | - } |
|
21 | + function __construct( GravityView_Edit_Entry $loader ) { |
|
22 | + $this->loader = $loader; |
|
23 | + } |
|
24 | 24 | |
25 | - function load() { |
|
25 | + function load() { |
|
26 | 26 | |
27 | - if( !is_admin() ) { |
|
28 | - return; |
|
29 | - } |
|
27 | + if( !is_admin() ) { |
|
28 | + return; |
|
29 | + } |
|
30 | 30 | |
31 | - // Add Edit Link as a default field, outside those set in the Gravity Form form |
|
32 | - add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
31 | + // Add Edit Link as a default field, outside those set in the Gravity Form form |
|
32 | + add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
33 | 33 | |
34 | - // For the Edit Entry Link, you don't want visible to all users. |
|
35 | - add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
34 | + // For the Edit Entry Link, you don't want visible to all users. |
|
35 | + add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
36 | 36 | |
37 | - // Modify the field options based on the name of the field type |
|
38 | - add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
|
37 | + // Modify the field options based on the name of the field type |
|
38 | + add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
|
39 | 39 | |
40 | - // add tooltips |
|
41 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
40 | + // add tooltips |
|
41 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
42 | 42 | |
43 | - // custom fields' options for zone EDIT |
|
44 | - add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
|
43 | + // custom fields' options for zone EDIT |
|
44 | + add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
|
45 | 45 | |
46 | - // Add Edit Entry settings to View Settings |
|
47 | - add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) ); |
|
48 | - } |
|
46 | + // Add Edit Entry settings to View Settings |
|
47 | + add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) ); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Render Edit Entry View metabox settings |
@@ -73,109 +73,109 @@ discard block |
||
73 | 73 | GravityView_Render_Settings::render_setting_row( 'action_label_cancel', $current_settings ); |
74 | 74 | } |
75 | 75 | |
76 | - /** |
|
77 | - * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
78 | - * @param array $entry_default_fields Existing fields |
|
79 | - * @param string|array $form form_ID or form object |
|
80 | - * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
81 | - */ |
|
82 | - function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
83 | - |
|
84 | - if( $zone !== 'edit' ) { |
|
85 | - |
|
86 | - $entry_default_fields['edit_link'] = array( |
|
87 | - 'label' => __('Link to Edit Entry', 'gravityview'), |
|
88 | - 'type' => 'edit_link', |
|
89 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
90 | - 'icon' => 'dashicons-welcome-write-blog', |
|
91 | - ); |
|
92 | - |
|
93 | - } |
|
94 | - |
|
95 | - return $entry_default_fields; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Change wording for the Edit context to read Entry Creator |
|
100 | - * |
|
101 | - * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
102 | - * @param string $field_type Type of field options to render (`field` or `widget`) |
|
103 | - * @param string $template_id Table slug |
|
104 | - * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
105 | - * @param string $context What context are we in? Example: `single` or `directory` |
|
106 | - * @param string $input_type (textarea, list, select, etc.) |
|
107 | - * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
108 | - */ |
|
109 | - function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
110 | - |
|
111 | - $caps = $visibility_caps; |
|
112 | - |
|
113 | - // If we're configuring fields in the edit context, we want a limited selection |
|
114 | - if( $context === 'edit' ) { |
|
115 | - |
|
116 | - // Remove other built-in caps. |
|
117 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
118 | - |
|
119 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
120 | - } |
|
121 | - |
|
122 | - return $caps; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Add "Edit Link Text" setting to the edit_link field settings |
|
127 | - * |
|
128 | - * @param array $field_options |
|
129 | - * @param string $template_id |
|
130 | - * @param string $field_id |
|
131 | - * @param string $context |
|
132 | - * @param string $input_type |
|
133 | - * |
|
134 | - * @return array $field_options, with "Edit Link Text" field option |
|
135 | - */ |
|
136 | - function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
137 | - |
|
138 | - // Always a link, never a filter |
|
139 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
140 | - |
|
141 | - // Edit Entry link should only appear to visitors capable of editing entries |
|
142 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
143 | - |
|
144 | - $add_option['edit_link'] = array( |
|
145 | - 'type' => 'text', |
|
146 | - 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
147 | - 'desc' => NULL, |
|
148 | - 'value' => __('Edit Entry', 'gravityview'), |
|
149 | - 'merge_tags' => true, |
|
150 | - ); |
|
151 | - |
|
152 | - $add_option['new_window'] = array( |
|
153 | - 'type' => 'checkbox', |
|
154 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
155 | - 'value' => false, |
|
156 | - 'group' => 'display', |
|
157 | - 'priority' => 1300, |
|
158 | - ); |
|
159 | - |
|
160 | - return array_merge( $add_option, $field_options ); |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Add tooltips |
|
165 | - * @param array $tooltips Existing tooltips |
|
166 | - * @return array Modified tooltips |
|
167 | - */ |
|
168 | - function tooltips( $tooltips ) { |
|
169 | - |
|
170 | - $return = $tooltips; |
|
171 | - |
|
172 | - $return['allow_edit_cap'] = array( |
|
173 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
174 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
175 | - ); |
|
176 | - |
|
177 | - return $return; |
|
178 | - } |
|
76 | + /** |
|
77 | + * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
78 | + * @param array $entry_default_fields Existing fields |
|
79 | + * @param string|array $form form_ID or form object |
|
80 | + * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
81 | + */ |
|
82 | + function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
83 | + |
|
84 | + if( $zone !== 'edit' ) { |
|
85 | + |
|
86 | + $entry_default_fields['edit_link'] = array( |
|
87 | + 'label' => __('Link to Edit Entry', 'gravityview'), |
|
88 | + 'type' => 'edit_link', |
|
89 | + 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
90 | + 'icon' => 'dashicons-welcome-write-blog', |
|
91 | + ); |
|
92 | + |
|
93 | + } |
|
94 | + |
|
95 | + return $entry_default_fields; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Change wording for the Edit context to read Entry Creator |
|
100 | + * |
|
101 | + * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
102 | + * @param string $field_type Type of field options to render (`field` or `widget`) |
|
103 | + * @param string $template_id Table slug |
|
104 | + * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
105 | + * @param string $context What context are we in? Example: `single` or `directory` |
|
106 | + * @param string $input_type (textarea, list, select, etc.) |
|
107 | + * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
108 | + */ |
|
109 | + function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
110 | + |
|
111 | + $caps = $visibility_caps; |
|
112 | + |
|
113 | + // If we're configuring fields in the edit context, we want a limited selection |
|
114 | + if( $context === 'edit' ) { |
|
115 | + |
|
116 | + // Remove other built-in caps. |
|
117 | + unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
118 | + |
|
119 | + $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
120 | + } |
|
121 | + |
|
122 | + return $caps; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Add "Edit Link Text" setting to the edit_link field settings |
|
127 | + * |
|
128 | + * @param array $field_options |
|
129 | + * @param string $template_id |
|
130 | + * @param string $field_id |
|
131 | + * @param string $context |
|
132 | + * @param string $input_type |
|
133 | + * |
|
134 | + * @return array $field_options, with "Edit Link Text" field option |
|
135 | + */ |
|
136 | + function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
137 | + |
|
138 | + // Always a link, never a filter |
|
139 | + unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
140 | + |
|
141 | + // Edit Entry link should only appear to visitors capable of editing entries |
|
142 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
143 | + |
|
144 | + $add_option['edit_link'] = array( |
|
145 | + 'type' => 'text', |
|
146 | + 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
147 | + 'desc' => NULL, |
|
148 | + 'value' => __('Edit Entry', 'gravityview'), |
|
149 | + 'merge_tags' => true, |
|
150 | + ); |
|
151 | + |
|
152 | + $add_option['new_window'] = array( |
|
153 | + 'type' => 'checkbox', |
|
154 | + 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
155 | + 'value' => false, |
|
156 | + 'group' => 'display', |
|
157 | + 'priority' => 1300, |
|
158 | + ); |
|
159 | + |
|
160 | + return array_merge( $add_option, $field_options ); |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Add tooltips |
|
165 | + * @param array $tooltips Existing tooltips |
|
166 | + * @return array Modified tooltips |
|
167 | + */ |
|
168 | + function tooltips( $tooltips ) { |
|
169 | + |
|
170 | + $return = $tooltips; |
|
171 | + |
|
172 | + $return['allow_edit_cap'] = array( |
|
173 | + 'title' => __('Limiting Edit Access', 'gravityview'), |
|
174 | + 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
175 | + ); |
|
176 | + |
|
177 | + return $return; |
|
178 | + } |
|
179 | 179 | |
180 | 180 | /** |
181 | 181 | * Add "Edit Link Text" setting to the edit_link field settings |
@@ -191,28 +191,28 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
193 | 193 | |
194 | - // We only want to modify the settings for the edit context |
|
195 | - if( 'edit' !== $context ) { |
|
196 | - return $field_options; |
|
197 | - } |
|
198 | - |
|
199 | - // Entry field is only for logged in users |
|
200 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
201 | - |
|
202 | - $add_options = array( |
|
203 | - 'allow_edit_cap' => array( |
|
204 | - 'type' => 'select', |
|
205 | - 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
206 | - 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
207 | - 'tooltip' => 'allow_edit_cap', |
|
208 | - 'class' => 'widefat', |
|
209 | - 'value' => 'read', // Default: entry creator |
|
210 | - 'group' => 'visibility', |
|
211 | - ), |
|
212 | - ); |
|
213 | - |
|
214 | - return array_merge( $field_options, $add_options ); |
|
215 | - } |
|
194 | + // We only want to modify the settings for the edit context |
|
195 | + if( 'edit' !== $context ) { |
|
196 | + return $field_options; |
|
197 | + } |
|
198 | + |
|
199 | + // Entry field is only for logged in users |
|
200 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
201 | + |
|
202 | + $add_options = array( |
|
203 | + 'allow_edit_cap' => array( |
|
204 | + 'type' => 'select', |
|
205 | + 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
206 | + 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
207 | + 'tooltip' => 'allow_edit_cap', |
|
208 | + 'class' => 'widefat', |
|
209 | + 'value' => 'read', // Default: entry creator |
|
210 | + 'group' => 'visibility', |
|
211 | + ), |
|
212 | + ); |
|
213 | + |
|
214 | + return array_merge( $field_options, $add_options ); |
|
215 | + } |
|
216 | 216 | |
217 | 217 | |
218 | 218 | } // end class |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | if ( ! empty( $passed_post ) ) { |
22 | 22 | $id_or_id_array = $this->maybe_get_view_id( $passed_post ); |
23 | - foreach( is_array( $id_or_id_array ) ? $id_or_id_array : array( $id_or_id_array ) as $view_id ) { |
|
23 | + foreach ( is_array( $id_or_id_array ) ? $id_or_id_array : array( $id_or_id_array ) as $view_id ) { |
|
24 | 24 | if ( \GV\View::exists( $view_id ) && ! $this->views->contains( $view_id ) ) { |
25 | 25 | $this->views->add( \GV\View::by_id( $view_id ) ); |
26 | 26 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | foreach ( $passed_post as &$post ) { |
79 | 79 | $views = \GV\View_Collection::from_post( $post ); |
80 | 80 | foreach ( $views->all() as $view ) { |
81 | - $ids []= $view->ID; |
|
81 | + $ids [ ] = $view->ID; |
|
82 | 82 | |
83 | 83 | /** And as a side-effect... add each view to the global scope. */ |
84 | 84 | if ( ! $this->views->contains( $view->ID ) ) { |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | if ( is_string( $passed_post ) ) { |
93 | 93 | $shortcodes = \GV\Shortcode::parse( $passed_post ); |
94 | 94 | foreach ( $shortcodes as $shortcode ) { |
95 | - if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) { |
|
96 | - $ids []= $shortcode->atts['id']; |
|
95 | + if ( $shortcode->name == 'gravityview' && ! empty( $shortcode->atts[ 'id' ] ) ) { |
|
96 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
97 | 97 | |
98 | 98 | /** And as a side-effect... add each view to the global scope. */ |
99 | - if ( ! $this->views->contains( $shortcode->atts['id'] ) && \GV\View::exists( $shortcode->atts['id'] ) ) { |
|
100 | - $this->views->add( $shortcode->atts['id'] ); |
|
99 | + if ( ! $this->views->contains( $shortcode->atts[ 'id' ] ) && \GV\View::exists( $shortcode->atts[ 'id' ] ) ) { |
|
100 | + $this->views->add( $shortcode->atts[ 'id' ] ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } else { |
105 | 105 | $id = $this->get_id_from_atts( $passed_post ); |
106 | - $ids[] = intval( $id ); |
|
106 | + $ids[ ] = intval( $id ); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // If it's just one ID, return that. |
115 | 115 | // Otherwise, return array of IDs |
116 | - return ( count( $ids ) === 1 ) ? $ids[0] : $ids; |
|
116 | + return ( count( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function getInstance( $passed_post = NULL ) { |
123 | 123 | |
124 | - if( empty( self::$instance ) ) { |
|
124 | + if ( empty( self::$instance ) ) { |
|
125 | 125 | self::$instance = new GravityView_View_Data( $passed_post ); |
126 | 126 | } |
127 | 127 | |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | return array(); |
138 | 138 | } |
139 | 139 | return array_combine( |
140 | - array_map( function ( $view ) { return $view->ID; }, $this->views->all() ), |
|
141 | - array_map( function ( $view ) { return $view->as_data(); }, $this->views->all() ) |
|
140 | + array_map( function( $view ) { return $view->ID; }, $this->views->all() ), |
|
141 | + array_map( function( $view ) { return $view->as_data(); }, $this->views->all() ) |
|
142 | 142 | ); |
143 | 143 | } |
144 | 144 | |
@@ -252,22 +252,22 @@ discard block |
||
252 | 252 | public function parse_post_content( $content ) { |
253 | 253 | $ids = array(); |
254 | 254 | foreach ( \GV\Shortcode::parse( $content ) as $shortcode ) { |
255 | - if ( $shortcode->name == 'gravityview' && is_numeric( $shortcode->atts['id'] ) ) { |
|
256 | - if ( \GV\View::exists( $shortcode->atts['id'] ) && ! $this->views->contains( $shortcode->atts['id'] ) ) { |
|
257 | - $this->views->add( \GV\View::by_id( $shortcode->atts['id'] ) ); |
|
255 | + if ( $shortcode->name == 'gravityview' && is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
256 | + if ( \GV\View::exists( $shortcode->atts[ 'id' ] ) && ! $this->views->contains( $shortcode->atts[ 'id' ] ) ) { |
|
257 | + $this->views->add( \GV\View::by_id( $shortcode->atts[ 'id' ] ) ); |
|
258 | 258 | } |
259 | 259 | /** |
260 | 260 | * The original function outputs the ID even though it wasn't added by ::add_view() |
261 | 261 | * Wether this is a bug or not remains a mystery. But we need to emulate this behavior |
262 | 262 | * until better times. |
263 | 263 | */ |
264 | - $ids []= $shortcode->atts['id']; |
|
264 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | if ( empty ( $ids ) ) { |
268 | 268 | return null; |
269 | 269 | } |
270 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
270 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | // Not invalid if not set! |
291 | 291 | if ( empty( $post_id ) || empty( $view_id ) ) { |
292 | 292 | |
293 | - if( $empty_is_valid ) { |
|
293 | + if ( $empty_is_valid ) { |
|
294 | 294 | return true; |
295 | 295 | } |
296 | 296 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() ); |
324 | 324 | |
325 | 325 | // The post or page specified does not contain the shortcode. |
326 | - if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) { |
|
326 | + if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) { |
|
327 | 327 | $message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' ); |
328 | 328 | } |
329 | 329 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | if ( ! $message ) { |
332 | 332 | // It's a View |
333 | 333 | if ( \GV\View::exists( $post_id ) ) { |
334 | - $message = esc_html__( 'The ID is already a View.', 'gravityview' );; |
|
334 | + $message = esc_html__( 'The ID is already a View.', 'gravityview' ); ; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | if ( ! $detailed ) { |
556 | 556 | $defaults = array(); |
557 | 557 | foreach ( $default_settings as $key => $value ) { |
558 | - $defaults[ $key ] = $value['value']; |
|
558 | + $defaults[ $key ] = $value[ 'value' ]; |
|
559 | 559 | } |
560 | 560 | return $defaults; |
561 | 561 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | // If the $group argument is set for the method, |
567 | 567 | // ignore any settings that aren't in that group. |
568 | 568 | if ( ! empty( $group ) && is_string( $group ) ) { |
569 | - if ( empty( $value['group'] ) || $value['group'] !== $group ) { |
|
569 | + if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) { |
|
570 | 570 | unset( $default_settings[ $key ] ); |
571 | 571 | } |
572 | 572 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | return; |
305 | 305 | } |
306 | 306 | |
307 | - $locale = apply_filters( 'plugin_locale', ( ( function_exists('get_user_locale') && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
307 | + $locale = apply_filters( 'plugin_locale', ( ( function_exists( 'get_user_locale' ) && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
308 | 308 | |
309 | 309 | gravityview()->log->error( sprintf( 'Unable to load textdomain for %s locale.', $locale ) ); |
310 | 310 | } |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | */ |
527 | 527 | private function get_php_version() { |
528 | 528 | |
529 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
530 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
529 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
530 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | */ |
540 | 540 | private function get_wordpress_version() { |
541 | 541 | |
542 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
543 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
542 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
543 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -552,14 +552,14 @@ discard block |
||
552 | 552 | */ |
553 | 553 | private function get_gravityforms_version() { |
554 | 554 | |
555 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
555 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
556 | 556 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
557 | 557 | |
558 | 558 | return null; |
559 | 559 | } |
560 | 560 | |
561 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
562 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
561 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
562 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | $items = get_posts( array( |
606 | 606 | 'post_type' => 'gravityview', |
607 | 607 | 'post_status' => 'any', |
608 | - 'numberposts' => - 1, |
|
608 | + 'numberposts' => -1, |
|
609 | 609 | 'fields' => 'ids', |
610 | 610 | ) ); |
611 | 611 | |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | $tables = array(); |
620 | 620 | |
621 | 621 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
622 | - $tables [] = \GFFormsModel::get_entry_meta_table_name(); |
|
622 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
623 | 623 | } elseif ( ! $this->is_GF_25() ) { |
624 | - $tables [] = \GFFormsModel::get_lead_meta_table_name(); |
|
624 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | foreach ( $tables as $meta_table ) { |
@@ -640,9 +640,9 @@ discard block |
||
640 | 640 | $tables = array(); |
641 | 641 | |
642 | 642 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
643 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
643 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
644 | 644 | } elseif ( ! $this->is_GF_25() ) { |
645 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
645 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | array( |
84 | 84 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
85 | 85 | 'action' => 'entry_creator_get_users', |
86 | - 'gf25' => (bool) gravityview()->plugin->is_GF_25(), |
|
86 | + 'gf25' => (bool)gravityview()->plugin->is_GF_25(), |
|
87 | 87 | 'language' => array( |
88 | 88 | 'search_placeholder' => esc_html__( 'Search by ID, login, email, or name.', 'gravityview' ), |
89 | 89 | ), |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | ) |
108 | 108 | ); |
109 | 109 | |
110 | - if ( ! wp_verify_nonce( $post_var['gv_nonce'], 'gv_entry_creator' ) ) { |
|
110 | + if ( ! wp_verify_nonce( $post_var[ 'gv_nonce' ], 'gv_entry_creator' ) ) { |
|
111 | 111 | die(); |
112 | 112 | } |
113 | 113 | |
114 | - $search_string = $post_var['q']; |
|
114 | + $search_string = $post_var[ 'q' ]; |
|
115 | 115 | |
116 | 116 | if ( is_numeric( $search_string ) ) { |
117 | 117 | $user_args = array( |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
161 | - $result = RGFormsModel::update_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true ); |
|
161 | + $result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true ); |
|
162 | 162 | |
163 | 163 | if ( false === $result ) { |
164 | 164 | $status = __( 'Error', 'gravityview' ); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | - GravityView_Entry_Notes::add_note( $entry['id'], - 1, 'GravityView', $note, 'gravityview' ); |
|
183 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], - 1, 'GravityView', $note, 'gravityview' ); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | // If screen mode isn't set, then we're in the wrong place. |
218 | - if ( empty( $_REQUEST['screen_mode'] ) ) { |
|
218 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
219 | 219 | return; |
220 | 220 | } |
221 | 221 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
243 | 243 | if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) { |
244 | - $_POST["screen_mode"] = 'edit'; |
|
244 | + $_POST[ "screen_mode" ] = 'edit'; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $entry_creator_user_id = \GV\Utils::get( $entry, 'created_by' ); |
317 | 317 | |
318 | 318 | $entry_creator_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $entry_creator_user_id ) ); |
319 | - $entry_creator_user = isset( $entry_creator_user[0] ) ? $entry_creator_user[0] : array(); |
|
319 | + $entry_creator_user = isset( $entry_creator_user[ 0 ] ) ? $entry_creator_user[ 0 ] : array(); |
|
320 | 320 | |
321 | 321 | $output .= '<option value="0" ' . selected( true, empty( $entry_creator_user_id ), false ) . '> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
322 | 322 | |
@@ -335,18 +335,18 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | $user_count = count_users(); |
338 | - $user_count = $user_count['total_users']; |
|
338 | + $user_count = $user_count[ 'total_users' ]; |
|
339 | 339 | $users_displayed = self::DEFAULT_NUMBER_OF_USERS + ( ! empty( $entry_creator_user ) ? 1 : 0 ); |
340 | 340 | if ( $user_count > $users_displayed ) { |
341 | 341 | $remaining_users = $user_count - $users_displayed; |
342 | - $user_users = _n( esc_html__('user', 'gravityview' ), esc_html__('users', 'gravityview' ), $remaining_users ); |
|
342 | + $user_users = _n( esc_html__( 'user', 'gravityview' ), esc_html__( 'users', 'gravityview' ), $remaining_users ); |
|
343 | 343 | $message = esc_html_x( 'Use the input above to search the remaining %d %s.', '%d is replaced with user count %s is replaced with "user" or "users"', 'gravityview' ); |
344 | 344 | $message = sprintf( $message, $remaining_users, $user_users ); |
345 | - $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
345 | + $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | $output .= '</select>'; |
349 | - $output .= '<input name="originally_created_by" value="' . esc_attr( $entry['created_by'] ) . '" type="hidden" />'; |
|
349 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
350 | 350 | $output .= wp_nonce_field( 'gv_entry_creator', 'gv_entry_creator_nonce', false, false ); |
351 | 351 | |
352 | 352 | echo $output; |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @return array |
361 | 361 | */ |
362 | 362 | function register_gform_noconflict( $assets ) { |
363 | - $assets[] = 'gravityview_selectwoo'; |
|
364 | - $assets[] = 'gravityview_entry_creator'; |
|
363 | + $assets[ ] = 'gravityview_selectwoo'; |
|
364 | + $assets[ ] = 'gravityview_entry_creator'; |
|
365 | 365 | |
366 | 366 | return $assets; |
367 | 367 | } |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | <div id="publishing-action"> |
21 | 21 | <?php |
22 | 22 | |
23 | - /** |
|
24 | - * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
25 | - * @since 1.11.1 |
|
26 | - * @since 2.11 The cancel link now uses history.back() so the $back_link URL matters less. |
|
27 | - * @param string $back_link Existing URL of the Cancel link |
|
28 | - * @param array $form The Gravity Forms form |
|
29 | - * @param array $entry The Gravity Forms entry |
|
30 | - * @param int $view_id The current View ID |
|
31 | - */ |
|
32 | - $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
23 | + /** |
|
24 | + * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
25 | + * @since 1.11.1 |
|
26 | + * @since 2.11 The cancel link now uses history.back() so the $back_link URL matters less. |
|
27 | + * @param string $back_link Existing URL of the Cancel link |
|
28 | + * @param array $form The Gravity Forms form |
|
29 | + * @param array $entry The Gravity Forms entry |
|
30 | + * @param int $view_id The current View ID |
|
31 | + */ |
|
32 | + $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container. |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @used-by GravityView_Delete_Entry::add_delete_button() |
85 | 85 | * |
86 | 86 | * @since 1.5.1 |
87 | - * @since 2.0.13 Added $post_id |
|
87 | + * @since 2.0.13 Added $post_id |
|
88 | 88 | * @param array $form The Gravity Forms form |
89 | 89 | * @param array $entry The Gravity Forms entry |
90 | 90 | * @param int $view_id The current View ID |
91 | - * @param int $post_id The current Post ID |
|
91 | + * @param int $post_id The current Post ID |
|
92 | 92 | */ |
93 | 93 | do_action( 'gravityview/edit-entry/publishing-action/after', $object->form, $object->entry, $object->view_id, $object->post_id ); |
94 | 94 | ?> |
@@ -44,35 +44,35 @@ discard block |
||
44 | 44 | |
45 | 45 | if ( $object->show_previous_button ) { |
46 | 46 | $previous_tabindex = GFCommon::get_tabindex(); |
47 | - $previous_label = GFCommon::replace_variables( $labels['previous'], $object->form, $object->entry ); |
|
47 | + $previous_label = GFCommon::replace_variables( $labels[ 'previous' ], $object->form, $object->entry ); |
|
48 | 48 | ?> |
49 | - <input id="gform_previous_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-previous" type="submit" <?php echo $previous_tabindex; ?> value="<?php echo esc_attr( $previous_label ); ?>" name="save" /> |
|
49 | + <input id="gform_previous_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-previous" type="submit" <?php echo $previous_tabindex; ?> value="<?php echo esc_attr( $previous_label ); ?>" name="save" /> |
|
50 | 50 | <?php |
51 | 51 | } |
52 | 52 | |
53 | 53 | if ( $object->show_next_button ) { |
54 | - $next_tabindex = GFCommon::get_tabindex(); |
|
55 | - $next_label = GFCommon::replace_variables( $labels['next'], $object->form, $object->entry ); |
|
54 | + $next_tabindex = GFCommon::get_tabindex(); |
|
55 | + $next_label = GFCommon::replace_variables( $labels[ 'next' ], $object->form, $object->entry ); |
|
56 | 56 | ?> |
57 | - <input id="gform_next_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-next" type="submit" <?php echo $next_tabindex; ?> value="<?php echo esc_attr( $next_label ); ?>" name="save" /> |
|
57 | + <input id="gform_next_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-next" type="submit" <?php echo $next_tabindex; ?> value="<?php echo esc_attr( $next_label ); ?>" name="save" /> |
|
58 | 58 | <?php |
59 | 59 | } |
60 | 60 | |
61 | 61 | if ( $object->show_update_button ) { |
62 | - $update_tabindex = GFCommon::get_tabindex(); |
|
63 | - $update_label = GFCommon::replace_variables( $labels['submit'], $object->form, $object->entry ); |
|
62 | + $update_tabindex = GFCommon::get_tabindex(); |
|
63 | + $update_label = GFCommon::replace_variables( $labels[ 'submit' ], $object->form, $object->entry ); |
|
64 | 64 | ?> |
65 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $update_label ); ?>" name="save" /> |
|
65 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $update_label ); ?>" name="save" /> |
|
66 | 66 | <?php |
67 | 67 | } |
68 | 68 | |
69 | - $cancel_tabindex = GFCommon::get_tabindex(); |
|
70 | - $cancel_label = GFCommon::replace_variables( $labels['cancel'], $object->form, $object->entry ); |
|
69 | + $cancel_tabindex = GFCommon::get_tabindex(); |
|
70 | + $cancel_label = GFCommon::replace_variables( $labels[ 'cancel' ], $object->form, $object->entry ); |
|
71 | 71 | |
72 | 72 | // If the entry has been edited, history.back() will keep pointing to the Edit Entry screen. Go back before editing, please! |
73 | 73 | // On first visit, will be history.go(-1) because (0 + 1 * -1). |
74 | 74 | // After updating twice, history.go(-3) because (2 + 1 * -1) |
75 | - $update_count = (int) \GV\Utils::_POST( 'update_count', 0 ); |
|
75 | + $update_count = (int)\GV\Utils::_POST( 'update_count', 0 ); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @filter `gravityview/edit_entry/cancel_onclick` Modify the `onclick` attribute for the back link. To remove `onclick` altogether, return an empty string. |
@@ -106,5 +106,5 @@ discard block |
||
106 | 106 | ?> |
107 | 107 | <input type='hidden' name='update_count' value='<?php echo $update_count + 1; ?>'/> |
108 | 108 | <input type="hidden" name="action" value="update" /> |
109 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
109 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
110 | 110 | </div> |