@@ -10,175 +10,175 @@ |
||
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() { |
|
26 | - |
|
27 | - if( !is_admin() ) { |
|
28 | - return; |
|
29 | - } |
|
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 ); |
|
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 ); |
|
25 | + function load() { |
|
26 | + |
|
27 | + if( !is_admin() ) { |
|
28 | + return; |
|
29 | + } |
|
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 ); |
|
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 ); |
|
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_tooltips', array( $this, 'tooltips') ); |
|
42 | - |
|
43 | - // custom fields' options for zone EDIT |
|
44 | - add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 5 ); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
49 | - * @param array $entry_default_fields Existing fields |
|
50 | - * @param string|array $form form_ID or form object |
|
51 | - * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
52 | - */ |
|
53 | - function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
54 | - |
|
55 | - if( $zone !== 'edit' ) { |
|
56 | - |
|
57 | - $entry_default_fields['edit_link'] = array( |
|
58 | - 'label' => __('Edit Entry', 'gravityview'), |
|
59 | - 'type' => 'edit_link', |
|
60 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
61 | - ); |
|
62 | - |
|
63 | - } |
|
64 | - |
|
65 | - return $entry_default_fields; |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * Change wording for the Edit context to read Entry Creator |
|
70 | - * |
|
71 | - * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
72 | - * @param string $field_type Type of field options to render (`field` or `widget`) |
|
73 | - * @param string $template_id Table slug |
|
74 | - * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
75 | - * @param string $context What context are we in? Example: `single` or `directory` |
|
76 | - * @param string $input_type (textarea, list, select, etc.) |
|
77 | - * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
78 | - */ |
|
79 | - function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
80 | - |
|
81 | - $caps = $visibility_caps; |
|
82 | - |
|
83 | - // If we're configuring fields in the edit context, we want a limited selection |
|
84 | - if( $context === 'edit' ) { |
|
85 | - |
|
86 | - // Remove other built-in caps. |
|
87 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
88 | - |
|
89 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
90 | - } |
|
91 | - |
|
92 | - return $caps; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Add "Edit Link Text" setting to the edit_link field settings |
|
97 | - * @param [type] $field_options [description] |
|
98 | - * @param [type] $template_id [description] |
|
99 | - * @param [type] $field_id [description] |
|
100 | - * @param [type] $context [description] |
|
101 | - * @param [type] $input_type [description] |
|
102 | - * @return [type] [description] |
|
103 | - */ |
|
104 | - function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
105 | - |
|
106 | - // Always a link, never a filter |
|
107 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
108 | - |
|
109 | - // Edit Entry link should only appear to visitors capable of editing entries |
|
110 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
111 | - |
|
112 | - $add_option['edit_link'] = array( |
|
113 | - 'type' => 'text', |
|
114 | - 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
115 | - 'desc' => NULL, |
|
116 | - 'value' => __('Edit Entry', 'gravityview'), |
|
117 | - 'merge_tags' => true, |
|
118 | - ); |
|
119 | - |
|
120 | - return array_merge( $add_option, $field_options ); |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Add tooltips |
|
125 | - * @param array $tooltips Existing tooltips |
|
126 | - * @return array Modified tooltips |
|
127 | - */ |
|
128 | - function tooltips( $tooltips ) { |
|
129 | - |
|
130 | - $return = $tooltips; |
|
131 | - |
|
132 | - $return['allow_edit_cap'] = array( |
|
133 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
134 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
135 | - ); |
|
136 | - |
|
137 | - return $return; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Manipulate the fields' options for the EDIT ENTRY screen |
|
142 | - * @param [type] $field_options [description] |
|
143 | - * @param [type] $template_id [description] |
|
144 | - * @param [type] $field_id [description] |
|
145 | - * @param [type] $context [description] |
|
146 | - * @param [type] $input_type [description] |
|
147 | - * @return [type] [description] |
|
148 | - */ |
|
149 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
150 | - |
|
151 | - // We only want to modify the settings for the edit context |
|
152 | - if( 'edit' !== $context ) { |
|
153 | - |
|
154 | - /** |
|
155 | - * @since 1.8.4 |
|
156 | - */ |
|
157 | - $field_options['new_window'] = array( |
|
158 | - 'type' => 'checkbox', |
|
159 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
160 | - 'value' => false, |
|
161 | - ); |
|
162 | - |
|
163 | - return $field_options; |
|
164 | - } |
|
165 | - |
|
166 | - // Entry field is only for logged in users |
|
167 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
168 | - |
|
169 | - $add_options = array( |
|
170 | - 'allow_edit_cap' => array( |
|
171 | - 'type' => 'select', |
|
172 | - 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
173 | - 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
174 | - 'tooltip' => 'allow_edit_cap', |
|
175 | - 'class' => 'widefat', |
|
176 | - 'value' => 'read', // Default: entry creator |
|
177 | - ), |
|
178 | - ); |
|
179 | - |
|
180 | - return array_merge( $field_options, $add_options ); |
|
181 | - } |
|
40 | + // add tooltips |
|
41 | + add_filter( 'gravityview_tooltips', array( $this, 'tooltips') ); |
|
42 | + |
|
43 | + // custom fields' options for zone EDIT |
|
44 | + add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 5 ); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
49 | + * @param array $entry_default_fields Existing fields |
|
50 | + * @param string|array $form form_ID or form object |
|
51 | + * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
52 | + */ |
|
53 | + function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
54 | + |
|
55 | + if( $zone !== 'edit' ) { |
|
56 | + |
|
57 | + $entry_default_fields['edit_link'] = array( |
|
58 | + 'label' => __('Edit Entry', 'gravityview'), |
|
59 | + 'type' => 'edit_link', |
|
60 | + 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
61 | + ); |
|
62 | + |
|
63 | + } |
|
64 | + |
|
65 | + return $entry_default_fields; |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * Change wording for the Edit context to read Entry Creator |
|
70 | + * |
|
71 | + * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
72 | + * @param string $field_type Type of field options to render (`field` or `widget`) |
|
73 | + * @param string $template_id Table slug |
|
74 | + * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
75 | + * @param string $context What context are we in? Example: `single` or `directory` |
|
76 | + * @param string $input_type (textarea, list, select, etc.) |
|
77 | + * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
78 | + */ |
|
79 | + function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
80 | + |
|
81 | + $caps = $visibility_caps; |
|
82 | + |
|
83 | + // If we're configuring fields in the edit context, we want a limited selection |
|
84 | + if( $context === 'edit' ) { |
|
85 | + |
|
86 | + // Remove other built-in caps. |
|
87 | + unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
88 | + |
|
89 | + $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
90 | + } |
|
91 | + |
|
92 | + return $caps; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Add "Edit Link Text" setting to the edit_link field settings |
|
97 | + * @param [type] $field_options [description] |
|
98 | + * @param [type] $template_id [description] |
|
99 | + * @param [type] $field_id [description] |
|
100 | + * @param [type] $context [description] |
|
101 | + * @param [type] $input_type [description] |
|
102 | + * @return [type] [description] |
|
103 | + */ |
|
104 | + function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
105 | + |
|
106 | + // Always a link, never a filter |
|
107 | + unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
108 | + |
|
109 | + // Edit Entry link should only appear to visitors capable of editing entries |
|
110 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
111 | + |
|
112 | + $add_option['edit_link'] = array( |
|
113 | + 'type' => 'text', |
|
114 | + 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
115 | + 'desc' => NULL, |
|
116 | + 'value' => __('Edit Entry', 'gravityview'), |
|
117 | + 'merge_tags' => true, |
|
118 | + ); |
|
119 | + |
|
120 | + return array_merge( $add_option, $field_options ); |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Add tooltips |
|
125 | + * @param array $tooltips Existing tooltips |
|
126 | + * @return array Modified tooltips |
|
127 | + */ |
|
128 | + function tooltips( $tooltips ) { |
|
129 | + |
|
130 | + $return = $tooltips; |
|
131 | + |
|
132 | + $return['allow_edit_cap'] = array( |
|
133 | + 'title' => __('Limiting Edit Access', 'gravityview'), |
|
134 | + 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
135 | + ); |
|
136 | + |
|
137 | + return $return; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Manipulate the fields' options for the EDIT ENTRY screen |
|
142 | + * @param [type] $field_options [description] |
|
143 | + * @param [type] $template_id [description] |
|
144 | + * @param [type] $field_id [description] |
|
145 | + * @param [type] $context [description] |
|
146 | + * @param [type] $input_type [description] |
|
147 | + * @return [type] [description] |
|
148 | + */ |
|
149 | + function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
150 | + |
|
151 | + // We only want to modify the settings for the edit context |
|
152 | + if( 'edit' !== $context ) { |
|
153 | + |
|
154 | + /** |
|
155 | + * @since 1.8.4 |
|
156 | + */ |
|
157 | + $field_options['new_window'] = array( |
|
158 | + 'type' => 'checkbox', |
|
159 | + 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
160 | + 'value' => false, |
|
161 | + ); |
|
162 | + |
|
163 | + return $field_options; |
|
164 | + } |
|
165 | + |
|
166 | + // Entry field is only for logged in users |
|
167 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
168 | + |
|
169 | + $add_options = array( |
|
170 | + 'allow_edit_cap' => array( |
|
171 | + 'type' => 'select', |
|
172 | + 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
173 | + 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
174 | + 'tooltip' => 'allow_edit_cap', |
|
175 | + 'class' => 'widefat', |
|
176 | + 'value' => 'read', // Default: entry creator |
|
177 | + ), |
|
178 | + ); |
|
179 | + |
|
180 | + return array_merge( $field_options, $add_options ); |
|
181 | + } |
|
182 | 182 | |
183 | 183 | |
184 | 184 | } // end class |
185 | 185 | \ No newline at end of file |
@@ -7,15 +7,15 @@ |
||
7 | 7 | <div id="publishing-action"> |
8 | 8 | <?php |
9 | 9 | |
10 | - /** |
|
11 | - * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
12 | - * @since 1.11.1 |
|
13 | - * @param string $back_link Existing URL of the Cancel link |
|
14 | - * @param array $form The Gravity Forms form |
|
15 | - * @param array $entry The Gravity Forms entry |
|
16 | - * @param int $view_id The current View ID |
|
17 | - */ |
|
18 | - $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
10 | + /** |
|
11 | + * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
12 | + * @since 1.11.1 |
|
13 | + * @param string $back_link Existing URL of the Cancel link |
|
14 | + * @param array $form The Gravity Forms form |
|
15 | + * @param array $entry The Gravity Forms entry |
|
16 | + * @param int $view_id The current View ID |
|
17 | + */ |
|
18 | + $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container. |
@@ -307,7 +307,7 @@ |
||
307 | 307 | ! isset( $value ) // If it's not set, it's empty! |
308 | 308 | || false === $value |
309 | 309 | || null === $value |
310 | - || '' === $value // Empty string |
|
310 | + || '' === $value // Empty string |
|
311 | 311 | || array() === $value // Empty array |
312 | 312 | || ( is_object( $value ) && ! get_object_vars( $value ) ) // Empty object |
313 | 313 | ) { |
@@ -116,12 +116,12 @@ |
||
116 | 116 | return $settings; |
117 | 117 | } |
118 | 118 | |
119 | - /** |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function get_widget_id() { |
|
123 | - return $this->widget_id; |
|
124 | - } |
|
119 | + /** |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function get_widget_id() { |
|
123 | + return $this->widget_id; |
|
124 | + } |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Get the widget settings |
@@ -39,22 +39,22 @@ |
||
39 | 39 | |
40 | 40 | <?php |
41 | 41 | |
42 | - $search_value = rgget( $search_field['name'] ); |
|
42 | + $search_value = rgget( $search_field['name'] ); |
|
43 | 43 | |
44 | - foreach ( $search_field['choices'] as $k => $choice ) { |
|
44 | + foreach ( $search_field['choices'] as $k => $choice ) { |
|
45 | 45 | |
46 | - if ( 0 != $k ) { |
|
47 | - echo esc_html( $links_sep ); |
|
48 | - } |
|
46 | + if ( 0 != $k ) { |
|
47 | + echo esc_html( $links_sep ); |
|
48 | + } |
|
49 | 49 | |
50 | - $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
50 | + $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
51 | 51 | |
52 | - if ( $active ) { |
|
53 | - $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
54 | - } else { |
|
55 | - $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
56 | - } |
|
57 | - ?> |
|
52 | + if ( $active ) { |
|
53 | + $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
54 | + } else { |
|
55 | + $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
56 | + } |
|
57 | + ?> |
|
58 | 58 | |
59 | 59 | <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a> |
60 | 60 |
@@ -184,8 +184,8 @@ |
||
184 | 184 | // Get the settings for the View ID |
185 | 185 | $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
186 | 186 | |
187 | - // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
|
188 | - $criteria['context_view_id'] = $instance['view_id']; |
|
187 | + // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
|
188 | + $criteria['context_view_id'] = $instance['view_id']; |
|
189 | 189 | |
190 | 190 | $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
191 | 191 | $view_settings['id'] = $instance['view_id']; |
@@ -227,7 +227,7 @@ |
||
227 | 227 | */ |
228 | 228 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField() ); |
229 | 229 | |
230 | - $content = gravityview_get_link( $link, $content, $link_atts ); |
|
230 | + $content = gravityview_get_link( $link, $content, $link_atts ); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $output_arr[] = array( |
@@ -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 | } |
@@ -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 | * |