clean up code

master
Jean-Christian Paul Denis 2021-09-02 14:56:02 +02:00
parent a2663368ed
commit 517a395d81
15 changed files with 189 additions and 161 deletions

View File

@ -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
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

View File

@ -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)

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
@ -21,10 +21,11 @@ $this->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'
]
);

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
@ -74,10 +74,10 @@ class publicPeriodical
$last_nb = 0;
$last_tz = $cur_tz;
$max_nb = $periods->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

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')){
return;
@ -257,7 +257,7 @@ class periodical
$cur = $this->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;

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
@ -67,7 +67,7 @@ class adminPeriodicalList extends adminGenericList
return $echo;
}
private function periodLine()
{
$nb_posts = $this->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;

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')){
return;

View File

@ -1,15 +1,15 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of periodical, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# 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 ------------------------------------
/**
* @brief periodical, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
@ -25,7 +25,6 @@ $per = new periodical($core);
$action = isset($_POST['action']) ? $_POST['action'] : '';
$part = isset($_REQUEST['part']) && $_REQUEST['part'] == 'period' ? 'period' : 'periods';
############################################################
#
# One period
@ -392,7 +391,7 @@ if ($part == 'period') {
} else {
$order='desc';
}
if ($sortby != 'post_dt' || $order != 'desc') {
$show_filters = true;
}
@ -538,7 +537,7 @@ if ($part == 'period') {
'<p><label for="status" class="ib">' . __('Status:') . '</label> ' .
form::combo('status', $status_combo, $status) . '</p> ' .
'</div>' .
'<div class="cell filters-sibling-cell">' .
'<p><label for="selected" class="ib">' . __('Selected:') . '</label> ' .
form::combo('selected', $selected_combo, $selected) .'</p>' .
@ -549,7 +548,7 @@ if ($part == 'period') {
'<p><label for="lang" class="ib">' . __('Lang:') . '</label> ' .
form::combo('lang', $lang_combo, $lang) . '</p> ' .
'</div>'.
'<div class="cell filters-options">' .
'<h4>' . __('Display options') . '</h4>' .
'<p><label for="sortby" class="ib">' . __('Order by:') . '</label> ' .
@ -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;
}

View File

@ -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(); } });
/* -- 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();
}
});

View File

@ -16,7 +16,7 @@ $(function(){
$filtersform = $('#filters-form');
$filtersform.before('<p><a id="filter-control" class="form-control" href="plugin.php?p=periodical&amp;part=periods" style="display:inline">'+dotclear.msg.filter_posts_list+'</a></p>')
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' ) {

View File

@ -16,7 +16,7 @@ $(function(){
$filtersform = $('#filters-form');
$filtersform.before('<p><a id="filter-control" class="form-control" href="plugin.php?p=periodical&amp;part=period&amp;period_id='+$('#filters-form input[name=period_id]').val()+'#posts" style="display:inline">'+dotclear.msg.filter_posts_list+'</a></p>')
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' ) {

View File

@ -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';