*/ // Namespace namespace Inisev\Subs; // Disallow direct access if (defined('ABSPATH')) { /** * Main class for handling the Review */ if (!class_exists('Inisev\Subs\Inisev_Try_Out_Plugins')) { class Inisev_Try_Out_Plugins { public $pluginDir; public $pluginFile; public $pluginName; public $pluginPageURL; function __construct($plugin_file, $plugin_dir, $plugin_name, $plugin_menu_page) { if (!is_admin() || !current_user_can('install_plugins')) return; if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') { add_action('wp_ajax_tifm_notice_actions', [&$this, 'noticeAjax']); } if (get_option('_tifm_feature_enabled') == 'enabled') { update_option('_tifm_force_disable_feature_update', true); } else if (get_option('_tifm_force_disable_feature_update', 'no') === 'no') { delete_option('_tifm_feature_enabled'); delete_option('_tifm_hide_notice_forever'); delete_option('_tifm_disable_feature_forever'); update_option('_tifm_force_disable_feature_update', true); } global $pagenow; if (!($pagenow == 'plugin-install.php' || $pagenow == 'admin-ajax.php')) return; if (get_option('_tifm_disable_feature_forever', false) != false) return; $this->pluginDir = $plugin_dir; $this->pluginFile = $plugin_file; $this->pluginName = $plugin_name; $this->pluginPageURL = admin_url($plugin_menu_page) . '&scrollToSection=testPlugins'; $this->showInformativeNotice(); $this->insertActionButton(); } public function showInformativeNotice() { add_action('in_admin_footer', [&$this, 'tryItOutScript']); if (get_option('_tifm_hide_notice_forever', false) != false) return; add_action('admin_notices', [&$this, 'informativeAdminNoticeHandler']); add_action('admin_head', [&$this, 'noticeStyles']); add_action('in_admin_footer', [&$this, 'noticeScripts']); } public function noticeStyles() { ?>
New: Add a Try it first button to try out plugins before installing on your site. Sounds cool! Show me a preview Not needed, I'm good
Brought to you by pluginName); ?>