PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.2.0
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.2.0
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
hurrytimer / includes / Admin.php

Admin.php in HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce 2.2.0, at includes/Admin.php

608 lines 20.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hurrytimer;
4
5 use Hurrytimer\Utils\Helpers;
6
7 class Admin
8 {
9 /**
10 * The ID of this plugin.
11 *
12 * @since 1.0.0
13 * @access private
14 * @var string $pluginName The ID of this plugin.
15 */
16 private $pluginName;
17
18 /**
19 * The version of this plugin.
20 *
21 * @since 1.0.0
22 * @access private
23 * @var string $version The current version of this plugin.
24 */
25 private $version;
26
27 /**
28 * Initialize the class and set its properties.
29 *
30 * @param string $pluginName The name of this plugin.
31 * @param string $version The version of this plugin.
32 *
33 * @since 1.0.0
34 *
35 */
36 public function __construct($pluginName, $version)
37 {
38 $this->pluginName = $pluginName;
39 $this->version = $version;
40 add_action('wp_ajax_wcSearchProducts', [$this, 'ajaxWcSearchProducts']);
41 add_action('admin_init', [$this, 'activateCampaign']);
42 add_action('admin_init', [$this, 'deactivateCampaign']);
43 add_action('admin_init', [$this, 'resetEvergreenCampaign']);
44 add_action('admin_init', [$this, 'resetAllEvergreenCampaigns']);
45 add_action('admin_init', [$this, 'pluginSettings']);
46 add_filter('post_row_actions', [$this, 'campaignsListRowActions']);
47 add_action('admin_menu', [$this, 'menu']);
48 add_filter('bulk_actions-edit-' . HURRYT_POST_TYPE, [
49 $this,
50 'campaignsListBulkActions',
51 ]);
52
53 add_filter('manage_' . HURRYT_POST_TYPE . '_posts_columns', [
54 $this,
55 'campaignsListColumns',
56 ]);
57
58 add_action(
59 'manage_' . HURRYT_POST_TYPE . '_posts_custom_column',
60 [$this, 'countdownListColumnsContent'],
61 10,
62 2
63 );
64
65 add_filter(
66 'bulk_post_updated_messages',
67 [$this, 'customBulkPostUpdatedMessages'],
68 10,
69 2
70 );
71
72 add_action('admin_menu', [$this, 'helpTabs']);
73 add_action('admin_notices', [$this, 'resetEvergreenCampaignNotice']);
74 add_action('admin_notices', [$this, 'resetAllEvergreenCampaignNotice']);
75
76 add_action('admin_notices', [$this, 'countdown_activation_notice']);
77 add_filter('admin_footer_text', [$this, 'admin_footer_text']);
78 //removeIf(pro)
79 add_filter('plugin_action_links_' . HURRYT_BASENAME, [
80 $this,
81 'pluginLinks',
82 ]);
83 //endRemoveIf(pro)
84 }
85
86 public function admin_footer_text()
87 {
88 $screen = get_current_screen();
89 if ($screen->post_type === HURRYT_POST_TYPE) {
90 include HURRYT_DIR . 'admin/templates/footer-rate-plugin.php';
91 }
92 }
93
94 //removeIf(pro)
95 public function pluginLinks($links)
96 {
97 $links[] =
98 '<a href="https://hurrytimer.com/?utm_source=plugin&utm_medium=installed_plugins&utm_campaign=go_pro" target="_blank" class="hurryt-text-green-500 hurryt-font-bold">Go Pro</a>';
99
100 return $links;
101 }
102
103 //endRemoveIf(pro)
104
105 public function countdown_activation_notice()
106 {
107 $post_id = filter_input(INPUT_GET, 'post', FILTER_VALIDATE_INT);
108 $status = filter_input(INPUT_GET, 'hurrytimer_action');
109
110 if (!$post_id || !$status || !($post = get_post($post_id))) {
111 return;
112 }
113 if (
114 $status === "activate-compaign" &&
115 !Utils\Helpers::isPostActive($post_id)
116 ) { ?>
117 <div class="notice notice-success is-dismissible">
118 <p><?php _e(
119 'Countdown timer deactivated.',
120 "hurrytimer"
121 ); ?></p>
122 </div>
123 <?php } else { ?>
124 <div class="notice notice-success is-dismissible">
125 <p><?php _e('Countdown timer activated.', "hurrytimer"); ?></p>
126 </div>
127 <?php }
128 }
129
130 public function helpTabs()
131 {
132 add_action('load-edit.php', [$this, 'editHelpTabs']);
133 add_action('load-post-new.php', [$this, 'editHelpTabs']);
134 add_action('load-post.php', [$this, 'editHelpTabs']);
135 }
136
137 public function editHelpTabs()
138 {
139 $screen = get_current_screen();
140 if (strpos($screen->id, 'hurrytimer_countdown') === false) {
141 return;
142 }
143 $screen->remove_help_tabs();
144 }
145
146 public function customBulkPostUpdatedMessages($bulk_messages, $bulk_counts)
147 {
148 $bulk_messages[HURRYT_POST_TYPE] = [
149 'updated' => _n(
150 '%s countdown timer updated.',
151 '%s countdown timers updated.',
152 $bulk_counts['updated']
153 ),
154 'locked' => _n(
155 '%s countdown timer not updated, somebody is editing it.',
156 '%s countdown timers not updated, somebody is editing them.',
157 $bulk_counts['locked']
158 ),
159 'deleted' => _n(
160 '%s countdown timer permanently deleted.',
161 '%s countdown timers permanently deleted.',
162 $bulk_counts['deleted']
163 ),
164 'trashed' => _n(
165 '%s countdown timer deleted.',
166 '%s countdown timers deleted.',
167 $bulk_counts['trashed']
168 ),
169 'untrashed' => _n(
170 '%s countdown timer restored from the Trash.',
171 '%s countdown timers restored from the Trash.',
172 $bulk_counts['untrashed']
173 ),
174 ];
175
176 return $bulk_messages;
177 }
178
179 public function countdownListColumnsContent($column, $post_id)
180 {
181 $campaign = new Campaign($post_id);
182 switch ($column) {
183 case 'status':
184 echo $campaign->isPublished()
185 ? __('Active', "hurrytimer")
186 : __('Inactive', "hurrytimer");
187 break;
188 case 'mode':
189 if ($campaign->isEvergreen()) {
190 echo __('Evergreen', "hurrytimer");
191 }
192 if ($campaign->isRegular()) {
193 echo __('One-Time', "hurrytimer");
194 }
195 if ($campaign->isRecurring()) {
196 echo __('Recurring', "hurrytimer");
197 }
198 break;
199 case 'CampaignShortcode':
200 echo '<pre class="htmr-list-shortcode">[hurrytimer id="' .
201 $post_id .
202 '"]</pre>';
203 break;
204 }
205 }
206
207 public function campaignsListBulkActions($actions)
208 {
209 unset($actions['edit']);
210
211 return $actions;
212 }
213
214 public function campaignsListColumns($columns)
215 {
216 $allowed_columns = [];
217 foreach ($columns as $column_name => $value) {
218 if (in_array($column_name, ['cb', 'title', 'date'])) {
219 $allowed_columns[$column_name] = $value;
220 }
221 }
222
223 $columns = $allowed_columns;
224 $date = $columns['date'];
225 unset($columns['date']);
226 $columns = array_merge($columns, [
227 'status' => __('Status', "hurrytimer"),
228 'mode' => __('Mode', "hurrytimer"),
229 'CampaignShortcode' => __('CampaignShortcode', "hurrytimer"),
230 ]);
231 $columns['date'] = $date;
232
233 return $columns;
234 }
235
236 /**
237 * Register the stylesheets for the admin area.
238 *
239 * @since 1.0.0
240 */
241 public function enqueueStyles()
242 {
243 $version = defined('WP_DEBUG') && WP_DEBUG ? time() : $this->version;
244 wp_enqueue_style('wp-color-picker');
245 wp_enqueue_style('iris');
246 wp_dequeue_style('select2');
247
248 wp_enqueue_style(
249 "codemirror",
250 HURRYT_URL . 'assets/css/codemirror.css',
251 [],
252 "5.42.2",
253 'all'
254 );
255 wp_enqueue_style(
256 'hurryt-select2',
257 HURRYT_URL . 'assets/css/select2.css',
258 array(),
259 '4.0.5',
260 'all'
261 );
262
263 wp_enqueue_style(
264 'hurryt-base-css',
265 HURRYT_URL . 'assets/css/base.css',
266 array(),
267 $version,
268 'all'
269 );
270
271 wp_enqueue_style(
272 $this->pluginName,
273 HURRYT_URL . 'assets/css/admin.css',
274 ['hurryt-base-css', 'hurryt-select2'],
275 $version,
276 'all'
277 );
278 }
279
280 public function campaignsListRowActions($actions)
281 {
282 global $post;
283 if ($post->post_type === HURRYT_POST_TYPE) {
284 unset($actions['inline hide-if-no-js']);
285 }
286
287 return $actions;
288 }
289
290 /**
291 * Register the JavaScript for the admin area.
292 *
293 * @since 1.0.0
294 */
295 public function enqueueScripts()
296 {
297 wp_enqueue_script('jquery-ui-core');
298 wp_enqueue_script('jquery-ui-tooltip');
299 wp_enqueue_script('wp-color-picker');
300 wp_enqueue_script('iris');
301 wp_enqueue_script('jquery-ui-slider');
302 wp_dequeue_script('select2');
303
304 wp_enqueue_script(
305 'hurryt-cookie',
306 HURRYT_URL . 'assets/js/cookie.min.js',
307 [],
308 '2.2.0',
309 true
310 );
311
312 //removeIf(pro)
313 wp_enqueue_script(
314 "jq-modal",
315 HURRYT_URL . 'assets/js/jquery.modal.min.js',
316 ['jquery'],
317 "0.9.1",
318 true
319 );
320 //endRemoveIf(pro)
321
322 wp_enqueue_script(
323 'jq-date-picker-addon',
324 HURRYT_URL . 'assets/js/timepicker-addon.js',
325 ['jquery-ui-datepicker'],
326 '1.6.3',
327 true
328 );
329
330 wp_enqueue_script(
331 'hurryt-select2',
332 HURRYT_URL . 'assets/js/select2.min.js',
333 ['jquery'],
334 '4.0.5',
335 true
336 );
337
338 $deps = ['hurryt-cookie', 'jq-date-picker-addon', 'hurryt-select2'];
339
340 wp_enqueue_script(
341 $this->pluginName,
342 HURRYT_URL . 'assets/js/admin.js',
343 $deps,
344 $this->version,
345 true
346 );
347
348 wp_localize_script($this->pluginName, 'hurrytimer_ajax_object', array(
349 'ajax_url' => admin_url('admin-ajax.php'),
350 'headline_pos' => [
351 'above_timer' => C::HEADLINE_POSITION_ABOVE_TIMER,
352 'below_timer' => C::HEADLINE_POSITION_BELOW_TIMER,
353 ],
354 'mode' => [
355 'evergreen' => C::MODE_EVERGREEN,
356 'regular' => C::MODE_REGULAR,
357 'recurring' => C::MODE_RECURRING,
358 ],
359 ));
360 }
361
362 public function menu()
363 {
364 add_menu_page(
365 'HurryTimer',
366 'HurryTimer',
367 'manage_options',
368 'hurrytimer',
369 null,
370 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNjkuNTYgNzAuNjIiPiAgPGRlZnM+ICAgIDxsaW5lYXJHcmFkaW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CwwLDAsMy4zLS4zMUw2OS41Niw3LjgxbC0xMiwuMzJhMi40MSwyLjQxLDAsMCwwLC4xMyw0LjgyWiIgc3R5bGU9ImZpbGw6IHVybCgjYzk5ODViMWMtYjg3Zi00M2Y1LWFiMzItNWE4ZWZiMzQ1ZDA1KSIvPiAgICAgIDwvZz4gICAgPC9nPiAgPC9nPjwvc3ZnPg==',
371 55
372 );
373 add_submenu_page(
374 'hurrytimer',
375 __('Add Campaign', 'hurrytimer'),
376 __('Add Campaign', 'hurrytimer'),
377 'manage_options',
378 'post-new.php?post_type=hurrytimer_countdown'
379 );
380
381 add_submenu_page(
382 'hurrytimer',
383 __('Settings', 'hurrytimer'),
384 __('Settings', 'hurrytimer'),
385 'manage_options',
386 'hurrytimer_settings',
387 [$this, 'settings']
388 );
389 }
390
391 public function settings()
392 {
393 include_once HURRYT_DIR . 'admin/templates/settings.php';
394 }
395
396 public function activateCampaign()
397 {
398 if (
399 isset($_GET['hurrytimer_action']) &&
400 $_GET['hurrytimer_action'] === "activate-compaign" &&
401 isset($_GET['_wpnonce']) &&
402 wp_verify_nonce($_GET['_wpnonce'], 'activate-compaign')
403 ) {
404 $postId = intval($_GET['post']);
405 wp_update_post(['ID' => $postId, 'post_status' => 'publish']);
406 }
407 }
408
409 function resetEvergreenCampaignNotice()
410 {
411 if (
412 isset($_GET['hurryt-action']) &&
413 isset($_GET['hurryt-scope']) &&
414 isset($_GET['post']) &&
415 $_GET['hurryt-action'] === "reset-evergreen-compaign" &&
416 isset($_GET['_wpnonce']) &&
417 wp_verify_nonce($_GET['_wpnonce'], 'reset-evergreen-compaign')
418 ) {
419 $scopeText =
420 $_GET['hurryt-scope'] === 'admin'
421 ? ' you '
422 : ' all visitors '; ?>
423 <div class="notice notice-success is-dismissible">
424 <p><?php _e(
425 "Campaign has been reset for $scopeText successfully.",
426 'hurrytimer'
427 ); ?></p>
428 </div>
429 <?php
430 }
431 }
432 function resetAllEvergreenCampaignNotice()
433 {
434 if (
435 isset($_GET['hurryt-page']) &&
436 isset($_GET['hurryt-scope']) &&
437 isset($_GET['hurryt-action']) &&
438 $_GET['hurryt-page'] === "hurrytimer_settings" &&
439 $_GET['hurryt-action'] === "reset-all-evergreen-compaigns" &&
440 isset($_GET['_wpnonce']) &&
441 wp_verify_nonce($_GET['_wpnonce'], 'reset-all-evergreen-compaigns')
442 ) {
443 $scopeText =
444 $_GET['hurryt-scope'] === 'admin'
445 ? ' you '
446 : ' all visitors '; ?>
447 <div class="notice notice-success is-dismissible">
448 <p><?php _e(
449 "All evergreen campaigns have been reset for $scopeText successfully.",
450 'hurrytimer'
451 ); ?></p>
452 </div>
453 <?php
454 }
455 }
456 public function resetEvergreenCampaign()
457 {
458 if (
459 isset($_GET['hurryt-action']) &&
460 isset($_GET['hurryt-scope']) &&
461 isset($_GET['post']) &&
462 $_GET['hurryt-action'] === "reset-evergreen-compaign" &&
463 isset($_GET['_wpnonce']) &&
464 wp_verify_nonce($_GET['_wpnonce'], 'reset-evergreen-compaign')
465 ) {
466 $postId = intval($_GET['post']);
467 $IPDetection = new IPDetection();
468 $cookieDetection = new CookieDetection();
469 $campaign = new EvergreenCampaign(
470 $postId,
471 $cookieDetection,
472 $IPDetection
473 );
474 $campaign->reset(sanitize_text_field($_GET['hurryt-scope']));
475 }
476 }
477 public function resetAllEvergreenCampaigns()
478 {
479 if (
480 isset($_GET['hurryt-page']) &&
481 isset($_GET['hurryt-scope']) &&
482 isset($_GET['hurryt-action']) &&
483 $_GET['hurryt-page'] === "hurrytimer_settings" &&
484 $_GET['hurryt-action'] === "reset-all-evergreen-compaigns" &&
485 isset($_GET['_wpnonce']) &&
486 wp_verify_nonce($_GET['_wpnonce'], 'reset-all-evergreen-compaigns')
487 ) {
488 $evergreenCampaign = new EvergreenCampaign(null, new CookieDetection(), new IPDetection());
489 $evergreenCampaign->resetAll(sanitize_text_field($_GET['hurryt-scope']));
490 }
491 }
492 public function deactivateCampaign()
493 {
494 if (
495 isset($_GET['hurrytimer_action']) &&
496 $_GET['hurrytimer_action'] === "deactivate-compaign" &&
497 isset($_GET['_wpnonce']) &&
498 wp_verify_nonce($_GET['_wpnonce'], 'deactivate-compaign')
499 ) {
500 $postId = intval($_GET['post']);
501 wp_update_post(['ID' => $postId, 'post_status' => 'draft']);
502 }
503 }
504
505 public function settingsBox()
506 {
507 require plugin_dir_path(dirname(__FILE__)) .
508 'admin/CampaignSettings.php';
509 new CampaignSettings();
510 }
511
512 //removeIf(pro)
513 public function upgradeBanner()
514 {
515 add_meta_box(
516 'hurrytimer-upgrade-banner',
517 __('Get the Most of HurryTimer', 'hurrytimer'),
518 function () {
519 include HURRYT_DIR . 'admin/templates/upgrade-banner.php';
520 },
521 HURRYT_POST_TYPE,
522 'side',
523 'low'
524 );
525 }
526 //endRemoveIf(pro)
527
528 /**
529 * Search products
530 *
531 * @return void
532 */
533 public function ajaxWcSearchProducts()
534 {
535 $search = sanitize_text_field($_GET['search']);
536 $selection = sanitize_text_field($_GET['productsSelection']);
537 $exclude = array_map('intval', $_GET['exclude']);
538
539 if (
540 in_array($selection, [
541 C::WC_PS_TYPE_INCLUDE_CATEGORIES,
542 C::WC_PS_TYPE_EXCLUDE_CATEGORIES,
543 ])
544 ) {
545 $args = [
546 "hide_empty" => false,
547 "taxonomy" => "product_cat",
548 "name__like" => $search,
549 'exclude' => $exclude,
550 ];
551
552 $items = get_terms($args);
553 $results = array_map(function ($item) {
554 return [
555 "id" => $item->term_id,
556 "text" => $item->name,
557 ];
558 }, $items);
559 } else {
560 $args = [
561 's' => $search,
562 'post_type' => 'product',
563 'post__not_in' => $exclude,
564 ];
565 $items = get_posts($args);
566 $results = array_map(function ($item) {
567 return [
568 "id" => $item->ID,
569 "text" => $item->post_title,
570 ];
571 }, $items);
572 }
573 exit(json_encode(["results" => $results, "pagination" => true]));
574 }
575
576 public function pluginSettings()
577 {
578 register_setting('hurrytimer_settings', 'hurryt_settings');
579 add_settings_section(
580 'hurryt_settings_general',
581 __('General', 'hurrytimer'),
582 null,
583 'hurrytimer_settings'
584 );
585 add_settings_field(
586 'hurryt_disable_actions_edit_mode',
587 'Disable actions in the admin area',
588 function ($args) {
589 $options = get_option('hurryt_settings'); ?>
590 <label for="">
591 <input type="checkbox"
592 name="hurryt_settings[disable_actions]" <?php checked(
593 isset($options['disable_actions']) &&
594 $options['disable_actions'],
595 1
596 ); ?> id="hurryt-disable-actions" value="1"/>
597 </label>
598 <p class="description">
599 Don't run actions when editing or previewing a page in the admin area.
600 </p>
601 <?php
602 },
603 'hurrytimer_settings',
604 'hurryt_settings_general'
605 );
606 }
607 }
608