@@ -449,9 +449,7 @@ |
||
| 449 | 449 | $button_label = sprintf( __( 'Upgrade to %s for Access', 'gravityview' ), $required_license ); |
| 450 | 450 | $button_class = 'button-primary button-large'; |
| 451 | 451 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
| 452 | - } |
|
| 453 | - |
|
| 454 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 452 | + } elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 455 | 453 | $spinner = false; |
| 456 | 454 | $status = 'notinstalled'; |
| 457 | 455 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @param array $items Scripts or styles to exclude from no-conflict |
| 51 | 51 | * |
| 52 | - * @return array |
|
| 52 | + * @return string[] |
|
| 53 | 53 | */ |
| 54 | 54 | public function register_noconflict( $items ) { |
| 55 | 55 | |
@@ -326,6 +326,9 @@ discard block |
||
| 326 | 326 | <?php |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | + /** |
|
| 330 | + * @param string $section_slug |
|
| 331 | + */ |
|
| 329 | 332 | private function render_section( $section_slug, $heading, $downloads_data, $wp_plugins = array() ) { |
| 330 | 333 | |
| 331 | 334 | ob_start(); |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function add_downloads_data_filters() { |
| 68 | 68 | |
| 69 | - $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
|
| 69 | + $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
|
| 70 | 70 | |
| 71 | - if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
| 71 | + if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function add_admin_menu() { |
| 99 | 99 | |
| 100 | - $menu_text = _x( 'Manage Add-Ons', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
| 100 | + $menu_text = _x( 'Manage Add-Ons', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
| 101 | 101 | |
| 102 | 102 | $menu_text = sprintf( '<span title="%s" style="margin: 0">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text ); |
| 103 | 103 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * When on the Installer page, show a different notice than on the Settings page |
|
| 116 | - * |
|
| 115 | + * When on the Installer page, show a different notice than on the Settings page |
|
| 116 | + * |
|
| 117 | 117 | * @param array $notice |
| 118 | 118 | * |
| 119 | 119 | * @return string License notice |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | public function maybe_modify_license_notice( $notice = '' ) { |
| 122 | 122 | |
| 123 | 123 | if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) { |
| 124 | - return $notice; |
|
| 125 | - } |
|
| 124 | + return $notice; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 127 | + return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -162,43 +162,43 @@ discard block |
||
| 162 | 162 | * Get downloads data from transient or from API; save transient after getting data from API |
| 163 | 163 | * |
| 164 | 164 | * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: { |
| 165 | - * @type array $info { |
|
| 166 | - * @type string $id int 17 |
|
| 167 | - * @type string $slug Extension slug |
|
| 168 | - * @type string $title Extension title |
|
| 169 | - * @type string $create_date in '2018-07-19 20:03:10' format |
|
| 170 | - * @type string $modified_date |
|
| 171 | - * @type string $status |
|
| 172 | - * @type string $link URL to public plugin page |
|
| 173 | - * @type string $content |
|
| 174 | - * @type string $excerpt |
|
| 175 | - * @type string $thumbnail URL to thumbnail |
|
| 176 | - * @type array $category Taxonomy details for the plugin's category { |
|
| 177 | - * @type int $term_id => int 30 |
|
| 178 | - * @type string $name => string 'Plugins' (length=7) |
|
| 179 | - * @type string $slug => string 'plugins' (length=7) |
|
| 180 | - * @type int $term_group => int 0 |
|
| 181 | - * @type int $term_taxonomy_id => int 30 |
|
| 182 | - * @type string $taxonomy => string 'download_category' (length=17) |
|
| 183 | - * @type string $description => string '' (length=0) |
|
| 184 | - * @type int $parent => int 0 |
|
| 185 | - * @type int $count => int 4 |
|
| 186 | - * @type string $filter => string 'raw' (length=3) |
|
| 187 | - * } |
|
| 188 | - * @type array $tags {see $category above} |
|
| 189 | - * @type string $textdomain string 'gravityview' (length=11) |
|
| 190 | - * } |
|
| 191 | - * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
| 192 | - * @type array $licensing { |
|
| 193 | - * @type bool $enabled Is licensing enabled for the extension |
|
| 194 | - * @type string $version Version number |
|
| 195 | - * @type string $exp_unit Expiration unit ('years') |
|
| 196 | - * @type string $exp_length Expiration length ('1') |
|
| 197 | - * } |
|
| 198 | - * @type array $files Array of files. Empty if user has no access to the file. { |
|
| 199 | - * @type string $file string URL of the file download |
|
| 200 | - * } |
|
| 201 | - * } |
|
| 165 | + * @type array $info { |
|
| 166 | + * @type string $id int 17 |
|
| 167 | + * @type string $slug Extension slug |
|
| 168 | + * @type string $title Extension title |
|
| 169 | + * @type string $create_date in '2018-07-19 20:03:10' format |
|
| 170 | + * @type string $modified_date |
|
| 171 | + * @type string $status |
|
| 172 | + * @type string $link URL to public plugin page |
|
| 173 | + * @type string $content |
|
| 174 | + * @type string $excerpt |
|
| 175 | + * @type string $thumbnail URL to thumbnail |
|
| 176 | + * @type array $category Taxonomy details for the plugin's category { |
|
| 177 | + * @type int $term_id => int 30 |
|
| 178 | + * @type string $name => string 'Plugins' (length=7) |
|
| 179 | + * @type string $slug => string 'plugins' (length=7) |
|
| 180 | + * @type int $term_group => int 0 |
|
| 181 | + * @type int $term_taxonomy_id => int 30 |
|
| 182 | + * @type string $taxonomy => string 'download_category' (length=17) |
|
| 183 | + * @type string $description => string '' (length=0) |
|
| 184 | + * @type int $parent => int 0 |
|
| 185 | + * @type int $count => int 4 |
|
| 186 | + * @type string $filter => string 'raw' (length=3) |
|
| 187 | + * } |
|
| 188 | + * @type array $tags {see $category above} |
|
| 189 | + * @type string $textdomain string 'gravityview' (length=11) |
|
| 190 | + * } |
|
| 191 | + * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
| 192 | + * @type array $licensing { |
|
| 193 | + * @type bool $enabled Is licensing enabled for the extension |
|
| 194 | + * @type string $version Version number |
|
| 195 | + * @type string $exp_unit Expiration unit ('years') |
|
| 196 | + * @type string $exp_length Expiration length ('1') |
|
| 197 | + * } |
|
| 198 | + * @type array $files Array of files. Empty if user has no access to the file. { |
|
| 199 | + * @type string $file string URL of the file download |
|
| 200 | + * } |
|
| 201 | + * } |
|
| 202 | 202 | */ |
| 203 | 203 | public function get_downloads_data() { |
| 204 | 204 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | ) ); |
| 231 | 231 | |
| 232 | 232 | if ( is_wp_error( $response ) ) { |
| 233 | - gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
| 233 | + gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
| 234 | 234 | return $response; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | <div class="gv-admin-installer-notice notice inline error"> |
| 284 | 284 | <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3> |
| 285 | 285 | <?php |
| 286 | - if ( is_wp_error( $downloads_data ) ) { |
|
| 287 | - echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
| 288 | - } |
|
| 289 | - ?> |
|
| 286 | + if ( is_wp_error( $downloads_data ) ) { |
|
| 287 | + echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
| 288 | + } |
|
| 289 | + ?> |
|
| 290 | 290 | </div> |
| 291 | 291 | </div> |
| 292 | 292 | <?php |
@@ -362,9 +362,9 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | protected function render_download( $download, $wp_plugins ) { |
| 364 | 364 | |
| 365 | - $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
| 365 | + $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
| 366 | 366 | |
| 367 | - $download_info = $details['download_info']; |
|
| 367 | + $download_info = $details['download_info']; |
|
| 368 | 368 | |
| 369 | 369 | ?> |
| 370 | 370 | <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
@@ -386,43 +386,43 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | <div class="addon-excerpt"><?php |
| 388 | 388 | |
| 389 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 389 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 390 | 390 | |
| 391 | - // Allow some pure HTML tags, but remove everything else from the excerpt. |
|
| 392 | - $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
|
| 393 | - $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' ); |
|
| 391 | + // Allow some pure HTML tags, but remove everything else from the excerpt. |
|
| 392 | + $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
|
| 393 | + $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' ); |
|
| 394 | 394 | |
| 395 | - $excerpt = str_replace( $tags, $replacements, $excerpt ); |
|
| 396 | - $excerpt = esc_html( strip_tags( $excerpt ) ); |
|
| 395 | + $excerpt = str_replace( $tags, $replacements, $excerpt ); |
|
| 396 | + $excerpt = esc_html( strip_tags( $excerpt ) ); |
|
| 397 | 397 | $excerpt = str_replace( $replacements, $tags, $excerpt ); |
| 398 | 398 | |
| 399 | 399 | echo wpautop( $excerpt ); |
| 400 | - ?></div> |
|
| 400 | + ?></div> |
|
| 401 | 401 | </div> |
| 402 | 402 | </div> |
| 403 | 403 | <?php |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | - * Generates details array for the download to keep the render_download() method a bit tidier |
|
| 408 | - * |
|
| 407 | + * Generates details array for the download to keep the render_download() method a bit tidier |
|
| 408 | + * |
|
| 409 | 409 | * @param array $download Single download, as returned by {@see get_downloads_data} |
| 410 | 410 | * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()} |
| 411 | 411 | * |
| 412 | 412 | * @return array { |
| 413 | - * @type array $download_info |
|
| 414 | - * @type string $plugin_path |
|
| 415 | - * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
| 416 | - * @type string $status_label |
|
| 417 | - * @type string $button_title Title attribute to show when hovering over the download's button |
|
| 418 | - * @type string $button_class CSS class to use for the button |
|
| 419 | - * @type string $button_label Text to use for the download's anchor link |
|
| 420 | - * @type string $href URL for the download's button |
|
| 421 | - * @type bool $spinner Whether to show the spinner icon |
|
| 422 | - * @type string $item_class CSS class for the download container |
|
| 423 | - * @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions") |
|
| 424 | - * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
| 425 | - * } |
|
| 413 | + * @type array $download_info |
|
| 414 | + * @type string $plugin_path |
|
| 415 | + * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
| 416 | + * @type string $status_label |
|
| 417 | + * @type string $button_title Title attribute to show when hovering over the download's button |
|
| 418 | + * @type string $button_class CSS class to use for the button |
|
| 419 | + * @type string $button_label Text to use for the download's anchor link |
|
| 420 | + * @type string $href URL for the download's button |
|
| 421 | + * @type bool $spinner Whether to show the spinner icon |
|
| 422 | + * @type string $item_class CSS class for the download container |
|
| 423 | + * @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions") |
|
| 424 | + * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
| 425 | + * } |
|
| 426 | 426 | */ |
| 427 | 427 | private function get_download_display_details( $download, $wp_plugins ) { |
| 428 | 428 | |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | 'slug' => '', |
| 434 | 434 | 'excerpt' => '', |
| 435 | 435 | 'link' => '', |
| 436 | - 'coming_soon' => false, |
|
| 436 | + 'coming_soon' => false, |
|
| 437 | 437 | 'installer_title' => null, // May not be defined |
| 438 | 438 | 'installer_excerpt' => null, // May not be defined |
| 439 | 439 | ) ); |
@@ -476,14 +476,14 @@ discard block |
||
| 476 | 476 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 480 | - $spinner = false; |
|
| 481 | - $status = 'notinstalled'; |
|
| 482 | - $status_label = __( 'Coming Soon', 'gravityview' ); |
|
| 483 | - $button_label = __( 'Learn More', 'gravityview' ); |
|
| 484 | - $button_class = 'button-primary button-large'; |
|
| 485 | - $href = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' ); |
|
| 486 | - } |
|
| 479 | + elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 480 | + $spinner = false; |
|
| 481 | + $status = 'notinstalled'; |
|
| 482 | + $status_label = __( 'Coming Soon', 'gravityview' ); |
|
| 483 | + $button_label = __( 'Learn More', 'gravityview' ); |
|
| 484 | + $button_class = 'button-primary button-large'; |
|
| 485 | + $href = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' ); |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | 488 | // Access but the plugin is not installed |
| 489 | 489 | elseif ( ! $wp_plugin ) { |
@@ -523,18 +523,18 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
| 526 | - } |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | 528 | /** |
| 529 | - * Returns the base price for an extension |
|
| 530 | - * |
|
| 529 | + * Returns the base price for an extension |
|
| 530 | + * |
|
| 531 | 531 | * @param array $download |
| 532 | 532 | * |
| 533 | 533 | * @return float Base price for an extension. If not for sale separately, returns 0 |
| 534 | 534 | */ |
| 535 | 535 | private function get_download_base_price( $download ) { |
| 536 | 536 | |
| 537 | - $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
| 537 | + $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
| 538 | 538 | $base_price = \GFCommon::to_number( $base_price ); |
| 539 | 539 | |
| 540 | 540 | unset( $download['pricing']['amount'] ); |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | return floatval( $base_price ); |
| 548 | - } |
|
| 548 | + } |
|
| 549 | 549 | |
| 550 | 550 | /** |
| 551 | 551 | * Handle AJAX request to activate extension |
@@ -563,8 +563,8 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
| 565 | 565 | wp_send_json_error( array( |
| 566 | - 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
| 567 | - ) ); |
|
| 566 | + 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
| 567 | + ) ); |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | wp_send_json_success(); |
@@ -585,10 +585,10 @@ discard block |
||
| 585 | 585 | deactivate_plugins( $data['path'] ); |
| 586 | 586 | |
| 587 | 587 | if( is_plugin_active( $data['path'] ) ) { |
| 588 | - wp_send_json_error( array( |
|
| 589 | - 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
| 590 | - ) ); |
|
| 591 | - } |
|
| 588 | + wp_send_json_error( array( |
|
| 589 | + 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
| 590 | + ) ); |
|
| 591 | + } |
|
| 592 | 592 | |
| 593 | 593 | wp_send_json_success(); |
| 594 | 594 | } |
@@ -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 | } |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
| 70 | 70 | |
| 71 | - if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
| 71 | + if ( ! $downloads_data && ! isset( $_GET[ 'cache' ] ) ) { |
|
| 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 | } |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
| 206 | 206 | |
| 207 | - if ( $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
| 207 | + if ( $downloads_data && ! isset( $_GET[ 'cache' ] ) ) { |
|
| 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 | /** |
@@ -317,9 +317,9 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $this->render_section( 'extensions', esc_html__( 'GravityView Extensions', 'gravityview' ), $downloads_data, $wp_plugins ); |
| 319 | 319 | |
| 320 | - $this->render_section( 'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
| 320 | + $this->render_section( 'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
| 321 | 321 | |
| 322 | - $this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
| 322 | + $this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
| 323 | 323 | ?> |
| 324 | 324 | </div> |
| 325 | 325 | </div> |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | continue; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if ( empty( $download['info'] ) ) { |
|
| 339 | + if ( empty( $download[ 'info' ] ) ) { |
|
| 340 | 340 | continue; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -364,29 +364,29 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
| 366 | 366 | |
| 367 | - $download_info = $details['download_info']; |
|
| 367 | + $download_info = $details[ 'download_info' ]; |
|
| 368 | 368 | |
| 369 | 369 | ?> |
| 370 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
| 370 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
| 371 | 371 | <div class="addon-inner"> |
| 372 | - <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> |
|
| 373 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
| 372 | + <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> |
|
| 373 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
| 374 | 374 | <div> |
| 375 | - <?php if( ! empty( $details['status_label'] ) ) { ?> |
|
| 376 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
| 377 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
| 375 | + <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?> |
|
| 376 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
| 377 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
| 378 | 378 | </div> |
| 379 | 379 | <?php } ?> |
| 380 | 380 | |
| 381 | - <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'] ); ?>"> |
|
| 382 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
| 383 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
| 381 | + <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' ] ); ?>"> |
|
| 382 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
| 383 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
| 384 | 384 | </a> |
| 385 | 385 | </div> |
| 386 | 386 | |
| 387 | 387 | <div class="addon-excerpt"><?php |
| 388 | 388 | |
| 389 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 389 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
| 390 | 390 | |
| 391 | 391 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
| 392 | 392 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | */ |
| 427 | 427 | private function get_download_display_details( $download, $wp_plugins ) { |
| 428 | 428 | |
| 429 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
| 429 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
| 430 | 430 | 'thumbnail' => '', |
| 431 | 431 | 'title' => '', |
| 432 | 432 | 'textdomain' => '', |
@@ -438,9 +438,9 @@ discard block |
||
| 438 | 438 | 'installer_excerpt' => null, // May not be defined |
| 439 | 439 | ) ); |
| 440 | 440 | |
| 441 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
| 441 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
| 442 | 442 | |
| 443 | - $has_access = ! empty( $download['files'] ); |
|
| 443 | + $has_access = ! empty( $download[ 'files' ] ); |
|
| 444 | 444 | $spinner = true; |
| 445 | 445 | $href = $plugin_path = '#'; |
| 446 | 446 | $status = $item_class = $button_title = $button_class = ''; |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
| 451 | 451 | |
| 452 | 452 | // The license is not active - no matter what level, this should not work |
| 453 | - if( ! $is_active && empty( $base_price ) ) { |
|
| 453 | + if ( ! $is_active && empty( $base_price ) ) { |
|
| 454 | 454 | $spinner = false; |
| 455 | 455 | $status_label = ''; |
| 456 | 456 | $button_class = 'disabled disabled-license'; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $status_label = ''; |
| 464 | 464 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
| 465 | 465 | $button_class = 'button-primary button-large'; |
| 466 | - $href = $download_info['link']; |
|
| 466 | + $href = $download_info[ 'link' ]; |
|
| 467 | 467 | $item_class = 'featured'; |
| 468 | 468 | } |
| 469 | 469 | |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 479 | + elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) { |
|
| 480 | 480 | $spinner = false; |
| 481 | 481 | $status = 'notinstalled'; |
| 482 | 482 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -491,8 +491,8 @@ discard block |
||
| 491 | 491 | $href = add_query_arg( |
| 492 | 492 | array( |
| 493 | 493 | 'action' => 'install-plugin', |
| 494 | - 'plugin' => $download_info['slug'], |
|
| 495 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
| 494 | + 'plugin' => $download_info[ 'slug' ], |
|
| 495 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
| 496 | 496 | ), |
| 497 | 497 | self_admin_url( 'update.php' ) |
| 498 | 498 | ); |
@@ -504,25 +504,25 @@ discard block |
||
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // Access and the plugin is installed but not active |
| 507 | - elseif ( false === $wp_plugin['activated'] ) { |
|
| 507 | + elseif ( false === $wp_plugin[ 'activated' ] ) { |
|
| 508 | 508 | $status = 'inactive'; |
| 509 | 509 | $status_label = __( 'Inactive', 'gravityview' ); |
| 510 | 510 | $button_label = __( 'Activate', 'gravityview' ); |
| 511 | - $plugin_path = $wp_plugin['path']; |
|
| 511 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 512 | 512 | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | // Access and the plugin is installed and active |
| 516 | 516 | else { |
| 517 | 517 | |
| 518 | - $plugin_path = $wp_plugin['path']; |
|
| 518 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 519 | 519 | $status = 'active'; |
| 520 | 520 | $status_label = __( 'Active', 'gravityview' ); |
| 521 | 521 | $button_label = __( 'Deactivate', 'gravityview' ); |
| 522 | 522 | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 525 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | /** |
@@ -537,11 +537,11 @@ discard block |
||
| 537 | 537 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
| 538 | 538 | $base_price = \GFCommon::to_number( $base_price ); |
| 539 | 539 | |
| 540 | - unset( $download['pricing']['amount'] ); |
|
| 540 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
| 541 | 541 | |
| 542 | 542 | // Price options array, not single price |
| 543 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
| 544 | - $base_price = array_shift( $download['pricing'] ); |
|
| 543 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
| 544 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | return floatval( $base_price ); |
@@ -555,13 +555,13 @@ discard block |
||
| 555 | 555 | public function activate_download() { |
| 556 | 556 | $data = \GV\Utils::_POST( 'data', array() ); |
| 557 | 557 | |
| 558 | - if ( empty( $data['path'] ) ) { |
|
| 558 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 559 | 559 | return; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - $result = activate_plugin( $data['path'] ); |
|
| 562 | + $result = activate_plugin( $data[ 'path' ] ); |
|
| 563 | 563 | |
| 564 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
| 564 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
| 565 | 565 | wp_send_json_error( array( |
| 566 | 566 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
| 567 | 567 | ) ); |
@@ -578,13 +578,13 @@ discard block |
||
| 578 | 578 | public function deactivate_download() { |
| 579 | 579 | $data = \GV\Utils::_POST( 'data', array() ); |
| 580 | 580 | |
| 581 | - if ( empty( $data['path'] ) ) { |
|
| 581 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 582 | 582 | return; |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - deactivate_plugins( $data['path'] ); |
|
| 585 | + deactivate_plugins( $data[ 'path' ] ); |
|
| 586 | 586 | |
| 587 | - if( is_plugin_active( $data['path'] ) ) { |
|
| 587 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
| 588 | 588 | wp_send_json_error( array( |
| 589 | 589 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
| 590 | 590 | ) ); |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $gv_page = gravityview()->request->is_admin( '', 'single' ); |
| 79 | 79 | |
| 80 | 80 | // New View or Edit View page |
| 81 | - if( $gv_page && $pagenow === 'post-new.php' ) { |
|
| 81 | + if ( $gv_page && $pagenow === 'post-new.php' ) { |
|
| 82 | 82 | remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' ); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | parent::add_hooks(); |
| 69 | 69 | |
| 70 | - if( gravityview()->request->is_admin( '', null ) ) { |
|
| 70 | + if ( gravityview()->request->is_admin( '', null ) ) { |
|
| 71 | 71 | |
| 72 | 72 | // Make Yoast metabox go down to the bottom please. |
| 73 | 73 | add_filter( 'wpseo_metabox_prio', array( $this, 'return_low' ) ); |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function disable_content_analysis( $options ) { |
| 94 | 94 | |
| 95 | - $options['keyword_analysis_active'] = false; |
|
| 96 | - $options['content_analysis_active'] = false; |
|
| 95 | + $options[ 'keyword_analysis_active' ] = false; |
|
| 96 | + $options[ 'content_analysis_active' ] = false; |
|
| 97 | 97 | |
| 98 | 98 | return $options; |
| 99 | 99 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | global $pagenow; |
| 113 | 113 | |
| 114 | 114 | // New View page |
| 115 | - if( $pagenow === 'post-new.php' ) { |
|
| 116 | - $options['hideeditbox-gravityview'] = true; |
|
| 115 | + if ( $pagenow === 'post-new.php' ) { |
|
| 116 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return $options; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | $is_page = false; |
| 40 | 40 | |
| 41 | - if( function_exists( '\get_current_screen' ) || function_exists( 'get_current_screen' ) ) { |
|
| 41 | + if ( function_exists( '\get_current_screen' ) || function_exists( 'get_current_screen' ) ) { |
|
| 42 | 42 | $current_screen = \get_current_screen(); |
| 43 | 43 | } else { |
| 44 | 44 | $current_screen = false; |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | $is_page = 'single'; |
| 52 | 52 | } elseif ( $is_gv_settings = 'gravityview_page_gravityview_settings' === $current_screen->id ) { |
| 53 | 53 | $is_page = 'settings'; |
| 54 | - } elseif( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) { |
|
| 54 | + } elseif ( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) { |
|
| 55 | 55 | $is_page = 'downloads'; |
| 56 | - } elseif( $is_changelog = 'gravityview_page_gv-changelog' === $current_screen->id ) { |
|
| 56 | + } elseif ( $is_changelog = 'gravityview_page_gv-changelog' === $current_screen->id ) { |
|
| 57 | 57 | $is_page = 'changelog'; |
| 58 | - } elseif( $is_getting_started = 'gravityview_page_gv-getting-started' === $current_screen->id ) { |
|
| 58 | + } elseif ( $is_getting_started = 'gravityview_page_gv-getting-started' === $current_screen->id ) { |
|
| 59 | 59 | $is_page = 'getting-started'; |
| 60 | - } elseif( $is_credits = 'gravityview_page_gv-credits' === $current_screen->id ) { |
|
| 60 | + } elseif ( $is_credits = 'gravityview_page_gv-credits' === $current_screen->id ) { |
|
| 61 | 61 | $is_page = 'credits'; |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -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 | } |
@@ -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 | ) ) ); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if( is_array( $search_field['value'] ) ) { |
| 19 | - gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
|
| 19 | + gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
|
| 20 | 20 | $search_field['value'] = reset( $search_field['value'] ); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -10,14 +10,14 @@ discard block |
||
| 10 | 10 | $search_field = $gravityview_view->search_field; |
| 11 | 11 | |
| 12 | 12 | // Make sure that there are choices to display |
| 13 | -if( empty( $search_field['choices'] ) ) { |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | 14 | gravityview()->log->debug( 'search-field-select.php - No choices for field' ); |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if( is_array( $search_field['value'] ) ) { |
|
| 18 | +if ( is_array( $search_field[ 'value' ] ) ) { |
|
| 19 | 19 | gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
| 20 | - $search_field['value'] = reset( $search_field['value'] ); |
|
| 20 | + $search_field[ 'value' ] = reset( $search_field[ 'value' ] ); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -26,26 +26,26 @@ discard block |
||
| 26 | 26 | * @param string $default_option Default: `—` (—) |
| 27 | 27 | * @param string $field_type Field type: "select" or "multiselect" |
| 28 | 28 | */ |
| 29 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'select' ); |
|
| 29 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'select' ); |
|
| 30 | 30 | |
| 31 | 31 | ?> |
| 32 | 32 | <div class="gv-search-box gv-search-field-select"> |
| 33 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 34 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 33 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 34 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 35 | 35 | <?php } ?> |
| 36 | 36 | <p> |
| 37 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
| 38 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
| 37 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"> |
|
| 38 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
| 39 | 39 | <?php |
| 40 | - foreach( $search_field['choices'] as $choice ) { ?> |
|
| 41 | - <?php if ( is_array( $choice['value'] ) ) { ?> |
|
| 42 | - <optgroup label="<?php echo esc_attr( $choice['text'] ); ?>"> |
|
| 43 | - <?php foreach ( $choice['value'] as $subchoice ): ?> |
|
| 44 | - <option value="<?php echo esc_attr( $subchoice['value'] ); ?>"><?php echo esc_html( $subchoice['text'] ); ?></option> |
|
| 40 | + foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
| 41 | + <?php if ( is_array( $choice[ 'value' ] ) ) { ?> |
|
| 42 | + <optgroup label="<?php echo esc_attr( $choice[ 'text' ] ); ?>"> |
|
| 43 | + <?php foreach ( $choice[ 'value' ] as $subchoice ): ?> |
|
| 44 | + <option value="<?php echo esc_attr( $subchoice[ 'value' ] ); ?>"><?php echo esc_html( $subchoice[ 'text' ] ); ?></option> |
|
| 45 | 45 | <?php endforeach; ?> |
| 46 | 46 | </optgroup> |
| 47 | 47 | <?php } else { ?> |
| 48 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $search_field['value'] ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
| 48 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $search_field[ 'value' ] ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
| 49 | 49 | <?php } ?> |
| 50 | 50 | <?php } ?> |
| 51 | 51 | </select> |
@@ -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 | |