From beb6a186d19f5cb5e0f99a62591c9a92044d9647 Mon Sep 17 00:00:00 2001
From: Jean-Christian Denis
Date: Sun, 20 Nov 2022 21:43:32 +0100
Subject: [PATCH] release 2022.11.20
---
CHANGELOG.md | 5 +-
README.md | 9 +-
_admin.php | 209 ++++++++++++++++++---------------------
_define.php | 23 +++--
_install.php | 15 +--
_prepend.php | 23 +++--
_public.php | 94 +++++++++---------
dcstore.xml | 23 ++---
locales/fr/main.lang.php | 60 -----------
9 files changed, 195 insertions(+), 266 deletions(-)
delete mode 100644 locales/fr/main.lang.php
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 754b54b..816463a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
-2022.04.27.1 - dev
-- [ ] fix wrong timezone on admin vs public expired date
+2022.11.20
+- fix compatibility with Dotclear 2.24 (required)
+- fix wrong timezone on admin vs public expired date
2022.04.27
- require Dotclear 2.21.3
diff --git a/README.md b/README.md
index c9397e4..1349de4 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,10 @@
[![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)
[![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)
[![License](https://img.shields.io/github/license/JcDenis/postExpired)](https://github.com/JcDenis/postExpired/blob/master/LICENSE)
-
## WHAT IS POSTEXPIRED ?
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:
* contentadmin permissions
- * Dotclear 2.21.3
+ * Dotclear 2.24
## USAGE
@@ -43,8 +42,8 @@ Notes:
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [GitHub Page](https://github.com/JcDenis/postExpired)
- * Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postExpired)
- * Discuss & help: [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=42305)
+ * Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postExpired)
+ * Discuss & help : [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=42305)
## CONTRIBUTORS
diff --git a/_admin.php b/_admin.php
index e750500..6f7447b 100644
--- a/_admin.php
+++ b/_admin.php
@@ -1,16 +1,15 @@
getVersion('postExpired') != dcCore::app()->plugins->moduleIn
# Check user right
if (!dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
- dcAuth::PERMISSION_CONTENT_ADMIN,
- ]), dcCore::app()->blog->id)
+ dcAuth::PERMISSION_CONTENT_ADMIN,
+]), dcCore::app()->blog->id)
) {
return null;
}
@@ -87,33 +86,33 @@ class adminBehaviorPostExpired
{
/**
* Add actions to posts page combo
- *
+ *
* @param dcPostsActionsPage $ap dcPostsActionsPage instance
*/
public static function adminPostsActions(dcPostsActions $pa)
{
$pa->addAction(
- array(
- __('Expired entries') => array(
- __('Add expired date') => 'post_expired_add'
- )
- ),
- array('adminBehaviorPostExpired', 'callbackAdd')
+ [
+ __('Expired entries') => [
+ __('Add expired date') => 'post_expired_add',
+ ],
+ ],
+ ['adminBehaviorPostExpired', 'callbackAdd']
);
$pa->addAction(
- array(
- __('Expired entries') => array(
- __('Remove expired date') => 'post_expired_remove'
- )
- ),
- array('adminBehaviorPostExpired', 'callbackRemove')
+ [
+ __('Expired entries') => [
+ __('Remove expired date') => 'post_expired_remove',
+ ],
+ ],
+ ['adminBehaviorPostExpired', 'callbackRemove']
);
}
/**
* Add javascript for date field and toggle
- *
+ *
* @return string HTML head
*/
public static function adminPostHeaders()
@@ -123,7 +122,7 @@ class adminBehaviorPostExpired
/**
* Add form to post sidebar
- *
+ *
* @param ArrayObject $main_items Main items
* @param ArrayObject $sidebar_items Sidebar items
* @param record $post Post record or null
@@ -134,18 +133,18 @@ class adminBehaviorPostExpired
return null;
}
- $sidebar_items['post_expired'] = array(
+ $sidebar_items['post_expired'] = [
'title' => __('Expired date'),
'items' => self::fieldsPostExpired(
$post->post_type,
$post->post_id
- )
- );
+ ),
+ ];
}
/**
* Delete expired date on post edition
- *
+ *
* @param integer $post_id Post id
*/
public static function adminBeforePostDelete($post_id)
@@ -155,7 +154,7 @@ class adminBehaviorPostExpired
/**
* Add expired date on post edition
- *
+ *
* @param cursor $cur Current post cursor
* @param integer $post_id Post id
*/
@@ -175,7 +174,7 @@ class adminBehaviorPostExpired
/**
* Posts actions callback to add expired date
- *
+ *
* @param dcPostsActions $pa dcPostsActions instance
* @param ArrayObject $post _POST actions
*/
@@ -194,7 +193,7 @@ class adminBehaviorPostExpired
|| !empty($post['post_expired_selected'])
|| !empty($post['post_expired_comment'])
|| !empty($post['post_expired_trackback']))) {
- foreach($posts_ids as $post_id) {
+ foreach ($posts_ids as $post_id) {
self::delPostExpired($post_id);
self::setPostExpired($post_id, $post);
}
@@ -208,11 +207,11 @@ class adminBehaviorPostExpired
$posts = $pa->getRS();
$pa->beginPage(
- dcPage::breadcrumb(array(
+ dcPage::breadcrumb([
html::escapeHTML(dcCore::app()->blog->name) => '',
- $pa->getCallerTitle() => $pa->getRedirection(true),
- __('Add expired date to this selection') => ''
- )),
+ $pa->getCallerTitle() => $pa->getRedirection(true),
+ __('Add expired date to this selection') => '',
+ ]),
//dcPage::jsDatePicker() .
self::adminPostHeaders()
);
@@ -225,7 +224,7 @@ class adminBehaviorPostExpired
dcCore::app()->formNonce() .
$pa->getHiddenFields() .
- form::hidden(array('action'), 'post_expired_add') .
+ form::hidden(['action'], 'post_expired_add') .
'
' .
'';
@@ -235,7 +234,7 @@ class adminBehaviorPostExpired
/**
* Posts actions callback to add expired date
- *
+ *
* @param dcPostsActions $pa dcPostsActions instance
* @param ArrayObject $post _POST actions
*/
@@ -248,7 +247,7 @@ class adminBehaviorPostExpired
}
# Delete expired date
- foreach($posts_ids as $post_id) {
+ foreach ($posts_ids as $post_id) {
self::delPostExpired($post_id);
}
@@ -258,7 +257,7 @@ class adminBehaviorPostExpired
/**
* Delete expired date
- *
+ *
* @param integer $post_id Post id
*/
protected static function delPostExpired($post_id)
@@ -268,43 +267,38 @@ class adminBehaviorPostExpired
/**
* Save expired date
- *
+ *
* @param integer $post_id Post id
* @param array $post _POST fields
*/
protected static function setPostExpired($post_id, $post)
{
- $post_expired = array(
- 'status'=> '',
- 'category'=> '',
- 'selected'=> '',
- 'comment'=> '',
+ $post_expired = [
+ 'status' => '',
+ 'category' => '',
+ 'selected' => '',
+ 'comment' => '',
'trackback' => '',
- 'date'=> date(
+ 'date' => date(
'Y-m-d H:i:00',
strtotime($post['post_expired_date'])
- )
- );
+ ),
+ ];
if (!empty($post['post_expired_status'])) {
- $post_expired['status'] =
- (string) $post['post_expired_status'];
+ $post_expired['status'] = (string) $post['post_expired_status'];
}
if (!empty($post['post_expired_category'])) {
- $post_expired['category'] =
- (string) $post['post_expired_category'];
+ $post_expired['category'] = (string) $post['post_expired_category'];
}
if (!empty($post['post_expired_selected'])) {
- $post_expired['selected'] =
- (string) $post['post_expired_selected'];
+ $post_expired['selected'] = (string) $post['post_expired_selected'];
}
if (!empty($post['post_expired_comment'])) {
- $post_expired['comment'] =
- (string) $post['post_expired_comment'];
+ $post_expired['comment'] = (string) $post['post_expired_comment'];
}
if (!empty($post['post_expired_trackback'])) {
- $post_expired['trackback'] =
- (string) $post['post_expired_trackback'];
+ $post_expired['trackback'] = (string) $post['post_expired_trackback'];
}
dcCore::app()->meta->setPostMeta(
@@ -316,20 +310,19 @@ class adminBehaviorPostExpired
/**
* Expired date form fields
- *
+ *
* @param string $post_type Posts type
* @return array Array of HTML form fields
*/
protected static function fieldsPostExpired($post_type, $post_id = null)
{
- $fields = $post_expired = array();
+ $fields = $post_expired = [];
if ($post_id) {
-
$rs = dcCore::app()->meta->getMetadata([
'meta_type' => 'post_expired',
- 'post_id' => $post_id,
- 'limit' => 1
+ 'post_id' => $post_id,
+ 'limit' => 1,
]);
if (!$rs->isEmpty()) {
@@ -337,8 +330,7 @@ class adminBehaviorPostExpired
}
}
- $fields['post_expired_date'] =
- '