From 517a395d8180361ae4a8698c344d9d11aca1e148 Mon Sep 17 00:00:00 2001
From: Jean-Christian Denis
Date: Thu, 2 Sep 2021 14:56:02 +0200
Subject: [PATCH] clean up code
---
CHANGELOG.md | 71 ++++++++++++++-------------
README.md | 2 +-
_admin.php | 22 ++++-----
_define.php | 27 +++++-----
_install.php | 22 ++++-----
_prepend.php | 22 ++++-----
_public.php | 28 +++++------
inc/class.periodical.php | 28 +++++------
inc/lib.index.pager.php | 36 +++++++-------
inc/lib.periodical.socialmewriter.php | 22 ++++-----
index.php | 31 ++++++------
js/dates.js | 28 ++++++++++-
js/periodsfilter.js | 4 +-
js/postsfilter.js | 4 +-
locales/fr/main.lang.php | 3 +-
15 files changed, 189 insertions(+), 161 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 411b294..f2fc783 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,42 +1,45 @@
-periodical 2021.08.xx
- * update license
- * update php code to PSR-2 style and short array
- * move settings to blog pref
+xxxx.xx.xx
+- [x] update php headers to phpdoc style
-periodical 2013.11.11
- * Switch to Dotclear 2.6
+2021.08.23
+- update license
+- update php code to PSR-2 style and short array
+- move settings to blog pref
-periodical 2013.06.30
- * Small fix and typo
+2013.11.11
+- Switch to Dotclear 2.6
-periodical 0.5 - 2011-01-30
- * Fixed install on nightly buid
- * Fixed call to blog object on prepend
- * Removed mesenger fonctions (this is to another plugin to do that)
- * Added behavior on post update
- * Added periodical to plugin soCialMe
- * New year copyright
+2013.06.30
+- Small fix and typo
-periodical 0.4 - 2010-09-09
- * Removed old Twitter functions
- * Added StatusNet small functions (Identica)
- * Required plugin Tac for Twitter ability
+0.5 - 2011-01-30
+- Fixed install on nightly buid
+- Fixed call to blog object on prepend
+- Removed mesenger fonctions (this is to another plugin to do that)
+- Added behavior on post update
+- Added periodical to plugin soCialMe
+- New year copyright
-periodical 0.3.1 - 2010-06-25
- * Fixed postgreSQL compatibility
- * Fixed php 5.3 compatibility on post action combo
- * Fixed admin crash on non DC 2.2
- * Fixed users rights
+0.4 - 2010-09-09
+- Removed old Twitter functions
+- Added StatusNet small functions (Identica)
+- Required plugin Tac for Twitter ability
-periodical 0.3 - 2010-06-08
- * Switched to DC 2.2
- * Fixed simultaneous updates (uses flock)
- * Added twitter option when posts are published
+0.3.1 - 2010-06-25
+- Fixed postgreSQL compatibility
+- Fixed php 5.3 compatibility on post action combo
+- Fixed admin crash on non DC 2.2
+- Fixed users rights
-periodical 0.2 - 2010-04-11
- * Fixed some bugs
- * Added DC 2.2 compatibility (new setting)
- * closes #415
+0.3 - 2010-06-08
+- Switched to DC 2.2
+- Fixed simultaneous updates (uses flock)
+- Added twitter option when posts are published
-periodical 0.1 - 2010-04-05
- * First lab release
\ No newline at end of file
+0.2 - 2010-04-11
+- Fixed some bugs
+- Added DC 2.2 compatibility (new setting)
+- closes #415
+
+0.1 - 2010-04-05
+- First lab release
\ No newline at end of file
diff --git a/README.md b/README.md
index 4701406..85b6759 100644
--- a/README.md
+++ b/README.md
@@ -41,4 +41,4 @@ You can also add or remove period to multiple posts from posts actions page.
* License : GNU GPL v2
* Source & contribution : [GitHub Page](https://github.com/JcDenis/periodical)
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/periodical)
- * Discuss & help: [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=42289)
+ * Discuss & help: [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=42289)
\ No newline at end of file
diff --git a/_admin.php b/_admin.php
index 2b44989..6fc9b54 100644
--- a/_admin.php
+++ b/_admin.php
@@ -1,15 +1,15 @@
registerModule(
'Jean-Christian Denis and contributors',
'2021.08.23',
[
+ 'requires' => [['core', '2.19']],
'permissions' => 'usage,contentadmin',
'type' => 'plugin',
- 'dc_min' => '2.19',
'support' => 'https://github.com/JcDenis/periodical',
- 'details' => 'https://plugins.dotaddict.org/dc2/details/periodical'
+ 'details' => 'https://plugins.dotaddict.org/dc2/details/periodical',
+ 'repository' => 'https://raw.githubusercontent.com/JcDenis/periodical/master/dcstore.xml'
]
);
\ No newline at end of file
diff --git a/_install.php b/_install.php
index 62acd48..cf13cd6 100644
--- a/_install.php
+++ b/_install.php
@@ -1,15 +1,15 @@
periodical_pub_nb;
$max_tz = $end_tz < $now_tz ? $end_tz : $now_tz;
-
+
# Calculate nb of posts to get
$loop_tz = $cur_tz;
$limit = 0;
@@ -107,7 +107,7 @@ class publicPeriodical
if (!$posts->isEmpty()) {
$cur_post = $core->con->openCursor($core->prefix . 'post');
-
+
while($posts->fetch()) {
# Publish post with right date
diff --git a/inc/class.periodical.php b/inc/class.periodical.php
index f2367c3..372acbe 100644
--- a/inc/class.periodical.php
+++ b/inc/class.periodical.php
@@ -1,15 +1,15 @@
con->openCursor($this->core->prefix .'meta');
$this->con->writeLock($this->core->prefix . 'meta');
-
+
try {
$cur->post_id = $post_id;
$cur->meta_id = $period_id;
@@ -306,7 +306,7 @@ class periodical
if (empty($ids)) {
return;
}
-
+
$this->con->execute(
'DELETE FROM ' . $this->core->prefix . 'meta ' .
"WHERE meta_type = 'periodical' " .
@@ -324,7 +324,7 @@ class periodical
__('Monthly') => 'month'
];
}
-
+
public static function getNextTime($ts, $period)
{
$ts = (integer) $ts;
diff --git a/inc/lib.index.pager.php b/inc/lib.index.pager.php
index 2e79ea6..f562549 100644
--- a/inc/lib.index.pager.php
+++ b/inc/lib.index.pager.php
@@ -1,15 +1,15 @@
rs->periodical->getPosts(['periodical_id' => $this->rs->periodical_id], true);
@@ -126,11 +126,11 @@ class adminPeriodicalList extends adminGenericList
$blocks = explode('%s', $html_block);
$echo .= $blocks[0];
-
+
while ($this->rs->fetch()) {
$echo .= $this->postLine();
}
-
+
$echo .= $blocks[1];
$echo .= $pager->getLinks();
@@ -138,7 +138,7 @@ class adminPeriodicalList extends adminGenericList
return $echo;
}
-
+
private function postLine()
{
if ($this->core->auth->check('categories', $this->core->blog->id)) {
@@ -163,15 +163,15 @@ class adminPeriodicalList extends adminGenericList
case 1:
$img_status = sprintf($img, __('published'), 'check-on.png');
break;
-
+
case 0:
$img_status = sprintf($img, __('unpublished'), 'check-off.png');
break;
-
+
case -1:
$img_status = sprintf($img, __('scheduled'), 'scheduled.png');
break;
-
+
case -2:
$img_status = sprintf($img, __('pending'), 'check-wrn.png');
break;
diff --git a/inc/lib.periodical.socialmewriter.php b/inc/lib.periodical.socialmewriter.php
index 01d395f..811087e 100644
--- a/inc/lib.periodical.socialmewriter.php
+++ b/inc/lib.periodical.socialmewriter.php
@@ -1,15 +1,15 @@
' . __('Status:') . ' ' .
form::combo('status', $status_combo, $status) . '
' .
'' .
-
+
'' .
'
' . __('Selected:') . ' ' .
form::combo('selected', $selected_combo, $selected) .'
' .
@@ -549,7 +548,7 @@ if ($part == 'period') {
'
' . __('Lang:') . ' ' .
form::combo('lang', $lang_combo, $lang) . '
' .
'
'.
-
+
'' .
'
' . __('Display options') . ' ' .
'
' . __('Order by:') . ' ' .
@@ -694,7 +693,7 @@ if ($part == 'period') {
if ($order !== '' && in_array($order, $order_combo)) {
$params['order'] = $sortby . ' ' . $order;
}
-
+
if ($sortby != 'periodical_curdt' || $order != 'desc') {
$show_filters = true;
}
diff --git a/js/dates.js b/js/dates.js
index 597a031..f1c2d71 100644
--- a/js/dates.js
+++ b/js/dates.js
@@ -1 +1,27 @@
-/* -- BEGIN LICENSE BLOCK ----------------------------------
*
* This file is part of periodical, a plugin for Dotclear 2.
*
* Copyright (c) 2009-2013 Jean-Christian Denis and contributors
* contact@jcdenis.fr http://jcd.lv
*
* Licensed under the GPL version 2.0 license.
* A copy of this license is available in LICENSE file or at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* -- END LICENSE BLOCK ------------------------------------*/
$(function(){
var periodicalstart=document.getElementById('period_curdt');
if(periodicalstart!=undefined){
var periodicalstart_dtPick=new datePicker(periodicalstart);
periodicalstart_dtPick.img_top='1.5em';
periodicalstart_dtPick.draw();
}
var periodicalend=document.getElementById('period_enddt');
if(periodicalend!=undefined){
var periodicalend_dtPick=new datePicker(periodicalend);
periodicalend_dtPick.img_top='1.5em';
periodicalend_dtPick.draw();
}
});
\ No newline at end of file
+/* -- BEGIN LICENSE BLOCK ----------------------------------
+ *
+ * This file is part of periodical, a plugin for Dotclear 2.
+ *
+ * Copyright (c) 2009-2013 Jean-Christian Denis and contributors
+ * contact@jcdenis.fr http://jcd.lv
+ *
+ * Licensed under the GPL version 2.0 license.
+ * A copy of this license is available in LICENSE file or at
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ * -- END LICENSE BLOCK ------------------------------------*/
+
+$(function(){
+ var periodicalstart=document.getElementById('period_curdt');
+ if(periodicalstart!=undefined){
+ var periodicalstart_dtPick=new datePicker(periodicalstart);
+ periodicalstart_dtPick.img_top='1.5em';
+ periodicalstart_dtPick.draw();
+ }
+ var periodicalend=document.getElementById('period_enddt');
+ if(periodicalend!=undefined){
+ var periodicalend_dtPick=new datePicker(periodicalend);
+ periodicalend_dtPick.img_top='1.5em';
+ periodicalend_dtPick.draw();
+ }
+});
\ No newline at end of file
diff --git a/js/periodsfilter.js b/js/periodsfilter.js
index e3d983c..3c608fb 100644
--- a/js/periodsfilter.js
+++ b/js/periodsfilter.js
@@ -16,7 +16,7 @@ $(function(){
$filtersform = $('#filters-form');
$filtersform.before('
'+dotclear.msg.filter_posts_list+'
')
-
+
if( dotclear.msg.show_filters == 'false' ) {
$filtersform.hide();
} else {
@@ -24,7 +24,7 @@ $(function(){
.addClass('open')
.text(dotclear.msg.cancel_the_filter);
}
-
+
$('#filter-control').click(function() {
if( $(this).hasClass('open') ) {
if( dotclear.msg.show_filters == 'true' ) {
diff --git a/js/postsfilter.js b/js/postsfilter.js
index e11c92f..223e97a 100644
--- a/js/postsfilter.js
+++ b/js/postsfilter.js
@@ -16,7 +16,7 @@ $(function(){
$filtersform = $('#filters-form');
$filtersform.before('
'+dotclear.msg.filter_posts_list+'
')
-
+
if( dotclear.msg.show_filters == 'false' ) {
$filtersform.hide();
} else {
@@ -24,7 +24,7 @@ $(function(){
.addClass('open')
.text(dotclear.msg.cancel_the_filter);
}
-
+
$('#filter-control').click(function() {
if( $(this).hasClass('open') ) {
if( dotclear.msg.show_filters == 'true' ) {
diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php
index 89c0cc5..f5e882d 100644
--- a/locales/fr/main.lang.php
+++ b/locales/fr/main.lang.php
@@ -180,5 +180,4 @@ $GLOBALS['__l10n']['Selected periods action:'] = 'Action sur les périodes selec
$GLOBALS['__l10n']['Configuration has been successfully updated.'] = 'La configuration a été mise à jour avec succés.';
-$GLOBALS['__l10n']['Published periodically entries'] = 'Publier périodiquement des billets';
-
+$GLOBALS['__l10n']['Published periodically entries'] = 'Publier périodiquement des billets';
\ No newline at end of file