bludit/bl-kernel/boot/rules/69.pages.php

87 lines
2.0 KiB
PHP
Raw Normal View History

2017-05-09 00:24:15 +02:00
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Variables
// ============================================================================
2017-07-11 23:53:53 +02:00
// Array with pages, each page is a Page Object
2018-08-06 21:46:58 +02:00
// Filtered by pagenumber, number of items per page and sorted by date/position
2017-07-13 00:44:39 +02:00
/*
array(
0 => Page Object,
1 => Page Object,
...
N => Page Object
)
*/
$content = array();
2017-05-09 00:24:15 +02:00
2017-07-11 23:53:53 +02:00
// Page filtered by the user, is a Page Object
$page = false;
2017-05-16 00:46:20 +02:00
// Array with static content, each item is a Page Object
// Order by position
/*
array(
0 => Page Object,
1 => Page Object,
...
N => Page Object
)
*/
2017-10-13 00:15:13 +02:00
$staticContent = $staticPages = buildStaticPages();
2017-10-04 23:42:14 +02:00
2017-05-09 00:24:15 +02:00
// ============================================================================
// Main
// ============================================================================
// Execute the scheduler
2018-08-03 18:59:23 +02:00
if ($pages->scheduler()) {
// Execute plugins with the hook afterPageCreate
Theme::plugins('afterPageCreate');
2017-05-09 00:24:15 +02:00
reindexTags();
reindexCategories();
2017-06-23 00:41:00 +02:00
// Add to syslog
$syslog->add(array(
2017-10-04 00:00:54 +02:00
'dictionaryKey'=>'content-published-from-scheduler',
2017-06-23 00:41:00 +02:00
'notes'=>''
));
2017-05-09 00:24:15 +02:00
}
// Set home page if the user defined one
if ($site->homepage() && $url->whereAmI()==='home') {
$pageKey = $site->homepage();
2018-08-03 18:59:23 +02:00
if ($pages->exists($pageKey)) {
$url->setSlug($pageKey);
$url->setWhereAmI('page');
2017-07-13 00:44:39 +02:00
}
2017-07-11 23:53:53 +02:00
}
2017-05-09 00:24:15 +02:00
// Build specific page
if ($url->whereAmI()==='page') {
$content[0] = $page = buildThePage();
2017-05-09 00:24:15 +02:00
}
2018-02-06 18:26:59 +01:00
// Build content by tag
elseif ($url->whereAmI()==='tag') {
$content = buildPagesByTag();
2017-05-09 00:24:15 +02:00
}
2018-02-06 18:26:59 +01:00
// Build content by category
elseif ($url->whereAmI()==='category') {
$content = buildPagesByCategory();
2017-05-09 00:24:15 +02:00
}
2018-02-06 18:26:59 +01:00
// Build content for the homepage
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
$content = buildPagesForHome();
2017-05-09 00:24:15 +02:00
}
if (isset($content[0])) {
$page = $content[0];
}
// If set notFound, create the page 404
if ($url->notFound()) {
$content[0] = $page = buildErrorPage();
2017-05-09 00:24:15 +02:00
}