HEX
Server: Apache
System: Linux srv-plesk28.ps.kz 5.14.0-284.18.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 29 17:06:27 EDT 2023 x86_64
User: greencl1 (10085)
PHP: 8.1.33
Disabled: apache_setenv,dl,eval,exec,openlog,passthru,pcntl_exec,pcntl_fork,popen,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,socket_create,socket_create_listen,socket_create_pair,syslog,system,socket_listen,stream_socket_server
Upload Files
File: /var/www/vhosts/greenclinic.kz/test.greenclinic.kz/modules/backend/classes/Skin.php
<?php namespace Backend\Classes;

use File;
use Config;
use October\Rain\Router\Helper as RouterHelper;

/**
 * Skin Base class
 * Used for defining skins.
 *
 * @package october\backend
 * @author Alexey Bobkov, Samuel Georges
 */
abstract class Skin
{
    /**
     * Returns information about this skin, including name and description.
     */
    abstract public function skinDetails();

    /**
     * @var string The absolute path to this skin.
     */
    public $skinPath;

    /**
     * @var string The public path to this skin.
     */
    public $publicSkinPath;

    /**
     * @var string The default skin path, usually the root level of modules/backend.
     */
    public $defaultSkinPath;

    /**
     * @var string The default public skin path.
     */
    public $defaultPublicSkinPath;

    /**
     * @var Self Cache of the active skin.
     */
    private static $skinCache;

    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->defaultSkinPath = base_path() . '/modules/backend';

        /*
         * Guess the skin path
         */
        $class = get_called_class();
        $classFolder = strtolower(class_basename($class));
        $classFile = realpath(dirname(File::fromClass($class)));
        $this->skinPath = $classFile
            ? $classFile . '/' . $classFolder
            : $this->defaultSkinPath;

        $this->publicSkinPath = File::localToPublic($this->skinPath);
        $this->defaultPublicSkinPath = File::localToPublic($this->defaultSkinPath);
    }

    /**
     * Looks up a path to a skin-based file, if it doesn't exist, the default path is used.
     * @param  string  $path
     * @param  boolean $isPublic
     * @return string
     */
    public function getPath($path = null, $isPublic = false)
    {
        $path = RouterHelper::normalizeUrl($path);
        $assetFile = $this->skinPath . $path;

        if (File::isFile($assetFile)) {
            return $isPublic
                ? $this->publicSkinPath . $path
                : $this->skinPath . $path;
        }

        return $isPublic
            ? $this->defaultPublicSkinPath . $path
            : $this->defaultSkinPath . $path;
    }

    /**
     * Returns an array of paths where skin layouts can be found.
     * @return array
     */
    public function getLayoutPaths()
    {
        return [$this->skinPath.'/layouts', $this->defaultSkinPath.'/layouts'];
    }

    /**
     * Returns the active skin.
     */
    public static function getActive()
    {
        if (self::$skinCache !== null) {
            return self::$skinCache;
        }

        $skinClass = Config::get('cms.backendSkin');
        $skinObject = new $skinClass();
        return self::$skinCache = $skinObject;
    }
}