' . esc_html( $group_name ) . ' ';
// Needs an extra wrapping div for nth-child selectors to work.
echo '
';
$group = $plugin['group'];
}
$title = wp_kses( $plugin['name'], $plugins_allowedtags );
// Remove any HTML from the description.
$description = strip_tags( $plugin['short_description'] );
/**
* Filters the plugin card description on the Add Plugins screen.
*
* @since 6.0.0
*
* @param string $description Plugin card description.
* @param array $plugin An array of plugin data. See {@see plugins_api()}
* for the list of possible values.
*/
$description = apply_filters( 'plugin_install_description', $description, $plugin );
$version = wp_kses( $plugin['version'], $plugins_allowedtags );
$name = strip_tags( $title . ' ' . $version );
$author = wp_kses( $plugin['author'], $plugins_allowedtags );
if ( ! empty( $author ) ) {
/* translators: %s: Plugin author. */
$author = '
' . sprintf( __( 'By %s' ), $author ) . ' ';
}
$requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
$requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
$compatible_php = is_php_version_compatible( $requires_php );
$compatible_wp = is_wp_version_compatible( $requires_wp );
$tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) );
$action_links = array();
$action_links[] = wp_get_plugin_action_button( $name, $plugin, $compatible_php, $compatible_wp );
$details_link = self_admin_url(
'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] .
'&TB_iframe=true&width=600&height=550'
);
$action_links[] = sprintf(
'
%s ',
esc_url( $details_link ),
/* translators: %s: Plugin name and version. */
esc_attr( sprintf( __( 'More information about %s' ), $name ) ),
esc_attr( $name ),
__( 'More Details' )
);
if ( ! empty( $plugin['icons']['svg'] ) ) {
$plugin_icon_url = $plugin['icons']['svg'];
} elseif ( ! empty( $plugin['icons']['2x'] ) ) {
$plugin_icon_url = $plugin['icons']['2x'];
} elseif ( ! empty( $plugin['icons']['1x'] ) ) {
$plugin_icon_url = $plugin['icons']['1x'];
} else {
$plugin_icon_url = $plugin['icons']['default'];
}
/**
* Filters the install action links for a plugin.
*
* @since 2.7.0
*
* @param string[] $action_links An array of plugin action links.
* Defaults are links to Details and Install Now.
* @param array $plugin An array of plugin data. See {@see plugins_api()}
* for the list of possible values.
*/
$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
$last_updated_timestamp = strtotime( $plugin['last_updated'] );
?>
Please update WordPress, and then
learn more about updating PHP .' ),
self_admin_url( 'update-core.php' ),
esc_url( wp_get_update_php_url() )
);
$incompatible_notice_message .= wp_update_php_annotation( '
', ' ', false );
} elseif ( current_user_can( 'update_core' ) ) {
$incompatible_notice_message .= sprintf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( 'Please update WordPress .' ),
self_admin_url( 'update-core.php' )
);
} elseif ( current_user_can( 'update_php' ) ) {
$incompatible_notice_message .= sprintf(
/* translators: %s: URL to Update PHP page. */
' ' . __( 'Learn more about updating PHP .' ),
esc_url( wp_get_update_php_url() )
);
$incompatible_notice_message .= wp_update_php_annotation( '
', ' ', false );
}
} elseif ( ! $compatible_wp ) {
$incompatible_notice_message .= __( 'This plugin does not work with your version of WordPress.' );
if ( current_user_can( 'update_core' ) ) {
$incompatible_notice_message .= printf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( 'Please update WordPress .' ),
self_admin_url( 'update-core.php' )
);
}
} elseif ( ! $compatible_php ) {
$incompatible_notice_message .= __( 'This plugin does not work with your version of PHP.' );
if ( current_user_can( 'update_php' ) ) {
$incompatible_notice_message .= sprintf(
/* translators: %s: URL to Update PHP page. */
' ' . __( 'Learn more about updating PHP .' ),
esc_url( wp_get_update_php_url() )
);
$incompatible_notice_message .= wp_update_php_annotation( '
', ' ', false );
}
}
wp_admin_notice(
$incompatible_notice_message,
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'inline' ),
)
);
}
?>
' . implode( ' ', $action_links ) . ' ';
}
?>
get_dependencies_notice( $plugin );
if ( ! empty( $dependencies_notice ) ) {
echo $dependencies_notice;
}
?>
$plugin['rating'],
'type' => 'percent',
'number' => $plugin['num_ratings'],
)
);
?>
()
= 1000000 ) {
$active_installs_millions = floor( $plugin['active_installs'] / 1000000 );
$active_installs_text = sprintf(
/* translators: %s: Number of millions. */
_nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ),
number_format_i18n( $active_installs_millions )
);
} elseif ( 0 === $plugin['active_installs'] ) {
$active_installs_text = _x( 'Less Than 10', 'Active plugin installations' );
} else {
$active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+';
}
/* translators: %s: Number of installations. */
printf( __( '%s Active Installations' ), $active_installs_text );
?>
' . __( 'Untested with your version of WordPress' ) . '';
} elseif ( ! $compatible_wp ) {
echo '' . __( 'Incompatible with your version of WordPress' ) . ' ';
} else {
echo '' . __( 'Compatible with your version of WordPress' ) . ' ';
}
?>
';
}
}
/**
* Returns a notice containing a list of dependencies required by the plugin.
*
* @since 6.5.0
*
* @param array $plugin_data An array of plugin data. See {@see plugins_api()}
* for the list of possible values.
* @return string A notice containing a list of dependencies required by the plugin,
* or an empty string if none is required.
*/
protected function get_dependencies_notice( $plugin_data ) {
if ( empty( $plugin_data['requires_plugins'] ) ) {
return '';
}
$no_name_markup = '
%s
';
$has_name_markup = '
%s %s
';
$dependencies_list = '';
foreach ( $plugin_data['requires_plugins'] as $dependency ) {
$dependency_data = WP_Plugin_Dependencies::get_dependency_data( $dependency );
if (
false !== $dependency_data &&
! empty( $dependency_data['name'] ) &&
! empty( $dependency_data['slug'] ) &&
! empty( $dependency_data['version'] )
) {
$more_details_link = $this->get_more_details_link( $dependency_data['name'], $dependency_data['slug'] );
$dependencies_list .= sprintf( $has_name_markup, esc_html( $dependency_data['name'] ), $more_details_link );
continue;
}
$result = plugins_api( 'plugin_information', array( 'slug' => $dependency ) );
if ( ! empty( $result->name ) ) {
$more_details_link = $this->get_more_details_link( $result->name, $result->slug );
$dependencies_list .= sprintf( $has_name_markup, esc_html( $result->name ), $more_details_link );
continue;
}
$dependencies_list .= sprintf( $no_name_markup, esc_html( $dependency ) );
}
$dependencies_notice = sprintf(
'
',
'
' . __( 'Additional plugins are required' ) . ' ',
$dependencies_list
);
return $dependencies_notice;
}
/**
* Creates a 'More details' link for the plugin.
*
* @since 6.5.0
*
* @param string $name The plugin's name.
* @param string $slug The plugin's slug.
* @return string The 'More details' link for the plugin.
*/
protected function get_more_details_link( $name, $slug ) {
$url = add_query_arg(
array(
'tab' => 'plugin-information',
'plugin' => $slug,
'TB_iframe' => 'true',
'width' => '600',
'height' => '550',
),
network_admin_url( 'plugin-install.php' )
);
$more_details_link = sprintf(
'
%4$s ',
esc_url( $url ),
/* translators: %s: Plugin name. */
sprintf( __( 'More information about %s' ), esc_html( $name ) ),
esc_attr( $name ),
__( 'More Details' )
);
return $more_details_link;
}
}