@@ -12,7 +12,9 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 15 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | + exit; |
|
| 17 | +} |
|
| 16 | 18 | |
| 17 | 19 | /** |
| 18 | 20 | * GravityView_Welcome Class |
@@ -2,8 +2,9 @@ discard block |
||
| 2 | 2 | namespace GV; |
| 3 | 3 | |
| 4 | 4 | /** If this file is called directly, abort. */ |
| 5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
| 5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
| 6 | 6 | die(); |
| 7 | +} |
|
| 7 | 8 | |
| 8 | 9 | /** |
| 9 | 10 | * The base Entry class. |
@@ -24,8 +25,9 @@ discard block |
||
| 24 | 25 | $endpoint = self::get_endpoint_name(); |
| 25 | 26 | |
| 26 | 27 | /** Let's make sure the endpoint array is not polluted. */ |
| 27 | - if ( in_array( array( EP_ALL, $endpoint, $endpoint ), $wp_rewrite->endpoints ) ) |
|
| 28 | - return; |
|
| 28 | + if ( in_array( array( EP_ALL, $endpoint, $endpoint ), $wp_rewrite->endpoints ) ) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | add_rewrite_endpoint( $endpoint, EP_ALL ); |
| 31 | 33 | } |
@@ -2,8 +2,9 @@ discard block |
||
| 2 | 2 | namespace GV; |
| 3 | 3 | |
| 4 | 4 | /** If this file is called directly, abort. */ |
| 5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
| 5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
| 6 | 6 | die(); |
| 7 | +} |
|
| 7 | 8 | |
| 8 | 9 | /** |
| 9 | 10 | * The default GravityView View class. |
@@ -21,8 +22,9 @@ discard block |
||
| 21 | 22 | public static function register_post_type() { |
| 22 | 23 | |
| 23 | 24 | /** Register only once */ |
| 24 | - if ( post_type_exists( 'gravityview' ) ) |
|
| 25 | - return; |
|
| 25 | + if ( post_type_exists( 'gravityview' ) ) { |
|
| 26 | + return; |
|
| 27 | + } |
|
| 26 | 28 | |
| 27 | 29 | /** |
| 28 | 30 | * @filter `gravityview_is_hierarchical` Make GravityView Views hierarchical by returning TRUE |
@@ -2,8 +2,9 @@ |
||
| 2 | 2 | namespace GV; |
| 3 | 3 | |
| 4 | 4 | /** If this file is called directly, abort. */ |
| 5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
| 5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
| 6 | 6 | die(); |
| 7 | +} |
|
| 7 | 8 | |
| 8 | 9 | /** |
| 9 | 10 | * The Request abstract class. |
@@ -2,8 +2,9 @@ |
||
| 2 | 2 | namespace GV; |
| 3 | 3 | |
| 4 | 4 | /** If this file is called directly, abort. */ |
| 5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
| 5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
| 6 | 6 | die(); |
| 7 | +} |
|
| 7 | 8 | |
| 8 | 9 | /** |
| 9 | 10 | * The base \GV\Shortcode class. |
@@ -50,7 +50,6 @@ |
||
| 50 | 50 | * |
| 51 | 51 | * @throws \ErrorException if shortcode with this name has already been registered elsewhere. |
| 52 | 52 | * @internal |
| 53 | - |
|
| 54 | 53 | * @return \GV\Shortcode The only internally registered instance of this shortcode. |
| 55 | 54 | */ |
| 56 | 55 | public static function add() { |
@@ -2,8 +2,9 @@ |
||
| 2 | 2 | namespace GV\Shortcodes; |
| 3 | 3 | |
| 4 | 4 | /** If this file is called directly, abort. */ |
| 5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
| 5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
| 6 | 6 | die(); |
| 7 | +} |
|
| 7 | 8 | |
| 8 | 9 | /** |
| 9 | 10 | * The base \GV\Shortcode class. |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | $this->context_view_id = $_GET['gvid']; |
| 246 | 246 | |
| 247 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 247 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 248 | 248 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 249 | 249 | $this->context_view_id = array_pop( $array_keys ); |
| 250 | 250 | unset( $array_keys ); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // User reported WooCommerce doesn't pass two args. |
| 455 | - if ( empty( $passed_post_id ) ) { |
|
| 455 | + if ( empty( $passed_post_id ) ) { |
|
| 456 | 456 | return $title; |
| 457 | 457 | } |
| 458 | 458 | |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | */ |
| 1308 | 1308 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1309 | 1309 | |
| 1310 | - switch( strtolower( $address_part ) ){ |
|
| 1310 | + switch( strtolower( $address_part ) ) { |
|
| 1311 | 1311 | case 'street': |
| 1312 | 1312 | $sort_field_id .= '.1'; |
| 1313 | 1313 | break; |
@@ -1392,7 +1392,7 @@ discard block |
||
| 1392 | 1392 | */ |
| 1393 | 1393 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1394 | 1394 | |
| 1395 | - if ( empty( $single_entry ) ){ |
|
| 1395 | + if ( empty( $single_entry ) ) { |
|
| 1396 | 1396 | return false; |
| 1397 | 1397 | } else { |
| 1398 | 1398 | return $single_entry; |
@@ -40,7 +40,6 @@ |
||
| 40 | 40 | * Get the default date format for a field based on the field ID and the time format setting |
| 41 | 41 | * |
| 42 | 42 | * @since 1.16.4 |
| 43 | - |
|
| 44 | 43 | * @param string $date_format The Gravity Forms date format for the field. Default: "mdy" |
| 45 | 44 | * @param int $field_id The ID of the field. Used to figure out full date/day/month/year |
| 46 | 45 | * |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | - * @hack |
|
| 310 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 311 | - */ |
|
| 309 | + * @hack |
|
| 310 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 311 | + */ |
|
| 312 | 312 | if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
| 313 | - continue; |
|
| 314 | - } |
|
| 313 | + continue; |
|
| 314 | + } |
|
| 315 | 315 | $fields["{$input['id']}"] = array( |
| 316 | 316 | 'label' => rgar( $input, 'label' ), |
| 317 | 317 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | } elseif ( 'delete' === GFForms::get( 'action' ) ) { |
| 489 | 489 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
| 490 | 490 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
| 491 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 491 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 492 | 492 | $criteria['context_view_id'] = null; |
| 493 | 493 | } |
| 494 | 494 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | ), |
| 1252 | 1252 | ); |
| 1253 | 1253 | |
| 1254 | - $fields = $date_created + $fields; |
|
| 1254 | + $fields = $date_created + $fields; |
|
| 1255 | 1255 | |
| 1256 | 1256 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1257 | 1257 | |
@@ -1263,13 +1263,13 @@ discard block |
||
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | - /** |
|
| 1267 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1268 | - * @since 1.12 |
|
| 1269 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1270 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1271 | - */ |
|
| 1272 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1266 | + /** |
|
| 1267 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1268 | + * @since 1.12 |
|
| 1269 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1270 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1271 | + */ |
|
| 1272 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1273 | 1273 | |
| 1274 | 1274 | return $fields; |
| 1275 | 1275 | } |
@@ -1561,26 +1561,26 @@ discard block |
||
| 1561 | 1561 | } |
| 1562 | 1562 | |
| 1563 | 1563 | |
| 1564 | - /** |
|
| 1565 | - * Display updated/error notice |
|
| 1566 | - * |
|
| 1567 | - * @since 1.19.2 Added $cap and $object_id parameters |
|
| 1568 | - * |
|
| 1569 | - * @param string $notice text/HTML of notice |
|
| 1570 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1571 | - * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
| 1572 | - * |
|
| 1573 | - * @return string |
|
| 1574 | - */ |
|
| 1575 | - public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
| 1576 | - |
|
| 1577 | - // If $cap is defined, only show notice if user has capability |
|
| 1578 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
| 1579 | - return ''; |
|
| 1580 | - } |
|
| 1581 | - |
|
| 1582 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1583 | - } |
|
| 1564 | + /** |
|
| 1565 | + * Display updated/error notice |
|
| 1566 | + * |
|
| 1567 | + * @since 1.19.2 Added $cap and $object_id parameters |
|
| 1568 | + * |
|
| 1569 | + * @param string $notice text/HTML of notice |
|
| 1570 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1571 | + * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
| 1572 | + * |
|
| 1573 | + * @return string |
|
| 1574 | + */ |
|
| 1575 | + public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
| 1576 | + |
|
| 1577 | + // If $cap is defined, only show notice if user has capability |
|
| 1578 | + if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
| 1579 | + return ''; |
|
| 1580 | + } |
|
| 1581 | + |
|
| 1582 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1583 | + } |
|
| 1584 | 1584 | |
| 1585 | 1585 | /** |
| 1586 | 1586 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
| 327 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
| 327 | + if( GFCommon::is_product_field( $field['type'] ) ) { |
|
| 328 | 328 | $has_product_fields = true; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $fields = array(); |
| 386 | 386 | |
| 387 | - foreach ( $extra_fields as $key => $field ){ |
|
| 387 | + foreach ( $extra_fields as $key => $field ) { |
|
| 388 | 388 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
| 389 | 389 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
| 390 | 390 | } |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | $form = GFAPI::get_form( $form ); |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 981 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 982 | 982 | return GFFormsModel::get_field( $form, $field_id ); |
| 983 | 983 | } else { |
| 984 | 984 | return null; |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | $shortcodes = array(); |
| 1026 | 1026 | |
| 1027 | 1027 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 1028 | - if ( empty( $matches ) ){ |
|
| 1028 | + if ( empty( $matches ) ) { |
|
| 1029 | 1029 | return false; |
| 1030 | 1030 | } |
| 1031 | 1031 | |