Fix themeUrl format

This commit is contained in:
joyqi 2022-05-13 00:46:12 +08:00
parent 7279d4832d
commit 05e20c0ae5
2 changed files with 10 additions and 11 deletions

View File

@ -261,18 +261,18 @@ class Options extends Base
*
* @param string|null $path 子路径
* @param string|null $theme 模版名称
* @return string
* @return string | void
*/
public function themeUrl(?string $path = null, ?string $theme = null): string
public function themeUrl(?string $path, ?string $theme)
{
if (empty($theme)) {
if (!isset($theme)) {
echo Common::url($path, $this->themeUrl);
} else {
$url = defined('__TYPECHO_THEME_URL__') ? __TYPECHO_THEME_URL__ :
Common::url(__TYPECHO_THEME_DIR__ . '/' . $theme, $this->siteUrl);
return isset($path) ? Common::url($path, $url) : $url;
}
$url = defined('__TYPECHO_THEME_URL__') ? __TYPECHO_THEME_URL__ :
Common::url(__TYPECHO_THEME_DIR__ . '/' . $theme, $this->siteUrl);
return Common::url($path, $url);
}
/**
@ -482,8 +482,7 @@ class Options extends Base
*/
protected function ___themeUrl(): string
{
return defined('__TYPECHO_THEME_URL__') ? __TYPECHO_THEME_URL__ :
Common::url(__TYPECHO_THEME_DIR__ . '/' . $this->theme, $this->siteUrl);
return $this->themeUrl(null, $this->theme);
}
/**

View File

@ -46,7 +46,7 @@ class Edit extends Options implements ActionInterface
$this->update(['value' => 'recent'], $this->db->sql()->where('name = ?', 'frontPage'));
}
$this->options->themeUrl = rtrim($this->options->themeUrl('', $theme), '/');
$this->options->themeUrl = $this->options->themeUrl(null, $theme);
$configFile = $this->options->themeFile($theme, 'functions.php');