@@ -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 |