PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / trunk
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar vtrunk
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
← All changes | includes/Types/DownloadStats.php +214 -0 0.2.5.6trunk View file →
@@ -1,0 +1,214 @@
1 +<?php
2 +
3 +/**
4 + * Extension Abstract
5 + *
6 + * @package NotificationX\Extensions
7 + */
8 +
9 +namespace NotificationX\Types;
10 +
11 +use NotificationX\Extensions\GlobalFields;
12 +use NotificationX\GetInstance;
13 +use NotificationX\Core\Rules;
14 +
15 +/**
16 + * Extension Abstract for all Extension.
17 + * @method static DownloadStats get_instance($args = null)
18 + */
19 +class DownloadStats extends Types {
20 + /**
21 + * Instance of Admin
22 + *
23 + * @var Admin
24 + */
25 + use GetInstance;
26 +
27 + public $priority = 30;
28 + public $themes = [];
29 + public $module = [
30 + 'modules_wordpress',
31 + 'modules_freemius',
32 + ];
33 + public $default_source = 'wp_stats';
34 + public $default_theme = 'download_stats_today-download';
35 + public $link_type = 'stats_page';
36 +
37 +
38 + /**
39 + * Initially Invoked when initialized.
40 + */
41 + public function __construct() {
42 + parent::__construct();
43 + $this->id = 'download_stats';
44 + }
45 +
46 + public function init()
47 + {
48 + parent::init();
49 + $this->title = __('Download Stats', 'notificationx');
50 + $this->themes = [
51 + 'today-download' => [
52 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/today-download.png',
53 + 'image_shape' => 'square',
54 + 'template' => [
55 + 'first_param' => 'tag_plugin_theme_name',
56 + 'custom_first_param' => '',
57 + 'second_param' => __('has been downloaded' , 'notificationx'),
58 + 'third_param' => 'tag_today',
59 + 'custom_third_param' => '',
60 + 'fourth_param' => 'tag_today_text',
61 + 'custom_fourth_param' => '',
62 + ],
63 + ],
64 + '7day-download' => [
65 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/7day-download.png',
66 + 'image_shape' => 'rounded',
67 + 'template' => [
68 + 'first_param' => 'tag_plugin_theme_name',
69 + 'custom_first_param' => '',
70 + 'second_param' => __('has been downloaded', 'notificationx'),
71 + 'third_param' => 'tag_last_week',
72 + 'custom_third_param' => '',
73 + 'fourth_param' => 'tag_last_week_text',
74 + 'custom_fourth_param' => '',
75 + ],
76 + ],
77 + 'actively_using' => [
78 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/actively-using.png',
79 + 'image_shape' => 'rounded',
80 + 'template' => [
81 + 'first_param' => 'tag_active_installs',
82 + 'custom_first_param' => '',
83 + 'second_param' => __('people are actively using' , 'notificationx'),
84 + 'third_param' => 'tag_plugin_theme_name',
85 + 'custom_third_param' => '',
86 + ],
87 + ],
88 + 'total-download' => [
89 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/total-download.png',
90 + 'image_shape' => 'circle',
91 + 'template' => [
92 + 'first_param' => 'tag_plugin_theme_name',
93 + 'custom_first_param' => '',
94 + 'second_param' => __('has been downloaded', 'notificationx'),
95 + 'third_param' => 'tag_all_time',
96 + 'custom_third_param' => '',
97 + 'fourth_param' => 'tag_all_time_text',
98 + 'custom_fourth_param' => '',
99 + ],
100 + ],
101 + ];
102 + $this->res_themes = [
103 + 'res-today-download' => [
104 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_wporg/wporg-res-theme-1.png',
105 + 'image_shape' => 'square',
106 + '_template' => 'wp_stats_template_new',
107 + 'is_pro' => true,
108 + ],
109 + 'res-7day-download' => [
110 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_wporg/wporg-res-theme-2.png',
111 + 'image_shape' => 'rounded',
112 + '_template' => 'wp_stats_template_new',
113 + 'is_pro' => true,
114 + ],
115 + 'res-actively_using' => [
116 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_wporg/wporg-res-theme-3.png',
117 + 'image_shape' => 'rounded',
118 + '_template' => 'actively_using_template_new',
119 + 'is_pro' => true,
120 + ],
121 + 'res-total-download' => [
122 + 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_wporg/wporg-res-theme-4.png',
123 + 'image_shape' => 'circle',
124 + '_template' => 'wp_stats_template_new',
125 + 'is_pro' => true,
126 + ],
127 + ];
128 + $this->templates = [
129 + 'wp_stats_template_new' => [
130 + 'first_param' => [
131 + 'tag_plugin_theme_name' => __('Plugin/Theme Name', 'notificationx'),
132 +
133 + ],
134 + 'third_param' => [
135 + 'tag_today' => __('Today', 'notificationx'),
136 + 'tag_last_week' => __('In last 7 days', 'notificationx'),
137 + 'tag_all_time' => __('Total', 'notificationx'),
138 + 'tag_active_installs' => __('Total Active Install', 'notificationx'),
139 +
140 + ],
141 + 'fourth_param' => [
142 + 'tag_today_text' => __('Try it out', 'notificationx'),
143 + 'tag_last_week_text' => __('Get Started for Free.', 'notificationx'),
144 + 'tag_all_time_text' => __('Why Don\'t You?', 'notificationx'),
145 + 'tag_active_installs_text' => __('in total active', 'notificationx'),
146 + ],
147 + '_themes' => [
148 + 'download_stats_today-download',
149 + 'download_stats_7day-download',
150 + 'download_stats_total-download',
151 + ]
152 + ],
153 + 'actively_using_template_new' => [
154 + 'first_param' => [
155 + 'tag_today' => __('Today', 'notificationx'),
156 + 'tag_last_week' => __('In last 7 days', 'notificationx'),
157 + 'tag_all_time' => __('Total', 'notificationx'),
158 + 'tag_active_installs' => __('Total Active Install', 'notificationx'),
159 + ],
160 + 'third_param' => [
161 + 'tag_plugin_theme_name' => __('Plugin/Theme Name', 'notificationx'),
162 + ],
163 + '_themes' => [
164 + 'download_stats_actively_using',
165 + ]
166 + ],
167 + ];
168 + }
169 +
170 + /**
171 + * Hooked to nx_before_metabox_load action.
172 + *
173 + * @return void
174 + */
175 + public function init_fields() {
176 + parent::init_fields();
177 + add_filter('nx_link_types', [$this, 'link_types']);
178 + add_filter('nx_content_fields', [$this, 'content_fields'], 20);
179 + }
180 + /**
181 + * Content Fields function
182 + *
183 + * @param array $options
184 + * @return array
185 + */
186 + public function content_fields($fields) {
187 + $fields['content']['fields']['random_order'] = Rules::is('type', $this->id, true, $fields["content"]['fields']['random_order']);
188 + return $fields;
189 + }
190 +
191 + /**
192 + * Adds option to Link Type field in Content tab.
193 + *
194 + * @param array $options
195 + * @return array
196 + */
197 + public function link_types($options) {
198 + $_options = GlobalFields::get_instance()->normalize_fields([
199 + 'stats_page' => __('Product Page', 'notificationx'),
200 + ], 'type', $this->id);
201 +
202 + return array_merge($options, $_options);
203 + }
204 +
205 + public function preview_entry($entry, $settings){
206 + $entry['image_data'] = array(
207 + 'url' => "https://ps.w.org/notificationx/assets/icon-256x256.gif?rev=2783824",
208 + 'alt' => '',
209 + 'classes' => 'greview_icon',
210 + );
211 + return $entry;
212 + }
213 +
214 +}