@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Render the page size widget |
79 | - * |
|
79 | + * |
|
80 | 80 | * @param array $widget_args The Widget shortcode args. |
81 | 81 | * @param string $content The content. |
82 | 82 | * @param string|\GV\Template_Context $context The context, if available. |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | <?php } ?> |
118 | 118 | </select> |
119 | 119 | <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php |
120 | - if( ! empty( $_GET ) ) { |
|
121 | - $get = $_GET; |
|
122 | - unset( $get['page_size'] ); |
|
123 | - foreach ( $get as $key => $value ) { |
|
120 | + if( ! empty( $_GET ) ) { |
|
121 | + $get = $_GET; |
|
122 | + unset( $get['page_size'] ); |
|
123 | + foreach ( $get as $key => $value ) { |
|
124 | 124 | if ( is_array( $value ) ) { |
125 | 125 | foreach ( $value as $_key => $_value ) { |
126 | 126 | printf( '<input type="hidden" name="%s[%s]" value="%s" />', esc_attr( $key ), esc_attr( $_key ), esc_attr( $_value ) ); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | } else { |
129 | 129 | printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) ); |
130 | 130 | } |
131 | - } |
|
132 | - } |
|
133 | - ?> |
|
131 | + } |
|
132 | + } |
|
133 | + ?> |
|
134 | 134 | </div> |
135 | 135 | </form> |
136 | 136 | </div> |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public static function get_duplicate_link( $entry, $view_id, $post_id = null ) { |
248 | 248 | |
249 | - $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
249 | + $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
250 | 250 | |
251 | 251 | if ( empty( $base ) ) { |
252 | 252 | gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) ); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | 'action' => 'duplicate', |
258 | 258 | 'entry_id' => $entry['id'], |
259 | 259 | 'gvid' => $view_id, |
260 | - 'view_id' => $view_id, |
|
260 | + 'view_id' => $view_id, |
|
261 | 261 | ), $base ); |
262 | 262 | |
263 | 263 | return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl ); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @since 2.5 |
461 | 461 | * @param array $duplicated_entry The duplicated entry |
462 | 462 | * @param array $entry The original entry |
463 | - */ |
|
463 | + */ |
|
464 | 464 | do_action( 'gravityview/duplicate-entry/duplicated', $duplicated_entry, $entry ); |
465 | 465 | |
466 | 466 | gravityview()->log->debug( 'Duplicate response: {duplicate_response}', array( 'duplicate_response' => $duplicate_response ) ); |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | |
32 | 32 | <?php |
33 | 33 | |
34 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
34 | + do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
35 | 35 | |
36 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
36 | + do_action('gravityview_render_field_pickers', 'directory' ); |
|
37 | 37 | |
38 | - ?> |
|
38 | + ?> |
|
39 | 39 | |
40 | 40 | <?php // list of available widgets to be shown in the popup ?> |
41 | 41 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | |
61 | 61 | <div id="single-active-fields" class="gv-grid"> |
62 | 62 | <?php |
63 | - if(!empty( $curr_template ) ) { |
|
64 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
65 | - } |
|
66 | - ?> |
|
63 | + if(!empty( $curr_template ) ) { |
|
64 | + do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
65 | + } |
|
66 | + ?> |
|
67 | 67 | </div> |
68 | 68 | <?php |
69 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
69 | + do_action('gravityview_render_field_pickers', 'single' ); |
|
70 | 70 | ?> |
71 | 71 | </div> |
72 | 72 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | </div> |
86 | 86 | |
87 | 87 | <?php |
88 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
88 | + do_action('gravityview_render_field_pickers', 'edit' ); |
|
89 | 89 | ?> |
90 | 90 | |
91 | 91 | </div> |
@@ -18,83 +18,83 @@ discard block |
||
18 | 18 | |
19 | 19 | class GravityView_Edit_Entry { |
20 | 20 | |
21 | - /** |
|
22 | - * @var string |
|
23 | - */ |
|
21 | + /** |
|
22 | + * @var string |
|
23 | + */ |
|
24 | 24 | static $file; |
25 | 25 | |
26 | 26 | static $instance; |
27 | 27 | |
28 | - /** |
|
29 | - * Component instances. |
|
30 | - * @var array |
|
31 | - */ |
|
32 | - public $instances = array(); |
|
28 | + /** |
|
29 | + * Component instances. |
|
30 | + * @var array |
|
31 | + */ |
|
32 | + public $instances = array(); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | function __construct() { |
36 | 36 | |
37 | - self::$file = plugin_dir_path( __FILE__ ); |
|
37 | + self::$file = plugin_dir_path( __FILE__ ); |
|
38 | 38 | |
39 | - if( is_admin() ) { |
|
40 | - $this->load_components( 'admin' ); |
|
41 | - } |
|
39 | + if( is_admin() ) { |
|
40 | + $this->load_components( 'admin' ); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | $this->load_components( 'locking' ); |
44 | 44 | |
45 | - $this->load_components( 'render' ); |
|
45 | + $this->load_components( 'render' ); |
|
46 | 46 | |
47 | - // If GF User Registration Add-on exists |
|
48 | - $this->load_components( 'user-registration' ); |
|
47 | + // If GF User Registration Add-on exists |
|
48 | + $this->load_components( 'user-registration' ); |
|
49 | 49 | |
50 | - $this->add_hooks(); |
|
50 | + $this->add_hooks(); |
|
51 | 51 | |
52 | 52 | // Process hooks for addons that may or may not be present |
53 | 53 | $this->addon_specific_hooks(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | - static function getInstance() { |
|
57 | + static function getInstance() { |
|
58 | 58 | |
59 | - if( empty( self::$instance ) ) { |
|
60 | - self::$instance = new GravityView_Edit_Entry; |
|
61 | - } |
|
59 | + if( empty( self::$instance ) ) { |
|
60 | + self::$instance = new GravityView_Edit_Entry; |
|
61 | + } |
|
62 | 62 | |
63 | - return self::$instance; |
|
64 | - } |
|
63 | + return self::$instance; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - private function load_components( $component ) { |
|
67 | + private function load_components( $component ) { |
|
68 | 68 | |
69 | - $dir = trailingslashit( self::$file ); |
|
69 | + $dir = trailingslashit( self::$file ); |
|
70 | 70 | |
71 | - $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
72 | - $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
71 | + $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
72 | + $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
73 | 73 | |
74 | - // Loads component and pass extension's instance so that component can |
|
75 | - // talk each other. |
|
76 | - require_once $filename; |
|
77 | - $this->instances[ $component ] = new $classname( $this ); |
|
78 | - $this->instances[ $component ]->load(); |
|
74 | + // Loads component and pass extension's instance so that component can |
|
75 | + // talk each other. |
|
76 | + require_once $filename; |
|
77 | + $this->instances[ $component ] = new $classname( $this ); |
|
78 | + $this->instances[ $component ]->load(); |
|
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - private function add_hooks() { |
|
82 | + private function add_hooks() { |
|
83 | 83 | |
84 | - // Add front-end access to Gravity Forms delete file action |
|
85 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
84 | + // Add front-end access to Gravity Forms delete file action |
|
85 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
86 | 86 | |
87 | - // Make sure this hook is run for non-admins |
|
88 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
87 | + // Make sure this hook is run for non-admins |
|
88 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
89 | 89 | |
90 | - add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
90 | + add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
91 | 91 | |
92 | - // add template path to check for field |
|
93 | - add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
92 | + // add template path to check for field |
|
93 | + add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
94 | 94 | |
95 | 95 | add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 ); |
96 | 96 | |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Trigger hooks that are normally run in the admin for Addons, but need to be triggered manually because we're not in the admin |
@@ -149,74 +149,74 @@ discard block |
||
149 | 149 | return false; |
150 | 150 | } |
151 | 151 | |
152 | - /** |
|
153 | - * Include this extension templates path |
|
154 | - * @param array $file_paths List of template paths ordered |
|
155 | - */ |
|
156 | - public function add_template_path( $file_paths ) { |
|
157 | - |
|
158 | - // Index 100 is the default GravityView template path. |
|
159 | - $file_paths[ 110 ] = self::$file; |
|
160 | - |
|
161 | - return $file_paths; |
|
162 | - } |
|
163 | - |
|
164 | - /** |
|
165 | - * |
|
166 | - * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
167 | - * |
|
168 | - * @param $view_id int GravityView view id |
|
169 | - * @param $form_id int Gravity Forms form id |
|
170 | - * @param $entry_id int Gravity Forms entry id |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
174 | - return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * The edit entry link creates a secure link with a nonce |
|
180 | - * |
|
181 | - * It also mimics the URL structure Gravity Forms expects to have so that |
|
182 | - * it formats the display of the edit form like it does in the backend, like |
|
183 | - * "You can edit this post from the post page" fields, for example. |
|
184 | - * |
|
185 | - * @param $entry array Gravity Forms entry object |
|
186 | - * @param $view_id int GravityView view id |
|
187 | - * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
188 | - * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
189 | - * @return string |
|
190 | - */ |
|
191 | - public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
192 | - |
|
193 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
194 | - |
|
195 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
196 | - |
|
197 | - $url = add_query_arg( array( |
|
198 | - 'edit' => wp_create_nonce( $nonce_key ) |
|
199 | - ), $base ); |
|
200 | - |
|
201 | - if( $post_id ) { |
|
202 | - $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * Allow passing params to dynamically populate entry with values |
|
207 | - * @since 1.9.2 |
|
208 | - */ |
|
209 | - if( !empty( $field_values ) ) { |
|
210 | - |
|
211 | - if( is_array( $field_values ) ) { |
|
212 | - // If already an array, no parse_str() needed |
|
213 | - $params = $field_values; |
|
214 | - } else { |
|
215 | - parse_str( $field_values, $params ); |
|
216 | - } |
|
217 | - |
|
218 | - $url = add_query_arg( $params, $url ); |
|
219 | - } |
|
152 | + /** |
|
153 | + * Include this extension templates path |
|
154 | + * @param array $file_paths List of template paths ordered |
|
155 | + */ |
|
156 | + public function add_template_path( $file_paths ) { |
|
157 | + |
|
158 | + // Index 100 is the default GravityView template path. |
|
159 | + $file_paths[ 110 ] = self::$file; |
|
160 | + |
|
161 | + return $file_paths; |
|
162 | + } |
|
163 | + |
|
164 | + /** |
|
165 | + * |
|
166 | + * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
167 | + * |
|
168 | + * @param $view_id int GravityView view id |
|
169 | + * @param $form_id int Gravity Forms form id |
|
170 | + * @param $entry_id int Gravity Forms entry id |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
174 | + return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * The edit entry link creates a secure link with a nonce |
|
180 | + * |
|
181 | + * It also mimics the URL structure Gravity Forms expects to have so that |
|
182 | + * it formats the display of the edit form like it does in the backend, like |
|
183 | + * "You can edit this post from the post page" fields, for example. |
|
184 | + * |
|
185 | + * @param $entry array Gravity Forms entry object |
|
186 | + * @param $view_id int GravityView view id |
|
187 | + * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
188 | + * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
189 | + * @return string |
|
190 | + */ |
|
191 | + public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
192 | + |
|
193 | + $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
194 | + |
|
195 | + $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
196 | + |
|
197 | + $url = add_query_arg( array( |
|
198 | + 'edit' => wp_create_nonce( $nonce_key ) |
|
199 | + ), $base ); |
|
200 | + |
|
201 | + if( $post_id ) { |
|
202 | + $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * Allow passing params to dynamically populate entry with values |
|
207 | + * @since 1.9.2 |
|
208 | + */ |
|
209 | + if( !empty( $field_values ) ) { |
|
210 | + |
|
211 | + if( is_array( $field_values ) ) { |
|
212 | + // If already an array, no parse_str() needed |
|
213 | + $params = $field_values; |
|
214 | + } else { |
|
215 | + parse_str( $field_values, $params ); |
|
216 | + } |
|
217 | + |
|
218 | + $url = add_query_arg( $params, $url ); |
|
219 | + } |
|
220 | 220 | |
221 | 221 | /** |
222 | 222 | * @filter `gravityview/edit/link` Filter the edit URL link. |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param \GV\View $view The View. |
226 | 226 | */ |
227 | 227 | return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
228 | - } |
|
228 | + } |
|
229 | 229 | |
230 | 230 | /** |
231 | 231 | * Edit mode doesn't allow certain field types. |
@@ -280,19 +280,19 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | |
283 | - /** |
|
284 | - * checks if user has permissions to edit a specific entry |
|
285 | - * |
|
286 | - * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
287 | - * |
|
288 | - * @param array $entry Gravity Forms entry array |
|
289 | - * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
290 | - * @return bool |
|
291 | - */ |
|
292 | - public static function check_user_cap_edit_entry( $entry, $view = 0 ) { |
|
283 | + /** |
|
284 | + * checks if user has permissions to edit a specific entry |
|
285 | + * |
|
286 | + * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
287 | + * |
|
288 | + * @param array $entry Gravity Forms entry array |
|
289 | + * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
290 | + * @return bool |
|
291 | + */ |
|
292 | + public static function check_user_cap_edit_entry( $entry, $view = 0 ) { |
|
293 | 293 | |
294 | - // No permission by default |
|
295 | - $user_can_edit = false; |
|
294 | + // No permission by default |
|
295 | + $user_can_edit = false; |
|
296 | 296 | |
297 | 297 | // get user_edit setting |
298 | 298 | if ( empty( $view ) ) { |
@@ -310,60 +310,60 @@ discard block |
||
310 | 310 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
311 | 311 | } |
312 | 312 | |
313 | - // If they can edit any entries (as defined in Gravity Forms) |
|
314 | - // Or if they can edit other people's entries |
|
315 | - // Then we're good. |
|
316 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
313 | + // If they can edit any entries (as defined in Gravity Forms) |
|
314 | + // Or if they can edit other people's entries |
|
315 | + // Then we're good. |
|
316 | + if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
317 | 317 | |
318 | - gravityview()->log->debug( 'User has ability to edit all entries.' ); |
|
318 | + gravityview()->log->debug( 'User has ability to edit all entries.' ); |
|
319 | 319 | |
320 | - $user_can_edit = true; |
|
320 | + $user_can_edit = true; |
|
321 | 321 | |
322 | - } else if( !isset( $entry['created_by'] ) ) { |
|
322 | + } else if( !isset( $entry['created_by'] ) ) { |
|
323 | 323 | |
324 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
324 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
325 | 325 | |
326 | - $user_can_edit = false; |
|
326 | + $user_can_edit = false; |
|
327 | 327 | |
328 | - } else { |
|
328 | + } else { |
|
329 | 329 | |
330 | - $current_user = wp_get_current_user(); |
|
330 | + $current_user = wp_get_current_user(); |
|
331 | 331 | |
332 | - // User edit is disabled |
|
333 | - if( empty( $user_edit ) ) { |
|
332 | + // User edit is disabled |
|
333 | + if( empty( $user_edit ) ) { |
|
334 | 334 | |
335 | - gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
|
335 | + gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
|
336 | 336 | |
337 | - $user_can_edit = false; |
|
338 | - } |
|
337 | + $user_can_edit = false; |
|
338 | + } |
|
339 | 339 | |
340 | - // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
341 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
340 | + // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
341 | + else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
342 | 342 | |
343 | - gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
|
343 | + gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
|
344 | 344 | |
345 | - $user_can_edit = true; |
|
345 | + $user_can_edit = true; |
|
346 | 346 | |
347 | - } else if( ! is_user_logged_in() ) { |
|
347 | + } else if( ! is_user_logged_in() ) { |
|
348 | 348 | |
349 | - gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
|
349 | + gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
|
350 | 350 | |
351 | - $user_can_edit = false; // Here just for clarity |
|
352 | - } |
|
351 | + $user_can_edit = false; // Here just for clarity |
|
352 | + } |
|
353 | 353 | |
354 | - } |
|
354 | + } |
|
355 | 355 | |
356 | - /** |
|
357 | - * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
358 | - * @since 1.15 Added `$entry` and `$view_id` parameters |
|
359 | - * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
360 | - * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
361 | - * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
362 | - */ |
|
363 | - $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
356 | + /** |
|
357 | + * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
358 | + * @since 1.15 Added `$entry` and `$view_id` parameters |
|
359 | + * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
360 | + * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
361 | + * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
362 | + */ |
|
363 | + $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
364 | 364 | |
365 | - return (bool) $user_can_edit; |
|
366 | - } |
|
365 | + return (bool) $user_can_edit; |
|
366 | + } |
|
367 | 367 | |
368 | 368 | |
369 | 369 |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function add_downloads_data_filters() { |
68 | 68 | |
69 | - $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
|
69 | + $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
|
70 | 70 | |
71 | - if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
71 | + if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function add_admin_menu() { |
99 | 99 | |
100 | - $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
100 | + $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
101 | 101 | |
102 | 102 | $menu_text = sprintf( '<span title="%s" style="margin: 0">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text ); |
103 | 103 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | - * When on the Installer page, show a different notice than on the Settings page |
|
116 | - * |
|
115 | + * When on the Installer page, show a different notice than on the Settings page |
|
116 | + * |
|
117 | 117 | * @param array $notice |
118 | 118 | * |
119 | 119 | * @return string License notice |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | public function maybe_modify_license_notice( $notice = '' ) { |
122 | 122 | |
123 | 123 | if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) { |
124 | - return $notice; |
|
125 | - } |
|
124 | + return $notice; |
|
125 | + } |
|
126 | 126 | |
127 | - return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
127 | + return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -162,43 +162,43 @@ discard block |
||
162 | 162 | * Get downloads data from transient or from API; save transient after getting data from API |
163 | 163 | * |
164 | 164 | * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: { |
165 | - * @type array $info { |
|
166 | - * @type string $id int 17 |
|
167 | - * @type string $slug Extension slug |
|
168 | - * @type string $title Extension title |
|
169 | - * @type string $create_date in '2018-07-19 20:03:10' format |
|
170 | - * @type string $modified_date |
|
171 | - * @type string $status |
|
172 | - * @type string $link URL to public plugin page |
|
173 | - * @type string $content |
|
174 | - * @type string $excerpt |
|
175 | - * @type string $thumbnail URL to thumbnail |
|
176 | - * @type array $category Taxonomy details for the plugin's category { |
|
177 | - * @type int $term_id => int 30 |
|
178 | - * @type string $name => string 'Plugins' (length=7) |
|
179 | - * @type string $slug => string 'plugins' (length=7) |
|
180 | - * @type int $term_group => int 0 |
|
181 | - * @type int $term_taxonomy_id => int 30 |
|
182 | - * @type string $taxonomy => string 'download_category' (length=17) |
|
183 | - * @type string $description => string '' (length=0) |
|
184 | - * @type int $parent => int 0 |
|
185 | - * @type int $count => int 4 |
|
186 | - * @type string $filter => string 'raw' (length=3) |
|
187 | - * } |
|
188 | - * @type array $tags {see $category above} |
|
189 | - * @type string $textdomain string 'gravityview' (length=11) |
|
190 | - * } |
|
191 | - * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
192 | - * @type array $licensing { |
|
193 | - * @type bool $enabled Is licensing enabled for the extension |
|
194 | - * @type string $version Version number |
|
195 | - * @type string $exp_unit Expiration unit ('years') |
|
196 | - * @type string $exp_length Expiration length ('1') |
|
197 | - * } |
|
198 | - * @type array $files Array of files. Empty if user has no access to the file. { |
|
199 | - * @type string $file string URL of the file download |
|
200 | - * } |
|
201 | - * } |
|
165 | + * @type array $info { |
|
166 | + * @type string $id int 17 |
|
167 | + * @type string $slug Extension slug |
|
168 | + * @type string $title Extension title |
|
169 | + * @type string $create_date in '2018-07-19 20:03:10' format |
|
170 | + * @type string $modified_date |
|
171 | + * @type string $status |
|
172 | + * @type string $link URL to public plugin page |
|
173 | + * @type string $content |
|
174 | + * @type string $excerpt |
|
175 | + * @type string $thumbnail URL to thumbnail |
|
176 | + * @type array $category Taxonomy details for the plugin's category { |
|
177 | + * @type int $term_id => int 30 |
|
178 | + * @type string $name => string 'Plugins' (length=7) |
|
179 | + * @type string $slug => string 'plugins' (length=7) |
|
180 | + * @type int $term_group => int 0 |
|
181 | + * @type int $term_taxonomy_id => int 30 |
|
182 | + * @type string $taxonomy => string 'download_category' (length=17) |
|
183 | + * @type string $description => string '' (length=0) |
|
184 | + * @type int $parent => int 0 |
|
185 | + * @type int $count => int 4 |
|
186 | + * @type string $filter => string 'raw' (length=3) |
|
187 | + * } |
|
188 | + * @type array $tags {see $category above} |
|
189 | + * @type string $textdomain string 'gravityview' (length=11) |
|
190 | + * } |
|
191 | + * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
192 | + * @type array $licensing { |
|
193 | + * @type bool $enabled Is licensing enabled for the extension |
|
194 | + * @type string $version Version number |
|
195 | + * @type string $exp_unit Expiration unit ('years') |
|
196 | + * @type string $exp_length Expiration length ('1') |
|
197 | + * } |
|
198 | + * @type array $files Array of files. Empty if user has no access to the file. { |
|
199 | + * @type string $file string URL of the file download |
|
200 | + * } |
|
201 | + * } |
|
202 | 202 | */ |
203 | 203 | public function get_downloads_data() { |
204 | 204 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | ) ); |
231 | 231 | |
232 | 232 | if ( is_wp_error( $response ) ) { |
233 | - gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
233 | + gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
234 | 234 | return $response; |
235 | 235 | } |
236 | 236 | |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | <div class="gv-admin-installer-notice notice inline error"> |
284 | 284 | <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3> |
285 | 285 | <?php |
286 | - if ( is_wp_error( $downloads_data ) ) { |
|
287 | - echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
288 | - } |
|
289 | - ?> |
|
286 | + if ( is_wp_error( $downloads_data ) ) { |
|
287 | + echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
288 | + } |
|
289 | + ?> |
|
290 | 290 | </div> |
291 | 291 | </div> |
292 | 292 | <?php |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | protected function render_download( $download, $wp_plugins ) { |
343 | 343 | |
344 | 344 | |
345 | - $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
345 | + $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
346 | 346 | |
347 | - $download_info = $details['download_info']; |
|
347 | + $download_info = $details['download_info']; |
|
348 | 348 | |
349 | 349 | ?> |
350 | 350 | <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
@@ -366,43 +366,43 @@ discard block |
||
366 | 366 | |
367 | 367 | <div class="addon-excerpt"><?php |
368 | 368 | |
369 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
369 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
370 | 370 | |
371 | - // Allow some pure HTML tags, but remove everything else from the excerpt. |
|
372 | - $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
|
373 | - $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' ); |
|
371 | + // Allow some pure HTML tags, but remove everything else from the excerpt. |
|
372 | + $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
|
373 | + $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' ); |
|
374 | 374 | |
375 | - $excerpt = str_replace( $tags, $replacements, $excerpt ); |
|
376 | - $excerpt = esc_html( strip_tags( $excerpt ) ); |
|
375 | + $excerpt = str_replace( $tags, $replacements, $excerpt ); |
|
376 | + $excerpt = esc_html( strip_tags( $excerpt ) ); |
|
377 | 377 | $excerpt = str_replace( $replacements, $tags, $excerpt ); |
378 | 378 | |
379 | 379 | echo wpautop( $excerpt ); |
380 | - ?></div> |
|
380 | + ?></div> |
|
381 | 381 | </div> |
382 | 382 | </div> |
383 | 383 | <?php |
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
387 | - * Generates details array for the download to keep the render_download() method a bit tidier |
|
388 | - * |
|
387 | + * Generates details array for the download to keep the render_download() method a bit tidier |
|
388 | + * |
|
389 | 389 | * @param array $download Single download, as returned by {@see get_downloads_data} |
390 | 390 | * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()} |
391 | 391 | * |
392 | 392 | * @return array { |
393 | - * @type array $download_info |
|
394 | - * @type string $plugin_path |
|
395 | - * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
396 | - * @type string $status_label |
|
397 | - * @type string $button_title Title attribute to show when hovering over the download's button |
|
398 | - * @type string $button_class CSS class to use for the button |
|
399 | - * @type string $button_label Text to use for the download's anchor link |
|
400 | - * @type string $href URL for the download's button |
|
401 | - * @type bool $spinner Whether to show the spinner icon |
|
402 | - * @type string $item_class CSS class for the download container |
|
403 | - * @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions") |
|
404 | - * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
405 | - * } |
|
393 | + * @type array $download_info |
|
394 | + * @type string $plugin_path |
|
395 | + * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
396 | + * @type string $status_label |
|
397 | + * @type string $button_title Title attribute to show when hovering over the download's button |
|
398 | + * @type string $button_class CSS class to use for the button |
|
399 | + * @type string $button_label Text to use for the download's anchor link |
|
400 | + * @type string $href URL for the download's button |
|
401 | + * @type bool $spinner Whether to show the spinner icon |
|
402 | + * @type string $item_class CSS class for the download container |
|
403 | + * @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions") |
|
404 | + * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
405 | + * } |
|
406 | 406 | */ |
407 | 407 | private function get_download_display_details( $download, $wp_plugins ) { |
408 | 408 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | 'slug' => '', |
414 | 414 | 'excerpt' => '', |
415 | 415 | 'link' => '', |
416 | - 'coming_soon' => false, |
|
416 | + 'coming_soon' => false, |
|
417 | 417 | 'installer_title' => null, // May not be defined |
418 | 418 | 'installer_excerpt' => null, // May not be defined |
419 | 419 | ) ); |
@@ -456,14 +456,14 @@ discard block |
||
456 | 456 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
457 | 457 | } |
458 | 458 | |
459 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
460 | - $spinner = false; |
|
461 | - $status = 'notinstalled'; |
|
462 | - $status_label = __( 'Coming Soon', 'gravityview' ); |
|
463 | - $button_label = __( 'Learn More', 'gravityview' ); |
|
464 | - $button_class = 'button-primary button-large'; |
|
465 | - $href = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' ); |
|
466 | - } |
|
459 | + elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
460 | + $spinner = false; |
|
461 | + $status = 'notinstalled'; |
|
462 | + $status_label = __( 'Coming Soon', 'gravityview' ); |
|
463 | + $button_label = __( 'Learn More', 'gravityview' ); |
|
464 | + $button_class = 'button-primary button-large'; |
|
465 | + $href = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' ); |
|
466 | + } |
|
467 | 467 | |
468 | 468 | // Access but the plugin is not installed |
469 | 469 | elseif ( ! $wp_plugin ) { |
@@ -503,18 +503,18 @@ discard block |
||
503 | 503 | } |
504 | 504 | |
505 | 505 | return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
506 | - } |
|
506 | + } |
|
507 | 507 | |
508 | 508 | /** |
509 | - * Returns the base price for an extension |
|
510 | - * |
|
509 | + * Returns the base price for an extension |
|
510 | + * |
|
511 | 511 | * @param array $download |
512 | 512 | * |
513 | 513 | * @return float Base price for an extension. If not for sale separately, returns 0 |
514 | 514 | */ |
515 | 515 | private function get_download_base_price( $download ) { |
516 | 516 | |
517 | - $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
517 | + $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
518 | 518 | $base_price = \GFCommon::to_number( $base_price ); |
519 | 519 | |
520 | 520 | unset( $download['pricing']['amount'] ); |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | return floatval( $base_price ); |
528 | - } |
|
528 | + } |
|
529 | 529 | |
530 | 530 | /** |
531 | 531 | * Handle AJAX request to activate extension |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | |
544 | 544 | if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
545 | 545 | wp_send_json_error( array( |
546 | - 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
547 | - ) ); |
|
546 | + 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
547 | + ) ); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | wp_send_json_success(); |
@@ -565,10 +565,10 @@ discard block |
||
565 | 565 | deactivate_plugins( $data['path'] ); |
566 | 566 | |
567 | 567 | if( is_plugin_active( $data['path'] ) ) { |
568 | - wp_send_json_error( array( |
|
569 | - 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
570 | - ) ); |
|
571 | - } |
|
568 | + wp_send_json_error( array( |
|
569 | + 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
570 | + ) ); |
|
571 | + } |
|
572 | 572 | |
573 | 573 | wp_send_json_success(); |
574 | 574 | } |
@@ -39,13 +39,13 @@ |
||
39 | 39 | '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' ), |
40 | 40 | ); |
41 | 41 | |
42 | - $field_options['make_clickable'] = array( |
|
43 | - 'type' => 'checkbox', |
|
44 | - 'merge_tags' => false, |
|
45 | - 'value' => 0, |
|
46 | - 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
47 | - 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
48 | - ); |
|
42 | + $field_options['make_clickable'] = array( |
|
43 | + 'type' => 'checkbox', |
|
44 | + 'merge_tags' => false, |
|
45 | + 'value' => 0, |
|
46 | + 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
47 | + 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
48 | + ); |
|
49 | 49 | |
50 | 50 | $field_options['allow_html'] = array( |
51 | 51 | 'type' => 'checkbox', |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function add_network_menu() { |
136 | 136 | |
137 | - if ( ! gravityview()->plugin->is_network_activated() ) { |
|
137 | + if ( ! gravityview()->plugin->is_network_activated() ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
141 | + add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Uninstall all traces of GravityView |
|
146 | - * |
|
147 | - * Note: method is public because parent method is public |
|
148 | - * |
|
145 | + * Uninstall all traces of GravityView |
|
146 | + * |
|
147 | + * Note: method is public because parent method is public |
|
148 | + * |
|
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | public function uninstall() { |
152 | 152 | gravityview()->plugin->uninstall(); |
153 | 153 | |
154 | 154 | /** |
155 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | - * @see GFAddOn::uninstall_addon |
|
157 | - * @uses deactivate_plugins() |
|
158 | - */ |
|
155 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | + * @see GFAddOn::uninstall_addon |
|
157 | + * @uses deactivate_plugins() |
|
158 | + */ |
|
159 | 159 | $this->_path = GRAVITYVIEW_FILE; |
160 | 160 | |
161 | 161 | return true; |
@@ -185,42 +185,42 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | - * Get an array of reasons why the plugin might be uninstalled |
|
189 | - * |
|
190 | - * @since 1.17.5 |
|
191 | - * |
|
188 | + * Get an array of reasons why the plugin might be uninstalled |
|
189 | + * |
|
190 | + * @since 1.17.5 |
|
191 | + * |
|
192 | 192 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
193 | 193 | */ |
194 | 194 | private function get_uninstall_reasons() { |
195 | 195 | $reasons = array( |
196 | 196 | 'will-continue' => array( |
197 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | - ), |
|
197 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | + ), |
|
199 | 199 | 'no-longer-need' => array( |
200 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | - ), |
|
200 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | + ), |
|
202 | 202 | 'doesnt-work' => array( |
203 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | - ), |
|
203 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'found-other' => array( |
206 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | - ), |
|
206 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | + ), |
|
209 | 209 | 'other' => array( |
210 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | - ), |
|
210 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | shuffle( $reasons ); |
215 | 215 | |
216 | 216 | return $reasons; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | /** |
220 | - * Display a feedback form when the plugin is uninstalled |
|
221 | - * |
|
222 | - * @since 1.17.5 |
|
223 | - * |
|
220 | + * Display a feedback form when the plugin is uninstalled |
|
221 | + * |
|
222 | + * @since 1.17.5 |
|
223 | + * |
|
224 | 224 | * @return string HTML of the uninstallation form |
225 | 225 | */ |
226 | 226 | public function uninstall_form() { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
301 | 301 | <ul> |
302 | 302 | <?php |
303 | - $reasons = $this->get_uninstall_reasons(); |
|
303 | + $reasons = $this->get_uninstall_reasons(); |
|
304 | 304 | foreach ( $reasons as $reason ) { |
305 | 305 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
306 | 306 | } |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | public function app_settings_tab() { |
397 | - parent::app_settings_tab(); |
|
397 | + parent::app_settings_tab(); |
|
398 | 398 | |
399 | 399 | if ( $this->maybe_uninstall() ) { |
400 | - echo $this->uninstall_form(); |
|
400 | + echo $this->uninstall_form(); |
|
401 | 401 | } |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * The Settings title |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | type="' . $field['type'] . '" |
563 | 563 | name="' . esc_attr( $name ) . '" |
564 | 564 | value="' . $value . '" ' . |
565 | - implode( ' ', $attributes ) . |
|
566 | - ' />'; |
|
565 | + implode( ' ', $attributes ) . |
|
566 | + ' />'; |
|
567 | 567 | |
568 | 568 | if ( $echo ) { |
569 | 569 | echo $html; |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
584 | - * Check whether GravityView is being saved |
|
585 | - * |
|
586 | - * The generic is_save_postback() is true for all addons |
|
587 | - * |
|
588 | - * @since 2.0.8 |
|
589 | - * |
|
584 | + * Check whether GravityView is being saved |
|
585 | + * |
|
586 | + * The generic is_save_postback() is true for all addons |
|
587 | + * |
|
588 | + * @since 2.0.8 |
|
589 | + * |
|
590 | 590 | * @return bool |
591 | 591 | */ |
592 | 592 | public function is_save_postback() { |
@@ -600,16 +600,16 @@ discard block |
||
600 | 600 | */ |
601 | 601 | public function license_key_notice() { |
602 | 602 | |
603 | - if( $this->is_save_postback() ) { |
|
604 | - $settings = $this->get_posted_settings(); |
|
605 | - $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | - } else { |
|
608 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | - $license_key = $this->get( 'license_key' ); |
|
610 | - } |
|
603 | + if( $this->is_save_postback() ) { |
|
604 | + $settings = $this->get_posted_settings(); |
|
605 | + $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | + } else { |
|
608 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | + $license_key = $this->get( 'license_key' ); |
|
610 | + } |
|
611 | 611 | |
612 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
612 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
613 | 613 | |
614 | 614 | $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
615 | 615 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $update_below = false; |
627 | 627 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
628 | 628 | |
629 | - switch ( $license_status ) { |
|
629 | + switch ( $license_status ) { |
|
630 | 630 | /** @since 1.17 */ |
631 | 631 | case 'expired': |
632 | 632 | $title = __( 'Expired License', 'gravityview' ); |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | return; |
665 | 665 | } |
666 | 666 | |
667 | - \GravityView_Admin_Notices::add_notice( array( |
|
668 | - 'message' => $message, |
|
669 | - 'class' => 'notice notice-warning', |
|
670 | - 'title' => $title, |
|
671 | - 'cap' => 'gravityview_edit_settings', |
|
672 | - 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | - ) ); |
|
667 | + \GravityView_Admin_Notices::add_notice( array( |
|
668 | + 'message' => $message, |
|
669 | + 'class' => 'notice notice-warning', |
|
670 | + 'title' => $title, |
|
671 | + 'cap' => 'gravityview_edit_settings', |
|
672 | + 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | + ) ); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -684,12 +684,12 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
687 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | - * |
|
689 | - * @since 1.21.5 |
|
690 | - * |
|
691 | - * @see GFAddOn::scripts() |
|
692 | - * |
|
687 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | + * |
|
689 | + * @since 1.21.5 |
|
690 | + * |
|
691 | + * @see GFAddOn::scripts() |
|
692 | + * |
|
693 | 693 | * @return array Array of scripts |
694 | 694 | */ |
695 | 695 | public function scripts() { |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | $scripts[] = array( |
699 | 699 | 'handle' => 'gform_tooltip_init', |
700 | 700 | 'enqueue' => array( |
701 | - array( |
|
702 | - 'admin_page' => array( 'app_settings' ) |
|
703 | - ) |
|
704 | - ) |
|
701 | + array( |
|
702 | + 'admin_page' => array( 'app_settings' ) |
|
703 | + ) |
|
704 | + ) |
|
705 | 705 | ); |
706 | 706 | |
707 | 707 | return $scripts; |
@@ -719,10 +719,10 @@ discard block |
||
719 | 719 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
720 | 720 | 'version' => Plugin::$version, |
721 | 721 | 'deps' => array( |
722 | - 'gform_admin', |
|
722 | + 'gform_admin', |
|
723 | 723 | 'gaddon_form_settings_css', |
724 | - 'gform_tooltip', |
|
725 | - 'gform_font_awesome', |
|
724 | + 'gform_tooltip', |
|
725 | + 'gform_font_awesome', |
|
726 | 726 | ), |
727 | 727 | 'enqueue' => array( |
728 | 728 | array( 'admin_page' => array( |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | array( |
891 | 891 | 'label' => esc_html__( 'Show me beta versions if they are available.', 'gravityview' ), |
892 | 892 | 'value' => '1', |
893 | - 'name' => 'beta', |
|
893 | + 'name' => 'beta', |
|
894 | 894 | ), |
895 | 895 | ), |
896 | 896 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
@@ -928,38 +928,38 @@ discard block |
||
928 | 928 | |
929 | 929 | if ( empty( $field['disabled'] ) ) { |
930 | 930 | unset( $field['disabled'] ); |
931 | - } |
|
931 | + } |
|
932 | 932 | } |
933 | 933 | |
934 | - $sections = array( |
|
935 | - array( |
|
936 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | - 'fields' => $fields, |
|
938 | - ) |
|
939 | - ); |
|
934 | + $sections = array( |
|
935 | + array( |
|
936 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | + 'fields' => $fields, |
|
938 | + ) |
|
939 | + ); |
|
940 | 940 | |
941 | - // custom 'update settings' button |
|
942 | - $button = array( |
|
943 | - 'class' => 'button button-primary button-hero', |
|
944 | - 'type' => 'save', |
|
945 | - ); |
|
941 | + // custom 'update settings' button |
|
942 | + $button = array( |
|
943 | + 'class' => 'button button-primary button-hero', |
|
944 | + 'type' => 'save', |
|
945 | + ); |
|
946 | 946 | |
947 | 947 | if ( $disabled_attribute ) { |
948 | 948 | $button['disabled'] = $disabled_attribute; |
949 | 949 | } |
950 | 950 | |
951 | - /** |
|
952 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | - * Extensions can tap in here to insert their own section and settings. |
|
954 | - * <code> |
|
955 | - * $sections[] = array( |
|
956 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | - * 'fields' => $settings, |
|
958 | - * ); |
|
959 | - * </code> |
|
960 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | - */ |
|
962 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
951 | + /** |
|
952 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | + * Extensions can tap in here to insert their own section and settings. |
|
954 | + * <code> |
|
955 | + * $sections[] = array( |
|
956 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | + * 'fields' => $settings, |
|
958 | + * ); |
|
959 | + * </code> |
|
960 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | + */ |
|
962 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
963 | 963 | |
964 | 964 | // If there are extensions, add a section for them |
965 | 965 | if ( ! empty( $extension_sections ) ) { |
@@ -972,13 +972,13 @@ discard block |
||
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | - $k = count( $extension_sections ) - 1 ; |
|
976 | - $extension_sections[ $k ]['fields'][] = $button; |
|
975 | + $k = count( $extension_sections ) - 1 ; |
|
976 | + $extension_sections[ $k ]['fields'][] = $button; |
|
977 | 977 | $sections = array_merge( $sections, $extension_sections ); |
978 | 978 | } else { |
979 | - // add the 'update settings' button to the general section |
|
980 | - $sections[0]['fields'][] = $button; |
|
981 | - } |
|
979 | + // add the 'update settings' button to the general section |
|
980 | + $sections[0]['fields'][] = $button; |
|
981 | + } |
|
982 | 982 | |
983 | 983 | return $sections; |
984 | 984 | } |
@@ -1032,9 +1032,9 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | protected function settings_edd_license( $field, $echo = true ) { |
1034 | 1034 | |
1035 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | - $field['input_type'] = 'password'; |
|
1037 | - } |
|
1035 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | + $field['input_type'] = 'password'; |
|
1037 | + } |
|
1038 | 1038 | |
1039 | 1039 | $text = $this->settings_text( $field, false ); |
1040 | 1040 | |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * Allow pure HTML settings row |
1054 | - * |
|
1055 | - * @since 2.0.6 |
|
1056 | - * |
|
1054 | + * |
|
1055 | + * @since 2.0.6 |
|
1056 | + * |
|
1057 | 1057 | * @param array $field |
1058 | 1058 | * @param bool $echo Whether to echo the |
1059 | 1059 | * |
@@ -1119,19 +1119,19 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | /** |
1122 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | - * |
|
1124 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | - * |
|
1127 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | - * |
|
1130 | - * @since 1.21.5.2 |
|
1131 | - * |
|
1122 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | + * |
|
1124 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | + * |
|
1127 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | + * |
|
1130 | + * @since 1.21.5.2 |
|
1131 | + * |
|
1132 | 1132 | * @param array $field |
1133 | - * |
|
1134 | - * @return void |
|
1133 | + * |
|
1134 | + * @return void |
|
1135 | 1135 | */ |
1136 | 1136 | public function single_setting_row( $field ) { |
1137 | 1137 | $field['gv_description'] = Utils::get( $field, 'description' ); |
@@ -318,12 +318,12 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
321 | - * @hack |
|
322 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
323 | - */ |
|
321 | + * @hack |
|
322 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
323 | + */ |
|
324 | 324 | if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
325 | - continue; |
|
326 | - } |
|
325 | + continue; |
|
326 | + } |
|
327 | 327 | $fields["{$input['id']}"] = array( |
328 | 328 | 'label' => \GV\Utils::get( $input, 'label' ), |
329 | 329 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | ), |
1421 | 1421 | ); |
1422 | 1422 | |
1423 | - $fields = $date_created + $fields; |
|
1423 | + $fields = $date_created + $fields; |
|
1424 | 1424 | |
1425 | 1425 | // Are there custom content fields? |
1426 | 1426 | if ( is_admin() ) { |
@@ -1459,13 +1459,13 @@ discard block |
||
1459 | 1459 | |
1460 | 1460 | } |
1461 | 1461 | |
1462 | - /** |
|
1463 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1464 | - * @since 1.12 |
|
1465 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
1466 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
1467 | - */ |
|
1468 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1462 | + /** |
|
1463 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1464 | + * @since 1.12 |
|
1465 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
1466 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
1467 | + */ |
|
1468 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1469 | 1469 | |
1470 | 1470 | return $fields; |
1471 | 1471 | } |
@@ -1757,26 +1757,26 @@ discard block |
||
1757 | 1757 | } |
1758 | 1758 | |
1759 | 1759 | |
1760 | - /** |
|
1761 | - * Display updated/error notice |
|
1762 | - * |
|
1763 | - * @since 1.19.2 Added $cap and $object_id parameters |
|
1764 | - * |
|
1765 | - * @param string $notice text/HTML of notice |
|
1766 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
1767 | - * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1768 | - * |
|
1769 | - * @return string |
|
1770 | - */ |
|
1771 | - public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1772 | - |
|
1773 | - // If $cap is defined, only show notice if user has capability |
|
1774 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1775 | - return ''; |
|
1776 | - } |
|
1777 | - |
|
1778 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1779 | - } |
|
1760 | + /** |
|
1761 | + * Display updated/error notice |
|
1762 | + * |
|
1763 | + * @since 1.19.2 Added $cap and $object_id parameters |
|
1764 | + * |
|
1765 | + * @param string $notice text/HTML of notice |
|
1766 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
1767 | + * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1768 | + * |
|
1769 | + * @return string |
|
1770 | + */ |
|
1771 | + public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1772 | + |
|
1773 | + // If $cap is defined, only show notice if user has capability |
|
1774 | + if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1775 | + return ''; |
|
1776 | + } |
|
1777 | + |
|
1778 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1779 | + } |
|
1780 | 1780 | |
1781 | 1781 | /** |
1782 | 1782 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
22 | - * Constructor. Add filters to modify output. |
|
23 | - * |
|
22 | + * Constructor. Add filters to modify output. |
|
23 | + * |
|
24 | 24 | * @since 2.0.4 |
25 | 25 | * |
26 | 26 | * @param View $view |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct( View $view, Entry_Collection $entries, Request $request ) { |
31 | 31 | |
32 | - add_filter( 'gravityview/template/field/label', array( __CLASS__, 'add_columns_sort_links' ), 100, 2 ); |
|
32 | + add_filter( 'gravityview/template/field/label', array( __CLASS__, 'add_columns_sort_links' ), 100, 2 ); |
|
33 | 33 | |
34 | 34 | parent::__construct( $view, $entries, $request ); |
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | - * Add sorting links to HTML columns that support sorting |
|
39 | - * |
|
40 | - * @since 2.0.4 |
|
41 | - * @since 2.0.5 Made static |
|
42 | - * |
|
43 | - * @static |
|
44 | - * |
|
38 | + * Add sorting links to HTML columns that support sorting |
|
39 | + * |
|
40 | + * @since 2.0.4 |
|
41 | + * @since 2.0.5 Made static |
|
42 | + * |
|
43 | + * @static |
|
44 | + * |
|
45 | 45 | * @param string $column_label Label for the table column |
46 | 46 | * @param \GV\Template_Context $context |
47 | 47 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $sort_columns = $context->view->settings->get( 'sort_columns' ); |
53 | 53 | |
54 | 54 | if ( empty( $sort_columns ) ) { |
55 | - return $column_label; |
|
55 | + return $column_label; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | if ( 'custom' === $context->field->type ) { |
@@ -111,22 +111,22 @@ discard block |
||
111 | 111 | // If we are already sorting by the current field... |
112 | 112 | if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
113 | 113 | |
114 | - switch( $sorting['direction'] ) { |
|
115 | - // No sort |
|
116 | - case '': |
|
117 | - $sort_args[1] = 'asc'; |
|
118 | - $class .= ' gv-icon-caret-up-down'; |
|
119 | - break; |
|
120 | - case 'desc': |
|
121 | - $sort_args[1] = ''; |
|
122 | - $class .= ' gv-icon-sort-asc'; |
|
123 | - break; |
|
124 | - case 'asc': |
|
125 | - default: |
|
126 | - $sort_args[1] = 'desc'; |
|
127 | - $class .= ' gv-icon-sort-desc'; |
|
128 | - break; |
|
129 | - } |
|
114 | + switch( $sorting['direction'] ) { |
|
115 | + // No sort |
|
116 | + case '': |
|
117 | + $sort_args[1] = 'asc'; |
|
118 | + $class .= ' gv-icon-caret-up-down'; |
|
119 | + break; |
|
120 | + case 'desc': |
|
121 | + $sort_args[1] = ''; |
|
122 | + $class .= ' gv-icon-sort-asc'; |
|
123 | + break; |
|
124 | + case 'asc': |
|
125 | + default: |
|
126 | + $sort_args[1] = 'desc'; |
|
127 | + $class .= ' gv-icon-sort-desc'; |
|
128 | + break; |
|
129 | + } |
|
130 | 130 | |
131 | 131 | } else { |
132 | 132 | $class .= ' gv-icon-caret-up-down'; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $url = remove_query_arg( 'sort', $url ); |
137 | 137 | $multisort_url = self::_get_multisort_url( $url, $sort_args, $context->field ); |
138 | 138 | |
139 | - $url = add_query_arg( $sort_args[0], $sort_args[1], $url ); |
|
139 | + $url = add_query_arg( $sort_args[0], $sort_args[1], $url ); |
|
140 | 140 | |
141 | 141 | $return = '<a href="'. esc_url_raw( $url ) .'"'; |
142 | 142 | |
@@ -150,28 +150,28 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
153 | - * Get the multi-sort URL used in the sorting links |
|
154 | - * |
|
155 | - * @todo Consider moving to Utils? |
|
156 | - * |
|
157 | - * @since 2.3 |
|
158 | - * |
|
159 | - * @see add_columns_sort_links |
|
153 | + * Get the multi-sort URL used in the sorting links |
|
154 | + * |
|
155 | + * @todo Consider moving to Utils? |
|
156 | + * |
|
157 | + * @since 2.3 |
|
158 | + * |
|
159 | + * @see add_columns_sort_links |
|
160 | 160 | * @param string $url Single-sort URL |
161 | 161 | * @param array $sort_args Single sorting for rules, in [ field_id, dir ] format |
162 | - * @param \GV\Field $field The current field |
|
163 | - * |
|
164 | - * @return string Multisort URL, if there are multiple sorts. Otherwise, existing $url |
|
162 | + * @param \GV\Field $field The current field |
|
163 | + * |
|
164 | + * @return string Multisort URL, if there are multiple sorts. Otherwise, existing $url |
|
165 | 165 | */ |
166 | 166 | static public function _get_multisort_url( $url, $sort_args, $field ) { |
167 | 167 | |
168 | 168 | $sorts = Utils::_GET( 'sort' ); |
169 | 169 | |
170 | 170 | if ( ! is_array( $sorts ) ) { |
171 | - return $url; |
|
171 | + return $url; |
|
172 | 172 | } |
173 | 173 | |
174 | - $multisort_url = $url; |
|
174 | + $multisort_url = $url; |
|
175 | 175 | |
176 | 176 | if ( ! $field ) { |
177 | 177 | return $url; |
@@ -184,26 +184,26 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | // If the field has already been sorted by, add the field to the URL |
187 | - if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
|
188 | - if ( count( $keys ) ) { |
|
189 | - $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
|
190 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
191 | - } else { |
|
192 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
193 | - } |
|
194 | - } |
|
195 | - // Otherwise, we are just updating the sort order |
|
196 | - else { |
|
197 | - |
|
198 | - // Pass empty value to unset |
|
199 | - if( '' === $sort_args[1] ) { |
|
200 | - unset( $sorts[ $field_id ] ); |
|
201 | - } else { |
|
202 | - $sorts[ $field_id ] = $sort_args[1]; |
|
203 | - } |
|
204 | - |
|
205 | - $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
|
206 | - } |
|
187 | + if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
|
188 | + if ( count( $keys ) ) { |
|
189 | + $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
|
190 | + $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
191 | + } else { |
|
192 | + $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
193 | + } |
|
194 | + } |
|
195 | + // Otherwise, we are just updating the sort order |
|
196 | + else { |
|
197 | + |
|
198 | + // Pass empty value to unset |
|
199 | + if( '' === $sort_args[1] ) { |
|
200 | + unset( $sorts[ $field_id ] ); |
|
201 | + } else { |
|
202 | + $sorts[ $field_id ] = $sort_args[1]; |
|
203 | + } |
|
204 | + |
|
205 | + $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
|
206 | + } |
|
207 | 207 | |
208 | 208 | return $multisort_url; |
209 | 209 | } |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
236 | - * Returns the label for a column, with support for all deprecated filters |
|
237 | - * |
|
238 | - * @since 2.1 |
|
239 | - * |
|
236 | + * Returns the label for a column, with support for all deprecated filters |
|
237 | + * |
|
238 | + * @since 2.1 |
|
239 | + * |
|
240 | 240 | * @param \GV\Field $field |
241 | 241 | * @param \GV\Template_Context $context |
242 | 242 | */ |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $column_label = apply_filters( 'gravityview/template/field/label', $column_label, $context ); |
260 | 260 | |
261 | 261 | return $column_label; |
262 | - } |
|
262 | + } |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Output the entry row. |
@@ -328,15 +328,15 @@ discard block |
||
328 | 328 | */ |
329 | 329 | do_action( 'gravityview/template/table/cells/before', $context ); |
330 | 330 | |
331 | - /** |
|
332 | - * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
333 | - * @since 1.0.7 |
|
331 | + /** |
|
332 | + * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
333 | + * @since 1.0.7 |
|
334 | 334 | * @param \GravityView_View $this Current GravityView_View object |
335 | 335 | * @deprecated Use `gravityview/template/table/cells/before` |
336 | - */ |
|
337 | - do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
336 | + */ |
|
337 | + do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
338 | 338 | |
339 | - foreach ( $fields->all() as $field ) { |
|
339 | + foreach ( $fields->all() as $field ) { |
|
340 | 340 | if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) { |
341 | 341 | if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) { |
342 | 342 | $field = $this->view->unions[ $entry['form_id'] ][ $field->ID ]; |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | */ |
357 | 357 | do_action( 'gravityview/template/table/cells/after', $context ); |
358 | 358 | |
359 | - /** |
|
360 | - * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
361 | - * @since 1.0.7 |
|
359 | + /** |
|
360 | + * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
361 | + * @since 1.0.7 |
|
362 | 362 | * @param \GravityView_View $this Current GravityView_View object |
363 | 363 | * @deprecated Use `gravityview/template/table/cells/after` |
364 | - */ |
|
365 | - do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
364 | + */ |
|
365 | + do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
366 | 366 | |
367 | 367 | ?> |
368 | 368 | </tr> |
@@ -410,9 +410,9 @@ discard block |
||
410 | 410 | 'value' => $value, |
411 | 411 | 'hide_empty' => false, |
412 | 412 | 'zone_id' => 'directory_table-columns', |
413 | - 'label' => self::get_field_column_label( $field, $context ), |
|
413 | + 'label' => self::get_field_column_label( $field, $context ), |
|
414 | 414 | 'markup' => '<td id="{{ field_id }}" class="{{ class }}" data-label="{{label_value:data-label}}">{{ value }}</td>', |
415 | - 'form' => $form, |
|
415 | + 'form' => $form, |
|
416 | 416 | ); |
417 | 417 | |
418 | 418 | /** Output. */ |
@@ -437,11 +437,11 @@ discard block |
||
437 | 437 | do_action( 'gravityview/template/table/body/before', $context ); |
438 | 438 | |
439 | 439 | /** |
440 | - * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
441 | - * @deprecated Use `gravityview/template/table/body/before` |
|
442 | - * @since 1.0.7 |
|
443 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
444 | - */ |
|
440 | + * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
441 | + * @deprecated Use `gravityview/template/table/body/before` |
|
442 | + * @since 1.0.7 |
|
443 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
444 | + */ |
|
445 | 445 | do_action( 'gravityview_table_body_before', \GravityView_View::getInstance() /** ugh! */ ); |
446 | 446 | } |
447 | 447 | |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | do_action( 'gravityview/template/table/body/after', $context ); |
464 | 464 | |
465 | 465 | /** |
466 | - * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
467 | - * @deprecated Use `gravityview/template/table/body/after` |
|
468 | - * @since 1.0.7 |
|
469 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
470 | - */ |
|
466 | + * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
467 | + * @deprecated Use `gravityview/template/table/body/after` |
|
468 | + * @since 1.0.7 |
|
469 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
470 | + */ |
|
471 | 471 | do_action( 'gravityview_table_body_after', \GravityView_View::getInstance() /** ugh! */ ); |
472 | 472 | } |
473 | 473 |