remove empty filters

This commit is contained in:
floppy0 2018-03-06 16:35:28 +01:00
parent ab1bc9fbd0
commit e7fe2f4cbf
1 changed files with 19 additions and 7 deletions

View File

@ -62,17 +62,29 @@ class dbSite extends dbJSON
return $this->save(); return $this->save();
} }
// Returns an array with the filters for the url // Returns an array with the URL filters
// or returns a string with the filter defined on $filter // Also, you can get the a particular filter
public function uriFilters($filter='') public function uriFilters($filter='')
{ {
$filters['admin'] = '/'.ADMIN_URI_FILTER; $filters['admin'] = '/'.ADMIN_URI_FILTER;
$filters['page'] = $this->getField('uriPage');
$filters['tag'] = $this->getField('uriTag');
$filters['category'] = $this->getField('uriCategory');
$filters['blog'] = $this->getField('uriBlog');
if(empty($filter)) { if ($this->getField('uriPage')) {
$filters['page'] = $this->getField('uriPage');
}
if ($this->getField('uriTag')) {
$filters['tag'] = $this->getField('uriTag');
}
if ($this->getField('uriCategory')) {
$filters['category'] = $this->getField('uriCategory');
}
if ($this->getField('uriBlog')) {
$filters['blog'] = $this->getField('uriBlog');
}
if (empty($filter)) {
return $filters; return $filters;
} }