| 1 |
<?php |
| 2 |
/** |
| 3 |
* CustomNotification Extension |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Extensions\CustomNotification; |
| 9 |
|
| 10 |
use NotificationX\GetInstance; |
| 11 |
use NotificationX\Extensions\Extension; |
| 12 |
use NotificationX\Extensions\ExtensionFactory; |
| 13 |
use NotificationX\Types\Conversions; |
| 14 |
|
| 15 |
/** |
| 16 |
* CustomNotification Extension |
| 17 |
* @method static CustomNotification get_instance($args = null) |
| 18 |
*/ |
| 19 |
class CustomNotification extends Extension { |
| 20 |
/** |
| 21 |
* Instance of CustomNotification |
| 22 |
* |
| 23 |
* @var CustomNotification |
| 24 |
*/ |
| 25 |
use GetInstance; |
| 26 |
|
| 27 |
public $priority = 5; |
| 28 |
public $id = 'custom_notification'; |
| 29 |
public $img = NOTIFICATIONX_ADMIN_URL . 'images/extensions/sources/custom.png'; |
| 30 |
public $doc_link = 'https://notificationx.com/docs/custom-notification'; |
| 31 |
public $types = 'custom'; |
| 32 |
public $module = 'modules_custom_notification'; |
| 33 |
public $module_priority = 13; |
| 34 |
public $is_pro = true; |
| 35 |
public $link_type = '-1'; |
| 36 |
|
| 37 |
/** |
| 38 |
* Initially Invoked when initialized. |
| 39 |
*/ |
| 40 |
public function __construct(){ |
| 41 |
parent::__construct(); |
| 42 |
} |
| 43 |
|
| 44 |
public function init_extension() |
| 45 |
{ |
| 46 |
$this->title = __('Custom Notification', 'notificationx'); |
| 47 |
$this->module_title = __('Custom Notification', 'notificationx'); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Get data for CustomNotification Extension. |
| 52 |
* |
| 53 |
* @param array $args Settings arguments. |
| 54 |
* @return array |
| 55 |
*/ |
| 56 |
public function get_data( $args = array() ){ |
| 57 |
return 'Hello From Custom Notification'; |
| 58 |
} |
| 59 |
|
| 60 |
public function supported_themes() { |
| 61 |
$custom = []; |
| 62 |
$custom['sales_count'] = $this->get_themes_for_type('conversions_count'); |
| 63 |
$custom['conversions'] = $this->get_themes_for_type('conversions'); |
| 64 |
$custom['maps_theme'] = $this->get_themes_for_type('maps_theme'); |
| 65 |
$custom['comments'] = $this->get_themes_for_type('comments'); |
| 66 |
$custom['reviews'] = $this->get_themes_for_type('reviews'); |
| 67 |
$custom['stats'] = $this->get_themes_for_type('download_stats'); |
| 68 |
$custom['subs'] = $this->get_themes_for_type('email_subscription'); |
| 69 |
return $custom; |
| 70 |
} |
| 71 |
|
| 72 |
public function get_themes_for_type($type) { |
| 73 |
$conversions_count = Conversions::get_instance()->conversions_count; |
| 74 |
$maps_theme = array('conversions_maps_theme', 'conversions_conv-theme-six', 'comments_maps_theme', 'email_subscription_maps_theme'); |
| 75 |
if ($type == 'conversions_count') return $conversions_count; |
| 76 |
if ($type == 'maps_theme') { |
| 77 |
return $maps_theme; |
| 78 |
} |
| 79 |
|
| 80 |
$themes = ExtensionFactory::get_instance()->get_themes_for_type($type); |
| 81 |
|
| 82 |
if ($type == 'conversions') { |
| 83 |
$themes = array_values(array_diff($themes, $conversions_count)); |
| 84 |
} |
| 85 |
$themes = array_values(array_diff($themes, $maps_theme)); |
| 86 |
|
| 87 |
return $themes; |
| 88 |
} |
| 89 |
|
| 90 |
public function doc(){ |
| 91 |
return sprintf(__('<p>You can make custom notification for its all types of campaign. For further assistance, check out our step by step <a target="_blank" href="%1$s">documentation</a>.</p> |
| 92 |
<p>🎦 Watch <a target="_blank" href="%2$s">video tutorial</a> to learn quickly</p> |
| 93 |
<p><strong>Recommended Blog:</strong></p> |
| 94 |
<p>🔥 How to <a target="_blank" href="%3$s">Display Custom Notification Alerts</a> On Your Website Using NotificationX</p>', 'notificationx'), |
| 95 |
'https://notificationx.com/docs/custom-notification/', |
| 96 |
'https://www.youtube.com/watch?v=OuTmDZ0_TEw', |
| 97 |
'https://wpdeveloper.com/custom-notificationx-alert-fomo/' |
| 98 |
); |
| 99 |
} |
| 100 |
} |
| 101 |
|