PluginProbe ʕ •ᴥ•ʔ
UpdraftPlus: WP Backup & Migration Plugin / 1.26.4
UpdraftPlus: WP Backup & Migration Plugin v1.26.4
1.26.4 1.26.3 1.9.19 1.9.25 1.9.26 1.9.30 1.9.31 1.9.32 1.9.4 1.9.40 1.9.41 1.9.42 1.9.43 1.9.44 1.9.45 1.9.46 1.9.5 1.9.50 1.9.51 1.9.60 1.9.62 1.9.63 1.9.64 1.11.12 1.4.8 1.11.15 1.4.9 1.11.17 1.5.16 1.11.18 1.5.20 1.11.2 1.5.21 1.11.20 1.5.22 1.11.23 1.5.5 1.11.24 1.5.6 1.11.25 1.5.7 1.11.26 1.5.8 1.11.27 1.5.9 1.11.28 1.6.1 1.11.3 1.6.17 1.11.4 1.6.2 1.11.5 1.6.46 1.11.8 1.7.0 1.11.9 1.7.1 1.12.0 1.7.18 1.12.1 1.7.20 1.12.12 1.7.3 1.12.13 1.7.34 1.12.15 1.7.35 1.12.17 1.7.39 1.12.2 1.7.40 1.12.20 1.7.41 1.12.23 1.8.1 1.12.24 1.8.11 1.12.25 1.8.12 1.12.28 1.8.13 1.12.29 1.8.2 1.12.30 1.8.5 1.12.32 1.8.8 1.12.34 1.9.0 1.12.35 1.9.13 1.12.37 1.9.15 1.12.39 1.9.17 1.12.4 1.12.40 1.12.6 1.13.1 1.13.11 1.13.12 1.13.15 1.13.16 1.13.2 1.13.3 1.13.4 1.13.5 1.13.6 1.13.7 1.13.8 1.13.9 1.14.10 1.14.11 1.14.12 1.14.13 1.14.2 1.14.3 1.14.4 1.14.5 1.14.7 1.14.9 1.15.0 1.15.2 1.15.3 1.15.5 1.15.6 1.15.7 1.16.0 1.16.10 1.16.11 1.16.12 1.16.13 1.16.14 1.16.15 1.16.16 1.16.17 1.16.20 1.16.21 1.16.22 1.16.23 1.16.24 1.16.25 1.16.26 1.16.28 1.16.29 1.16.32 1.16.34 1.16.35 1.16.36 1.16.37 1.16.4 1.16.40 1.16.41 1.16.42 1.16.43 1.16.44 1.16.45 1.16.46 1.16.47 1.16.48 1.16.49 1.16.5 1.16.50 1.16.51 1.16.53 1.16.55 1.16.56 1.16.59 1.16.6 1.16.60 1.16.61 1.16.62 1.16.63 1.16.64 1.16.65 1.16.66 1.16.67 1.16.68 1.16.69 1.16.7 1.16.8 1.16.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.14 1.2.15 1.2.16 1.2.17 1.2.19 1.2.2 1.2.20 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.33 1.2.35 1.2.36 1.2.38 1.2.39 1.2.4 1.2.40 1.2.41 1.2.42 1.2.43 1.2.44 1.2.45 1.2.46 1.2.5 1.2.7 1.2.8 1.2.9 1.22.1 1.22.10 1.22.11 1.22.12 1.22.14 1.22.15 1.22.16 1.22.17 1.22.18 1.22.19 1.22.20 1.22.21 1.22.22 1.22.23 1.22.24 1.22.3 1.22.4 1.22.5 1.22.6 1.22.7 1.22.8 1.22.9 1.23.1 1.23.10 1.23.11 1.23.12 1.23.13 1.23.15 1.23.16 1.23.2 1.23.3 1.23.4 1.23.5 1.23.6 1.23.7 1.23.8 1.23.9 1.24.1 1.24.10 1.24.11 1.24.12 1.24.2 trunk 1.24.3 0.7.4 1.24.4 0.7.7 1.24.5 0.8.28 1.24.6 0.8.29 1.24.7 0.8.30 1.24.8 0.8.31 1.24.9 0.8.32 1.25.1 0.8.33 1.25.2 0.8.36 1.25.3 0.8.37 1.25.5 0.8.50 1.25.6 0.8.51 1.25.7 0.9.1 1.25.8 0.9.10 1.25.9 0.9.11 1.26.1 0.9.12 1.26.2 0.9.2 1.3.10 0.9.20 1.3.12 0.9.21 1.3.14 0.9.22 1.3.15 1.0.10 1.3.17 1.0.11 1.3.18 1.0.12 1.3.19 1.0.15 1.3.2 1.0.16 1.3.20 1.0.18 1.3.22 1.0.20 1.3.23 1.0.3 1.3.24 1.0.4 1.3.25 1.0.5 1.3.3 1.0.6 1.3.4 1.0.7 1.3.6 1.0.8 1.3.7 1.0.9 1.3.8 1.1.0 1.3.9 1.1.10 1.4.0 1.1.11 1.4.10 1.1.12 1.4.11 1.1.13 1.4.12 1.1.14 1.4.13 1.1.15 1.4.14 1.1.16 1.4.15 1.1.17 1.4.2 1.1.2 1.4.27 1.1.3 1.4.28 1.1.5 1.4.29 1.1.6 1.4.30 1.1.8 1.4.4 1.1.9 1.4.48 1.10.1 1.4.5 1.10.3 1.4.6 1.11.1 1.4.7
updraftplus / includes / updraftplus-tour.php
updraftplus / includes Last commit date
Dropbox2 3 weeks ago Google 3 weeks ago blockui 3 weeks ago checkout-embed 3 weeks ago cloudfiles 3 weeks ago handlebars 1 month ago images 9 years ago jquery-ui.dialog.extended 3 weeks ago jquery.serializeJSON 5 years ago jstree 1 year ago labelauty 3 weeks ago pcloud 3 weeks ago select2 1 year ago tether 6 years ago tether-shepherd 7 years ago updraftclone 3 weeks ago S3.php 3 weeks ago S3compat.php 3 weeks ago cacert.pem 2 years ago class-backup-history.php 1 month ago class-commands.php 3 weeks ago class-database-utility.php 1 month ago class-filesystem-functions.php 1 month ago class-http-error-descriptions.php 2 years ago class-job-scheduler.php 3 years ago class-manipulation-functions.php 1 month ago class-partialfileservlet.php 3 weeks ago class-remote-send.php 3 weeks ago class-search-replace.php 1 month ago class-semaphore.php 3 weeks ago class-storage-methods-interface.php 1 month ago class-updraft-dashboard-news.php 1 month ago class-updraft-semaphore.php 4 years ago class-updraftcentral-updraftplus-commands.php 3 years ago class-updraftplus-deactivation.php 1 month ago class-updraftplus-encryption.php 1 month ago class-wpadmin-commands.php 1 month ago class-zip.php 1 month ago ftp.class.php 2 months ago get-cpanel-quota-usage.pl 12 years ago google-extensions.php 1 month ago jquery-ui.custom-v1.11.4-1-26-4.min.css 3 weeks ago jquery-ui.custom-v1.11.4-1-26-4.min.css.map 3 weeks ago jquery-ui.custom-v1.11.4.css 3 years ago jquery-ui.custom-v1.12.1-1-26-4.min.css 3 weeks ago jquery-ui.custom-v1.12.1-1-26-4.min.css.map 3 weeks ago jquery-ui.custom-v1.12.1.css 3 years ago migrator-lite.php 1 month ago updraft-admin-common-1-26-4.min.js 3 weeks ago updraft-admin-common.js 3 weeks ago updraft-restorer-skin-compatibility.php 6 years ago updraft-restorer-skin.php 3 years ago updraftcentral.php 1 year ago updraftplus-clone.php 1 year ago updraftplus-login.php 7 months ago updraftplus-notices.php 1 month ago updraftplus-tour.php 1 month ago updraftvault.php 3 years ago
updraftplus-tour.php
303 lines
1 <?php
2 if (!defined('ABSPATH')) die('No direct access allowed');
3 /**
4 * Class UpdraftPlus_Tour
5 *
6 * Adds the guided tour when activating the plugin for the first time.
7 */
8 class UpdraftPlus_Tour {
9
10 /**
11 * The class instance
12 *
13 * @var object
14 */
15 protected static $instance;
16
17 /**
18 * Get the instance
19 *
20 * @return object
21 */
22 public static function get_instance() {
23 if (!self::$instance) {
24 self::$instance = new self();
25 }
26 return self::$instance;
27 }
28
29 /**
30 * __construct
31 */
32 private function __construct() {
33 }
34
35 /**
36 * Sets up the notices, security and loads assets for the admin page
37 */
38 public function init() {
39 // Add plugin action link
40 add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
41
42 // only init and load assets if the tour hasn't been canceled
43 $updraftplus_tour = UpdraftPlus_Manipulation_Functions::fetch_superglobal('request', 'updraftplus_tour');
44 if (isset($updraftplus_tour) && 0 === (int) $updraftplus_tour) {
45 $this->set_tour_status(array('current_step' => 'start'));
46 return;
47 }
48
49 // if backups already exist and
50 if ($this->updraftplus_was_already_installed() && !isset($updraftplus_tour)) {
51 return;
52 }
53
54 // if 'Take tour' link was used, reset tour
55 if (isset($updraftplus_tour) && 1 === (int) $updraftplus_tour) {
56 $this->reset_tour_status();
57 }
58
59 if (!UpdraftPlus_Options::get_updraft_option('updraftplus_tour_cancelled_on')) {
60 add_action('admin_enqueue_scripts', array($this, 'load_tour'));
61 }
62 }
63
64 /**
65 * Loads in tour assets
66 *
67 * @param string $hook - current page
68 */
69 public function load_tour($hook) {
70
71 $pages = array('settings_page_updraftplus', 'plugins.php');
72
73 if (!in_array($hook, $pages)) return;
74 if (!UpdraftPlus_Options::user_can_manage()) return;
75
76 global $updraftplus, $updraftplus_addons2, $updraftplus_checkout_embed;
77
78 $checkout_embed_5gb_attribute = '';
79 if ($updraftplus_checkout_embed) {
80 $checkout_embed_5gb_attribute = $updraftplus_checkout_embed->get_product('updraftplus-vault-storage-5-gb') ? 'data-embed-checkout="'.apply_filters('updraftplus_com_link', $updraftplus_checkout_embed->get_product('updraftplus-vault-storage-5-gb', UpdraftPlus_Options::admin_page_url().'?page=updraftplus&tab=settings')).'"' : '';
81 }
82
83 $script_suffix = $updraftplus->use_unminified_scripts() ? '' : '.min';
84 $updraft_min_or_not = $updraftplus->get_updraftplus_file_version();
85 wp_enqueue_script('updraftplus-tether-js', trailingslashit(UPDRAFTPLUS_URL).'includes/tether/tether'.$script_suffix.'.js', $updraftplus->version, true);
86 wp_enqueue_script('updraftplus-shepherd-js', trailingslashit(UPDRAFTPLUS_URL).'includes/tether-shepherd/shepherd'.$script_suffix.'.js', array('updraftplus-tether-js'), $updraftplus->version, true);
87 wp_enqueue_style('updraftplus-shepherd-css', trailingslashit(UPDRAFTPLUS_URL).'css/tether-shepherd/shepherd-theme-arrows-plain-buttons'.$script_suffix.'.css', false, $updraftplus->version);
88 wp_enqueue_style('updraftplus-tour-css', trailingslashit(UPDRAFTPLUS_URL).'css/updraftplus-tour'.$updraft_min_or_not.'.css', false, $updraftplus->version);
89 wp_register_script('updraftplus-tour-js', trailingslashit(UPDRAFTPLUS_URL).'js/tour.js', array('updraftplus-tether-js'), $updraftplus->version, true);
90
91 $tour_data = array(
92 'nonce' => wp_create_nonce('updraftplus-credentialtest-nonce'),
93 'show_tab_on_load' => '#updraft-navtab-status',
94 'next' => __('Next', 'updraftplus'),
95 'back' => __('Back', 'updraftplus'),
96 'skip' => __('Skip this step', 'updraftplus'),
97 'end_tour' => __('End tour', 'updraftplus'),
98 'close' => __('Close', 'updraftplus'),
99 'plugins_page' => array(
100 'title' => __("UpdraftPlus settings", 'updraftplus'),
101 'text' => '<div class="updraftplus-welcome-logo"><img src="'.trailingslashit(UPDRAFTPLUS_URL).'images/ud-logo.png" alt="" /></div><strong>'.__('Welcome to UpdraftPlus', 'updraftplus').'</strong>, '.__("the world’s most trusted backup plugin!", 'updraftplus'),
102 'button' => array(
103 'url' => UpdraftPlus_Options::admin_page_url().'?page=updraftplus',
104 'text' => __('Press here to start!', 'updraftplus')
105 )
106 ),
107 'backup_now' => array(
108 'title' => __('Your first backup', 'updraftplus'),
109 'text' => sprintf(
110 __('To make a simple backup to your server, press this button.', 'updraftplus').' '.
111 /* translators: 1: HTML <a> and <strong> opening tag 2: HTML </a> and </strong> closing tag*/
112 __('Or to setup regular backups and remote storage, go to %1$s settings %2$s', 'updraftplus'),
113 '<strong><a href="#settings" class="js--go-to-settings">',
114 '</a></strong>'
115 )
116 ),
117 'backup_options' => array(
118 'title' => __("Manual backup options", 'updraftplus'),
119 'text' => __('Select what you want to backup', 'updraftplus')
120 ),
121 'backup_now_btn' => array(
122 'title' => __("Creating your first backup", 'updraftplus'),
123 'text' => __("Press here to run a manual backup.", 'updraftplus').'<br>'.
124 /* translators: 1: Opening anchor tag, 2: Closing anchor tag */
125 sprintf(_x('But to avoid server-wide threats backup regularly to remote cloud storage in %1$s settings %2$s', 'Backup warning with link', 'updraftplus'), '<strong><a href="#settings" class="js--go-to-settings">', '</a></strong>'),
126 'btn_text' => __('Go to settings', 'updraftplus')
127 ),
128 'backup_now_btn_success' => array(
129 'title' => __('Creating your first backup', 'updraftplus'),
130 'text' => __('Congratulations! Your first backup is running.', 'updraftplus').'<br>'.
131 /* translators: 1: Opening strong tag, 2: Closing strong tag */
132 sprintf(_x('But to avoid server-wide threats backup regularly to remote cloud storage in %1$s settings %2$s', 'Backup recommendation', 'updraftplus'), '<strong>', '</strong>'),
133 'btn_text' => __('Go to settings', 'updraftplus')
134 ),
135 'settings_timing' => array(
136 'title' => __("Choose your backup schedule", 'updraftplus'),
137 'text' => __("Choose the schedule that you want your backups to run on.", 'updraftplus')
138 ),
139 'settings_remote_storage' => array(
140 'title' => __("Remote storage", 'updraftplus'),
141 'text' => __('Now select a remote storage destination to protect against server-wide threats.', 'updraftplus').' '.__('If not, your backups remain on the same server as your site.', 'updraftplus')
142 .'<div class="ud-notice">'
143 .'<h3>'.__('Try UpdraftVault!', 'updraftplus').'</h3>'
144 .__("UpdraftVault is our remote storage which works seamlessly with UpdraftPlus.", 'updraftplus')
145 .' <a href="'.apply_filters('updraftplus_com_link', 'https://teamupdraft.com/updraftplus/updraftvault/').'" target="_blank">'.__('Find out more here.', 'updraftplus').'</a>'
146 .'<p><a href="'.apply_filters('updraftplus_com_link', $updraftplus->get_url('shop_vault_5')).'" target="_blank" '.$checkout_embed_5gb_attribute.' class="button button-primary">'.__('Try UpdraftVault for 1 month for only $1!', 'updraftplus').'</a></p>'
147 .'</div>'
148 ),
149 'settings_more' => array(
150 'title' => __("More settings", 'updraftplus'),
151 'text' => __("Look through the other settings here, making any changes you’d like.", 'updraftplus')
152 ),
153 'settings_save' => array(
154 'title' => __("Save", 'updraftplus'),
155 'text' => __('Press here to save your settings.', 'updraftplus')
156 ),
157 'settings_saved' => array(
158 'title' => __("Save", 'updraftplus'),
159 'text' => __('Congratulations, your settings have successfully been saved.', 'updraftplus')
160 ),
161 'updraft_central' => array(
162 'title' => __("UpdraftCentral", 'updraftplus'),
163 'text' => '<div class="ud-notice">'
164 .'<h3>'.__('Control all your backups in one place', 'updraftplus').'</h3>'
165 .__('Do you have a few more WordPress sites you want to backup? If yes you can save hours by controlling all your backups in one place from UpdraftCentral.', 'updraftplus')
166 .'</div>'
167 ),
168 'premium' => array(
169 'title' => 'UpdraftPlus Premium',
170 'text' => __('Thank you for taking the tour.', 'updraftplus')
171 .'<div class="ud-notice">'
172 .'<h3>'.__('UpdraftPlus Premium and addons', 'updraftplus').'</h3>'
173 .__('UpdraftPlus Premium has many more exciting features!', 'updraftplus').' <a href="'.$updraftplus->get_url('premium').'" target="_blank">'.__('Find out more here.', 'updraftplus').'</a>'
174 .'</div>',
175 'attach_to' => '#updraft-navtab-addons top',
176 'button' => __('Finish', 'updraftplus')
177 ),
178 'vault_selected' => array(
179 'title' => 'UpdraftVault',
180 'text' => _x('To get started with UpdraftVault, select one of the options below:', 'Translators: UpdraftVault is a product name and should not be translated.', 'updraftplus')
181 )
182 );
183 $tab = UpdraftPlus_Manipulation_Functions::fetch_superglobal('request', 'tab');
184 if (isset($tab)) {
185 $tour_data['show_tab_on_load'] = '#updraft-navtab-'.esc_attr(sanitize_text_field($tab));
186 }
187
188 // Change the data for premium users
189 if ($updraftplus_addons2 && method_exists($updraftplus_addons2, 'connection_status')) {
190
191 $tour_data['settings_remote_storage'] = array(
192 'title' => __("Remote storage", 'updraftplus'),
193 'text' => __('Now select a remote storage destination to protect against server-wide threats.', 'updraftplus').' '.__('If not, your backups remain on the same server as your site.', 'updraftplus')
194 .'<div class="ud-notice">'
195 .'<h3>'.__('Try UpdraftVault!', 'updraftplus').'</h3>'
196 .__("UpdraftVault is our remote storage which works seamlessly with UpdraftPlus.", 'updraftplus')
197 .' <a href="'.apply_filters('updraftplus_com_link', 'https://teamupdraft.com/updraftplus/updraftvault/').'" target="_blank">'.__('Find out more here.', 'updraftplus').'</a>'
198 .'<br>'
199 .__("If you have a valid Premium license, you get 1GB of storage included.", 'updraftplus')
200 .' <a href="'.apply_filters('updraftplus_com_link', $updraftplus->get_url('shop_vault_5')).'" target="_blank" '.$checkout_embed_5gb_attribute.'>'.__('Otherwise, you can try UpdraftVault for 1 month for only $1!', 'updraftplus').'</a>'
201 .'</div>'
202 );
203
204 if ($updraftplus_addons2->connection_status() && !is_wp_error($updraftplus_addons2->connection_status())) {
205 $tour_data['premium'] = array(
206 'title' => 'UpdraftPlus Premium',
207 'text' => __('Thank you for taking the tour.', 'updraftplus').' '.__('You are now all set to use UpdraftPlus!', 'updraftplus'),
208 'attach_to' => '#updraft-navtab-addons top',
209 'button' => __('Finish', 'updraftplus')
210 );
211 } else {
212 $tour_data['premium'] = array(
213 'title' => 'UpdraftPlus Premium',
214 'text' => __('Thank you for taking the tour.', 'updraftplus')
215 .'<div class="ud-notice">'
216 .'<h3>'.__('Connect to updraftplus.com', 'updraftplus').'</h3>'
217 .__('Log in here to enable all the features you have access to.', 'updraftplus')
218 .'</div>',
219 'attach_to' => '#updraftplus-addons_options_email right',
220 'button' => __('Finish', 'updraftplus')
221 );
222 }
223 }
224
225 wp_localize_script('updraftplus-tour-js', 'updraftplus_tour_i18n', $tour_data);
226 wp_enqueue_script('updraftplus-tour-js');
227 }
228
229 /**
230 * Removes the tour status so the tour can be seen again
231 *
232 * @return string|WP_Error not visible by the user
233 */
234 public function reset_tour_status() {
235
236 // If the option isn't set, the tour hasn't been cancelled
237 if (!UpdraftPlus_Options::get_updraft_option('updraftplus_tour_cancelled_on')) {
238 // string not visible by the user
239 return 'The tour is still active. Everything should be ok.';
240 }
241
242 $result = UpdraftPlus_Options::delete_updraft_option('updraftplus_tour_cancelled_on');
243 // strings not visible by the user
244 return $result ? 'The tour status was successfully reset' : new WP_Error('update_failed', 'The attempt to update the tour option failed.', array('status' => 409));
245 }
246
247 /**
248 * Updates the stored value for which step the tour ended on
249 *
250 * @param object $request - the http $_REQUEST obj
251 * @return bool
252 */
253 public function set_tour_status($request) {
254 if (!isset($request['current_step'])) return false;
255 return UpdraftPlus_Options::update_updraft_option('updraftplus_tour_cancelled_on', $request['current_step']);
256 }
257
258 /**
259 * Adds the Tour link under the plugin on the plugin screen.
260 *
261 * @param Array $links Set of links for the plugin, before being filtered
262 * @param String $file File name (relative to the plugin directory)
263 * @return Array filtered results
264 */
265 public function plugin_action_links($links, $file) {
266 if (is_array($links) && 'updraftplus/updraftplus.php' === $file) {
267 $links['updraftplus_tour'] = '<a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus&updraftplus_tour=1" class="js-updraftplus-tour">'.__("Take Tour", "updraftplus").'</a>';
268 }
269 return $links;
270 }
271
272 /**
273 * Checks if UDP was newly installed.
274 *
275 * Checks if there are backups, and if there are more than 1,
276 * checks if the folder is older than 1 day old
277 *
278 * @return bool
279 */
280 public function updraftplus_was_already_installed() {
281 // If backups already exist
282 $backup_history = UpdraftPlus_Backup_History::get_history();
283
284 // No backup history
285 if (!$backup_history) return false;
286 if (is_array($backup_history) && 0 === count($backup_history)) {
287 return false;
288 }
289 // If there is at least 1 backup, we check if the folder is older than 1 day old
290 if (0 < count($backup_history)) {
291 $backups_timestamps = array_keys($backup_history);
292 $last_backlup_age = time() - end($backups_timestamps);
293 if (DAY_IN_SECONDS < $last_backlup_age) {
294 // the oldest backup is older than 1 day old, so it's likely that UDP was already installed, and the backups aren't a product of the user testing while doing the tour.
295 return true;
296 }
297 }
298 return false;
299 }
300 }
301
302 add_action('admin_init', array(UpdraftPlus_Tour::get_instance(), 'init'));
303