HEX
Server: Apache
System: Linux ecngx285.inmotionhosting.com 4.18.0-553.79.1.lve.el8.x86_64 #1 SMP Wed Oct 15 17:59:35 UTC 2025 x86_64
User: zeusxp5 (3862)
PHP: 8.3.28
Disabled: NONE
Upload Files
File: /home/zeusxp5/chuair.org/wp-content/plugins/wd-framework/import/endpoints/content.php
<?php

namespace Webdevia\Main_Plugin;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class WD_ImportContent extends Endpoint {

	public $action = 'wd_data_import';

	public function __construct() {
		parent::__construct();
	}

	public function action() {
    ob_start();
		try {
			// TODO: add nonce

			$importer = new Importer();

			if ( $_POST['import_attachments'] == 1 )
				$importer->attachments = true;
			else
				$importer->attachments = false;

			$folder = 'demo-1/';
			if ( ! empty( $_POST['example'] ) )
				$folder = $_POST['example'] . "/";

			if ( ! ini_get( 'allow_url_fopen' ) ) {
				throw new \Exception( "Please ensure that your server's php.ini file is updated to enable the 'allow_url_fopen' option to On. This is necessary for the import to function correctly, as your server is currently not permitted to open files from our server." );
			}

			$importer->importContent( $folder . $_POST['xml'] );

			if( str_contains( $_POST['xml'], '10') ) {
				global $wpdb;
				$importer->importSettingsPages( $folder . 'settingpages.txt' );
				$importer->importGlobalStyle( $folder . 'globalstyle.txt' );
				$importer->importmenu( $folder . 'menu.txt' );
				
				
				
				wd_trash_hello_world();
				
				global $wpdb;
				switch ( WD_MAIN_PLUGIN_THEME_SLUG ) {
					case 'marbleo':
						switch ( $_POST['example'] ) {
							case 'demo-13':
								$theme_root_link = 'https://demo.webdevia.com/marbleo-marble-tiles-wordpress-theme/elementor';
								break;
							default:
								$theme_root_link = 'https://marbleo.webdevia.com';
								break;
						}
						break;
					case 'cocina':
						$theme_root_link = 'https://demo.webdevia.com/cocina-kitchen-wordpress-theme';
						break;
					case 'lifttruck':
						$theme_root_link = 'https://demo.webdevia.com/lifttruck-forklift-repair-for-sale-or-hire';
						break;
					case 'electrental':

						switch ( $_POST['example'] ) {
							case 'demo-2':
								$theme_root_link = 'https://av.electrental.webdevia.com';
								break;
							case 'demo-1':
								$theme_root_link = 'https://electrental.webdevia.com';
								break;
							default:
								$theme_root_link = 'https://electrental.webdevia.com';
								break;
						}

						$sit_url = home_url();
						$sql = "UPDATE wp_posts SET post_content = REPLACE(post_content, '$theme_root_link', '$sit_url' ) WHERE post_name LIKE 'navigation-2-2'";
						$results = $wpdb->get_results( $sql );
						break;
					default:
						$theme_root_link = 'exemple.com';
						break;

				} 	
				
					if ($theme_root_link == 'exemple.com') {
						$sit_url = home_url();
						$sql = "UPDATE wp_posts SET post_content = REPLACE(post_content, 'exemple.com', '$sit_url' ) WHERE post_title LIKE 'Navigation'";
						$results = $wpdb->get_results( $sql );

						$sql = "UPDATE wp_posts SET post_content = REPLACE(post_content, 'exemple.com', '$sit_url' ) WHERE post_name LIKE 'auto-draft'";
						$results = $wpdb->get_results( $sql );
					}else{
						$sit_url = home_url();
						$sql = "UPDATE wp_posts SET post_content = REPLACE(post_content, '$theme_root_link', '$sit_url' ) WHERE post_title LIKE 'Navigation'";
						$results = $wpdb->get_results( $sql );
					} 
					
			}

			wp_send_json( [
        'success'   => true,
        'message'   => esc_html__( "Content imported successfully.", "webdevia" ),
        'output'    => ob_get_clean()
      ], 200 );
		} catch (\Exception $e) {
			// Handle the exception
			wp_send_json( [
        'success'   => false,
        'message'   => esc_html__( $e->getMessage(), 'webdevia' ),
        'output'    => ob_get_clean()
      ], 500 );
		}
	}

}