theme = wp_get_theme(); $this->plugin_status = $this->get_plugin_status( 'omnipress/omnipress.php' ); if ( 'active' === $this->plugin_status ) { return; } add_action( 'admin_head', array( $this, 'notice_styles' ) ); add_action( 'init', array( $this, 'handle_dismiss_notice' ) ); if ( ! \get_transient( 'op_notice_dismissed' ) ) { add_action( 'admin_notices', array( $this, 'render_notice' ) ); } add_action( 'switch_theme', array( $this, 'show_notice' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'notice_scripts' ) ); } /** * Delete cookie on theme switch. * * @return void */ public function show_notice() { \delete_transient( 'op_notice_dismissed' ); } /** * Returns plugins status. * * @param string $plugin_slug * @return string active | paused | not-found */ protected function get_plugin_status( $plugin_slug ) { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } if ( is_plugin_active( $plugin_slug ) ) { return 'active'; } static $plugins = array(); if ( ! $plugins ) { $plugins = get_plugins(); } if ( isset( $plugins[ $plugin_slug ] ) ) { return 'paused'; } return 'not-found'; } public function notice_styles() { ?>