| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Extension Abstract |
| 5 |
* |
| 6 |
* @package NotificationX\Extensions |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace NotificationX\Types; |
| 10 |
|
| 11 |
use NotificationX\Extensions\GlobalFields; |
| 12 |
use NotificationX\GetInstance; |
| 13 |
use NotificationX\Modules; |
| 14 |
use NotificationX\NotificationX; |
| 15 |
|
| 16 |
/** |
| 17 |
* Extension Abstract for all Extension. |
| 18 |
* @method static OfferAnnouncement get_instance($args = null) |
| 19 |
*/ |
| 20 |
class OfferAnnouncement extends Types { |
| 21 |
/** |
| 22 |
* Instance of OfferAnnouncement |
| 23 |
* |
| 24 |
* @var OfferAnnouncement |
| 25 |
*/ |
| 26 |
use GetInstance; |
| 27 |
public $priority = 36; |
| 28 |
public $module = ['modules_announcements']; |
| 29 |
public $id = 'offer_announcement'; |
| 30 |
public $default_source = 'announcements'; |
| 31 |
public $default_theme = 'announcements_theme-one'; |
| 32 |
public $is_pro = true; |
| 33 |
// public $link_type = 'comment_url'; |
| 34 |
|
| 35 |
/** |
| 36 |
* Initially Invoked when initialized. |
| 37 |
*/ |
| 38 |
public function __construct() { |
| 39 |
parent::__construct(); |
| 40 |
|
| 41 |
// add_filter('nx_link_types', [$this, 'link_types']); |
| 42 |
} |
| 43 |
|
| 44 |
public function init() |
| 45 |
{ |
| 46 |
parent::init(); |
| 47 |
$this->title = __('Discount Alert', 'notificationx'); |
| 48 |
$this->popup = [ |
| 49 |
"denyButtonText" => __("<a href='https://notificationx.com/docs/configure-discount-alert/' target='_blank'>More Info</a>", "notificationx"), |
| 50 |
"confirmButtonText" => __("<a href='https://notificationx.com/#pricing' target='_blank'>Upgrade to PRO</a>", "notificationx"), |
| 51 |
// phpcs:disable PluginCheck.CodeAnalysis.Offloading.OffloadedContent -- False positive for this context: these are HTML email bodies and remote documentation/tutorial links in admin help text, not offloaded plugin assets. Audited 2026-07-16. |
| 52 |
"html"=> __(' |
| 53 |
<span>Discount Alert by NotificationX will allow you to display offers/discounts of your products/services on your website interactively & easily.</span> |
| 54 |
<video id="pro_alert_video_popup" type="text/html" allowfullscreen width="450" height="235" autoplay loop muted> |
| 55 |
<source src="https://notificationx.com/wp-content/uploads/2024/01/NX-Discount-Alert-1.mp4" type="video/mp4"> |
| 56 |
</video> |
| 57 |
', 'notificationx') |
| 58 |
// phpcs:enable PluginCheck.CodeAnalysis.Offloading.OffloadedContent |
| 59 |
]; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Hooked to nx_before_metabox_load action. |
| 64 |
* |
| 65 |
* @return void |
| 66 |
*/ |
| 67 |
public function init_fields() { |
| 68 |
parent::init_fields(); |
| 69 |
// add_filter('nx_content_trim_length_dependency', [$this, 'content_trim_length_dependency']); |
| 70 |
|
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* Adds option to Link Type field in Content tab. |
| 75 |
* |
| 76 |
* @param array $options |
| 77 |
* @return array |
| 78 |
*/ |
| 79 |
public function link_types($options){ |
| 80 |
$_options = GlobalFields::get_instance()->normalize_fields([ |
| 81 |
'comment_url' => __('Comment URL', 'notificationx'), |
| 82 |
], 'type', $this->id); |
| 83 |
|
| 84 |
return array_merge($options, $_options); |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
/** |
| 89 |
* This method is an implementable method for All Extension coming forward. |
| 90 |
* |
| 91 |
* @param array $args Settings arguments. |
| 92 |
* @return mixed |
| 93 |
*/ |
| 94 |
public function content_trim_length_dependency($dependency) { |
| 95 |
$dependency[] = 'comments_theme-six-free'; |
| 96 |
$dependency[] = 'comments_theme-seven-free'; |
| 97 |
$dependency[] = 'comments_theme-eight-free'; |
| 98 |
return $dependency; |
| 99 |
} |
| 100 |
} |
| 101 |
|