403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.13
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.9/wp-content/themes/dt-the7/inc/mods/dev-mode/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.9/wp-content/themes/dt-the7/inc/mods/dev-mode/tools.php
<?php
/**
 * The7 dev tools class.
 *
 * @package The7
 */

namespace The7\Mods\Dev_Mode;

defined( 'ABSPATH' ) || exit;

/**
 * Tools class.
 */
class Tools {

	/**
	 * Form post action handler.
	 */
	public static function use_tool() {
		if ( ! check_ajax_referer( 'the7-dev-tools', false, false ) ) {
			return;
		}

		if ( ! current_user_can( 'switch_themes' ) ) {
			return;
		}

		if ( empty( $_POST['tool'] ) ) {
			return;
		}

		$tool = $_POST['tool'];
		if ( is_callable( __CLASS__ . "::tool_$tool" ) ) {
			call_user_func( __CLASS__ . "::tool_$tool" );
		}

		$referer = wp_get_referer();
		if ( $referer ) {
			wp_safe_redirect( esc_url( $referer ) );
		} else {
			wp_safe_redirect( admin_url( 'admin.php?page=the7-dev' ) );
		}
		exit();
	}

	/**
	 * Regenerate shortcodes css.
	 */
	public static function tool_regenerate_shortcodes_css() {
		include_once PRESSCORE_MODS_DIR . '/theme-update/the7-update-utility-functions.php';
		the7_mass_regenerate_short_codes_inline_css();
		self::set_message( '<p>Shortcodes css was regenerated.</p>' );
	}

	/**
	 * Restore theme options from a backup.
	 */
	public static function tool_restore_theme_options_from_backup() {
		if ( ! isset( $_POST['theme_options_backup'] ) ) {
			self::set_message( '<p>There is no backup selected.</p>' );
			return;
		}

		$record_name = $_POST['theme_options_backup'];

		unset( $_POST['_wp_http_referer'] );
		if ( \The7_Options_Backup::restore( $record_name ) ) {
			$message = '<p>Theme options successfully restored from backup <code>' . esc_html( $record_name ) . '</code>.</p>';
		} else {
			$message = '<p>Selected backup is not valid, please search for <code>%' . esc_html( $record_name ) . '%</code> option in DB.</p>';
		}

		self::set_message( $message );
	}

	/**
	 * Delete all theme options backups.
	 */
	public static function tool_delete_all_theme_options_backups() {
		$count = \The7_Options_Backup::delete_all_records();
		self::set_message( "<p>Successfully deleted $count backups.</p>" );
	}

	/**
	 * @return void
	 */
	public static function tool_delete_post_type_builder_data() {
		if ( class_exists( '\The7_Core\Mods\Post_Type_Builder\Models\Post_Types' ) ) {
			\The7_Core\Mods\Post_Type_Builder\Models\Post_Types::save( [] );
		}

		if ( class_exists( '\The7_Core\Mods\Post_Type_Builder\Models\Taxonomies' ) ) {
			\The7_Core\Mods\Post_Type_Builder\Models\Taxonomies::save( [] );
		}

		if ( class_exists( '\The7_Post_Types\Models\Post_Types' ) ) {
			\The7_Post_Types\Models\Post_Types::save( [] );
		}

		if ( class_exists( '\The7_Post_Types\Models\Taxonomies' ) ) {
			\The7_Post_Types\Models\Taxonomies::save( [] );
		}

		self::set_message( '<p>Post Type Builder data was deleted.</p>' );
	}

	/**
	 * Run theme migration.
	 */
	public static function tool_run_migration() {
		$migration_version = isset( $_POST['migration'] ) ? $_POST['migration'] : null;
		$migrations        = \The7_Install::get_update_callbacks();

		if ( ! array_key_exists( $migration_version, $migrations ) ) {
			self::set_message( '<p>Error. Wrong migration.</p>' );
			return;
		}

		if ( \The7_Install::db_is_updating() ) {
			self::set_message( '<p>DB is updating. Please, wait untill it is done.</p>' );
			return;
		}

		$migrations_to_run = $migrations[ $migration_version ];

		// Bump DB version if needed.
		if ( version_compare( $migration_version, \The7_Install::get_db_version(), '>' ) ) {
			$migrations_to_run[] = 'bump_db_version_to_' . $migration_version;
		}

		$migrations_to_run[] = 'presscore_refresh_dynamic_css';
		$migrations_to_run[] = 'the7_elementor_flush_css_cache';

		\The7_Install::register_update_callbacks( $migrations_to_run );
		\The7_Install::updater_dispatch();

		the7_admin_notices()->reset( 'the7_updated' );
	}

	/**
	 * Change theme.json version.
	 */
	public static function tool_change_themejson_version() {
		if ( ! the7_is_gutenberg_theme_mode_active() ) {
			return;
		}

		$themejson_version = isset( $_POST['themejson_version'] ) ? $_POST['themejson_version'] : null;
		if ( ! $themejson_version ) {
			self::set_message( '<p>Error. Wrong theme.json version.</p>' );
			return;
		}

		$the7_compat_obj = \The7\Mods\Compatibility\Gutenberg\Block_Theme\The7_Block_Theme_Compatibility::instance();
		if ( $the7_compat_obj && $the7_compat_obj->set_fse_version( $themejson_version ) ) {
			self::set_message( '<p>Theme.json version was changed to ' . esc_html( $themejson_version ) . '.</p>' );
		} else {
			self::set_message( '<p>Error. Wrong theme.json version.</p>' );
		}
	}

	/**
	 * @return void
	 */
	public static function tool_trigger_fse_styles_font_download() {
		if ( ! the7_is_gutenberg_theme_mode_active() ) {
			return;
		}

		\The7\Mods\Compatibility\Gutenberg\Block_Theme\The7_FSE_Font_Manager::instance()->reset_fonts_to_download();
		self::set_message( '<p>Font download triggered.</p>' );
	}

	/**
	 * Store message to be published on the7 tools admin page.
	 *
	 * @param string $message Message text.
	 */
	protected static function set_message( $message ) {
		set_transient( 'the7-dev-tools-message', $message, 60 );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit