@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * Try subkeys after split. |
| 92 | 92 | */ |
| 93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
| 94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
| 94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public static function gf_query_debug( $query ) { |
| 146 | 146 | $introspect = $query->_introspect(); |
| 147 | 147 | return array( |
| 148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
| 148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -29,11 +29,11 @@ |
||
| 29 | 29 | $KWS_GF_Change_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
| 30 | 30 | |
| 31 | 31 | // Now, no validation is required in the methods; let's hook in. |
| 32 | - remove_action('admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) ); |
|
| 32 | + remove_action( 'admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) ); |
|
| 33 | 33 | |
| 34 | - remove_action("gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 ); |
|
| 34 | + remove_action( "gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 ); |
|
| 35 | 35 | |
| 36 | - remove_action("gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
| 36 | + remove_action( "gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function register_noconflict( $items ) { |
| 55 | 55 | |
| 56 | - $items[] = 'gravityview-admin-installer'; |
|
| 56 | + $items[ ] = 'gravityview-admin-installer'; |
|
| 57 | 57 | |
| 58 | 58 | return $items; |
| 59 | 59 | } |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) { |
|
| 75 | + add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) { |
|
| 76 | 76 | foreach ( $downloads_data as $extension ) { |
| 77 | - if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) { |
|
| 77 | + if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) { |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - return (object) array( |
|
| 82 | - 'slug' => $extension['info']['slug'], |
|
| 83 | - 'name' => $extension['info']['title'], |
|
| 84 | - 'version' => $extension['licensing']['version'], |
|
| 85 | - 'download_link' => $extension['files'][0]['file'], |
|
| 81 | + return (object)array( |
|
| 82 | + 'slug' => $extension[ 'info' ][ 'slug' ], |
|
| 83 | + 'name' => $extension[ 'info' ][ 'title' ], |
|
| 84 | + 'version' => $extension[ 'licensing' ][ 'version' ], |
|
| 85 | + 'download_link' => $extension[ 'files' ][ 0 ][ 'file' ], |
|
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | foreach ( $all_plugins as $path => $plugin ) { |
| 146 | 146 | |
| 147 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
| 147 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
| 151 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
| 152 | 152 | 'path' => $path, |
| 153 | - 'version' => $plugin['Version'], |
|
| 153 | + 'version' => $plugin[ 'Version' ], |
|
| 154 | 154 | 'activated' => is_plugin_active( $path ) |
| 155 | 155 | ); |
| 156 | 156 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | return $downloads_data; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if( \GV\Plugin::is_network_activated() ) { |
|
| 211 | + if ( \GV\Plugin::is_network_activated() ) { |
|
| 212 | 212 | $home_url = network_home_url(); |
| 213 | 213 | } else { |
| 214 | 214 | $home_url = home_url(); |
@@ -236,13 +236,13 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
| 238 | 238 | |
| 239 | - if ( empty( $downloads_data['products'] ) ) { |
|
| 239 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
| 240 | 240 | return array(); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
| 243 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
| 244 | 244 | |
| 245 | - return $downloads_data['products']; |
|
| 245 | + return $downloads_data[ 'products' ]; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | foreach ( $downloads_data as $extension ) { |
| 317 | 317 | |
| 318 | - if ( empty( $extension['info'] ) ) { |
|
| 318 | + if ( empty( $extension[ 'info' ] ) ) { |
|
| 319 | 319 | continue; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -344,29 +344,29 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
| 346 | 346 | |
| 347 | - $download_info = $details['download_info']; |
|
| 347 | + $download_info = $details[ 'download_info' ]; |
|
| 348 | 348 | |
| 349 | 349 | ?> |
| 350 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
| 350 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
| 351 | 351 | <div class="addon-inner"> |
| 352 | - <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a> |
|
| 353 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
| 352 | + <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a> |
|
| 353 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
| 354 | 354 | <div> |
| 355 | - <?php if( ! empty( $details['status_label'] ) ) { ?> |
|
| 356 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
| 357 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
| 355 | + <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?> |
|
| 356 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
| 357 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
| 358 | 358 | </div> |
| 359 | 359 | <?php } ?> |
| 360 | 360 | |
| 361 | - <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>"> |
|
| 362 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
| 363 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
| 361 | + <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>"> |
|
| 362 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
| 363 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
| 364 | 364 | </a> |
| 365 | 365 | </div> |
| 366 | 366 | |
| 367 | 367 | <div class="addon-excerpt"><?php |
| 368 | 368 | |
| 369 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 369 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
| 370 | 370 | |
| 371 | 371 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
| 372 | 372 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | private function get_download_display_details( $download, $wp_plugins ) { |
| 408 | 408 | |
| 409 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
| 409 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
| 410 | 410 | 'thumbnail' => '', |
| 411 | 411 | 'title' => '', |
| 412 | 412 | 'textdomain' => '', |
@@ -418,9 +418,9 @@ discard block |
||
| 418 | 418 | 'installer_excerpt' => null, // May not be defined |
| 419 | 419 | ) ); |
| 420 | 420 | |
| 421 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
| 421 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
| 422 | 422 | |
| 423 | - $has_access = ! empty( $download['files'] ); |
|
| 423 | + $has_access = ! empty( $download[ 'files' ] ); |
|
| 424 | 424 | $spinner = true; |
| 425 | 425 | $href = $plugin_path = '#'; |
| 426 | 426 | $status = $item_class = $button_title = $button_class = ''; |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
| 431 | 431 | |
| 432 | 432 | // The license is not active - no matter what level, this should not work |
| 433 | - if( ! $is_active && empty( $base_price ) ) { |
|
| 433 | + if ( ! $is_active && empty( $base_price ) ) { |
|
| 434 | 434 | $spinner = false; |
| 435 | 435 | $status_label = ''; |
| 436 | 436 | $button_class = 'disabled disabled-license'; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | $status_label = ''; |
| 444 | 444 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
| 445 | 445 | $button_class = 'button-primary button-large'; |
| 446 | - $href = $download_info['link']; |
|
| 446 | + $href = $download_info[ 'link' ]; |
|
| 447 | 447 | $item_class = 'featured'; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 459 | + elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) { |
|
| 460 | 460 | $spinner = false; |
| 461 | 461 | $status = 'notinstalled'; |
| 462 | 462 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -471,8 +471,8 @@ discard block |
||
| 471 | 471 | $href = add_query_arg( |
| 472 | 472 | array( |
| 473 | 473 | 'action' => 'install-plugin', |
| 474 | - 'plugin' => $download_info['slug'], |
|
| 475 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
| 474 | + 'plugin' => $download_info[ 'slug' ], |
|
| 475 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
| 476 | 476 | ), |
| 477 | 477 | self_admin_url( 'update.php' ) |
| 478 | 478 | ); |
@@ -484,25 +484,25 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | // Access and the plugin is installed but not active |
| 487 | - elseif ( false === $wp_plugin['activated'] ) { |
|
| 487 | + elseif ( false === $wp_plugin[ 'activated' ] ) { |
|
| 488 | 488 | $status = 'inactive'; |
| 489 | 489 | $status_label = __( 'Inactive', 'gravityview' ); |
| 490 | 490 | $button_label = __( 'Activate', 'gravityview' ); |
| 491 | - $plugin_path = $wp_plugin['path']; |
|
| 491 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 492 | 492 | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // Access and the plugin is installed and active |
| 496 | 496 | else { |
| 497 | 497 | |
| 498 | - $plugin_path = $wp_plugin['path']; |
|
| 498 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 499 | 499 | $status = 'active'; |
| 500 | 500 | $status_label = __( 'Active', 'gravityview' ); |
| 501 | 501 | $button_label = __( 'Deactivate', 'gravityview' ); |
| 502 | 502 | |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 505 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | /** |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
| 518 | 518 | $base_price = \GFCommon::to_number( $base_price ); |
| 519 | 519 | |
| 520 | - unset( $download['pricing']['amount'] ); |
|
| 520 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
| 521 | 521 | |
| 522 | 522 | // Price options array, not single price |
| 523 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
| 524 | - $base_price = array_shift( $download['pricing'] ); |
|
| 523 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
| 524 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | return floatval( $base_price ); |
@@ -535,13 +535,13 @@ discard block |
||
| 535 | 535 | public function activate_download() { |
| 536 | 536 | $data = \GV\Utils::_POST( 'data', array() ); |
| 537 | 537 | |
| 538 | - if ( empty( $data['path'] ) ) { |
|
| 538 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 539 | 539 | return; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - $result = activate_plugin( $data['path'] ); |
|
| 542 | + $result = activate_plugin( $data[ 'path' ] ); |
|
| 543 | 543 | |
| 544 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
| 544 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
| 545 | 545 | wp_send_json_error( array( |
| 546 | 546 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
| 547 | 547 | ) ); |
@@ -558,13 +558,13 @@ discard block |
||
| 558 | 558 | public function deactivate_download() { |
| 559 | 559 | $data = \GV\Utils::_POST( 'data', array() ); |
| 560 | 560 | |
| 561 | - if ( empty( $data['path'] ) ) { |
|
| 561 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 562 | 562 | return; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - deactivate_plugins( $data['path'] ); |
|
| 565 | + deactivate_plugins( $data[ 'path' ] ); |
|
| 566 | 566 | |
| 567 | - if( is_plugin_active( $data['path'] ) ) { |
|
| 567 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
| 568 | 568 | wp_send_json_error( array( |
| 569 | 569 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
| 570 | 570 | ) ); |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) { |
| 41 | 41 | |
| 42 | 42 | if ( in_array( $source_field, array( 'date_created', 'date_updated', 'payment_date' ), true ) ) { |
| 43 | - $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
|
| 44 | - $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
|
| 43 | + $field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value ); |
|
| 44 | + $target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ( $source_field instanceof GF_Field && $source_field->type == 'date' ) { |
| 48 | - $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
|
| 49 | - $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
|
| 48 | + $field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value ); |
|
| 49 | + $target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | if ( in_array( $_operation = str_replace( ' ', '_', trim( $operation ) ), array( 'in', 'not_in' ) ) ) { |
| 53 | - return GVCommon::matches_operation( (array) $field_value, (array) $target_value, $_operation ); |
|
| 53 | + return GVCommon::matches_operation( (array)$field_value, (array)$target_value, $_operation ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return parent::is_value_match( $field_value, $target_value, $operation, $source_field, $rule, $form ); |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $post_data = self::get_post_fields( $form, $entry ); |
| 76 | 76 | |
| 77 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 77 | + $media = get_attached_media( 'image', $entry[ 'post_id' ] ); |
|
| 78 | 78 | |
| 79 | 79 | $post_images = array(); |
| 80 | 80 | |
| 81 | 81 | foreach ( $media as $media_item ) { |
| 82 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 83 | - if( |
|
| 82 | + foreach ( (array)$post_data[ 'images' ] as $post_data_item ) { |
|
| 83 | + if ( |
|
| 84 | 84 | \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title && |
| 85 | 85 | \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content && |
| 86 | 86 | \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt |
| 87 | 87 | ) { |
| 88 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 88 | + $post_images[ "{$post_data_item[ 'field_id' ]}" ] = $media_item->ID; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * If the method changes to public, use Gravity Forms' method |
| 114 | 114 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 115 | 115 | */ |
| 116 | - if( $reflection->isPublic() ) { |
|
| 116 | + if ( $reflection->isPublic() ) { |
|
| 117 | 117 | return parent::get_post_fields( $form, $entry ); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * If the method changes to public, use Gravity Forms' method |
| 141 | 141 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 142 | 142 | */ |
| 143 | - if( $reflection->isPublic() ) { |
|
| 143 | + if ( $reflection->isPublic() ) { |
|
| 144 | 144 | return parent::copy_post_image( $url, $post_id ); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * If the method changes to public, use Gravity Forms' method |
| 176 | 176 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 177 | 177 | */ |
| 178 | - if( $reflection->isPublic() ) { |
|
| 178 | + if ( $reflection->isPublic() ) { |
|
| 179 | 179 | return parent::media_handle_upload( $url, $post_id, $post_data ); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * This allows us to fake it till we make it. |
| 110 | 110 | */ |
| 111 | 111 | $parameters = $view->settings->as_atts(); |
| 112 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
| 112 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
| 113 | 113 | $has_multisort = true; |
| 114 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
| 115 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
| 116 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
| 114 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
| 115 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
| 116 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | 'entries' => $entries, |
| 129 | 129 | 'request' => $request, |
| 130 | 130 | ), empty( $parameters ) ? array() : array( |
| 131 | - 'paging' => $parameters['paging'], |
|
| 132 | - 'sorting' => $parameters['sorting'], |
|
| 131 | + 'paging' => $parameters[ 'paging' ], |
|
| 132 | + 'sorting' => $parameters[ 'sorting' ], |
|
| 133 | 133 | ), empty( $post ) ? array() : array( |
| 134 | 134 | 'post' => $post, |
| 135 | 135 | ) ) ); |
@@ -15,34 +15,34 @@ |
||
| 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 | - if( !empty( $this->item['desc'] ) ) { |
|
| 32 | - $field_info_items[] = array( |
|
| 33 | - 'value' => $this->item['desc'] |
|
| 31 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
| 32 | + $field_info_items[ ] = array( |
|
| 33 | + 'value' => $this->item[ 'desc' ] |
|
| 34 | 34 | ); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
| 38 | - $field_info_items[] = array( |
|
| 39 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
| 37 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
| 38 | + $field_info_items[ ] = array( |
|
| 39 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
| 40 | 40 | 'class' => 'gv-sublabel' |
| 41 | 41 | ); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $field_info_items[] = array( |
|
| 45 | - 'value' => sprintf( __('Form ID: %s', 'gravityview' ), $this->form_id ), |
|
| 44 | + $field_info_items[ ] = array( |
|
| 45 | + 'value' => sprintf( __( 'Form ID: %s', 'gravityview' ), $this->form_id ), |
|
| 46 | 46 | 'hide_in_picker' => true, |
| 47 | 47 | ); |
| 48 | 48 | |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected $form_id; |
| 46 | 46 | |
| 47 | - function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null) { |
|
| 47 | + function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null ) { |
|
| 48 | 48 | |
| 49 | 49 | // Backward compat |
| 50 | - if ( ! empty( $item['type'] ) ) { |
|
| 51 | - $item['input_type'] = $item['type']; |
|
| 52 | - unset( $item['type'] ); |
|
| 50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 52 | + unset( $item[ 'type' ] ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Prevent items from not having index set |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->id = $item_id; |
| 72 | 72 | $this->form_id = $form_id; |
| 73 | 73 | $this->settings = $settings; |
| 74 | - $this->label_type = $item['label_type']; |
|
| 74 | + $this->label_type = $item[ 'label_type' ]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | foreach ( $field_info_items as $item ) { |
| 117 | 117 | |
| 118 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 118 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 122 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 123 | 123 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 124 | 124 | $output .= '<span class="' . $class . '">'; |
| 125 | - $output .= esc_html( $item['value'] ); |
|
| 125 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 126 | 126 | $output .= '</span>'; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -150,29 +150,29 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 152 | 152 | // TODO: Un-hack this |
| 153 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 153 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 154 | 154 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 155 | 155 | |
| 156 | 156 | // Should we show the icon that the field is being used as a link to single entry? |
| 157 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 157 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 158 | 158 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
| 159 | 159 | |
| 160 | 160 | // When a field label is empty, use the Field ID |
| 161 | 161 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 162 | 162 | |
| 163 | 163 | // If there's a custom label, and show label is checked, use that as the field heading |
| 164 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 165 | - $label = $this->settings['custom_label']; |
|
| 166 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 167 | - $label = $this->item['customLabel']; |
|
| 164 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 165 | + $label = $this->settings[ 'custom_label' ]; |
|
| 166 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 167 | + $label = $this->item[ 'customLabel' ]; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
| 171 | 171 | |
| 172 | 172 | $label = esc_attr( $label ); |
| 173 | 173 | |
| 174 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 175 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
| 174 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 175 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // Name of field / widget |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $output .= '</h5>'; |
| 190 | 190 | |
| 191 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 192 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 191 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 192 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 193 | 193 | |
| 194 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
| 194 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 195 | 195 | |
| 196 | 196 | return $output; |
| 197 | 197 | } |
@@ -58,16 +58,16 @@ |
||
| 58 | 58 | if ( $view->joins ) { |
| 59 | 59 | $form_ids = array(); |
| 60 | 60 | foreach ( $view->joins as $join ) { |
| 61 | - $form_ids[] = $join->join->ID; |
|
| 62 | - $form_ids[] = $join->join_on->ID; |
|
| 61 | + $form_ids[ ] = $join->join->ID; |
|
| 62 | + $form_ids[ ] = $join->join_on->ID; |
|
| 63 | 63 | } |
| 64 | 64 | foreach ( $entry->entries as $e ) { |
| 65 | - if ( ! in_array( $e['form_id'], $form_ids ) ) { |
|
| 65 | + if ( ! in_array( $e[ 'form_id' ], $form_ids ) ) { |
|
| 66 | 66 | gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $e->ID, 'view_id' => $view->ID ) ); |
| 67 | 67 | return null; |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - } else if ( $view->form && $view->form->ID != $entry['form_id'] ) { |
|
| 70 | + } else if ( $view->form && $view->form->ID != $entry[ 'form_id' ] ) { |
|
| 71 | 71 | gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $entry->ID, 'view_id' => $view->ID ) ); |
| 72 | 72 | return null; |
| 73 | 73 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ( ! $entry instanceof Entry ) { |
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | - $_entry->entries[ $entry['form_id'] ] = &$entry; |
|
| 47 | + $_entry->entries[ $entry[ 'form_id' ] ] = &$entry; |
|
| 48 | 48 | } |
| 49 | 49 | return $_entry; |
| 50 | 50 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | foreach ( $this->entries as $entry ) { |
| 67 | 67 | $entry = $entry->as_entry(); |
| 68 | - $_entry['_multi'][ $entry['form_id'] ] = $entry; |
|
| 68 | + $_entry[ '_multi' ][ $entry[ 'form_id' ] ] = $entry; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function get_permalink( \GV\View $view = null, \GV\Request $request = null, $track_directory = true ) { |
| 88 | 88 | $slugs = array(); |
| 89 | 89 | add_filter( 'gravityview/entry/slug', $callback = function( $slug ) use ( &$slugs ) { |
| 90 | - $slugs[] = $slug; |
|
| 90 | + $slugs[ ] = $slug; |
|
| 91 | 91 | return implode( ',', $slugs ); |
| 92 | 92 | }, 10, 1 ); |
| 93 | 93 | |