plugins as $plugin_key => $plugin_data) {
if ( is_object( $plugin_data ) ) {
$plugin_data = (array) $plugin_data;
}
// Taking some data
$title = wp_kses( $plugin_data['name'], $plugins_allowedtags );
$version = wp_kses( $plugin_data['version'], $plugins_allowedtags );
$name = strip_tags( $title . ' ' . $version );
$description = strip_tags( $plugin_data['short_description'] );
$last_updated_timestamp = strtotime( $plugin_data['last_updated'] );
$author = wp_kses( $plugin_data['author'], $plugins_allowedtags );
$author = str_replace( "href=", 'target="_blank" href=', $author );
$requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
$requires_wp = isset( $plugin_data['requires'] ) ? $plugin_data['requires'] : null;
$compatible_php = is_php_version_compatible( $requires_php );
$compatible_wp = is_wp_version_compatible( $requires_wp );
$tested_wp = ( empty( $plugin_data['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin_data['tested'], '<=' ) );
$details_link = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . '&TB_iframe=true&width=600&height=550' );
$extra_class = ( ! empty( $plugins_filter[ $plugin_data['slug'] ]['class'] ) ) ? $plugins_filter[ $plugin_data['slug'] ]['class'] : '';
$plugin_tags = ( ! empty( $plugins_filter[ $plugin_data['slug'] ]['tags'] ) ) ? $plugins_filter[ $plugin_data['slug'] ]['tags'] : '';
// Author String
if ( ! empty( $author ) ) {
/* translators: %s: Plugin author. */
$author = '
' . sprintf( __( 'By %s' ), $author ) . '';
}
// Plugin Icon
if ( ! empty( $plugin_data['icons']['svg'] ) ) {
$plugin_icon_url = $plugin_data['icons']['svg'];
} elseif ( ! empty( $plugin_data['icons']['2x'] ) ) {
$plugin_icon_url = $plugin_data['icons']['2x'];
} elseif ( ! empty( $plugin_data['icons']['1x'] ) ) {
$plugin_icon_url = $plugin_data['icons']['1x'];
} else {
$plugin_icon_url = $plugin_data['icons']['default'];
}
// Plugin Action Links
$action_links = array();
if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
$status = install_plugin_install_status( $plugin_data );
switch ( $status['status'] ) {
case 'install':
if ( $status['url'] ) {
if ( $compatible_php && $compatible_wp ) {
$action_links[] = sprintf(
'
%s',
esc_attr( $plugin_data['slug'] ),
esc_url( $status['url'] ),
/* translators: %s: Plugin name and version. */
esc_attr( sprintf( __( 'Install %s now' ), $name ) ),
esc_attr( $name ),
__( 'Install Now' )
);
} else {
$action_links[] = sprintf(
'
',
_x( 'Cannot Install', 'plugin' )
);
}
}
break;
case 'update_available':
if ( $status['url'] ) {
if ( $compatible_php && $compatible_wp ) {
$action_links[] = sprintf(
'
%s',
esc_attr( $status['file'] ),
esc_attr( $plugin_data['slug'] ),
esc_url( $status['url'] ),
/* translators: %s: Plugin name and version. */
esc_attr( sprintf( __( 'Update %s now' ), $name ) ),
esc_attr( $name ),
__( 'Update Now' )
);
} else {
$action_links[] = sprintf(
'
',
_x( 'Cannot Update', 'plugin' )
);
}
}
break;
case 'latest_installed':
case 'newer_installed':
if ( is_plugin_active( $status['file'] ) ) {
$action_links[] = sprintf(
'
',
_x( 'Active', 'plugin' )
);
} elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
$button_text = __( 'Activate' );
/* translators: %s: Plugin name. */
$button_label = _x( 'Activate %s', 'plugin' );
$activate_url = add_query_arg(
array(
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
'action' => 'activate',
'plugin' => $status['file'],
),
network_admin_url( 'plugins.php' )
);
if ( is_network_admin() ) {
$button_text = __( 'Network Activate' );
/* translators: %s: Plugin name. */
$button_label = _x( 'Network Activate %s', 'plugin' );
$activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
}
$action_links[] = sprintf(
'
%3$s',
esc_url( $activate_url ),
esc_attr( sprintf( $button_label, $plugin_data['name'] ) ),
$button_text
);
} else {
$action_links[] = sprintf(
'
',
_x( 'Installed', 'plugin' )
);
}
break;
}
}
$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' )
);
?>