| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* flashing Extension |
| 5 |
* |
| 6 |
* @package NotificationX\Extensions |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace NotificationX\Extensions\FlashingTab; |
| 10 |
|
| 11 |
use NotificationX\Core\Helper; |
| 12 |
use NotificationX\Core\Locations; |
| 13 |
use NotificationX\Core\PostType; |
| 14 |
use NotificationX\Core\Rules; |
| 15 |
use NotificationX\Extensions\Extension; |
| 16 |
use NotificationX\Extensions\GlobalFields; |
| 17 |
use NotificationX\FrontEnd\FrontEnd; |
| 18 |
use NotificationX\GetInstance; |
| 19 |
|
| 20 |
/** |
| 21 |
* flashing Extension |
| 22 |
* @method static FlashingTab get_instance($args = null) |
| 23 |
*/ |
| 24 |
class FlashingTab extends Extension { |
| 25 |
/** |
| 26 |
* Instance of flashing |
| 27 |
* |
| 28 |
* @var FlashingTab |
| 29 |
*/ |
| 30 |
use GetInstance; |
| 31 |
|
| 32 |
public $priority = 5; |
| 33 |
public $id = 'flashing_tab'; |
| 34 |
public $img = ''; |
| 35 |
public $doc_link = 'https://notificationx.com/docs/flashing-tab-alerts/'; |
| 36 |
public $types = 'flashing_tab'; |
| 37 |
// used in Settings > General tab |
| 38 |
public $module = 'modules_flashing'; |
| 39 |
public $module_priority = 30; |
| 40 |
public $default_theme = 'flashing_tab_theme-1'; |
| 41 |
public $is_pro = true; |
| 42 |
|
| 43 |
/** |
| 44 |
* Initially Invoked when initialized. |
| 45 |
*/ |
| 46 |
public function __construct() { |
| 47 |
parent::__construct(); |
| 48 |
} |
| 49 |
|
| 50 |
public function init_extension() |
| 51 |
{ |
| 52 |
$this->title = __('Flashing Tab', 'notificationx'); |
| 53 |
$this->module_title = __('Flashing Tab', 'notificationx'); |
| 54 |
$this->themes = [ |
| 55 |
'theme-1' => array( |
| 56 |
'is_pro' => true, |
| 57 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/flashing-tab/theme-1.gif', |
| 58 |
'defaults' => [ |
| 59 |
'ft_theme_one_icons' => [ |
| 60 |
'icon-one' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-1-icon-1.png', |
| 61 |
'icon-two' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-1-icon-2.png', |
| 62 |
], |
| 63 |
'ft_theme_one_message' => __('Comeback!', 'notificationx'), |
| 64 |
], |
| 65 |
), |
| 66 |
'theme-2' => array( |
| 67 |
'is_pro' => true, |
| 68 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/flashing-tab/theme-2.gif', |
| 69 |
'defaults' => [ |
| 70 |
'ft_theme_one_icons' => [ |
| 71 |
'icon-one' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-2-icon-1.png', |
| 72 |
'icon-two' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-2-icon-2.png', |
| 73 |
], |
| 74 |
'ft_theme_one_message' => __('Comeback! We miss you.', 'notificationx'), |
| 75 |
], |
| 76 |
), |
| 77 |
'theme-3' => array( |
| 78 |
'is_pro' => true, |
| 79 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/flashing-tab/theme-3.gif', |
| 80 |
'defaults' => [ |
| 81 |
'ft_theme_three_line_one' => [ |
| 82 |
'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-3-icon-1.png', |
| 83 |
'message' => __('Comeback!', 'notificationx'), |
| 84 |
], |
| 85 |
'ft_theme_three_line_two' => [ |
| 86 |
'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-3-icon-2.png', |
| 87 |
'message' => __('You forgot to purchase!', 'notificationx'), |
| 88 |
], |
| 89 |
], |
| 90 |
), |
| 91 |
'theme-4' => array( |
| 92 |
'is_pro' => true, |
| 93 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/flashing-tab/theme-4.gif', |
| 94 |
'defaults' => [ |
| 95 |
// 'ft_theme_three_line_one' => 'dddddd', |
| 96 |
'ft_theme_three_line_one' => [ |
| 97 |
'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-4-icon-1.png', |
| 98 |
'message' => __('Comeback!', 'notificationx'), |
| 99 |
], |
| 100 |
'ft_theme_four_line_two' => [ |
| 101 |
'is-show-empty' => false, |
| 102 |
'default' => [ |
| 103 |
'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-4-icon-2.png', |
| 104 |
'message' => __('{quantity} items in your cart!', 'notificationx'), |
| 105 |
], |
| 106 |
'alternative' => [ |
| 107 |
'icon' => NOTIFICATIONX_PUBLIC_URL . 'image/flashing-tab/theme-4-icon-2.png', |
| 108 |
'message' => '', |
| 109 |
], |
| 110 |
], |
| 111 |
], |
| 112 |
), |
| 113 |
]; |
| 114 |
} |
| 115 |
|
| 116 |
public function init_fields(){ |
| 117 |
parent::init_fields(); |
| 118 |
|
| 119 |
add_filter( 'nx_metabox_tabs', [ $this, 'nx_tabs' ], 15 ); |
| 120 |
} |
| 121 |
|
| 122 |
/** |
| 123 |
* Undocumented function |
| 124 |
* |
| 125 |
* @param [type] $tabs |
| 126 |
* @return void |
| 127 |
*/ |
| 128 |
public function nx_tabs( $tabs ) { |
| 129 |
$tabs['display_tab'] = Rules::is( 'source', $this->id, true, $tabs['display_tab'] ); |
| 130 |
$tabs['customize_tab'] = Rules::is( 'source', $this->id, true, $tabs['customize_tab'] ); |
| 131 |
return $tabs; |
| 132 |
} |
| 133 |
|
| 134 |
public function doc(){ |
| 135 |
// translators: links |
| 136 |
return sprintf(__(' |
| 137 |
<p>Make sure that you have NotificationX PRO installed and activated on your website to use Flashing Tab. For further assistance, follow the step-by-step <a target="_blank" href="%1$s">documentation</a>.</p> |
| 138 |
<p>🎥 Get a quick demo from the <a target="_blank" href="%2$s">video tutorial</a></p> |
| 139 |
<p>📖 Recommended Blog:</p> |
| 140 |
<p>🔥How To <a target="_blank" href="%3$s">Attract Customers With Flashing Browser Tab Notification Using NotificationX?</a></p> |
| 141 |
', 'notificationx'), |
| 142 |
'https://notificationx.com/docs/flashing-tab-alerts/', |
| 143 |
'https://www.youtube.com/watch?v=RCyB06nI-Xc', |
| 144 |
'https://notificationx.com/blog/flashing-browser-tab-notifications/' |
| 145 |
); |
| 146 |
} |
| 147 |
} |
| 148 |
|