@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
| 167 | 167 | */ |
| 168 | 168 | public static function from_configuration( $configuration ) { |
| 169 | - if ( empty( $configuration['id'] ) ) { |
|
| 169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
| 170 | 170 | $field = new self(); |
| 171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
| 172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | } else { |
| 180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
| 181 | 181 | } |
| 182 | - $trace = $trace[1]; |
|
| 183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
| 182 | + $trace = $trace[ 1 ]; |
|
| 183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
| 184 | 184 | $field = new self(); |
| 185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
| 186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** Determine the field implementation to use, and try to use. */ |
| 191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | public function update_configuration( $configuration ) { |
| 228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
| 229 | 229 | |
| 230 | - if ( $this->ID != $configuration['id'] ) { |
|
| 230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
| 231 | 231 | /** Smelling trouble here... */ |
| 232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $this->ID = $configuration['id']; |
|
| 236 | - $this->label = $configuration['label']; |
|
| 237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
| 238 | - $this->custom_label = $configuration['custom_label']; |
|
| 239 | - $this->custom_class = $configuration['custom_class']; |
|
| 240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
| 241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
| 242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
| 235 | + $this->ID = $configuration[ 'id' ]; |
|
| 236 | + $this->label = $configuration[ 'label' ]; |
|
| 237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
| 238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
| 239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
| 240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
| 241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
| 242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
| 243 | 243 | |
| 244 | 244 | /** Shared among all field types (sort of). */ |
| 245 | 245 | $shared_configuration_keys = array( |
| 246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
| 247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 248 | 248 | ); |
| 249 | 249 | |
| 250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | /** A custom label is available. */ |
| 275 | 275 | if ( ! empty( $this->custom_label ) ) { |
| 276 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
| 276 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return ''; |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
| 351 | 351 | */ |
| 352 | 352 | public function __get( $key ) { |
| 353 | - switch( $key ) { |
|
| 353 | + switch ( $key ) { |
|
| 354 | 354 | default: |
| 355 | 355 | if ( isset( $this->configuration[ $key ] ) ) { |
| 356 | 356 | return $this->configuration[ $key ]; |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | * @return boolean Whether this $key is set or not. |
| 369 | 369 | */ |
| 370 | 370 | public function __isset( $key ) { |
| 371 | - switch( $key ) { |
|
| 371 | + switch ( $key ) { |
|
| 372 | 372 | default: |
| 373 | 373 | return isset( $this->configuration[ $key ] ); |
| 374 | 374 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $field_options = array(); |
| 29 | 29 | |
| 30 | - if( 'field' === $field_type ) { |
|
| 30 | + if ( 'field' === $field_type ) { |
|
| 31 | 31 | |
| 32 | 32 | // Default options - fields |
| 33 | 33 | $field_options = array( |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'custom_class' => array( |
| 46 | 46 | 'type' => 'text', |
| 47 | 47 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
| 48 | - 'desc' => __( 'This class will be added to the field container', 'gravityview'), |
|
| 48 | + 'desc' => __( 'This class will be added to the field container', 'gravityview' ), |
|
| 49 | 49 | 'value' => '', |
| 50 | 50 | 'merge_tags' => true, |
| 51 | 51 | 'tooltip' => 'gv_css_merge_tags', |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | // Match Table as well as DataTables |
| 68 | - if( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) { |
|
| 69 | - $field_options['width'] = array( |
|
| 68 | + if ( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) { |
|
| 69 | + $field_options[ 'width' ] = array( |
|
| 70 | 70 | 'type' => 'number', |
| 71 | - 'label' => __('Percent Width', 'gravityview'), |
|
| 72 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
| 71 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
| 72 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
| 73 | 73 | 'class' => 'code widefat', |
| 74 | 74 | 'value' => '', |
| 75 | 75 | ); |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | - if( is_multisite() ) { |
|
| 126 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
| 125 | + if ( is_multisite() ) { |
|
| 126 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
| 137 | 137 | * @param string $input_type Optional. (textarea, list, select, etc.) |
| 138 | 138 | */ |
| 139 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 139 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 140 | 140 | |
| 141 | 141 | return $select_cap_choices; |
| 142 | 142 | } |
@@ -164,27 +164,27 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
| 166 | 166 | |
| 167 | - if( empty( $uniqid ) ) { |
|
| 167 | + if ( empty( $uniqid ) ) { |
|
| 168 | 168 | //generate a unique field id |
| 169 | - $uniqid = uniqid('', false); |
|
| 169 | + $uniqid = uniqid( '', false ); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // get field/widget options |
| 173 | 173 | $options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type ); |
| 174 | 174 | |
| 175 | 175 | // two different post arrays, depending of the field type |
| 176 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
| 176 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
| 177 | 177 | |
| 178 | 178 | // build output |
| 179 | 179 | $output = ''; |
| 180 | - $output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
| 181 | - $output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
| 180 | + $output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
| 181 | + $output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
| 182 | 182 | if ( $form_id ) { |
| 183 | - $output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
| 183 | + $output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // If there are no options, return what we got. |
| 187 | - if(empty($options)) { |
|
| 187 | + if ( empty( $options ) ) { |
|
| 188 | 188 | |
| 189 | 189 | // This is here for checking if the output is empty in render_label() |
| 190 | 190 | $output .= '<!-- No Options -->'; |
@@ -192,33 +192,33 @@ discard block |
||
| 192 | 192 | return $output; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">'; |
|
| 195 | + $output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">'; |
|
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * @since 1.8 |
| 199 | 199 | */ |
| 200 | - if( !empty( $item['subtitle'] ) ) { |
|
| 201 | - $output .= '<div class="subtitle">' . $item['subtitle'] . '</div>'; |
|
| 200 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
| 201 | + $output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>'; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - foreach( $options as $key => $option ) { |
|
| 204 | + foreach ( $options as $key => $option ) { |
|
| 205 | 205 | |
| 206 | 206 | $value = isset( $current[ $key ] ) ? $current[ $key ] : NULL; |
| 207 | 207 | |
| 208 | - $field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value); |
|
| 208 | + $field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value ); |
|
| 209 | 209 | |
| 210 | 210 | // The setting is empty |
| 211 | - if( empty( $field_output ) ) { |
|
| 211 | + if ( empty( $field_output ) ) { |
|
| 212 | 212 | continue; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - switch( $option['type'] ) { |
|
| 215 | + switch ( $option[ 'type' ] ) { |
|
| 216 | 216 | // Hide hidden fields |
| 217 | 217 | case 'hidden': |
| 218 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>'; |
|
| 218 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
|
| 219 | 219 | break; |
| 220 | 220 | default: |
| 221 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>'; |
|
| 221 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>'; |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
@@ -247,17 +247,17 @@ discard block |
||
| 247 | 247 | * @deprecated setting index 'default' was replaced by 'value' |
| 248 | 248 | * @see GravityView_FieldType::get_field_defaults |
| 249 | 249 | */ |
| 250 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
| 251 | - $option['value'] = $option['default']; |
|
| 252 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
| 250 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
| 251 | + $option[ 'value' ] = $option[ 'default' ]; |
|
| 252 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // prepare to render option field type |
| 256 | - if( isset( $option['type'] ) ) { |
|
| 256 | + if ( isset( $option[ 'type' ] ) ) { |
|
| 257 | 257 | |
| 258 | 258 | $type_class = self::load_type_class( $option ); |
| 259 | 259 | |
| 260 | - if( class_exists( $type_class ) ) { |
|
| 260 | + if ( class_exists( $type_class ) ) { |
|
| 261 | 261 | |
| 262 | 262 | /** @var GravityView_FieldType $render_type */ |
| 263 | 263 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @param[in,out] string $output field class name |
| 275 | 275 | * @param[in] array $option option field data |
| 276 | 276 | */ |
| 277 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
| 277 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | } // isset option[type] |
@@ -309,27 +309,27 @@ discard block |
||
| 309 | 309 | * @deprecated setting index 'name' was replaced by 'label' |
| 310 | 310 | * @see GravityView_FieldType::get_field_defaults |
| 311 | 311 | */ |
| 312 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
| 313 | - $setting['label'] = $setting['name']; |
|
| 314 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
| 312 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
| 313 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
| 314 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | $name = esc_attr( sprintf( $name, $key ) ); |
| 318 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
| 319 | - $setting['tooltip'] = 'gv_' . $key; |
|
| 318 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
| 319 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
| 320 | 320 | |
| 321 | 321 | // Use default if current setting isn't set. |
| 322 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
| 322 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
| 323 | 323 | |
| 324 | 324 | // default setting type = text |
| 325 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
| 325 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
| 326 | 326 | |
| 327 | 327 | // merge tags |
| 328 | - if( !isset( $setting['merge_tags'] ) ) { |
|
| 329 | - if( $setting['type'] === 'text' ) { |
|
| 330 | - $setting['merge_tags'] = true; |
|
| 328 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
| 329 | + if ( $setting[ 'type' ] === 'text' ) { |
|
| 330 | + $setting[ 'merge_tags' ] = true; |
|
| 331 | 331 | } else { |
| 332 | - $setting['merge_tags'] = false; |
|
| 332 | + $setting[ 'merge_tags' ] = false; |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | // render the setting |
| 339 | 339 | $type_class = self::load_type_class( $setting ); |
| 340 | - if( class_exists( $type_class ) ) { |
|
| 340 | + if ( class_exists( $type_class ) ) { |
|
| 341 | 341 | /** @var GravityView_FieldType $render_type */ |
| 342 | 342 | $render_type = new $type_class( $name, $setting, $curr_value ); |
| 343 | 343 | ob_start(); |
@@ -346,25 +346,25 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | // Check if setting is specific for a template |
| 349 | - if( !empty( $setting['show_in_template'] ) ) { |
|
| 350 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
| 351 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
| 349 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
| 350 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
| 351 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
| 352 | 352 | } |
| 353 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
| 353 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
| 354 | 354 | } else { |
| 355 | 355 | $show_if = ''; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - if( ! empty( $setting['requires'] ) ) { |
|
| 359 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
| 358 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
| 359 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if( ! empty( $setting['requires_not'] ) ) { |
|
| 363 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
| 362 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
| 363 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // output |
| 367 | - echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>'; |
|
| 367 | + echo '<tr valign="top" ' . $show_if . '>' . $output . '</tr>'; |
|
| 368 | 368 | |
| 369 | 369 | } |
| 370 | 370 | |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | public static function load_type_class( $field = NULL ) { |
| 378 | 378 | |
| 379 | - if( empty( $field['type'] ) ) { |
|
| 379 | + if ( empty( $field[ 'type' ] ) ) { |
|
| 380 | 380 | return NULL; |
| 381 | 381 | } |
| 382 | 382 | |
@@ -385,19 +385,19 @@ discard block |
||
| 385 | 385 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
| 386 | 386 | * @param array $field field data |
| 387 | 387 | */ |
| 388 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
| 388 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
| 389 | 389 | |
| 390 | - if( !class_exists( $type_class ) ) { |
|
| 390 | + if ( ! class_exists( $type_class ) ) { |
|
| 391 | 391 | |
| 392 | 392 | /** |
| 393 | 393 | * @filter `gravityview/setting/class_file/{field_type}` |
| 394 | 394 | * @param string $field_type_include_path field class file path |
| 395 | 395 | * @param array $field field data |
| 396 | 396 | */ |
| 397 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
| 397 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
| 398 | 398 | |
| 399 | - if( $class_file ) { |
|
| 400 | - if( file_exists( $class_file ) ) { |
|
| 399 | + if ( $class_file ) { |
|
| 400 | + if ( file_exists( $class_file ) ) { |
|
| 401 | 401 | require_once( $class_file ); |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -422,8 +422,8 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
| 424 | 424 | |
| 425 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
| 426 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
| 425 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
| 426 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
| 427 | 427 | |
| 428 | 428 | return $output; |
| 429 | 429 | } |
@@ -443,22 +443,22 @@ discard block |
||
| 443 | 443 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
| 444 | 444 | |
| 445 | 445 | // Show the merge tags if the field is a list view |
| 446 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 446 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 447 | 447 | |
| 448 | 448 | // Or is a single entry view |
| 449 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 449 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 450 | 450 | $show = ( $is_single || $is_list ); |
| 451 | 451 | |
| 452 | 452 | $class = ''; |
| 453 | 453 | // and $add_merge_tags is not false |
| 454 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 454 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 455 | 455 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
| 459 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
| 458 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
| 459 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
| 460 | 460 | |
| 461 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
| 461 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
@@ -475,21 +475,21 @@ discard block |
||
| 475 | 475 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
| 476 | 476 | |
| 477 | 477 | // Show the merge tags if the field is a list view |
| 478 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 478 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 479 | 479 | |
| 480 | 480 | // Or is a single entry view |
| 481 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 481 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 482 | 482 | $show = ( $is_single || $is_list ); |
| 483 | 483 | |
| 484 | 484 | $class = ''; |
| 485 | 485 | // and $add_merge_tags is not false |
| 486 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 486 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 487 | 487 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
| 490 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
| 491 | 491 | |
| 492 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
| 492 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | /** |
@@ -505,9 +505,9 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
| 507 | 507 | |
| 508 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
| 509 | - foreach( $choices as $value => $label ) { |
|
| 510 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
| 508 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
| 509 | + foreach ( $choices as $value => $label ) { |
|
| 510 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
| 511 | 511 | } |
| 512 | 512 | $output .= '</select>'; |
| 513 | 513 | |
@@ -28,18 +28,18 @@ |
||
| 28 | 28 | |
| 29 | 29 | $sort_fields_input = '<select name="template_settings[sort_field][]" class="gravityview_sort_field" id="gravityview_sort_field_%d">%s</select>'; |
| 30 | 30 | |
| 31 | - if ( is_array( $current_settings['sort_field'] ) ) { |
|
| 32 | - $primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][0] ); |
|
| 33 | - $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][1] ); |
|
| 31 | + if ( is_array( $current_settings[ 'sort_field' ] ) ) { |
|
| 32 | + $primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 0 ] ); |
|
| 33 | + $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 1 ] ); |
|
| 34 | 34 | } else { |
| 35 | - $primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ); |
|
| 35 | + $primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ] ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Splice the sort direction |
| 39 | 39 | $_directions = array(); |
| 40 | 40 | foreach ( (array)\GV\Utils::get( $current_settings, 'sort_direction', array() ) as $i => $direction ) { |
| 41 | 41 | if ( ! $i ) { |
| 42 | - $_directions['sort_direction'] = $direction; |
|
| 42 | + $_directions[ 'sort_direction' ] = $direction; |
|
| 43 | 43 | } else { |
| 44 | 44 | $_directions[ sprintf( 'sort_direction_%d', $i + 1 ) ] = $direction; |
| 45 | 45 | } |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @see add_columns_sort_links |
| 143 | 143 | * @param string $url Single-sort URL |
| 144 | - * @param array $sort_args Single sorting for rules, in [ field_id, dir ] format |
|
| 145 | - * @param string|int $field_id ID of the current field being displayed |
|
| 144 | + * @param string[] $sort_args Single sorting for rules, in [ field_id, dir ] format |
|
| 145 | + * @param string $field_id ID of the current field being displayed |
|
| 146 | 146 | * |
| 147 | 147 | * @return string Multisort URL, if there are multiple sorts. Otherwise, existing $url |
| 148 | 148 | */ |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * Output a field cell. |
| 347 | 347 | * |
| 348 | 348 | * @param \GV\Field $field The field to be ouput. |
| 349 | - * @param \GV\Field $entry The entry this field is for. |
|
| 349 | + * @param Entry $entry The entry this field is for. |
|
| 350 | 350 | * |
| 351 | 351 | * @return void |
| 352 | 352 | */ |
@@ -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 ( ! \GravityView_frontend::getInstance()->is_field_sortable( $context->field->ID, $context->view->form->form ) ) { |
@@ -102,22 +102,22 @@ discard block |
||
| 102 | 102 | // If we are already sorting by the current field... |
| 103 | 103 | if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
| 104 | 104 | |
| 105 | - switch( $sorting['direction'] ) { |
|
| 106 | - // No sort |
|
| 107 | - case '': |
|
| 108 | - $sort_args[1] = 'asc'; |
|
| 109 | - $class .= ' gv-icon-caret-up-down'; |
|
| 110 | - break; |
|
| 111 | - case 'desc': |
|
| 112 | - $sort_args[1] = ''; |
|
| 113 | - $class .= ' gv-icon-sort-asc'; |
|
| 114 | - break; |
|
| 115 | - case 'asc': |
|
| 116 | - default: |
|
| 117 | - $sort_args[1] = 'desc'; |
|
| 118 | - $class .= ' gv-icon-sort-desc'; |
|
| 119 | - break; |
|
| 120 | - } |
|
| 105 | + switch( $sorting['direction'] ) { |
|
| 106 | + // No sort |
|
| 107 | + case '': |
|
| 108 | + $sort_args[1] = 'asc'; |
|
| 109 | + $class .= ' gv-icon-caret-up-down'; |
|
| 110 | + break; |
|
| 111 | + case 'desc': |
|
| 112 | + $sort_args[1] = ''; |
|
| 113 | + $class .= ' gv-icon-sort-asc'; |
|
| 114 | + break; |
|
| 115 | + case 'asc': |
|
| 116 | + default: |
|
| 117 | + $sort_args[1] = 'desc'; |
|
| 118 | + $class .= ' gv-icon-sort-desc'; |
|
| 119 | + break; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } else { |
| 123 | 123 | $class .= ' gv-icon-caret-up-down'; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $url = remove_query_arg( 'sort', $url ); |
| 128 | 128 | $multisort_url = self::_get_multisort_url( $url, $sort_args, $context->field->ID ); |
| 129 | 129 | |
| 130 | - $url = add_query_arg( $sort_args[0], $sort_args[1], $url ); |
|
| 130 | + $url = add_query_arg( $sort_args[0], $sort_args[1], $url ); |
|
| 131 | 131 | |
| 132 | 132 | $return = '<a href="'. esc_url_raw( $url ) .'"'; |
| 133 | 133 | |
@@ -141,50 +141,50 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | - * Get the multi-sort URL used in the sorting links |
|
| 145 | - * |
|
| 146 | - * @todo Consider moving to Utils? |
|
| 147 | - * |
|
| 148 | - * @since 2.3 |
|
| 149 | - * |
|
| 150 | - * @see add_columns_sort_links |
|
| 144 | + * Get the multi-sort URL used in the sorting links |
|
| 145 | + * |
|
| 146 | + * @todo Consider moving to Utils? |
|
| 147 | + * |
|
| 148 | + * @since 2.3 |
|
| 149 | + * |
|
| 150 | + * @see add_columns_sort_links |
|
| 151 | 151 | * @param string $url Single-sort URL |
| 152 | 152 | * @param array $sort_args Single sorting for rules, in [ field_id, dir ] format |
| 153 | - * @param string|int $field_id ID of the current field being displayed |
|
| 154 | - * |
|
| 155 | - * @return string Multisort URL, if there are multiple sorts. Otherwise, existing $url |
|
| 153 | + * @param string|int $field_id ID of the current field being displayed |
|
| 154 | + * |
|
| 155 | + * @return string Multisort URL, if there are multiple sorts. Otherwise, existing $url |
|
| 156 | 156 | */ |
| 157 | 157 | static public function _get_multisort_url( $url, $sort_args, $field_id ) { |
| 158 | 158 | |
| 159 | 159 | $sorts = Utils::_GET( 'sort' ); |
| 160 | 160 | |
| 161 | 161 | if ( ! is_array( $sorts ) ) { |
| 162 | - return $url; |
|
| 162 | + return $url; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $multisort_url = $url; |
|
| 165 | + $multisort_url = $url; |
|
| 166 | 166 | |
| 167 | 167 | // If the field has already been sorted by, add the field to the URL |
| 168 | - if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
|
| 169 | - if ( count( $keys ) ) { |
|
| 170 | - $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
|
| 171 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 172 | - } else { |
|
| 173 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - // Otherwise, we are just updating the sort order |
|
| 177 | - else { |
|
| 178 | - |
|
| 179 | - // Pass empty value to unset |
|
| 180 | - if( '' === $sort_args[1] ) { |
|
| 181 | - unset( $sorts[ $field_id ] ); |
|
| 182 | - } else { |
|
| 183 | - $sorts[ $field_id ] = $sort_args[1]; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
|
| 187 | - } |
|
| 168 | + if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
|
| 169 | + if ( count( $keys ) ) { |
|
| 170 | + $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
|
| 171 | + $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 172 | + } else { |
|
| 173 | + $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + // Otherwise, we are just updating the sort order |
|
| 177 | + else { |
|
| 178 | + |
|
| 179 | + // Pass empty value to unset |
|
| 180 | + if( '' === $sort_args[1] ) { |
|
| 181 | + unset( $sorts[ $field_id ] ); |
|
| 182 | + } else { |
|
| 183 | + $sorts[ $field_id ] = $sort_args[1]; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | return $multisort_url; |
| 190 | 190 | } |
@@ -214,10 +214,10 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | - * Returns the label for a column, with support for all deprecated filters |
|
| 218 | - * |
|
| 219 | - * @since 2.1 |
|
| 220 | - * |
|
| 217 | + * Returns the label for a column, with support for all deprecated filters |
|
| 218 | + * |
|
| 219 | + * @since 2.1 |
|
| 220 | + * |
|
| 221 | 221 | * @param \GV\Field $field |
| 222 | 222 | * @param \GV\Template_Context $context |
| 223 | 223 | */ |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $column_label = apply_filters( 'gravityview/template/field/label', $column_label, $context ); |
| 241 | 241 | |
| 242 | 242 | return $column_label; |
| 243 | - } |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * Output the entry row. |
@@ -309,15 +309,15 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | do_action( 'gravityview/template/table/cells/before', $context ); |
| 311 | 311 | |
| 312 | - /** |
|
| 313 | - * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
| 314 | - * @since 1.0.7 |
|
| 312 | + /** |
|
| 313 | + * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
| 314 | + * @since 1.0.7 |
|
| 315 | 315 | * @param \GravityView_View $this Current GravityView_View object |
| 316 | 316 | * @deprecated Use `gravityview/template/table/cells/before` |
| 317 | - */ |
|
| 318 | - do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
| 317 | + */ |
|
| 318 | + do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
| 319 | 319 | |
| 320 | - foreach ( $fields->all() as $field ) { |
|
| 320 | + foreach ( $fields->all() as $field ) { |
|
| 321 | 321 | if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) { |
| 322 | 322 | if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) { |
| 323 | 323 | $field = $this->view->unions[ $entry['form_id'] ][ $field->ID ]; |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | do_action( 'gravityview/template/table/cells/after', $context ); |
| 339 | 339 | |
| 340 | - /** |
|
| 341 | - * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
| 342 | - * @since 1.0.7 |
|
| 340 | + /** |
|
| 341 | + * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
| 342 | + * @since 1.0.7 |
|
| 343 | 343 | * @param \GravityView_View $this Current GravityView_View object |
| 344 | 344 | * @deprecated Use `gravityview/template/table/cells/after` |
| 345 | - */ |
|
| 346 | - do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
| 345 | + */ |
|
| 346 | + do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
| 347 | 347 | |
| 348 | 348 | ?> |
| 349 | 349 | </tr> |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | 'value' => $value, |
| 385 | 385 | 'hide_empty' => false, |
| 386 | 386 | 'zone_id' => 'directory_table-columns', |
| 387 | - 'label' => self::get_field_column_label( $field, $context ), |
|
| 387 | + 'label' => self::get_field_column_label( $field, $context ), |
|
| 388 | 388 | 'markup' => '<td id="{{ field_id }}" class="{{ class }}" data-label="{{label_value:data-label}}">{{ value }}</td>', |
| 389 | - 'form' => $form, |
|
| 389 | + 'form' => $form, |
|
| 390 | 390 | ); |
| 391 | 391 | |
| 392 | 392 | /** Output. */ |
@@ -411,11 +411,11 @@ discard block |
||
| 411 | 411 | do_action( 'gravityview/template/table/body/before', $context ); |
| 412 | 412 | |
| 413 | 413 | /** |
| 414 | - * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
| 415 | - * @deprecated Use `gravityview/template/table/body/before` |
|
| 416 | - * @since 1.0.7 |
|
| 417 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 418 | - */ |
|
| 414 | + * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
| 415 | + * @deprecated Use `gravityview/template/table/body/before` |
|
| 416 | + * @since 1.0.7 |
|
| 417 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 418 | + */ |
|
| 419 | 419 | do_action( 'gravityview_table_body_before', \GravityView_View::getInstance() /** ugh! */ ); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -437,11 +437,11 @@ discard block |
||
| 437 | 437 | do_action( 'gravityview/template/table/body/after', $context ); |
| 438 | 438 | |
| 439 | 439 | /** |
| 440 | - * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
| 441 | - * @deprecated Use `gravityview/template/table/body/after` |
|
| 442 | - * @since 1.0.7 |
|
| 443 | - * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 444 | - */ |
|
| 440 | + * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
| 441 | + * @deprecated Use `gravityview/template/table/body/after` |
|
| 442 | + * @since 1.0.7 |
|
| 443 | + * @param \GravityView_View $gravityview_view Current GravityView_View object. |
|
| 444 | + */ |
|
| 445 | 445 | do_action( 'gravityview_table_body_after', \GravityView_View::getInstance() /** ugh! */ ); |
| 446 | 446 | } |
| 447 | 447 | |
@@ -69,22 +69,22 @@ discard block |
||
| 69 | 69 | if ( is_array( $sorts ) ) { |
| 70 | 70 | foreach ( (array)$sorts as $key => $direction ) { |
| 71 | 71 | if ( $key == $context->field->ID ) { |
| 72 | - $sorting['key'] = $context->field->ID; |
|
| 73 | - $sorting['direction'] = strtolower( $direction ); |
|
| 72 | + $sorting[ 'key' ] = $context->field->ID; |
|
| 73 | + $sorting[ 'direction' ] = strtolower( $direction ); |
|
| 74 | 74 | break; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } else { |
| 78 | 78 | if ( $sorts == $context->field->ID ) { |
| 79 | - $sorting['key'] = $context->field->ID; |
|
| 80 | - $sorting['direction'] = strtolower( Utils::_GET( 'dir', '' ) ); |
|
| 79 | + $sorting[ 'key' ] = $context->field->ID; |
|
| 80 | + $sorting[ 'direction' ] = strtolower( Utils::_GET( 'dir', '' ) ); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | } else { |
| 84 | 84 | foreach ( (array)$context->view->settings->get( 'sort_field', array() ) as $i => $sort_field ) { |
| 85 | 85 | if ( $sort_field == $context->field->ID ) { |
| 86 | - $sorting['key'] = $sort_field; |
|
| 87 | - $sorting['direction'] = strtolower( Utils::get( $directions, $i, '' ) ); |
|
| 86 | + $sorting[ 'key' ] = $sort_field; |
|
| 87 | + $sorting[ 'direction' ] = strtolower( Utils::get( $directions, $i, '' ) ); |
|
| 88 | 88 | break; // Only get the first sort |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -100,21 +100,21 @@ discard block |
||
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | // If we are already sorting by the current field... |
| 103 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 103 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 104 | 104 | |
| 105 | - switch( $sorting['direction'] ) { |
|
| 105 | + switch ( $sorting[ 'direction' ] ) { |
|
| 106 | 106 | // No sort |
| 107 | 107 | case '': |
| 108 | - $sort_args[1] = 'asc'; |
|
| 108 | + $sort_args[ 1 ] = 'asc'; |
|
| 109 | 109 | $class .= ' gv-icon-caret-up-down'; |
| 110 | 110 | break; |
| 111 | 111 | case 'desc': |
| 112 | - $sort_args[1] = ''; |
|
| 112 | + $sort_args[ 1 ] = ''; |
|
| 113 | 113 | $class .= ' gv-icon-sort-asc'; |
| 114 | 114 | break; |
| 115 | 115 | case 'asc': |
| 116 | 116 | default: |
| 117 | - $sort_args[1] = 'desc'; |
|
| 117 | + $sort_args[ 1 ] = 'desc'; |
|
| 118 | 118 | $class .= ' gv-icon-sort-desc'; |
| 119 | 119 | break; |
| 120 | 120 | } |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | $url = remove_query_arg( 'sort', $url ); |
| 128 | 128 | $multisort_url = self::_get_multisort_url( $url, $sort_args, $context->field->ID ); |
| 129 | 129 | |
| 130 | - $url = add_query_arg( $sort_args[0], $sort_args[1], $url ); |
|
| 130 | + $url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $url ); |
|
| 131 | 131 | |
| 132 | - $return = '<a href="'. esc_url_raw( $url ) .'"'; |
|
| 132 | + $return = '<a href="' . esc_url_raw( $url ) . '"'; |
|
| 133 | 133 | |
| 134 | 134 | if ( ! empty( $multisort_url ) ) { |
| 135 | - $return .= ' data-multisort-href="'. esc_url_raw( $multisort_url ) . '"'; |
|
| 135 | + $return .= ' data-multisort-href="' . esc_url_raw( $multisort_url ) . '"'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $return .= ' class="'. $class .'" ></a> '. $column_label; |
|
| 138 | + $return .= ' class="' . $class . '" ></a> ' . $column_label; |
|
| 139 | 139 | |
| 140 | 140 | return $return; |
| 141 | 141 | } |
@@ -168,19 +168,19 @@ discard block |
||
| 168 | 168 | if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
| 169 | 169 | if ( count( $keys ) ) { |
| 170 | 170 | $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
| 171 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 171 | + $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url ); |
|
| 172 | 172 | } else { |
| 173 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 173 | + $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url ); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | // Otherwise, we are just updating the sort order |
| 177 | 177 | else { |
| 178 | 178 | |
| 179 | 179 | // Pass empty value to unset |
| 180 | - if( '' === $sort_args[1] ) { |
|
| 180 | + if ( '' === $sort_args[ 1 ] ) { |
|
| 181 | 181 | unset( $sorts[ $field_id ] ); |
| 182 | 182 | } else { |
| 183 | - $sorts[ $field_id ] = $sort_args[1]; |
|
| 183 | + $sorts[ $field_id ] = $sort_args[ 1 ]; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
@@ -318,9 +318,9 @@ discard block |
||
| 318 | 318 | do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
| 319 | 319 | |
| 320 | 320 | foreach ( $fields->all() as $field ) { |
| 321 | - if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) { |
|
| 322 | - if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) { |
|
| 323 | - $field = $this->view->unions[ $entry['form_id'] ][ $field->ID ]; |
|
| 321 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) { |
|
| 322 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) { |
|
| 323 | + $field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ]; |
|
| 324 | 324 | } else { |
| 325 | 325 | if ( ! $field instanceof Internal_Field ) { |
| 326 | 326 | $field = Internal_Field::from_configuration( array( 'id' => 'custom' ) ); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public static function get_instance() { |
| 96 | 96 | |
| 97 | - if( empty( self::$instance ) ) { |
|
| 97 | + if ( empty( self::$instance ) ) { |
|
| 98 | 98 | self::$instance = new self; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
| 130 | 130 | |
| 131 | - if( $with_values ) { |
|
| 131 | + if ( $with_values ) { |
|
| 132 | 132 | $operators_with_values = array(); |
| 133 | - foreach( $operators as $key ) { |
|
| 133 | + foreach ( $operators as $key ) { |
|
| 134 | 134 | $operators_with_values[ $key ] = ''; |
| 135 | 135 | } |
| 136 | 136 | return $operators_with_values; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $operators = $this->get_operators( false ); |
| 151 | 151 | |
| 152 | - if( !in_array( $operation, $operators ) ) { |
|
| 152 | + if ( ! in_array( $operation, $operators ) ) { |
|
| 153 | 153 | gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) ); |
| 154 | 154 | return false; |
| 155 | 155 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | return null; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if( empty( $atts ) ) { |
|
| 204 | + if ( empty( $atts ) ) { |
|
| 205 | 205 | gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) ); |
| 206 | 206 | return null; |
| 207 | 207 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $setup = $this->setup_operation_and_comparison(); |
| 226 | 226 | |
| 227 | 227 | // We need an operation and comparison value |
| 228 | - if( ! $setup ) { |
|
| 228 | + if ( ! $setup ) { |
|
| 229 | 229 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
| 230 | 230 | return null; |
| 231 | 231 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $logged_in_match = ! $this->logged_in ^ is_user_logged_in(); // XNOR |
| 278 | 278 | |
| 279 | 279 | // Only logged-in match |
| 280 | - if( 1 === sizeof( $this->passed_atts ) ) { |
|
| 280 | + if ( 1 === sizeof( $this->passed_atts ) ) { |
|
| 281 | 281 | $this->is_match = $logged_in_match; |
| 282 | 282 | } else { |
| 283 | 283 | $this->is_match = $logged_in_match && $comparison_match; |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | private function get_output() { |
| 293 | 293 | |
| 294 | - if( $this->is_match ) { |
|
| 294 | + if ( $this->is_match ) { |
|
| 295 | 295 | $output = $this->content; |
| 296 | 296 | } else { |
| 297 | 297 | $output = $this->else_content; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @param string $output HTML/text output |
| 310 | 310 | * @param GVLogic_Shortcode $this This class |
| 311 | 311 | */ |
| 312 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 312 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 313 | 313 | |
| 314 | 314 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
| 315 | 315 | |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL ); |
| 330 | 330 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL ); |
| 331 | 331 | |
| 332 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 332 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 333 | 333 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
| 334 | 334 | |
| 335 | 335 | // The content is everything OTHER than the [else] |
| 336 | 336 | $this->content = $before_else_if; |
| 337 | 337 | |
| 338 | 338 | if ( ! $this->is_match ) { |
| 339 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 339 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 340 | 340 | $this->else_content = $elseif_content; |
| 341 | 341 | } else { |
| 342 | 342 | $this->else_content = $else_content; |
@@ -364,16 +364,16 @@ discard block |
||
| 364 | 364 | foreach ( $else_if_matches as $key => $else_if_match ) { |
| 365 | 365 | |
| 366 | 366 | // If $else_if_match[5] exists and has content, check for more shortcodes |
| 367 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 367 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 368 | 368 | |
| 369 | 369 | // If the logic passes, this is the value that should be used for $this->else_content |
| 370 | - $else_if_value = $else_if_match[5]; |
|
| 371 | - $check_elseif_match = $else_if_match[0]; |
|
| 370 | + $else_if_value = $else_if_match[ 5 ]; |
|
| 371 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
| 372 | 372 | |
| 373 | 373 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
| 374 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
| 375 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
| 376 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
| 374 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
| 375 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
| 376 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | // Process any remaining [else] tags |
| 393 | - return $this->process_elseif( $else_if_match[5] ); |
|
| 393 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | return false; |
@@ -417,11 +417,11 @@ discard block |
||
| 417 | 417 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
| 418 | 418 | |
| 419 | 419 | // Strip whitespace if it's not default false |
| 420 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
| 420 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 421 | 421 | |
| 422 | - if ( isset( $this->atts['logged_in'] ) ) { |
|
| 422 | + if ( isset( $this->atts[ 'logged_in' ] ) ) { |
|
| 423 | 423 | // Truthy |
| 424 | - if ( in_array( strtolower( $this->atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) { |
|
| 424 | + if ( in_array( strtolower( $this->atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) { |
|
| 425 | 425 | $this->logged_in = false; |
| 426 | 426 | } else { |
| 427 | 427 | $this->logged_in = true; |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
| 438 | 438 | |
| 439 | 439 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 440 | - unset( $this->atts['if'] ); |
|
| 440 | + unset( $this->atts[ 'if' ] ); |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if ( 'address' === \GV\Utils::get( $search_field, 'type' ) ) { |
| 62 | 62 | |
| 63 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
| 64 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
| 63 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
| 64 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
| 65 | 65 | $form = GravityView_View::getInstance()->getForm(); |
| 66 | 66 | |
| 67 | 67 | /** @var GF_Field_Address $address_field */ |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $choices = array(); |
| 71 | 71 | |
| 72 | 72 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
| 73 | - if( method_exists( $this, $method_name ) ) { |
|
| 73 | + if ( method_exists( $this, $method_name ) ) { |
|
| 74 | 74 | /** |
| 75 | 75 | * @uses GravityView_Field_Address::get_choices_country() |
| 76 | 76 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | $choices = $this->{$method_name}( $address_field, $form ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if( ! empty( $choices ) ) { |
|
| 82 | - $search_field['choices'] = $choices; |
|
| 83 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
| 81 | + if ( ! empty( $choices ) ) { |
|
| 82 | + $search_field[ 'choices' ] = $choices; |
|
| 83 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
| 84 | 84 | } else { |
| 85 | - $search_field['type'] = 'text'; |
|
| 86 | - $search_field['input'] = 'input_text'; |
|
| 85 | + $search_field[ 'type' ] = 'text'; |
|
| 86 | + $search_field[ 'input' ] = 'input_text'; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $country_choices = array(); |
| 110 | 110 | |
| 111 | 111 | foreach ( $countries as $key => $country ) { |
| 112 | - $country_choices[] = array( |
|
| 112 | + $country_choices[ ] = array( |
|
| 113 | 113 | 'value' => $country, |
| 114 | 114 | 'text' => $country, |
| 115 | 115 | ); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | private function get_choices_state( $address_field, $form ) { |
| 136 | 136 | |
| 137 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
| 137 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
| 138 | 138 | |
| 139 | 139 | $state_choices = array(); |
| 140 | 140 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | $states = GFCommon::get_canadian_provinces(); |
| 147 | 147 | break; |
| 148 | 148 | default: |
| 149 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
| 150 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
| 149 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
| 150 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
| 151 | 151 | break; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,19 +156,19 @@ discard block |
||
| 156 | 156 | $state_subchoices = array(); |
| 157 | 157 | |
| 158 | 158 | foreach ( $state as $key => $substate ) { |
| 159 | - $state_subchoices[] = array( |
|
| 159 | + $state_subchoices[ ] = array( |
|
| 160 | 160 | 'value' => is_numeric( $key ) ? $substate : $key, |
| 161 | 161 | 'text' => $substate, |
| 162 | 162 | ); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $state_choices[] = array( |
|
| 165 | + $state_choices[ ] = array( |
|
| 166 | 166 | 'text' => $key, |
| 167 | 167 | 'value' => $state_subchoices, |
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | 170 | } else { |
| 171 | - $state_choices[] = array( |
|
| 171 | + $state_choices[ ] = array( |
|
| 172 | 172 | 'value' => is_numeric( $key ) ? $state : $key, |
| 173 | 173 | 'text' => $state, |
| 174 | 174 | ); |
@@ -192,13 +192,13 @@ discard block |
||
| 192 | 192 | // Use the same inputs as the "text" input type allows |
| 193 | 193 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
| 194 | 194 | |
| 195 | - $input_types['street'] = $text_inputs; |
|
| 196 | - $input_types['street2'] = $text_inputs; |
|
| 197 | - $input_types['city'] = $text_inputs; |
|
| 195 | + $input_types[ 'street' ] = $text_inputs; |
|
| 196 | + $input_types[ 'street2' ] = $text_inputs; |
|
| 197 | + $input_types[ 'city' ] = $text_inputs; |
|
| 198 | 198 | |
| 199 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | - $input_types['zip'] = array( 'input_text' ); |
|
| 201 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 199 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
| 201 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 202 | 202 | |
| 203 | 203 | return $input_types; |
| 204 | 204 | } |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
| 220 | 220 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
| 221 | 221 | |
| 222 | - if( 'address' === $field_type && $input_id ) { |
|
| 222 | + if ( 'address' === $field_type && $input_id ) { |
|
| 223 | 223 | |
| 224 | 224 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
| 225 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 225 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 226 | 226 | $input_type = $address_field_name; |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -271,20 +271,20 @@ discard block |
||
| 271 | 271 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 272 | 272 | |
| 273 | 273 | // If this is NOT the full address field, return default options. |
| 274 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 274 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 275 | 275 | return $field_options; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if( 'edit' === $context ) { |
|
| 278 | + if ( 'edit' === $context ) { |
|
| 279 | 279 | return $field_options; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $add_options = array(); |
| 283 | 283 | |
| 284 | - $add_options['show_map_link'] = array( |
|
| 284 | + $add_options[ 'show_map_link' ] = array( |
|
| 285 | 285 | 'type' => 'checkbox', |
| 286 | 286 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 287 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 287 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 288 | 288 | 'value' => true, |
| 289 | 289 | 'merge_tags' => false, |
| 290 | 290 | ); |