PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.00.00
E2Pdf – Export Pdf Tool for WordPress v1.00.00
1.32.49 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 All 72 releases
e2pdf / classes / model / e2pdf-notification.php

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

94 lines 3.1 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 * Create instance of class Model_E2pdf_Notification
24 */
25 public static function instance() {
26 if (!isset(self::$instance)) {
27 self::$instance = new self();
28 }
29 return self::$instance;
30 }
31
32 /**
33 * Add notification
34 *
35 * @param string $type - Notification type
36 * @param string $text - Notification text
37 */
38 public function add_notification($type, $text) {
39 $notifications = get_transient('e2pdf_notifications');
40 $notifications[] = array(
41 'type' => $type,
42 'text' => $text,
43 );
44 set_transient('e2pdf_notifications', $notifications);
45 }
46
47 /**
48 * Get notifications
49 *
50 * @return array - List of notifications
51 */
52 public function get_notifications() {
53 $notifications = get_transient('e2pdf_notifications');
54 if (!get_option('e2pdf_hide_warnings')) {
55
56 if (!is_array($notifications)) {
57 $notifications = array();
58 }
59
60 if (get_site_option('e2pdf_force_update')) {
61 array_unshift($notifications, array(
62 'type' => 'error',
63 'text' => __("E2Pdf was not able to download needed extensions. Please check for plugin updates at Dashboard -> Updates and update E2Pdf plugin", 'e2pdf')
64 ));
65 }
66
67 if ($this->helper->get('license')->get('status') == 'pre_expired') {
68 array_unshift($notifications, array(
69 'type' => 'notice',
70 '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)
71 ));
72 }
73
74 if ($this->helper->get('license')->get('status') == 'expired') {
75 array_unshift($notifications, array(
76 'type' => 'error',
77 '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)
78 ));
79 }
80
81 if ($this->helper->get('license')->get('type') == 'FREE') {
82 array_unshift($notifications, array(
83 'type' => 'notice',
84 '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)
85 ));
86 }
87 }
88
89 set_transient('e2pdf_notifications', array());
90 return $notifications;
91 }
92
93 }
94