Remove url filter /blog/ #557

This commit is contained in:
Diego Najar 2018-03-06 19:42:18 +01:00
parent e7fe2f4cbf
commit 71528b2e5c
5 changed files with 33 additions and 19 deletions

View File

@ -102,7 +102,8 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
'label'=>$L->g('Blog'), 'label'=>$L->g('Blog'),
'value'=>$Site->uriFilters('blog'), 'value'=>$Site->uriFilters('blog'),
'class'=>'uk-width-1-2 uk-form-medium', 'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>DOMAIN_BLOG 'tip'=>DOMAIN.$Site->uriFilters('blog'),
'disabled'=>!$Site->uriFilters('blog')
)); ));
echo '<div class="uk-form-row"> echo '<div class="uk-form-row">
@ -113,3 +114,21 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
</div>'; </div>';
HTML::formClose(); HTML::formClose();
?>
<script>
$(document).ready(function() {
$("#jshomepage").change(function() {
if ($(this).val()==' ') {
$("#jsuriBlog").attr('value', '');
$("#jsuriBlog").attr('disabled', 'disabled');
} else {
$("#jsuriBlog").removeAttr('disabled');
$("#jsuriBlog").attr('value', '/blog/');
}
});
});
</script>

View File

@ -198,9 +198,6 @@ define('CATEGORY_URI_FILTER', $Url->filters('category'));
// Page URI filter // Page URI filter
define('PAGE_URI_FILTER', $Url->filters('page')); define('PAGE_URI_FILTER', $Url->filters('page'));
// Blog URI filter
define('BLOG_URI_FILTER', $Url->filters('blog'));
// Content order by: date / position // Content order by: date / position
define('ORDER_BY', $Site->orderBy()); define('ORDER_BY', $Site->orderBy());
@ -234,7 +231,6 @@ 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_BLOG', Text::addSlashes(DOMAIN_BASE.BLOG_URI_FILTER, false, true));
$ADMIN_CONTROLLER = ''; $ADMIN_CONTROLLER = '';
$ADMIN_VIEW = ''; $ADMIN_VIEW = '';

View File

@ -67,18 +67,9 @@ class dbSite extends dbJSON
public function uriFilters($filter='') public function uriFilters($filter='')
{ {
$filters['admin'] = '/'.ADMIN_URI_FILTER; $filters['admin'] = '/'.ADMIN_URI_FILTER;
if ($this->getField('uriPage')) {
$filters['page'] = $this->getField('uriPage'); $filters['page'] = $this->getField('uriPage');
}
if ($this->getField('uriTag')) {
$filters['tag'] = $this->getField('uriTag'); $filters['tag'] = $this->getField('uriTag');
}
if ($this->getField('uriCategory')) {
$filters['category'] = $this->getField('uriCategory'); $filters['category'] = $this->getField('uriCategory');
}
if ($this->getField('uriBlog')) { if ($this->getField('uriBlog')) {
$filters['blog'] = $this->getField('uriBlog'); $filters['blog'] = $this->getField('uriBlog');
@ -88,9 +79,13 @@ class dbSite extends dbJSON
return $filters; return $filters;
} }
if (isset($filters[$filter])) {
return $filters[$filter]; return $filters[$filter];
} }
return false;
}
// Returns the URL of the rss.xml file // Returns the URL of the rss.xml file
// You need to have enabled the plugin RSS // You need to have enabled the plugin RSS
public function rss() public function rss()

View File

@ -659,15 +659,19 @@ function editSettings($args) {
if (isset($args['uriPage'])) { if (isset($args['uriPage'])) {
$args['uriPage'] = Text::addSlashes($args['uriPage']); $args['uriPage'] = Text::addSlashes($args['uriPage']);
} }
if (isset($args['uriTag'])) { if (isset($args['uriTag'])) {
$args['uriTag'] = Text::addSlashes($args['uriTag']); $args['uriTag'] = Text::addSlashes($args['uriTag']);
} }
if (isset($args['uriCategory'])) { if (isset($args['uriCategory'])) {
$args['uriCategory'] = Text::addSlashes($args['uriCategory']); $args['uriCategory'] = Text::addSlashes($args['uriCategory']);
} }
if (isset($args['uriBlog'])) { if (isset($args['uriBlog'])) {
$args['uriBlog'] = Text::addSlashes($args['uriBlog']); $args['uriBlog'] = Text::addSlashes($args['uriBlog']);
} else {
$args['uriBlog'] = '';
} }
if ($Site->set($args)) { if ($Site->set($args)) {

View File

@ -12,7 +12,7 @@
<h1 class="title"><?php echo $page->title(); ?></h1> <h1 class="title"><?php echo $page->title(); ?></h1>
</a> </a>
<?php if (!$page->isStatic()): ?> <?php if (!$page->isStatic() && !$Url->notFound()): ?>
<!-- Creation date --> <!-- Creation date -->
<h6 class="card-subtitle mb-3 text-muted"><?php echo $page->date(); ?> - <?php echo $Language->get('Reading time') . ': ' . $page->readingTime() ?></h6> <h6 class="card-subtitle mb-3 text-muted"><?php echo $page->date(); ?> - <?php echo $Language->get('Reading time') . ': ' . $page->readingTime() ?></h6>
<?php endif ?> <?php endif ?>