>
*/
public static function get_catalog() {
return array(
'downloadsentinel' => array(
'name' => 'Download Sentinel',
'file' => 'downloadsentinel/downloadsentinel.php',
'website' => 'https://downloadsentinel.com',
'settings' => 'options-general.php?page=downloadsentinel',
'wporg' => 'https://wordpress.org/plugins/downloadsentinel/',
'description' => __( 'Secure, masked download links with upload management and download tracking. Hide real file paths and monitor claimed transfers.', 'activitysignature' ),
),
'authenticsender' => array(
'name' => 'Authentic Sender',
'file' => 'authenticsender/authenticsender.php',
'website' => 'https://authenticsender.com',
'settings' => 'options-general.php?page=authenticsender',
'wporg' => 'https://wordpress.org/plugins/authenticsender/',
'description' => __( 'Configure WordPress to send email via SMTP, UseSend, or Resend instead of the built-in mail() function.', 'activitysignature' ),
),
'essentialheaders' => array(
'name' => 'Essential Headers',
'file' => 'essentialheaders/essentialheaders.php',
'website' => 'https://essentialheaders.com',
'settings' => 'options-general.php?page=essentialheaders',
'wporg' => 'https://wordpress.org/plugins/essentialheaders/',
'description' => __( 'Adds the essential HTTP security headers WordPress leaves out—CSP, HSTS, frame options, and more—on every front-end response.', 'activitysignature' ),
),
'enumguard' => array(
'name' => 'EnumGuard',
'file' => 'enumguard/enumguard.php',
'website' => 'https://enumguard.com',
'settings' => 'options-general.php?page=enumguard',
'wporg' => 'https://wordpress.org/plugins/enumguard/',
'description' => __( 'Stops WordPress user enumeration through author URLs, REST, login errors, XML-RPC, feeds, sitemaps, and oEmbed.', 'activitysignature' ),
),
'fallbackredirect' => array(
'name' => 'FallbackRedirect',
'file' => 'fallbackredirect/fallbackredirect.php',
'website' => 'https://fallbackredirect.com',
'settings' => 'options-general.php?page=fallbackredirect',
'wporg' => 'https://wordpress.org/plugins/fallbackredirect/',
'description' => __( 'Redirect manager for 301, 302, and 307 redirections. Monitor and fix 404 errors, log every broken link, and protect your SEO after a migration.', 'activitysignature' ),
),
);
}
/**
* Render the Plugin Recommendations tab.
*/
public static function render() {
$can_install = current_user_can( 'install_plugins' );
$can_activate = current_user_can( 'activate_plugins' );
?>
$plugin Catalog row.
* @param bool $can_install Whether the user can install plugins.
* @param bool $can_activate Whether the user can activate plugins.
*/
private static function render_card( $slug, $plugin, $can_install, $can_activate ) {
$file = self::resolve_plugin_file( $slug, $plugin['file'] );
$status = self::get_status( $file );
$pills = array(
'active' => array( 'status-on', __( 'Active', 'activitysignature' ) ),
'installed' => array( 'status-wait', __( 'Installed', 'activitysignature' ) ),
'missing' => array( 'status-off', __( 'Not installed', 'activitysignature' ) ),
);
$pill = $pills[ $status ];
?>
$plugin Catalog row.
* @param string $status active|installed|missing.
* @param bool $can_install Whether the user can install plugins.
* @param bool $can_activate Whether the user can activate plugins.
*/
private static function render_primary_action( $slug, $file, $plugin, $status, $can_install, $can_activate ) {
$settings_url = admin_url( $plugin['settings'] );
if ( 'active' === $status ) {
printf(
'%s',
esc_url( $settings_url ),
esc_html__( 'Settings', 'activitysignature' )
);
return;
}
if ( 'installed' === $status ) {
if ( ! $can_activate ) {
echo '' . esc_html__( 'Installed', 'activitysignature' ) . '';
return;
}
$activate_url = wp_nonce_url(
self_admin_url( 'plugins.php?action=activate&plugin=' . rawurlencode( $file ) ),
'activate-plugin_' . $file
);
printf(
'%s',
esc_url( $activate_url ),
esc_attr( $slug ),
esc_attr( $file ),
esc_attr( $plugin['name'] ),
esc_url( $settings_url ),
esc_html__( 'Activate', 'activitysignature' )
);
return;
}
if ( ! $can_install ) {
printf(
'%s',
esc_url( $plugin['wporg'] ),
esc_html__( 'View on WordPress.org', 'activitysignature' )
);
return;
}
$install_url = wp_nonce_url(
self_admin_url( 'update.php?action=install-plugin&plugin=' . rawurlencode( $slug ) ),
'install-plugin_' . $slug
);
printf(
'%s',
esc_url( $install_url ),
esc_attr( $slug ),
esc_attr( $file ),
esc_attr( $plugin['name'] ),
esc_url( $settings_url ),
esc_html__( 'Install & Activate', 'activitysignature' )
);
}
/**
* Resolve the installed plugin basename for a slug.
*
* @param string $slug WordPress.org slug / folder name.
* @param string $default Expected basename.
*
* @return string
*/
private static function resolve_plugin_file( $slug, $default ) {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
if ( isset( $plugins[ $default ] ) ) {
return $default;
}
foreach ( array_keys( $plugins ) as $file ) {
if ( 0 === strpos( $file, $slug . '/' ) ) {
return $file;
}
}
return $default;
}
/**
* Whether a plugin is active, installed, or missing.
*
* @param string $file Plugin basename.
*
* @return string
*/
private static function get_status( $file ) {
if ( is_plugin_active( $file ) ) {
return 'active';
}
if ( file_exists( WP_PLUGIN_DIR . '/' . $file ) ) {
return 'installed';
}
return 'missing';
}
}