@@ -276,19 +276,19 @@ discard block |
||
276 | 276 | |
277 | 277 | if ( ! empty( $view_id ) ) { |
278 | 278 | |
279 | - $this->context_view_id = (int) $view_id; |
|
279 | + $this->context_view_id = (int)$view_id; |
|
280 | 280 | |
281 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
281 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
282 | 282 | /** |
283 | 283 | * used on a has_multiple_views context |
284 | 284 | * |
285 | 285 | * @see GravityView_API::entry_link |
286 | 286 | */ |
287 | - $this->context_view_id = (int) $_GET['gvid']; |
|
287 | + $this->context_view_id = (int)$_GET[ 'gvid' ]; |
|
288 | 288 | |
289 | 289 | } elseif ( ! $multiple_views ) { |
290 | 290 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
291 | - $this->context_view_id = (int) array_pop( $array_keys ); |
|
291 | + $this->context_view_id = (int)array_pop( $array_keys ); |
|
292 | 292 | unset( $array_keys ); |
293 | 293 | } |
294 | 294 | |
@@ -330,16 +330,16 @@ discard block |
||
330 | 330 | $_query = wp_parse_args( $query->query ); |
331 | 331 | |
332 | 332 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
333 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
334 | - unset( $_query['pagename'] ); |
|
333 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
334 | + unset( $_query[ 'pagename' ] ); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // this is where will break from core WordPress |
338 | 338 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
339 | 339 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
340 | 340 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
341 | - foreach ( (array) $endpoints as $endpoint ) { |
|
342 | - $ignore[] = $endpoint[1]; |
|
341 | + foreach ( (array)$endpoints as $endpoint ) { |
|
342 | + $ignore[ ] = $endpoint[ 1 ]; |
|
343 | 343 | } |
344 | 344 | unset( $endpoints ); |
345 | 345 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
350 | 350 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
351 | 351 | |
352 | - $qv =& $query->query_vars; |
|
352 | + $qv = & $query->query_vars; |
|
353 | 353 | |
354 | 354 | // Prevent redirect when on the single entry endpoint |
355 | 355 | if ( self::is_single_entry() ) { |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | |
359 | 359 | $query->is_page = true; |
360 | 360 | $query->is_home = false; |
361 | - $qv['page_id'] = $front_page_id; |
|
361 | + $qv[ 'page_id' ] = $front_page_id; |
|
362 | 362 | |
363 | 363 | // Correct <!--nextpage--> for page_on_front |
364 | - if ( ! empty( $qv['paged'] ) ) { |
|
365 | - $qv['page'] = $qv['paged']; |
|
366 | - unset( $qv['paged'] ); |
|
364 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
365 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
366 | + unset( $qv[ 'paged' ] ); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | $blocks = parse_blocks( $post_content ); |
427 | 427 | |
428 | 428 | foreach ( $blocks as $block ) { |
429 | - if ( empty( $block['attrs']['ref'] ) ) { |
|
429 | + if ( empty( $block[ 'attrs' ][ 'ref' ] ) ) { |
|
430 | 430 | continue; |
431 | 431 | } |
432 | 432 | |
433 | - $block_post = get_post( $block['attrs']['ref'] ); |
|
433 | + $block_post = get_post( $block[ 'attrs' ][ 'ref' ] ); |
|
434 | 434 | |
435 | 435 | if ( $block_post ) { |
436 | 436 | $post_content .= $block_post->post_content; |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | |
560 | 560 | // Don't modify the title for anything other than the current view/post. |
561 | 561 | // This is true for embedded shortcodes and Views. |
562 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
562 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
563 | 563 | return $passed_title; |
564 | 564 | } |
565 | 565 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | |
634 | 634 | $title = $view->settings->get( 'single_title', $passed_title ); |
635 | 635 | |
636 | - $form = GVCommon::get_form( $entry['form_id'] ); |
|
636 | + $form = GVCommon::get_form( $entry[ 'form_id' ] ); |
|
637 | 637 | |
638 | 638 | // We are allowing HTML in the fields, so no escaping the output |
639 | 639 | $title = GravityView_API::replace_variables( $title, $form, $entry ); |
@@ -855,9 +855,9 @@ discard block |
||
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
858 | - if ( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
858 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
859 | 859 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
860 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
860 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
861 | 861 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
862 | 862 | } |
863 | 863 | } |
@@ -876,19 +876,19 @@ discard block |
||
876 | 876 | public static function process_search_only_approved( $args, $search_criteria ) { |
877 | 877 | |
878 | 878 | /** @since 1.19 */ |
879 | - if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
879 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
880 | 880 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
881 | 881 | return $search_criteria; |
882 | 882 | } |
883 | 883 | |
884 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
884 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
885 | 885 | |
886 | - $search_criteria['field_filters'][] = array( |
|
886 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
887 | 887 | 'key' => GravityView_Entry_Approval::meta_key, |
888 | 888 | 'value' => GravityView_Entry_Approval_Status::APPROVED, |
889 | 889 | ); |
890 | 890 | |
891 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
891 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
892 | 892 | |
893 | 893 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
894 | 894 | } |
@@ -915,18 +915,18 @@ discard block |
||
915 | 915 | */ |
916 | 916 | public static function is_entry_approved( $entry, $args = array() ) { |
917 | 917 | |
918 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
918 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
919 | 919 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
920 | 920 | return true; |
921 | 921 | } |
922 | 922 | |
923 | 923 | /** @since 1.19 */ |
924 | - if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
924 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
925 | 925 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
926 | 926 | return true; |
927 | 927 | } |
928 | 928 | |
929 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
929 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
930 | 930 | |
931 | 931 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
932 | 932 | } |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
951 | 951 | */ |
952 | 952 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
953 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
953 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
954 | 954 | |
955 | 955 | /** |
956 | 956 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -970,19 +970,19 @@ discard block |
||
970 | 970 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' => $search_criteria ) ); |
971 | 971 | |
972 | 972 | // implicity search |
973 | - if ( ! empty( $args['search_value'] ) ) { |
|
973 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
974 | 974 | |
975 | 975 | // Search operator options. Options: `is` or `contains` |
976 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
976 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
977 | 977 | |
978 | - $search_criteria['field_filters'][] = array( |
|
978 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
979 | 979 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
980 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
980 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
981 | 981 | 'operator' => $operator, |
982 | 982 | ); |
983 | 983 | |
984 | 984 | // Lock search mode to "all" with implicit presearch filter. |
985 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
985 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
986 | 986 | } |
987 | 987 | |
988 | 988 | if ( $search_criteria !== $original_search_criteria ) { |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1004 | 1004 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1005 | 1005 | */ |
1006 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1006 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1007 | 1007 | |
1008 | 1008 | return $search_criteria; |
1009 | 1009 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | 'search_criteria' => $search_criteria, |
1120 | 1120 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1121 | 1121 | 'paging' => $paging, |
1122 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1122 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1123 | 1123 | ); |
1124 | 1124 | |
1125 | 1125 | /** |
@@ -1169,17 +1169,17 @@ discard block |
||
1169 | 1169 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1170 | 1170 | |
1171 | 1171 | // Paging & offset |
1172 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1172 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1173 | 1173 | |
1174 | 1174 | if ( -1 === $page_size ) { |
1175 | 1175 | $page_size = PHP_INT_MAX; |
1176 | 1176 | } |
1177 | 1177 | |
1178 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1178 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1179 | 1179 | $offset = ( $curr_page - 1 ) * $page_size; |
1180 | 1180 | |
1181 | - if ( ! empty( $args['offset'] ) ) { |
|
1182 | - $offset += intval( $args['offset'] ); |
|
1181 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1182 | + $offset += intval( $args[ 'offset' ] ); |
|
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | $paging = array( |
@@ -1204,11 +1204,11 @@ discard block |
||
1204 | 1204 | public static function updateViewSorting( $args, $form_id ) { |
1205 | 1205 | $sorting = array(); |
1206 | 1206 | |
1207 | - $has_values = isset( $_GET['sort'] ); |
|
1207 | + $has_values = isset( $_GET[ 'sort' ] ); |
|
1208 | 1208 | |
1209 | - if ( $has_values && is_array( $_GET['sort'] ) ) { |
|
1210 | - $sorts = array_keys( $_GET['sort'] ); |
|
1211 | - $dirs = array_values( $_GET['sort'] ); |
|
1209 | + if ( $has_values && is_array( $_GET[ 'sort' ] ) ) { |
|
1210 | + $sorts = array_keys( $_GET[ 'sort' ] ); |
|
1211 | + $dirs = array_values( $_GET[ 'sort' ] ); |
|
1212 | 1212 | |
1213 | 1213 | if ( $has_values = array_filter( $dirs ) ) { |
1214 | 1214 | $sort_field_id = end( $sorts ); |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | if ( ! isset( $sort_field_id ) ) { |
1220 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
1220 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | if ( ! isset( $sort_direction ) ) { |
1224 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1224 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | if ( is_array( $sort_field_id ) ) { |
@@ -1253,10 +1253,10 @@ discard block |
||
1253 | 1253 | $form = GFAPI::get_form( $form_id ); |
1254 | 1254 | |
1255 | 1255 | // Get the first GF_Field field ID, set as the key for entry randomization |
1256 | - if ( ! empty( $form['fields'] ) ) { |
|
1256 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
1257 | 1257 | |
1258 | 1258 | /** @var GF_Field $field */ |
1259 | - foreach ( $form['fields'] as $field ) { |
|
1259 | + foreach ( $form[ 'fields' ] as $field ) { |
|
1260 | 1260 | if ( ! is_a( $field, 'GF_Field' ) ) { |
1261 | 1261 | continue; |
1262 | 1262 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | if ( is_array( $sort_field_id ) ) { |
1306 | 1306 | $modified_ids = array(); |
1307 | 1307 | foreach ( $sort_field_id as $_sort_field_id ) { |
1308 | - $modified_ids [] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1308 | + $modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1309 | 1309 | } |
1310 | 1310 | return $modified_ids; |
1311 | 1311 | } |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | return $sort_field_id; |
1319 | 1319 | } |
1320 | 1320 | |
1321 | - switch ( $sort_field['type'] ) { |
|
1321 | + switch ( $sort_field[ 'type' ] ) { |
|
1322 | 1322 | |
1323 | 1323 | case 'address': |
1324 | 1324 | // Sorting by full address |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | $views = $this->getGvOutputData()->get_views(); |
1446 | 1446 | |
1447 | 1447 | foreach ( $views as $view_id => $data ) { |
1448 | - $view = \GV\View::by_id( $data['id'] ); |
|
1448 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
1449 | 1449 | $view_id = $view->ID; |
1450 | 1450 | $template_id = gravityview_get_template_id( $view->ID ); |
1451 | 1451 | $data = $view->as_data(); |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | * @param \GV\View The View. |
1476 | 1476 | */ |
1477 | 1477 | $js_dependency = apply_filters( 'gravityview_lightbox_script', $js_dependency, $view ); |
1478 | - $js_dependencies[] = $js_dependency; |
|
1478 | + $js_dependencies[ ] = $js_dependency; |
|
1479 | 1479 | |
1480 | 1480 | /** |
1481 | 1481 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
@@ -1491,7 +1491,7 @@ discard block |
||
1491 | 1491 | * @param \GV\View The View. |
1492 | 1492 | */ |
1493 | 1493 | $css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view ); |
1494 | - $css_dependencies[] = $css_dependency; |
|
1494 | + $css_dependencies[ ] = $css_dependency; |
|
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | /** |
@@ -1500,8 +1500,8 @@ discard block |
||
1500 | 1500 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1501 | 1501 | * @since 1.15 |
1502 | 1502 | */ |
1503 | - if ( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1504 | - $css_dependencies[] = 'dashicons'; |
|
1503 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1504 | + $css_dependencies[ ] = 'dashicons'; |
|
1505 | 1505 | } |
1506 | 1506 | |
1507 | 1507 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GV_PLUGIN_VERSION, true ); |
@@ -1512,7 +1512,7 @@ discard block |
||
1512 | 1512 | |
1513 | 1513 | wp_enqueue_script( 'gravityview-fe-view' ); |
1514 | 1514 | |
1515 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1515 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1516 | 1516 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GV_PLUGIN_VERSION, 'all' ); |
1517 | 1517 | } |
1518 | 1518 | |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | return $label; |
1614 | 1614 | } |
1615 | 1615 | |
1616 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1616 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1617 | 1617 | return $label; |
1618 | 1618 | } |
1619 | 1619 | |
@@ -1621,20 +1621,20 @@ discard block |
||
1621 | 1621 | |
1622 | 1622 | $class = 'gv-sort'; |
1623 | 1623 | |
1624 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1624 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1625 | 1625 | |
1626 | 1626 | $sort_args = array( |
1627 | - 'sort' => $field['id'], |
|
1627 | + 'sort' => $field[ 'id' ], |
|
1628 | 1628 | 'dir' => 'asc', |
1629 | 1629 | ); |
1630 | 1630 | |
1631 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1631 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1632 | 1632 | // toggle sorting direction. |
1633 | - if ( 'asc' === $sorting['direction'] ) { |
|
1634 | - $sort_args['dir'] = 'desc'; |
|
1633 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1634 | + $sort_args[ 'dir' ] = 'desc'; |
|
1635 | 1635 | $class .= ' gv-icon-sort-desc'; |
1636 | 1636 | } else { |
1637 | - $sort_args['dir'] = 'asc'; |
|
1637 | + $sort_args[ 'dir' ] = 'asc'; |
|
1638 | 1638 | $class .= ' gv-icon-sort-asc'; |
1639 | 1639 | } |
1640 | 1640 | } else { |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | return false; |
1691 | 1691 | } |
1692 | 1692 | |
1693 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1693 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1694 | 1694 | |
1695 | 1695 | } |
1696 | 1696 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $form = $gravityview_view->getForm(); |
32 | 32 | |
33 | - if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) { |
|
33 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) { |
|
34 | 34 | /** Allow to fall through for back compatibility testing purposes. */ |
35 | 35 | } else { |
36 | 36 | return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label ); |
@@ -38,29 +38,29 @@ discard block |
||
38 | 38 | |
39 | 39 | $label = ''; |
40 | 40 | |
41 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
41 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
42 | 42 | |
43 | - $label = $field['label']; |
|
43 | + $label = $field[ 'label' ]; |
|
44 | 44 | |
45 | 45 | // Support Gravity Forms 1.9+ |
46 | - if( class_exists( 'GF_Field' ) ) { |
|
46 | + if ( class_exists( 'GF_Field' ) ) { |
|
47 | 47 | |
48 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
48 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
49 | 49 | |
50 | - if( $field_object ) { |
|
50 | + if ( $field_object ) { |
|
51 | 51 | |
52 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
52 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
53 | 53 | |
54 | 54 | // This is a complex field, with labels on a per-input basis |
55 | - if( $input ) { |
|
55 | + if ( $input ) { |
|
56 | 56 | |
57 | 57 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
58 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
58 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
59 | 59 | |
60 | 60 | } else { |
61 | 61 | |
62 | 62 | // This is a field with one label |
63 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
63 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
72 | - if ( !empty( $field['custom_label'] ) ) { |
|
72 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
73 | 73 | |
74 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
74 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | |
134 | 134 | $width = NULL; |
135 | 135 | |
136 | - if( !empty( $field['width'] ) ) { |
|
137 | - $width = absint( $field['width'] ); |
|
136 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
137 | + $width = absint( $field[ 'width' ] ); |
|
138 | 138 | |
139 | 139 | // If using percentages, limit to 100% |
140 | - if( '%d%%' === $format && $width > 100 ) { |
|
140 | + if ( '%d%%' === $format && $width > 100 ) { |
|
141 | 141 | $width = 100; |
142 | 142 | } |
143 | 143 | |
@@ -157,42 +157,42 @@ discard block |
||
157 | 157 | public static function field_class( $field, $form = NULL, $entry = NULL ) { |
158 | 158 | $classes = array(); |
159 | 159 | |
160 | - if( !empty( $field['custom_class'] ) ) { |
|
160 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
161 | 161 | |
162 | - $custom_class = $field['custom_class']; |
|
162 | + $custom_class = $field[ 'custom_class' ]; |
|
163 | 163 | |
164 | - if( !empty( $entry ) ) { |
|
164 | + if ( ! empty( $entry ) ) { |
|
165 | 165 | |
166 | 166 | // We want the merge tag to be formatted as a class. The merge tag may be |
167 | 167 | // replaced by a multiple-word value that should be output as a single class. |
168 | 168 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
169 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
169 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
170 | 170 | |
171 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
171 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
172 | 172 | |
173 | 173 | // And then we want life to return to normal |
174 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
174 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | // And now we want the spaces to be handled nicely. |
178 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
178 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
179 | 179 | |
180 | 180 | } |
181 | 181 | |
182 | - if(!empty($field['id'])) { |
|
183 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
184 | - $form_id = '-'.$form['id']; |
|
182 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
183 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
184 | + $form_id = '-' . $form[ 'id' ]; |
|
185 | 185 | } else { |
186 | 186 | // @deprecated path. Form should always be given. |
187 | 187 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
188 | 188 | $gravityview_view = GravityView_View::getInstance(); |
189 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
189 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
190 | 190 | } |
191 | 191 | |
192 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
192 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
193 | 193 | } |
194 | 194 | |
195 | - return esc_attr(implode(' ', $classes)); |
|
195 | + return esc_attr( implode( ' ', $classes ) ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | * @return string Sanitized unique HTML `id` attribute for the field |
208 | 208 | */ |
209 | 209 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
210 | - $id = $field['id']; |
|
210 | + $id = $field[ 'id' ]; |
|
211 | 211 | |
212 | 212 | if ( ! empty( $id ) ) { |
213 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
214 | - $form_id = '-' . $form['id']; |
|
213 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
214 | + $form_id = '-' . $form[ 'id' ]; |
|
215 | 215 | } else { |
216 | 216 | // @deprecated path. Form should always be given. |
217 | 217 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
220 | 220 | } |
221 | 221 | |
222 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
222 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | return esc_attr( $id ); |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) { |
260 | 260 | |
261 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
261 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
262 | 262 | gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) ); |
263 | 263 | return NULL; |
264 | 264 | } |
265 | 265 | |
266 | 266 | $href = self::entry_link( $entry, $base_id ); |
267 | 267 | |
268 | - if( '' === $href ) { |
|
268 | + if ( '' === $href ) { |
|
269 | 269 | return NULL; |
270 | 270 | } |
271 | 271 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } else { |
303 | 303 | $gravityview_view = GravityView_View::getInstance(); |
304 | 304 | |
305 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
305 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
306 | 306 | $is_search = true; |
307 | 307 | } |
308 | 308 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | $output = esc_html__( 'This search returned no results.', 'gk-gravityview' ); |
315 | 315 | |
316 | - if( $context ) { |
|
316 | + if ( $context ) { |
|
317 | 317 | $setting = $context->view->settings->get( 'no_search_results_text', $output ); |
318 | 318 | } |
319 | 319 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | $output = esc_html__( 'No entries match your request.', 'gk-gravityview' ); |
323 | 323 | |
324 | - if( $context ) { |
|
324 | + if ( $context ) { |
|
325 | 325 | $setting = $context->view->settings->get( 'no_results_text', $output ); |
326 | 326 | } |
327 | 327 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $link = $directory_links[ 'gv_directory_link_' . $post_id ]; |
454 | 454 | } |
455 | 455 | |
456 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
456 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
457 | 457 | $link = home_url(); |
458 | 458 | } |
459 | 459 | |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | |
469 | 469 | $args = array(); |
470 | 470 | |
471 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
472 | - $args['pagenum'] = intval( $pagenum ); |
|
471 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
472 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
473 | 473 | } |
474 | 474 | |
475 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
476 | - $args['sort'] = $sort; |
|
477 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
475 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
476 | + $args[ 'sort' ] = $sort; |
|
477 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | $link = add_query_arg( $args, $link ); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
512 | 512 | |
513 | 513 | // Generate an unique hash to use as the default value |
514 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
514 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
515 | 515 | |
516 | 516 | /** |
517 | 517 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
523 | 523 | |
524 | 524 | // Make sure we have something - use the original ID as backup. |
525 | - if( empty( $slug ) ) { |
|
525 | + if ( empty( $slug ) ) { |
|
526 | 526 | $slug = $id; |
527 | 527 | } |
528 | 528 | |
@@ -616,15 +616,15 @@ discard block |
||
616 | 616 | * @param boolean $custom Should we process the custom entry slug? |
617 | 617 | */ |
618 | 618 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
619 | - if( $custom ) { |
|
619 | + if ( $custom ) { |
|
620 | 620 | // create the gravityview_unique_id and save it |
621 | 621 | |
622 | 622 | // Get the entry hash |
623 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
623 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
624 | 624 | |
625 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
625 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
626 | 626 | |
627 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
627 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
628 | 628 | |
629 | 629 | } |
630 | 630 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | |
651 | 651 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
652 | 652 | $entry = GVCommon::get_entry( $entry ); |
653 | - } else if( empty( $entry ) ) { |
|
653 | + } else if ( empty( $entry ) ) { |
|
654 | 654 | // @deprecated path |
655 | 655 | $entry = GravityView_frontend::getInstance()->getEntry(); |
656 | 656 | } |
@@ -670,32 +670,32 @@ discard block |
||
670 | 670 | |
671 | 671 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
672 | 672 | |
673 | - if ( ! empty( $entry['_multi'] ) ) { |
|
673 | + if ( ! empty( $entry[ '_multi' ] ) ) { |
|
674 | 674 | $entry_slugs = array(); |
675 | 675 | |
676 | - foreach ( $entry['_multi'] as $_multi ) { |
|
676 | + foreach ( $entry[ '_multi' ] as $_multi ) { |
|
677 | 677 | |
678 | - if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
679 | - $entry_slugs[] = $gv_multi->get_slug(); |
|
678 | + if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
679 | + $entry_slugs[ ] = $gv_multi->get_slug(); |
|
680 | 680 | } else { |
681 | 681 | // TODO: This path isn't covered by unit tests |
682 | - $entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi ); |
|
682 | + $entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi ); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | unset( $gv_multi ); |
686 | 686 | |
687 | - $forms[] = $_multi['form_id']; |
|
687 | + $forms[ ] = $_multi[ 'form_id' ]; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | $entry_slug = implode( ',', $entry_slugs ); |
691 | 691 | } else { |
692 | 692 | |
693 | 693 | // Fallback when |
694 | - if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
694 | + if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
695 | 695 | $entry_slug = $gv_entry->get_slug(); |
696 | 696 | } else { |
697 | 697 | // TODO: This path isn't covered by unit tests |
698 | - $entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
698 | + $entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | unset( $gv_entry ); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | $args = gv_get_query_args(); |
715 | 715 | } |
716 | 716 | |
717 | - if ( get_option('permalink_structure') && ! is_preview() ) { |
|
717 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
718 | 718 | |
719 | 719 | /** |
720 | 720 | * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug. |
@@ -722,13 +722,13 @@ discard block |
||
722 | 722 | */ |
723 | 723 | $link_parts = explode( '?', $directory_link ); |
724 | 724 | |
725 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
725 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
726 | 726 | |
727 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
727 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
728 | 728 | |
729 | 729 | } else { |
730 | 730 | |
731 | - $args[] = array( $query_arg_name => $entry_slug ); |
|
731 | + $args[ ] = array( $query_arg_name => $entry_slug ); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | /** |
@@ -736,21 +736,21 @@ discard block |
||
736 | 736 | */ |
737 | 737 | if ( $add_directory_args ) { |
738 | 738 | |
739 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
740 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
739 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
740 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | /** |
744 | 744 | * @since 1.7 |
745 | 745 | */ |
746 | 746 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
747 | - $args['sort'] = $sort; |
|
748 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
747 | + $args[ 'sort' ] = $sort; |
|
748 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | } |
752 | 752 | |
753 | - if( $post_id ) { |
|
753 | + if ( $post_id ) { |
|
754 | 754 | $passed_post = get_post( $post_id ); |
755 | 755 | $views = \GV\View_Collection::from_post( $passed_post ); |
756 | 756 | $has_multiple_views = $views->count() > 1; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | } |
760 | 760 | |
761 | 761 | if ( $has_multiple_views ) { |
762 | - $args['gvid'] = $view_id ? $view_id : gravityview_get_view_id(); |
|
762 | + $args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id(); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | return add_query_arg( $args, $directory_link ); |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | } |
832 | 832 | |
833 | 833 | function gv_class( $field, $form = NULL, $entry = array() ) { |
834 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
834 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | /** |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | $view_id = 0; |
855 | 855 | if ( $context->view ) { |
856 | 856 | $view_id = $context->view->ID; |
857 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
857 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
858 | 858 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
859 | 859 | } |
860 | 860 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | $default_css_class .= ' ' . $context->view->settings->get( 'class', '' ); |
887 | 887 | } |
888 | 888 | |
889 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
889 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
890 | 890 | |
891 | 891 | /** |
892 | 892 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | |
914 | 914 | $value = GravityView_API::field_value( $entry, $field ); |
915 | 915 | |
916 | - if( $value === '' ) { |
|
916 | + if ( $value === '' ) { |
|
917 | 917 | /** |
918 | 918 | * @filter `gravityview_empty_value` What to display when a field is empty |
919 | 919 | * @param string $value (empty string) |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | } |
934 | 934 | |
935 | 935 | function gv_no_results( $wpautop = true, $context = null ) { |
936 | - return apply_filters('gravityview/template/no_entries',GravityView_API::no_results( $wpautop, $context ),$context); |
|
936 | + return apply_filters( 'gravityview/template/no_entries', GravityView_API::no_results( $wpautop, $context ), $context ); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | /** |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | */ |
1027 | 1027 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
1028 | 1028 | |
1029 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
1029 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
1030 | 1030 | |
1031 | 1031 | // For the complete field value as generated by Gravity Forms |
1032 | 1032 | return $display_value; |
@@ -1060,16 +1060,16 @@ discard block |
||
1060 | 1060 | $terms = explode( ', ', $value ); |
1061 | 1061 | } |
1062 | 1062 | |
1063 | - foreach ($terms as $term_name ) { |
|
1063 | + foreach ( $terms as $term_name ) { |
|
1064 | 1064 | |
1065 | 1065 | // If we're processing a category, |
1066 | - if( $taxonomy === 'category' ) { |
|
1066 | + if ( $taxonomy === 'category' ) { |
|
1067 | 1067 | |
1068 | 1068 | // Use rgexplode to prevent errors if : doesn't exist |
1069 | 1069 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
1070 | 1070 | |
1071 | 1071 | // The explode was succesful; we have the category ID |
1072 | - if( !empty( $term_id )) { |
|
1072 | + if ( ! empty( $term_id ) ) { |
|
1073 | 1073 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
1074 | 1074 | } else { |
1075 | 1075 | // We have to fall back to the name |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | // There's still a tag/category here. |
1085 | - if( $term ) { |
|
1085 | + if ( $term ) { |
|
1086 | 1086 | |
1087 | 1087 | $term_link = get_term_link( $term, $taxonomy ); |
1088 | 1088 | |
@@ -1091,11 +1091,11 @@ discard block |
||
1091 | 1091 | continue; |
1092 | 1092 | } |
1093 | 1093 | |
1094 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
1094 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - return implode(', ', $output ); |
|
1098 | + return implode( ', ', $output ); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | /** |
@@ -1109,8 +1109,8 @@ discard block |
||
1109 | 1109 | |
1110 | 1110 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
1111 | 1111 | |
1112 | - if( empty( $link ) ) { |
|
1113 | - return strip_tags( $output); |
|
1112 | + if ( empty( $link ) ) { |
|
1113 | + return strip_tags( $output ); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | return $output; |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | $fe = GravityView_frontend::getInstance(); |
1130 | 1130 | |
1131 | 1131 | // Solve problem when loading content via admin-ajax.php |
1132 | - if( ! $fe->getGvOutputData() ) { |
|
1132 | + if ( ! $fe->getGvOutputData() ) { |
|
1133 | 1133 | |
1134 | 1134 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
1135 | 1135 | |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | // Make 100% sure that we're dealing with a properly called situation |
1140 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
1140 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
1141 | 1141 | |
1142 | 1142 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
1143 | 1143 | |
@@ -1368,12 +1368,12 @@ discard block |
||
1368 | 1368 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
1369 | 1369 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1370 | 1370 | |
1371 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1372 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1371 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1372 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1373 | 1373 | } |
1374 | 1374 | |
1375 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1376 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1375 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1376 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | if ( is_null( $context ) ) { |
@@ -1484,21 +1484,21 @@ discard block |
||
1484 | 1484 | } else { |
1485 | 1485 | // @deprecated path |
1486 | 1486 | // Required fields. |
1487 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1487 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1488 | 1488 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
1489 | 1489 | return ''; |
1490 | 1490 | } |
1491 | 1491 | } |
1492 | 1492 | |
1493 | 1493 | if ( $context instanceof \GV\Template_Context ) { |
1494 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1495 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
1496 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
1494 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1495 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
1496 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
1497 | 1497 | } else { |
1498 | 1498 | // @deprecated path |
1499 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1500 | - $field = $args['field']; |
|
1501 | - $form = $args['form']; |
|
1499 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1500 | + $field = $args[ 'field' ]; |
|
1501 | + $form = $args[ 'form' ]; |
|
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | /** |
@@ -1518,43 +1518,43 @@ discard block |
||
1518 | 1518 | ); |
1519 | 1519 | |
1520 | 1520 | if ( $context instanceof \GV\Template_Context ) { |
1521 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
1521 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
1522 | 1522 | } else { |
1523 | 1523 | // @deprecated path |
1524 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
1524 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | // If the value is empty and we're hiding empty, return empty. |
1528 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1528 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1529 | 1529 | return ''; |
1530 | 1530 | } |
1531 | 1531 | |
1532 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1533 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
1532 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1533 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | // Get width setting, if exists |
1537 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
1537 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
1538 | 1538 | |
1539 | 1539 | // If replacing with CSS inline formatting, let's do it. |
1540 | - $placeholders['width:style'] = (string) GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
1540 | + $placeholders[ 'width:style' ] = (string)GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
1541 | 1541 | |
1542 | 1542 | // Grab the Class using `gv_class` |
1543 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
1544 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1543 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
1544 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1545 | 1545 | |
1546 | 1546 | if ( $context instanceof \GV\Template_Context ) { |
1547 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label', '' ); |
|
1547 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label', '' ); |
|
1548 | 1548 | } else { |
1549 | 1549 | // Default Label value |
1550 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
1550 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
1551 | 1551 | } |
1552 | 1552 | |
1553 | - $placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders['label_value'] ) ) ) ); |
|
1554 | - $placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] ); |
|
1553 | + $placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders[ 'label_value' ] ) ) ) ); |
|
1554 | + $placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] ); |
|
1555 | 1555 | |
1556 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
1557 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1556 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
1557 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | /** |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | * @since 2.0 |
1566 | 1566 | * @param \GV\Template_Context $context The context. |
1567 | 1567 | */ |
1568 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
1568 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
1569 | 1569 | |
1570 | 1570 | /** |
1571 | 1571 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1592,7 +1592,7 @@ discard block |
||
1592 | 1592 | foreach ( $placeholders as $tag => $value ) { |
1593 | 1593 | |
1594 | 1594 | // If the tag doesn't exist just skip it |
1595 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1595 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1596 | 1596 | continue; |
1597 | 1597 | } |
1598 | 1598 | |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | $value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args, $context ); |
1614 | 1614 | |
1615 | 1615 | // Finally do the replace |
1616 | - $html = str_replace( $search, (string) $value, $html ); |
|
1616 | + $html = str_replace( $search, (string)$value, $html ); |
|
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | /** |