mirror of
https://github.com/typecho/typecho.git
synced 2025-01-16 20:18:19 +01:00
parent
23724c4193
commit
b989f24c5b
@ -288,6 +288,15 @@ class Archive extends Contents
|
||||
return $this->archiveDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 1.3.0
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->getArchiveDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $archiveDescription the $description to set
|
||||
*/
|
||||
@ -304,6 +313,15 @@ class Archive extends Contents
|
||||
return $this->archiveKeywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 1.3.0
|
||||
* @return string|null
|
||||
*/
|
||||
public function getKeywords(): ?string
|
||||
{
|
||||
return $this->getArchiveKeywords();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $archiveKeywords the $keywords to set
|
||||
*/
|
||||
@ -320,6 +338,15 @@ class Archive extends Contents
|
||||
return $this->archiveFeedAtomUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 1.3.0
|
||||
* @return string
|
||||
*/
|
||||
public function getFeedAtomUrl(): string
|
||||
{
|
||||
return $this->getArchiveFeedAtomUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $archiveFeedAtomUrl the $feedAtomUrl to set
|
||||
*/
|
||||
@ -336,6 +363,15 @@ class Archive extends Contents
|
||||
return $this->archiveFeedRssUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 1.3.0
|
||||
* @return string
|
||||
*/
|
||||
public function getFeedRssUrl(): string
|
||||
{
|
||||
return $this->getArchiveFeedRssUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $archiveFeedRssUrl the $feedRssUrl to set
|
||||
*/
|
||||
@ -352,6 +388,15 @@ class Archive extends Contents
|
||||
return $this->archiveFeedUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 1.3.0
|
||||
* @return string
|
||||
*/
|
||||
public function getFeedUrl(): string
|
||||
{
|
||||
return $this->getArchiveFeedUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $archiveFeedUrl the $feedUrl to set
|
||||
*/
|
||||
@ -1700,23 +1745,33 @@ EOF;
|
||||
->where('type = ?', 'category')
|
||||
->limit(1);
|
||||
|
||||
$alias = 'category';
|
||||
|
||||
if ($this->request->is('mid')) {
|
||||
$categorySelect->where('mid = ?', $this->request->filter('int')->get('mid'));
|
||||
$mid = $this->request->filter('int')->get('mid');
|
||||
$categorySelect->where('mid = ?', $mid);
|
||||
$alias .= ':' . $mid;
|
||||
}
|
||||
|
||||
if ($this->request->is('slug')) {
|
||||
$categorySelect->where('slug = ?', $this->request->get('slug'));
|
||||
$slug = $this->request->get('slug');
|
||||
$categorySelect->where('slug = ?', $slug);
|
||||
$alias .= ':' . $slug;
|
||||
}
|
||||
|
||||
if ($this->request->is('directory')) {
|
||||
$directory = explode('/', $this->request->get('directory'));
|
||||
$categorySelect->where('slug = ?', $directory[count($directory) - 1]);
|
||||
$slug = $directory[count($directory) - 1];
|
||||
$categorySelect->where('slug = ?', $slug);
|
||||
$alias .= ':' . $slug;
|
||||
}
|
||||
|
||||
$category = MetasFrom::allocWithAlias('category:' . $this->cid, [
|
||||
$category = MetasFrom::allocWithAlias($alias, [
|
||||
'query' => $categorySelect
|
||||
]);
|
||||
|
||||
var_dump($category->mid);
|
||||
|
||||
if (!$category->have()) {
|
||||
throw new WidgetException(_t('分类不存在'), 404);
|
||||
}
|
||||
@ -1780,16 +1835,22 @@ EOF;
|
||||
$tagSelect = $this->db->select()->from('table.metas')
|
||||
->where('type = ?', 'tag')->limit(1);
|
||||
|
||||
$alias = 'tag';
|
||||
|
||||
if ($this->request->is('mid')) {
|
||||
$tagSelect->where('mid = ?', $this->request->filter('int')->get('mid'));
|
||||
$mid = $this->request->filter('int')->get('mid');
|
||||
$tagSelect->where('mid = ?', $mid);
|
||||
$alias .= ':' . $mid;
|
||||
}
|
||||
|
||||
if ($this->request->is('slug')) {
|
||||
$tagSelect->where('slug = ?', $this->request->get('slug'));
|
||||
$slug = $this->request->get('slug');
|
||||
$tagSelect->where('slug = ?', $slug);
|
||||
$alias .= ':' . $slug;
|
||||
}
|
||||
|
||||
/** 如果是标签 */
|
||||
$tag = MetasFrom::allocWithAlias('tag:' . $this->cid, [
|
||||
$tag = MetasFrom::allocWithAlias($alias, [
|
||||
'query' => $tagSelect
|
||||
]);
|
||||
|
||||
|
@ -669,6 +669,14 @@ class Contents extends Base implements QueryInterface, RowFilterInterface, Prima
|
||||
return $directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function ___category(): string
|
||||
{
|
||||
return empty($this->categories) ? '' : $this->categories[0]['slug'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user