From bfafc8cbc95321b54387ae66eaaa4ae2e2c58309 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Fri, 27 Aug 2021 21:29:07 +0200 Subject: [PATCH] cleanup 2021 --- CHANGELOG | 26 ----- CHANGELOG.md | 31 ++++++ LICENSE | 23 ++--- README.md | 11 ++ _admin.php | 7 +- _define.php | 32 +++--- _public.php | 44 ++++---- _widgets.php | 210 +++++++++++++++++---------------------- dcstore.xml | 13 +++ locales/fr/main.lang.php | 61 ++++++++++++ locales/fr/main.po | 47 +++++---- 11 files changed, 287 insertions(+), 218 deletions(-) delete mode 100644 CHANGELOG create mode 100644 CHANGELOG.md create mode 100644 dcstore.xml create mode 100644 locales/fr/main.lang.php diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index bc25b93..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,26 +0,0 @@ -v2015.04.22 - Pierre Van Glabeke -* modif url support -* suppression icône - -v2015.01.29 - Pierre Van Glabeke -* ajout option hors ligne widget -* modif code pour affichage widget (compatibilité currywurst) -* modifs locales - -v2013.11.12 -* Tiny clean up and add options to widgets - -v2013.06.30 -* Used new 'homeonly' style for widgets - -v0.5 - 2010-06-05 -* Switched to DC 2.2 - -v0.4 -* Added media update -* Moved public function to _public.php -* Fixed some l10n - -v0.3 -* Fixed php 5.3 compatibility -* Fixed wrong timezone \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5ff43cc --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,31 @@ +v2021.08.27 +- cleanup (PSR2, short array, ...) +- enhance widget style +- update license + +v2015.04.22 - Pierre Van Glabeke +- modif url support +- suppression icône + +v2015.01.29 - Pierre Van Glabeke +- ajout option hors ligne widget +- modif code pour affichage widget (compatibilité currywurst) +- modifs locales + +v2013.11.12 +- Tiny clean up and add options to widgets + +v2013.06.30 +- Used new 'homeonly' style for widgets + +v0.5 - 2010-06-05 +- Switched to DC 2.2 + +v0.4 +- Added media update +- Moved public function to _public.php +- Fixed some l10n + +v0.3 +- Fixed php 5.3 compatibility +- Fixed wrong timezone \ No newline at end of file diff --git a/LICENSE b/LICENSE index 8cdb845..d511905 100644 --- a/LICENSE +++ b/LICENSE @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc., + Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - {description} - Copyright (C) {year} {fullname} + + Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -329,7 +329,7 @@ necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. - {signature of Ty Coon}, 1 April 1989 + , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into @@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. - diff --git a/README.md b/README.md index 89b2b06..9969a60 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,14 @@ First install lastBlogUpdate, manualy from a zip package or from Dotaddict repository. (See Dotclear's documentation to know how do this) Add and configure "Last blog update" from widgets manager. + +## MORE + + * License : GNU GPL v2 + * Source & contribution : [GitHub Page](https://github.com/JcDenis/lastBlogUpdate) + * Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/lastBlogUpdate) + +## CONTRIBUTORS + + * Jean-Chirstian Denis + * Pierre Van Glabeke diff --git a/_admin.php b/_admin.php index 40fead7..92ef251 100644 --- a/_admin.php +++ b/_admin.php @@ -3,7 +3,7 @@ # # This file is part of lastBlogUpdate, a plugin for Dotclear 2. # -# Copyright (c) 2009-2015 Jean-Christian Denis and contributors +# 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 @@ -12,8 +12,7 @@ # -- END LICENSE BLOCK ------------------------------------ if (!defined('DC_CONTEXT_ADMIN')) { - - return null; + return null; } -require dirname(__FILE__).'/_widgets.php'; \ No newline at end of file +require dirname(__FILE__) . '/_widgets.php'; \ No newline at end of file diff --git a/_define.php b/_define.php index f6972c5..67fe9f3 100644 --- a/_define.php +++ b/_define.php @@ -3,7 +3,7 @@ # # This file is part of lastBlogUpdate, a plugin for Dotclear 2. # -# Copyright (c) 2009-2015 Jean-Christian Denis and contributors +# 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 @@ -12,24 +12,20 @@ # -- END LICENSE BLOCK ------------------------------------ if (!defined('DC_RC_PATH')) { - - return null; + return null; } $this->registerModule( - /* Name */ - "lastBlogUpdate", - /* Description*/ - "Show the dates of last updates of your blog in a widget", - /* Author */ - "Jean-Christian Denis, Pierre Van Glabeke", - /* Version */ - '2015.04.22', - array( - 'permissions' => 'usage,contentadmin', - 'type' => 'plugin', - 'dc_min' => '2.6', - 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332950#p332950', - 'details' => 'http://plugins.dotaddict.org/dc2/details/lastBlogUpdate' - ) + 'lastBlogUpdate', + 'Show the dates of last updates of your blog in a widget', + 'Jean-Christian Denis, Pierre Van Glabeke', + '2021.08.27', + [ + 'permissions' => 'usage,contentadmin', + 'type' => 'plugin', + 'dc_min' => '2.19', + 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332950#p332950', + 'details' => 'http://plugins.dotaddict.org/dc2/details/lastBlogUpdate', + 'repository' => 'https://raw.githubusercontent.com/JcDenis/lastBlogUpdate/master/dcstore.xml' + ] ); \ No newline at end of file diff --git a/_public.php b/_public.php index 5aeafb9..c254577 100644 --- a/_public.php +++ b/_public.php @@ -3,7 +3,7 @@ # # This file is part of lastBlogUpdate, a plugin for Dotclear 2. # -# Copyright (c) 2009-2015 Jean-Christian Denis and contributors +# 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 @@ -22,29 +22,32 @@ function lastBlogUpdateWidgetPublic($w) { global $core; - if ($w->offline) - return; + if ($w->offline) { + return null; + } # Nothing to display if ($w->homeonly == 1 && $core->url->type != 'default' || $w->homeonly == 2 && $core->url->type == 'default' || !$w->blog_show && !$w->post_show && !$w->comment_show && !$w->media_show - || !$w->blog_text && !$w->post_text && !$w->comment_text && !$w->media_text) return; + || !$w->blog_text && !$w->post_text && !$w->comment_text && !$w->media_text) { + return null; + } $blog = $post = $comment = $media = $addons = ''; # Blog if ($w->blog_show && $w->blog_text) { - $title = $w->blog_title ? ''.html::escapeHTML($w->blog_title).' ' : ''; + $title = $w->blog_title ? sprintf('%s', html::escapeHTML($w->blog_title)) : ''; $text = dt::str($w->blog_text, $core->blog->upddt, $core->blog->settings->system->blog_timezone); $blog = sprintf('
  • %s%s
  • ', $title, $text); } # Post if ($w->post_show && $w->post_text) { - $rs = $core->blog->getPosts(array('limit' => 1, 'no_content' => true)); + $rs = $core->blog->getPosts(['limit' => 1, 'no_content' => true]); if (!$rs->isEmpty()) { - $title = $w->post_title ? ''.html::escapeHTML($w->post_title).' ' : ''; + $title = $w->post_title ? sprintf('%s', html::escapeHTML($w->post_title)) : ''; $text = dt::str($w->post_text, strtotime($rs->post_upddt), $core->blog->settings->system->blog_timezone); $link = $rs->getURL(); $over = $rs->post_title; @@ -55,11 +58,11 @@ function lastBlogUpdateWidgetPublic($w) # Comment if ($w->comment_show && $w->comment_text) { - $rs = $core->blog->getComments(array('limit' => 1, 'no_content' => true)); + $rs = $core->blog->getComments(['limit' => 1, 'no_content' => true]); if (!$rs->isEmpty()) { - $title = $w->comment_title ? ''.html::escapeHTML($w->comment_title).' ' : ''; + $title = $w->comment_title ? sprintf('%s', html::escapeHTML($w->comment_title)) : ''; $text = dt::str($w->comment_text, strtotime($rs->comment_upddt), $core->blog->settings->system->blog_timezone); - $link = $core->blog->url.$core->getPostPublicURL($rs->post_type, html::sanitizeURL($rs->post_url)).'#c'.$rs->comment_id; + $link = $core->blog->url . $core->getPostPublicURL($rs->post_type, html::sanitizeURL($rs->post_url)) . '#c' . $rs->comment_id; $over = $rs->post_title; $comment = sprintf('
  • %s%s
  • ', $title, $link, $over, $text); @@ -69,13 +72,13 @@ function lastBlogUpdateWidgetPublic($w) # Media if ($w->media_show && $w->media_text) { $rs = $core->con->select( - 'SELECT media_upddt FROM '.$core->prefix.'media '. - "WHERE media_path='".$core->con->escape($core->blog->settings->system->public_path)."' ". - 'ORDER BY media_upddt DESC '.$core->con->limit(1) + 'SELECT media_upddt FROM ' . $core->prefix . 'media ' . + "WHERE media_path='" . $core->con->escape($core->blog->settings->system->public_path) . "' " . + 'ORDER BY media_upddt DESC ' . $core->con->limit(1) ); if (!$rs->isEmpty()) { - $title = $w->media_title ? ''.html::escapeHTML($w->media_title).' ' : ''; + $title = $w->media_title ? sprintf('%s', html::escapeHTML($w->media_title)) : ''; $text = dt::str($w->media_text, strtotime($rs->f('media_upddt')), $core->blog->settings->system->blog_timezone); $media = sprintf('
  • %s%s
  • ', $title, $text); @@ -87,14 +90,15 @@ function lastBlogUpdateWidgetPublic($w) # Nothing to display if (!$blog && !$post && !$comment && !$media && !$addons) { - return null; } # Display - $res = - ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). - '
      '.$blog.$post.$comment.$media.$addons.'
    '; - - return $w->renderDiv($w->content_only,'lastblogupdate '.$w->class,'',$res); + return $w->renderDiv( + $w->content_only, + 'lastblogupdate ' . $w->class, + '', + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . + sprintf('
      %s
    ', $blog . $post . $comment . $media . $addons) + ); } \ No newline at end of file diff --git a/_widgets.php b/_widgets.php index 9fdb7a3..55065d6 100644 --- a/_widgets.php +++ b/_widgets.php @@ -3,7 +3,7 @@ # # This file is part of lastBlogUpdate, a plugin for Dotclear 2. # -# Copyright (c) 2009-2015 Jean-Christian Denis and contributors +# 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 @@ -12,129 +12,103 @@ # -- END LICENSE BLOCK ------------------------------------ if (!defined('DC_RC_PATH')) { - - return null; + return null; } $core->addBehavior('initWidgets', 'lastBlogUpdateWidgetAdmin'); function lastBlogUpdateWidgetAdmin($w) { - global $core; - - $w->create( - 'lastblogupdate', - __('LastBlogUpdate: dates of lastest updates'), - 'lastBlogUpdateWidgetPublic', - null, - "Show the dates of last updates of your blog in a widget" - ); - $w->lastblogupdate->setting( - 'title', - __('Title:'), - __('Dates of lastest updates'), - 'text' - ); - $w->lastblogupdate->setting( - 'blog_show', - __('Show blog update'), - 1, - 'check' - ); - $w->lastblogupdate->setting( - 'blog_title', - __('Title for blog update:'), - __('Blog:'), - 'text' - ); - $w->lastblogupdate->setting( - 'blog_text', - __('Text for blog update:'), - __('%Y-%m-%d %H:%M'), - 'text' - ); - - $w->lastblogupdate->setting( - 'post_show', - __('Show entry update'), - 1, - 'check' - ); - $w->lastblogupdate->setting( - 'post_title', - __('Title for entries update:'), - __('Entries:'), - 'text' - ); - $w->lastblogupdate->setting( - 'post_text', - __('Text for entries update:'), - __('%Y-%m-%d %H:%M'), - 'text' - ); - - $w->lastblogupdate->setting( - 'comment_show', - __('Show comment update'), - 1, - 'check' - ); - $w->lastblogupdate->setting( - 'comment_title', - __('Title for comments update:'), - __('Comments:'), - 'text' - ); - $w->lastblogupdate->setting( - 'comment_text', - __('Text for comments update:'), - __('%Y-%m-%d %H:%M'), - 'text' - ); - - $w->lastblogupdate->setting( - 'media_show', - __('Show media update'), - 1, - 'check' - ); - $w->lastblogupdate->setting( - 'media_title', - __('Title for media update:'), - __('Medias:'), - 'text' - ); - $w->lastblogupdate->setting( - 'media_text', - __('Text for media update:'), - __('%Y-%m-%d %H:%M'), - 'text' - ); + global $core; + + $w + ->create( + 'lastblogupdate', + __('LastBlogUpdate: dates of lastest updates'), + 'lastBlogUpdateWidgetPublic', + null, + "Show the dates of last updates of your blog in a widget" + ) + ->addTitle(__('Dates of lastest updates')) + ->setting( + 'blog_show', + __('Show blog update'), + 1, + 'check' + ) + ->setting( + 'blog_title', + __('Title for blog update:'), + __('Blog:'), + 'text' + ) + ->setting( + 'blog_text', + __('Text for blog update:'), + __('%Y-%m-%d %H:%M'), + 'text' + ) + ->setting( + 'post_show', + __('Show entry update'), + 1, + 'check' + ) + ->setting( + 'post_title', + __('Title for entries update:'), + __('Entries:'), + 'text' + ) + ->setting( + 'post_text', + __('Text for entries update:'), + __('%Y-%m-%d %H:%M'), + 'text' + ) + ->setting( + 'comment_show', + __('Show comment update'), + 1, + 'check' + ) + ->setting( + 'comment_title', + __('Title for comments update:'), + __('Comments:'), + 'text' + ) + ->setting( + 'comment_text', + __('Text for comments update:'), + __('%Y-%m-%d %H:%M'), + 'text' + ) + ->setting( + 'media_show', + __('Show media update'), + 1, + 'check' + ) + ->setting( + 'media_title', + __('Title for media update:'), + __('Medias:'), + 'text' + ) + ->setting( + 'media_text', + __('Text for media update:'), + __('%Y-%m-%d %H:%M'), + 'text' + ); - # --BEHAVIOR-- lastBlogUpdateWidgetInit - $core->callBehavior('lastBlogUpdateWidgetInit', $w); + # --BEHAVIOR-- lastBlogUpdateWidgetInit + $core->callBehavior('lastBlogUpdateWidgetInit', $w); - $w->lastblogupdate->setting( - 'homeonly', - __('Display on:'), - 0, - 'combo', - array( - __('All pages') => 0, - __('Home page only') => 1, - __('Except on home page') => 2 - ) - ); - $w->lastblogupdate->setting( - 'content_only', - __('Content only'), - 0, - 'check' - ); - $w->lastblogupdate->setting( - 'class', - __('CSS class:'), - '' - ); - $w->lastblogupdate->setting('offline',__('Offline'),0,'check'); + $w->lastblogupdate + ->addHomeOnly() + ->addContentOnly() + ->addClass() + ->addOffline(); } \ No newline at end of file diff --git a/dcstore.xml b/dcstore.xml new file mode 100644 index 0000000..0ecfa30 --- /dev/null +++ b/dcstore.xml @@ -0,0 +1,13 @@ + + +lastBlogUpdate +2021.08.27 +Jean-Christian Denis, Pierre Van Glabeke +Show the dates of last updates of your blog in a widget +https://github.com/JcDenis/lastBlogUpdate/releases/download/v2021.08.27/plugin-lastBlogUpdate.zip +2.19 +http://plugins.dotaddict.org/dc2/details/lastBlogUpdate + +http://forum.dotclear.org/viewtopic.php?pid=332950#p332950 + + \ No newline at end of file diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php new file mode 100644 index 0000000..3e9220e --- /dev/null +++ b/locales/fr/main.lang.php @@ -0,0 +1,61 @@ + 1);\n" -#: _widgets.php:28 +#: _widgets.php:27 msgid "LastBlogUpdate: dates of lastest updates" msgstr "LastBlogUpdate : dates des dernières mises à jour" -#: _widgets.php:36 +#: _widgets.php:32 msgid "Dates of lastest updates" msgstr "Dates des dernières mises à jour" -#: _widgets.php:41 +#: _widgets.php:35 msgid "Show blog update" msgstr "Afficher la date de mise à jour du blog" -#: _widgets.php:47 +#: _widgets.php:41 msgid "Title for blog update:" msgstr "Titre pour la date de mise à jour du blog :" -#: _widgets.php:53 +#: _widgets.php:47 msgid "Text for blog update:" msgstr "Texte pour la date de mise à jour du blog :" -#: _widgets.php:60 +#: _widgets.php:53 msgid "Show entry update" msgstr "Afficher la date de mise à jour des billets" -#: _widgets.php:66 +#: _widgets.php:59 msgid "Title for entries update:" msgstr "Titre pour la date de mise à jour des billets :" -#: _widgets.php:67 +#: _widgets.php:60 msgid "Entries:" msgstr "Billets :" -#: _widgets.php:72 +#: _widgets.php:65 msgid "Text for entries update:" msgstr "Texte pour la date de mise à jour des billets :" -#: _widgets.php:79 +#: _widgets.php:71 msgid "Show comment update" msgstr "Afficher la date de mise à jour des commentaires" -#: _widgets.php:85 +#: _widgets.php:77 msgid "Title for comments update:" msgstr "Titre pour la date de mise à jour des commentaires :" -#: _widgets.php:86 +#: _widgets.php:78 msgid "Comments:" msgstr "Commentaires :" -#: _widgets.php:91 +#: _widgets.php:83 msgid "Text for comments update:" msgstr "Texte pour la date de mise à jour des commentaires :" -#: _widgets.php:98 +#: _widgets.php:89 msgid "Show media update" msgstr "Afficher la date de mise à jour des médias" -#: _widgets.php:104 +#: _widgets.php:95 msgid "Title for media update:" msgstr "Titre pour la date de mise à jour des médias :" -#: _widgets.php:105 +#: _widgets.php:96 msgid "Medias:" msgstr "Médias :" -#: _widgets.php:110 +#: _widgets.php:101 msgid "Text for media update:" msgstr "Texte pour la date de mise à jour des médias :" @@ -81,4 +87,5 @@ msgid "Show the dates of last updates of your blog in a widget" msgstr "Afficher les dates des dernières mises à jour de votre blog" msgid "Last blog update" -msgstr "Dernières mises à jour du blog" \ No newline at end of file +msgstr "Dernières mises à jour du blog" +