vendor/codeages/plugin-bundle/Loader/ThemeTwigLoader.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Codeages\PluginBundle\Loader;

use Codeages\PluginBundle\System\PluginableHttpKernelInterface;

class ThemeTwigLoader extends \Twig_Loader_Filesystem
{
    /**
     * @var PluginableHttpKernelInterface
     */
    private $kernel;

    public function __construct(PluginableHttpKernelInterface $kernel)
    {
        $this->kernel = $kernel;
        parent::__construct(array());
    }

    public function findTemplate($name, $throw = true)
    {
        $logicalName = (string) $name;

        if (isset($this->cache[$logicalName])) {
            return $this->cache[$logicalName];
        }

        $file = $this->getCustomFile($logicalName);

        if (is_null($file)) {
            $file = $this->getThemeFile($logicalName);
        }

        if ($file === false || null === $file) {
            if ($throw) {
                throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $logicalName));
            }

            return false;
        }

        return $this->cache[$logicalName] = $file;
    }

    protected function getThemeFile($file)
    {
        if ($this->isAppResourceFile($file)) {
            $themeDir = $this->kernel->getPluginConfigurationManager()->getActiveThemeDirectory();
            $file = $themeDir.'/views/'.$file;
        }

        if (is_file($file)) {
            return $file;
        }

        return null;
    }

    protected function getCustomFile($file)
    {

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。