src/Biz/Theme/Service/Impl/ThemeServiceImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\Theme\Service\Impl;

use Biz\BaseService;
use Biz\Theme\Service\ThemeService;
use Topxia\Service\Common\ServiceKernel;
use Codeages\PluginBundle\System\PluginConfigurationManager;
use AppBundle\System;

class ThemeServiceImpl extends BaseService implements ThemeService
{
    private $defaultConfig;
    private $allConfig;
    private $themeName;

    public function __construct()
    {
        parent::__construct(ServiceKernel::instance()->getBiz());
        $currentTheme = $this->getSettingService()->get('theme');

        try {
            $this->defaultConfig = $this->getKernel()->getParameter("theme_{$currentTheme['uri']}_default");
            $this->allConfig = $this->getKernel()->getParameter("theme_{$currentTheme['uri']}_all");

            if ($this->getKernel()->hasParameter("theme_{$currentTheme['uri']}_extend")) {
                $allConfigExtend = $this->getKernel()->getParameter("theme_{$currentTheme['uri']}_extend");
                $this->allConfig = array_merge_recursive($this->allConfig, $allConfigExtend["theme_{$currentTheme['uri']}_all"]);
            }

            $this->themeName = $this->getKernel()->getParameter("theme_{$currentTheme['uri']}_name");
        } catch (\Exception $e) {
            $this->setConfigAndNameByThemeConfig($currentTheme);
        }
    }

    public function isAllowedConfig()
    {
        $currentTheme = $this->getSettingService()->get('theme');

        if (!isset($currentTheme['name'])) {
            $currentTheme['name'] = '简墨';
        }

        if (empty($this->themeName) && empty($this->defaultConfig)) {
            return false;
        }

        if (in_array($currentTheme['name'], array($this->themeName))) {
            return true;
        }

        return false;
    }

    public function createThemeConfig($name, $config)
    {
        return $this->getThemeConfigDao()->create(array(
            'name' => $name,
            'config' => $config,

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

AI 解读 AI

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

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