clean up 2021
This commit is contained in:
parent
d6be467e63
commit
6857691733
11 changed files with 539 additions and 459 deletions
31
CHANGELOG.md
Normal file
31
CHANGELOG.md
Normal file
|
@ -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
|
23
LICENSE
23
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., <http://fsf.org/>
|
||||
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}
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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
|
||||
<signature of Ty Coon>, 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.
|
||||
|
||||
|
|
24
README.md
24
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
|
||||
|
|
|
@ -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';
|
||||
require dirname(__FILE__) . '/_widgets.php';
|
32
_define.php
32
_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'
|
||||
]
|
||||
);
|
|
@ -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';
|
||||
require dirname(__FILE__) . '/_widgets.php';
|
600
_widgets.php
600
_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 = '<span class="topcomments-rank">' . $i . '</span>';
|
||||
|
||||
$i++;
|
||||
$rank = '<span class="topcomments-rank">'.$i.'</span>';
|
||||
if ($user->comment_site) {
|
||||
$author = '<a href="' . $user->comment_site . '" title="' .
|
||||
__('Author link') . '">' . $user->comment_author . '</a>';
|
||||
} else {
|
||||
$author = $user->comment_author;
|
||||
}
|
||||
$author = '<span class="topcomments-author">' . $author . '</span>';
|
||||
|
||||
if ($user->comment_site) {
|
||||
$author = '<a href="'.$user->comment_site.'" title="'.
|
||||
__('Author link').'">'.$user->comment_author.'</a>';
|
||||
}
|
||||
else {
|
||||
$author = $user->comment_author;
|
||||
}
|
||||
$author = '<span class="topcomments-author">'.$author.'</span>';
|
||||
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(
|
||||
'<li>%s</li>',
|
||||
str_replace(
|
||||
['%rank%', '%author%', '%count%'],
|
||||
[$rank, $author, $count],
|
||||
$w->text
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$content .= '<li>'.str_replace(
|
||||
array('%rank%', '%author%', '%count%'),
|
||||
array($rank, $author, $count),
|
||||
$w->text
|
||||
).'</li>';
|
||||
}
|
||||
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('<ul>%s</ul>', $content)
|
||||
);
|
||||
}
|
||||
|
||||
public static function topPost($w)
|
||||
{
|
||||
global $core;
|
||||
|
||||
return null;
|
||||
}
|
||||
if ($w->offline) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$res =
|
||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
|
||||
'<ul>'.$content.'</ul>';
|
||||
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 = '<span class="topentries-rank">' . $i . '</span>';
|
||||
|
||||
$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 = '<a href="' .
|
||||
$core->blog->url . $core->url->getBase("author") . '/' . $user->user_id . '" ' .
|
||||
'title="' . __('Author posts') . '">' . $author . '</a>';
|
||||
}
|
||||
elseif ($user->user_url) {
|
||||
$author = '<a href="' . $user->user_url . '" title="' .
|
||||
__('Author link') . '">' . $author . '</a>';
|
||||
}
|
||||
$author = '<span class="topentries-author">' . $author . '</span>';
|
||||
|
||||
$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(
|
||||
'<li>%s</li>',
|
||||
str_replace(
|
||||
['%rank%', '%author%', '%count%'],
|
||||
[$rank, $author, $count],
|
||||
$w->text
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$i++;
|
||||
$rank = '<span class="topentries-rank">'.$i.'</span>';
|
||||
if ($i < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$core->blog->settings->addNamespace('authormode');
|
||||
if ($core->blog->settings->authormode->authormode_active) {
|
||||
$author = '<a href="'.
|
||||
$core->blog->url.$core->url->getBase("author").'/'.$user->user_id.'" '.
|
||||
'title="'.__('Author posts').'">'.$author.'</a>';
|
||||
}
|
||||
elseif ($user->user_url) {
|
||||
$author = '<a href="'.$user->user_url.'" title="'.
|
||||
__('Author link').'">'.$author.'</a>';
|
||||
}
|
||||
$author = '<span class="topentries-author">'.$author.'</span>';
|
||||
return $w->renderDiv(
|
||||
$w->content_only,
|
||||
'topentries ' . $w->class,
|
||||
'',
|
||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
||||
sprintf('<ul>%s</ul>', $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 .= '<li>'.str_replace(
|
||||
array('%rank%', '%author%', '%count%'),
|
||||
array($rank, $author, $count),
|
||||
$w->text
|
||||
).'</li>';
|
||||
}
|
||||
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)) : '').
|
||||
'<ul>'.$content.'</ul>';
|
||||
|
||||
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 '';
|
||||
}
|
||||
}
|
25
changelog
25
changelog
|
@ -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
|
13
dcstore.xml
Normal file
13
dcstore.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="topWriter">
|
||||
<name>topWriter</name>
|
||||
<version>0.8</version>
|
||||
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
|
||||
<desc>Ranking of the most prolific writers and/or commentators</desc>
|
||||
<file>https://github.com/JcDenis/topWriter/releases/download/v0.8/plugin-topWriter.zip</file>
|
||||
<da:dcmin>2.19</da:dcmin>
|
||||
<da:details>http://plugins.dotaddict.org/dc2/details/topWriter</da:details>
|
||||
<da:section></da:section>
|
||||
<da:support>http://forum.dotclear.org/viewtopic.php?pid=333002#p333002</da:support>
|
||||
</module>
|
||||
</modules>
|
75
locales/fr/main.lang.php
Normal file
75
locales/fr/main.lang.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
// Language: Français
|
||||
// Module: topWriter - 0.8
|
||||
// Date: 2021-08-27 20:05:38
|
||||
// Translated with dcTranslater - 2021.08.18
|
||||
|
||||
#_widgets.php:28
|
||||
$GLOBALS['__l10n']['Top Writer: top comments'] = 'Top Writer : top commentaires';
|
||||
|
||||
#_widgets.php:31
|
||||
$GLOBALS['__l10n']['List users who write more comments'] = 'Liste les utilisateurs qui ont écrit le plus de commentaires';
|
||||
|
||||
#_widgets.php:33
|
||||
$GLOBALS['__l10n']['Top comments'] = 'Top commentaires';
|
||||
|
||||
#_widgets.php:42
|
||||
#_widgets.php:98
|
||||
$GLOBALS['__l10n']['Period:'] = 'Période :';
|
||||
|
||||
#_widgets.php:46
|
||||
#_widgets.php:102
|
||||
$GLOBALS['__l10n']['day'] = 'jour';
|
||||
|
||||
#_widgets.php:47
|
||||
#_widgets.php:103
|
||||
$GLOBALS['__l10n']['week'] = 'semaine';
|
||||
|
||||
#_widgets.php:48
|
||||
#_widgets.php:104
|
||||
$GLOBALS['__l10n']['month'] = 'mois';
|
||||
|
||||
#_widgets.php:49
|
||||
#_widgets.php:105
|
||||
$GLOBALS['__l10n']['year'] = 'année';
|
||||
|
||||
#_widgets.php:50
|
||||
#_widgets.php:106
|
||||
$GLOBALS['__l10n']['from begining'] = 'depuis le début';
|
||||
|
||||
#_widgets.php:65
|
||||
#_widgets.php:120
|
||||
$GLOBALS['__l10n']['Limit:'] = 'Limite :';
|
||||
|
||||
#_widgets.php:71
|
||||
$GLOBALS['__l10n']['Exclude post writer from list'] = 'Exclure de la liste les auteurs de billets';
|
||||
|
||||
#_widgets.php:84
|
||||
$GLOBALS['__l10n']['Top Writer: top entries'] = 'Top Writer : top billets';
|
||||
|
||||
#_widgets.php:87
|
||||
$GLOBALS['__l10n']['List users who write more posts'] = 'Liste les utilisateurs qui ont écrit le plus de billets';
|
||||
|
||||
#_widgets.php:89
|
||||
$GLOBALS['__l10n']['Top entries'] = 'Top billets';
|
||||
|
||||
#_widgets.php:190
|
||||
#_widgets.php:282
|
||||
$GLOBALS['__l10n']['Author link'] = 'Lien vers l\'auteur';
|
||||
|
||||
#_widgets.php:278
|
||||
$GLOBALS['__l10n']['Author posts'] = 'Billets de l\'auteur';
|
||||
|
||||
#_widgets.php:287
|
||||
$GLOBALS['__l10n']['no entries'] = 'aucun billet';
|
||||
|
||||
$GLOBALS['__l10n']['Ranking of the most prolific writers and/or commentators'] = 'Classement des plus prolifiques rédacteurs et/ou commentateurs';
|
||||
|
||||
$GLOBALS['__l10n']['one entries'] = 'un billet';
|
||||
|
||||
$GLOBALS['__l10n']['%s entries'] = '%s billets';
|
||||
|
||||
$GLOBALS['__l10n']['un comment'] = 'un commentaire';
|
||||
|
||||
$GLOBALS['__l10n']['%s comments'] = '%s commentaires';
|
||||
|
|
@ -1,101 +1,108 @@
|
|||
# Language: Français
|
||||
# Module: topWriter - 0.8
|
||||
# Date: 2021-08-27 20:05:38
|
||||
# Translated with translater 2021.08.18
|
||||
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: topWriter 0.4\n"
|
||||
"Project-Id-Version: topWriter 0.8\n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2013-11-12T17:15:44+00:00\n"
|
||||
"PO-Revision-Date: 2021-08-27T20:05:38+00:00\n"
|
||||
"Last-Translator: Jean-Christian Denis\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue