release 2022.11.20
This commit is contained in:
parent
947b0cf339
commit
beb6a186d1
@ -1,5 +1,6 @@
|
|||||||
2022.04.27.1 - dev
|
2022.11.20
|
||||||
- [ ] fix wrong timezone on admin vs public expired date
|
- fix compatibility with Dotclear 2.24 (required)
|
||||||
|
- fix wrong timezone on admin vs public expired date
|
||||||
|
|
||||||
2022.04.27
|
2022.04.27
|
||||||
- require Dotclear 2.21.3
|
- require Dotclear 2.21.3
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
[![Release](https://img.shields.io/github/v/release/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/releases)
|
[![Release](https://img.shields.io/github/v/release/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/releases)
|
||||||
[![Date](https://img.shields.io/github/release-date/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/releases)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/releases)
|
||||||
[![Issues](https://img.shields.io/github/issues/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/issues)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/issues)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.20-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/postExpired)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/postExpired)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/blob/master/LICENSE)
|
||||||
|
|
||||||
|
|
||||||
## WHAT IS POSTEXPIRED ?
|
## WHAT IS POSTEXPIRED ?
|
||||||
|
|
||||||
Post expired is a plugin for the open-source
|
Post expired is a plugin for the open-source
|
||||||
@ -21,7 +20,7 @@ to change some options of a post at a given time.
|
|||||||
postExpired requires:
|
postExpired requires:
|
||||||
|
|
||||||
* contentadmin permissions
|
* contentadmin permissions
|
||||||
* Dotclear 2.21.3
|
* Dotclear 2.24
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
@ -43,8 +42,8 @@ Notes:
|
|||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
||||||
* Source & contribution : [GitHub Page](https://github.com/JcDenis/postExpired)
|
* Source & contribution : [GitHub Page](https://github.com/JcDenis/postExpired)
|
||||||
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postExpired)
|
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postExpired)
|
||||||
* Discuss & help: [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=42305)
|
* Discuss & help : [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=42305)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
|
209
_admin.php
209
_admin.php
@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief postExpired, a plugin for Dotclear 2
|
* @brief postExpired, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and Contributors
|
* @author Jean-Christian Denis and Contributors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -22,8 +21,8 @@ if (dcCore::app()->getVersion('postExpired') != dcCore::app()->plugins->moduleIn
|
|||||||
|
|
||||||
# Check user right
|
# Check user right
|
||||||
if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||||
]), dcCore::app()->blog->id)
|
]), dcCore::app()->blog->id)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -87,33 +86,33 @@ class adminBehaviorPostExpired
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Add actions to posts page combo
|
* Add actions to posts page combo
|
||||||
*
|
*
|
||||||
* @param dcPostsActionsPage $ap dcPostsActionsPage instance
|
* @param dcPostsActionsPage $ap dcPostsActionsPage instance
|
||||||
*/
|
*/
|
||||||
public static function adminPostsActions(dcPostsActions $pa)
|
public static function adminPostsActions(dcPostsActions $pa)
|
||||||
{
|
{
|
||||||
$pa->addAction(
|
$pa->addAction(
|
||||||
array(
|
[
|
||||||
__('Expired entries') => array(
|
__('Expired entries') => [
|
||||||
__('Add expired date') => 'post_expired_add'
|
__('Add expired date') => 'post_expired_add',
|
||||||
)
|
],
|
||||||
),
|
],
|
||||||
array('adminBehaviorPostExpired', 'callbackAdd')
|
['adminBehaviorPostExpired', 'callbackAdd']
|
||||||
);
|
);
|
||||||
|
|
||||||
$pa->addAction(
|
$pa->addAction(
|
||||||
array(
|
[
|
||||||
__('Expired entries') => array(
|
__('Expired entries') => [
|
||||||
__('Remove expired date') => 'post_expired_remove'
|
__('Remove expired date') => 'post_expired_remove',
|
||||||
)
|
],
|
||||||
),
|
],
|
||||||
array('adminBehaviorPostExpired', 'callbackRemove')
|
['adminBehaviorPostExpired', 'callbackRemove']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add javascript for date field and toggle
|
* Add javascript for date field and toggle
|
||||||
*
|
*
|
||||||
* @return string HTML head
|
* @return string HTML head
|
||||||
*/
|
*/
|
||||||
public static function adminPostHeaders()
|
public static function adminPostHeaders()
|
||||||
@ -123,7 +122,7 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add form to post sidebar
|
* Add form to post sidebar
|
||||||
*
|
*
|
||||||
* @param ArrayObject $main_items Main items
|
* @param ArrayObject $main_items Main items
|
||||||
* @param ArrayObject $sidebar_items Sidebar items
|
* @param ArrayObject $sidebar_items Sidebar items
|
||||||
* @param record $post Post record or null
|
* @param record $post Post record or null
|
||||||
@ -134,18 +133,18 @@ class adminBehaviorPostExpired
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sidebar_items['post_expired'] = array(
|
$sidebar_items['post_expired'] = [
|
||||||
'title' => __('Expired date'),
|
'title' => __('Expired date'),
|
||||||
'items' => self::fieldsPostExpired(
|
'items' => self::fieldsPostExpired(
|
||||||
$post->post_type,
|
$post->post_type,
|
||||||
$post->post_id
|
$post->post_id
|
||||||
)
|
),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete expired date on post edition
|
* Delete expired date on post edition
|
||||||
*
|
*
|
||||||
* @param integer $post_id Post id
|
* @param integer $post_id Post id
|
||||||
*/
|
*/
|
||||||
public static function adminBeforePostDelete($post_id)
|
public static function adminBeforePostDelete($post_id)
|
||||||
@ -155,7 +154,7 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add expired date on post edition
|
* Add expired date on post edition
|
||||||
*
|
*
|
||||||
* @param cursor $cur Current post cursor
|
* @param cursor $cur Current post cursor
|
||||||
* @param integer $post_id Post id
|
* @param integer $post_id Post id
|
||||||
*/
|
*/
|
||||||
@ -175,7 +174,7 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Posts actions callback to add expired date
|
* Posts actions callback to add expired date
|
||||||
*
|
*
|
||||||
* @param dcPostsActions $pa dcPostsActions instance
|
* @param dcPostsActions $pa dcPostsActions instance
|
||||||
* @param ArrayObject $post _POST actions
|
* @param ArrayObject $post _POST actions
|
||||||
*/
|
*/
|
||||||
@ -194,7 +193,7 @@ class adminBehaviorPostExpired
|
|||||||
|| !empty($post['post_expired_selected'])
|
|| !empty($post['post_expired_selected'])
|
||||||
|| !empty($post['post_expired_comment'])
|
|| !empty($post['post_expired_comment'])
|
||||||
|| !empty($post['post_expired_trackback']))) {
|
|| !empty($post['post_expired_trackback']))) {
|
||||||
foreach($posts_ids as $post_id) {
|
foreach ($posts_ids as $post_id) {
|
||||||
self::delPostExpired($post_id);
|
self::delPostExpired($post_id);
|
||||||
self::setPostExpired($post_id, $post);
|
self::setPostExpired($post_id, $post);
|
||||||
}
|
}
|
||||||
@ -208,11 +207,11 @@ class adminBehaviorPostExpired
|
|||||||
$posts = $pa->getRS();
|
$posts = $pa->getRS();
|
||||||
|
|
||||||
$pa->beginPage(
|
$pa->beginPage(
|
||||||
dcPage::breadcrumb(array(
|
dcPage::breadcrumb([
|
||||||
html::escapeHTML(dcCore::app()->blog->name) => '',
|
html::escapeHTML(dcCore::app()->blog->name) => '',
|
||||||
$pa->getCallerTitle() => $pa->getRedirection(true),
|
$pa->getCallerTitle() => $pa->getRedirection(true),
|
||||||
__('Add expired date to this selection') => ''
|
__('Add expired date to this selection') => '',
|
||||||
)),
|
]),
|
||||||
//dcPage::jsDatePicker() .
|
//dcPage::jsDatePicker() .
|
||||||
self::adminPostHeaders()
|
self::adminPostHeaders()
|
||||||
);
|
);
|
||||||
@ -225,7 +224,7 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
dcCore::app()->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
$pa->getHiddenFields() .
|
$pa->getHiddenFields() .
|
||||||
form::hidden(array('action'), 'post_expired_add') .
|
form::hidden(['action'], 'post_expired_add') .
|
||||||
'<input type="submit" value="' . __('Save') . '" /></p>' .
|
'<input type="submit" value="' . __('Save') . '" /></p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
|
|
||||||
@ -235,7 +234,7 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Posts actions callback to add expired date
|
* Posts actions callback to add expired date
|
||||||
*
|
*
|
||||||
* @param dcPostsActions $pa dcPostsActions instance
|
* @param dcPostsActions $pa dcPostsActions instance
|
||||||
* @param ArrayObject $post _POST actions
|
* @param ArrayObject $post _POST actions
|
||||||
*/
|
*/
|
||||||
@ -248,7 +247,7 @@ class adminBehaviorPostExpired
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Delete expired date
|
# Delete expired date
|
||||||
foreach($posts_ids as $post_id) {
|
foreach ($posts_ids as $post_id) {
|
||||||
self::delPostExpired($post_id);
|
self::delPostExpired($post_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +257,7 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete expired date
|
* Delete expired date
|
||||||
*
|
*
|
||||||
* @param integer $post_id Post id
|
* @param integer $post_id Post id
|
||||||
*/
|
*/
|
||||||
protected static function delPostExpired($post_id)
|
protected static function delPostExpired($post_id)
|
||||||
@ -268,43 +267,38 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save expired date
|
* Save expired date
|
||||||
*
|
*
|
||||||
* @param integer $post_id Post id
|
* @param integer $post_id Post id
|
||||||
* @param array $post _POST fields
|
* @param array $post _POST fields
|
||||||
*/
|
*/
|
||||||
protected static function setPostExpired($post_id, $post)
|
protected static function setPostExpired($post_id, $post)
|
||||||
{
|
{
|
||||||
$post_expired = array(
|
$post_expired = [
|
||||||
'status'=> '',
|
'status' => '',
|
||||||
'category'=> '',
|
'category' => '',
|
||||||
'selected'=> '',
|
'selected' => '',
|
||||||
'comment'=> '',
|
'comment' => '',
|
||||||
'trackback' => '',
|
'trackback' => '',
|
||||||
'date'=> date(
|
'date' => date(
|
||||||
'Y-m-d H:i:00',
|
'Y-m-d H:i:00',
|
||||||
strtotime($post['post_expired_date'])
|
strtotime($post['post_expired_date'])
|
||||||
)
|
),
|
||||||
);
|
];
|
||||||
|
|
||||||
if (!empty($post['post_expired_status'])) {
|
if (!empty($post['post_expired_status'])) {
|
||||||
$post_expired['status'] =
|
$post_expired['status'] = (string) $post['post_expired_status'];
|
||||||
(string) $post['post_expired_status'];
|
|
||||||
}
|
}
|
||||||
if (!empty($post['post_expired_category'])) {
|
if (!empty($post['post_expired_category'])) {
|
||||||
$post_expired['category'] =
|
$post_expired['category'] = (string) $post['post_expired_category'];
|
||||||
(string) $post['post_expired_category'];
|
|
||||||
}
|
}
|
||||||
if (!empty($post['post_expired_selected'])) {
|
if (!empty($post['post_expired_selected'])) {
|
||||||
$post_expired['selected'] =
|
$post_expired['selected'] = (string) $post['post_expired_selected'];
|
||||||
(string) $post['post_expired_selected'];
|
|
||||||
}
|
}
|
||||||
if (!empty($post['post_expired_comment'])) {
|
if (!empty($post['post_expired_comment'])) {
|
||||||
$post_expired['comment'] =
|
$post_expired['comment'] = (string) $post['post_expired_comment'];
|
||||||
(string) $post['post_expired_comment'];
|
|
||||||
}
|
}
|
||||||
if (!empty($post['post_expired_trackback'])) {
|
if (!empty($post['post_expired_trackback'])) {
|
||||||
$post_expired['trackback'] =
|
$post_expired['trackback'] = (string) $post['post_expired_trackback'];
|
||||||
(string) $post['post_expired_trackback'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->meta->setPostMeta(
|
dcCore::app()->meta->setPostMeta(
|
||||||
@ -316,20 +310,19 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Expired date form fields
|
* Expired date form fields
|
||||||
*
|
*
|
||||||
* @param string $post_type Posts type
|
* @param string $post_type Posts type
|
||||||
* @return array Array of HTML form fields
|
* @return array Array of HTML form fields
|
||||||
*/
|
*/
|
||||||
protected static function fieldsPostExpired($post_type, $post_id = null)
|
protected static function fieldsPostExpired($post_type, $post_id = null)
|
||||||
{
|
{
|
||||||
$fields = $post_expired = array();
|
$fields = $post_expired = [];
|
||||||
|
|
||||||
if ($post_id) {
|
if ($post_id) {
|
||||||
|
|
||||||
$rs = dcCore::app()->meta->getMetadata([
|
$rs = dcCore::app()->meta->getMetadata([
|
||||||
'meta_type' => 'post_expired',
|
'meta_type' => 'post_expired',
|
||||||
'post_id' => $post_id,
|
'post_id' => $post_id,
|
||||||
'limit' => 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!$rs->isEmpty()) {
|
if (!$rs->isEmpty()) {
|
||||||
@ -337,8 +330,7 @@ class adminBehaviorPostExpired
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields['post_expired_date'] =
|
$fields['post_expired_date'] = '<p><label for="post_expired_date">' .
|
||||||
'<p><label for="post_expired_date">' .
|
|
||||||
__('Date:') . '</label>' .
|
__('Date:') . '</label>' .
|
||||||
form::datetime('post_expired_date', [
|
form::datetime('post_expired_date', [
|
||||||
'default' => html::escapeHTML(dt::str('%Y-%m-%dT%H:%M', strtotime($post_expired['date'] ?? 0))),
|
'default' => html::escapeHTML(dt::str('%Y-%m-%dT%H:%M', strtotime($post_expired['date'] ?? 0))),
|
||||||
@ -346,61 +338,55 @@ class adminBehaviorPostExpired
|
|||||||
])
|
])
|
||||||
. '</p>';
|
. '</p>';
|
||||||
|
|
||||||
$fields['post_expired_status'] =
|
$fields['post_expired_status'] = '<h5>' . __('On this date, change:') . '</h5>' .
|
||||||
'<h5>' . __('On this date, change:') . '</h5>' .
|
|
||||||
'<p><label for="post_expired_status">' .
|
'<p><label for="post_expired_status">' .
|
||||||
__('Status:') . '</label>' .
|
__('Status:') . '</label>' .
|
||||||
form::combo(
|
form::combo(
|
||||||
'post_expired_status',
|
'post_expired_status',
|
||||||
self::statusCombo(),
|
self::statusCombo(),
|
||||||
empty($post_expired['status']) ?
|
empty($post_expired['status']) ?
|
||||||
'' : $post_expired['status']
|
'' : $post_expired['status']
|
||||||
) . '</p>';
|
) . '</p>';
|
||||||
|
|
||||||
if ($post_type == 'post') {
|
if ($post_type == 'post') {
|
||||||
|
$fields['post_expired_category'] = '<p><label for="post_expired_category">' .
|
||||||
$fields['post_expired_category'] =
|
|
||||||
'<p><label for="post_expired_category">' .
|
|
||||||
__('Category:') . '</label>' .
|
__('Category:') . '</label>' .
|
||||||
form::combo(
|
form::combo(
|
||||||
'post_expired_category',
|
'post_expired_category',
|
||||||
self::categoriesCombo(
|
self::categoriesCombo(
|
||||||
dcCore::app()->blog->getCategories(
|
dcCore::app()->blog->getCategories(
|
||||||
array('post_type' => 'post')
|
['post_type' => 'post']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
empty($post_expired['category']) ?
|
empty($post_expired['category']) ?
|
||||||
'' : $post_expired['category']
|
'' : $post_expired['category']
|
||||||
) . '</p>';
|
) . '</p>';
|
||||||
|
|
||||||
$fields['post_expired_selected'] =
|
$fields['post_expired_selected'] = '<p><label for="post_expired_selected">' .
|
||||||
'<p><label for="post_expired_selected">' .
|
|
||||||
__('Selection:') . '</label>' .
|
__('Selection:') . '</label>' .
|
||||||
form::combo(
|
form::combo(
|
||||||
'post_expired_selected',
|
'post_expired_selected',
|
||||||
self::selectedCombo(),
|
self::selectedCombo(),
|
||||||
empty($post_expired['selected']) ?
|
empty($post_expired['selected']) ?
|
||||||
'' : $post_expired['selected']
|
'' : $post_expired['selected']
|
||||||
) . '</p>';
|
) . '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields['post_expired_comment'] =
|
$fields['post_expired_comment'] = '<p><label for="post_expired_comment">' .
|
||||||
'<p><label for="post_expired_comment">' .
|
|
||||||
__('Comments status:') . '</label>' .
|
__('Comments status:') . '</label>' .
|
||||||
form::combo(
|
form::combo(
|
||||||
'post_expired_comment',
|
'post_expired_comment',
|
||||||
self::commentCombo(),
|
self::commentCombo(),
|
||||||
empty($post_expired['comment']) ?
|
empty($post_expired['comment']) ?
|
||||||
'' : $post_expired['comment']
|
'' : $post_expired['comment']
|
||||||
) . '</p>';
|
) . '</p>';
|
||||||
|
|
||||||
$fields['post_expired_trackback'] =
|
$fields['post_expired_trackback'] = '<p><label for="post_expired_trackback">' .
|
||||||
'<p><label for="post_expired_trackback">' .
|
|
||||||
__('Trackbacks status:') . '</label>' .
|
__('Trackbacks status:') . '</label>' .
|
||||||
form::combo(
|
form::combo(
|
||||||
'post_expired_trackback',
|
'post_expired_trackback',
|
||||||
self::trackbackCombo(),
|
self::trackbackCombo(),
|
||||||
empty($post_expired['trackback']) ?
|
empty($post_expired['trackback']) ?
|
||||||
'' : $post_expired['trackback']
|
'' : $post_expired['trackback']
|
||||||
) . '</p>';
|
) . '</p>';
|
||||||
|
|
||||||
@ -409,29 +395,30 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom categories combo
|
* Custom categories combo
|
||||||
*
|
*
|
||||||
* @param dcRecord $categories Categories recordset
|
* @param dcRecord $categories Categories recordset
|
||||||
* @return array Categorires combo
|
* @return array Categorires combo
|
||||||
*/
|
*/
|
||||||
protected static function categoriesCombo(dcRecord $categories)
|
protected static function categoriesCombo(dcRecord $categories)
|
||||||
{
|
{
|
||||||
# Getting categories
|
# Getting categories
|
||||||
$categories_combo = array(
|
$categories_combo = [
|
||||||
__('Not changed') => '',
|
__('Not changed') => '',
|
||||||
__('Uncategorized') => '!'
|
__('Uncategorized') => '!',
|
||||||
);
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$categories = dcCore::app()->blog->getCategories(
|
$categories = dcCore::app()->blog->getCategories(
|
||||||
array('post_type' => 'post')
|
['post_type' => 'post']
|
||||||
);
|
);
|
||||||
while ($categories->fetch()) {
|
while ($categories->fetch()) {
|
||||||
$categories_combo[] = new formSelectOption(
|
$categories_combo[] = new formSelectOption(
|
||||||
str_repeat(' ', $categories->level - 1) . '• '. html::escapeHTML($categories->cat_title),
|
str_repeat(' ', $categories->level - 1) . '• ' . html::escapeHTML($categories->cat_title),
|
||||||
'!'.$categories->cat_id
|
'!' . $categories->cat_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $categories_combo;
|
return $categories_combo;
|
||||||
@ -439,58 +426,58 @@ class adminBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom status combo
|
* Custom status combo
|
||||||
*
|
*
|
||||||
* @return array Status combo
|
* @return array Status combo
|
||||||
*/
|
*/
|
||||||
protected static function statusCombo()
|
protected static function statusCombo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
__('Not changed') => '',
|
__('Not changed') => '',
|
||||||
__('Published') => '!1',
|
__('Published') => '!1',
|
||||||
__('Pending') => '!-2',
|
__('Pending') => '!-2',
|
||||||
__('Unpublished') => '!0'
|
__('Unpublished') => '!0',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom selection combo
|
* Custom selection combo
|
||||||
*
|
*
|
||||||
* @return array Selection combo
|
* @return array Selection combo
|
||||||
*/
|
*/
|
||||||
protected static function selectedCombo()
|
protected static function selectedCombo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
__('Not changed') => '',
|
__('Not changed') => '',
|
||||||
__('Selected') => '!1',
|
__('Selected') => '!1',
|
||||||
__('Not selected') => '!0'
|
__('Not selected') => '!0',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom comment status combo
|
* Custom comment status combo
|
||||||
*
|
*
|
||||||
* @return array Comment status combo
|
* @return array Comment status combo
|
||||||
*/
|
*/
|
||||||
protected static function commentCombo()
|
protected static function commentCombo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
__('Not changed') => '',
|
__('Not changed') => '',
|
||||||
__('Opened') => '!1',
|
__('Opened') => '!1',
|
||||||
__('Closed') => '!0'
|
__('Closed') => '!0',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom trackback status combo
|
* Custom trackback status combo
|
||||||
*
|
*
|
||||||
* @return array Trackback status combo
|
* @return array Trackback status combo
|
||||||
*/
|
*/
|
||||||
protected static function trackbackCombo()
|
protected static function trackbackCombo()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
__('Not changed') => '',
|
__('Not changed') => '',
|
||||||
__('Opened') => '!1',
|
__('Opened') => '!1',
|
||||||
__('Closed') => '!0'
|
__('Closed') => '!0',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
_define.php
23
_define.php
@ -1,34 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief postExpired, a plugin for Dotclear 2
|
* @brief postExpired, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and Contributors
|
* @author Jean-Christian Denis and Contributors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Expired entries',
|
'Expired entries',
|
||||||
'Change entries options at a given date',
|
'Change entries options at a given date',
|
||||||
'Jean-Christian Denis and Contributors',
|
'Jean-Christian Denis and Contributors',
|
||||||
'2022.11.12',
|
'2022.11.12',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.24']],
|
'requires' => [['core', '2.24']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
dcAuth::PERMISSION_USAGE,
|
dcAuth::PERMISSION_USAGE,
|
||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||||
]),
|
]),
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://github.com/JcDenis/postExpired',
|
'support' => 'https://github.com/JcDenis/postExpired',
|
||||||
'details' => 'https://plugins.dotaddict.org/dc2/details/postExpired',
|
'details' => 'https://plugins.dotaddict.org/dc2/details/postExpired',
|
||||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/postExpired/master/dcstore.xml'
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/postExpired/master/dcstore.xml',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
15
_install.php
15
_install.php
@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief postExpired, a plugin for Dotclear 2
|
* @brief postExpired, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and Contributors
|
* @author Jean-Christian Denis and Contributors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -31,10 +30,12 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check Dotclear version
|
# Check Dotclear version
|
||||||
if (!method_exists('dcUtils', 'versionsCompare')
|
if (!method_exists('dcUtils', 'versionsCompare')
|
||||||
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
||||||
throw new Exception(sprintf(
|
throw new Exception(sprintf(
|
||||||
'%s requires Dotclear %s', $mod_id, $dc_min
|
'%s requires Dotclear %s',
|
||||||
|
$mod_id,
|
||||||
|
$dc_min
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,4 +50,4 @@ try {
|
|||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
23
_prepend.php
23
_prepend.php
@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief postExpired, a plugin for Dotclear 2
|
* @brief postExpired, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and Contributors
|
* @author Jean-Christian Denis and Contributors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -20,14 +19,14 @@ if (!defined('DC_RC_PATH')) {
|
|||||||
*
|
*
|
||||||
* This is saved into post_meta as meta_id value,
|
* This is saved into post_meta as meta_id value,
|
||||||
* so this must be less than 255 caracters.
|
* so this must be less than 255 caracters.
|
||||||
*
|
*
|
||||||
* @param array $in Array of options
|
* @param array $in Array of options
|
||||||
* @return string "Serialized" options
|
* @return string "Serialized" options
|
||||||
*/
|
*/
|
||||||
function encodePostExpired($in)
|
function encodePostExpired($in)
|
||||||
{
|
{
|
||||||
$out = array();
|
$out = [];
|
||||||
foreach($in as $k => $v) {
|
foreach ($in as $k => $v) {
|
||||||
$out[] = $k . '|' . $v;
|
$out[] = $k . '|' . $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,17 +35,17 @@ function encodePostExpired($in)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode Expired Date settings
|
* Decode Expired Date settings
|
||||||
*
|
*
|
||||||
* @param string $in "Serialized" options
|
* @param string $in "Serialized" options
|
||||||
* @return array Array of options
|
* @return array Array of options
|
||||||
*/
|
*/
|
||||||
function decodePostExpired($in)
|
function decodePostExpired($in)
|
||||||
{
|
{
|
||||||
$out = array();
|
$out = [];
|
||||||
foreach(explode(';', $in) as $v) {
|
foreach (explode(';', $in) as $v) {
|
||||||
$v = explode('|', $v);
|
$v = explode('|', $v);
|
||||||
$out[$v[0]] = $v[1];
|
$out[$v[0]] = $v[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
94
_public.php
94
_public.php
@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief postExpired, a plugin for Dotclear 2
|
* @brief postExpired, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and Contributors
|
* @author Jean-Christian Denis and Contributors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -23,7 +22,7 @@ __('Expired on');
|
|||||||
__('This entry has no expiration date');
|
__('This entry has no expiration date');
|
||||||
|
|
||||||
# launch update only on public home page and feed
|
# launch update only on public home page and feed
|
||||||
if (in_array(dcCore::app()->url->type, array('default', 'feed'))) {
|
if (in_array(dcCore::app()->url->type, ['default', 'feed'])) {
|
||||||
dcCore::app()->addBehavior(
|
dcCore::app()->addBehavior(
|
||||||
'publicBeforeDocumentV2',
|
'publicBeforeDocumentV2',
|
||||||
['publicBehaviorPostExpired', 'publicBeforeDocument']
|
['publicBehaviorPostExpired', 'publicBeforeDocument']
|
||||||
@ -55,7 +54,6 @@ class publicBehaviorPostExpired
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Check if there are expired dates
|
* Check if there are expired dates
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static function publicBeforeDocument()
|
public static function publicBeforeDocument()
|
||||||
{
|
{
|
||||||
@ -67,7 +65,7 @@ class publicBehaviorPostExpired
|
|||||||
'ON META.post_id = P.post_id ' .
|
'ON META.post_id = P.post_id ' .
|
||||||
"WHERE blog_id = '" . dcCore::app()->con->escape(dcCore::app()->blog->id) . "' " .
|
"WHERE blog_id = '" . dcCore::app()->con->escape(dcCore::app()->blog->id) . "' " .
|
||||||
// Removed for quick compatibility with some plugins
|
// Removed for quick compatibility with some plugins
|
||||||
//"AND P.post_type = 'post' " .
|
//"AND P.post_type = 'post' " .
|
||||||
"AND META.meta_type = 'post_expired' "
|
"AND META.meta_type = 'post_expired' "
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -84,18 +82,17 @@ class publicBehaviorPostExpired
|
|||||||
|
|
||||||
# Loop through marked posts
|
# Loop through marked posts
|
||||||
$updated = false;
|
$updated = false;
|
||||||
while($posts->fetch()) {
|
while ($posts->fetch()) {
|
||||||
|
|
||||||
# Decode meta record
|
# Decode meta record
|
||||||
$post_expired = decodePostExpired($posts->meta_id);
|
$post_expired = decodePostExpired($posts->meta_id);
|
||||||
|
|
||||||
# Check if post is outdated
|
# Check if post is outdated
|
||||||
$now_tz = $now + dt::getTimeOffset($posts->post_tz, $now);
|
$now_tz = $now + dt::getTimeOffset($posts->post_tz, $now);
|
||||||
$meta_tz = strtotime($post_expired['date']);
|
$meta_tz = strtotime($post_expired['date']);
|
||||||
if ($now_tz > $meta_tz) {
|
if ($now_tz > $meta_tz) {
|
||||||
# Delete meta for expired date
|
# Delete meta for expired date
|
||||||
dcCore::app()->auth->sudo(
|
dcCore::app()->auth->sudo(
|
||||||
array(dcCore::app()->meta, 'delPostMeta'),
|
[dcCore::app()->meta, 'delPostMeta'],
|
||||||
$posts->post_id,
|
$posts->post_id,
|
||||||
'post_expired'
|
'post_expired'
|
||||||
);
|
);
|
||||||
@ -105,36 +102,40 @@ class publicBehaviorPostExpired
|
|||||||
$post_cur->post_upddt = date('Y-m-d H:i:s', $now_tz);
|
$post_cur->post_upddt = date('Y-m-d H:i:s', $now_tz);
|
||||||
|
|
||||||
# Loop through actions
|
# Loop through actions
|
||||||
foreach($post_expired as $k => $v) {
|
foreach ($post_expired as $k => $v) {
|
||||||
if (empty($v)) {
|
if (empty($v)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
# values are prefixed by "!"
|
# values are prefixed by "!"
|
||||||
$v = (integer) substr($v, 1);
|
$v = (int) substr($v, 1);
|
||||||
|
|
||||||
# Put value in post cursor
|
# Put value in post cursor
|
||||||
switch($k)
|
switch($k) {
|
||||||
{
|
|
||||||
case 'status':
|
case 'status':
|
||||||
$post_cur->post_status = $v;
|
$post_cur->post_status = $v;
|
||||||
break;
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'category':
|
case 'category':
|
||||||
$post_cur->cat_id = $v ? $v : null;
|
$post_cur->cat_id = $v ? $v : null;
|
||||||
break;
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'selected':
|
case 'selected':
|
||||||
$post_cur->post_selected = $v;
|
$post_cur->post_selected = $v;
|
||||||
break;
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'comment':
|
case 'comment':
|
||||||
$post_cur->post_open_comment = $v;
|
$post_cur->post_open_comment = $v;
|
||||||
break;
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'trackback':
|
case 'trackback':
|
||||||
$post_cur->post_open_tb = $v;
|
$post_cur->post_open_tb = $v;
|
||||||
break;
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ class publicBehaviorPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends posts record with expired date
|
* Extends posts record with expired date
|
||||||
*
|
*
|
||||||
* @param dcRecord $rs Post recordset
|
* @param dcRecord $rs Post recordset
|
||||||
*/
|
*/
|
||||||
public static function coreBlogGetPosts(dcRecord $rs)
|
public static function coreBlogGetPosts(dcRecord $rs)
|
||||||
@ -174,7 +175,7 @@ class rsExtPostExpiredPublic extends rsExtPost
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Retrieve expired date of a post
|
* Retrieve expired date of a post
|
||||||
*
|
*
|
||||||
* @param record $rs Post recordset
|
* @param record $rs Post recordset
|
||||||
* @return string Expired date or null
|
* @return string Expired date or null
|
||||||
*/
|
*/
|
||||||
@ -183,15 +184,15 @@ class rsExtPostExpiredPublic extends rsExtPost
|
|||||||
if (!$rs->postexpired[$rs->post_id]) { //memory
|
if (!$rs->postexpired[$rs->post_id]) { //memory
|
||||||
$rs_date = $rs->core->meta->getMetadata([
|
$rs_date = $rs->core->meta->getMetadata([
|
||||||
'meta_type' => 'post_expired',
|
'meta_type' => 'post_expired',
|
||||||
'post_id'=> $rs->post_id,
|
'post_id' => $rs->post_id,
|
||||||
'limit'=> 1
|
'limit' => 1,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($rs_date->isEmpty()) {
|
if ($rs_date->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$v = decodePostExpired($rs_date->meta_id);
|
$v = decodePostExpired($rs_date->meta_id);
|
||||||
$rs->postexpired[$rs->post_id] = $v['date'];
|
$rs->postexpired[$rs->post_id] = $v['date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,48 +209,48 @@ class tplPostExpired
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Template condition to check if there is an expired date
|
* Template condition to check if there is an expired date
|
||||||
*
|
*
|
||||||
* @param array $attr Block attributes
|
* @param array $attr Block attributes
|
||||||
* @param string $content Block content
|
* @param string $content Block content
|
||||||
*/
|
*/
|
||||||
public static function EntryExpiredIf($attr, $content)
|
public static function EntryExpiredIf($attr, $content)
|
||||||
{
|
{
|
||||||
$if = array();
|
$if = [];
|
||||||
$operator = isset($attr['operator']) ?
|
$operator = isset($attr['operator']) ?
|
||||||
self::getOperator($attr['operator']) : '&&';
|
self::getOperator($attr['operator']) : '&&';
|
||||||
|
|
||||||
if (isset($attr['has_date'])) {
|
if (isset($attr['has_date'])) {
|
||||||
$sign = (boolean) $attr['has_date'] ? '!' : '=';
|
$sign = (bool) $attr['has_date'] ? '!' : '=';
|
||||||
$if[] = '(null ' . $sign . '== dcCore::app()->ctx->posts->postExpiredDate())';
|
$if[] = '(null ' . $sign . '== dcCore::app()->ctx->posts->postExpiredDate())';
|
||||||
} else {
|
} else {
|
||||||
$if[] = '(null !== dcCore::app()->ctx->posts->postExpiredDate())';
|
$if[] = '(null !== dcCore::app()->ctx->posts->postExpiredDate())';
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
"<?php if(" . implode(' ' . $operator . ' ', $if) . ") : ?>\n" .
|
'<?php if(' . implode(' ' . $operator . ' ', $if) . ") : ?>\n" .
|
||||||
$content .
|
$content .
|
||||||
"<?php endif; ?>\n";
|
"<?php endif; ?>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template for expired date
|
* Template for expired date
|
||||||
*
|
*
|
||||||
* @param array $attr Value attributes
|
* @param array $attr Value attributes
|
||||||
*/
|
*/
|
||||||
public static function EntryExpiredDate($attr)
|
public static function EntryExpiredDate($attr)
|
||||||
{
|
{
|
||||||
$format = !empty($attr['format']) ?
|
$format = !empty($attr['format']) ?
|
||||||
addslashes($attr['format']) : '';
|
addslashes($attr['format']) : '';
|
||||||
$f = dcCore::app()->tpl->getFilters($attr);
|
$f = dcCore::app()->tpl->getFilters($attr);
|
||||||
|
|
||||||
if (!empty($attr['rfc822'])) {
|
if (!empty($attr['rfc822'])) {
|
||||||
$res = sprintf($f, "dt::rfc822(strtotime(dcCore::app()->ctx->posts->postExpiredDate()),dcCore::app()->ctx->posts->post_tz)");
|
$res = sprintf($f, 'dt::rfc822(strtotime(dcCore::app()->ctx->posts->postExpiredDate()),dcCore::app()->ctx->posts->post_tz)');
|
||||||
} elseif (!empty($attr['iso8601'])) {
|
} elseif (!empty($attr['iso8601'])) {
|
||||||
$res = sprintf($f, "dt::iso8601(strtotime(dcCore::app()->ctx->posts->postExpiredDate(),dcCore::app()->ctx->posts->post_tz)");
|
$res = sprintf($f, 'dt::iso8601(strtotime(dcCore::app()->ctx->posts->postExpiredDate(),dcCore::app()->ctx->posts->post_tz)');
|
||||||
} elseif ($format) {
|
} elseif ($format) {
|
||||||
$res = sprintf($f, "dt::dt2str('" . $format . "',dcCore::app()->ctx->posts->postExpiredDate())");
|
$res = sprintf($f, "dt::dt2str('" . $format . "',dcCore::app()->ctx->posts->postExpiredDate())");
|
||||||
} else {
|
} else {
|
||||||
$res = sprintf($f, "dt::dt2str(dcCore::app()->blog->settings->system->date_format,dcCore::app()->ctx->posts->postExpiredDate())");
|
$res = sprintf($f, 'dt::dt2str(dcCore::app()->blog->settings->system->date_format,dcCore::app()->ctx->posts->postExpiredDate())');
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<?php if (null !== dcCore::app()->ctx->posts->postExpiredDate()) { echo ' . $res . '; } ?>';
|
return '<?php if (null !== dcCore::app()->ctx->posts->postExpiredDate()) { echo ' . $res . '; } ?>';
|
||||||
@ -257,29 +258,30 @@ class tplPostExpired
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Template for expired time
|
* Template for expired time
|
||||||
*
|
*
|
||||||
* @param array $attr Value attributes
|
* @param array $attr Value attributes
|
||||||
*/
|
*/
|
||||||
public static function EntryExpiredTime($attr)
|
public static function EntryExpiredTime($attr)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
'<?php if (null !== dcCore::app()->ctx->posts->postExpiredDate()) { echo ' . sprintf(
|
'<?php if (null !== dcCore::app()->ctx->posts->postExpiredDate()) { echo ' . sprintf(
|
||||||
dcCore::app()->tpl->getFilters($attr), "dt::dt2str(" .
|
dcCore::app()->tpl->getFilters($attr),
|
||||||
(!empty($attr['format']) ?
|
'dt::dt2str(' .
|
||||||
"'" . addslashes($attr['format']) . "'" : "dcCore::app()->blog->settings->system->time_format"
|
(
|
||||||
) . ",dcCore::app()->ctx->posts->postExpiredDate())"
|
!empty($attr['format']) ?
|
||||||
|
"'" . addslashes($attr['format']) . "'" : 'dcCore::app()->blog->settings->system->time_format'
|
||||||
|
) . ',dcCore::app()->ctx->posts->postExpiredDate())'
|
||||||
) . '; } ?>';
|
) . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse tempalte attributes oprerator
|
* Parse tempalte attributes oprerator
|
||||||
*
|
*
|
||||||
* @param string $op Operator
|
* @param string $op Operator
|
||||||
*/
|
*/
|
||||||
protected static function getOperator($op)
|
protected static function getOperator($op)
|
||||||
{
|
{
|
||||||
switch (strtolower($op))
|
switch (strtolower($op)) {
|
||||||
{
|
|
||||||
case 'or':
|
case 'or':
|
||||||
case '||':
|
case '||':
|
||||||
return '||';
|
return '||';
|
||||||
@ -289,4 +291,4 @@ class tplPostExpired
|
|||||||
return '&&';
|
return '&&';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
dcstore.xml
23
dcstore.xml
@ -1,12 +1,13 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="postExpired">
|
<module id="postExpired">
|
||||||
<name>Billets périmés</name>
|
<name>Expired entries</name>
|
||||||
<version>2022.04.27</version>
|
<version>2022.11.12</version>
|
||||||
<author>Jean-Christian Denis and Contributors</author>
|
<author>Jean-Christian Denis and Contributors</author>
|
||||||
<desc>Change entries options at a given date</desc>
|
<desc>Change entries options at a given date</desc>
|
||||||
<file>https://github.com/JcDenis/postExpired/releases/download/v2022.04.27/plugin-postExpired.zip</file>
|
<file>https://github.com/JcDenis/postExpired/releases/download/v2022.11.12/plugin-postExpired.zip</file>
|
||||||
<da:dcmin>2.121</da:dcmin>
|
<da:dcmin>2.24</da:dcmin>
|
||||||
<da:details>https://plugins.dotaddict.org/dc2/details/postExpired</da:details>
|
<da:details>https://plugins.dotaddict.org/dc2/details/postExpired</da:details>
|
||||||
<da:support>https://github.com/JcDenis/postExpired</da:support>
|
<da:support>https://github.com/JcDenis/postExpired</da:support>
|
||||||
</module>
|
</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
// Language: Français
|
|
||||||
// Module: postExpired - 2013.11.03
|
|
||||||
// Date: 2013-11-03 22:12:31
|
|
||||||
// Translated with dcTranslater - 2013.05.11
|
|
||||||
|
|
||||||
#_admin.php:100
|
|
||||||
#_admin.php:110
|
|
||||||
$GLOBALS['__l10n']['Expired entries'] = 'Billets périmés';
|
|
||||||
|
|
||||||
#_admin.php:101
|
|
||||||
$GLOBALS['__l10n']['Add expired date'] = 'Ajouter une date de péremption';
|
|
||||||
|
|
||||||
#_admin.php:111
|
|
||||||
$GLOBALS['__l10n']['Remove expired date'] = 'Retirer une date de péremption';
|
|
||||||
|
|
||||||
#_admin.php:139
|
|
||||||
$GLOBALS['__l10n']['Expired date'] = 'Date de péremption';
|
|
||||||
|
|
||||||
#_admin.php:209
|
|
||||||
$GLOBALS['__l10n']['Expired date added.'] = 'Date de péremption ajoutée.';
|
|
||||||
|
|
||||||
#_admin.php:222
|
|
||||||
$GLOBALS['__l10n']['Add expired date to this selection'] = 'Ajouter une date de péremtion à cette sélection';
|
|
||||||
|
|
||||||
#_admin.php:269
|
|
||||||
$GLOBALS['__l10n']['Expired date deleted.'] = 'Dtae de péremtion supprimé';
|
|
||||||
|
|
||||||
#_admin.php:370
|
|
||||||
$GLOBALS['__l10n']['On this date, change:'] = 'Á cette date, changer :';
|
|
||||||
|
|
||||||
#_admin.php:398
|
|
||||||
$GLOBALS['__l10n']['Selection:'] = 'Séléction :';
|
|
||||||
|
|
||||||
#_admin.php:409
|
|
||||||
$GLOBALS['__l10n']['Comments status:'] = 'Status des commentaires :';
|
|
||||||
|
|
||||||
#_admin.php:419
|
|
||||||
$GLOBALS['__l10n']['Trackbacks status:'] = 'Status des rétroliens :';
|
|
||||||
|
|
||||||
#_admin.php:440
|
|
||||||
#_admin.php:470
|
|
||||||
#_admin.php:485
|
|
||||||
#_admin.php:499
|
|
||||||
#_admin.php:513
|
|
||||||
$GLOBALS['__l10n']['Not changed'] = 'Inchangé';
|
|
||||||
|
|
||||||
#_admin.php:500
|
|
||||||
#_admin.php:514
|
|
||||||
$GLOBALS['__l10n']['Opened'] = 'Ouvert';
|
|
||||||
|
|
||||||
#_admin.php:501
|
|
||||||
#_admin.php:515
|
|
||||||
$GLOBALS['__l10n']['Closed'] = 'Fermé';
|
|
||||||
|
|
||||||
#_public.php:25
|
|
||||||
$GLOBALS['__l10n']['Expired on'] = 'Expire le';
|
|
||||||
|
|
||||||
#_public.php:26
|
|
||||||
$GLOBALS['__l10n']['This entry has no expiration date'] = 'Ce billet n\'a pas de date de péremption';
|
|
Loading…
Reference in New Issue
Block a user