PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.06.02
E2Pdf – Export Pdf Tool for WordPress v1.06.02
1.32.48 1.32.43 1.32.40 1.32.34 1.32.32 1.32.31 1.32.26 1.32.22 1.32.23 1.32.18 1.32.17 1.32.15 trunk 1.00.00 1.00.13 1.01.01 1.02.02 1.03.07 1.04.07 1.05.03 1.06.02 1.07.11 1.08.00 1.08.06 1.08.09 All 71 releases
e2pdf / classes / model / e2pdf-notification.php

e2pdf-notification.php in E2Pdf – Export Pdf Tool for WordPress 1.06.02, at classes/model/e2pdf-notification.php

77 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * E2pdf Notification Helper
5 *
6 * @copyright Copyright 2017 https://e2pdf.com
7 * @license GPL v2
8 * @version 1
9 * @link https://e2pdf.com
10 * @since 0.00.01
11 */
12 if (!defined('ABSPATH')) {
13 die('Access denied.');
14 }
15
16 class Model_E2pdf_Notification extends Model_E2pdf_Model {
17
18 protected static $instance = NULL;
19
20 const UPGRADE_URL = 'https://e2pdf.com';
21
22 /**
23 * Add notification
24 *
25 * @param string $type - Notification type
26 * @param string $text - Notification text
27 */
28 public function add_notification($type, $text) {
29 $notifications = get_transient('e2pdf_notifications');
30 $notifications[] = array(
31 'type' => $type,
32 'text' => $text,
33 );
34 set_transient('e2pdf_notifications', $notifications);
35 }
36
37 /**
38 * Get notifications
39 *
40 * @return array - List of notifications
41 */
42 public function get_notifications() {
43 $notifications = get_transient('e2pdf_notifications');
44 if (!get_option('e2pdf_hide_warnings')) {
45
46 if (!is_array($notifications)) {
47 $notifications = array();
48 }
49
50 if ($this->helper->get('license')->get('status') == 'pre_expired') {
51 array_unshift($notifications, array(
52 'type' => 'notice',
53 'text' => sprintf(__("Your E2Pdf License Key will expire at <strong>%s</strong>. Please renew it at <a target='_blank' href='%s'>%s</a>.", 'e2pdf'), $this->helper->get('license')->get('expire'), self::UPGRADE_URL, self::UPGRADE_URL)
54 ));
55 }
56
57 if ($this->helper->get('license')->get('status') == 'expired') {
58 array_unshift($notifications, array(
59 'type' => 'error',
60 'text' => sprintf(__("Your E2Pdf License Key has expired. Please renew it at <a target='_blank' href='%s'>%s</a>.", 'e2pdf'), self::UPGRADE_URL, self::UPGRADE_URL)
61 ));
62 }
63
64 if ($this->helper->get('license')->get('type') == 'FREE') {
65 array_unshift($notifications, array(
66 'type' => 'notice',
67 'text' => sprintf(__("You are using FREE license type. Up to 1 page and up to 1 template allowed. Please check <a target='_blank' href='%s'>%s</a> for upgrade options.", 'e2pdf'), self::UPGRADE_URL, self::UPGRADE_URL)
68 ));
69 }
70 }
71
72 set_transient('e2pdf_notifications', array());
73 return $notifications;
74 }
75
76 }
77