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

83 lines
1.9 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
2021-04-20 23:21:44 +02:00
// Page filtered by the user, will be 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
)
*/
2021-04-20 23:21:44 +02:00
$staticContent = 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
2021-03-19 20:48:04 +01:00
execPluginsByHook('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') {
2021-04-20 23:21:44 +02:00
$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') ) {
2021-04-20 23:21:44 +02:00
$content = buildPagesForHome();
}
// If set notFound, create the page 404
if ($url->notFound()) {
2021-04-20 23:21:44 +02:00
$page = buildErrorPage();
2017-05-09 00:24:15 +02:00
}