| 1 |
<?php |
| 2 |
/** |
| 3 |
* Extension Abstract |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Types; |
| 9 |
|
| 10 |
use NotificationX\Extensions\GlobalFields; |
| 11 |
use NotificationX\GetInstance; |
| 12 |
use NotificationX\Modules; |
| 13 |
|
| 14 |
/** |
| 15 |
* Extension Abstract for all Extension. |
| 16 |
* @method static EmailSubscription get_instance($args = null) |
| 17 |
*/ |
| 18 |
class EmailSubscription extends Types { |
| 19 |
/** |
| 20 |
* Instance of Admin |
| 21 |
* |
| 22 |
* @var Admin |
| 23 |
*/ |
| 24 |
use GetInstance; |
| 25 |
|
| 26 |
public $priority = 65; |
| 27 |
public $is_pro = true; |
| 28 |
public $module = [ |
| 29 |
'modules_mailchimp', |
| 30 |
'modules_convertkit', |
| 31 |
'modules_mailchimp', |
| 32 |
'modules_zapier', |
| 33 |
]; |
| 34 |
public $default_source = 'mailchimp'; |
| 35 |
|
| 36 |
/** |
| 37 |
* Initially Invoked when initialized. |
| 38 |
*/ |
| 39 |
public function __construct(){ |
| 40 |
parent::__construct(); |
| 41 |
$this->id = 'email_subscription'; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Runs when modules is enabled. |
| 46 |
* |
| 47 |
* @return void |
| 48 |
*/ |
| 49 |
public function init(){ |
| 50 |
parent::init(); |
| 51 |
$this->title = __('Email Subscription', 'notificationx'); |
| 52 |
$this->popup = [ |
| 53 |
"denyButtonText" => __("<a href='https://notificationx.com/docs/mailchimp-email-subscription-alert/' target='_blank'>More Info</a>", "notificationx"), |
| 54 |
"confirmButtonText" => __("<a href='https://notificationx.com/#pricing' target='_blank'>Upgrade to PRO</a>", "notificationx"), |
| 55 |
// 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. |
| 56 |
"html"=> __(' |
| 57 |
<span>Show popups to display which users subscribed to your Newsletter.</span> |
| 58 |
<video id="pro_alert_video_popup" type="text/html" allowfullscreen width="450" height="235" autoplay loop muted> |
| 59 |
<source src="https://notificationx.com/wp-content/uploads/2024/01/How-to-Display-Email-Subscription-Alerts-using-NotificationX.mp4" type="video/mp4"> |
| 60 |
</video> |
| 61 |
', 'notificationx') |
| 62 |
// phpcs:enable PluginCheck.CodeAnalysis.Offloading.OffloadedContent |
| 63 |
]; |
| 64 |
|
| 65 |
$common_fields = [ |
| 66 |
'first_param' => 'tag_first_name', |
| 67 |
'custom_first_param' => __('Someone' , 'notificationx'), |
| 68 |
'second_param' => __('just subscribed to', 'notificationx'), |
| 69 |
'third_param' => 'tag_title', |
| 70 |
'custom_third_param' => __('Anonymous Title', 'notificationx'), |
| 71 |
'fourth_param' => 'tag_time', |
| 72 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 73 |
]; |
| 74 |
|
| 75 |
$this->themes = [ |
| 76 |
'theme-one' => [ |
| 77 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/subscriptions/mailchimp-theme-1.jpg', |
| 78 |
'image_shape' => 'rounded', |
| 79 |
'template' => $common_fields, |
| 80 |
], |
| 81 |
'theme-two' => [ |
| 82 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/subscriptions/mailchimp-theme-2.png', |
| 83 |
'template' => $common_fields, |
| 84 |
'image_shape' => 'circle', |
| 85 |
], |
| 86 |
'theme-three' => [ |
| 87 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/subscriptions/mailchimp-theme-three.jpg', |
| 88 |
'image_shape' => 'square', |
| 89 |
'template' => $common_fields, |
| 90 |
], |
| 91 |
'maps_theme' => [ |
| 92 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/subscriptions/maps-theme-subscribed.png', |
| 93 |
'image_shape' => 'square', |
| 94 |
'show_notification_image' => 'maps_image', |
| 95 |
], |
| 96 |
]; |
| 97 |
|
| 98 |
$this->res_themes = [ |
| 99 |
'res-theme-one' => [ |
| 100 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_subscriptions/mailchimp-res-theme-1.png', |
| 101 |
'_template' => 'mailchimp_template_new', |
| 102 |
'is_pro' => true, |
| 103 |
], |
| 104 |
'res-theme-two' => [ |
| 105 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_subscriptions/mailchimp-res-theme-2.png', |
| 106 |
'_template' => 'mailchimp_template_new', |
| 107 |
'is_pro' => true, |
| 108 |
], |
| 109 |
'res-theme-three' => [ |
| 110 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_subscriptions/mailchimp-res-theme-3.png', |
| 111 |
'_template' => 'mailchimp_template_new', |
| 112 |
'is_pro' => true, |
| 113 |
], |
| 114 |
'subscriptions-res-theme-four' => [ |
| 115 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_subscriptions/mailchimp-res-theme-4.png', |
| 116 |
'_template' => 'maps_template_new', |
| 117 |
'is_pro' => true, |
| 118 |
], |
| 119 |
]; |
| 120 |
|
| 121 |
$this->templates = [ |
| 122 |
'mailchimp_template_new' => [ |
| 123 |
'first_param' => GlobalFields::get_instance()->common_name_fields(), |
| 124 |
'third_param' => [ |
| 125 |
'tag_title' => __('List Title', 'notificationx'), |
| 126 |
// 'tag_anonymous_title' => __('Anonymous Title' , 'notificationx'), |
| 127 |
], |
| 128 |
'fourth_param' => [ |
| 129 |
'tag_time' => __('Definite Time', 'notificationx'), |
| 130 |
'tag_sometime' => __('Some time ago', 'notificationx'), |
| 131 |
], |
| 132 |
'_themes' => [ |
| 133 |
"{$this->id}_theme-one", |
| 134 |
"{$this->id}_theme-two", |
| 135 |
"{$this->id}_theme-three", |
| 136 |
"{$this->id}_maps_theme", |
| 137 |
], |
| 138 |
], |
| 139 |
]; |
| 140 |
} |
| 141 |
|
| 142 |
public function preview_entry($entry, $settings){ |
| 143 |
$entry = array_merge($entry, [ |
| 144 |
"title" => "NotificationX Pro", |
| 145 |
]); |
| 146 |
|
| 147 |
if('email_subscription_maps_theme' !== $settings['theme']){ |
| 148 |
$entry['image_data'] = array( |
| 149 |
'url' => NOTIFICATIONX_PUBLIC_URL . 'image/icons/pink-face-looped.gif', |
| 150 |
'alt' => '', |
| 151 |
'classes' => 'greview_icon', |
| 152 |
); |
| 153 |
} |
| 154 |
return $entry; |
| 155 |
} |
| 156 |
|
| 157 |
} |
| 158 |
|