@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
| 38 | 38 | |
| 39 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
| 39 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
| 40 | 40 | |
| 41 | - if( empty( $permalink_args ) ) { |
|
| 41 | + if ( empty( $permalink_args ) ) { |
|
| 42 | 42 | return array(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
| 64 | 64 | |
| 65 | 65 | $output = ''; |
| 66 | - if( is_array( $current ) ) { |
|
| 67 | - if( in_array( $value, $current ) ) { |
|
| 66 | + if ( is_array( $current ) ) { |
|
| 67 | + if ( in_array( $value, $current ) ) { |
|
| 68 | 68 | $output = __checked_selected_helper( true, true, false, $type ); |
| 69 | 69 | } |
| 70 | 70 | } else { |
| 71 | 71 | $output = __checked_selected_helper( $value, $current, false, $type ); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if( $echo ) { |
|
| 74 | + if ( $echo ) { |
|
| 75 | 75 | echo $output; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 82 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | function gravityview_strip_whitespace( $string ) { |
| 127 | 127 | $string = normalize_whitespace( $string ); |
| 128 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
| 128 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @return string Included file contents |
| 140 | 140 | */ |
| 141 | 141 | function gravityview_ob_include( $file_path, $object = NULL ) { |
| 142 | - if( ! file_exists( $file_path ) ) { |
|
| 142 | + if ( ! file_exists( $file_path ) ) { |
|
| 143 | 143 | do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path ); |
| 144 | 144 | return ''; |
| 145 | 145 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | function gravityview_get_floaty() { |
| 157 | 157 | |
| 158 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
| 158 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
| 159 | 159 | $style = 'margin:10px 10px 10px 0;'; |
| 160 | 160 | $class = 'alignright'; |
| 161 | 161 | } else { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $class = 'alignleft'; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
| 166 | + return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="87" width="66" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | function gravityview_number_format( $number, $decimals = '' ) { |
| 187 | 187 | global $wp_locale; |
| 188 | 188 | |
| 189 | - if( '' === $decimals ) { |
|
| 189 | + if ( '' === $decimals ) { |
|
| 190 | 190 | |
| 191 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
| 191 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * Calculate the position of the decimal point in the number |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $parts = parse_url( $value ); |
| 218 | 218 | |
| 219 | 219 | // No domain? Strange...show the original text. |
| 220 | - if( empty( $parts['host'] ) ) { |
|
| 220 | + if ( empty( $parts[ 'host' ] ) ) { |
|
| 221 | 221 | return $value; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -230,16 +230,16 @@ discard block |
||
| 230 | 230 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
| 231 | 231 | * If true: `http://example.com => example.com` |
| 232 | 232 | */ |
| 233 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
| 233 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
| 234 | 234 | |
| 235 | - if( isset( $parts['scheme'] ) ) { |
|
| 236 | - $return .= $parts['scheme']; |
|
| 235 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
| 236 | + $return .= $parts[ 'scheme' ]; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | // The domain, which may contain a subdomain |
| 242 | - $domain = $parts['host']; |
|
| 242 | + $domain = $parts[ 'host' ]; |
|
| 243 | 243 | |
| 244 | 244 | /** |
| 245 | 245 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
| 248 | 248 | * If true: `www.example.com => example.com` |
| 249 | 249 | */ |
| 250 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
| 250 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
| 251 | 251 | |
| 252 | - if( $strip_www ) { |
|
| 253 | - $domain = str_replace('www.', '', $domain ); |
|
| 252 | + if ( $strip_www ) { |
|
| 253 | + $domain = str_replace( 'www.', '', $domain ); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | * If true: `http://demo.example.com => example.com` \n |
| 261 | 261 | * If false: `http://demo.example.com => demo.example.com` |
| 262 | 262 | */ |
| 263 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
| 263 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
| 264 | 264 | |
| 265 | - if( $strip_subdomains ) { |
|
| 265 | + if ( $strip_subdomains ) { |
|
| 266 | 266 | |
| 267 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
| 267 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
| 268 | 268 | |
| 269 | 269 | } |
| 270 | 270 | |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
| 279 | 279 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
| 280 | 280 | */ |
| 281 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
| 281 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
| 282 | 282 | |
| 283 | - if( empty( $root_only ) ) { |
|
| 283 | + if ( empty( $root_only ) ) { |
|
| 284 | 284 | |
| 285 | - if( isset( $parts['path'] ) ) { |
|
| 286 | - $return .= $parts['path']; |
|
| 285 | + if ( isset( $parts[ 'path' ] ) ) { |
|
| 286 | + $return .= $parts[ 'path' ]; |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
| 294 | 294 | * If true: `http://example.com/?query=example => example.com` |
| 295 | 295 | */ |
| 296 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
| 296 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
| 297 | 297 | |
| 298 | - if( empty( $strip_query_string ) ) { |
|
| 298 | + if ( empty( $strip_query_string ) ) { |
|
| 299 | 299 | |
| 300 | - if( isset( $parts['query'] ) ) { |
|
| 301 | - $return .= '?'.$parts['query']; |
|
| 300 | + if ( isset( $parts[ 'query' ] ) ) { |
|
| 301 | + $return .= '?' . $parts[ 'query' ]; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | } |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
| 317 | 317 | |
| 318 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
| 319 | - return $matches['domain']; |
|
| 318 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
| 319 | + return $matches[ 'domain' ]; |
|
| 320 | 320 | } else { |
| 321 | 321 | return $string_maybe_has_subdomain; |
| 322 | 322 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) { |
| 339 | 339 | |
| 340 | - if( |
|
| 340 | + if ( |
|
| 341 | 341 | ! isset( $value ) // If it's not set, it's empty! |
| 342 | 342 | || false === $value |
| 343 | 343 | || null === $value |
@@ -348,20 +348,20 @@ discard block |
||
| 348 | 348 | return true; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - if( is_string( $value ) && $allow_string_booleans ) { |
|
| 351 | + if ( is_string( $value ) && $allow_string_booleans ) { |
|
| 352 | 352 | |
| 353 | 353 | $value = trim( $value ); |
| 354 | 354 | $value = strtolower( $value ); |
| 355 | 355 | |
| 356 | 356 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
| 357 | 357 | $value = true; |
| 358 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 358 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 359 | 359 | $value = false; |
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | // If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false. |
| 364 | - if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 364 | + if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 365 | 365 | return false; |
| 366 | 366 | } |
| 367 | 367 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | function gv_map_deep( $value, $callback ) { |
| 384 | 384 | |
| 385 | 385 | // Use the original function, if exists. |
| 386 | - if( function_exists( 'map_deep') ) { |
|
| 386 | + if ( function_exists( 'map_deep' ) ) { |
|
| 387 | 387 | return map_deep( $value, $callback ); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | |
| 449 | 449 | $exploded = explode( '.', "{$field_id}" ); |
| 450 | 450 | |
| 451 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : 0; |
|
| 451 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : 0; |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /** |
@@ -489,13 +489,13 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
| 491 | 491 | |
| 492 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
| 492 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
| 493 | 493 | |
| 494 | 494 | $choices = array(); |
| 495 | 495 | |
| 496 | 496 | if ( is_array( $terms ) ) { |
| 497 | 497 | foreach ( $terms as $term_id => $term_name ) { |
| 498 | - $choices[] = array( |
|
| 498 | + $choices[ ] = array( |
|
| 499 | 499 | 'text' => $term_name, |
| 500 | 500 | 'value' => $term_id |
| 501 | 501 | ); |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 25 | 25 | |
| 26 | - if( 'edit' === $context ) { |
|
| 26 | + if ( 'edit' === $context ) { |
|
| 27 | 27 | return $field_options; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $this->add_field_support('date_display', $field_options ); |
|
| 30 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
| 52 | 52 | |
| 53 | 53 | $date_field_output = ''; |
| 54 | - switch( $field_input_id ) { |
|
| 54 | + switch ( $field_input_id ) { |
|
| 55 | 55 | case 1: |
| 56 | 56 | $date_field_output = rgar( $parsed_date, 'day' ); |
| 57 | 57 | break; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $list_rows = maybe_unserialize( $field_value ); |
| 62 | 62 | |
| 63 | - if( ! is_array( $list_rows ) ) { |
|
| 63 | + if ( ! is_array( $list_rows ) ) { |
|
| 64 | 64 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
| 65 | 65 | return null; |
| 66 | 66 | } |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | foreach ( $list_row as $column_key => $column_value ) { |
| 74 | 74 | |
| 75 | 75 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
| 76 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 77 | - $column_values[] = $column_value; |
|
| 76 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 77 | + $column_values[ ] = $column_value; |
|
| 78 | 78 | } |
| 79 | 79 | $current_column++; |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Return the array of values |
| 84 | - if( 'raw' === $format ) { |
|
| 84 | + if ( 'raw' === $format ) { |
|
| 85 | 85 | return $column_values; |
| 86 | 86 | } |
| 87 | 87 | // Return the Gravity Forms Field output |
@@ -104,22 +104,22 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function _filter_field_label( $label, $field, $form, $entry ) { |
| 106 | 106 | |
| 107 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 107 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 108 | 108 | |
| 109 | 109 | // Not a list field |
| 110 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
| 110 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
| 111 | 111 | return $label; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Custom label is defined, so use it |
| 115 | - if( ! empty( $field['custom_label'] ) ) { |
|
| 115 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 116 | 116 | return $label; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
| 119 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
| 120 | 120 | |
| 121 | 121 | // Parent field, not column field |
| 122 | - if( empty( $column_id ) ) { |
|
| 122 | + if ( empty( $column_id ) ) { |
|
| 123 | 123 | return $label; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
| 141 | 141 | |
| 142 | 142 | // Doesn't have columns enabled |
| 143 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 143 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 144 | 144 | return $backup_label; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
| 61 | 61 | |
| 62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
| 100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
| 101 | 101 | |
| 102 | 102 | // If the search is being sorted |
| 103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
| 103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
| 104 | 104 | |
| 105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
| 105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
| 109 | 109 | * @see modify_sort_id() |
| 110 | 110 | */ |
| 111 | - if( ! empty( $pieces[1] ) ) { |
|
| 111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
| 112 | 112 | |
| 113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
| 114 | - $this->_time_format = $pieces[1]; |
|
| 115 | - $this->_date_format = $pieces[2]; |
|
| 114 | + $this->_time_format = $pieces[ 1 ]; |
|
| 115 | + $this->_date_format = $pieces[ 2 ]; |
|
| 116 | 116 | |
| 117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
| 118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
| 118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
| 122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
| 123 | 123 | */ |
| 124 | - $criteria['sorting']['is_numeric'] = true; |
|
| 124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
| 125 | 125 | |
| 126 | 126 | // Modify the Gravity Forms WP Query |
| 127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | * then we want to modify the query. |
| 148 | 148 | * @see GFFormsModel::sort_by_field_query() |
| 149 | 149 | */ |
| 150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 151 | 151 | |
| 152 | - if( $this->_time_format === '24' ) { |
|
| 152 | + if ( $this->_time_format === '24' ) { |
|
| 153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
| 154 | 154 | } else { |
| 155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
| 195 | 195 | // Set variables |
| 196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
| 197 | 197 | |
| 198 | - if( 'edit' === $context ) { |
|
| 198 | + if ( 'edit' === $context ) { |
|
| 199 | 199 | return $field_options; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Set default date format based on field ID and Form ID |
| 204 | 204 | */ |
| 205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 206 | 206 | |
| 207 | - $this->add_field_support('date_display', $field_options ); |
|
| 207 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 208 | 208 | |
| 209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 210 | 210 | |
| 211 | 211 | return $field_options; |
| 212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | private function _get_time_format() { |
| 222 | 222 | global $post; |
| 223 | 223 | |
| 224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
| 224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
| 225 | 225 | |
| 226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
| 227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | // GF defaults to 12, so should we. |
| 241 | 241 | $time_format = '12'; |
| 242 | 242 | |
| 243 | - if( $form_id ) { |
|
| 243 | + if ( $form_id ) { |
|
| 244 | 244 | $form = GFAPI::get_form( $form_id ); |
| 245 | 245 | |
| 246 | 246 | if ( $form ) { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $default = 'h:i A'; |
| 288 | 288 | |
| 289 | 289 | // This doesn't take into account 24-hour |
| 290 | - switch( $field_input_id ) { |
|
| 290 | + switch ( $field_input_id ) { |
|
| 291 | 291 | // Hours |
| 292 | 292 | case 1: |
| 293 | 293 | return ( $time_format === '12' ) ? 'h' : 'H'; |