PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.2.13
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.2.13
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 1.2.0 1.2.1 All 156 releases
notificationx / includes / Extensions / LearnDash / LearnDashInline.php

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

120 lines 3.9 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\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 * @todo Something
76 *
77 * @param [type] $exclude
78 * @param [type] $settings
79 * @return void
80 */
81 public function show_on_exclude( $exclude, $settings ) {
82 if ( 'inline' === $settings['type'] && $settings['source'] === $this->id ) {
83 $edd_location = $settings['inline_location'];
84 $hooks = [ 'tutor_course/loop/after_title' ];
85 $diff = array_diff( $hooks, $edd_location );
86 if ( count( $diff ) <= count( $hooks ) ) {
87 return true;
88 }
89 }
90 return $exclude;
91 }
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