2015.04.22

This commit is contained in:
brol 2015-04-22 23:44:23 +02:00
parent 2f05697318
commit 100ef730e4
7 changed files with 426 additions and 2 deletions

26
CHANGELOG Normal file
View file

@ -0,0 +1,26 @@
v2015.04.22 - Pierre Van Glabeke
* modif url support
* suppression icône
v2015.01.29 - Pierre Van Glabeke
* ajout option hors ligne widget
* modif code pour affichage widget (compatibilité currywurst)
* modifs locales
v2013.11.12
* Tiny clean up and add options to widgets
v2013.06.30
* Used new 'homeonly' style for widgets
v0.5 - 2010-06-05
* Switched to DC 2.2
v0.4
* Added media update
* Moved public function to _public.php
* Fixed some l10n
v0.3
* Fixed php 5.3 compatibility
* Fixed wrong timezone

View file

@ -1,2 +1,22 @@
# lastBlogUpdate
Afficher dans un widget les dates de dernières mises à jour du blog
# README
## WHAT IS LASTBLOGUPDATE ?
"last blog update" is a plugin for the open-source
web publishing software called Dotclear.
Simply show visitors last update of posts, comments, etc of your blog.
## REQUIREMENTS
lastBlogUpdate requires:
* permissions to manage widgets
* Dotclear 2.6
## USAGE
First install lastBlogUpdate, manualy from a zip package or from
Dotaddict repository. (See Dotclear's documentation to know how do this)
Add and configure "Last blog update" from widgets manager.

19
_admin.php Normal file
View file

@ -0,0 +1,19 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of lastBlogUpdate, 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 lastBlogUpdate, 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 */
"lastBlogUpdate",
/* Description*/
"Show the dates of last updates of your blog in a widget",
/* Author */
"Jean-Christian Denis, Pierre Van Glabeke",
/* Version */
'2015.04.22',
array(
'permissions' => 'usage,contentadmin',
'type' => 'plugin',
'dc_min' => '2.6',
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332950#p332950',
'details' => 'http://plugins.dotaddict.org/dc2/details/lastBlogUpdate'
)
);

100
_public.php Normal file
View file

@ -0,0 +1,100 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of lastBlogUpdate, 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 lastBlogUpdateWidgetPublic($w)
{
global $core;
if ($w->offline)
return;
# Nothing to display
if ($w->homeonly == 1 && $core->url->type != 'default'
|| $w->homeonly == 2 && $core->url->type == 'default'
|| !$w->blog_show && !$w->post_show && !$w->comment_show && !$w->media_show
|| !$w->blog_text && !$w->post_text && !$w->comment_text && !$w->media_text) return;
$blog = $post = $comment = $media = $addons = '';
# Blog
if ($w->blog_show && $w->blog_text) {
$title = $w->blog_title ? '<strong>'.html::escapeHTML($w->blog_title).'</strong> ' : '';
$text = dt::str($w->blog_text, $core->blog->upddt, $core->blog->settings->system->blog_timezone);
$blog = sprintf('<li>%s%s</li>', $title, $text);
}
# Post
if ($w->post_show && $w->post_text) {
$rs = $core->blog->getPosts(array('limit' => 1, 'no_content' => true));
if (!$rs->isEmpty()) {
$title = $w->post_title ? '<strong>'.html::escapeHTML($w->post_title).'</strong> ' : '';
$text = dt::str($w->post_text, strtotime($rs->post_upddt), $core->blog->settings->system->blog_timezone);
$link = $rs->getURL();
$over = $rs->post_title;
$post = sprintf('<li>%s<a href="%s" title="%s">%s</a></li>', $title, $link, $over, $text);
}
}
# Comment
if ($w->comment_show && $w->comment_text) {
$rs = $core->blog->getComments(array('limit' => 1, 'no_content' => true));
if (!$rs->isEmpty()) {
$title = $w->comment_title ? '<strong>'.html::escapeHTML($w->comment_title).'</strong> ' : '';
$text = dt::str($w->comment_text, strtotime($rs->comment_upddt), $core->blog->settings->system->blog_timezone);
$link = $core->blog->url.$core->getPostPublicURL($rs->post_type, html::sanitizeURL($rs->post_url)).'#c'.$rs->comment_id;
$over = $rs->post_title;
$comment = sprintf('<li>%s<a href="%s" title="%s">%s</a></li>', $title, $link, $over, $text);
}
}
# Media
if ($w->media_show && $w->media_text) {
$rs = $core->con->select(
'SELECT media_upddt FROM '.$core->prefix.'media '.
"WHERE media_path='".$core->con->escape($core->blog->settings->system->public_path)."' ".
'ORDER BY media_upddt DESC '.$core->con->limit(1)
);
if (!$rs->isEmpty()) {
$title = $w->media_title ? '<strong>'.html::escapeHTML($w->media_title).'</strong> ' : '';
$text = dt::str($w->media_text, strtotime($rs->f('media_upddt')), $core->blog->settings->system->blog_timezone);
$media = sprintf('<li>%s%s</li>', $title, $text);
}
}
# --BEHAVIOR-- lastBlogUpdateWidgetParse
$addons = $core->callBehavior('lastBlogUpdateWidgetParse', $core, $w);
# Nothing to display
if (!$blog && !$post && !$comment && !$media && !$addons) {
return null;
}
# Display
$res =
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
'<ul>'.$blog.$post.$comment.$media.$addons.'</ul>';
return $w->renderDiv($w->content_only,'lastblogupdate '.$w->class,'',$res);
}

