# ever-compare/trunk/includes/classes/Admin/Notices.php

Ever Compare – Products Compare Plugin for WooCommerce, version trunk. 76 lines.

- Page: https://pluginprobe.com/plugins/ever-compare/trunk/code/includes/classes/Admin/Notices.php
- Raw: https://pluginprobe.com/plugins/ever-compare/trunk/raw/includes/classes/Admin/Notices.php
- Modified: 2026-04-05T03:41:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ever-compare/trunk/code/includes/classes/Admin/Notices.php#L10-L20`.

```php
<?php
namespace EverCompare\Admin;

defined( 'ABSPATH' ) || exit;
/**
 * Notices handlers class
 */
class Notices {

    /**
     * Run the Notices
     *
     * @return void
     */
    public function notice() {
        $this->all_notices();
    }

    /**
     * Add Notices
     */
    public function all_notices() {

        // Notice for WooCommerce
        if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
            add_action( 'admin_notices', [ $this, 'admin_notice_missing_woocommerce_plugin' ] );
            return;
        }

    }

    /**
    * [is_plugins_active] Check Plugin is Installed or not
    * @param  [string]  $pl_file_path plugin file path
    * @return boolean  true|false
    */
    public function is_plugins_active( $pl_file_path = NULL ){
        $installed_plugins_list = get_plugins();
        return isset( $installed_plugins_list[$pl_file_path] );
    }

    /**
     * [admin_notice_missing_woocommerce_plugin] Admin Notice For missing WooCommerce
     * @return [void]
     */
    public function admin_notice_missing_woocommerce_plugin(){
        $woocommerce = 'woocommerce/woocommerce.php';
        if( $this->is_plugins_active( $woocommerce ) ) {
            if( ! current_user_can( 'activate_plugins' ) ) {
                return;
            }
            $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $woocommerce . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $woocommerce );
            /*
             * translators: %1$s: strong tag start
             * translators: %2$s: strong tag end
             */
            $message = sprintf( __( '%1$sEver Compare%2$s requires %1$s"WooCommerce"%2$s plugin to be active. Please activate WooCommerce to continue.', 'ever-compare' ), '<strong>', '</strong>');
            $button_text = __( 'Activate WooCommerce', 'ever-compare' );
        } else {
            if( ! current_user_can( 'activate_plugins' ) ) {
                return;
            }
            $activation_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
            /*
             * translators: %1$s: strong tag start
             * translators: %2$s: strong tag end
             */
            $message = sprintf( __( '%1$sEver Compare%2$s requires %1$s"WooCommerce"%2$s plugin to be installed and activated. Please install WooCommerce to continue.', 'ever-compare' ), '<strong>', '</strong>' );
            $button_text = __( 'Install WooCommerce', 'ever-compare' );
        }
        $button = '<p><a href="' . $activation_url . '" class="button-primary">' . $button_text . '</a></p>';
        printf( '<div class="error"><p>%1$s</p>%2$s</div>', wp_kses_post($message) , wp_kses_post($button) );
    }
    

}
```
