Add repost link functionalities #53
17 changed files with 447 additions and 102 deletions
|
@ -74,10 +74,15 @@
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
<ul class="dropdown-menu dropdown-menu-end">
|
||||||
|
<?php foreach ($pagetypes->getDB() as $contentPageKey => $fields) {
|
||||||
|
$pageType = new PageType($contentPageKey);
|
||||||
|
?>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content/static' ?>">
|
<a class="dropdown-item" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content/'.$pageType->type(); ?>">
|
||||||
<?php $L->p('New') ?> (<?php $L->p(string: 'Static page') ?>)</a>
|
<?php $L->p('New') ?> (<?php echo $pageType->name(); ?>)</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php
|
||||||
|
} ?>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-category' ?>">
|
<a class="dropdown-item" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-category' ?>">
|
||||||
<?php $L->p('New category') ?></a>
|
<?php $L->p('New category') ?></a>
|
||||||
|
|
|
@ -1,5 +1,67 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
class ContentPage
|
||||||
|
{
|
||||||
|
private static function canShow($contentType, $args)
|
||||||
|
{
|
||||||
|
return $contentType->canShow($args['name']);
|
||||||
|
}
|
||||||
|
public static function formInputTextBlock($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formInputTextBlock($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formInputFile($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formInputFile($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formTextarea($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formTextarea($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formTextareaBlock($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formTextareaBlock($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formInputText($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formInputText($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formCheckbox($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formCheckbox($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formSelect($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formSelect($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formSelectBlock($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formSelectBlock($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
public static function formInputHidden($contentType, $args) {
|
||||||
|
if (ContentPage::canShow($contentType, $args)) {
|
||||||
|
return Bootstrap::formInputHidden($args);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Bootstrap
|
class Bootstrap
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
echo "<div class='d-flex justify-content-between align-content-center'>";
|
||||||
|
|
||||||
echo Bootstrap::pageTitle(array('title'=>$contentType->plural(), 'icon'=>$contentType->icon()));
|
echo Bootstrap::pageTitle(array('title'=>$contentType->plural(), 'icon'=>$contentType->icon()));
|
||||||
|
|
||||||
|
echo "<div>";
|
||||||
|
echo Bootstrap::link(array(
|
||||||
|
'title'=>$L->g('New'),
|
||||||
|
'href'=>HTML_PATH_ADMIN_ROOT.'new-content/'.$contentType->type(),
|
||||||
|
'icon'=>'plus',
|
||||||
|
'class'=>'btn btn-outline-success'
|
||||||
|
));
|
||||||
|
echo "</div></div>";
|
||||||
|
|
||||||
function table($type) {
|
function table($type) {
|
||||||
global $url;
|
global $url;
|
||||||
global $L;
|
global $L;
|
||||||
|
|
|
@ -78,7 +78,42 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Editor -->
|
<!-- Editor -->
|
||||||
<textarea id="jseditor" class="editable h-100" style=""><?php echo $page->contentRaw(true) ?></textarea>
|
<div class="<?php echo $contentType->mustHide("content")?"d-none":"" ?>">
|
||||||
|
<textarea id="jseditor" class="editable h-100" style=""><?php echo $page->contentRaw(true) ?></textarea>
|
||||||
|
</div>
|
||||||
|
<?php if ($contentType->mustHide("content")) {
|
||||||
|
// Description
|
||||||
|
echo ContentPage::formTextareaBlock($contentType, array(
|
||||||
|
'name' => 'description',
|
||||||
|
'label' => $L->g('Description'),
|
||||||
|
'selected' => '',
|
||||||
|
'class' => '',
|
||||||
|
'value' => $page->description(),
|
||||||
|
'rows' => 5,
|
||||||
|
'placeholder' => $L->get('this-field-can-help-describe-the-content')
|
||||||
|
));
|
||||||
|
|
||||||
|
// Post Kinds
|
||||||
|
echo ContentPage::formSelectBlock($contentType, array(
|
||||||
|
'name' => 'kind',
|
||||||
|
'label' => $L->g('Post Kinds'),
|
||||||
|
'selected' => $page->kind(),
|
||||||
|
'class' => '',
|
||||||
|
'emptyOption' => '- ' . $L->g('None') . ' -',
|
||||||
|
'options' => $contentType->kinds(),
|
||||||
|
'mt' => 'mt-0',
|
||||||
|
'type'=> 'Post kinds allow themes to use different formating and microformat for this kind of posts'
|
||||||
|
));
|
||||||
|
|
||||||
|
// Source Link
|
||||||
|
echo ContentPage::formInputTextBlock($contentType,array(
|
||||||
|
'name' => 'sourceLink',
|
||||||
|
'label' => $L->g('Source Link'),
|
||||||
|
'placeholder' => '',
|
||||||
|
'tip' => $L->g('The external link you refer to in the post'),
|
||||||
|
'value' => $page->sourceLink()
|
||||||
|
));
|
||||||
|
} ?>
|
||||||
|
|
||||||
<!-- Custom fields: BOTTOM -->
|
<!-- Custom fields: BOTTOM -->
|
||||||
<?php
|
<?php
|
||||||
|
@ -131,52 +166,74 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
<div class="tab-content pr-3 pl-3 pb-3 card-body">
|
<div class="tab-content pr-3 pl-3 pb-3 card-body">
|
||||||
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
|
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
|
||||||
<?php
|
<?php
|
||||||
if ($contentTypeKey == "article") {
|
// Category
|
||||||
// Category
|
echo ContentPage::formSelectBlock($contentType,array(
|
||||||
echo Bootstrap::formSelectBlock(array(
|
'name' => 'category',
|
||||||
'name' => 'category',
|
'label' => $L->g('Category'),
|
||||||
'label' => $L->g('Category'),
|
'selected' => $page->categoryKey(),
|
||||||
'selected' => $page->categoryKey(),
|
|
||||||
'class' => '',
|
|
||||||
'emptyOption' => '- ' . $L->g('Uncategorized') . ' -',
|
|
||||||
'options' => $categories->getKeyNameArray(),
|
|
||||||
'mt'=>'mt-0'
|
|
||||||
));
|
|
||||||
|
|
||||||
// Tags
|
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
|
||||||
'name' => 'tags',
|
|
||||||
'label' => $L->g('Tags'),
|
|
||||||
'placeholder' => '',
|
|
||||||
'tip' => $L->g('Write the tags separated by comma'),
|
|
||||||
'value' => $page->tags()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Description
|
|
||||||
echo Bootstrap::formTextareaBlock(array(
|
|
||||||
'name' => 'description',
|
|
||||||
'label' => $L->g('Description'),
|
|
||||||
'selected' => '',
|
|
||||||
'class' => '',
|
'class' => '',
|
||||||
'value' => $page->description(),
|
'emptyOption' => '- ' . $L->g('Uncategorized') . ' -',
|
||||||
'rows' => 5,
|
'options' => $categories->getKeyNameArray(),
|
||||||
'placeholder' => $L->get('this-field-can-help-describe-the-content')
|
'mt'=>'mt-0'
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($contentTypeKey == "article") {
|
// Tags
|
||||||
// Sticky
|
echo ContentPage::formInputTextBlock($contentType,array(
|
||||||
echo Bootstrap::formCheckbox(array(
|
'name' => 'tags',
|
||||||
'name' => 'sticky',
|
'label' => $L->g('Tags'),
|
||||||
'label' => $L->g('Sticky'),
|
'placeholder' => '',
|
||||||
'labelForCheckbox' => $L->g('Put this article in first position in the article list.'),
|
'tip' => $L->g('Write the tags separated by comma'),
|
||||||
|
'value' => $page->tags()
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($contentType->canShow("content")) {
|
||||||
|
// Post Kinds
|
||||||
|
echo ContentPage::formSelectBlock($contentType, array(
|
||||||
|
'name' => 'kind',
|
||||||
|
'label' => $L->g('Post Kinds'),
|
||||||
|
'selected' => $page->kind(),
|
||||||
|
'class' => '',
|
||||||
|
'emptyOption' => '- ' . $L->g('None') . ' -',
|
||||||
|
'options' => $contentType->kinds(),
|
||||||
|
'mt' => 'mt-0',
|
||||||
|
'type'=> 'Post kinds allow themes to use different formating and microformat for this kind of posts'
|
||||||
|
));
|
||||||
|
|
||||||
|
// Description
|
||||||
|
echo ContentPage::formTextareaBlock($contentType,array(
|
||||||
|
'name' => 'description',
|
||||||
|
'label' => $L->g('Description'),
|
||||||
|
'selected' => '',
|
||||||
|
'class' => '',
|
||||||
|
'value' => $page->description(),
|
||||||
|
'rows' => 5,
|
||||||
|
'placeholder' => $L->get('this-field-can-help-describe-the-content')
|
||||||
|
));
|
||||||
|
|
||||||
|
// Source Link
|
||||||
|
echo ContentPage::formInputTextBlock($contentType,array(
|
||||||
|
'name' => 'sourceLink',
|
||||||
|
'label' => $L->g('Source Link'),
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
'checked' => $page->sticky(),
|
'tip' => $L->g('The external link you refer to in the post'),
|
||||||
'tip' => ""
|
'value' => $page->sourceLink()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sticky
|
||||||
|
echo ContentPage::formCheckbox($contentType,array(
|
||||||
|
'name' => 'sticky',
|
||||||
|
'label' => $L->g('Sticky'),
|
||||||
|
'labelForCheckbox' => $L->g('Put this article in first position in the article list.'),
|
||||||
|
'placeholder' => '',
|
||||||
|
'checked' => $page->sticky(),
|
||||||
|
'tip' => ""
|
||||||
|
));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if ($contentType->canShow('cover')): ?>
|
||||||
|
|
||||||
<!-- Cover Image -->
|
<!-- Cover Image -->
|
||||||
<?php
|
<?php
|
||||||
$coverImage = $page->coverImage(false);
|
$coverImage = $page->coverImage(false);
|
||||||
|
@ -210,11 +267,12 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
|
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
|
||||||
<?php
|
<?php
|
||||||
// Date
|
// Date
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'date',
|
'name' => 'date',
|
||||||
'label' => $L->g('Date'),
|
'label' => $L->g('Date'),
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
|
@ -224,7 +282,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
));
|
));
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'position',
|
'name' => 'position',
|
||||||
'label' => $L->g('Position'),
|
'label' => $L->g('Position'),
|
||||||
'tip' => $L->g('Field used when ordering content by position'),
|
'tip' => $L->g('Field used when ordering content by position'),
|
||||||
|
@ -242,7 +300,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// continue
|
// continue
|
||||||
}
|
}
|
||||||
echo Bootstrap::formSelectBlock(array(
|
echo ContentPage::formSelectBlock($contentType,array(
|
||||||
'name' => 'parent',
|
'name' => 'parent',
|
||||||
'label' => $L->g('Parent'),
|
'label' => $L->g('Parent'),
|
||||||
'options' => $options,
|
'options' => $options,
|
||||||
|
@ -290,7 +348,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Template
|
// Template
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'template',
|
'name' => 'template',
|
||||||
'label' => $L->g('Template'),
|
'label' => $L->g('Template'),
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
|
@ -298,7 +356,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
||||||
));
|
));
|
||||||
|
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'externalCoverImage',
|
'name' => 'externalCoverImage',
|
||||||
'label' => $L->g('External cover image'),
|
'label' => $L->g('External cover image'),
|
||||||
'placeholder' => "https://",
|
'placeholder' => "https://",
|
||||||
|
@ -364,7 +422,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
|
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
|
||||||
<?php
|
<?php
|
||||||
// Friendly URL
|
// Friendly URL
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'slug',
|
'name' => 'slug',
|
||||||
'tip' => $L->g('URL associated with the content'),
|
'tip' => $L->g('URL associated with the content'),
|
||||||
'label' => $L->g('Friendly URL'),
|
'label' => $L->g('Friendly URL'),
|
||||||
|
@ -374,7 +432,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
));
|
));
|
||||||
|
|
||||||
// Robots
|
// Robots
|
||||||
echo Bootstrap::formCheckbox(array(
|
echo ContentPage::formCheckbox($contentType, array(
|
||||||
'name' => 'noindex',
|
'name' => 'noindex',
|
||||||
'label' => 'Robots',
|
'label' => 'Robots',
|
||||||
'labelForCheckbox' => $L->g('apply-code-noindex-code-to-this-page'),
|
'labelForCheckbox' => $L->g('apply-code-noindex-code-to-this-page'),
|
||||||
|
@ -384,7 +442,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
));
|
));
|
||||||
|
|
||||||
// Robots
|
// Robots
|
||||||
echo Bootstrap::formCheckbox(array(
|
echo ContentPage::formCheckbox($contentType, array(
|
||||||
'name' => 'nofollow',
|
'name' => 'nofollow',
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'labelForCheckbox' => $L->g('apply-code-nofollow-code-to-this-page'),
|
'labelForCheckbox' => $L->g('apply-code-nofollow-code-to-this-page'),
|
||||||
|
@ -394,7 +452,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
|
||||||
));
|
));
|
||||||
|
|
||||||
// Robots
|
// Robots
|
||||||
echo Bootstrap::formCheckbox(array(
|
echo ContentPage::formCheckbox($contentType, array(
|
||||||
'name' => 'noarchive',
|
'name' => 'noarchive',
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'labelForCheckbox' => $L->g('apply-code-noarchive-code-to-this-page'),
|
'labelForCheckbox' => $L->g('apply-code-noarchive-code-to-this-page'),
|
||||||
|
|
|
@ -71,7 +71,42 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Editor -->
|
<!-- Editor -->
|
||||||
<textarea id="jseditor" class="editable h-100 mb-1"></textarea>
|
<div class="<?php echo $contentType->mustHide("content")?"d-none":"" ?>">
|
||||||
|
<textarea id="jseditor" class="editable h-100 mb-1"></textarea>
|
||||||
|
</div>
|
||||||
|
<?php if ($contentType->mustHide("content")) {
|
||||||
|
// Description
|
||||||
|
echo ContentPage::formTextareaBlock($contentType, array(
|
||||||
|
'name' => 'description',
|
||||||
|
'label' => $L->g('Description'),
|
||||||
|
'selected' => '',
|
||||||
|
'class' => '',
|
||||||
|
'value' => '',
|
||||||
|
'rows' => 5,
|
||||||
|
'placeholder' => $L->get('this-field-can-help-describe-the-content')
|
||||||
|
));
|
||||||
|
|
||||||
|
// Post Kinds
|
||||||
|
echo ContentPage::formSelectBlock($contentType, array(
|
||||||
|
'name' => 'kind',
|
||||||
|
'label' => $L->g('Post Kinds'),
|
||||||
|
'selected' => $contentType->defaultKind(),
|
||||||
|
'class' => '',
|
||||||
|
'emptyOption' => '- ' . $L->g('None') . ' -',
|
||||||
|
'options' => $contentType->kinds(),
|
||||||
|
'mt' => 'mt-0',
|
||||||
|
'type'=> 'Post kinds allow themes to use different formating and microformat for this kind of posts'
|
||||||
|
));
|
||||||
|
|
||||||
|
// Source Link
|
||||||
|
echo ContentPage::formInputTextBlock($contentType,array(
|
||||||
|
'name' => 'sourceLink',
|
||||||
|
'label' => $L->g('Source Link'),
|
||||||
|
'placeholder' => '',
|
||||||
|
'tip' => $L->g('The external link you refer to in the post'),
|
||||||
|
'value' => ''
|
||||||
|
));
|
||||||
|
} ?>
|
||||||
|
|
||||||
<!-- Custom fields: BOTTOM -->
|
<!-- Custom fields: BOTTOM -->
|
||||||
<?php
|
<?php
|
||||||
|
@ -124,51 +159,71 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
<div class="tab-content pr-3 pl-3 pb-3">
|
<div class="tab-content pr-3 pl-3 pb-3">
|
||||||
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
|
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
|
||||||
<?php
|
<?php
|
||||||
if ($contentTypeKey == "article") {
|
// Category
|
||||||
// Category
|
echo ContentPage::formSelectBlock($contentType, array(
|
||||||
echo Bootstrap::formSelectBlock(array(
|
'name' => 'category',
|
||||||
'name' => 'category',
|
'label' => $L->g('Category'),
|
||||||
'label' => $L->g('Category'),
|
|
||||||
'selected' => '',
|
|
||||||
'class' => '',
|
|
||||||
'emptyOption' => '- ' . $L->g('Uncategorized') . ' -',
|
|
||||||
'options' => $categories->getKeyNameArray(),
|
|
||||||
'mt' => 'mt-0'
|
|
||||||
));
|
|
||||||
|
|
||||||
// Tags
|
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
|
||||||
'name' => 'tags',
|
|
||||||
'label' => $L->g('Tags'),
|
|
||||||
'placeholder' => '',
|
|
||||||
'tip' => $L->g('Write the tags separated by comma')
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Description
|
|
||||||
echo Bootstrap::formTextareaBlock(array(
|
|
||||||
'name' => 'description',
|
|
||||||
'label' => $L->g('Description'),
|
|
||||||
'selected' => '',
|
'selected' => '',
|
||||||
'class' => '',
|
'class' => '',
|
||||||
'value' => '',
|
'emptyOption' => '- ' . $L->g('Uncategorized') . ' -',
|
||||||
'rows' => 5,
|
'options' => $categories->getKeyNameArray(),
|
||||||
'placeholder' => $L->get('this-field-can-help-describe-the-content')
|
'mt' => 'mt-0'
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($contentTypeKey == "article") {
|
// Tags
|
||||||
// Sticky
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
echo Bootstrap::formCheckbox(array(
|
'name' => 'tags',
|
||||||
'name' => 'sticky',
|
'label' => $L->g('Tags'),
|
||||||
'label' => $L->g('Sticky'),
|
'placeholder' => '',
|
||||||
'labelForCheckbox' => $L->g('Put this article in first position in the article list.'),
|
'tip' => $L->g('Write the tags separated by comma')
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($contentType->canShow("content")) {
|
||||||
|
// Post Kinds
|
||||||
|
echo ContentPage::formSelectBlock($contentType, array(
|
||||||
|
'name' => 'kind',
|
||||||
|
'label' => $L->g('Post Kinds'),
|
||||||
|
'selected' => $contentType->defaultKind(),
|
||||||
|
'class' => '',
|
||||||
|
'emptyOption' => '- ' . $L->g('None') . ' -',
|
||||||
|
'options' => $contentType->kinds(),
|
||||||
|
'mt' => 'mt-0',
|
||||||
|
'type'=> 'Post kinds allow themes to use different formating and microformat for this kind of posts'
|
||||||
|
));
|
||||||
|
|
||||||
|
// Description
|
||||||
|
echo ContentPage::formTextareaBlock($contentType, array(
|
||||||
|
'name' => 'description',
|
||||||
|
'label' => $L->g('Description'),
|
||||||
|
'selected' => '',
|
||||||
|
'class' => '',
|
||||||
|
'value' => '',
|
||||||
|
'rows' => 5,
|
||||||
|
'placeholder' => $L->get('this-field-can-help-describe-the-content')
|
||||||
|
));
|
||||||
|
|
||||||
|
// Source Link
|
||||||
|
echo ContentPage::formInputTextBlock($contentType,array(
|
||||||
|
'name' => 'sourceLink',
|
||||||
|
'label' => $L->g('Source Link'),
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
'checked' => false,
|
'tip' => $L->g('The external link you refer to in the post'),
|
||||||
'tip' => ""
|
'value' => ''
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sticky
|
||||||
|
echo ContentPage::formCheckbox($contentType, array(
|
||||||
|
'name' => 'sticky',
|
||||||
|
'label' => $L->g('Sticky'),
|
||||||
|
'labelForCheckbox' => $L->g('Put this article in first position in the article list.'),
|
||||||
|
'placeholder' => '',
|
||||||
|
'checked' => false,
|
||||||
|
'tip' => ""
|
||||||
|
));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php if ($contentType->canShow('cover')): ?>
|
||||||
<!-- Cover Image -->
|
<!-- Cover Image -->
|
||||||
<label class="mt-2 mb-0 pb-1 text-uppercase w-100"><?php $L->p('Cover Image') ?></label>
|
<label class="mt-2 mb-0 pb-1 text-uppercase w-100"><?php $L->p('Cover Image') ?></label>
|
||||||
<div>
|
<div>
|
||||||
|
@ -194,11 +249,12 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
|
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
|
||||||
<?php
|
<?php
|
||||||
// Date
|
// Date
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'date',
|
'name' => 'date',
|
||||||
'label' => $L->g('Date'),
|
'label' => $L->g('Date'),
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
|
@ -208,7 +264,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
));
|
));
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'position',
|
'name' => 'position',
|
||||||
'label' => $L->g('Position'),
|
'label' => $L->g('Position'),
|
||||||
'tip' => $L->g('Field used when ordering content by position'),
|
'tip' => $L->g('Field used when ordering content by position'),
|
||||||
|
@ -216,7 +272,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
));
|
));
|
||||||
|
|
||||||
// Parent
|
// Parent
|
||||||
echo Bootstrap::formSelectBlock(array(
|
echo ContentPage::formSelectBlock($contentType, array(
|
||||||
'name' => 'parent',
|
'name' => 'parent',
|
||||||
'label' => $L->g('Parent'),
|
'label' => $L->g('Parent'),
|
||||||
'options' => array(),
|
'options' => array(),
|
||||||
|
@ -263,7 +319,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Template
|
// Template
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'template',
|
'name' => 'template',
|
||||||
'label' => $L->g('Template'),
|
'label' => $L->g('Template'),
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
|
@ -271,7 +327,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
||||||
));
|
));
|
||||||
|
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'externalCoverImage',
|
'name' => 'externalCoverImage',
|
||||||
'label' => $L->g('External cover image'),
|
'label' => $L->g('External cover image'),
|
||||||
'placeholder' => "https://",
|
'placeholder' => "https://",
|
||||||
|
@ -348,7 +404,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
|
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
|
||||||
<?php
|
<?php
|
||||||
// Friendly URL
|
// Friendly URL
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo ContentPage::formInputTextBlock($contentType, array(
|
||||||
'name' => 'slug',
|
'name' => 'slug',
|
||||||
'tip' => $L->g('URL associated with the content'),
|
'tip' => $L->g('URL associated with the content'),
|
||||||
'label' => $L->g('Friendly URL'),
|
'label' => $L->g('Friendly URL'),
|
||||||
|
@ -357,7 +413,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
));
|
));
|
||||||
|
|
||||||
// Robots
|
// Robots
|
||||||
echo Bootstrap::formCheckbox(array(
|
echo ContentPage::formCheckbox($contentType, array(
|
||||||
'name' => 'noindex',
|
'name' => 'noindex',
|
||||||
'label' => 'Robots',
|
'label' => 'Robots',
|
||||||
'labelForCheckbox' => $L->g('apply-code-noindex-code-to-this-page'),
|
'labelForCheckbox' => $L->g('apply-code-noindex-code-to-this-page'),
|
||||||
|
@ -367,7 +423,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
));
|
));
|
||||||
|
|
||||||
// Robots
|
// Robots
|
||||||
echo Bootstrap::formCheckbox(array(
|
echo ContentPage::formCheckbox($contentType, array(
|
||||||
'name' => 'nofollow',
|
'name' => 'nofollow',
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'labelForCheckbox' => $L->g('apply-code-nofollow-code-to-this-page'),
|
'labelForCheckbox' => $L->g('apply-code-nofollow-code-to-this-page'),
|
||||||
|
@ -377,7 +433,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
|
||||||
));
|
));
|
||||||
|
|
||||||
// Robots
|
// Robots
|
||||||
echo Bootstrap::formCheckbox(array(
|
echo ContentPage::formCheckbox($contentType, array(
|
||||||
'name' => 'noarchive',
|
'name' => 'noarchive',
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'labelForCheckbox' => $L->g('apply-code-noarchive-code-to-this-page'),
|
'labelForCheckbox' => $L->g('apply-code-noarchive-code-to-this-page'),
|
||||||
|
@ -462,6 +518,7 @@ foreach ($customFields as $field => $options) {
|
||||||
|
|
||||||
// Button Save
|
// Button Save
|
||||||
$("#jsbuttonSave").on("click", function() {
|
$("#jsbuttonSave").on("click", function() {
|
||||||
|
console.log("uwu")
|
||||||
let actionParameters = '';
|
let actionParameters = '';
|
||||||
|
|
||||||
var value = "published"
|
var value = "published"
|
||||||
|
|
|
@ -69,6 +69,7 @@ define('DB_CATEGORIES', PATH_DATABASES . 'categories.php');
|
||||||
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
||||||
define('DB_AUTHORS', PATH_DATABASES . 'authors.php');
|
define('DB_AUTHORS', PATH_DATABASES . 'authors.php');
|
||||||
define('DB_ARCHIVES', PATH_DATABASES . 'archives.php');
|
define('DB_ARCHIVES', PATH_DATABASES . 'archives.php');
|
||||||
|
define('DB_KINDS', PATH_DATABASES . 'kinds.php');
|
||||||
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
||||||
define('DB_USERS', PATH_DATABASES . 'users.php');
|
define('DB_USERS', PATH_DATABASES . 'users.php');
|
||||||
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
||||||
|
@ -94,6 +95,7 @@ include(PATH_KERNEL . 'users.class.php');
|
||||||
include(PATH_KERNEL . 'tags.class.php');
|
include(PATH_KERNEL . 'tags.class.php');
|
||||||
include(PATH_KERNEL . 'authors.class.php');
|
include(PATH_KERNEL . 'authors.class.php');
|
||||||
include(PATH_KERNEL . 'archives.class.php');
|
include(PATH_KERNEL . 'archives.class.php');
|
||||||
|
include(PATH_KERNEL . 'kinds.class.php');
|
||||||
include(PATH_KERNEL . 'language.class.php');
|
include(PATH_KERNEL . 'language.class.php');
|
||||||
include(PATH_KERNEL . 'site.class.php');
|
include(PATH_KERNEL . 'site.class.php');
|
||||||
include(PATH_KERNEL . 'categories.class.php');
|
include(PATH_KERNEL . 'categories.class.php');
|
||||||
|
@ -139,6 +141,7 @@ $users = new Users();
|
||||||
$tags = new Tags();
|
$tags = new Tags();
|
||||||
$authors = new Authors();
|
$authors = new Authors();
|
||||||
$archives = new Archives();
|
$archives = new Archives();
|
||||||
|
$kinds = new Kinds();
|
||||||
$categories = new Categories();
|
$categories = new Categories();
|
||||||
$site = new Site();
|
$site = new Site();
|
||||||
$url = new Url();
|
$url = new Url();
|
||||||
|
@ -210,6 +213,9 @@ define('AUTHOR_URI_FILTER', $url->filters('author'));
|
||||||
// Archive URI filter
|
// Archive URI filter
|
||||||
define('ARCHIVE_URI_FILTER', $url->filters('archive'));
|
define('ARCHIVE_URI_FILTER', $url->filters('archive'));
|
||||||
|
|
||||||
|
// Post kind URI filter
|
||||||
|
define('KIND_URI_FILTER', $url->filters('kind'));
|
||||||
|
|
||||||
// Page URI filter
|
// Page URI filter
|
||||||
define('PAGE_URI_FILTER', $url->filters('page'));
|
define('PAGE_URI_FILTER', $url->filters('page'));
|
||||||
|
|
||||||
|
@ -268,6 +274,7 @@ define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER,
|
||||||
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_AUTHORS', Text::addSlashes(DOMAIN_BASE . AUTHOR_URI_FILTER, false, true));
|
define('DOMAIN_AUTHORS', Text::addSlashes(DOMAIN_BASE . AUTHOR_URI_FILTER, false, true));
|
||||||
define('DOMAIN_ARCHIVES', Text::addSlashes(DOMAIN_BASE . ARCHIVE_URI_FILTER, false, true));
|
define('DOMAIN_ARCHIVES', Text::addSlashes(DOMAIN_BASE . ARCHIVE_URI_FILTER, false, true));
|
||||||
|
define('DOMAIN_KINDS', Text::addSlashes(DOMAIN_BASE . KIND_URI_FILTER, false, true));
|
||||||
|
|
||||||
$ADMIN_CONTROLLER = '';
|
$ADMIN_CONTROLLER = '';
|
||||||
$ADMIN_VIEW = '';
|
$ADMIN_VIEW = '';
|
||||||
|
|
|
@ -108,3 +108,19 @@ $GLOBALS['ALLOWED_IMG_EXTENSION'] = array('gif', 'png', 'jpg', 'jpeg', 'svg', 'w
|
||||||
|
|
||||||
// Allowed image mime types
|
// Allowed image mime types
|
||||||
$GLOBALS['ALLOWED_IMG_MIMETYPES'] = array('image/gif', 'image/png', 'image/jpeg', 'image/svg+xml', 'image/webp');
|
$GLOBALS['ALLOWED_IMG_MIMETYPES'] = array('image/gif', 'image/png', 'image/jpeg', 'image/svg+xml', 'image/webp');
|
||||||
|
|
||||||
|
// Supported post kinds
|
||||||
|
$GLOBALS['POST_KINDS'] = array('article', 'note', 'photo', 'reply', 'bookmark', 'like', 'review');
|
||||||
|
|
||||||
|
$GLOBALS['POST_KINDS_EMOJI'] = array(
|
||||||
|
"article"=>'📄',
|
||||||
|
'note'=>'📔',
|
||||||
|
'photo'=>'📷',
|
||||||
|
'video'=>'🎥',
|
||||||
|
'audio'=>'🎤',
|
||||||
|
'reply'=>'💬',
|
||||||
|
'bookmark'=>'🔖',
|
||||||
|
'like'=>'👍',
|
||||||
|
'review'=>'⭐️',
|
||||||
|
'chicken'=>'🐔'
|
||||||
|
);
|
|
@ -32,6 +32,14 @@ function reindexArchives()
|
||||||
return $archives->reindex();
|
return $archives->reindex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-index database of post kinds
|
||||||
|
// If you create/edit/remove a page is necessary regenerate the database of archives
|
||||||
|
function reindexKinds()
|
||||||
|
{
|
||||||
|
global $kinds;
|
||||||
|
return $kinds->reindex();
|
||||||
|
}
|
||||||
|
|
||||||
// Generate the page 404 Not found
|
// Generate the page 404 Not found
|
||||||
function buildErrorPage()
|
function buildErrorPage()
|
||||||
{
|
{
|
||||||
|
@ -384,6 +392,7 @@ function createPage($args)
|
||||||
reindexTags();
|
reindexTags();
|
||||||
reindexAuthors();
|
reindexAuthors();
|
||||||
reindexArchives();
|
reindexArchives();
|
||||||
|
reindexKinds();
|
||||||
|
|
||||||
// Add to syslog
|
// Add to syslog
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
|
@ -437,6 +446,7 @@ function editPage($args)
|
||||||
reindexTags();
|
reindexTags();
|
||||||
reindexAuthors();
|
reindexAuthors();
|
||||||
reindexArchives();
|
reindexArchives();
|
||||||
|
reindexKinds();
|
||||||
|
|
||||||
// Add to syslog
|
// Add to syslog
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
|
@ -464,6 +474,7 @@ function deletePage($key)
|
||||||
reindexTags();
|
reindexTags();
|
||||||
reindexAuthors();
|
reindexAuthors();
|
||||||
reindexArchives();
|
reindexArchives();
|
||||||
|
reindexKinds();
|
||||||
|
|
||||||
// Add to syslog
|
// Add to syslog
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
|
|
|
@ -11,6 +11,10 @@ class KoblogUpdater {
|
||||||
global $L;
|
global $L;
|
||||||
|
|
||||||
foreach ($pages->db as $key => $fields) {
|
foreach ($pages->db as $key => $fields) {
|
||||||
|
if ($fields['kind'] === '') {
|
||||||
|
$pages->db[$key]['kind'] = 'article';
|
||||||
|
}
|
||||||
|
|
||||||
if ($fields['type'] === "published") {
|
if ($fields['type'] === "published") {
|
||||||
$pages->db[$key]['type'] = "article";
|
$pages->db[$key]['type'] = "article";
|
||||||
$pages->db[$key]['state'] = "published";
|
$pages->db[$key]['state'] = "published";
|
||||||
|
@ -43,11 +47,16 @@ class KoblogUpdater {
|
||||||
//
|
//
|
||||||
if (!file_exists(PATH_DATABASES . 'pagetypes.php')) {
|
if (!file_exists(PATH_DATABASES . 'pagetypes.php')) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'article' => array('name' => $L->g("Article"), 'plural' => $L->g("Articles"), 'icon'=>'file-text'),
|
'article' => array('name' => $L->g("Article"), 'plural' => $L->g("Articles"), 'icon'=>'file-text', 'hideFields'=>'', 'kinds'=>'article reply note photo video audio repost review', 'defaultKind'=>'article'),
|
||||||
'static' => array('name' => $L->g("Static page"), 'plural' => $L->g("Static pages"), 'icon'=>'file'),
|
'static' => array('name' => $L->g("Static page"), 'plural' => $L->g("Static pages"), 'icon'=>'file', 'hideFields'=>'category tags sticky sourceLink kind', 'kinds'=>'', 'defaultKind'=>''),
|
||||||
|
'share' => array('name' => $L->g("Share"), 'plural' => $L->g("Shares"), 'icon'=>'retweet', 'hideFields'=>'content category cover position parent template externalCoverImage custom noindex nofollow noarchive', 'kinds'=>'like bookmark', 'defaultKind'=>'bookmark'),
|
||||||
);
|
);
|
||||||
file_put_contents(PATH_DATABASES . 'pagetypes.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
file_put_contents(PATH_DATABASES . 'pagetypes.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||||
}
|
}
|
||||||
|
if (!file_exists(PATH_DATABASES . 'kinds.php')) {
|
||||||
|
global $kinds;
|
||||||
|
$kinds->reindex();
|
||||||
|
}
|
||||||
|
|
||||||
return $pages->save();
|
return $pages->save();
|
||||||
}
|
}
|
||||||
|
|
45
bl-kernel/kinds.class.php
Normal file
45
bl-kernel/kinds.class.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php defined('KOBLOG') or die('Koblog CMS.');
|
||||||
|
|
||||||
|
class Kinds extends dbList {
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(DB_KINDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
function numberOfPages($key)
|
||||||
|
{
|
||||||
|
return $this->countItems($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reindex()
|
||||||
|
{
|
||||||
|
global $pages;
|
||||||
|
global $L;
|
||||||
|
|
||||||
|
$kindArray = array();
|
||||||
|
|
||||||
|
foreach ($GLOBALS['POST_KINDS'] as $kind) {
|
||||||
|
$kindArray[$kind]['name'] = $GLOBALS['POST_KINDS_EMOJI'][$kind]." ".$L->g($kind);
|
||||||
|
$kindArray[$kind]['list'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$db = $pages->getDB($onlyKeys=false);
|
||||||
|
foreach ($db as $pageKey=>$pageFields) {
|
||||||
|
if ($pageFields['state'] == "published" && isset($pageFields['kinds']) && $pageFields !== '') {
|
||||||
|
$kind = $pageFields['kind'];
|
||||||
|
|
||||||
|
// Index by years
|
||||||
|
if (isset($kindArray[$kind])) {
|
||||||
|
array_push($kindArray[$kind]['list'], $pageKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db = $kindArray;
|
||||||
|
return $this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ class Pages extends dbJSON
|
||||||
'tags' => array(),
|
'tags' => array(),
|
||||||
'type' => 'article', // article, static
|
'type' => 'article', // article, static
|
||||||
'state' => 'published', // draft, scheduled, autosave
|
'state' => 'published', // draft, scheduled, autosave
|
||||||
|
'kind'=>'',
|
||||||
'sticky' => false,
|
'sticky' => false,
|
||||||
'date' => '',
|
'date' => '',
|
||||||
'dateModified' => '',
|
'dateModified' => '',
|
||||||
|
@ -24,6 +25,7 @@ class Pages extends dbJSON
|
||||||
'noindex' => false,
|
'noindex' => false,
|
||||||
'nofollow' => false,
|
'nofollow' => false,
|
||||||
'noarchive' => false,
|
'noarchive' => false,
|
||||||
|
'sourceLink'=>'',
|
||||||
'custom' => array()
|
'custom' => array()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -57,5 +57,47 @@ class PageType
|
||||||
{
|
{
|
||||||
return $this->getValue("plural");
|
return $this->getValue("plural");
|
||||||
}
|
}
|
||||||
|
public function canShow($field)
|
||||||
|
{
|
||||||
|
$hideFields = $this->getValue("hideFields");
|
||||||
|
if ($hideFields === '' || !isset($hideFields))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !str_contains($hideFields, $field);
|
||||||
|
}
|
||||||
|
public function mustHide($field)
|
||||||
|
{
|
||||||
|
return !$this->canShow($field);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function haveKind($var)
|
||||||
|
{
|
||||||
|
$kinds = $this->getValue("kinds");
|
||||||
|
if ($kinds === '' || !isset($kinds))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !str_contains($kinds, $var);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function kinds()
|
||||||
|
{
|
||||||
|
global $kinds;
|
||||||
|
return array_filter($kinds->getKeyNameArray(), function ($var)
|
||||||
|
{
|
||||||
|
$kinds = $this->getValue("kinds");
|
||||||
|
if ($kinds === '' || !isset($kinds))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return str_contains($kinds, $var);
|
||||||
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function defaultKind()
|
||||||
|
{
|
||||||
|
return $this->getValue('defaultKind');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,7 +5,10 @@ class PageTypes extends dbJSON {
|
||||||
protected $dbFields = array(
|
protected $dbFields = array(
|
||||||
'name'=>'',
|
'name'=>'',
|
||||||
'plural'=>'',
|
'plural'=>'',
|
||||||
'icon'=>'fa-file'
|
'icon'=>'fa-file',
|
||||||
|
'hideField'=>'',
|
||||||
|
'kinds'=>'article',
|
||||||
|
'defaultKind'=>'article'
|
||||||
);
|
);
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
|
|
|
@ -447,6 +447,17 @@ class Page
|
||||||
return $this->getValue('noarchive');
|
return $this->getValue('noarchive');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// retour the source link
|
||||||
|
public function sourceLink()
|
||||||
|
{
|
||||||
|
return $this->getValue('sourceLink');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function kind()
|
||||||
|
{
|
||||||
|
return $this->getValue('kind');
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the page slug
|
// Returns the page slug
|
||||||
public function slug()
|
public function slug()
|
||||||
{
|
{
|
||||||
|
|
|
@ -265,6 +265,8 @@
|
||||||
"post": "Article",
|
"post": "Article",
|
||||||
"article": "Article",
|
"article": "Article",
|
||||||
"articles": "Articles",
|
"articles": "Articles",
|
||||||
|
"share": "Partage",
|
||||||
|
"shares": "Partages",
|
||||||
"static-page": "Page statique",
|
"static-page": "Page statique",
|
||||||
"static-pages": "Pages statiques",
|
"static-pages": "Pages statiques",
|
||||||
"default": "Défaut",
|
"default": "Défaut",
|
||||||
|
@ -411,5 +413,7 @@
|
||||||
"insert-thumbnail": "Insérer une miniature",
|
"insert-thumbnail": "Insérer une miniature",
|
||||||
"insert-linked-thumbnail": "Insérer une miniature liée",
|
"insert-linked-thumbnail": "Insérer une miniature liée",
|
||||||
"more-infos": "Infos supplémentaires",
|
"more-infos": "Infos supplémentaires",
|
||||||
"base-infos": "Infos de bases"
|
"base-infos": "Infos de bases",
|
||||||
|
"source-link": "Lien source",
|
||||||
|
"the-external-link-you-refer-to-in-the-post":"Le lien externe auquel vous vous referrez dans le contenu"
|
||||||
}
|
}
|
|
@ -156,6 +156,7 @@ EOF;
|
||||||
reindexTags();
|
reindexTags();
|
||||||
reindexAuthors();
|
reindexAuthors();
|
||||||
reindexArchives();
|
reindexArchives();
|
||||||
|
reindexKinds();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -469,8 +469,9 @@ function install($adminPassword, $timezone)
|
||||||
file_put_contents(PATH_DATABASES . 'categories.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
file_put_contents(PATH_DATABASES . 'categories.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'article' => array('name' => $L->g("Article"), 'plural' => $L->g("Articles"), 'icon'=>'fa-file-text'),
|
'article' => array('name' => $L->g("Article"), 'plural' => $L->g("Articles"), 'icon'=>'file-text', 'hideFields'=>'', 'kinds'=>'article reply note photo video audio repost review', 'defaultKind'=>'article'),
|
||||||
'static' => array('name' => $L->g("Static page"), 'plural' => $L->g("Static pages"), 'icon'=>'fa-file'),
|
'static' => array('name' => $L->g("Static page"), 'plural' => $L->g("Static pages"), 'icon'=>'file', 'hideFields'=>'category tags sticky sourceLink kind', 'kinds'=>'', 'defaultKind'=>''),
|
||||||
|
'share' => array('name' => $L->g("Share"), 'plural' => $L->g("Shares"), 'icon'=>'retweet', 'hideFields'=>'content category cover position parent template externalCoverImage custom noindex nofollow noarchive', 'kinds'=>'like bookmark', 'defaultKind'=>'bookmark'),
|
||||||
);
|
);
|
||||||
file_put_contents(PATH_DATABASES . 'pagetypes.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
file_put_contents(PATH_DATABASES . 'pagetypes.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue