PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.3
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.3
3.3.3 3.3.2 3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 158 releases
notificationx / includes / Extensions / EDD / EDInline.php

EDInline.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 3.3.3, at includes/Extensions/EDD/EDInline.php

120 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * EDD Extension
5 *
6 * @package NotificationX\Extensions
7 */
8
9 namespace NotificationX\Extensions\EDD;
10
11 /**
12 * EDD Extension
13 */
14 class EDDInline extends EDD {
15 protected static $instance = null;
16
17 public $priority = 10;
18 public $id = 'edd_inline';
19 public $img = NOTIFICATIONX_ADMIN_URL . 'images/extensions/sources/edd.png';
20 public $doc_link = 'https://notificationx.com/docs/notificationx-easy-digital-downloads/';
21 public $types = 'inline';
22 public $module = 'modules_edd';
23 public $module_priority = 5;
24 public $class = 'Easy_Digital_Downloads';
25 public $is_pro = true;
26
27 /**
28 * Initially Invoked when initialized.
29 */
30 public function __construct() {
31 add_filter( 'nx_show_on_exclude', array( $this, 'show_on_exclude' ), 10, 4 );
32 parent::__construct();
33 }
34
35 public function init_extension()
36 {
37 $this->themes = [
38 'conv-theme-seven' => array(
39 'is_pro' => true,
40 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/woo-inline.jpg',
41 'image_shape' => 'rounded',
42 'inline_location' => ['edd_single'],
43 'template' => [
44 'first_param' => 'tag_sales_count',
45 'custom_first_param' => __( 'Someone', 'notificationx' ),
46 'second_param' => __( 'people purchased', 'notificationx' ),
47 'third_param' => 'tag_custom',
48 'custom_third_param' => ' ',
49 'fourth_param' => 'tag_7days',
50 'custom_fourth_param' => __( 'in last {{day:7}}', 'notificationx' ),
51 ],
52 ),
53 ];
54 $this->templates = [
55 'woo_template_sales_count' => [
56 'first_param' => [
57 'tag_sales_count' => __( 'Sales Count', 'notificationx' ),
58 ],
59 'third_param' => [
60 'tag_product_title' => __( 'Product Title', 'notificationx' ),
61 ],
62 'fourth_param' => [
63 'tag_1day' => __( 'In last 1 day', 'notificationx' ),
64 'tag_7days' => __( 'In last 7 days', 'notificationx' ),
65 'tag_30days' => __( 'In last 30 days', 'notificationx' ),
66 ],
67 '_themes' => [
68 "{$this->id}_conv-theme-seven",
69 ],
70 ],
71 ];
72 }
73
74 /**
75 * Keep this source's notifications out of the popup loop in
76 * FrontEnd::get_notifications_ids(). They render inline at the hooks
77 * chosen in `inline_location`, never as a floating popup.
78 *
79 * `inline_location` is not read here on purpose: it can be saved as ''
80 * (MCP or Quick Builder create without the field), and passing that to
81 * array_diff() is a TypeError on PHP 8 that white-screens every page.
82 *
83 * @param bool $exclude Whether an earlier callback already excluded it.
84 * @param array $settings Notification settings.
85 * @return bool
86 */
87 public function show_on_exclude( $exclude, $settings ) {
88 if ( isset( $settings['type'], $settings['source'] ) && 'inline' === $settings['type'] && $this->id === $settings['source'] ) {
89 return true;
90 }
91 return $exclude;
92 }
93 /**
94 * Get the instance of called class.
95 *
96 * @return ReviewX
97 */
98 public static function get_instance($args = null){
99 if ( is_null( static::$instance ) ) {
100 $class = __CLASS__;
101 if(strpos($class, "NotificationX\\") === 0){
102 $pro_class = str_replace("NotificationX\\", "NotificationXPro\\", $class);
103 if(class_exists($pro_class)){
104 $class = $pro_class;
105 }
106 }
107
108 if(!empty($args)){
109 static::$instance = new $class($args);
110 }
111 else{
112 static::$instance = new $class;
113 }
114 }
115 return static::$instance;
116 }
117
118
119 }
120