403Webshell
Server IP : 167.235.67.158  /  Your IP : 216.73.216.179
Web Server : Apache
System : Linux ubuntu-8gb-nbg1-1 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : upstairsbar.co.uk ( 982)
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/vinfinity.co.uk/wp-content/themes/dine/inc/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vinfinity.co.uk/wp-content/themes/dine/inc/admin/updater.php
<?php
/**
 * Use this every time we want to migrate old options to new options
 * (for consistency in namespace or we just changed the mechanism)
 *
 * @since 3.3
 */
class Dine_Updater {
    
    /**
     * Construct
     * ----------------------------------------*/
    function __construct() {
        
        // check to run update automatically without permission
        add_action( 'init', [ $this, 'check_run_update' ], 0 );
        add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 );
        
    }
    
    /**
     * Create admin menu
     * ----------------------------------------*/
    function admin_menu() {
        
        // create an admin interface to run update
        add_submenu_page(
            '',
            'The Updater',
            'The Updater',
            'manage_options',
            'dine-updater',
            array( $this, 'create_update_page')
        );
        
    }
    
    /**
     * Update page
     * ----------------------------------------*/
    function create_update_page() {
        
        $run_update = isset( $_GET[ 'run_update' ] ) ? $_GET[ 'run_update' ] : '';
        if ( 'yes' == $run_update ) {

            $back_compat = new Dine_Updater();
            $back_compat->run_update();

            echo '<div class="message notice notice-success"><p>Thank you! Now you are using theme mod instead of options!</p></div>';

        }

        if ( defined( 'DINE_ADMIN_PATH' ) ) {
            
            include_once DINE_ADMIN_PATH . 'update.php';
            
        } else {
            
            include_once 'update.php';
            
        }
        
    }
    
    /**
     * Check things to update  from versions
     * ----------------------------------------*/
    function check_run_update() {
        
        $get = get_theme_mod( 'option_to_thememod', false );
        if ( $get ) {
            return;
        } else {
            
            $this->run_update();
            
        }
        
    }
    
    /**
     * Run Update
     * This function runs immedately after update
     * And it can be re-run when we request
     *
     * $updates is array of things we need to do
     * ----------------------------------------*/
    function run_update() {
        
        /**
         * 01 - options => theme_mod
         */
        $reg_options = Dine_Register::instance()->options();
        $prefix = 'dine_';
        
        // Loop through all registered options
        foreach ( $reg_options as $id => $option ) {
            
            $std = isset( $option[ 'std' ] ) ? $option[ 'std' ] : null;
            $val = get_option( $prefix . $id, $std );
            if ( $val !== null ) {
                // $id_no_prefix = str_replace( 'dine_', '', $id );
                set_theme_mod( $id, $val );
            }
            
        }
        
        /**
         * 02 - font settings
         */
        $ids = [
            'body', 'heading', 'nav', 'text_slider',
        ];
        foreach ( $ids as $id ) {
            
            if ( 'text_slider' == $id ) {
                $new_id = 'special';
            } else {
                $new_id = $id;
            }
            
            /**
             * 2.1 - the name, loads weights
             */
            $body_font = get_option( $prefix . $id . '_font' );
            if ( $body_font ) {
                $weights = get_option( $prefix . $id . '_font_weights' );
                if ( is_string( $weights ) ) {
                    $weights = explode( ',', $weights );
                    $weights = array_map( 'intval', $weights );
                }
                if ( ! is_array( $weights ) ) {
                    $weights = [ 'regular' ];
                }
                $weight_str = [];
                foreach ( $weights as $weight ) {
                    if ( $weight == 400 ) {
                        $weight_str[] = 'regular';
                    } else {
                        $weight_str[] = $weight;
                    }
                }
                $weight_str = implode( ',', $weight_str );

                $body_font_new = "{$body_font}:{$weight_str}";

                set_theme_mod( $new_id . '_font', $body_font_new );
            }

            /**
             * 2.2 - rename options
             */
            $old_to_new = [
                $id . '_font_name' => $new_id . '_custom_font',
                $id . '_font_fallback' => $new_id . '_fallback_font',
            ];

            foreach( $old_to_new as $old => $new ) {
                $val = get_option( $prefix . $old, null );
                if ( null !== $val ) {
                    set_theme_mod( $new, $val );
                }
            }

            /**
             * 2.3 - typography problem
             */
            $current_typo = json_decode( get_theme_mod( $new_id . '_typography' ), true );
            if ( ! is_array( $current_typo ) ) {
                $current_typo = [];
            }
            $props = [
                'font_size' => 'font-size',
                'size' => 'font-size',
                'letter_spacing' => 'letter-spacing',
                'text_transform' => 'text-transform',
                'transform' => 'text-transform',
                'weight' => 'font-weight',
            ];
            foreach ( $props as $k => $prop ) {
                $val = get_option( $prefix . $id . '_' . $k, null );
                if ( null !== $val ) {
                    $current_typo[ $prop ] = $val;
                }
            }
            $current_typo = json_encode( $current_typo );
            set_theme_mod( $new_id . '_typography', $current_typo );
            
        } // foreach
        
        /**
         * 03 - other element fonts
         */
        $typo_migration = [
            'page_title_size' => [
                'ele' => 'page_title',
                'prop' => 'font-size',
            ],
            'blog_post_title_size' => [
                'ele' => 'blog_post_title',
                'prop' => 'font-size',
            ],
            'blog_post_title_weight' => [
                'ele' => 'blog_post_title',
                'prop' => 'font-weight',
            ],
            'widget_title_size' => [
                'ele' => 'title_widget',
                'prop' => 'font-size',
            ],
            'post_content_size' => [
                'ele' => 'post_content',
                'prop' => 'font-size'
            ],
            
        ];
        
        foreach ( $typo_migration as $old => $newdata ) {
            
            $id = $newdata[ 'ele' ];
            $prop = $newdata[ 'prop' ];
        
            $current_typo = json_decode( get_theme_mod( $id . '_typography' ), true );
            if ( ! is_array( $current_typo ) ) {
                $current_typo = [];
            }
            $val = get_option( $prefix . $old, null );
            if ( null !== $val ) {
                $current_typo[ $prop ] = $val;
            }
            $current_typo = json_encode( $current_typo );
            set_theme_mod( $id . '_typography', $current_typo );
            
        }
        
        set_theme_mod( 'option_to_thememod', true );
        return;
        
    }

}

new Dine_Updater();

Youez - 2016 - github.com/yon3zu
LinuXploit