2015.04.23

This commit is contained in:
brol 2015-04-23 19:27:33 +02:00
parent 3431616cff
commit df834b7d1d
7 changed files with 531 additions and 0 deletions

20
CHANGELOG Normal file
View File

@ -0,0 +1,20 @@
myBlogNumbers 2015.04.23 - Pierre Van Glabeke
* modif url support
myBlogNumbers 2015.01.20 - Pierre Van Glabeke
* Ajout hors ligne dans widget (dc2.7)
* Corrections typo
myBlogNumbers 2013.11.12
* Use plural form
* Add options to widgets
myBlogNumbers 2013.06.29
* Used new 'homeonly' option
* Fixed text for 0 count
myBlogNumbers 0.2 - 2010-06-05
* Switched to DC 2.2
myBlogNumbers 0.1 - 2009-10-16
* First lab release

19
_admin.php Normal file
View File

@ -0,0 +1,19 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of myBlogNumbers, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
require dirname(__FILE__).'/_widgets.php';

35
_define.php Normal file
View File

@ -0,0 +1,35 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of myBlogNumbers, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return null;
}
$this->registerModule(
/* Name */
"myBlogNumbers",
/* Description*/
"Show some figures of your blog",
/* Author */
"Jean-Christian Denis, Pierre Van Glabeke",
/* Version */
'2015.04.23',
array(
'permissions' => 'usage,contentadmin',
'type' => 'plugin',
'dc_min' => '2.7',
'support' => 'http://forum.dotclear.org/viewtopic.php?id=40934',
'details' => 'http://plugins.dotaddict.org/dc2/details/myBlogNumbers'
)
);

0
_disabled Normal file
View File

154
_public.php Normal file
View File

@ -0,0 +1,154 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of myBlogNumbers, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return null;
}
require dirname(__FILE__).'/_widgets.php';
function myBlogNumbersWidgetPublic($w)
{
global $core;
$content = $addons = '';
$s_line = '<li>%s%s</li>';
$s_title = '<strong>%s</strong> ';
if ($w->offline)
return;
# Home only
if ($w->homeonly == 1 && $core->url->type != 'default'
|| $w->homeonly == 2 && $core->url->type == 'default'
) {
return;
}
# Entry
if ($w->entry_show) {
$title = $w->entry_title ?
sprintf($s_title, html::escapeHTML($w->entry_title)) : '';
$count = $core->blog->getPosts(array(), true)->f(0);
$text = $count == 0 ?
sprintf(__('no entries'), $count) :
sprintf(__('one entry', '%s entries', $count), $count);
$content .= sprintf($s_line, $title, $text);
}
# Cat
if ($w->cat_show) {
$title = $w->cat_title ?
sprintf($s_title, html::escapeHTML($w->cat_title)) : '';
$count = $core->blog->getCategories(array())->count();
$text = $count == 0 ?
sprintf(__('no categories'), $count) :
sprintf(__('one category', '%s categories', $count), $count);
$content .= sprintf($s_line, $title, $text);
}
# Comment
if ($w->comment_show) {
$title = $w->comment_title ?
sprintf($s_title, html::escapeHTML($w->comment_title)) : '';
$params = array(
'post_type' => 'post',
'comment_status' => 1,
'comment_trackback' => 0
);
$count = $core->blog->getComments($params, true)->f(0);
$text = $count == 0 ?
sprintf(__('no comments'),$count) :
sprintf(__('one comment', '%s comments', $count), $count);
$content .= sprintf($s_line,$title,$text);
}
# Trackback
if ($w->trackback_show) {
$title = $w->trackback_title ?
sprintf($s_title, html::escapeHTML($w->trackback_title)) : '';
$params = array(
'post_type' => 'post',
'comment_status' => 1,
'comment_trackback' => 1
);
$count = $core->blog->getComments($params, true)->f(0);
$text = $count == 0 ?
sprintf(__('no trackbacks'),$count) :
sprintf(__('one trackback', '%s trackbacks', $count), $count);
$content .= sprintf($s_line,$title,$text);
}
# Tag
if ($core->plugins->moduleExists('tags') && $w->tag_show) {
$title = $w->tag_title ?
sprintf($s_title,html::escapeHTML($w->tag_title)) : '';
$count = $core->con->select(
'SELECT count(M.meta_id) AS count '.
'FROM '.$core->prefix.'meta M '.
'LEFT JOIN '.$core->prefix.'post P ON P.post_id=M.post_id '.
"WHERE M.meta_type='tag' ".
"AND P.blog_id='".$core->blog->id."' "
)->f(0);
$text = $count == 0 ?
sprintf(__('no tags'), $count) :
sprintf(__('one tag', '%s tags', $count), $count);
$content .= sprintf($s_line, $title, $text);
}
# User (that post)
if ($w->user_show) {
$title = $w->user_title ?
sprintf($s_title, html::escapeHTML($w->user_title)) : '';
$count = $core->blog->getPostsUsers(array(),true)->count();
$text = $count == 0 ?
sprintf(__('no author'), $count) :
sprintf(__('one author', '%s authors', $count), $count);
$content .= sprintf($s_line,$title,$text);
}
# --BEHAVIOR-- myBlogNumbersWidgetParse
$addons = $core->callBehavior('myBlogNumbersWidgetParse', $core, $w);
# Nothing to display
if (!$content && !$addons) {
return null;
}
# Display
$res =
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
'<ul>'.$content.$addons.'</ul>';
return $w->renderDiv($w->content_only,'myblognumbers '.$w->class,'',$res);
}

