@@ -4,7 +4,7 @@ |
||
4 | 4 | die(); |
5 | 5 | |
6 | 6 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ |
7 | -if ( version_compare( phpversion(), '5.3' , '<' ) ) |
|
7 | +if ( version_compare( phpversion(), '5.3', '<' ) ) |
|
8 | 8 | return false; |
9 | 9 | |
10 | 10 | /** Require */ |
@@ -1,11 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** If this file is called directly, abort. */ |
3 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
3 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
4 | 4 | die(); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ |
7 | -if ( version_compare( phpversion(), '5.3' , '<' ) ) |
|
8 | +if ( version_compare( phpversion(), '5.3' , '<' ) ) { |
|
8 | 9 | return false; |
10 | +} |
|
9 | 11 | |
10 | 12 | /** Require */ |
11 | 13 | require GRAVITYVIEW_DIR . 'future/includes/class-gv-core.php'; |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | |
59 | 59 | if ( 'address' === rgar( $search_field, 'type' ) ) { |
60 | 60 | |
61 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
62 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
61 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
62 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
63 | 63 | $form = GravityView_View::getInstance()->getForm(); |
64 | 64 | |
65 | 65 | /** @var GF_Field_Address $address_field */ |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $choices = array(); |
69 | 69 | |
70 | 70 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
71 | - if( method_exists( $this, $method_name ) ) { |
|
71 | + if ( method_exists( $this, $method_name ) ) { |
|
72 | 72 | /** |
73 | 73 | * @uses GravityView_Field_Address::get_choices_country() |
74 | 74 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | $choices = $this->{$method_name}( $address_field ); |
77 | 77 | } |
78 | 78 | |
79 | - if( ! empty( $choices ) ) { |
|
80 | - $search_field['choices'] = $choices; |
|
81 | - $search_field['type'] = rgar( $search_field, 'input'); |
|
79 | + if ( ! empty( $choices ) ) { |
|
80 | + $search_field[ 'choices' ] = $choices; |
|
81 | + $search_field[ 'type' ] = rgar( $search_field, 'input' ); |
|
82 | 82 | } else { |
83 | - $search_field['type'] = 'text'; |
|
84 | - $search_field['input'] = 'input_text'; |
|
83 | + $search_field[ 'type' ] = 'text'; |
|
84 | + $search_field[ 'input' ] = 'input_text'; |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $country_choices = array(); |
108 | 108 | |
109 | 109 | foreach ( $countries as $key => $country ) { |
110 | - $country_choices[] = array( |
|
110 | + $country_choices[ ] = array( |
|
111 | 111 | 'value' => $country, |
112 | 112 | 'text' => $country, |
113 | 113 | ); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | private function get_choices_state( $address_field ) { |
133 | 133 | |
134 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
134 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
135 | 135 | |
136 | 136 | $state_choices = array(); |
137 | 137 | |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | $states = GFCommon::get_canadian_provinces(); |
144 | 144 | break; |
145 | 145 | default: |
146 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
146 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
147 | 147 | break; |
148 | 148 | } |
149 | 149 | |
150 | 150 | foreach ( $states as $key => $state ) { |
151 | - $state_choices[] = array( |
|
151 | + $state_choices[ ] = array( |
|
152 | 152 | 'value' => $state, |
153 | 153 | 'text' => $state, |
154 | 154 | ); |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | // Use the same inputs as the "text" input type allows |
172 | 172 | $text_inputs = rgar( $input_types, 'text' ); |
173 | 173 | |
174 | - $input_types['street'] = $text_inputs; |
|
175 | - $input_types['street2'] = $text_inputs; |
|
176 | - $input_types['city'] = $text_inputs; |
|
174 | + $input_types[ 'street' ] = $text_inputs; |
|
175 | + $input_types[ 'street2' ] = $text_inputs; |
|
176 | + $input_types[ 'city' ] = $text_inputs; |
|
177 | 177 | |
178 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
179 | - $input_types['zip'] = array( 'input_text' ); |
|
180 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
178 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
179 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
180 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
181 | 181 | |
182 | 182 | return $input_types; |
183 | 183 | } |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
199 | 199 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
200 | 200 | |
201 | - if( 'address' === $field_type && $input_id ) { |
|
201 | + if ( 'address' === $field_type && $input_id ) { |
|
202 | 202 | |
203 | 203 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
204 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
204 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
205 | 205 | $input_type = $address_field_name; |
206 | 206 | } |
207 | 207 | } |
@@ -250,20 +250,20 @@ discard block |
||
250 | 250 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
251 | 251 | |
252 | 252 | // If this is NOT the full address field, return default options. |
253 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
253 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
254 | 254 | return $field_options; |
255 | 255 | } |
256 | 256 | |
257 | - if( 'edit' === $context ) { |
|
257 | + if ( 'edit' === $context ) { |
|
258 | 258 | return $field_options; |
259 | 259 | } |
260 | 260 | |
261 | 261 | $add_options = array(); |
262 | 262 | |
263 | - $add_options['show_map_link'] = array( |
|
263 | + $add_options[ 'show_map_link' ] = array( |
|
264 | 264 | 'type' => 'checkbox', |
265 | 265 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
266 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
266 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
267 | 267 | 'value' => true, |
268 | 268 | 'merge_tags' => false, |
269 | 269 | ); |
@@ -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 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $supports = array( 'title', 'revisions' ); |
36 | 36 | |
37 | 37 | if ( $is_hierarchical ) { |
38 | - $supports[] = 'page-attributes'; |
|
38 | + $supports[ ] = 'page-attributes'; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -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 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
17 | + var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
46 | 46 | |
47 | 47 | // It's not the parent field; it's an input |
48 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
48 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
49 | 49 | |
50 | - if( $this->is_choice_value_enabled() ) { |
|
50 | + if ( $this->is_choice_value_enabled() ) { |
|
51 | 51 | |
52 | 52 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
53 | 53 | $default = 'value'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | - $field_options['choice_display'] = array( |
|
68 | + $field_options[ 'choice_display' ] = array( |
|
69 | 69 | 'type' => 'radio', |
70 | 70 | 'class' => 'vertical', |
71 | 71 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -50,12 +50,12 @@ |
||
50 | 50 | |
51 | 51 | /** @var GF_Field_Total $total_field */ |
52 | 52 | foreach ( $Edit_Entry_Render->total_fields as $total_field ) { |
53 | - $entry["{$total_field->id}"] = GFCommon::get_order_total( $form, $Edit_Entry_Render->entry ); |
|
53 | + $entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $form, $Edit_Entry_Render->entry ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $return_entry = GFAPI::update_entry( $entry ); |
57 | 57 | |
58 | - if( is_wp_error( $return_entry ) ) { |
|
58 | + if ( is_wp_error( $return_entry ) ) { |
|
59 | 59 | do_action( 'gravityview_log_error', __METHOD__ . ': Updating the entry total fields failed', $return_entry ); |
60 | 60 | } else { |
61 | 61 | do_action( 'gravityview_log_debug', __METHOD__ . ': Updating the entry total fields succeeded' ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function clear_product_info_cache( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
51 | 51 | |
52 | - if( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
52 | + if ( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see GVCommon::entry_has_transaction_data() |
102 | 102 | * @param boolean $hide_product_fields Whether to hide product fields in the editor. Uses $entry data to determine. |
103 | 103 | */ |
104 | - $hide_product_fields = (bool) apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
104 | + $hide_product_fields = (bool)apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
105 | 105 | |
106 | 106 | return $hide_product_fields; |
107 | 107 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', false ); |
46 | 46 | |
47 | - return (bool) $hide_coupon_fields; |
|
47 | + return (bool)$hide_coupon_fields; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function edit_entry_field_blacklist( $blacklist = array() ) { |
60 | 60 | |
61 | 61 | if ( $this->should_hide_coupon_fields() ) { |
62 | - $blacklist[] = 'coupon'; |
|
62 | + $blacklist[ ] = 'coupon'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $blacklist; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // No coupons match the codes provided |
98 | 98 | $discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form ); |
99 | 99 | |
100 | - if( ! $discounts ) { |
|
100 | + if ( ! $discounts ) { |
|
101 | 101 | return $value; |
102 | 102 | } |
103 | 103 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @see GF_Field_Coupon::get_field_input |
107 | 107 | */ |
108 | 108 | $_POST = ! isset( $_POST ) ? array() : $_POST; |
109 | - $_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts ); |
|
109 | + $_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts ); |
|
110 | 110 | $_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes ); |
111 | 111 | |
112 | 112 | return $value; |