| 1 |
<?php |
| 2 |
/** |
| 3 |
* Announcements Extension |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Extensions\OfferAnnouncement; |
| 9 |
|
| 10 |
use NotificationX\GetInstance; |
| 11 |
use NotificationX\Extensions\Extension; |
| 12 |
use NotificationX\Extensions\ExtensionFactory; |
| 13 |
use NotificationX\Extensions\GlobalFields; |
| 14 |
use NotificationX\Types\Conversions; |
| 15 |
|
| 16 |
/** |
| 17 |
* Announcements Extension |
| 18 |
* @method static Announcements get_instance($args = null) |
| 19 |
*/ |
| 20 |
class Announcements extends Extension { |
| 21 |
/** |
| 22 |
* Instance of Announcements |
| 23 |
* |
| 24 |
* @var Announcements |
| 25 |
*/ |
| 26 |
use GetInstance; |
| 27 |
|
| 28 |
public $priority = 10; |
| 29 |
public $id = 'announcements'; |
| 30 |
// public $img = NOTIFICATIONX_ADMIN_URL . 'images/extensions/sources/custom.png'; |
| 31 |
// public $doc_link = 'https://notificationx.com/docs/custom-notification'; |
| 32 |
public $types = 'offer_announcement'; |
| 33 |
public $module = 'modules_announcements'; |
| 34 |
public $module_priority = 18; |
| 35 |
public $is_pro = true; |
| 36 |
public $link_type = 'announcements_link'; |
| 37 |
|
| 38 |
/** |
| 39 |
* Initially Invoked when initialized. |
| 40 |
*/ |
| 41 |
public function __construct(){ |
| 42 |
parent::__construct(); |
| 43 |
} |
| 44 |
|
| 45 |
public function init_extension() |
| 46 |
{ |
| 47 |
$this->title = __('Discount Alert', 'notificationx'); |
| 48 |
$this->module_title = __('Discount Alert', 'notificationx'); |
| 49 |
$this->themes = [ |
| 50 |
'theme-1' => [ |
| 51 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/announcements/theme-1.png', |
| 52 |
'image_shape' => 'rounded', |
| 53 |
'template' => [ |
| 54 |
'first_param' => 'tag_offer_title', |
| 55 |
'custom_first_param' => __('Flash Sale: Limited Time Offer!' , 'notificationx'), |
| 56 |
'third_param' => 'tag_offer_description', |
| 57 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx'), |
| 58 |
'fourth_param' => 'tag_time', |
| 59 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 60 |
// 'fifth_param' => 'tag_offer_discount', |
| 61 |
// 'custom_fifth_param' => __( 'Some time ago', 'notificationx' ), |
| 62 |
], |
| 63 |
'defaults' => [ |
| 64 |
// 'announcement_link_button' => false, |
| 65 |
'link' => '#', |
| 66 |
'offer_title' => __( 'Flash Sale: Limited Time Offer!', 'notificationx' ), |
| 67 |
'offer_description' => __( 'Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx' ), |
| 68 |
'announcement_link_button_text' => __( 'Grab Now', 'notificationx' ), |
| 69 |
], |
| 70 |
], |
| 71 |
'theme-2' => [ |
| 72 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/announcements/theme-2.png', |
| 73 |
'template' => [ |
| 74 |
'first_param' => 'tag_offer_title', |
| 75 |
'custom_first_param' => __('Flash Sale: Limited Time Offer!' , 'notificationx'), |
| 76 |
'third_param' => 'tag_offer_description', |
| 77 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx'), |
| 78 |
'fourth_param' => 'tag_time', |
| 79 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 80 |
// 'fifth_param' => 'tag_offer_discount', |
| 81 |
// 'custom_fifth_param' => __( '25% OFF', 'notificationx' ), |
| 82 |
], |
| 83 |
'defaults' => [ |
| 84 |
// 'announcement_link_button' => false, |
| 85 |
'link' => '#', |
| 86 |
'offer_title' => __( 'Flash Sale: Limited Time Offer!', 'notificationx' ), |
| 87 |
'offer_description' => __( 'Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx' ), |
| 88 |
'announcement_link_button_text' => __( 'Grab Now', 'notificationx' ), |
| 89 |
], |
| 90 |
'image_shape' => 'circle', |
| 91 |
], |
| 92 |
'theme-12' => [ |
| 93 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/announcements/theme-12.png', |
| 94 |
'template' => [ |
| 95 |
'first_param' => 'tag_offer_title', |
| 96 |
'custom_first_param' => __('Flash Sale: Limited Time Offer!' , 'notificationx'), |
| 97 |
'third_param' => 'tag_offer_description', |
| 98 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx'), |
| 99 |
'fourth_param' => 'tag_time', |
| 100 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 101 |
// 'fifth_param' => 'tag_offer_discount', |
| 102 |
// 'custom_fifth_param' => __( '25% OFF', 'notificationx' ), |
| 103 |
], |
| 104 |
'defaults' => [ |
| 105 |
// 'announcement_link_button' => true, |
| 106 |
'announcement_link_button_text' => __( 'Buy Now', 'notificationx' ), |
| 107 |
'link' => '#', |
| 108 |
'offer_title' => __( 'Flash Sale: Limited Time Offer!', 'notificationx' ), |
| 109 |
'link_button' => true, |
| 110 |
], |
| 111 |
'image_shape' => 'rounded', |
| 112 |
], |
| 113 |
// 'theme-13' => [ |
| 114 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/announcements/theme-13.png', |
| 115 |
// 'template' => [ |
| 116 |
// 'first_param' => 'tag_offer_title', |
| 117 |
// 'custom_first_param' => __('How Does It Works' , 'notificationx'), |
| 118 |
// ], |
| 119 |
// 'defaults' => [ |
| 120 |
// // 'announcement_link_button' => false, |
| 121 |
// 'announcement_link_button_text' => __( 'Watch Now', 'notificationx' ), |
| 122 |
// 'offer_title' => __( 'How Does It Works', 'notificationx' ), |
| 123 |
// 'link' => '#', |
| 124 |
// ], |
| 125 |
// ], |
| 126 |
'theme-14' => [ |
| 127 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/announcements/theme-14.png', |
| 128 |
'image_shape' => 'circle', |
| 129 |
'template' => [ |
| 130 |
'first_param' => 'tag_offer_title', |
| 131 |
'custom_first_param' => __('Hi There!' , 'notificationx'), |
| 132 |
'third_param' => 'tag_offer_description', |
| 133 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx'), |
| 134 |
'fourth_param' => 'tag_time', |
| 135 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 136 |
// 'fifth_param' => 'tag_offer_discount', |
| 137 |
// 'custom_fifth_param' => __( 'Some time ago', 'notificationx' ), |
| 138 |
], |
| 139 |
'defaults' => [ |
| 140 |
// 'announcement_link_button' => false, |
| 141 |
'announcement_link_button_text' => __( 'Get It Now', 'notificationx' ), |
| 142 |
'offer_title' => __( 'Hi There!', 'notificationx' ), |
| 143 |
'link' => '#', |
| 144 |
], |
| 145 |
], |
| 146 |
'theme-15' => [ |
| 147 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/announcements/theme-15.png', |
| 148 |
'template' => [ |
| 149 |
'first_param' => 'tag_offer_title', |
| 150 |
'custom_first_param' => __('Hi There!' , 'notificationx'), |
| 151 |
'third_param' => 'tag_offer_description', |
| 152 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO', 'notificationx'), |
| 153 |
], |
| 154 |
'defaults' => [ |
| 155 |
// 'announcement_link_button' => false, |
| 156 |
'announcement_link_button_text' => __( 'Book Now', 'notificationx' ), |
| 157 |
'offer_title' => __( 'Hi There!', 'notificationx' ), |
| 158 |
'offer_description' => __( 'Enjoy flat 50% Off on NotificationX PRO', 'notificationx' ), |
| 159 |
'link' => '#', |
| 160 |
], |
| 161 |
], |
| 162 |
]; |
| 163 |
$this->res_themes = [ |
| 164 |
'res-theme-one' => [ |
| 165 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_announcements/announcements-res-theme-1.png', |
| 166 |
'image_shape' => 'rounded', |
| 167 |
'template' => [ |
| 168 |
'first_param' => 'tag_offer_title', |
| 169 |
'custom_first_param' => __('Flash Sale:' , 'notificationx'), |
| 170 |
'third_param' => 'tag_offer_description', |
| 171 |
'fourth_param' => 'tag_time', |
| 172 |
], |
| 173 |
'is_pro' => true, |
| 174 |
], |
| 175 |
'res-theme-two' => [ |
| 176 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_announcements/announcements-res-theme-2.png', |
| 177 |
'template' => [ |
| 178 |
'first_param' => 'tag_offer_title', |
| 179 |
'custom_first_param' => __('Flash Sale: Limited Time Offer!' , 'notificationx'), |
| 180 |
'third_param' => 'tag_offer_description', |
| 181 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx'), |
| 182 |
'fourth_param' => 'tag_time', |
| 183 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 184 |
// 'fifth_param' => 'tag_offer_discount', |
| 185 |
// 'custom_fifth_param' => __( '25% OFF', 'notificationx' ), |
| 186 |
], |
| 187 |
'is_pro' => true, |
| 188 |
], |
| 189 |
'res-theme-three' => [ |
| 190 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_announcements/announcements-res-theme-3.png', |
| 191 |
'template' => [ |
| 192 |
'first_param' => 'tag_offer_title', |
| 193 |
'custom_first_param' => __('Flash Sale: Limited Time Offer!' , 'notificationx'), |
| 194 |
'third_param' => 'tag_offer_description', |
| 195 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx'), |
| 196 |
'fourth_param' => 'tag_time', |
| 197 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 198 |
// 'fifth_param' => 'tag_offer_discount', |
| 199 |
// 'custom_fifth_param' => __( '25% OFF', 'notificationx' ), |
| 200 |
], |
| 201 |
'is_pro' => true, |
| 202 |
], |
| 203 |
'res-theme-four' => [ |
| 204 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_announcements/announcements-res-theme-4.png', |
| 205 |
'image_shape' => 'circle', |
| 206 |
'template' => [ |
| 207 |
'first_param' => 'tag_offer_title', |
| 208 |
'custom_first_param' => __('Hi There!' , 'notificationx'), |
| 209 |
'third_param' => 'tag_offer_description', |
| 210 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO Valid till this week', 'notificationx'), |
| 211 |
'fourth_param' => 'tag_time', |
| 212 |
'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 213 |
], |
| 214 |
'is_pro' => true, |
| 215 |
], |
| 216 |
'res-theme-five' => [ |
| 217 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_announcements/announcements-res-theme-5.png', |
| 218 |
'template' => [ |
| 219 |
'first_param' => 'tag_offer_title', |
| 220 |
'custom_first_param' => __('Hi There!' , 'notificationx'), |
| 221 |
'third_param' => 'tag_offer_description', |
| 222 |
'custom_third_param' => __('Enjoy flat 50% Off on NotificationX PRO', 'notificationx'), |
| 223 |
], |
| 224 |
'is_pro' => true, |
| 225 |
], |
| 226 |
]; |
| 227 |
|
| 228 |
$this->templates = [ |
| 229 |
'announcements_template_new' => [ |
| 230 |
'first_param' => [ |
| 231 |
'tag_offer_title' => __('Offer Title', 'notificationx'), |
| 232 |
], |
| 233 |
'third_param' => [ |
| 234 |
'tag_offer_description' => __('Offer Description', 'notificationx'), |
| 235 |
// 'tag_anonymous_title' => __('Anonymous Title' , 'notificationx'), |
| 236 |
], |
| 237 |
'fourth_param' => [ |
| 238 |
'tag_time' => __('Definite Time', 'notificationx'), |
| 239 |
'tag_sometime' => __('Some time ago', 'notificationx'), |
| 240 |
], |
| 241 |
'fifth_param' => [ |
| 242 |
'tag_offer_discount' => __('Discount', 'notificationx'), |
| 243 |
'tag_offer_image' => __('Image', 'notificationx'), |
| 244 |
], |
| 245 |
'_themes' => [ |
| 246 |
"{$this->id}_theme-1", |
| 247 |
"{$this->id}_theme-2", |
| 248 |
"{$this->id}_theme-12", |
| 249 |
"{$this->id}_theme-14", |
| 250 |
"{$this->id}_theme-15", |
| 251 |
], |
| 252 |
], |
| 253 |
]; |
| 254 |
} |
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
/** |
| 259 |
* Get data for CustomNotification Extension. |
| 260 |
* |
| 261 |
* @param array $args Settings arguments. |
| 262 |
* @return array |
| 263 |
*/ |
| 264 |
public function get_data( $args = array() ){ |
| 265 |
return 'Hello From Custom Notification'; |
| 266 |
} |
| 267 |
|
| 268 |
public function doc(){ |
| 269 |
return sprintf(__('<p>You can showcase the discount alert popup on your WordPress website to make visitors take purchasing action immediately. For further assistance, check out our step-by-step <a target="_blank" href="%1$s">documentation</a>.</p> |
| 270 |
<p><strong>Recommended Blog:</strong></p> |
| 271 |
<p>🔥Introducing Discount Alert By NotificationX <a target="_blank" href="%2$s">Guide To Notify Customers About On-Sale Products</a> </p>', 'notificationx'), |
| 272 |
'https://notificationx.com/docs/configure-discount-alert/', |
| 273 |
'https://notificationx.com/discount-alerts/' |
| 274 |
); |
| 275 |
} |
| 276 |
} |
| 277 |
|