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