HEX
Server: LiteSpeed
System: Linux s383.bitcommand.com 5.14.0-687.24.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 9 18:14:06 EDT 2026 x86_64
User: pclast (1605)
PHP: 8.1.34
Disabled: exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/pclast/public_html/wp-content/plugins/zhaket-updater/includes/Settings/Helper.php
<?php


namespace ZhaketUpdater\Settings;


final class Helper
{

    public static function convert_old_option_to_new($old)
    {
        $new=[];
        $new['backup']=[];
        $new['notifications']=[];
        $new['settings']=[];
        $new['checkUpdate']=[];

        $new['checkUpdate']['allPlugins']= ($old['all-plugins']??'1') == '1';
        $new['checkUpdate']['allThemes']= ($old['all-themes']??'1') == '1';
        $new['backup']['backup']= ($old['remove-old-backup']??'1') == '1';
        $new['backup']['backupCount']=(int)($old['backup-keep-count']??'2');
        $new['notifications']['all_notice']= ($old['send-notifications']??'1') == '1';
        $new['notifications']['email_for_notice']=$old['email-address'] ?? get_bloginfo('admin_email');
        $new['notifications']['email_interval']=(int)($old['send-email-delay']??'2');
        $new['notifications']['email_notice']= ($old['send-admin-notifications']??'1') == '1';
        $new['notifications']['wordpress_notice']= ($old['show-admin-notifications']??'1') == '1';
        $new['notifications']['wordpress_offer']= ($old['show-admin-offer']??'1') == '1';
        $new['notifications']['send_data']= ($old['send-data']??'0') == '1';

        $new['settings']['alternative_domain']= ($old['use-second-way-domain-test']??'0') == '1';
        $new['settings']['alternative_update']= ($old['use-second-way-download']??'0') == '1';
        $new['settings']['alternative_server']= ($old['use-second-download-server']??'0') == '1';

        foreach ((array)($old['check-spacial-plugins']??[]) as $key => $value){
            $new['checkUpdate']['spacialPlugins'][]=['slug'=>$key,'value'=>$value=='1'];
        }
        foreach ((array)($old['check-spacial-themes']??[]) as $key => $value){
            $new['checkUpdate']['spacialThemes'][]=['slug'=>$key,'value'=>($value=='1')];
        }

        return $new;
    }

    public static function convert_bool_to_int($value){
        if ($value==false)
            return '0';
        return '1';
    }

    public static function convertArrayKeysAndValues($array) {
        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[$key] = self::convertArrayKeysAndValues($value);
            } else {
                // Convert "true" and "false" strings to boolean
                if ($value === "true") {
                    $result[$key] = true;
                } elseif ($value === "false") {
                    $result[$key] = false;
                } else {
                    // Leave other values unchanged
                    $result[$key] = $value;
                }
            }
        }

        return $result;
    }


}