PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.5.4
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.5.4
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Includes / Traits / Shared.php
embedpress / EmbedPress / Includes / Traits Last commit date
Branding.php 10 months ago Shared.php 1 month ago
Shared.php
214 lines
1 <?php
2
3 namespace EmbedPress\Includes\Traits;
4
5
6 if (!defined('ABSPATH')) {
7 exit;
8 } // Exit if accessed directly
9 use \EmbedPress\Includes\Classes\EmbedPress_Plugin_Usage_Tracker;
10 use \EmbedPress\Includes\Classes\EmbedPress_Notice;
11
12 use PriyoMukul\WPNotice\Notices;
13
14 use PriyoMukul\WPNotice\Utils\CacheBank;
15 use PriyoMukul\WPNotice\Utils\NoticeRemover;
16
17 trait Shared
18 {
19
20 private $insights = null;
21
22 /**
23 * @var CacheBank
24 */
25 private static $cache_bank;
26
27
28 /**
29 * Optional usage tracker
30 *
31 * @since v1.0.0
32 */
33 public function start_plugin_tracking()
34 {
35 $this->insights = $tracker = EmbedPress_Plugin_Usage_Tracker::get_instance(EMBEDPRESS_FILE, [
36 'opt_in' => true,
37 'goodbye_form' => true,
38 'item_id' => '98ba0ac16a4f7b3b940d'
39 ]);
40 $tracker->set_notice_options(array(
41 'notice' => 'Want to help make <strong>EmbedPress</strong> even more awesome? You can get a <strong>10% discount coupon</strong> for Premium extensions if you allow us to track the usage.',
42 'extra_notice' => 'We collect non-sensitive diagnostic data and plugin usage information.
43 Your site URL, WordPress & PHP version, plugins & themes and email address to send you the
44 discount coupon. This data lets us make sure this plugin always stays compatible with the most
45 popular plugins and themes. No spam, I promise.',
46 ));
47
48 $tracker->init();
49 }
50
51 public function admin_notice()
52 {
53
54 self::$cache_bank = CacheBank::get_instance();
55
56 try {
57 $this->notices();
58 } catch (\Exception $e) {
59 unset($e);
60 }
61
62 // Remove OLD notice from 1.0.0 (if other WPDeveloper plugin has notice)
63 NoticeRemover::get_instance('1.0.0');
64 }
65
66 public function notices()
67 {
68 $_assets_url = plugins_url('assets/', EMBEDPRESS_PLUGIN_BASENAME);
69
70 $notices = new Notices([
71 // 'dev_mode' => true,
72 'id' => 'embedpress',
73 'storage_key' => 'notices',
74 'lifetime' => 3,
75 'stylesheet_url' => $_assets_url . 'css/admin-notices.css',
76 'styles' => $_assets_url . 'css/admin-notices.css',
77 'priority' => 6
78 ]);
79
80 /**
81 * This is review message and thumbnail.
82 */
83 $_review_notice = [
84 'thumbnail' => $_assets_url . 'images/icon-128x128.png',
85 'html' => '<p>' . __('We hope you\'re enjoying EmbedPress! Could you please do us a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'embedpress') . '</p>',
86 'links' => [
87 'later' => array(
88 'link' => 'https://wordpress.org/support/plugin/embedpress/reviews/',
89 'target' => '_blank',
90 'label' => __('Ok, you deserve it!', 'embedpress'),
91 'icon_class' => 'dashicons dashicons-external',
92 ),
93 'allready' => array(
94 'label' => __('I already did', 'embedpress'),
95 'icon_class' => 'dashicons dashicons-smiley',
96 'attributes' => [
97 'data-dismiss' => true
98 ],
99 ),
100 'maybe_later' => array(
101 'label' => __('Maybe Later', 'embedpress'),
102 'icon_class' => 'dashicons dashicons-calendar-alt',
103 'attributes' => [
104 'data-later' => true
105 ],
106 ),
107 'support' => array(
108 'link' => 'https://wpdeveloper.com/support',
109 'label' => __('I need help', 'embedpress'),
110 'icon_class' => 'dashicons dashicons-sos',
111 ),
112 'never_show_again' => array(
113 'label' => __('Never show again', 'embedpress'),
114 'icon_class' => 'dashicons dashicons-dismiss',
115 'attributes' => [
116 'data-dismiss' => true
117 ],
118 ),
119 ],
120 ];
121
122 $notices->add(
123 'review',
124 $_review_notice,
125 [
126 'start' => $notices->strtotime('+15 day'),
127 'recurrence' => 30,
128 'dismissible' => true,
129 'refresh' => EMBEDPRESS_VERSION,
130 ]
131 );
132
133 $notices->add(
134 'optin',
135 [$this->insights, 'notice'],
136 [
137 'start' => $notices->strtotime('+10 day'),
138 'recurrence' => 30,
139 'dismissible' => true,
140 'refresh' => EMBEDPRESS_VERSION,
141 'do_action' => 'wpdeveloper_notice_clicked_for_embedpress',
142 'display_if' => !is_array($notices->is_installed('embedpress-pro/embedpress-pro.php'))
143 ]
144 );
145
146 $summer_message = '<div class="summer_2026_notice"><p class="notice-message"><span class="notice-emoji">🏖️</span> <strong>Summer Savings:</strong> Custom branding, ads, content protection, analytics and more with 250+ embed sources – now <strong>up to $150 OFF!</strong></p>
147 <div class="notice-links">
148 <a class="button button-primary" href="https://embedpress.com/summer2026-admin-notice" target="_blank">Upgrade To Pro Now</a>
149 <a class="embedpress-notice-dismiss-button dismiss-btn" data-dismiss="true" href="#" target="_blank">I Don&rsquo;t Want Any Discount</a>
150 </div>
151 </div>';
152 $_summer_2026_notice = [
153 'thumbnail' => $_assets_url . 'images/full-logo.svg',
154 'html' => $summer_message,
155 ];
156
157 $notices->add(
158 '_summer_2026_notice',
159 $_summer_2026_notice,
160 [
161 'start' => strtotime('20th May 2026'),
162 'recurrence' => false,
163 'dismissible' => true,
164 'refresh' => EMBEDPRESS_VERSION,
165 "expire" => strtotime('11:59:59pm 25th June 2026'),
166 'display_if' => !is_plugin_active('embedpress-pro/embedpress-pro.php') && ($_SERVER['REQUEST_URI'] === '/wp-admin/' || $_SERVER['REQUEST_URI'] === '/wp-admin/index.php'),
167 ]
168 );
169
170 $notices->init();
171
172 self::$cache_bank->create_account($notices);
173 self::$cache_bank->calculate_deposits($notices);
174 }
175
176 public function is_pro_active()
177 {
178 return is_plugin_active('embedpress-pro/embedpress-pro.php');
179 }
180
181 /**
182 * Show Admin notice when one of embedpress old plugin active
183 *
184 * @since 2.4.0
185 */
186 public function embedpress_admin_notice()
187 {
188 $compatibility_message = '<p style="margin-top: 0; margin-bottom: 0px;"><strong style="color:#FF7369;">Action Needed:</strong> Please update <strong>EmbedPress Pro</strong> to the latest version (<strong>v3.6.5</strong>) for enhanced features and compatibility.</p>';
189
190
191 if (is_plugin_active('embedpress-pro/embedpress-pro.php') && version_compare(EMBEDPRESS_PRO_PLUGIN_VERSION, '3.6.5', '<')) {
192 echo '<div class="notice notice-warning">' . $compatibility_message . '</div>';
193 }
194 }
195
196
197 public function remove_admin_notice()
198 {
199
200 $current_screen = get_current_screen();
201 if ($current_screen->id == 'toplevel_page_embedpress' || $current_screen->id == 'embedpress_page_embedpress-analytics') {
202
203 remove_all_actions('user_admin_notices');
204 remove_all_actions('admin_notices');
205
206 // To showing notice in EA settings page we have to use 'eael_admin_notices' action hook
207 add_action('admin_notices', function () {
208 do_action('ep_admin_notices');
209 });
210 }
211
212 }
213 }
214