HEX
Server: LiteSpeed
System: Linux server53.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64
User: nahevttf (6494)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /home/nahevttf/www/wp-content/plugins/smart-slider-3/Nextend/Framework/Font/FontParser.php
<?php


namespace Nextend\Framework\Font;


use Nextend\Framework\Misc\Base64;
use Nextend\Framework\Model\Section;

class FontParser {

    /**
     * @param $data
     *
     * @return string
     */
    public static function parse($data) {
        if (empty($data)) {
            return '';
        } else if (is_numeric($data)) {
            /**
             * Linked font
             */

            $font = Section::getById($data, 'font');

            if (!$font) {
                /**
                 * Linked font not exists anymore
                 */
                return '';
            }


            if (is_string($font['value'])) {
                /**
                 * Old format when value stored as Base64
                 */
                $decoded = $font['value'];
                if ($decoded[0] != '{') {
                    $decoded = Base64::decode($decoded);
                }

                return $decoded;
            }

            /**
             * Value stored as array
             */
            $value = json_encode($font['value']);
            if ($value == false) {
                return '';
            }

            return $value;
        } else if ($data[0] != '{') {
            return Base64::decode($data);
        }

        return $data;
    }
}