| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('WPO_VERSION')) die('No direct access allowed'); | |
| 3 | +if (!defined('ABSPATH')) die('No direct access allowed'); | |
| 4 | 4 | |
| 5 | 5 | global $wpo_backup_initialized, $wpo_take_backup_checkbox_id; |
| 6 | 6 | |
| 7 | -$updraftplus_admin = !empty($GLOBALS['updraftplus_admin']) ? $GLOBALS['updraftplus_admin'] : null; | |
| 8 | -$updraftplus = !empty($GLOBALS['updraftplus']) ? $GLOBALS['updraftplus'] : null; | |
| 7 | +$updraftplus_admin = empty($GLOBALS['updraftplus_admin']) ? null : $GLOBALS['updraftplus_admin']; | |
| 8 | +$updraftplus = empty($GLOBALS['updraftplus']) ? null : $GLOBALS['updraftplus']; | |
| 9 | 9 | |
| 10 | 10 | // Check if UpdraftPlus plugin status. |
| 11 | 11 | $updraftplus_status = $this->is_installed('UpdraftPlus - Backup/Restore'); |
| 12 | 12 | $check_version = false; |
| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | |
| 14 | 14 | // If UpdraftPlus Admin exists along with Method and active, then call the update modal. |
| 15 | 15 | if (is_a($updraftplus_admin, 'UpdraftPlus_Admin') && is_callable(array($updraftplus_admin, 'add_backup_scaffolding'))) { |
| 16 | 16 | if (!$wpo_backup_initialized) { |
| 17 | - $updraftplus_admin->add_backup_scaffolding(__('Backup before running optimizations', 'wp-optimize'), array($updraftplus_admin, 'backupnow_modal_contents')); | |
| 17 | + $updraftplus_admin->add_backup_scaffolding(esc_html__('Backup before running optimizations', 'wp-optimize'), array($updraftplus_admin, 'backupnow_modal_contents')); | |
| 18 | 18 | } |
| 19 | 19 | $wpo_backup_initialized = true; |
| 20 | 20 | $check_version = true; |
| 21 | 21 | } else { |
| @@ -58,19 +58,19 @@ | ||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $option_value = $options->get_option($checkbox_name, $default_checkbox_value); |
| 61 | 61 | |
| 62 | -$is_checked = ('true' == $option_value); | |
| 62 | +$is_checked = ('true' === $option_value); | |
| 63 | 63 | |
| 64 | 64 | ?> |
| 65 | 65 | <p class="wpo-take-a-backup"> |
| 66 | - <input class="enable-auto-backup" name="<?php echo $checkbox_name; ?>" id="<?php echo $checkbox_name; ?>" type="checkbox" value="true" <?php checked($is_checked);?> <?php echo $disabled_backup; ?> /> | |
| 67 | - <label for="<?php echo $checkbox_name; ?>"> <?php echo $label_text; ?> </label> | |
| 66 | + <input class="enable-auto-backup" name="<?php echo esc_attr($checkbox_name); ?>" id="<?php echo esc_attr($checkbox_name); ?>" type="checkbox" value="true" <?php checked($is_checked);?> <?php echo esc_attr($disabled_backup); ?> /> | |
| 67 | + <label for="<?php echo esc_attr($checkbox_name); ?>"> <?php echo esc_html($label_text); ?> </label> | |
| 68 | 68 | |
| 69 | 69 | <?php |
| 70 | 70 | // UpdraftPlus is not installed. |
| 71 | - if ('disabled' == $disabled_backup && !$updraftplus_status['installed']) { | |
| 72 | - echo '<small><a href="'.wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=updraftplus'), 'install-plugin_updraftplus').'"> '.__('Follow this link to install UpdraftPlus, to take a backup before optimization', 'wp-optimize').' </a></small>'; | |
| 71 | + if ('disabled' === $disabled_backup && !$updraftplus_status['installed']) { | |
| 72 | + echo '<small><a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=updraftplus'), 'install-plugin_updraftplus')).'"> '.esc_html__('Follow this link to install UpdraftPlus, to take a backup before optimization', 'wp-optimize').' </a></small>'; | |
| 73 | 73 | } else { |
| 74 | 74 | // Build activate url. |
| 75 | 75 | $activate_url = add_query_arg(array( |
| 76 | 76 | '_wpnonce' => wp_create_nonce('activate-plugin_updraftplus/updraftplus.php'), |
| @@ -77,9 +77,9 @@ | ||
| 77 | 77 | 'action' => 'activate', |
| 78 | 78 | 'plugin' => 'updraftplus/updraftplus.php' |
| 79 | 79 | ), network_admin_url('plugins.php')); |
| 80 | 80 | |
| 81 | - // If is network admin then add to link newtwork activation. | |
| 81 | + // If is network admin then add to link network activation. | |
| 82 | 82 | if (is_network_admin()) { |
| 83 | 83 | $activate_url = add_query_arg(array('networkwide' => 1), $activate_url); |
| 84 | 84 | } |
| 85 | 85 | |
| @@ -84,13 +84,13 @@ | ||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Check updraftplus version first. |
| 87 | 87 | if (!empty($updraftplus_version_check)) { |
| 88 | - echo '<small>'.__('UpdraftPlus needs to be updated to 1.12.33 or higher in order to backup the database before optimization.', 'wp-optimize').' <a href="'.admin_url('update-core.php').'">'.__('Please update UpdraftPlus to the latest version.', 'wp-optimize').'</a></small>'; | |
| 88 | + echo '<small>'.esc_html__('UpdraftPlus needs to be updated to 1.12.33 or higher in order to backup the database before optimization.', 'wp-optimize').' <a href="'.esc_url(admin_url('update-core.php')).'">'.esc_html__('Please update UpdraftPlus to the latest version.', 'wp-optimize').'</a></small>'; | |
| 89 | 89 | } else { |
| 90 | 90 | if ($updraftplus_status['installed'] && !$updraftplus_status['active']) { |
| 91 | - echo '<small><a href="'.$activate_url.'"> '.__('UpdraftPlus is installed but currently not active. Follow this link to activate UpdraftPlus, to take a backup before optimization.', 'wp-optimize').' </a></small>'; | |
| 91 | + echo '<small><a href="'.esc_url($activate_url).'"> '.esc_html__('UpdraftPlus is installed but currently not active.', 'wp-optimize').' '.esc_html__('Follow this link to activate UpdraftPlus, to take a backup before optimization.', 'wp-optimize') .'</a></small>'; | |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | ?> |
| 96 | 96 | </p> |