Blog Filter URI added
This commit is contained in:
parent
38d964ba1b
commit
9323fe2f5a
@ -38,3 +38,4 @@ if($Url->whereAmI()==='admin') {
|
||||
else {
|
||||
require(PATH_BOOT.'site.php');
|
||||
}
|
||||
|
||||
|
@ -130,6 +130,7 @@ class HTML {
|
||||
|
||||
public static function bluditQuickImages()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$html = '<!-- BLUDIT QUICK IMAGES -->';
|
||||
$html .= '
|
||||
@ -153,7 +154,7 @@ if(empty($thumbnailList)) {
|
||||
}
|
||||
|
||||
$html .= '
|
||||
<a data-uk-modal href="#bludit-images-v8" class="moreImages uk-button">More images</a>
|
||||
<a data-uk-modal href="#bludit-images-v8" class="moreImages uk-button">'.$L->g('More images').'</a>
|
||||
|
||||
</div>
|
||||
';
|
||||
@ -327,7 +328,7 @@ if(empty($thumbnailList)) {
|
||||
|
||||
$html .= '
|
||||
<div class="uk-modal-footer">
|
||||
Double click on the image to add it or <a href="" class="uk-modal-close">click here to cancel</a>
|
||||
'.$L->g('Double click on the image to add it').' <a href="" class="uk-modal-close">'.$L->g('Click here to cancel').'</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -84,6 +84,14 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
|
||||
'tip'=>''
|
||||
));
|
||||
|
||||
HTML::formInputText(array(
|
||||
'name'=>'uriBlog',
|
||||
'label'=>$L->g('Blog'),
|
||||
'value'=>$Site->uriFilters('blog'),
|
||||
'class'=>'uk-width-1-2 uk-form-medium',
|
||||
'tip'=>''
|
||||
));
|
||||
|
||||
echo '<div class="uk-form-row">
|
||||
<div class="uk-form-controls">
|
||||
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
|
||||
|
@ -42,7 +42,7 @@ else
|
||||
// Boot rules
|
||||
include(PATH_RULES.'60.plugins.php');
|
||||
include(PATH_RULES.'70.posts.php');
|
||||
include(PATH_RULES.'70.pages.php');
|
||||
include(PATH_RULES.'71.pages.php');
|
||||
include(PATH_RULES.'99.header.php');
|
||||
include(PATH_RULES.'99.paginator.php');
|
||||
include(PATH_RULES.'99.themes.php');
|
||||
|
@ -4,6 +4,8 @@
|
||||
// Variables
|
||||
// ============================================================================
|
||||
|
||||
// Array with all posts specified by a filter.
|
||||
// Filter by page number, by tag, etc.
|
||||
$posts = array();
|
||||
|
||||
// ============================================================================
|
||||
@ -138,11 +140,13 @@ if( ($Url->whereAmI()==='post') && ($Url->notFound()===false) )
|
||||
{
|
||||
$Post = buildPost( $Url->slug() );
|
||||
|
||||
// The post doesn't exist.
|
||||
if($Post===false)
|
||||
{
|
||||
$Url->setNotFound(true);
|
||||
unset($Post);
|
||||
}
|
||||
// The post is not published yet.
|
||||
elseif( !$Post->published() )
|
||||
{
|
||||
$Url->setNotFound(true);
|
||||
@ -166,8 +170,8 @@ else
|
||||
if($Url->whereAmI()==='admin') {
|
||||
$posts = buildPostsForPage($Url->pageNumber(), POSTS_PER_PAGE_ADMIN, false);
|
||||
}
|
||||
// Posts for homepage
|
||||
else {
|
||||
// Posts for home and blog filter.
|
||||
elseif( ( ($Url->whereAmI()==='home') || ($Url->whereAmI()==='blog') ) && ($Url->notFound()===false) ) {
|
||||
$posts = buildPostsForPage($Url->pageNumber(), $Site->postsPerPage(), true);
|
||||
}
|
||||
}
|
||||
|
@ -145,16 +145,18 @@ if( $Site->cliMode() ) {
|
||||
$dbPages->regenerateCli();
|
||||
}
|
||||
|
||||
// Filter by page, then build it
|
||||
// Build specific page.
|
||||
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
|
||||
{
|
||||
$Page = buildPage( $Url->slug() );
|
||||
|
||||
// The page doesn't exist.
|
||||
if($Page===false)
|
||||
{
|
||||
$Url->setNotFound(true);
|
||||
unset($Page);
|
||||
}
|
||||
// The page is not published yet.
|
||||
elseif( !$Page->published() )
|
||||
{
|
||||
$Url->setNotFound(true);
|
||||
@ -162,10 +164,11 @@ if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
|
||||
}
|
||||
}
|
||||
|
||||
// Default homepage
|
||||
if($Url->notFound()===false)
|
||||
// Homepage
|
||||
if( ($Url->whereAmI()==='home') && ($Url->notFound()===false) )
|
||||
{
|
||||
if( Text::isNotEmpty($Site->homepage()) && ($Url->whereAmI()==='home') )
|
||||
// The user defined as homepage a particular page.
|
||||
if( Text::isNotEmpty( $Site->homepage() ) )
|
||||
{
|
||||
$Url->setWhereAmI('page');
|
||||
|
@ -8,7 +8,7 @@ Theme::plugins('beforeRulesLoad');
|
||||
|
||||
// Load rules
|
||||
include(PATH_RULES.'70.posts.php');
|
||||
include(PATH_RULES.'70.pages.php');
|
||||
include(PATH_RULES.'71.pages.php');
|
||||
include(PATH_RULES.'99.header.php');
|
||||
include(PATH_RULES.'99.paginator.php');
|
||||
include(PATH_RULES.'99.themes.php');
|
||||
|
@ -17,6 +17,7 @@ class dbSite extends dbJSON
|
||||
'uriPage'=> array('inFile'=>false, 'value'=>'/'),
|
||||
'uriPost'=> array('inFile'=>false, 'value'=>'/post/'),
|
||||
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
|
||||
'uriBlog'=> array('inFile'=>false, 'value'=>'/blog/'),
|
||||
'url'=> array('inFile'=>false, 'value'=>''),
|
||||
'cliMode'=> array('inFile'=>false, 'value'=>true),
|
||||
'emailFrom'=> array('inFile'=>false, 'value'=>''),
|
||||
@ -67,6 +68,7 @@ class dbSite extends dbJSON
|
||||
$filters['post'] = $this->getField('uriPost');
|
||||
$filters['page'] = $this->getField('uriPage');
|
||||
$filters['tag'] = $this->getField('uriTag');
|
||||
$filters['blog'] = $this->getField('uriBlog');
|
||||
|
||||
if(empty($filter)) {
|
||||
return $filters;
|
||||
@ -93,6 +95,12 @@ class dbSite extends dbJSON
|
||||
return $this->url().ltrim($filter, '/');
|
||||
}
|
||||
|
||||
public function urlBlog()
|
||||
{
|
||||
$filter = $this->getField('uriBlog');
|
||||
return $this->url().ltrim($filter, '/');
|
||||
}
|
||||
|
||||
// Returns the site title.
|
||||
public function title()
|
||||
{
|
||||
|
@ -67,6 +67,12 @@ class Url
|
||||
break;
|
||||
}
|
||||
|
||||
if($filterURI===$filters['blog'])
|
||||
{
|
||||
$this->whereAmI = 'blog';
|
||||
break;
|
||||
}
|
||||
|
||||
if($filterURI===$adminFilter['admin'])
|
||||
{
|
||||
$this->whereAmI = 'admin';
|
||||
|
@ -220,5 +220,9 @@
|
||||
"activate": "Activate",
|
||||
"deactivate": "Deactivate",
|
||||
|
||||
"cover-image": "Cover image"
|
||||
"cover-image": "Cover image",
|
||||
"blog": "Blog",
|
||||
"more-images": "More images",
|
||||
"double-click-on-the-image-to-add-it": "Double click on the image to add it.",
|
||||
"click-here-to-cancel": "Click here to cancel."
|
||||
}
|
@ -24,7 +24,7 @@
|
||||
|
||||
<!-- Content -->
|
||||
<?php
|
||||
if( ($Url->whereAmI()=='home') || ($Url->whereAmI()=='tag') )
|
||||
if( ($Url->whereAmI()=='home') || ($Url->whereAmI()=='tag') || ($Url->whereAmI()=='blog') )
|
||||
{
|
||||
include(PATH_THEME_PHP.'home.php');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user