| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Admin\Notices; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || die(); |
| 6 |
|
| 7 |
/** |
| 8 |
* Woocommerce settings page class. |
| 9 |
* |
| 10 |
* @since 1.1.0 |
| 11 |
*/ |
| 12 |
class Woocommerce_Settings extends Notice_Base { |
| 13 |
|
| 14 |
/** |
| 15 |
* Notice key. |
| 16 |
* |
| 17 |
* @since 1.1.0 |
| 18 |
* @var string |
| 19 |
*/ |
| 20 |
public $key = 'woocommerce-page-notices'; |
| 21 |
|
| 22 |
/** |
| 23 |
* Woocommerce_Settings constructor. |
| 24 |
* |
| 25 |
* @since 1.1.0 |
| 26 |
*/ |
| 27 |
public function __construct() { |
| 28 |
parent::__construct(); |
| 29 |
|
| 30 |
$this->content = esc_html__( 'Unlock more engagement and sales for your WooCommerce store with advanced checkout optimization, dynamic discounts and personalized promotions.', 'sellkit' ); |
| 31 |
$this->buttons = [ |
| 32 |
'https://getsellkit.com/pricing/?utm_source=wp-dashboard&utm_campaign=gopro&utm_medium=' . $this->active_theme => esc_html__( 'Upgrade to SellKit Pro', 'sellkit' ), |
| 33 |
]; |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Check if notice is valid or not. |
| 38 |
* |
| 39 |
* @since 1.1.0 |
| 40 |
* @return bool |
| 41 |
*/ |
| 42 |
public function is_valid() { |
| 43 |
if ( in_array( $this->key, $this->dismissed_notices, true ) || sellkit()->has_pro || defined( 'SELLKIT_BUNDLED' ) ) { |
| 44 |
return false; |
| 45 |
} |
| 46 |
|
| 47 |
$current_page = ! empty( $_GET['page'] ) ? htmlentities( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore |
| 48 |
|
| 49 |
if ( 'wc-settings' === $current_page ) { |
| 50 |
return true; |
| 51 |
} |
| 52 |
|
| 53 |
return false; |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Set the priority of notice. |
| 58 |
* |
| 59 |
* @since 1.1.0 |
| 60 |
* @return int |
| 61 |
*/ |
| 62 |
public function priority() { |
| 63 |
return 1; |
| 64 |
} |
| 65 |
} |
| 66 |
|