@@ -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 ( 'custom' === $field->type ) { |
177 | 177 | $field_id = 'custom_' . $field->UID; |
@@ -180,26 +180,26 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | // If the field has already been sorted by, add the field to the URL |
183 | - if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
|
184 | - if ( count( $keys ) ) { |
|
185 | - $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
|
186 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
187 | - } else { |
|
188 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
189 | - } |
|
190 | - } |
|
191 | - // Otherwise, we are just updating the sort order |
|
192 | - else { |
|
193 | - |
|
194 | - // Pass empty value to unset |
|
195 | - if( '' === $sort_args[1] ) { |
|
196 | - unset( $sorts[ $field_id ] ); |
|
197 | - } else { |
|
198 | - $sorts[ $field_id ] = $sort_args[1]; |
|
199 | - } |
|
200 | - |
|
201 | - $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
|
202 | - } |
|
183 | + if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
|
184 | + if ( count( $keys ) ) { |
|
185 | + $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
|
186 | + $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
187 | + } else { |
|
188 | + $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
189 | + } |
|
190 | + } |
|
191 | + // Otherwise, we are just updating the sort order |
|
192 | + else { |
|
193 | + |
|
194 | + // Pass empty value to unset |
|
195 | + if( '' === $sort_args[1] ) { |
|
196 | + unset( $sorts[ $field_id ] ); |
|
197 | + } else { |
|
198 | + $sorts[ $field_id ] = $sort_args[1]; |
|
199 | + } |
|
200 | + |
|
201 | + $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
|
202 | + } |
|
203 | 203 | |
204 | 204 | return $multisort_url; |
205 | 205 | } |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
232 | - * Returns the label for a column, with support for all deprecated filters |
|
233 | - * |
|
234 | - * @since 2.1 |
|
235 | - * |
|
232 | + * Returns the label for a column, with support for all deprecated filters |
|
233 | + * |
|
234 | + * @since 2.1 |
|
235 | + * |
|
236 | 236 | * @param \GV\Field $field |
237 | 237 | * @param \GV\Template_Context $context |
238 | 238 | */ |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $column_label = apply_filters( 'gravityview/template/field/label', $column_label, $context ); |
256 | 256 | |
257 | 257 | return $column_label; |
258 | - } |
|
258 | + } |
|
259 | 259 | |
260 | 260 | /** |
261 | 261 | * Output the entry row. |
@@ -324,15 +324,15 @@ discard block |
||
324 | 324 | */ |
325 | 325 | do_action( 'gravityview/template/table/cells/before', $context ); |
326 | 326 | |
327 | - /** |
|
328 | - * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
329 | - * @since 1.0.7 |
|
327 | + /** |
|
328 | + * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
329 | + * @since 1.0.7 |
|
330 | 330 | * @param \GravityView_View $this Current GravityView_View object |
331 | 331 | * @deprecated Use `gravityview/template/table/cells/before` |
332 | - */ |
|
333 | - do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
332 | + */ |
|
333 | + do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
334 | 334 | |
335 | - foreach ( $fields->all() as $field ) { |
|
335 | + foreach ( $fields->all() as $field ) { |
|
336 | 336 | if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) { |
337 | 337 | if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) { |
338 | 338 | $field = $this->view->unions[ $entry['form_id'] ][ $field->ID ]; |
@@ -352,13 +352,13 @@ discard block |
||
352 | 352 | */ |
353 | 353 | do_action( 'gravityview/template/table/cells/after', $context ); |
354 | 354 | |
355 | - /** |
|
356 | - * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
357 | - * @since 1.0.7 |
|
355 | + /** |
|
356 | + * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
357 | + * @since 1.0.7 |
|
358 | 358 | * @param \GravityView_View $this Current GravityView_View object |
359 | 359 | * @deprecated Use `gravityview/template/table/cells/after` |
360 | - */ |
|
361 | - do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
360 | + */ |
|
361 | + do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
362 | 362 | |
363 | 363 | ?> |
364 | 364 | </tr> |
@@ -406,9 +406,9 @@ discard block |
||
406 | 406 | 'value' => $value, |
407 | 407 | 'hide_empty' => false, |
408 | 408 | 'zone_id' => 'directory_table-columns', |
409 | - 'label' => self::get_field_column_label( $field, $context ), |
|
409 | + 'label' => self::get_field_column_label( $field, $context ), |
|
410 | 410 | 'markup' => '<td id="{{ field_id }}" class="{{ class }}" data-label="{{label_value:data-label}}">{{ value }}</td>', |
411 | - 'form' => $form, |
|
411 | + 'form' => $form, |
|
412 | 412 | ); |
413 | 413 | |
414 | 414 | /** Output. */ |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | do_action( 'gravityview/template/table/body/before', $context ); |
434 | 434 | |
435 | 435 | /** |
436 | - * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
437 | - * @deprecated Use `gravityview/template/table/body/before` |
|
438 | - * @since 1.0.7 |
|
439 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
440 | - */ |
|
436 | + * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
437 | + * @deprecated Use `gravityview/template/table/body/before` |
|
438 | + * @since 1.0.7 |
|
439 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
440 | + */ |
|
441 | 441 | do_action( 'gravityview_table_body_before', \GravityView_View::getInstance() /** ugh! */ ); |
442 | 442 | } |
443 | 443 | |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | do_action( 'gravityview/template/table/body/after', $context ); |
460 | 460 | |
461 | 461 | /** |
462 | - * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
463 | - * @deprecated Use `gravityview/template/table/body/after` |
|
464 | - * @since 1.0.7 |
|
465 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
466 | - */ |
|
462 | + * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
463 | + * @deprecated Use `gravityview/template/table/body/after` |
|
464 | + * @since 1.0.7 |
|
465 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
466 | + */ |
|
467 | 467 | do_action( 'gravityview_table_body_after', \GravityView_View::getInstance() /** ugh! */ ); |
468 | 468 | } |
469 | 469 |