✨ (pages): allow to show pages by author
This commit is contained in:
parent
6b8420b10e
commit
79ff2bc74d
4 changed files with 27 additions and 1 deletions
|
@ -66,6 +66,7 @@ define('DB_PAGES', PATH_DATABASES . 'pages.php');
|
||||||
define('DB_SITE', PATH_DATABASES . 'site.php');
|
define('DB_SITE', PATH_DATABASES . 'site.php');
|
||||||
define('DB_CATEGORIES', PATH_DATABASES . 'categories.php');
|
define('DB_CATEGORIES', PATH_DATABASES . 'categories.php');
|
||||||
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
||||||
|
define('DB_AUTHORS', PATH_DATABASES . 'authors.php');
|
||||||
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
||||||
define('DB_USERS', PATH_DATABASES . 'users.php');
|
define('DB_USERS', PATH_DATABASES . 'users.php');
|
||||||
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
||||||
|
@ -88,6 +89,7 @@ include(PATH_ABSTRACT . 'plugin.class.php');
|
||||||
include(PATH_KERNEL . 'pages.class.php');
|
include(PATH_KERNEL . 'pages.class.php');
|
||||||
include(PATH_KERNEL . 'users.class.php');
|
include(PATH_KERNEL . 'users.class.php');
|
||||||
include(PATH_KERNEL . 'tags.class.php');
|
include(PATH_KERNEL . 'tags.class.php');
|
||||||
|
include(PATH_KERNEL . 'authors.class.php');
|
||||||
include(PATH_KERNEL . 'language.class.php');
|
include(PATH_KERNEL . 'language.class.php');
|
||||||
include(PATH_KERNEL . 'site.class.php');
|
include(PATH_KERNEL . 'site.class.php');
|
||||||
include(PATH_KERNEL . 'categories.class.php');
|
include(PATH_KERNEL . 'categories.class.php');
|
||||||
|
@ -126,6 +128,7 @@ include(PATH_HELPERS . 'cookie.class.php');
|
||||||
$pages = new Pages();
|
$pages = new Pages();
|
||||||
$users = new Users();
|
$users = new Users();
|
||||||
$tags = new Tags();
|
$tags = new Tags();
|
||||||
|
$authors = new Authors();
|
||||||
$categories = new Categories();
|
$categories = new Categories();
|
||||||
$site = new Site();
|
$site = new Site();
|
||||||
$url = new Url();
|
$url = new Url();
|
||||||
|
@ -191,6 +194,9 @@ define('TAG_URI_FILTER', $url->filters('tag'));
|
||||||
// Category URI filter
|
// Category URI filter
|
||||||
define('CATEGORY_URI_FILTER', $url->filters('category'));
|
define('CATEGORY_URI_FILTER', $url->filters('category'));
|
||||||
|
|
||||||
|
// Author URI filter
|
||||||
|
define('AUTHOR_URI_FILTER', $url->filters('author'));
|
||||||
|
|
||||||
// Page URI filter
|
// Page URI filter
|
||||||
define('PAGE_URI_FILTER', $url->filters('page'));
|
define('PAGE_URI_FILTER', $url->filters('page'));
|
||||||
|
|
||||||
|
@ -247,6 +253,7 @@ define('DOMAIN_ADMIN', DOMAIN_BASE . ADMIN_URI_FILTER . '/');
|
||||||
define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE . TAG_URI_FILTER, false, true));
|
define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE . TAG_URI_FILTER, false, true));
|
||||||
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER, false, true));
|
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER, false, true));
|
||||||
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
||||||
|
define('DOMAIN_AUTHORS', Text::addSlashes(DOMAIN_BASE . AUTHOR_URI_FILTER, false, true));
|
||||||
|
|
||||||
$ADMIN_CONTROLLER = '';
|
$ADMIN_CONTROLLER = '';
|
||||||
$ADMIN_VIEW = '';
|
$ADMIN_VIEW = '';
|
||||||
|
|
|
@ -71,6 +71,10 @@ elseif ($url->whereAmI()==='tag') {
|
||||||
elseif ($url->whereAmI()==='category') {
|
elseif ($url->whereAmI()==='category') {
|
||||||
$content = buildPagesByCategory();
|
$content = buildPagesByCategory();
|
||||||
}
|
}
|
||||||
|
// Build content by author
|
||||||
|
elseif ($url->whereAmI()==='author') {
|
||||||
|
$content = buildPagesByAuthor();
|
||||||
|
}
|
||||||
// Build content for the homepage
|
// Build content for the homepage
|
||||||
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
||||||
$content = buildPagesForHome();
|
$content = buildPagesForHome();
|
||||||
|
|
|
@ -92,16 +92,26 @@ function buildPagesByTag()
|
||||||
return buildPagesFor('tag', false, $tagKey);
|
return buildPagesFor('tag', false, $tagKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
||||||
|
function buildPagesByAuthor()
|
||||||
|
{
|
||||||
|
global $url;
|
||||||
|
|
||||||
|
$authorKey = $url->slug();
|
||||||
|
return buildPagesFor('author', false, false, $authorKey);
|
||||||
|
}
|
||||||
|
|
||||||
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
||||||
// Generate the global variables $content / $content, defined on 69.pages.php
|
// Generate the global variables $content / $content, defined on 69.pages.php
|
||||||
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
|
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
|
||||||
function buildPagesFor($for, $categoryKey = false, $tagKey = false)
|
function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey = false)
|
||||||
{
|
{
|
||||||
global $pages;
|
global $pages;
|
||||||
global $categories;
|
global $categories;
|
||||||
global $tags;
|
global $tags;
|
||||||
global $site;
|
global $site;
|
||||||
global $url;
|
global $url;
|
||||||
|
global $authors;
|
||||||
|
|
||||||
// Get the page number from URL
|
// Get the page number from URL
|
||||||
$pageNumber = $url->pageNumber();
|
$pageNumber = $url->pageNumber();
|
||||||
|
@ -122,6 +132,9 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false)
|
||||||
} elseif ($for == 'tag') {
|
} elseif ($for == 'tag') {
|
||||||
$numberOfItems = $site->itemsPerPage();
|
$numberOfItems = $site->itemsPerPage();
|
||||||
$list = $tags->getList($tagKey, $pageNumber, $numberOfItems);
|
$list = $tags->getList($tagKey, $pageNumber, $numberOfItems);
|
||||||
|
} elseif ($for == 'author') {
|
||||||
|
$numberOfItems = $site->itemsPerPage();
|
||||||
|
$list = $authors->getList($authorKey, $pageNumber, $numberOfItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are not items, invalid tag, invalid category, out of range, etc...
|
// There are not items, invalid tag, invalid category, out of range, etc...
|
||||||
|
|
|
@ -19,6 +19,7 @@ class Site extends dbJSON
|
||||||
'uriTag' => '/tag/',
|
'uriTag' => '/tag/',
|
||||||
'uriCategory' => '/category/',
|
'uriCategory' => '/category/',
|
||||||
'uriBlog' => '/blog/',
|
'uriBlog' => '/blog/',
|
||||||
|
'uriAuthor' => '/author/',
|
||||||
'url' => '',
|
'url' => '',
|
||||||
'emailFrom' => '',
|
'emailFrom' => '',
|
||||||
'dateFormat' => 'F j, Y',
|
'dateFormat' => 'F j, Y',
|
||||||
|
@ -99,6 +100,7 @@ class Site extends dbJSON
|
||||||
$filters['page'] = $this->getField('uriPage');
|
$filters['page'] = $this->getField('uriPage');
|
||||||
$filters['tag'] = $this->getField('uriTag');
|
$filters['tag'] = $this->getField('uriTag');
|
||||||
$filters['category'] = $this->getField('uriCategory');
|
$filters['category'] = $this->getField('uriCategory');
|
||||||
|
$filters['author'] = $this->getField('uriAuthor');
|
||||||
|
|
||||||
if ($this->getField('uriBlog')) {
|
if ($this->getField('uriBlog')) {
|
||||||
$filters['blog'] = $this->getField('uriBlog');
|
$filters['blog'] = $this->getField('uriBlog');
|
||||||
|
|
Loading…
Add table
Reference in a new issue