PluginProbe ʕ •ᴥ•ʔ
Easy Updates Manager / 8.0.5
Easy Updates Manager v8.0.5
trunk 2.0.0 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 3.0.0 3.1.0 3.2.0 3.3.0 3.4.0 3.5.0 3.6.0 4.0 4.0.2 4.0.3 4.1.0 4.1.10 4.1.12 4.2.21 4.2.24 4.3.0 4.3.10 4.3.12 4.3.13 4.6.0 4.7.0 5.0.0 5.1.0 5.1.1 5.2.0 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1 5.4.2 5.4.3 5.4.5 6.0.0 6.0.1 6.0.3 6.0.5 6.1.0 6.1.1 6.1.3 6.1.5 6.1.8 6.2.0 6.2.11 6.2.2 6.2.3 6.2.5 6.2.7 6.2.9 6.3.0 6.3.1 6.3.3 6.4.0 6.4.4 6.4.6 6.4.7 6.4.8 7.0.0 7.0.1 7.0.2 7.0.3 8.0.1 8.0.2 8.0.3 8.0.5 8.1.0 8.1.1 8.2.0 9.0.0 9.0.1 9.0.10 9.0.11 9.0.12 9.0.13 9.0.14 9.0.15 9.0.16 9.0.17 9.0.18 9.0.19 9.0.20 9.0.21 9.0.3 9.0.5 9.0.6 9.0.7 9.0.8 9.0.9
stops-core-theme-and-plugin-updates / includes / easy-updates-manager-notices.php
stops-core-theme-and-plugin-updates / includes Last commit date
MPSUM_Admin.php 7 years ago MPSUM_Admin_Advanced.php 7 years ago MPSUM_Admin_Advanced_Preview.php 7 years ago MPSUM_Admin_Ajax.php 7 years ago MPSUM_Admin_Bar.php 7 years ago MPSUM_Admin_Core.php 7 years ago MPSUM_Admin_Dashboard.php 7 years ago MPSUM_Admin_Help.php 7 years ago MPSUM_Admin_Logs.php 7 years ago MPSUM_Admin_Plugins.php 7 years ago MPSUM_Admin_Screen_Options.php 7 years ago MPSUM_Admin_Themes.php 7 years ago MPSUM_Advanced_Premium.php 7 years ago MPSUM_Check_Plugin_Install_Status.php 7 years ago MPSUM_Check_Theme_Install_Status.php 7 years ago MPSUM_Commands.php 7 years ago MPSUM_Disable_Updates.php 7 years ago MPSUM_Disable_Updates_All.php 7 years ago MPSUM_Disable_Updates_Plugins.php 7 years ago MPSUM_Disable_Updates_Themes.php 7 years ago MPSUM_Disable_Updates_Translations.php 7 years ago MPSUM_Disable_Updates_WordPress.php 7 years ago MPSUM_Exclude_Users.php 7 years ago MPSUM_Force_Updates.php 7 years ago MPSUM_List_Table.php 7 years ago MPSUM_Logs.php 7 years ago MPSUM_Logs_List_Table.php 7 years ago MPSUM_Plugins_List_Table.php 7 years ago MPSUM_Reset_Options.php 7 years ago MPSUM_Themes_List_Table.php 7 years ago MPSUM_UpdraftCentral.php 7 years ago MPSUM_UpdraftCentral_EUM_Commands.php 7 years ago MPSUM_Utils.php 7 years ago easy-updates-manager-notices.php 7 years ago updraft-notices.php 7 years ago
easy-updates-manager-notices.php
323 lines
1 <?php
2
3 if (!defined('EASY_UPDATES_MANAGER_MAIN_PATH')) die('No direct access allowed');
4
5 if (!class_exists('Updraft_Notices_1_0')) require_once(EASY_UPDATES_MANAGER_MAIN_PATH.'includes/updraft-notices.php');
6
7 /**
8 * Class Easy_Updates_Manager_Notices
9 */
10 class Easy_Updates_Manager_Notices extends Updraft_Notices_1_0 {
11
12 protected static $_instance = null;
13
14 private $initialized = false;
15
16 protected $self_affiliate_id = 212;
17
18 protected $notices_content = array();
19
20 /**
21 * Creates and returns the only notice instance
22 *
23 * @return Object a Easy_Updates_Manager_Notices instance
24 */
25 public static function instance() {
26 if (empty(self::$_instance)) {
27 self::$_instance = new self();
28 }
29 return self::$_instance;
30 }
31
32 /**
33 * This method gets any parent notices and adds its own notices to the notice array
34 *
35 * @return Array returns an array of notices
36 */
37 protected function populate_notices_content() {
38 global $easy_updates_manager;
39 $parent_notice_content = parent::populate_notices_content();
40 $child_notice_content = array(
41 'updraftplus' => array(
42 'prefix' => '',
43 'title' => __('Always run the UpdraftPlus backup plugin before you update', 'stops-core-theme-and-plugin-updates'),
44 'text' => __("UpdraftPlus is the world’s highest ranking and most popular backup plugin.", 'stops-core-theme-and-plugin-updates'),
45 'image' => 'notices/updraft_logo.png',
46 'button_link' => 'https://updraftplus.com/',
47 'button_meta' => 'updraftplus',
48 'dismiss_time' => 'dismiss_page_notice_until',
49 'supported_positions' => $this->anywhere,
50 'validity_function' => 'is_updraftplus_installed',
51 ),
52 'updraftcentral' => array(
53 'prefix' => '',
54 'title' => __('Save Time and Money. Manage multiple WordPress sites from one location.', 'stops-core-theme-and-plugin-updates'),
55 'text' => __('UpdraftCentral is a highly efficient way to take backup, update and manage multiple WP sites from one location.', 'stops-core-theme-and-plugin-updates'),
56 'image' => 'notices/updraft_logo.png',
57 'button_link' => 'https://updraftcentral.com/',
58 'button_meta' => 'updraftcentral',
59 'dismiss_time' => 'dismiss_page_notice_until',
60 'supported_positions' => $this->anywhere,
61 'validity_function' => 'is_updraftcentral_installed',
62 ),
63 'wp-optimize' => array(
64 'prefix' => '',
65 'title' => 'WP-Optimize',
66 'text' => __("After you've backed up your database, we recommend you install our WP-Optimize plugin to streamline it for better website performance.", 'stops-core-theme-and-plugin-updates'),
67 'image' => 'notices/wp_optimize_logo.png',
68 'button_link' => 'https://getwpo.com',
69 'button_meta' => 'wp-optimize',
70 'dismiss_time' => 'dismiss_page_notice_until',
71 'supported_positions' => $this->anywhere,
72 'validity_function' => 'is_wpo_installed',
73 ),
74 'keyy' => array(
75 'prefix' => '',
76 'title' => 'Keyy: Instant and secure logon with a wave of your phone',
77 'text' => __("Find out more about our revolutionary new WordPress plugin.", "stops-core-theme-and-plugin-updates"),
78 'button_link' => 'https://getkeyy.com/',
79 'button_meta' => 'keyy',
80 'image' => 'notices/keyy_logo.png',
81 'dismiss_time' => 'dismiss_page_notice_until',
82 'supported_positions' => $this->anywhere,
83 'validity_function' => 'is_keyy_installed',
84 ),
85 'meta-slider' => array(
86 'prefix' => '',
87 'title' => __("MetaSlider: the world's #1 slider plugin from the makers of Easy Updates Manager", "stops-core-theme-and-plugin-updates"),
88 'text' => __("With MetaSlider, you can easily add style and flare with beautifully-designed sliders.", "stops-core-theme-and-plugin-updates"),
89 'button_link' => 'https://www.metaslider.com',
90 'button_meta' => 'metaslider',
91 'image' => 'notices/metaslider_logo.png',
92 'dismiss_time' => 'dismiss_page_notice_until',
93 'supported_positions' => $this->anywhere,
94 'validity_function' => 'is_metaslider_installed',
95 ),
96 'survey' => array(
97 'prefix' => '',
98 'title' => __('Help us improve Easy Updates Manager', 'stops-core-theme-and-plugin-updates'),
99 'text' => __('Answer 3 simple questions to help us prioritise the new features you need.', 'stops-core-theme-and-plugin-updates'),
100 'image' => 'notices/eum_logo.png',
101 'button_link' => 'https://easyupdatesmanager.com/survey/?utm_source=eum-plugin-page&utm_medium=banner',
102 'button_meta' => 'eum_survey',
103 'dismiss_time' => 'dismiss_survey_notice_until',
104 'supported_positions' => $this->anywhere,
105 ),
106 'rate' => array(
107 'prefix' => '',
108 'title' => __('Rate Easy Updates Manager', 'stops-core-theme-and-plugin-updates'),
109 'text' => __('We hope you like this plugin! If you do, please rate it: positive ratings attract more users, which enables us to keep improving it.', 'stops-core-theme-and-plugin-updates'),
110 'image' => 'notices/eum_logo.png',
111 'button_link' => 'https://wordpress.org/support/plugin/stops-core-theme-and-plugin-updates/reviews/#new-post',
112 'button_meta' => 'eum_rate',
113 'dismiss_time' => 'dismiss_survey_notice_until',
114 'supported_positions' => $this->anywhere,
115 ),
116
117 // The sale adverts content starts here
118 'blackfriday' => array(
119 'prefix' => '',
120 'title' => __('Black Friday - 20% off Easy Updates Manager Premium until November 30th', 'stops-core-theme-and-plugin-updates'),
121 'text' => __('To benefit, use this discount code:', 'stops-core-theme-and-plugin-updates') . ' ',
122 'image' => 'notices/black_friday.png',
123 'button_link' => 'https://easyupdatesmanager.com/',
124 'button_meta' => 'eum_premium',
125 'dismiss_time' => 'dismiss_season_notice_until',
126 'discount_code' => 'blackfridaysale2018',
127 'valid_from' => '2018-11-20 00:00:00',
128 'valid_to' => '2018-11-30 23:59:59',
129 'supported_positions' => $this->dashboard_top_or_report,
130 ),
131 'christmas' => array(
132 'prefix' => '',
133 'title' => __('Christmas sale - 20% off Easy Updates Manager Premium until December 25th', 'stops-core-theme-and-plugin-updates'),
134 'text' => __('To benefit, use this discount code:', 'stops-core-theme-and-plugin-updates') . ' ',
135 'image' => 'notices/christmas.png',
136 'button_link' => 'https://easyupdatesmanager.com/',
137 'button_meta' => 'eum_premium',
138 'dismiss_time' => 'dismiss_season_notice_until',
139 'discount_code' => 'christmassale2018',
140 'valid_from' => '2018-12-01 00:00:00',
141 'valid_to' => '2018-12-25 23:59:59',
142 'supported_positions' => $this->dashboard_top_or_report,
143 ),
144 'newyear' => array(
145 'prefix' => '',
146 'title' => __('Happy New Year - 20% off Easy Updates Manager Premium until January 14th', 'stops-core-theme-and-plugin-updates'),
147 'text' => __('To benefit, use this discount code:', 'stops-core-theme-and-plugin-updates') . ' ',
148 'image' => 'notices/new_year.png',
149 'button_link' => 'https://easyupdatesmanager.com/',
150 'button_meta' => 'eum_premium',
151 'dismiss_time' => 'dismiss_season_notice_until',
152 'discount_code' => 'newyearsale2019',
153 'valid_from' => '2018-12-26 00:00:00',
154 'valid_to' => '2019-01-14 23:59:59',
155 'supported_positions' => $this->dashboard_top_or_report,
156 ),
157 'spring' => array(
158 'prefix' => '',
159 'title' => __('Spring sale - 20% off Easy Updates Manager Premium until April 30th', 'stops-core-theme-and-plugin-updates'),
160 'text' => __('To benefit, use this discount code:', 'stops-core-theme-and-plugin-updates') . ' ',
161 'image' => 'notices/spring.png',
162 'button_link' => 'https://easyupdatesmanager.com/',
163 'button_meta' => 'eum_premium',
164 'dismiss_time' => 'dismiss_season_notice_until',
165 'discount_code' => 'springsale2019',
166 'valid_from' => '2019-04-01 00:00:00',
167 'valid_to' => '2019-04-30 23:59:59',
168 'supported_positions' => $this->dashboard_top_or_report,
169 ),
170 'summer' => array(
171 'prefix' => '',
172 'title' => __('Summer sale - 20% off Easy Updates Manager Premium until July 31st', 'stops-core-theme-and-plugin-updates'),
173 'text' => __('To benefit, use this discount code:', 'stops-core-theme-and-plugin-updates') . ' ',
174 'image' => 'notices/summer.png',
175 'button_link' => 'https://easyupdatesmanager.com/',
176 'button_meta' => 'eum_premium',
177 'dismiss_time' => 'dismiss_season_notice_until',
178 'discount_code' => 'summersale2019',
179 'valid_from' => '2019-07-01 00:00:00',
180 'valid_to' => '2019-07-31 23:59:59',
181 'supported_positions' => $this->dashboard_top_or_report,
182 )
183 );
184
185 return array_merge($parent_notice_content, $child_notice_content);
186 }
187
188 /**
189 * Call this method to setup the notices
190 */
191 public function notices_init() {
192 if ($this->initialized) return;
193 $this->initialized = true;
194 $this->notices_content = (defined('EASY_UPDATES_MANAGER_NOADS_B') && EASY_UPDATES_MANAGER_NOADS_B) ? array() : $this->populate_notices_content();
195 $our_version = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? EASY_UPDATES_MANAGER_VERSION.'.'.time() : EASY_UPDATES_MANAGER_VERSION;
196 $min_or_not = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
197 wp_enqueue_style('easy-updates-manager-notices-css', EASY_UPDATES_MANAGER_URL.'css/easy-updates-manager-notices'.$min_or_not.'.css', array(), $our_version);
198 }
199
200 /**
201 * This method will call the parent is_plugin_installed and pass in the product updraftplus to check if that plugin is installed if it is then we shouldn't display the notice
202 *
203 * @param string $product the plugin slug
204 * @param boolean $also_require_active a bool to indicate if the plugin should also be active
205 * @return boolean a bool to indicate if the notice should be displayed or not
206 */
207 protected function is_updraftplus_installed($product = 'updraftplus', $also_require_active = false) {
208 return parent::is_plugin_installed($product, $also_require_active);
209 }
210
211 /**
212 * This method will call the parent is_plugin_installed and pass in the product updraftcentral to check if that plugin is installed if it is then we shouldn't display the notice
213 *
214 * @param string $product the plugin slug
215 * @param boolean $also_require_active a bool to indicate if the plugin should also be active
216 * @return boolean a bool to indicate if the notice should be displayed or not
217 */
218 protected function is_updraftcentral_installed($product = 'updraftcentral', $also_require_active = false) {
219 return parent::is_plugin_installed($product, $also_require_active);
220 }
221
222 /**
223 * This method will call the parent is_plugin_installed and pass in the product keyy to check if that plugin is installed if it is then we shouldn't display the notice
224 *
225 * @param string $product the plugin slug
226 * @param boolean $also_require_active a bool to indicate if the plugin should also be active
227 * @return boolean a bool to indicate if the notice should be displayed or not
228 */
229 protected function is_keyy_installed($product = 'keyy', $also_require_active = false) {
230 return parent::is_plugin_installed($product, $also_require_active);
231 }
232
233 /**
234 * This method will call the is premium function in the Easy_Updates_Manager_Notices object to check if this install is premium and if it is we won't display the notice
235 *
236 * @param string $product the plugin slug
237 * @param boolean $also_require_active a bool to indicate if the plugin should also be active
238 * @return boolean a bool to indicate if we should display the notice or not
239 */
240 protected function is_wpo_installed($product = 'wp-optimize', $also_require_active = false) {
241 return parent::is_plugin_installed($product, $also_require_active);
242 }
243
244 /**
245 * This method will check to see if Meta Slider plugin is installed.
246 *
247 * @param String $product the plugin slug
248 * @param boolean $also_require_active a bool to indicate if the plugin should be active or not
249 * @return boolean a bool to indicate if the notice should be displayed or not
250 */
251 protected function is_metaslider_installed($product = 'ml-slider', $also_require_active = false) {
252 return parent::is_plugin_installed($product, $also_require_active);
253 }
254
255
256 /**
257 * This method calls the parent version and will work out if the user is using a non english language and if so returns true so that they can see the translation advert.
258 *
259 * @param String $plugin_base_dir the plugin base directory
260 * @param String $product_name the name of the plugin
261 * @return Boolean returns true if the user is using a non english language and could translate otherwise false
262 */
263 protected function translation_needed($plugin_base_dir = null, $product_name = null) {
264 return parent::translation_needed(EASY_UPDATES_MANAGER_MAIN_PATH, 'stops-core-theme-and-plugin-updates');
265 }
266
267 /**
268 * This method checks to see if the notices dismiss_time parameter has been dismissed
269 *
270 * @param String $dismiss_time a string containing the dimiss time ID
271 * @return Boolean returns true if the notice has been dismissed and shouldn't be shown otherwise display it
272 */
273 protected function check_notice_dismissed($dismiss_time) {
274 $time_now = (defined('EASY_UPDATES_MANAGER_NOTICES_FORCE_TIME') ? EASY_UPDATES_MANAGER_NOTICES_FORCE_TIME : time());
275 $dismiss = ($time_now < get_site_option('easy_updates_manager_' . $dismiss_time, 0));
276 return $dismiss;
277 }
278
279 /**
280 * Check notice data for seasonal info and return true if we should display this notice.
281 *
282 * @param array $notice_data Data about notice
283 * @return bool Determines whether to skip seasonal notice or not
284 */
285 protected function skip_seasonal_notices($notice_data) {
286 $time_now = defined('EASY_UPDATES_MANAGER_FORCE_TIME_NOTICES_FORCE_TIME') ? EASY_UPDATES_MANAGER_FORCE_TIME_NOTICES_FORCE_TIME : time();
287 $valid_from = strtotime($notice_data['valid_from']);
288 $valid_to = strtotime($notice_data['valid_to']);
289 $dismiss = $this->check_notice_dismissed($notice_data['dismiss_time']);
290 if (($time_now >= $valid_from && $time_now <= $valid_to) && !$dismiss) {
291 // return true so that we return this notice to be displayed
292 return true;
293 }
294
295 return false;
296 }
297
298 /**
299 * This method will create the chosen notice and the template to use and depending on the parameters either echo it to the page or return it
300 *
301 * @param Array $advert_information an array with the notice information in
302 * @param Boolean $return_instead_of_echo a bool value to indicate if the notice should be printed to page or returned
303 * @param String $position a string to indicate what template should be used
304 * @return String a notice to display
305 */
306 protected function render_specified_notice($advert_information, $return_instead_of_echo = false, $position = 'top') {
307
308 if ('bottom' == $position) {
309 $template_file = 'bottom-notice.php';
310 } elseif ('report' == $position) {
311 $template_file = 'report.php';
312 } elseif ('report-plain' == $position) {
313 $template_file = 'report-plain.php';
314 } else {
315 $template_file = 'horizontal-notice.php';
316 }
317
318 $extract_variables = array_merge($advert_information, array('easy_updates_manager_notices' => $this));
319
320 return Easy_Updates_Manager()->include_template('notices/'.$template_file, $return_instead_of_echo, $extract_variables);
321 }
322 }
323