45 $plugins = array(); |
45 $plugins = array(); |
46 |
46 |
47 $plugin_info = get_site_transient( 'update_plugins' ); |
47 $plugin_info = get_site_transient( 'update_plugins' ); |
48 if ( isset( $plugin_info->no_update ) ) { |
48 if ( isset( $plugin_info->no_update ) ) { |
49 foreach ( $plugin_info->no_update as $plugin ) { |
49 foreach ( $plugin_info->no_update as $plugin ) { |
50 $plugin->upgrade = false; |
50 if ( isset( $plugin->slug ) ) { |
51 $plugins[ $plugin->slug ] = $plugin; |
51 $plugin->upgrade = false; |
|
52 $plugins[ $plugin->slug ] = $plugin; |
|
53 } |
52 } |
54 } |
53 } |
55 } |
54 |
56 |
55 if ( isset( $plugin_info->response ) ) { |
57 if ( isset( $plugin_info->response ) ) { |
56 foreach ( $plugin_info->response as $plugin ) { |
58 foreach ( $plugin_info->response as $plugin ) { |
57 $plugin->upgrade = true; |
59 if ( isset( $plugin->slug ) ) { |
58 $plugins[ $plugin->slug ] = $plugin; |
60 $plugin->upgrade = true; |
|
61 $plugins[ $plugin->slug ] = $plugin; |
|
62 } |
59 } |
63 } |
60 } |
64 } |
61 |
65 |
62 return $plugins; |
66 return $plugins; |
63 } |
67 } |
99 $tabs = array(); |
103 $tabs = array(); |
100 |
104 |
101 if ( 'search' === $tab ) { |
105 if ( 'search' === $tab ) { |
102 $tabs['search'] = __( 'Search Results' ); |
106 $tabs['search'] = __( 'Search Results' ); |
103 } |
107 } |
|
108 |
104 if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { |
109 if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { |
105 $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); |
110 $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); |
106 } |
111 } |
|
112 |
107 $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); |
113 $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); |
108 $tabs['popular'] = _x( 'Popular', 'Plugin Installer' ); |
114 $tabs['popular'] = _x( 'Popular', 'Plugin Installer' ); |
109 $tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' ); |
115 $tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' ); |
110 $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' ); |
116 $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' ); |
|
117 |
111 if ( current_user_can( 'upload_plugins' ) ) { |
118 if ( current_user_can( 'upload_plugins' ) ) { |
112 // No longer a real tab. Here for filter compatibility. |
119 // No longer a real tab. Here for filter compatibility. |
113 // Gets skipped in get_views(). |
120 // Gets skipped in get_views(). |
114 $tabs['upload'] = __( 'Upload Plugin' ); |
121 $tabs['upload'] = __( 'Upload Plugin' ); |
115 } |
122 } |
208 |
215 |
209 /** |
216 /** |
210 * Filters API request arguments for each Add Plugins screen tab. |
217 * Filters API request arguments for each Add Plugins screen tab. |
211 * |
218 * |
212 * The dynamic portion of the hook name, `$tab`, refers to the plugin install tabs. |
219 * The dynamic portion of the hook name, `$tab`, refers to the plugin install tabs. |
213 * Default tabs include 'featured', 'popular', 'recommended', 'favorites', and 'upload'. |
220 * |
|
221 * Possible hook names include: |
|
222 * |
|
223 * - `install_plugins_table_api_args_favorites` |
|
224 * - `install_plugins_table_api_args_featured` |
|
225 * - `install_plugins_table_api_args_popular` |
|
226 * - `install_plugins_table_api_args_recommended` |
|
227 * - `install_plugins_table_api_args_upload` |
214 * |
228 * |
215 * @since 3.7.0 |
229 * @since 3.7.0 |
216 * |
230 * |
217 * @param array|false $args Plugin install API arguments. |
231 * @param array|false $args Plugin install API arguments. |
218 */ |
232 */ |
470 if ( is_object( $plugin ) ) { |
484 if ( is_object( $plugin ) ) { |
471 $plugin = (array) $plugin; |
485 $plugin = (array) $plugin; |
472 } |
486 } |
473 |
487 |
474 // Display the group heading if there is one. |
488 // Display the group heading if there is one. |
475 if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { |
489 if ( isset( $plugin['group'] ) && $plugin['group'] !== $group ) { |
476 if ( isset( $this->groups[ $plugin['group'] ] ) ) { |
490 if ( isset( $this->groups[ $plugin['group'] ] ) ) { |
477 $group_name = $this->groups[ $plugin['group'] ]; |
491 $group_name = $this->groups[ $plugin['group'] ]; |
478 if ( isset( $plugins_group_titles[ $group_name ] ) ) { |
492 if ( isset( $plugins_group_titles[ $group_name ] ) ) { |
479 $group_name = $plugins_group_titles[ $group_name ]; |
493 $group_name = $plugins_group_titles[ $group_name ]; |
480 } |
494 } |
491 // Needs an extra wrapping div for nth-child selectors to work. |
505 // Needs an extra wrapping div for nth-child selectors to work. |
492 echo '<div class="plugin-items">'; |
506 echo '<div class="plugin-items">'; |
493 |
507 |
494 $group = $plugin['group']; |
508 $group = $plugin['group']; |
495 } |
509 } |
|
510 |
496 $title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
511 $title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
497 |
512 |
498 // Remove any HTML from the description. |
513 // Remove any HTML from the description. |
499 $description = strip_tags( $plugin['short_description'] ); |
514 $description = strip_tags( $plugin['short_description'] ); |
500 $version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
515 $version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
696 <div class="plugin-card-top"> |
711 <div class="plugin-card-top"> |
697 <div class="name column-name"> |
712 <div class="name column-name"> |
698 <h3> |
713 <h3> |
699 <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal"> |
714 <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal"> |
700 <?php echo $title; ?> |
715 <?php echo $title; ?> |
701 <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" /> |
716 <img src="<?php echo esc_url( $plugin_icon_url ); ?>" class="plugin-icon" alt="" /> |
702 </a> |
717 </a> |
703 </h3> |
718 </h3> |
704 </div> |
719 </div> |
705 <div class="action-links"> |
720 <div class="action-links"> |
706 <?php |
721 <?php |
741 $active_installs_text = sprintf( |
756 $active_installs_text = sprintf( |
742 /* translators: %s: Number of millions. */ |
757 /* translators: %s: Number of millions. */ |
743 _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), |
758 _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), |
744 number_format_i18n( $active_installs_millions ) |
759 number_format_i18n( $active_installs_millions ) |
745 ); |
760 ); |
746 } elseif ( 0 == $plugin['active_installs'] ) { |
761 } elseif ( 0 === $plugin['active_installs'] ) { |
747 $active_installs_text = _x( 'Less Than 10', 'Active plugin installations' ); |
762 $active_installs_text = _x( 'Less Than 10', 'Active plugin installations' ); |
748 } else { |
763 } else { |
749 $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; |
764 $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; |
750 } |
765 } |
751 /* translators: %s: Number of installations. */ |
766 /* translators: %s: Number of installations. */ |