154
_widgets.php Normal file
View File

@ -0,0 +1,154 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of myBlogNumbers, a plugin for Dotclear 2.
#
# Copyright (c) 2009-2015 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
return null;
}
$core->addBehavior('initWidgets', 'myBlogNumbersWidgetAdmin');
function myBlogNumbersWidgetAdmin($w)
{
global $core;
$w->create(
'myblognumbers',
__('My blog numbers'),
'myBlogNumbersWidgetPublic',
null,
__('Show some figures of your blog')
);
$w->myblognumbers->setting(
'title',
__('Title:'),
__('My blog numbers'),
'text'
);
# Entry
$w->myblognumbers->setting(
'entry_show',
__('Show entries count'),
1,
'check'
);
$w->myblognumbers->setting(
'entry_title',
__('Title for entries count:'),
__('Entries:'),
'text'
);
# Cat
$w->myblognumbers->setting(
'cat_show',
__('Show categories count'),
1,
'check'
);
$w->myblognumbers->setting(
'cat_title',
__('Title for categories count:'),
__('Categories:'),
'text'
);
# Comment
$w->myblognumbers->setting(
'comment_show',
__('Show comments count'),
1,
'check'
);
$w->myblognumbers->setting(
'comment_title',
__('Title for comments count:'),
__('Comments:'),
'text'
);
# Trackback
$w->myblognumbers->setting(
'trackback_show',
__('Show trackbacks count'),
1,
'check'
);
$w->myblognumbers->setting(
'trackback_title',
__('Title for trackbacks count:'),
__('Trackbacks:'),
'text'
);
if ($core->plugins->moduleExists('tags')) {
# Tag
$w->myblognumbers->setting(
'tag_show',
__('Show tags count'),
1,
'check'
);
$w->myblognumbers->setting(
'tag_title',
__('Title for tags count:'),
__('Tags:'),
'text'
);
}
# Users (that post)
$w->myblognumbers->setting(
'user_show',
__('Show users count'),
1,
'check'
);
$w->myblognumbers->setting(
'user_title',
__('Title for users count:'),
__('Authors:'),
'text'
);
# --BEHAVIOR-- myBlogNumbersWidgetInit
$core->callBehavior('myBlogNumbersWidgetInit',$w);
# widget option - page to show on
$w->myblognumbers->setting(
'homeonly',
__('Display on:'),
0,
'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
)
);
# widget option - content only
$w->myblognumbers->setting(
'content_only',
__('Content only'),
0,
'check'
);
# widget option - additionnal CSS
$w->myblognumbers->setting(
'class',
__('CSS class:'),
''
);
$w->myblognumbers->setting('offline',__('Offline'),0,'check');
}

149
locales/fr/main.po Normal file
View File

@ -0,0 +1,149 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: myBlogNumbers 2013.11.12\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2013-06-29T01:52:45+00:00\n"
"Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Show some figures of your blog"
msgstr "Afficher quelques chiffres de votre blog"
#: _public.php:41
msgid "no entries"
msgstr "aucun billet"
#: _public.php:45
msgid "one entry"
msgid_plural "%s entries"
msgstr[0] "un billet"
msgstr[1] "%s billets"
#: _public.php:65
msgid "no categories"
msgstr "aucune catégorie"
#: _public.php:69
msgid "one category"
msgid_plural "%s categories"
msgstr[0] "une catégorie"
msgstr[1] "%s catégories"
#: _public.php:94
msgid "no comments"
msgstr "aucun commentaire"
#: _public.php:102
msgid "one comment"
msgid_plural "%s comments"
msgstr[0] "un commentaire"
msgstr[1] "%s commentaires"
#: _public.php:123
msgid "no trackbacks"
msgstr "aucun rétrolien"
#: _public.php:131
msgid "one trackback"
msgid_plural "%s trackbacks"
msgstr[0] "un rétrolien"
msgstr[1] "%s rétroliens"
#: _public.php:153
msgid "no tags"
msgstr "aucun mot-clé"
#: _public.php:157
msgid "one tag"
msgid_plural "%s tags"
msgstr[0] "un mot-clé"
msgstr[1] "%s mots-clés"
#: _public.php:177
msgid "no author"
msgstr "aucun auteur"
#: _public.php:181
msgid "one author"
msgid_plural "%s authors"
msgstr[0] "un auteur"
msgstr[1] "%s auteurs"
#: _widgets.php:21
#: _widgets.php:24
msgid "My blog numbers"
msgstr "Mon blog en chiffres"
#: _widgets.php:27
msgid "Show entries count"
msgstr "Afficher le nombre de billets"
#: _widgets.php:28
msgid "Title for entries count:"
msgstr "Titre pour le nombre de billets :"
#: _widgets.php:29
msgid "Entries:"
msgstr "Billets :"
#: _widgets.php:32
msgid "Show categories count"
msgstr "Afficher le nombre de catégories"
#: _widgets.php:33
msgid "Title for categories count:"
msgstr "Titre pour le nombre de catégories :"
#: _widgets.php:34
msgid "Categories:"
msgstr "Catégories :"
#: _widgets.php:37
msgid "Show comments count"
msgstr "Afficher le nombre de commentaires"
#: _widgets.php:38
msgid "Title for comments count:"
msgstr "Titre pour le nombre de commentaires :"
#: _widgets.php:39
msgid "Comments:"
msgstr "Commentaires :"
#: _widgets.php:42
msgid "Show trackbacks count"
msgstr "Afficher le nombre de rétroliens"
#: _widgets.php:43
msgid "Title for trackbacks count:"
msgstr "Titre pour le nombre de rétroliens :"
#: _widgets.php:44
msgid "Trackbacks:"
msgstr "Rétroliens :"
#: _widgets.php:49
msgid "Show tags count"
msgstr "Afficher le nombre de mots-clés"
#: _widgets.php:50
msgid "Title for tags count:"
msgstr "Titre pour le nombre de mots-clés :"
msgid "Tags:"
msgstr "Mots-clés :"
#: _widgets.php:55
msgid "Show users count"
msgstr "Afficher le nombre d'auteurs"
#: _widgets.php:56
msgid "Title for users count:"
msgstr "Titre pour le nombre d'auteurs :"
#: _widgets.php:57
msgid "Authors:"
msgstr "Auteurs :"