@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
| 33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
| 34 | 34 | |
| 35 | - if( file_exists( $template_css_path ) ) { |
|
| 35 | + if ( file_exists( $template_css_path ) ) { |
|
| 36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
| 37 | - do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' ); |
|
| 37 | + do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . esc_attr( $css_file ) . ')' ); |
|
| 38 | 38 | } else { |
| 39 | 39 | // Default: use GravityView CSS file |
| 40 | 40 | |
| 41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
| 42 | - if( '' === $dir_path ) { |
|
| 42 | + if ( '' === $dir_path ) { |
|
| 43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
| 47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
| 47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
| 84 | 84 | |
| 85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
| 85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
| 86 | 86 | |
| 87 | - if( empty( $permalink_args ) ) { |
|
| 87 | + if ( empty( $permalink_args ) ) { |
|
| 88 | 88 | return array(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
| 110 | 110 | |
| 111 | 111 | $output = ''; |
| 112 | - if( is_array( $current ) ) { |
|
| 113 | - if( in_array( $value, $current ) ) { |
|
| 112 | + if ( is_array( $current ) ) { |
|
| 113 | + if ( in_array( $value, $current ) ) { |
|
| 114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if( $echo ) { |
|
| 120 | + if ( $echo ) { |
|
| 121 | 121 | echo $output; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
| 128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | function gravityview_strip_whitespace( $string ) { |
| 173 | 173 | $string = normalize_whitespace( $string ); |
| 174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
| 174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @return string Included file contents |
| 186 | 186 | */ |
| 187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
| 188 | - if( ! file_exists( $file_path ) ) { |
|
| 188 | + if ( ! file_exists( $file_path ) ) { |
|
| 189 | 189 | do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path ); |
| 190 | 190 | return ''; |
| 191 | 191 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | $width = $height * 0.7586206897; |
| 205 | 205 | |
| 206 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
| 206 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
| 207 | 207 | $style = 'margin:10px 10px 10px 0;'; |
| 208 | 208 | $class = 'alignright'; |
| 209 | 209 | } else { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $class = 'alignleft'; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
| 214 | + return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | function gravityview_number_format( $number, $decimals = '' ) { |
| 235 | 235 | global $wp_locale; |
| 236 | 236 | |
| 237 | - if( '' === $decimals ) { |
|
| 237 | + if ( '' === $decimals ) { |
|
| 238 | 238 | |
| 239 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
| 239 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | 242 | * Calculate the position of the decimal point in the number |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $parts = parse_url( $value ); |
| 266 | 266 | |
| 267 | 267 | // No domain? Strange...show the original text. |
| 268 | - if( empty( $parts['host'] ) ) { |
|
| 268 | + if ( empty( $parts[ 'host' ] ) ) { |
|
| 269 | 269 | return $value; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -278,16 +278,16 @@ discard block |
||
| 278 | 278 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
| 279 | 279 | * If true: `http://example.com => example.com` |
| 280 | 280 | */ |
| 281 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
| 281 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
| 282 | 282 | |
| 283 | - if( isset( $parts['scheme'] ) ) { |
|
| 284 | - $return .= $parts['scheme']; |
|
| 283 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
| 284 | + $return .= $parts[ 'scheme' ]; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // The domain, which may contain a subdomain |
| 290 | - $domain = $parts['host']; |
|
| 290 | + $domain = $parts[ 'host' ]; |
|
| 291 | 291 | |
| 292 | 292 | /** |
| 293 | 293 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
| 296 | 296 | * If true: `www.example.com => example.com` |
| 297 | 297 | */ |
| 298 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
| 298 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
| 299 | 299 | |
| 300 | - if( $strip_www ) { |
|
| 301 | - $domain = str_replace('www.', '', $domain ); |
|
| 300 | + if ( $strip_www ) { |
|
| 301 | + $domain = str_replace( 'www.', '', $domain ); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | * If true: `http://demo.example.com => example.com` \n |
| 309 | 309 | * If false: `http://demo.example.com => demo.example.com` |
| 310 | 310 | */ |
| 311 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
| 311 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
| 312 | 312 | |
| 313 | - if( $strip_subdomains ) { |
|
| 313 | + if ( $strip_subdomains ) { |
|
| 314 | 314 | |
| 315 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
| 315 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
| 327 | 327 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
| 328 | 328 | */ |
| 329 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
| 329 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
| 330 | 330 | |
| 331 | - if( empty( $root_only ) ) { |
|
| 331 | + if ( empty( $root_only ) ) { |
|
| 332 | 332 | |
| 333 | - if( isset( $parts['path'] ) ) { |
|
| 334 | - $return .= $parts['path']; |
|
| 333 | + if ( isset( $parts[ 'path' ] ) ) { |
|
| 334 | + $return .= $parts[ 'path' ]; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
| 342 | 342 | * If true: `http://example.com/?query=example => example.com` |
| 343 | 343 | */ |
| 344 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
| 344 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
| 345 | 345 | |
| 346 | - if( empty( $strip_query_string ) ) { |
|
| 346 | + if ( empty( $strip_query_string ) ) { |
|
| 347 | 347 | |
| 348 | - if( isset( $parts['query'] ) ) { |
|
| 349 | - $return .= '?'.$parts['query']; |
|
| 348 | + if ( isset( $parts[ 'query' ] ) ) { |
|
| 349 | + $return .= '?' . $parts[ 'query' ]; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | } |
@@ -363,8 +363,8 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
| 365 | 365 | |
| 366 | - 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 ) ) { |
|
| 367 | - return $matches['domain']; |
|
| 366 | + 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 ) ) { |
|
| 367 | + return $matches[ 'domain' ]; |
|
| 368 | 368 | } else { |
| 369 | 369 | return $string_maybe_has_subdomain; |
| 370 | 370 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) { |
| 387 | 387 | |
| 388 | - if( |
|
| 388 | + if ( |
|
| 389 | 389 | ! isset( $value ) // If it's not set, it's empty! |
| 390 | 390 | || false === $value |
| 391 | 391 | || null === $value |
@@ -396,20 +396,20 @@ discard block |
||
| 396 | 396 | return true; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if( is_string( $value ) && $allow_string_booleans ) { |
|
| 399 | + if ( is_string( $value ) && $allow_string_booleans ) { |
|
| 400 | 400 | |
| 401 | 401 | $value = trim( $value ); |
| 402 | 402 | $value = strtolower( $value ); |
| 403 | 403 | |
| 404 | 404 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
| 405 | 405 | $value = true; |
| 406 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 406 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 407 | 407 | $value = false; |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | // If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false. |
| 412 | - if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 412 | + if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 413 | 413 | return false; |
| 414 | 414 | } |
| 415 | 415 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | // Use the original function, if exists. |
| 434 | 434 | // Requires WP 4.4+ |
| 435 | - if( function_exists( 'map_deep') ) { |
|
| 435 | + if ( function_exists( 'map_deep' ) ) { |
|
| 436 | 436 | return map_deep( $value, $callback ); |
| 437 | 437 | } |
| 438 | 438 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | $exploded = explode( '.', "{$field_id}" ); |
| 499 | 499 | |
| 500 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
| 500 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -538,13 +538,13 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
| 540 | 540 | |
| 541 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
| 541 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
| 542 | 542 | |
| 543 | 543 | $choices = array(); |
| 544 | 544 | |
| 545 | 545 | if ( is_array( $terms ) ) { |
| 546 | 546 | foreach ( $terms as $term_id => $term_name ) { |
| 547 | - $choices[] = array( |
|
| 547 | + $choices[ ] = array( |
|
| 548 | 548 | 'text' => $term_name, |
| 549 | 549 | 'value' => $term_id |
| 550 | 550 | ); |
@@ -568,21 +568,21 @@ discard block |
||
| 568 | 568 | function _gravityview_process_posted_fields() { |
| 569 | 569 | $fields = array(); |
| 570 | 570 | |
| 571 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
| 572 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
| 571 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 572 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
| 573 | 573 | |
| 574 | 574 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
| 575 | 575 | $fields_holder = array(); |
| 576 | - GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder ); |
|
| 576 | + GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder ); |
|
| 577 | 577 | |
| 578 | - if ( isset( $fields_holder['fields'] ) ) { |
|
| 579 | - $fields = $fields_holder['fields']; |
|
| 578 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
| 579 | + $fields = $fields_holder[ 'fields' ]; |
|
| 580 | 580 | } else { |
| 581 | 581 | do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | } else { |
| 585 | - $fields = $_POST['gv_fields']; |
|
| 585 | + $fields = $_POST[ 'gv_fields' ]; |
|
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |
@@ -12,10 +12,10 @@ |
||
| 12 | 12 | |
| 13 | 13 | $field_info_items = array(); |
| 14 | 14 | |
| 15 | - if( !empty( $this->item['description'] ) ) { |
|
| 15 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
| 16 | 16 | |
| 17 | - $field_info_items[] = array( |
|
| 18 | - 'value' => $this->item['description'] |
|
| 17 | + $field_info_items[ ] = array( |
|
| 18 | + 'value' => $this->item[ 'description' ] |
|
| 19 | 19 | ); |
| 20 | 20 | |
| 21 | 21 | } |
@@ -15,29 +15,29 @@ |
||
| 15 | 15 | $field_info_items = array(); |
| 16 | 16 | |
| 17 | 17 | // Fields with IDs, not like Source URL or Entry ID |
| 18 | - if( is_numeric( $this->id ) ) { |
|
| 18 | + if ( is_numeric( $this->id ) ) { |
|
| 19 | 19 | |
| 20 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
| 20 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
| 21 | 21 | |
| 22 | - $field_info_items[] = array( |
|
| 23 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
| 22 | + $field_info_items[ ] = array( |
|
| 23 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | - $field_info_items[] = array( |
|
| 27 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
| 26 | + $field_info_items[ ] = array( |
|
| 27 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if( !empty( $this->item['desc'] ) ) { |
|
| 33 | - $field_info_items[] = array( |
|
| 34 | - 'value' => $this->item['desc'] |
|
| 32 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
| 33 | + $field_info_items[ ] = array( |
|
| 34 | + 'value' => $this->item[ 'desc' ] |
|
| 35 | 35 | ); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
| 39 | - $field_info_items[] = array( |
|
| 40 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
| 38 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
| 39 | + $field_info_items[ ] = array( |
|
| 40 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
| 41 | 41 | 'class' => 'gv-sublabel' |
| 42 | 42 | ); |
| 43 | 43 | } |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) { |
| 48 | 48 | |
| 49 | 49 | // If not set, the entry hasn't started a workflow |
| 50 | - $has_workflow_step = isset( $entry['workflow_step'] ); |
|
| 50 | + $has_workflow_step = isset( $entry[ 'workflow_step' ] ); |
|
| 51 | 51 | |
| 52 | - if( $has_workflow_step ) { |
|
| 52 | + if ( $has_workflow_step ) { |
|
| 53 | 53 | |
| 54 | - $GFlow = new Gravity_Flow_API( $entry['form_id'] ); |
|
| 54 | + $GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] ); |
|
| 55 | 55 | |
| 56 | 56 | if ( $current_step = $GFlow->get_current_step( $entry ) ) { |
| 57 | 57 | $output = esc_html( $current_step->get_name() ); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | preg_match( '/workflow_step_status_(\d+)/', $key, $matches ); |
| 80 | 80 | |
| 81 | 81 | if ( ! empty( $matches ) ) { |
| 82 | - $workflow_step_id = intval( $matches[1] ); |
|
| 82 | + $workflow_step_id = intval( $matches[ 1 ] ); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return $workflow_step_id; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $return = $label; |
| 100 | 100 | |
| 101 | - if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) { |
|
| 101 | + if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) { |
|
| 102 | 102 | |
| 103 | 103 | $step = $this->get_workflow_step( $workflow_step_id ); |
| 104 | 104 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $workflow_step = $GFlow->get_step( $workflow_step_id ); |
| 130 | 130 | |
| 131 | - if( ! $GFlow || ! $workflow_step ) { |
|
| 131 | + if ( ! $GFlow || ! $workflow_step ) { |
|
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | foreach ( $search_fields as & $search_field ) { |
| 152 | 152 | |
| 153 | - if ( $this->name === $search_field['key'] ) { |
|
| 153 | + if ( $this->name === $search_field[ 'key' ] ) { |
|
| 154 | 154 | |
| 155 | 155 | $form_id = GravityView_View::getInstance()->getFormId(); |
| 156 | 156 | |
@@ -159,21 +159,21 @@ discard block |
||
| 159 | 159 | $choices = array(); |
| 160 | 160 | |
| 161 | 161 | foreach ( $workflow_steps as $step ) { |
| 162 | - $choices[] = array( |
|
| 162 | + $choices[ ] = array( |
|
| 163 | 163 | 'text' => $step->get_name(), |
| 164 | 164 | 'value' => $step->get_id(), |
| 165 | 165 | ); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $search_field['choices'] = $choices; |
|
| 168 | + $search_field[ 'choices' ] = $choices; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // Workflow Step Statuses |
| 172 | - else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) { |
|
| 172 | + else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) { |
|
| 173 | 173 | |
| 174 | 174 | $status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id ); |
| 175 | 175 | |
| 176 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
| 176 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
| 43 | 43 | |
| 44 | - if( ! empty( $output ) ) { |
|
| 44 | + if ( ! empty( $output ) ) { |
|
| 45 | 45 | $output = gravity_flow()->translate_status_label( $output ); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | function modify_search_filters( $search_fields = array(), GravityView_Widget_Search $widget, $widget_args = array() ) { |
| 60 | 60 | |
| 61 | 61 | foreach ( $search_fields as & $search_field ) { |
| 62 | - if ( $this->name === $search_field['key'] ) { |
|
| 63 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 62 | + if ( $this->name === $search_field[ 'key' ] ) { |
|
| 63 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | parent::add_hooks(); |
| 35 | 35 | |
| 36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
| 36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
| 54 | 54 | |
| 55 | - if( empty( $form_id ) ) { |
|
| 55 | + if ( empty( $form_id ) ) { |
|
| 56 | 56 | $form_id = GravityView_View::getInstance()->getFormId(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
| 60 | 60 | |
| 61 | - return (array) rgars( $entry_meta, $status_key . '/filter/choices' ); |
|
| 61 | + return (array)rgars( $entry_meta, $status_key . '/filter/choices' ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $workflow_steps = $GFlow->get_steps(); |
| 82 | 82 | |
| 83 | - if( $workflow_steps ) { |
|
| 83 | + if ( $workflow_steps ) { |
|
| 84 | 84 | |
| 85 | 85 | foreach ( $workflow_steps as $step ) { |
| 86 | 86 | |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $fields['workflow_step'] = array( |
|
| 95 | + $fields[ 'workflow_step' ] = array( |
|
| 96 | 96 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
| 97 | 97 | 'type' => 'select', |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - $fields['workflow_final_status'] = array( |
|
| 100 | + $fields[ 'workflow_final_status' ] = array( |
|
| 101 | 101 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
| 102 | 102 | 'type' => 'select', |
| 103 | 103 | ); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $return = $input_type; |
| 47 | 47 | |
| 48 | - if( 'survey' === $field_type ) { |
|
| 48 | + if ( 'survey' === $field_type ) { |
|
| 49 | 49 | $return = 'select'; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | public function fix_survey_fields( $fields ) { |
| 66 | 66 | |
| 67 | 67 | /** @var GF_Field $field */ |
| 68 | - foreach( $fields as &$field ) { |
|
| 69 | - if( 'survey' === $field->type ) { |
|
| 68 | + foreach ( $fields as &$field ) { |
|
| 69 | + if ( 'survey' === $field->type ) { |
|
| 70 | 70 | $field->allowsPrepopulate = true; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @return void |
| 83 | 83 | */ |
| 84 | 84 | function add_render_hooks() { |
| 85 | - add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 ); |
|
| 85 | + add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 ); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | function remove_render_hooks() { |
| 98 | - remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 ); |
|
| 98 | + remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function fix_survey_field_value( $value, $field, $name ) { |
| 115 | 115 | |
| 116 | - if( 'survey' === $field->type ) { |
|
| 116 | + if ( 'survey' === $field->type ) { |
|
| 117 | 117 | |
| 118 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
| 118 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
| 119 | 119 | |
| 120 | 120 | // We need to run through each survey row until we find a match for expected values |
| 121 | 121 | foreach ( $entry as $field_id => $field_value ) { |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
| 127 | + if ( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
| 128 | 128 | list( $row_val, $col_val ) = explode( ':', $field_value, 2 ); |
| 129 | 129 | |
| 130 | 130 | // If the $name matches the $row_val, we are processing the correct row |
| 131 | - if( $row_val === $name ) { |
|
| 131 | + if ( $row_val === $name ) { |
|
| 132 | 132 | $value = $field_value; |
| 133 | 133 | break; |
| 134 | 134 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | function __construct( $title = '', $item_id, $item = array(), $settings = array() ) { |
| 43 | 43 | |
| 44 | 44 | // Backward compat |
| 45 | - if ( ! empty( $item['type'] ) ) { |
|
| 46 | - $item['input_type'] = $item['type']; |
|
| 47 | - unset( $item['type'] ); |
|
| 45 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 46 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 47 | + unset( $item[ 'type' ] ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Prevent items from not having index set |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->item = $item; |
| 65 | 65 | $this->id = $item_id; |
| 66 | 66 | $this->settings = $settings; |
| 67 | - $this->label_type = $item['label_type']; |
|
| 67 | + $this->label_type = $item[ 'label_type' ]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | if ( $html ) { |
| 108 | 108 | |
| 109 | 109 | foreach ( $field_info_items as $item ) { |
| 110 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 110 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 111 | 111 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 112 | 112 | $output .= '<span class="' . $class . '">'; |
| 113 | - $output .= esc_html( $item['value'] ); |
|
| 113 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 114 | 114 | $output .= '</span>'; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -138,29 +138,29 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 140 | 140 | // TODO: Un-hack this |
| 141 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 141 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 142 | 142 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 143 | 143 | |
| 144 | 144 | // Should we show the icon that the field is being used as a link to single entry? |
| 145 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 145 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 146 | 146 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
| 147 | 147 | |
| 148 | 148 | // When a field label is empty, use the Field ID |
| 149 | 149 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 150 | 150 | |
| 151 | 151 | // If there's a custom label, and show label is checked, use that as the field heading |
| 152 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 153 | - $label = $this->settings['custom_label']; |
|
| 154 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 155 | - $label = $this->item['customLabel']; |
|
| 152 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 153 | + $label = $this->settings[ 'custom_label' ]; |
|
| 154 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 155 | + $label = $this->item[ 'customLabel' ]; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
| 159 | 159 | |
| 160 | 160 | $label = esc_attr( $label ); |
| 161 | 161 | |
| 162 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 163 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
| 162 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 163 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Name of field / widget |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $output .= '</h5>'; |
| 178 | 178 | |
| 179 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 179 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 180 | 180 | |
| 181 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
| 181 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 182 | 182 | |
| 183 | 183 | return $output; |
| 184 | 184 | } |
@@ -59,8 +59,8 @@ |
||
| 59 | 59 | |
| 60 | 60 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
| 61 | 61 | |
| 62 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 63 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 62 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 63 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 64 | 64 | |
| 65 | 65 | $sql = $wpdb->prepare( " |
| 66 | 66 | DELETE FROM $notes_table |