@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | * @return string The version of PHP. |
| 201 | 201 | */ |
| 202 | 202 | private function get_php_version() { |
| 203 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
| 204 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
| 203 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
| 204 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | * @return string The version of WordPress. |
| 213 | 213 | */ |
| 214 | 214 | private function get_wordpress_version() { |
| 215 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
| 216 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
| 215 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
| 216 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -225,11 +225,11 @@ discard block |
||
| 225 | 225 | * @return string The version of Gravity Forms. |
| 226 | 226 | */ |
| 227 | 227 | private function get_gravityforms_version() { |
| 228 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) |
|
| 228 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) |
|
| 229 | 229 | throw new \ErrorException( __( 'Gravity Forms is inactive or not installed at all.', 'gravityview' ) ); |
| 230 | 230 | |
| 231 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
| 232 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
| 231 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
| 232 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | private function __clone() { } |
@@ -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 GravityView WordPress plugin class. |
@@ -68,8 +69,9 @@ discard block |
||
| 68 | 69 | * @return \GV\Plugin The global instance of GravityView Plugin. |
| 69 | 70 | */ |
| 70 | 71 | public static function get() { |
| 71 | - if ( ! self::$__instance instanceof self ) |
|
| 72 | - self::$__instance = new self; |
|
| 72 | + if ( ! self::$__instance instanceof self ) { |
|
| 73 | + self::$__instance = new self; |
|
| 74 | + } |
|
| 73 | 75 | return self::$__instance; |
| 74 | 76 | } |
| 75 | 77 | |
@@ -92,8 +94,9 @@ discard block |
||
| 92 | 94 | * Stop all further functionality from loading if the WordPress |
| 93 | 95 | * plugin is incompatible with the current environment. |
| 94 | 96 | */ |
| 95 | - if ( ! $this->is_compatible() ) |
|
| 96 | - return; |
|
| 97 | + if ( ! $this->is_compatible() ) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 97 | 100 | |
| 98 | 101 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
| 99 | 102 | register_activation_hook( $this->dir( 'gravityview.php' ), array( $this, 'activate' ) ); |
@@ -236,8 +239,9 @@ discard block |
||
| 236 | 239 | * @return string The version of Gravity Forms. |
| 237 | 240 | */ |
| 238 | 241 | private function get_gravityforms_version() { |
| 239 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) |
|
| 240 | - throw new \ErrorException( __( 'Gravity Forms is inactive or not installed.', 'gravityview' ) ); |
|
| 242 | + if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
| 243 | + throw new \ErrorException( __( 'Gravity Forms is inactive or not installed.', 'gravityview' ) ); |
|
| 244 | + } |
|
| 241 | 245 | |
| 242 | 246 | return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
| 243 | 247 | $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
@@ -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 | } |