403Webshell
Server IP : 15.235.198.142  /  Your IP : 216.73.216.14
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/yme/wp-content/plugins/ocean-extra/includes/onboarding/class/importer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/yme/wp-content/plugins/ocean-extra/includes/onboarding/class/importer/theme-settings.php
<?php
/**
 * Class for the settings importer.
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

if ( ! class_exists( 'Ocean_Settings_Importer' ) ) {

    /**
     * OWP_Settings_Importer class.
     *
     * This class handles the import of settings from a .dat file.
     */
    class Ocean_Settings_Importer {

        /**
         * Process the import file, parse the settings data, and return the result.
         *
         * @param string $file Path to the settings .dat file.
         */
        public function process_import_file( $file = '' ) {

            if ( ! file_exists( $file ) ) {
                return new WP_Error( 'file_not_found', __( 'The specified file does not exist', 'ocean-extra' ) );
            }

            // Read the file content. Check for errors.
            $raw = file_get_contents( $file );
            if ( false === $raw ) {
                return new WP_Error( 'file_read_error', __( 'Unable to read the file', 'ocean-extra' ) );
            }

            // Try to unserialize the data (if valid).
            $data = @unserialize( $raw, [ 'allowed_classes' => false ] );
            if ( false === $data ) {
                return new WP_Error( 'unserialize_error', __( 'Failed to unserialize data from file', 'ocean-extra' ) );
            }

            // Check and process wp_css if available.
            if ( function_exists( 'wp_update_custom_css_post' ) && isset( $data['wp_css'] ) && ! empty( $data['wp_css'] ) ) {
                wp_update_custom_css_post( $data['wp_css'] );
            }

            // Import the settings data
            return $this->import_data( $data['mods'] );
        }

        /**
         * Import the settings data into WordPress theme mods.
         *
         * @param array $data The settings data.
         */
        private function import_data( $data ) {
            // Ensure there is valid data to import.
            if ( empty( $data ) ) {
                return new WP_Error( 'empty_data', __( 'No settings data found to import', 'ocean-extra' ) );
            }

            foreach ( $data as $mod => $value ) {
                set_theme_mod( $mod, $value );
            }

            return $data;
        }

    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit