Skip to content

Commit

Permalink
Fix themeUrl format
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed May 12, 2022
1 parent 7279d48 commit 05e20c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions var/Widget/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,18 @@ public function index(?string $path = null)
*
* @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);
}

$url = defined('__TYPECHO_THEME_URL__') ? __TYPECHO_THEME_URL__ :
Common::url(__TYPECHO_THEME_DIR__ . '/' . $theme, $this->siteUrl);
} else {
$url = defined('__TYPECHO_THEME_URL__') ? __TYPECHO_THEME_URL__ :
Common::url(__TYPECHO_THEME_DIR__ . '/' . $theme, $this->siteUrl);

return Common::url($path, $url);
return isset($path) ? Common::url($path, $url) : $url;
}
}

/**
Expand Down Expand Up @@ -482,8 +482,7 @@ protected function ___index(): string
*/
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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion var/Widget/Themes/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function changeTheme(string $theme)
$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');

Expand Down

0 comments on commit 05e20c0

Please sign in to comment.