@@ -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] ) : false; |
|
| 451 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
| 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 | ); |
@@ -519,21 +519,21 @@ discard block |
||
| 519 | 519 | function _gravityview_process_posted_fields() { |
| 520 | 520 | $fields = array(); |
| 521 | 521 | |
| 522 | - if( !empty( $_POST['fields'] ) ) { |
|
| 523 | - if ( ! is_array( $_POST['fields'] ) ) { |
|
| 522 | + if ( ! empty( $_POST[ 'fields' ] ) ) { |
|
| 523 | + if ( ! is_array( $_POST[ 'fields' ] ) ) { |
|
| 524 | 524 | |
| 525 | 525 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
| 526 | 526 | $fields_holder = array(); |
| 527 | - GVCommon::gv_parse_str( $_POST['fields'], $fields_holder ); |
|
| 527 | + GVCommon::gv_parse_str( $_POST[ 'fields' ], $fields_holder ); |
|
| 528 | 528 | |
| 529 | - if ( isset( $fields_holder['fields'] ) ) { |
|
| 530 | - $fields = $fields_holder['fields']; |
|
| 529 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
| 530 | + $fields = $fields_holder[ 'fields' ]; |
|
| 531 | 531 | } else { |
| 532 | 532 | do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | } else { |
| 536 | - $fields = $_POST['fields']; |
|
| 536 | + $fields = $_POST[ 'fields' ]; |
|
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | |
@@ -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( false === $column_id ) { |
|
| 122 | + if ( false === $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 | |