diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..eb32804
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,31 @@
+topWriter x.x - xxxx.xx.xx
+ * literal rank of writer depending of num of com
+
+topWriter 0.8 - 2021.08.27
+- clean up (PSR2, short array, ...)
+- update widget class
+- fix translations
+- update license
+
+topWriter 0.7 - 25-04-2015 - Pierre Van Glabeke
+- Modification url support
+
+topWriter 0.6 - 23-01-2015 - Pierre Van Glabeke
+- Modifications locales pour widget
+
+topWriter 0.5 - 19-01-2015 - Pierre Van Glabeke
+- Compatibilité dc2.7
+
+topWriter 0.4 - 2013-11-12
+- Switch to Dotclear 2.6
+- Add widget options
+- Use plural forms
+
+topWriter 0.3 - 2010-10-06
+- Switched to DC 2.2
+- Fixed list order (thanks to Atv')
+
+topWriter 0.2 - 2009-08-10
+- Fixed php 5.3 compatibility
+- Fixed PostGreSQL compatibility
+- Added option to exclude post authors from comment list
\ 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 f70e342..ea33e0c 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,34 @@
# README
-## WHAT IS POSTINFOWIDGET ?
+## WHAT IS TOPWRITER ?
-postInfoWidget "Entry information list" is a plugin for the open-source
+"Top writer" is a plugin for the open-source
web publishing software called Dotclear.
-Show entry details in a widget.
+Show most active contributor on a widget.
## REQUIREMENTS
- postInfoWidget requires:
+ topWriter requires:
* permissions to manage widgets
* Dotclear 2.6
## USAGE
-First install postInfoWidget, manualy from a zip package or from
+First install topWriter, 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.
+Add and configure "Top writer" from widgets manager.
+There are two widget: entries and comments.
+
+## MORE
+
+ * License : GNU GPL v2
+ * Source & contribution : [GitHub Page](https://github.com/JcDenis/topWriter)
+ * Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/topWriter)
+
+## CONTRIBUTORS
+
+ * Jean-Chirstian Denis
+ * Pierre Van Glabeke
diff --git a/_admin.php b/_admin.php
index 5e05a70..b456899 100644
--- a/_admin.php
+++ b/_admin.php
@@ -3,7 +3,7 @@
#
# This file is part of topWriter, 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 dc29bbc..343a10d 100644
--- a/_define.php
+++ b/_define.php
@@ -3,7 +3,7 @@
#
# This file is part of topWriter, 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 */
- "topWriter",
- /* Description*/
- "Ranking of the most prolific writers and/or commentators",
- /* Author */
- "Jean-Christian Denis, Pierre Van Glabeke",
- /* Version */
- '0.7',
- array(
- 'permissions' => 'admin',
- 'type' => 'plugin',
- 'dc_min' => '2.6',
- 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=333002#p333002',
- 'details' => 'http://plugins.dotaddict.org/dc2/details/topWriter'
- )
+ 'topWriter',
+ 'Ranking of the most prolific writers and/or commentators',
+ 'Jean-Christian Denis, Pierre Van Glabeke',
+ '0.8',
+ [
+ 'permissions' => 'admin',
+ 'type' => 'plugin',
+ 'dc_min' => '2.19',
+ 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=333002#p333002',
+ 'details' => 'http://plugins.dotaddict.org/dc2/details/topWriter',
+ 'repository' => 'https://raw.githubusercontent.com/JcDenis/topWriter/master/dcstore.xml'
+ ]
);
\ No newline at end of file
diff --git a/_public.php b/_public.php
index 8d3fcca..efa292a 100644
--- a/_public.php
+++ b/_public.php
@@ -3,7 +3,7 @@
#
# This file is part of topWriter, 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';
\ No newline at end of file
+require dirname(__FILE__) . '/_widgets.php';
\ No newline at end of file
diff --git a/_widgets.php b/_widgets.php
index cd63808..dfb53a5 100644
--- a/_widgets.php
+++ b/_widgets.php
@@ -3,7 +3,7 @@
#
# This file is part of topWriter, 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,357 +12,331 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
-
- return null;
+ return null;
}
-$core->addBehavior('initWidgets', array('topWriterWidget', 'init'));
+$core->addBehavior('initWidgets', ['topWriterWidget', 'init']);
class topWriterWidget
{
- public static function init($w)
- {
+ public static function init($w)
+ {
#Top comments widget
- $w->create(
- 'topcom',
- __('Top Writer: top comments'),
- array('topWriterWidget', 'topCom'),
- null,
- __('List users who write more comments')
- );
- $w->topcom->setting(
- 'title',
- __('Title:'),
- __('Top comments'),
- 'text'
- );
- $w->topcom->setting(
- 'text',
- __('Text:'),
- '%author% (%count%)',
- 'text'
- );
- $w->topcom->setting(
- 'period',
- __('Period:'),
- 'year',
- 'combo',
- array(
- __('day') => 'day',
- __('week') => 'week',
- __('month') => 'month',
- __('year') => 'year',
- __('from begining') => ''
- )
- );
- $w->topcom->setting(
- 'sort',
- __('Sort:'),
- 'desc',
- 'combo',
- array(
- __('Ascending') => 'asc',
- __('Descending') => 'desc'
- )
- );
- $w->topcom->setting(
- 'limit',
- __('Limit:'),
- '10',
- 'text'
- );
- $w->topcom->setting(
- 'exclude',
- __('Exclude post writer from list'),
- 0,
- 'check'
- );
- $w->topcom->setting(
- 'homeonly',
- __('Display on:'),
- 0,
- 'combo',
- array(
- __('All pages') => 0,
- __('Home page only') => 1,
- __('Except on home page') => 2
- )
- );
- $w->topcom->setting('content_only',__('Content only'),0,'check');
- $w->topcom->setting('class',__('CSS class:'),'');
- $w->topcom->setting('offline',__('Offline'),0,'check');
+ $w
+ ->create(
+ 'topcom',
+ __('Top Writer: top comments'),
+ ['topWriterWidget', 'topCom'],
+ null,
+ __('List users who write more comments')
+ )
+ ->addTitle(__('Top comments'))
+ ->setting(
+ 'text',
+ __('Text:'),
+ '%author% (%count%)',
+ 'text'
+ )
+ ->setting(
+ 'period',
+ __('Period:'),
+ 'year',
+ 'combo',
+ [
+ __('day') => 'day',
+ __('week') => 'week',
+ __('month') => 'month',
+ __('year') => 'year',
+ __('from begining') => ''
+ ]
+ )
+ ->setting(
+ 'sort',
+ __('Sort:'),
+ 'desc',
+ 'combo',
+ [
+ __('Ascending') => 'asc',
+ __('Descending') => 'desc'
+ ]
+ )
+ ->setting(
+ 'limit',
+ __('Limit:'),
+ '10',
+ 'text'
+ )
+ ->setting(
+ 'exclude',
+ __('Exclude post writer from list'),
+ 0,
+ 'check'
+ )
+ ->addHomeOnly()
+ ->addContentOnly()
+ ->addClass()
+ ->addOffline();
- #Top entries widget
- $w->create(
- 'toppost',
- __('Top Writer: top entries'),
- array('topWriterWidget', 'topPost'),
- null,
- __('List users who write more posts')
- );
- $w->toppost->setting(
- 'title',
- __('Title:'),
- __('Top entries'),
- 'text'
- );
- $w->toppost->setting(
- 'text',
- __('Text:'),
- '%author% (%count%)',
- 'text'
- );
- $w->toppost->setting(
- 'period',
- __('Period:'),
- 'year',
- 'combo',
- array(
- __('day') => 'day',
- __('week') => 'week',
- __('month') => 'month',
- __('year') => 'year',
- __('from begining') => ''
- )
- );
- $w->toppost->setting(
- 'sort',
- __('Sort:'),'desc',
- 'combo',
- array(
- __('Ascending') => 'asc',
- __('Descending') => 'desc'
- )
- );
- $w->toppost->setting(
- 'limit',
- __('Limit:'),
- '10',
- 'text'
- );
- $w->toppost->setting(
- 'homeonly',
- __('Display on:'),
- 0,
- 'combo',
- array(
- __('All pages') => 0,
- __('Home page only') => 1,
- __('Except on home page') => 2
- )
- );
- $w->toppost->setting('content_only',__('Content only'),0,'check');
- $w->toppost->setting('class',__('CSS class:'),'');
- $w->toppost->setting('offline',__('Offline'),0,'check');
- }
+ #Top entries widget
+ $w
+ ->create(
+ 'toppost',
+ __('Top Writer: top entries'),
+ ['topWriterWidget', 'topPost'],
+ null,
+ __('List users who write more posts')
+ )
+ ->addTitle(__('Top entries'))
+ ->setting(
+ 'text',
+ __('Text:'),
+ '%author% (%count%)',
+ 'text'
+ )
+ ->setting(
+ 'period',
+ __('Period:'),
+ 'year',
+ 'combo',
+ [
+ __('day') => 'day',
+ __('week') => 'week',
+ __('month') => 'month',
+ __('year') => 'year',
+ __('from begining') => ''
+ ]
+ )
+ ->setting(
+ 'sort',
+ __('Sort:'),'desc',
+ 'combo',
+ [
+ __('Ascending') => 'asc',
+ __('Descending') => 'desc'
+ ]
+ )
+ ->setting(
+ 'limit',
+ __('Limit:'),
+ '10',
+ 'text'
+ )
+ ->addHomeOnly()
+ ->addContentOnly()
+ ->addClass()
+ ->addOffline();
+ }
- public static function topCom($w)
- {
- global $core;
+ public static function topCom($w)
+ {
+ global $core;
- if ($w->offline)
- return;
+ if ($w->offline) {
+ return null;
+ }
- if ($w->homeonly == 1 && $core->url->type != 'default'
- || $w->homeonly == 2 && $core->url->type == 'default'
- ) {
- return null;
- }
+ if (($w->homeonly == 1 && !$core->url->isHome($core->url->type))
+ || ($w->homeonly == 2 && $core->url->isHome($core->url->type))) {
+ return null;
+ }
- $req =
- 'SELECT COUNT(*) AS count, comment_email '.
- "FROM ".$core->prefix."post P, ".$core->prefix."comment C ".
- 'WHERE P.post_id=C.post_id '.
- "AND blog_id='".$core->con->escape($core->blog->id)."' ".
- 'AND post_status=1 AND comment_status=1 '.
- self::period('comment_dt',$w->period);
+ $req =
+ 'SELECT COUNT(*) AS count, comment_email ' .
+ "FROM " . $core->prefix . "post P, " . $core->prefix . "comment C " .
+ 'WHERE P.post_id=C.post_id ' .
+ "AND blog_id='" . $core->con->escape($core->blog->id) . "' " .
+ 'AND post_status=1 AND comment_status=1 ' .
+ self::period('comment_dt', $w->period);
- if ($w->exclude) {
- $req .=
- 'AND comment_email NOT IN ('.
- ' SELECT U.user_email '.
- ' FROM '.$core->prefix.'user U'.
- ' INNER JOIN '.$core->prefix.'post P ON P.user_id = U.user_id '.
- " WHERE blog_id='".$core->con->escape($core->blog->id)."' ".
- ' GROUP BY U.user_email) ';
- }
+ if ($w->exclude) {
+ $req .=
+ 'AND comment_email NOT IN (' .
+ ' SELECT U.user_email ' .
+ ' FROM ' . $core->prefix . 'user U' .
+ ' INNER JOIN ' . $core->prefix . 'post P ON P.user_id = U.user_id ' .
+ " WHERE blog_id='" . $core->con->escape($core->blog->id) . "' " .
+ ' GROUP BY U.user_email) ';
+ }
- $req .=
- 'GROUP BY comment_email '.
- 'ORDER BY count '.($w->sort == 'asc' ? 'ASC' : 'DESC').' '.
- $core->con->limit(abs((integer) $w->limit));
+ $req .=
+ 'GROUP BY comment_email ' .
+ 'ORDER BY count ' . ($w->sort == 'asc' ? 'ASC' : 'DESC') . ' ' .
+ $core->con->limit(abs((integer) $w->limit));
- $rs = $core->con->select($req);
+ $rs = $core->con->select($req);
- if ($rs->isEmpty()) {
+ if ($rs->isEmpty()) {
+ return null;
+ }
- return null;
- }
+ $content = '';
+ $i = 0;
+ while($rs->fetch()) {
+ $user = $core->con->select(
+ "SELECT * FROM " . $core->prefix . "comment " .
+ "WHERE comment_email='" . $rs->comment_email . "' " .
+ 'ORDER BY comment_dt DESC'
+ );
- $content = '';
- $i = 0;
- while($rs->fetch()) {
- $user = $core->con->select(
- "SELECT * FROM ".$core->prefix."comment ".
- "WHERE comment_email='".$rs->comment_email."' ".
- 'ORDER BY comment_dt DESC'
- );
+ if (!$user->comment_author) {
+ continue;
+ }
- if (!$user->comment_author) {
- continue;
- }
+ $i++;
+ $rank = '';
- $i++;
- $rank = '';
+ if ($user->comment_site) {
+ $author = '' . $user->comment_author . '';
+ } else {
+ $author = $user->comment_author;
+ }
+ $author = '';
- if ($user->comment_site) {
- $author = ''.$user->comment_author.'';
- }
- else {
- $author = $user->comment_author;
- }
- $author = '';
+ if ($rs->count == 0) {
+ $count = __('no comments');
+ } else {
+ $count = sprintf(__('one comment', '%s comments', $rs->count), $rs->count);
+ }
- if ($rs->count == 0) {
- $count = __('no comment');
- }
- else {
- $count = sprintf(__('one comment', '%s comments', $rs->count), $rs->count);
- }
+ $content .= sprintf(
+ '%s',
+ str_replace(
+ ['%rank%', '%author%', '%count%'],
+ [$rank, $author, $count],
+ $w->text
+ )
+ );
+ }
- $content .= ''.str_replace(
- array('%rank%', '%author%', '%count%'),
- array($rank, $author, $count),
- $w->text
- ).'';
- }
+ if ($i < 1) {
+ return null;
+ }
- if ($i < 1) {
+ return $w->renderDiv(
+ $w->content_only,
+ 'topcomments ' . $w->class,
+ '',
+ ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
+ sprintf('', $content)
+ );
+ }
+
+ public static function topPost($w)
+ {
+ global $core;
- return null;
- }
+ if ($w->offline) {
+ return null;
+ }
- $res =
- ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
- '';
+ if (($w->homeonly == 1 && !$core->url->isHome($core->url->type))
+ || ($w->homeonly == 2 && $core->url->isHome($core->url->type))) {
+ return null;
+ }
- return $w->renderDiv($w->content_only,'topcomments '.$w->class,'',$res);
- }
-
- public static function topPost($w)
- {
- global $core;
+ $rs = $core->con->select(
+ 'SELECT COUNT(*) AS count, U.user_id ' .
+ "FROM " . $core->prefix . "post P " .
+ 'INNER JOIN ' . $core->prefix . 'user U ON U.user_id = P.user_id ' .
+ "WHERE blog_id='" . $core->con->escape($core->blog->id) . "' " .
+ 'AND post_status=1 AND user_status=1 ' .
+ self::period('post_dt', $w->period) .
+ 'GROUP BY U.user_id ' .
+ 'ORDER BY count ' . ($w->sort == 'asc' ? 'ASC' : 'DESC') . ', U.user_id ASC ' .
+ $core->con->limit(abs((integer) $w->limit)));
- if ($w->offline)
- return;
+ if ($rs->isEmpty()) {
+ return null;
+ }
- if ($w->homeonly == 1 && $core->url->type != 'default'
- || $w->homeonly == 2 && $core->url->type == 'default'
- ) {
- return null;
- }
+ $content = '';
+ $i = 0;
+ while($rs->fetch()) {
+ $user = $core->con->select(
+ "SELECT * FROM " . $core->prefix . "user WHERE user_id='" . $rs->user_id . "' "
+ );
- $rs = $core->con->select(
- 'SELECT COUNT(*) AS count, U.user_id '.
- "FROM ".$core->prefix."post P ".
- 'INNER JOIN '.$core->prefix.'user U ON U.user_id = P.user_id '.
- "WHERE blog_id='".$core->con->escape($core->blog->id)."' ".
- 'AND post_status=1 AND user_status=1 '.
- self::period('post_dt',$w->period).
- 'GROUP BY U.user_id '.
- 'ORDER BY count '.($w->sort == 'asc' ? 'ASC' : 'DESC').', U.user_id ASC '.
- $core->con->limit(abs((integer) $w->limit)));
+ $author = dcUtils::getUserCN(
+ $user->user_id,
+ $user->user_name,
+ $user->user_firstname,
+ $user->user_displayname
+ );
- if ($rs->isEmpty()) {
+ if (empty($author)) {
+ continue;
+ }
- return null;
- }
+ $i++;
+ $rank = '' . $i . '';
- $content = '';
- $i = 0;
- while($rs->fetch()) {
- $user = $core->con->select(
- "SELECT * FROM ".$core->prefix."user WHERE user_id='".$rs->user_id."' "
- );
+ $core->blog->settings->addNamespace('authormode');
+ if ($core->blog->settings->authormode->authormode_active) {
+ $author = 'user_id . '" ' .
+ 'title="' . __('Author posts') . '">' . $author . '';
+ }
+ elseif ($user->user_url) {
+ $author = '' . $author . '';
+ }
+ $author = '' . $author . '';
- $author = dcUtils::getUserCN($user->user_id,$user->user_name,
- $user->user_firstname,$user->user_displayname);
+ if ($rs->count == 0) {
+ $count = __('no entries');
+ } else {
+ $count = sprintf(__('one entry', '%s entries', $rs->count), $rs->count);
+ }
- if (empty($author)) {
- continue;
- }
+ $content .= sprintf(
+ '%s',
+ str_replace(
+ ['%rank%', '%author%', '%count%'],
+ [$rank, $author, $count],
+ $w->text
+ )
+ );
+ }
- $i++;
- $rank = ''.$i.'';
+ if ($i < 1) {
+ return null;
+ }
- $core->blog->settings->addNamespace('authormode');
- if ($core->blog->settings->authormode->authormode_active) {
- $author = 'user_id.'" '.
- 'title="'.__('Author posts').'">'.$author.'';
- }
- elseif ($user->user_url) {
- $author = ''.$author.'';
- }
- $author = ''.$author.'';
+ return $w->renderDiv(
+ $w->content_only,
+ 'topentries ' . $w->class,
+ '',
+ ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
+ sprintf('', $content)
+ );
+ }
- if ($rs->count == 0) {
- $count = __('no post');
- }
- else {
- $count = sprintf(__('one post', '%s posts', $rs->count), $rs->count);
- }
+ private static function period($t, $p)
+ {
+ $pat = '%Y-%m-%d %H:%M:%S';
+ switch($p) {
+ case 'day':
+ return
+ "AND $t > TIMESTAMP '" . dt::str($pat, time() - 3600*24) . "' ";
+ break;
- $content .= ''.str_replace(
- array('%rank%', '%author%', '%count%'),
- array($rank, $author, $count),
- $w->text
- ).'';
- }
+ case 'week':
+ return
+ "AND $t > TIMESTAMP '" . dt::str($pat, time() - 3600*24*7) . "' ";
+ break;
- if ($i < 1) {
+ case 'month':
+ return
+ "AND $t > TIMESTAMP '" . dt::str($pat, time() - 3600*24*30) . "' ";
+ break;
- return null;
- }
+ case 'year':
+ return
+ "AND $t > TIMESTAMP '" . dt::str($pat, time() - 3600*24*30*12) . "' ";
+ break;
+ }
- $res =
- ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
- '';
-
- return $w->renderDiv($w->content_only,'topentries '.$w->class,'',$res);
- }
-
- private static function period($t,$p)
- {
- $pat = '%Y-%m-%d %H:%M:%S';
- switch($p) {
- case 'day':
-
- return
- "AND $t > TIMESTAMP '".dt::str($pat, time() - 3600*24)."' ";
- break;
-
- case 'week':
-
- return
- "AND $t > TIMESTAMP '".dt::str($pat, time() - 3600*24*7)."' ";
- break;
-
- case 'month':
-
- return
- "AND $t > TIMESTAMP '".dt::str($pat, time() - 3600*24*30)."' ";
- break;
-
- case 'year':
-
- return
- "AND $t > TIMESTAMP '".dt::str($pat, time() - 3600*24*30*12)."' ";
- break;
- }
-
- return '';
- }
+ return '';
+ }
}
\ No newline at end of file
diff --git a/changelog b/changelog
deleted file mode 100644
index f85f83f..0000000
--- a/changelog
+++ /dev/null
@@ -1,25 +0,0 @@
-topWriter x.x - xxxx-xx-xx
- * literal rank of writer depending of num of com
-
-topWriter 0.7 - 25-04-2015 - Pierre Van Glabeke
- * Modification url support
-
-topWriter 0.6 - 23-01-2015 - Pierre Van Glabeke
- * Modifications locales pour widget
-
-topWriter 0.5 - 19-01-2015 - Pierre Van Glabeke
- * Compatibilité dc2.7
-
-topWriter 0.4 - 2013-11-12
- * Switch to Dotclear 2.6
- * Add widget options
- * Use plural forms
-
-topWriter 0.3 - 2010-10-06
- * Switched to DC 2.2
- * Fixed list order (thanks to Atv')
-
-topWriter 0.2 - 2009-08-10
- * Fixed php 5.3 compatibility
- * Fixed PostGreSQL compatibility
- * Added option to exclude post authors from comment list
\ No newline at end of file
diff --git a/dcstore.xml b/dcstore.xml
new file mode 100644
index 0000000..7f4998b
--- /dev/null
+++ b/dcstore.xml
@@ -0,0 +1,13 @@
+
+
+topWriter
+0.8
+Jean-Christian Denis, Pierre Van Glabeke
+Ranking of the most prolific writers and/or commentators
+https://github.com/JcDenis/topWriter/releases/download/v0.8/plugin-topWriter.zip
+2.19
+http://plugins.dotaddict.org/dc2/details/topWriter
+
+http://forum.dotclear.org/viewtopic.php?pid=333002#p333002
+
+
\ 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..46e4689
--- /dev/null
+++ b/locales/fr/main.lang.php
@@ -0,0 +1,75 @@
+ 1);\n"
-#: _widgets.php:26
+#: _widgets.php:28
msgid "Top Writer: top comments"
msgstr "Top Writer : top commentaires"
-#: _widgets.php:34
-msgid "Top comments"
-msgstr "Top commentaires"
-
-#: _widgets.php:29
-msgid "List users who write more posts"
-msgstr "Liste les utilisateurs qui ont écrit le plus de billets"
-
-#: _widgets.php:45
-#: _widgets.php:122
-msgid "Period:"
-msgstr "Période :"
-
-#: _widgets.php:49
-#: _widgets.php:126
-msgid "day"
-msgstr "jour"
-
-#: _widgets.php:50
-#: _widgets.php:127
-msgid "week"
-msgstr "semaine"
-
-#: _widgets.php:51
-#: _widgets.php:128
-msgid "month"
-msgstr "mois"
-
-#: _widgets.php:52
-#: _widgets.php:129
-msgid "year"
-msgstr "année"
-
-#: _widgets.php:53
-#: _widgets.php:130
-msgid "from begining"
-msgstr "depuis le début"
-
-#: _widgets.php:68
-#: _widgets.php:144
-msgid "Limit:"
-msgstr "Limite :"
-
-#: _widgets.php:74
-msgid "Exclude post writer from list"
-msgstr "Exclure de la liste les auteurs de billets"
-
-#: _widgets.php:99
-msgid "Top Writer: top entries"
-msgstr "Top Writer : top billets"
-
-#: _widgets.php:111
-msgid "Top entries"
-msgstr "Top billets"
-
-#: _widgets.php:106
+#: _widgets.php:31
msgid "List users who write more comments"
msgstr "Liste les utilisateurs qui ont écrit le plus de commentaires"
-#: _widgets.php:230
-#: _widgets.php:318
+#: _widgets.php:33
+msgid "Top comments"
+msgstr "Top commentaires"
+
+#: _widgets.php:42
+#: _widgets.php:98
+msgid "Period:"
+msgstr "Période :"
+
+#: _widgets.php:46
+#: _widgets.php:102
+msgid "day"
+msgstr "jour"
+
+#: _widgets.php:47
+#: _widgets.php:103
+msgid "week"
+msgstr "semaine"
+
+#: _widgets.php:48
+#: _widgets.php:104
+msgid "month"
+msgstr "mois"
+
+#: _widgets.php:49
+#: _widgets.php:105
+msgid "year"
+msgstr "année"
+
+#: _widgets.php:50
+#: _widgets.php:106
+msgid "from begining"
+msgstr "depuis le début"
+
+#: _widgets.php:65
+#: _widgets.php:120
+msgid "Limit:"
+msgstr "Limite :"
+
+#: _widgets.php:71
+msgid "Exclude post writer from list"
+msgstr "Exclure de la liste les auteurs de billets"
+
+#: _widgets.php:84
+msgid "Top Writer: top entries"
+msgstr "Top Writer : top billets"
+
+#: _widgets.php:87
+msgid "List users who write more posts"
+msgstr "Liste les utilisateurs qui ont écrit le plus de billets"
+
+#: _widgets.php:89
+msgid "Top entries"
+msgstr "Top billets"
+
+#: _widgets.php:190
+#: _widgets.php:282
msgid "Author link"
msgstr "Lien vers l'auteur"
-#: _widgets.php:244
-msgid "one comment"
-msgid_plural "%s comments"
-msgstr[0] "un commentaire"
-msgstr[1] "%s commentaires"
-
-#: _widgets.php:314
+#: _widgets.php:278
msgid "Author posts"
msgstr "Billets de l'auteur"
-#: _widgets.php:323
-msgid "no post"
-msgstr "pas de billet"
-
-#: _widgets.php:326
-msgid "one post"
-msgid_plural "%s posts"
-msgstr[0] "un billet"
-msgstr[1] "%s billets"
+#: _widgets.php:287
+msgid "no entries"
+msgstr "aucun billet"
msgid "Ranking of the most prolific writers and/or commentators"
msgstr "Classement des plus prolifiques rédacteurs et/ou commentateurs"
+
+msgid "one entries"
+msgstr "un billet"
+
+msgid "%s entries"
+msgstr "%s billets"
+
+msgid "un comment"
+msgstr "un commentaire"
+
+msgid "%s comments"
+msgstr "%s commentaires"
+