223 * - `install_plugins_table_api_args_favorites` |
223 * - `install_plugins_table_api_args_favorites` |
224 * - `install_plugins_table_api_args_featured` |
224 * - `install_plugins_table_api_args_featured` |
225 * - `install_plugins_table_api_args_popular` |
225 * - `install_plugins_table_api_args_popular` |
226 * - `install_plugins_table_api_args_recommended` |
226 * - `install_plugins_table_api_args_recommended` |
227 * - `install_plugins_table_api_args_upload` |
227 * - `install_plugins_table_api_args_upload` |
|
228 * - `install_plugins_table_api_args_search` |
|
229 * - `install_plugins_table_api_args_beta` |
228 * |
230 * |
229 * @since 3.7.0 |
231 * @since 3.7.0 |
230 * |
232 * |
231 * @param array|false $args Plugin install API arguments. |
233 * @param array|false $args Plugin install API arguments. |
232 */ |
234 */ |
510 |
512 |
511 $title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
513 $title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
512 |
514 |
513 // Remove any HTML from the description. |
515 // Remove any HTML from the description. |
514 $description = strip_tags( $plugin['short_description'] ); |
516 $description = strip_tags( $plugin['short_description'] ); |
515 $version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
517 |
|
518 /** |
|
519 * Filters the plugin card description on the Add Plugins screen. |
|
520 * |
|
521 * @since 6.0.0 |
|
522 * |
|
523 * @param string $description Plugin card description. |
|
524 * @param array $plugin An array of plugin data. See {@see plugins_api()} |
|
525 * for the list of possible values. |
|
526 */ |
|
527 $description = apply_filters( 'plugin_install_description', $description, $plugin ); |
|
528 |
|
529 $version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
516 |
530 |
517 $name = strip_tags( $title . ' ' . $version ); |
531 $name = strip_tags( $title . ' ' . $version ); |
518 |
532 |
519 $author = wp_kses( $plugin['author'], $plugins_allowedtags ); |
533 $author = wp_kses( $plugin['author'], $plugins_allowedtags ); |
520 if ( ! empty( $author ) ) { |
534 if ( ! empty( $author ) ) { |
584 $action_links[] = sprintf( |
598 $action_links[] = sprintf( |
585 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
599 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
586 _x( 'Active', 'plugin' ) |
600 _x( 'Active', 'plugin' ) |
587 ); |
601 ); |
588 } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { |
602 } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { |
589 $button_text = __( 'Activate' ); |
603 if ( $compatible_php && $compatible_wp ) { |
590 /* translators: %s: Plugin name. */ |
604 $button_text = __( 'Activate' ); |
591 $button_label = _x( 'Activate %s', 'plugin' ); |
|
592 $activate_url = add_query_arg( |
|
593 array( |
|
594 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), |
|
595 'action' => 'activate', |
|
596 'plugin' => $status['file'], |
|
597 ), |
|
598 network_admin_url( 'plugins.php' ) |
|
599 ); |
|
600 |
|
601 if ( is_network_admin() ) { |
|
602 $button_text = __( 'Network Activate' ); |
|
603 /* translators: %s: Plugin name. */ |
605 /* translators: %s: Plugin name. */ |
604 $button_label = _x( 'Network Activate %s', 'plugin' ); |
606 $button_label = _x( 'Activate %s', 'plugin' ); |
605 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); |
607 $activate_url = add_query_arg( |
|
608 array( |
|
609 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), |
|
610 'action' => 'activate', |
|
611 'plugin' => $status['file'], |
|
612 ), |
|
613 network_admin_url( 'plugins.php' ) |
|
614 ); |
|
615 |
|
616 if ( is_network_admin() ) { |
|
617 $button_text = __( 'Network Activate' ); |
|
618 /* translators: %s: Plugin name. */ |
|
619 $button_label = _x( 'Network Activate %s', 'plugin' ); |
|
620 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); |
|
621 } |
|
622 |
|
623 $action_links[] = sprintf( |
|
624 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', |
|
625 esc_url( $activate_url ), |
|
626 esc_attr( sprintf( $button_label, $plugin['name'] ) ), |
|
627 $button_text |
|
628 ); |
|
629 } else { |
|
630 $action_links[] = sprintf( |
|
631 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
|
632 _x( 'Cannot Activate', 'plugin' ) |
|
633 ); |
606 } |
634 } |
607 |
|
608 $action_links[] = sprintf( |
|
609 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', |
|
610 esc_url( $activate_url ), |
|
611 esc_attr( sprintf( $button_label, $plugin['name'] ) ), |
|
612 $button_text |
|
613 ); |
|
614 } else { |
635 } else { |
615 $action_links[] = sprintf( |
636 $action_links[] = sprintf( |
616 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
637 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
617 _x( 'Installed', 'plugin' ) |
638 _x( 'Installed', 'plugin' ) |
618 ); |
639 ); |
648 /** |
669 /** |
649 * Filters the install action links for a plugin. |
670 * Filters the install action links for a plugin. |
650 * |
671 * |
651 * @since 2.7.0 |
672 * @since 2.7.0 |
652 * |
673 * |
653 * @param string[] $action_links An array of plugin action links. Defaults are links to Details and Install Now. |
674 * @param string[] $action_links An array of plugin action links. |
654 * @param array $plugin The plugin currently being listed. |
675 * Defaults are links to Details and Install Now. |
|
676 * @param array $plugin An array of plugin data. See {@see plugins_api()} |
|
677 * for the list of possible values. |
655 */ |
678 */ |
656 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); |
679 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); |
657 |
680 |
658 $last_updated_timestamp = strtotime( $plugin['last_updated'] ); |
681 $last_updated_timestamp = strtotime( $plugin['last_updated'] ); |
659 ?> |
682 ?> |
660 <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> |
683 <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> |
661 <?php |
684 <?php |
662 if ( ! $compatible_php || ! $compatible_wp ) { |
685 if ( ! $compatible_php || ! $compatible_wp ) { |
663 echo '<div class="notice inline notice-error notice-alt"><p>'; |
686 echo '<div class="notice inline notice-error notice-alt"><p>'; |
664 if ( ! $compatible_php && ! $compatible_wp ) { |
687 if ( ! $compatible_php && ! $compatible_wp ) { |
665 _e( 'This plugin doesn’t work with your versions of WordPress and PHP.' ); |
688 _e( 'This plugin does not work with your versions of WordPress and PHP.' ); |
666 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
689 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
667 printf( |
690 printf( |
668 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
691 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
669 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
692 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
670 self_admin_url( 'update-core.php' ), |
693 self_admin_url( 'update-core.php' ), |
684 esc_url( wp_get_update_php_url() ) |
707 esc_url( wp_get_update_php_url() ) |
685 ); |
708 ); |
686 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
709 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
687 } |
710 } |
688 } elseif ( ! $compatible_wp ) { |
711 } elseif ( ! $compatible_wp ) { |
689 _e( 'This plugin doesn’t work with your version of WordPress.' ); |
712 _e( 'This plugin does not work with your version of WordPress.' ); |
690 if ( current_user_can( 'update_core' ) ) { |
713 if ( current_user_can( 'update_core' ) ) { |
691 printf( |
714 printf( |
692 /* translators: %s: URL to WordPress Updates screen. */ |
715 /* translators: %s: URL to WordPress Updates screen. */ |
693 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
716 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
694 self_admin_url( 'update-core.php' ) |
717 self_admin_url( 'update-core.php' ) |
695 ); |
718 ); |
696 } |
719 } |
697 } elseif ( ! $compatible_php ) { |
720 } elseif ( ! $compatible_php ) { |
698 _e( 'This plugin doesn’t work with your version of PHP.' ); |
721 _e( 'This plugin does not work with your version of PHP.' ); |
699 if ( current_user_can( 'update_php' ) ) { |
722 if ( current_user_can( 'update_php' ) ) { |
700 printf( |
723 printf( |
701 /* translators: %s: URL to Update PHP page. */ |
724 /* translators: %s: URL to Update PHP page. */ |
702 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
725 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
703 esc_url( wp_get_update_php_url() ) |
726 esc_url( wp_get_update_php_url() ) |