140
_widgets.php Normal file
View file

@ -0,0 +1,140 @@
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
#
# This file is part of lastBlogUpdate, 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', 'lastBlogUpdateWidgetAdmin');
function lastBlogUpdateWidgetAdmin($w)
{
global $core;
$w->create(
'lastblogupdate',
__('LastBlogUpdate: dates of lastest updates'),
'lastBlogUpdateWidgetPublic',
null,
"Show the dates of last updates of your blog in a widget"
);
$w->lastblogupdate->setting(
'title',
__('Title:'),
__('Dates of lastest updates'),
'text'
);
$w->lastblogupdate->setting(
'blog_show',
__('Show blog update'),
1,
'check'
);
$w->lastblogupdate->setting(
'blog_title',
__('Title for blog update:'),
__('Blog:'),
'text'
);
$w->lastblogupdate->setting(
'blog_text',
__('Text for blog update:'),
__('%Y-%m-%d %H:%M'),
'text'
);
$w->lastblogupdate->setting(
'post_show',
__('Show entry update'),
1,
'check'
);
$w->lastblogupdate->setting(
'post_title',
__('Title for entries update:'),
__('Entries:'),
'text'
);
$w->lastblogupdate->setting(
'post_text',
__('Text for entries update:'),
__('%Y-%m-%d %H:%M'),
'text'
);
$w->lastblogupdate->setting(
'comment_show',
__('Show comment update'),
1,
'check'
);
$w->lastblogupdate->setting(
'comment_title',
__('Title for comments update:'),
__('Comments:'),
'text'
);
$w->lastblogupdate->setting(
'comment_text',
__('Text for comments update:'),
__('%Y-%m-%d %H:%M'),
'text'
);
$w->lastblogupdate->setting(
'media_show',
__('Show media update'),
1,
'check'
);
$w->lastblogupdate->setting(
'media_title',
__('Title for media update:'),
__('Medias:'),
'text'
);
$w->lastblogupdate->setting(
'media_text',
__('Text for media update:'),
__('%Y-%m-%d %H:%M'),
'text'
);
# --BEHAVIOR-- lastBlogUpdateWidgetInit
$core->callBehavior('lastBlogUpdateWidgetInit', $w);
$w->lastblogupdate->setting(
'homeonly',
__('Display on:'),
0,
'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
)
);
$w->lastblogupdate->setting(
'content_only',
__('Content only'),
0,
'check'
);
$w->lastblogupdate->setting(
'class',
__('CSS class:'),
''
);
$w->lastblogupdate->setting('offline',__('Offline'),0,'check');
}

84
locales/fr/main.po Normal file
View file

@ -0,0 +1,84 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: lastBlogUpdate 2013.11.12\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2013-11-12T09:56:30+00:00\n"
"Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: _widgets.php:28
msgid "LastBlogUpdate: dates of lastest updates"
msgstr "LastBlogUpdate : dates des dernières mises à jour"
#: _widgets.php:36
msgid "Dates of lastest updates"
msgstr "Dates des dernières mises à jour"
#: _widgets.php:41
msgid "Show blog update"
msgstr "Afficher la date de mise à jour du blog"
#: _widgets.php:47
msgid "Title for blog update:"
msgstr "Titre pour la date de mise à jour du blog :"
#: _widgets.php:53
msgid "Text for blog update:"
msgstr "Texte pour la date de mise à jour du blog :"
#: _widgets.php:60
msgid "Show entry update"
msgstr "Afficher la date de mise à jour des billets"
#: _widgets.php:66
msgid "Title for entries update:"
msgstr "Titre pour la date de mise à jour des billets :"
#: _widgets.php:67
msgid "Entries:"
msgstr "Billets :"
#: _widgets.php:72
msgid "Text for entries update:"
msgstr "Texte pour la date de mise à jour des billets :"
#: _widgets.php:79
msgid "Show comment update"
msgstr "Afficher la date de mise à jour des commentaires"
#: _widgets.php:85
msgid "Title for comments update:"
msgstr "Titre pour la date de mise à jour des commentaires :"
#: _widgets.php:86
msgid "Comments:"
msgstr "Commentaires :"
#: _widgets.php:91
msgid "Text for comments update:"
msgstr "Texte pour la date de mise à jour des commentaires :"
#: _widgets.php:98
msgid "Show media update"
msgstr "Afficher la date de mise à jour des médias"
#: _widgets.php:104
msgid "Title for media update:"
msgstr "Titre pour la date de mise à jour des médias :"
#: _widgets.php:105
msgid "Medias:"
msgstr "Médias :"
#: _widgets.php:110
msgid "Text for media update:"
msgstr "Texte pour la date de mise à jour des médias :"
msgid "Show the dates of last updates of your blog in a widget"
msgstr "Afficher les dates des dernières mises à jour de votre blog"
msgid "Last blog update"
msgstr "Dernières mises à jour du blog"