From 9899da09d11ba70650b8bb03837635aa5f920399 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Fri, 27 Aug 2021 21:01:19 +0200 Subject: [PATCH] cleanup 2021 --- CHANGELOG | 22 - CHANGELOG.md | 26 + LICENSE | 23 +- README.md | 11 + _admin.php | 7 +- _define.php | 32 +- _public.php | 7 +- _widgets.php | 1136 +++++++++++++++++++------------------- dcstore.xml | 13 + locales/fr/main.lang.php | 141 +++++ locales/fr/main.po | 138 ++--- 11 files changed, 843 insertions(+), 713 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 f62ca74..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,22 +0,0 @@ -postInfoWidget 0.5.1 - 2015-04-23 - Pierre Van Glabeke - * modif url support - -postInfoWidget 0.5 - 2015-01-29 - Pierre Van Glabeke - * ajout case hors ligne - * modif localisation - * fin de ligne unix (LF) - -postInfoWidget 0.4 - 2013-11-12 - * Switch to Dotclear 2.6 - * Clean up code - * Add widget options - -postInfoWidget 0.3 - 2010-06-21 - * Fixed tags list - * Fixed nav links - -postInfoWidget 0.2 - 2010-06-05 - * Switched to DC 2.2 - -postInfoWidget 0.1 - 2010-05-24 - * First lab release diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8c8af05 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,26 @@ +postInfoWidget 0.6 - 2021.08.27 +- cleanup (PSR2, short array, ...) +- update license + +postInfoWidget 0.5.1 - 2015.04.23 - Pierre Van Glabeke +- modif url support + +postInfoWidget 0.5 - 2015-01-29 - Pierre Van Glabeke +- ajout case hors ligne +- modif localisation +- fin de ligne unix (LF) + +postInfoWidget 0.4 - 2013.11.12 +- Switch to Dotclear 2.6 +- Clean up code +- Add widget options + +postInfoWidget 0.3 - 2010.06.21 +- Fixed tags list +- Fixed nav links + +postInfoWidget 0.2 - 2010.06.05 +- Switched to DC 2.2 + +postInfoWidget 0.1 - 2010.05.24 +- First lab release 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 f70e342..ae37a5f 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,14 @@ First install postInfoWidget, manualy from a zip package or from Dotaddict repository. (See Dotclear's documentation to know how do this) Add and configure "Entry information list" from widgets manager. + +## MORE + + * License : GNU GPL v2 + * Source & contribution : [GitHub Page](https://github.com/JcDenis/postInfoWidget) + * Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postInfoWidget) + +## CONTRIBUTORS + + * Jean-Chirstian Denis + * Pierre Van Glabeke diff --git a/_admin.php b/_admin.php index 55b144a..05468a2 100644 --- a/_admin.php +++ b/_admin.php @@ -3,7 +3,7 @@ # # This file is part of postInfoWidget, 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 25ff0df..59cf7c0 100644 --- a/_define.php +++ b/_define.php @@ -3,7 +3,7 @@ # # This file is part of postInfoWidget, 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 */ - "postInfoWidget", - /* Description*/ - "Show Entry informations on a widget", - /* Author */ - "Jean-Christian Denis, Pierre Van Glabeke", - /* Version */ - '0.5.1', - array( - 'permissions' => 'usage,contentadmin', - 'type' => 'plugin', - 'dc_min' => '2.7', - 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332974#p332974', - 'details' => 'http://plugins.dotaddict.org/dc2/details/postInfoWidget' - ) + 'postInfoWidget', + 'Show Entry informations on a widget', + 'Jean-Christian Denis, Pierre Van Glabeke', + '0.6', + [ + 'permissions' => 'usage,contentadmin', + 'type' => 'plugin', + 'dc_min' => '2.19', + 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332974#p332974', + 'details' => 'http://plugins.dotaddict.org/dc2/details/postInfoWidget', + 'repository' => 'https://raw.githubusercontent.com/JcDenis/postInfoWidget/master/dcstore.xml' + ] ); \ No newline at end of file diff --git a/_public.php b/_public.php index d543cda..9a213e8 100644 --- a/_public.php +++ b/_public.php @@ -3,7 +3,7 @@ # # This file is part of postInfoWidget, 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_RC_PATH')) { - - return null; + return null; } -require dirname(__FILE__).'/_widgets.php'; +require dirname(__FILE__) . '/_widgets.php'; \ No newline at end of file diff --git a/_widgets.php b/_widgets.php index 6ce1acd..269fa5f 100644 --- a/_widgets.php +++ b/_widgets.php @@ -3,7 +3,7 @@ # # This file is part of postInfoWidget, 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,620 +12,606 @@ # -- END LICENSE BLOCK ------------------------------------ if (!defined('DC_RC_PATH')) { - - return null; + return null; } $core->addBehavior( - 'initWidgets', - array('postInfoWidget', 'adminWidget') + 'initWidgets', + ['postInfoWidget', 'adminWidget'] ); class postInfoWidget { - public static function adminWidget($w) - { - global $core; + public static function adminWidget($w) + { + global $core; - $w->create( - 'postinfowidget', - __('PostInfoWidget: entry information list'), - array('postInfoWidget', 'publicWidget'), - null, - __('Show Entry informations on a widget') - ); - $w->postinfowidget->setting( - 'title', - __('Title:'), - __('About this entry'), - 'text' - ); - $w->postinfowidget->setting( - 'dt_str', - __('Publish date text:'), - __('Publish on %Y-%m-%d %H:%M'), - 'text' - ); - $w->postinfowidget->setting( - 'creadt_str', - __('Create date text:'), - __('Create on %Y-%m-%d %H:%M'), - 'text' - ); - $w->postinfowidget->setting( - 'upddt_str', - __('Update date text:'), - __('Update on %Y-%m-%d %H:%M'), - 'text' - ); - $w->postinfowidget->setting( - 'lang_str', - __('Language (%T = name, %C = code, %F = flag):'), - __('Language: %T %F'), - 'text' - ); - $w->postinfowidget->setting( - 'author_str', - __('Author text (%T = author):'), - __('Author: %T'), - 'text' - ); - $w->postinfowidget->setting( - 'category_str', - __('Category text (%T = category):'), - __('Category: %T'), - 'text' - ); - if ($core->plugins->moduleExists('tags')) { - $w->postinfowidget->setting( - 'tag_str', - __('Tags text (%T = tags list):'), - __('Tags: %T'), - 'text' - ); - } - $w->postinfowidget->setting( - 'attachment_str', - __('Attachments text (%T = text, %D = numeric):'), - __('Attachments: %T'), - 'text' - ); - $w->postinfowidget->setting( - 'comment_str', - __('Comments text (%T = text, %D = numeric):'), - __('Comments: %T'), - 'text' - ); - $w->postinfowidget->setting( - 'trackback_str', - __('Trackbacks text (%T = text, %D = numeric):'), - __('Trackbacks: %T'), - 'text' - ); - $w->postinfowidget->setting( - 'permalink_str', - __('Permalink text (%T = text link, %F = full link):'), - __('%T'), - 'text' - ); - $w->postinfowidget->setting( - 'feed', - __('Show comment feed url'), - 1, - 'check' - ); - $w->postinfowidget->setting( - 'navprevpost', - __('Link to previous entry (%T = navigation text, %F = entry title):'), - __('%T'), - 'text' - ); - $w->postinfowidget->setting( - 'navnextpost', - __('Link to next entry (%T = navigation text, %F = entry title):'), - __('%T'), - 'text' - ); - $w->postinfowidget->setting( - 'navprevcat', - __('Link to previous entry of this category (%T = navigation text, %F = entry title):'), - __('%T'), - 'text' - ); - $w->postinfowidget->setting( - 'navnextcat', - __('Link to next entry of this category (%T = navigation text, %F = entry title):'), - __('%T'), - 'text' - ); - $w->postinfowidget->setting( - 'style', - __('Try to adapt style'), - 'small', - 'combo', - array( - __('No style') => '-', - __('Small icon') => 'small', - __('Normal icon') => 'normal' - ) - ); - $w->postinfowidget->setting( - 'rmvinfo', - __('Try to remove entry information'), - 1, - 'check' - ); - $w->postinfowidget->setting( - 'rmvtags', - __('Try to remove entry tags'), - 1, - 'check' - ); - $w->postinfowidget->setting( - 'rmvnav', - __('Try to remove entry navigation'), - 1, - 'check' - ); + $w + ->create( + 'postinfowidget', + __('PostInfoWidget: entry information list'), + ['postInfoWidget', 'publicWidget'], + null, + __('Show Entry informations on a widget') + ) + ->addTitle(__('About this entry')) + ->setting( + 'dt_str', + __('Publish date text:'), + __('Publish on %Y-%m-%d %H:%M'), + 'text' + ) + ->setting( + 'creadt_str', + __('Create date text:'), + __('Create on %Y-%m-%d %H:%M'), + 'text' + ) + ->setting( + 'upddt_str', + __('Update date text:'), + __('Update on %Y-%m-%d %H:%M'), + 'text' + ) + ->setting( + 'lang_str', + __('Language (%T = name, %C = code, %F = flag):'), + __('Language: %T %F'), + 'text' + ) + ->setting( + 'author_str', + __('Author text (%T = author):'), + __('Author: %T'), + 'text' + ) + ->setting( + 'category_str', + __('Category text (%T = category):'), + __('Category: %T'), + 'text' + ); - # --BEHAVIOR-- postInfoWidgetAdmin - $core->callBehavior('postInfoWidgetAdmin', $w); + if ($core->plugins->moduleExists('tags')) { + $w->postinfowidget->setting( + 'tag_str', + __('Tags text (%T = tags list):'), + __('Tags: %T'), + 'text' + ); + } - $w->postinfowidget->setting( - 'content_only', - __('Content only'), - 0, - 'check' - ); + $w->postinfowidget + ->setting( + 'attachment_str', + __('Attachments text (%T = text, %D = numeric):'), + __('Attachments: %T'), + 'text' + ) + ->setting( + 'comment_str', + __('Comments text (%T = text, %D = numeric):'), + __('Comments: %T'), + 'text' + ) + ->setting( + 'trackback_str', + __('Trackbacks text (%T = text, %D = numeric):'), + __('Trackbacks: %T'), + 'text' + ) + ->setting( + 'permalink_str', + __('Permalink text (%T = text link, %F = full link):'), + __('%T'), + 'text' + ) + ->setting( + 'feed', + __('Show comment feed url'), + 1, + 'check' + ) + ->setting( + 'navprevpost', + __('Link to previous entry (%T = navigation text, %F = entry title):'), + __('%T'), + 'text' + ) + ->setting( + 'navnextpost', + __('Link to next entry (%T = navigation text, %F = entry title):'), + __('%T'), + 'text' + ) + ->setting( + 'navprevcat', + __('Link to previous entry of this category (%T = navigation text, %F = entry title):'), + __('%T'), + 'text' + ) + ->setting( + 'navnextcat', + __('Link to next entry of this category (%T = navigation text, %F = entry title):'), + __('%T'), + 'text' + ) + ->setting( + 'style', + __('Try to adapt style'), + 'small', + 'combo', + array( + __('No style') => '-', + __('Small icon') => 'small', + __('Normal icon') => 'normal' + ) + ); +/* + $w->postinfowidget + ->setting( + 'rmvinfo', + __('Try to remove entry information'), + 1, + 'check' + ) + ->setting( + 'rmvtags', + __('Try to remove entry tags'), + 1, + 'check' + ) + ->setting( + 'rmvnav', + __('Try to remove entry navigation'), + 1, + 'check' + ); +//*/ + # --BEHAVIOR-- postInfoWidgetAdmin + $core->callBehavior('postInfoWidgetAdmin', $w); - $w->postinfowidget->setting( - 'class', - __('CSS class:'), - '' - ); - $w->postinfowidget->setting('offline',__('Offline'),0,'check'); - } + $w->postinfowidget + ->addContentOnly() + ->addClass() + ->addOffline(); + } - public static function publicWidget($w) - { - global $core, $_ctx; + public static function publicWidget($w) + { + global $core, $_ctx; - if ($w->offline) - return; + if ($w->offline) { + return null; + } - if ($core->url->type != 'post' - || !$_ctx->posts->post_id - ){ - return null; - } + if ($core->url->type != 'post' + || !$_ctx->posts->post_id){ + return null; + } - $link = '%s'; - $title = (strlen($w->title) > 0) ? - '

'.html::escapeHTML($w->title).'

' : null; - $content = ''; + $link = '%s'; + $content = ''; - if ($w->dt_str != '') { - $content .= postInfoWidget::li( - $w, - 'date', - dt::str( - $w->dt_str, - strtotime($_ctx->posts->post_dt), - $core->blog->settings->system->blog_timezone - ) - ); - } + if ($w->dt_str != '') { + $content .= postInfoWidget::li( + $w, + 'date', + dt::str( + $w->dt_str, + strtotime($_ctx->posts->post_dt), + $core->blog->settings->system->blog_timezone + ) + ); + } - if ($w->creadt_str != '') { - $content .= postInfoWidget::li( - $w, - 'create', - dt::str( - $w->creadt_str, - strtotime($_ctx->posts->post_creadt), - $core->blog->settings->system->blog_timezone - ) - ); - } + if ($w->creadt_str != '') { + $content .= postInfoWidget::li( + $w, + 'create', + dt::str( + $w->creadt_str, + strtotime($_ctx->posts->post_creadt), + $core->blog->settings->system->blog_timezone + ) + ); + } - if ($w->upddt_str != '') { - $content .= postInfoWidget::li( - $w, - 'update', - dt::str( - $w->upddt_str, - strtotime($_ctx->posts->post_upddt), - $core->blog->settings->system->blog_timezone - ) - ); - } + if ($w->upddt_str != '') { + $content .= postInfoWidget::li( + $w, + 'update', + dt::str( + $w->upddt_str, + strtotime($_ctx->posts->post_upddt), + $core->blog->settings->system->blog_timezone + ) + ); + } - if ($w->lang_str != '') { - $ln = l10n::getISOcodes(); - $lang_code = $_ctx->posts->post_lang ? - $_ctx->posts->post_lang : - $core->blog->settings->system->lang; - $lang_name = isset($ln[$lang_code]) ? - $ln[$lang_code] : - $lang_code; - $lang_flag = file_exists( - dirname(__FILE__). - '/img/flags/'. - $lang_code.'.png' - ) ? - ''.$lang_name.'' : - ''; + if ($w->lang_str != '') { + $ln = l10n::getISOcodes(); + $lang_code = $_ctx->posts->post_lang ? + $_ctx->posts->post_lang : + $core->blog->settings->system->lang; + $lang_name = isset($ln[$lang_code]) ? + $ln[$lang_code] : + $lang_code; + $lang_flag = file_exists( + dirname(__FILE__) . + '/img/flags/' . + $lang_code . '.png' + ) ? + '' . $lang_name . '' : + ''; - $content .= postInfoWidget::li( - $w, - 'lang', - str_replace( - array('%T', '%C', '%F'), - array($lang_name, $lang_code, $lang_flag), - html::escapeHTML($w->lang_str) - ) - ); - } + $content .= postInfoWidget::li( + $w, + 'lang', + str_replace( + ['%T', '%C', '%F'], + [$lang_name, $lang_code, $lang_flag], + html::escapeHTML($w->lang_str) + ) + ); + } - if ($w->author_str != '') { - $content .= postInfoWidget::li( - $w, - 'author', - str_replace( - '%T', - $_ctx->posts->getAuthorLink(), - html::escapeHTML($w->author_str) - ) - ); - } + if ($w->author_str != '') { + $content .= postInfoWidget::li( + $w, + 'author', + str_replace( + '%T', + $_ctx->posts->getAuthorLink(), + html::escapeHTML($w->author_str) + ) + ); + } - if ($w->category_str != '' && $_ctx->posts->cat_id) { - $content .= postInfoWidget::li( - $w, - 'category', - str_replace( - '%T', - sprintf( - $link, - $_ctx->posts->getCategoryURL(), - html::escapeHTML($_ctx->posts->cat_title) - ), - html::escapeHTML($w->category_str) - ) - ); - } + if ($w->category_str != '' && $_ctx->posts->cat_id) { + $content .= postInfoWidget::li( + $w, + 'category', + str_replace( + '%T', + sprintf( + $link, + $_ctx->posts->getCategoryURL(), + html::escapeHTML($_ctx->posts->cat_title) + ), + html::escapeHTML($w->category_str) + ) + ); + } - if ($w->tag_str != '' && $core->plugins->moduleExists('tags')) { - $meta = $core->meta->getMetadata(array( - 'meta_type' => 'tag', - 'post_id' => $_ctx->posts->post_id - )); - $metas = array(); - while ($meta->fetch()) { - $metas[$meta->meta_id] = sprintf( - $link, - $core->blog->url. - $core->url->getBase('tag')."/". - rawurlencode($meta->meta_id), - $meta->meta_id - ); - } - if (!empty($metas)) { - $content .= postInfoWidget::li( - $w, - 'tag', - str_replace( - '%T', - implode(', ', $metas), - html::escapeHTML($w->tag_str) - ) - ); - } - } + if ($w->tag_str != '' && $core->plugins->moduleExists('tags')) { + $meta = $core->meta->getMetadata([ + 'meta_type' => 'tag', + 'post_id' => $_ctx->posts->post_id + ]); + $metas = []; + while ($meta->fetch()) { + $metas[$meta->meta_id] = sprintf( + $link, + $core->blog->url . + $core->url->getBase('tag') . "/" . + rawurlencode($meta->meta_id), + $meta->meta_id + ); + } + if (!empty($metas)) { + $content .= postInfoWidget::li( + $w, + 'tag', + str_replace( + '%T', + implode(', ', $metas), + html::escapeHTML($w->tag_str) + ) + ); + } + } - if ($w->attachment_str != '') { - $nb = $_ctx->posts->countMedia(); - if ($nb == 0) { - $attachment_numeric = 0; - $attachment_textual = __('no attachment'); - } - elseif ($nb == 1) { - $attachment_numeric = sprintf( - $link, - '#attachment', - 1 - ); - $attachment_textual = sprintf( - $link, - '#attachment', - __('one attachment') - ); - } - else { - $attachment_numeric = sprintf( - $link, - '#attachment', - $nb - ); - $attachment_textual = sprintf( - $link, - '#attachment', - sprintf(__('%d attachments'), $nb) - ); - } + if ($w->attachment_str != '') { + $nb = $_ctx->posts->countMedia(); + if ($nb == 0) { + $attachment_numeric = 0; + $attachment_textual = __('no attachment'); + } elseif ($nb == 1) { + $attachment_numeric = sprintf( + $link, + '#attachment', + 1 + ); + $attachment_textual = sprintf( + $link, + '#attachment', + __('one attachment') + ); + } else { + $attachment_numeric = sprintf( + $link, + '#attachment', + $nb + ); + $attachment_textual = sprintf( + $link, + '#attachment', + sprintf(__('%d attachments'), $nb) + ); + } - $content .= postInfoWidget::li( - $w, - 'attachment', - str_replace( - array('%T', '%D'), - array($attachment_textual, $attachment_numeric), - html::escapeHTML($w->attachment_str) - ) - ); - } + $content .= postInfoWidget::li( + $w, + 'attachment', + str_replace( + ['%T', '%D'], + [$attachment_textual, $attachment_numeric], + html::escapeHTML($w->attachment_str) + ) + ); + } - if ($w->comment_str != '' && $_ctx->posts->commentsActive()) { - $nb = $_ctx->posts->nb_comment; - if ($nb == 0) { - $comment_numeric = 0; - $comment_textual = __('no comment'); - } - elseif ($nb == 1) { - $comment_numeric = sprintf( - $link, - '#comments', - 1 - ); - $comment_textual = sprintf( - $link, - '#comments', - __('one comment') - ); - } - else { - $comment_numeric = sprintf( - $link, - '#comments', - $nb - ); - $comment_textual = sprintf( - $link, - '#comments', - sprintf(__('%d comments'), $nb) - ); - } + if ($w->comment_str != '' && $_ctx->posts->commentsActive()) { + $nb = $_ctx->posts->nb_comment; + if ($nb == 0) { + $comment_numeric = 0; + $comment_textual = __('no comment'); + } elseif ($nb == 1) { + $comment_numeric = sprintf( + $link, + '#comments', + 1 + ); + $comment_textual = sprintf( + $link, + '#comments', + __('one comment') + ); + } else { + $comment_numeric = sprintf( + $link, + '#comments', + $nb + ); + $comment_textual = sprintf( + $link, + '#comments', + sprintf(__('%d comments'), $nb) + ); + } - $content .= postInfoWidget::li( - $w, - 'comment', - str_replace( - array('%T', '%D'), - array($comment_textual, $comment_numeric), - html::escapeHTML($w->comment_str) - ) - ); - } + $content .= postInfoWidget::li( + $w, + 'comment', + str_replace( + ['%T', '%D'], + [$comment_textual, $comment_numeric], + html::escapeHTML($w->comment_str) + ) + ); + } - if ($w->trackback_str != '' && $_ctx->posts->trackbacksActive()) { - $nb = $_ctx->posts->nb_trackback; - if ($nb == 0) { - $trackback_numeric = 0; - $trackback_textual = __('no trackback'); - } - elseif ($nb == 1) { - $trackback_numeric = sprintf( - $link, - '#pings', - 1 - ); - $trackback_textual = sprintf( - $link, - '#pings', - __('one trackback') - ); - } - else { - $trackback_numeric = sprintf( - $link, - '#pings', - $nb - ); - $trackback_textual = sprintf( - $link, - '#pings', - sprintf(__('%d trackbacks'), $nb) - ); - } + if ($w->trackback_str != '' && $_ctx->posts->trackbacksActive()) { + $nb = $_ctx->posts->nb_trackback; + if ($nb == 0) { + $trackback_numeric = 0; + $trackback_textual = __('no trackback'); + } elseif ($nb == 1) { + $trackback_numeric = sprintf( + $link, + '#pings', + 1 + ); + $trackback_textual = sprintf( + $link, + '#pings', + __('one trackback') + ); + } else { + $trackback_numeric = sprintf( + $link, + '#pings', + $nb + ); + $trackback_textual = sprintf( + $link, + '#pings', + sprintf(__('%d trackbacks'), $nb) + ); + } - $content .= postInfoWidget::li( - $w, - 'trackback', - str_replace( - array('%T', '%D'), - array($trackback_textual, $trackback_numeric), - html::escapeHTML($w->trackback_str) - ) - ); - } + $content .= postInfoWidget::li( + $w, + 'trackback', + str_replace( + ['%T', '%D'], + array($trackback_textual, $trackback_numeric), + html::escapeHTML($w->trackback_str) + ) + ); + } - if ($w->permalink_str) { - $content .= postInfoWidget::li( - $w, - 'permalink', - str_replace( - array('%T', '%F'), - array( - sprintf( - $link, - $_ctx->posts->getURL(), - __('Permalink')), - $_ctx->posts->getURL() - ), - html::escapeHTML($w->permalink_str) - ) - ); - } + if ($w->permalink_str) { + $content .= postInfoWidget::li( + $w, + 'permalink', + str_replace( + ['%T', '%F'], + [ + sprintf( + $link, + $_ctx->posts->getURL(), + __('Permalink') + ), + $_ctx->posts->getURL() + ], + html::escapeHTML($w->permalink_str) + ) + ); + } - if ($w->feed && $_ctx->posts->commentsActive()) { - $content .= postInfoWidget::li( - $w, - 'feed', - sprintf( - $link, - $core->blog->url. - $core->url->getBase('feed'). - '/atom/comments/'. - $_ctx->posts->post_id, - __("This post's comments feed"), - html::escapeHTML($w->tag_str) - ) - ); - } + if ($w->feed && $_ctx->posts->commentsActive()) { + $content .= postInfoWidget::li( + $w, + 'feed', + sprintf( + $link, + $core->blog->url . + $core->url->getBase('feed') . + '/atom/comments/' . + $_ctx->posts->post_id, + __("This post's comments feed"), + html::escapeHTML($w->tag_str) + ) + ); + } - if ($w->navprevpost) { - $npp = postInfoWidget::nav( - $_ctx->posts, - -1, - false, - __('Previous entry'), - $w->navprevpost - ); - if ($npp) { - $content .= postInfoWidget::li( - $w, - 'previous', - $npp - ); - } - } - if ($w->navnextpost) { - $nnp = postInfoWidget::nav( - $_ctx->posts, - 1, - false, - __('Next entry'), - $w->navnextpost - ); - if ($nnp) { - $content .= postInfoWidget::li( - $w, - 'next', - $nnp - ); - } - } + if ($w->navprevpost) { + $npp = postInfoWidget::nav( + $_ctx->posts, + -1, + false, + __('Previous entry'), + $w->navprevpost + ); + if ($npp) { + $content .= postInfoWidget::li( + $w, + 'previous', + $npp + ); + } + } + if ($w->navnextpost) { + $nnp = postInfoWidget::nav( + $_ctx->posts, + 1, + false, + __('Next entry'), + $w->navnextpost + ); + if ($nnp) { + $content .= postInfoWidget::li( + $w, + 'next', + $nnp + ); + } + } - if ($w->navprevcat) { - $npc = postInfoWidget::nav( - $_ctx->posts, - -1, - true, - __('Previous entry of this category'), - $w->navprevcat - ); - if ($npc) { - $content .= postInfoWidget::li( - $w, - 'previous', - $npc - ); - } - } + if ($w->navprevcat) { + $npc = postInfoWidget::nav( + $_ctx->posts, + -1, + true, + __('Previous entry of this category'), + $w->navprevcat + ); + if ($npc) { + $content .= postInfoWidget::li( + $w, + 'previous', + $npc + ); + } + } - if ($w->navnextcat) { - $nnc = postInfoWidget::nav( - $_ctx->posts, - 1, - true, - __('Next entry of this category'), - $w->navnextcat - ); - if ($nnc) { - $content .= postInfoWidget::li( - $w, - 'next', - $nnc - ); - } - } + if ($w->navnextcat) { + $nnc = postInfoWidget::nav( + $_ctx->posts, + 1, + true, + __('Next entry of this category'), + $w->navnextcat + ); + if ($nnc) { + $content .= postInfoWidget::li( + $w, + 'next', + $nnc + ); + } + } - # --BEHAVIOR-- postInfoWidgetPublic - $content .= $core->callBehavior('postInfoWidgetPublic', $w); + # --BEHAVIOR-- postInfoWidgetPublic + $content .= $core->callBehavior('postInfoWidgetPublic', $w); - if (empty($content)) { + if (empty($content)) { + return null; + } +/* + $rmv = ''; + if ($w->rmvinfo || $w->rmvtags || $w->rmvnav) { + $rmv .= + '\n"; + } +//*/ + return $w->renderDiv( + $w->content_only, + 'postinfowidget ' . $w->class, + '', + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). + sprintf('
    %s
', $content) + ); + } - return null; - } + public static function li($w, $i, $c) + { + global $core; - $rmv = ''; - if ($w->rmvinfo || $w->rmvtags || $w->rmvnav) { - $rmv .= - '\n"; - } - - $rmv = - ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). - '
    '.$content.'
'; + $s = ' style="padding-left:%spx;background: transparent url(\'' . + $core->blog->getQmarkURL() . + 'pf=postInfoWidget/img/%s%s.png\') no-repeat left center;"'; + if ($w->style == 'small') { + $s = sprintf($s, 16, $i, '-small'); + } elseif($w->style == 'normal') { + $s = sprintf($s, 20, $i, ''); + } else { + $s = ''; + } + $l = ''; - return $w->renderDiv($w->content_only,'postinfowidget '.$w->class,'',$rmv); - } + return sprintf($l, $i, $s, $c); + } - public static function li($w, $i, $c) - { - $s = ' style="padding-left:%spx;background: transparent url(\''.$GLOBALS['core']->blog->getQmarkURL().'pf=postInfoWidget/img/%s%s.png\') no-repeat left center;"'; - if ($w->style == 'small') { - $s = sprintf($s, 16, $i, '-small'); - } - elseif($w->style == 'normal') { - $s = sprintf($s, 20, $i, ''); - } - else { - $s = ''; - } - $l = ''; + public static function nav($p, $d, $r, $t, $c) + { + global $core; - return sprintf($l, $i, $s, $c); - } + $rs = $core->blog->getNextPost($p, $d, $r); + if (is_null($rs)) { + return ''; + } + $l = '%s'; + $u = $rs->getURL(); + $e = html::escapeHTML($rs->post_title); - public static function nav($p, $d, $r, $t, $c) - { - global $core; - - $rs = $core->blog->getNextPost($p, $d, $r); - if ($rs !== null) { - $l = '%s'; - $u = $rs->getURL(); - $e = html::escapeHTML($rs->post_title); - - return str_replace( - array('%T', '%F'), - array(sprintf($l, $u, $e, $t), sprintf($l, $u, $t, $e)), - $c - ); - } - - return ''; - } + return str_replace( + ['%T', '%F'], + [sprintf($l, $u, $e, $t), sprintf($l, $u, $t, $e)], + $c + ); + } } \ No newline at end of file diff --git a/dcstore.xml b/dcstore.xml new file mode 100644 index 0000000..aac9d97 --- /dev/null +++ b/dcstore.xml @@ -0,0 +1,13 @@ + + +postInfoWidget +0.6 +Jean-Christian Denis, Pierre Van Glabeke +Show Entry informations on a widget +https://github.com/JcDenis/postInfoWidget/releases/download/v0.6/plugin-postInfoWidget.zip +2.19 +http://plugins.dotaddict.org/dc2/details/postInfoWidget + +http://forum.dotclear.org/viewtopic.php?pid=332974#p332974 + + \ 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..107fc3b --- /dev/null +++ b/locales/fr/main.lang.php @@ -0,0 +1,141 @@ + 1);\n" -#: _widgets.php:31 +#: _widgets.php:32 msgid "PostInfoWidget: entry information list" msgstr "PostInfoWidget : liste d'information du billet" -#: _widgets.php:34 +#: _widgets.php:35 msgid "Show Entry informations on a widget" msgstr "Afficher les informations d'un billet dans un widget" -#: _widgets.php:39 +#: _widgets.php:37 msgid "About this entry" msgstr "Á propos de ce billet" -#: _widgets.php:44 +#: _widgets.php:40 msgid "Publish date text:" msgstr "Texte pour la date de publication :" -#: _widgets.php:45 +#: _widgets.php:41 msgid "Publish on %Y-%m-%d %H:%M" msgstr "Publié le %d/%m/%Y à %H:%M" -#: _widgets.php:50 +#: _widgets.php:46 msgid "Create date text:" msgstr "Texte pour la date de création :" -#: _widgets.php:51 +#: _widgets.php:47 msgid "Create on %Y-%m-%d %H:%M" msgstr "Créé le %d/%m/%Y à %H:%M" -#: _widgets.php:56 +#: _widgets.php:52 msgid "Update date text:" msgstr "Texte pour la date de dernière mise à jour :" -#: _widgets.php:57 +#: _widgets.php:53 msgid "Update on %Y-%m-%d %H:%M" msgstr "Mis à jour le %d/%m/%Y à %H:%M" -#: _widgets.php:62 +#: _widgets.php:58 msgid "Language (%T = name, %C = code, %F = flag):" msgstr "Texte pour la langue (%T = nom, %C = code, %F = drapeau) :" -#: _widgets.php:63 +#: _widgets.php:59 msgid "Language: %T %F" msgstr "Langue : %T %F" -#: _widgets.php:68 +#: _widgets.php:64 msgid "Author text (%T = author):" msgstr "Texte pour l'auteur (%T = auteur) :" -#: _widgets.php:69 +#: _widgets.php:65 msgid "Author: %T" msgstr "Auteur : %T" -#: _widgets.php:74 +#: _widgets.php:70 msgid "Category text (%T = category):" msgstr "Texte pour la catégorie (%T = catégorie) :" -#: _widgets.php:75 +#: _widgets.php:71 msgid "Category: %T" msgstr "Catégorie : %T" -#: _widgets.php:81 +#: _widgets.php:78 msgid "Tags text (%T = tags list):" msgstr "Texte pour les mots-clés (%T = liste des mots-clés) :" -#: _widgets.php:82 +#: _widgets.php:79 msgid "Tags: %T" msgstr "Mots-clés : %T" -#: _widgets.php:88 +#: _widgets.php:87 msgid "Attachments text (%T = text, %D = numeric):" msgstr "Texte pour le nombre d'annexes (%T = texte, %D = nombre) :" -#: _widgets.php:89 +#: _widgets.php:88 msgid "Attachments: %T" msgstr "Annexes : %T" -#: _widgets.php:94 +#: _widgets.php:93 msgid "Comments text (%T = text, %D = numeric):" msgstr "Texte pour le nombre de commentaires (%T = texte, %D = nombre) :" -#: _widgets.php:95 +#: _widgets.php:94 msgid "Comments: %T" msgstr "Commentaires : %T" -#: _widgets.php:100 +#: _widgets.php:99 msgid "Trackbacks text (%T = text, %D = numeric):" msgstr "Texte pour le nombre de rétroliens (%T = texte, %D = nombre) :" -#: _widgets.php:101 +#: _widgets.php:100 msgid "Trackbacks: %T" msgstr "Rétroliens : %T" -#: _widgets.php:106 +#: _widgets.php:105 msgid "Permalink text (%T = text link, %F = full link):" msgstr "Texte pour le lien pemanent (%T = texte, %F = complet) :" -#: _widgets.php:107 -#: _widgets.php:119 -#: _widgets.php:125 -#: _widgets.php:131 -#: _widgets.php:137 +#: _widgets.php:106 +#: _widgets.php:118 +#: _widgets.php:124 +#: _widgets.php:130 +#: _widgets.php:136 msgid "%T" msgstr "%T" -#: _widgets.php:112 +#: _widgets.php:111 msgid "Show comment feed url" msgstr "Afficher l'URL du flux des commentaires" -#: _widgets.php:118 +#: _widgets.php:117 msgid "Link to previous entry (%T = navigation text, %F = entry title):" msgstr "Lien vers le billet précédent (%T = texte de navigation, %F = titre du billet) :" -#: _widgets.php:124 +#: _widgets.php:123 msgid "Link to next entry (%T = navigation text, %F = entry title):" msgstr "Lien vers le billet suivant (%T = texte de navigation, %F = titre du billet) :" -#: _widgets.php:130 +#: _widgets.php:129 msgid "Link to previous entry of this category (%T = navigation text, %F = entry title):" msgstr "Lien vers le billet précédent de la catégorie (%T = texte de navigation, %F = titre du billet) :" -#: _widgets.php:136 +#: _widgets.php:135 msgid "Link to next entry of this category (%T = navigation text, %F = entry title):" msgstr "Lien vers le billet suivant de la catégorie (%T = texte de navigation, %F = titre du billet) :" -#: _widgets.php:142 -msgid "Try to adapt style:" -msgstr "Essayer d'adapter le style :" - -#: _widgets.php:146 +#: _widgets.php:145 msgid "No style" msgstr "sans style" -#: _widgets.php:147 +#: _widgets.php:146 msgid "Small icon" msgstr "petite icône" -#: _widgets.php:148 +#: _widgets.php:147 msgid "Normal icon" msgstr "icône normale" -#: _widgets.php:153 +#: _widgets.php:154 msgid "Try to remove entry information" msgstr "Essayer de cacher les informations du billet" -#: _widgets.php:159 +#: _widgets.php:160 msgid "Try to remove entry tags" msgstr "Essayer de cacher la liste des mots-clés du billet" -#: _widgets.php:165 +#: _widgets.php:166 msgid "Try to remove entry navigation" msgstr "Essayer de cacher les liens de navigation" -#: _widgets.php:333 +#: _widgets.php:321 msgid "no attachment" msgstr "aucune annexe" -#: _widgets.php:344 -msgid "one attachment" -msgstr "une annexe" - -#: _widgets.php:356 -msgid "%d attachments" -msgstr "%d annexes" - -#: _widgets.php:375 +#: _widgets.php:361 msgid "no comment" msgstr "aucun commentaire" -#: _widgets.php:386 -msgid "one comment" -msgstr "un commentaire" - -#: _widgets.php:398 -msgid "%d comments" -msgstr "%d commentaires" - -#: _widgets.php:417 +#: _widgets.php:401 msgid "no trackback" msgstr "aucun rétrolien" -#: _widgets.php:428 -msgid "one trackback" -msgstr "un rétrolien" - -#: _widgets.php:440 -msgid "%d trackbacks" -msgstr "%d rétroliens" - -#: _widgets.php:494 +#: _widgets.php:477 msgid "Previous entry" msgstr "Billet précédent" -#: _widgets.php:510 +#: _widgets.php:493 msgid "Next entry" msgstr "Billet suivant" -#: _widgets.php:527 +#: _widgets.php:510 msgid "Previous entry of this category" msgstr "Billet précédent de cette catégorie" -#: _widgets.php:544 +#: _widgets.php:527 msgid "Next entry of this category" -msgstr "Billet suivant de cette catégorie" \ No newline at end of file +msgstr "Billet suivant de cette catégorie" + +msgid "Try to adapt style:" +msgstr "Essayer d'adapter le style :" +