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
← All changes | includes/Extensions/LearnDash/LearnDashInline.php +120 -0 0.2.5.5 → 3.3.3 View file →
@@ -1,0 +1,120 @@
1 +<?php
2 +
3 +/**
4 + * EDD Extension
5 + *
6 + * @package NotificationX\Extensions
7 + */
8 +
9 +namespace NotificationX\Extensions\LearnDash;
10 +
11 +/**
12 + * EDD Extension
13 + */
14 +class LearnDashInline extends LearnDash {
15 + protected static $instance = null;
16 +
17 + public $priority = 20;
18 + public $id = 'learndash_inline';
19 + public $img = NOTIFICATIONX_ADMIN_URL . 'images/extensions/sources/learndash.png';
20 + public $doc_link = 'https://notificationx.com/docs/how-to-display-learndash-course-enrollment-alert-using-notificationx/';
21 + public $types = 'inline';
22 + public $module = 'modules_learndash';
23 + public $module_priority = 18;
24 + public $is_pro = true;
25 + public $version = '1.2.0';
26 + public $class = '\LDLMS_Post_Types';
27 +
28 + /**
29 + * Initially Invoked when initialized.
30 + */
31 + public function __construct() {
32 + parent::__construct();
33 + add_filter( 'nx_show_on_exclude', array( $this, 'show_on_exclude' ), 10, 4 );
34 + }
35 +
36 + public function init_extension()
37 + {
38 + $this->themes = [
39 + 'conv-theme-seven' => array(
40 + 'is_pro' => true,
41 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/learndash-inline.png',
42 + 'image_shape' => 'rounded',
43 + 'inline_location' => ['learndash_content'],
44 + 'template' => [
45 + 'first_param' => 'tag_sales_count',
46 + 'second_param' => __('people enrolled', '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 + 'learndash_inline_template_sales_count' => [
56 + 'first_param' => [
57 + 'tag_sales_count' => __( 'Sales Count', 'notificationx' ),
58 + ],
59 + 'third_param' => [
60 + 'tag_course_title' => __('Course 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 + 'learndash_inline_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 + /**
95 + * Get the instance of called class.
96 + *
97 + * @return ReviewX
98 + */
99 + public static function get_instance($args = null){
100 + if ( is_null( static::$instance ) ) {
101 + $class = __CLASS__;
102 + if(strpos($class, "NotificationX\\") === 0){
103 + $pro_class = str_replace("NotificationX\\", "NotificationXPro\\", $class);
104 + if(class_exists($pro_class)){
105 + $class = $pro_class;
106 + }
107 + }
108 +
109 + if(!empty($args)){
110 + static::$instance = new $class($args);
111 + }
112 + else{
113 + static::$instance = new $class;
114 + }
115 + }
116 + return static::$instance;
117 + }
118 +
119 +
120 +}