PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.1.1
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.1.1
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 1 year ago Shared.php 1 year ago
Shared.php
231 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.', 'embedpress'),
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.', 'embedpress'),
46 ));
47 $tracker->init();
48 }
49
50 public function admin_notice()
51 {
52
53 self::$cache_bank = CacheBank::get_instance();
54
55 try {
56 $this->notices();
57 } catch (\Exception $e) {
58 unset($e);
59 }
60
61 // Remove OLD notice from 1.0.0 (if other WPDeveloper plugin has notice)
62 NoticeRemover::get_instance('1.0.0');
63 }
64
65 public function notices()
66 {
67 $_assets_url = plugins_url('assets/', EMBEDPRESS_PLUGIN_BASENAME);
68
69 $notices = new Notices([
70 // 'dev_mode' => true,
71 'id' => 'embedpress',
72 'storage_key' => 'notices',
73 'lifetime' => 3,
74 'stylesheet_url' => $_assets_url . 'css/admin-notices.css',
75 'styles' => $_assets_url . 'css/admin-notices.css',
76 'priority' => 6
77 ]);
78
79 /**
80 * This is review message and thumbnail.
81 */
82 $_review_notice = [
83 'thumbnail' => $_assets_url . 'images/icon-128x128.png',
84 '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>',
85 'links' => [
86 'later' => array(
87 'link' => 'https://wordpress.org/support/plugin/embedpress/reviews/',
88 'target' => '_blank',
89 'label' => __('Ok, you deserve it!', 'wp-scheduled-posts'),
90 'icon_class' => 'dashicons dashicons-external',
91 ),
92 'allready' => array(
93 'label' => __('I already did', 'wp-scheduled-posts'),
94 'icon_class' => 'dashicons dashicons-smiley',
95 'attributes' => [
96 'data-dismiss' => true
97 ],
98 ),
99 'maybe_later' => array(
100 'label' => __('Maybe Later', 'wp-scheduled-posts'),
101 'icon_class' => 'dashicons dashicons-calendar-alt',
102 'attributes' => [
103 'data-later' => true
104 ],
105 ),
106 'support' => array(
107 'link' => 'https://wpdeveloper.com/support',
108 'label' => __('I need help', 'wp-scheduled-posts'),
109 'icon_class' => 'dashicons dashicons-sos',
110 ),
111 'never_show_again' => array(
112 'label' => __('Never show again', 'wp-scheduled-posts'),
113 'icon_class' => 'dashicons dashicons-dismiss',
114 'attributes' => [
115 'data-dismiss' => true
116 ],
117 ),
118 ],
119 ];
120
121 $notices->add(
122 'review',
123 $_review_notice,
124 [
125 'start' => $notices->strtotime('+15 day'),
126 'recurrence' => 30,
127 'dismissible' => true,
128 'refresh' => EMBEDPRESS_VERSION,
129 ]
130 );
131
132 $notices->add(
133 'optin',
134 [$this->insights, 'notice'],
135 [
136 'start' => $notices->strtotime('+10 day'),
137 'recurrence' => 30,
138 'dismissible' => true,
139 'refresh' => EMBEDPRESS_VERSION,
140 'do_action' => 'wpdeveloper_notice_clicked_for_embedpress',
141 'display_if' => !is_array($notices->is_installed('embedpress-pro/embedpress-pro.php'))
142 ]
143 );
144
145 // $b_message = '<p style="margin-top: 0; margin-bottom: 10px;">Black Friday Sale: Save up to 40% now & <strong>embed from 150+</strong> sources with advanced features ⚡</p><a class="button button-primary" href="https://wpdeveloper.com/upgrade/embedpress-bfcm" target="_blank">Upgrade to PRO</a> <button data-dismiss="true" class="dismiss-btn button button-link">I don’t want to save money</button>';
146 // $_black_friday_notice = [
147 // 'thumbnail' => $_assets_url . 'images/full-logo.svg',
148 // 'html' => $b_message,
149 // ];
150
151 // $notices->add(
152 // 'black_friday_notice',
153 // $_black_friday_notice,
154 // [
155 // 'start' => $notices->time(),
156 // 'recurrence' => false,
157 // 'dismissible' => true,
158 // 'refresh' => EMBEDPRESS_VERSION,
159 // "expire" => strtotime('11:59:59pm 2nd December, 2023'),
160 // 'display_if' => !is_plugin_active('embedpress-pro/embedpress-pro.php')
161 // ]
162 // );
163
164 // $b_message = '<p style="margin-top: 0; margin-bottom: 10px;"><strong>Akah Join Us in Celebrating 100K+ Users!</strong> Enjoy up to 30% OFF for EmbedPress PRO & embed from 150+ sources</p><a class="button button-primary" href="https://wpdeveloper.com/upgrade/embedpress-bfcm" target="_blank">Upgrade to PRO</a> <button data-dismiss="true" class="dismiss-btn button button-link">I don’t want to save money</button>';
165 // $_black_friday_notice = [
166 // 'thumbnail' => $_assets_url . 'images/full-logo.svg',
167 // 'html' => $b_message,
168 // ];
169
170 // $notices->add(
171 // '100k_notice',
172 // $_black_friday_notice,
173 // [
174 // 'start' => $notices->time(),
175 // 'recurrence' => false,
176 // 'dismissible' => true,
177 // 'refresh' => EMBEDPRESS_VERSION,
178 // "expire" => strtotime('11:59:59pm 12th September, 2024'),
179 // 'display_if' => !is_plugin_active('embedpress-pro/embedpress-pro.php')
180 // ]
181 // );
182
183 $b_message = '<div class="helloween_2024_notice"><p style="margin-top: 0; margin-bottom: 0px;">🎃 Unlock advanced embedding functionalities with EmbedPress PRO & enjoy <strong>Up to $150 Off</strong> this Halloween.</p><a class="button button-primary" href="https://embedpress.com/halloween-2024/" target="_blank">
184 <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m15.743 10.938.161-1.578c.086-.842.142-1.399.098-1.749h.015c.727 0 1.316-.622 1.316-1.389s-.589-1.389-1.315-1.389c-.727 0-1.316.622-1.316 1.39 0 .346.12.663.32.907-.287.186-.66.58-1.223 1.171-.434.456-.65.684-.893.72a.7.7 0 0 1-.394-.059c-.223-.104-.372-.385-.67-.95l-1.57-2.97a22 22 0 0 0-.476-.873c.569-.306.958-.93.958-1.65C10.754 1.496 9.97.667 9 .667s-1.754.829-1.754 1.852c0 .72.389 1.344.958 1.65-.139.234-.293.525-.476.873l-1.57 2.97c-.298.565-.447.846-.67.95a.7.7 0 0 1-.394.058c-.242-.035-.46-.263-.893-.719-.563-.592-.937-.985-1.223-1.171.2-.244.32-.56.32-.908 0-.767-.589-1.389-1.316-1.389-.726 0-1.315.622-1.315 1.39 0 .766.589 1.388 1.315 1.388h.016c-.045.35.012.906.098 1.749l.16 1.578c.09.876.164 1.71.255 2.46H15.49c.09-.75.165-1.584.254-2.46m-7.698 6.395h1.908c2.488 0 3.732 0 4.562-.784.362-.342.591-.959.757-1.762H2.727c.166.803.395 1.42.757 1.762.83.784 2.074.784 4.562.784" fill="#fff"/></svg> Upgrade to PRO</a></div>';
185 $_helloween_2024_notice = [
186 'thumbnail' => $_assets_url . 'images/full-logo.svg',
187 'html' => $b_message,
188 ];
189
190 $notices->add(
191 'helloween_2024_notice',
192 $_helloween_2024_notice,
193 [
194 'start' => $notices->time(),
195 'recurrence' => false,
196 'dismissible' => true,
197 'refresh' => EMBEDPRESS_VERSION,
198 "expire" => strtotime('11:59:59pm 3rd November, 2024'),
199 'display_if' => !is_plugin_active('embedpress-pro/embedpress-pro.php') && ($_SERVER['REQUEST_URI'] === '/wp-admin/' || $_SERVER['REQUEST_URI'] === '/wp-admin/index.php'),
200
201
202 ]
203 );
204
205 $notices->init();
206
207 self::$cache_bank->create_account($notices);
208 self::$cache_bank->calculate_deposits($notices);
209 }
210
211 public function is_pro_active()
212 {
213 return is_plugin_active('embedpress-pro/embedpress-pro.php');
214 }
215
216 /**
217 * Show Admin notice when one of embedpress old plugin active
218 *
219 * @since 2.4.0
220 */
221 public function embedpress_admin_notice()
222 {
223 $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>';
224
225
226 if (is_plugin_active('embedpress-pro/embedpress-pro.php') && version_compare(EMBEDPRESS_PRO_PLUGIN_VERSION, '3.6.5', '<')) {
227 echo '<div class="notice notice-warning">' . $compatibility_message . '</div>';
228 }
229 }
230 }
231