1.5.1
This commit is contained in:
parent
b262337f3a
commit
e5ad2dbc0f
33
CHANGELOG
Normal file
33
CHANGELOG
Normal file
@ -0,0 +1,33 @@
|
||||
v 1.5.1 - 22-04-2015 - Pierre Van Glabeke
|
||||
* nommage widget
|
||||
* modifs localisation
|
||||
|
||||
v 1.5 - Pierre Van Glabeke
|
||||
* compatibilité dc2.7
|
||||
|
||||
v 1.4.1 - Pierre Van Glabeke
|
||||
* Ajustements settings
|
||||
* Fin de ligne unix
|
||||
* complément _define.php
|
||||
|
||||
v 1.4 - Pierre Van Glabeke
|
||||
* Modifs affichage pour le widget (remplacement paragraphe par une liste)
|
||||
|
||||
v 1.3.1
|
||||
* Ajout choix affichage page pour le widget (content only + css)
|
||||
|
||||
v 1.3
|
||||
* Ajout choix affichage page pour le widget
|
||||
* Correction de traduction
|
||||
|
||||
v 1.2
|
||||
* Ajout du piochage automatique de la date du blog si non saisie dans le widget
|
||||
* Ajout @ devant la fonction checkdate pour eviter un warning
|
||||
|
||||
v 1.1
|
||||
* Compatibilité dc2.2
|
||||
* Localisation
|
||||
* Intégration corrections proposées sur http://www.myouaibe.com/index.php/post/2007/08/23/Plugin-BlogAnniv-pour-DOTCLEAR-2
|
||||
|
||||
v 1.0
|
||||
* Création
|
@ -1,9 +1,9 @@
|
||||
# bloganniv
|
||||
Décompte du nombre de jours avant et après la date anniversaire du blog
|
||||
Décompte du nombre de jours avant et après une date donnée
|
||||
|
||||
Ce plugin permet l'affichage dans la sidebar par le biais du widget de :
|
||||
|
||||
* une date de naissance (si vide, la date de naissance du blog sera prise en compte),
|
||||
* l'âge en années,
|
||||
* le nombre de jours restant avant et après l'anniversaire de votre blog.
|
||||
* le nombre de jours restant avant et après l'anniversaire de la date.
|
||||
|
||||
|
16
_admin.php
Normal file
16
_admin.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# This file is part of DotClear.
|
||||
#
|
||||
# Plugin Bloganniv by Francis Trautmann
|
||||
# Contributor: Pierre Van Glabeke
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) { return; }
|
||||
|
||||
require dirname(__FILE__).'/_widgets.php';
|
27
_define.php
Normal file
27
_define.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# This file is part of DotClear.
|
||||
#
|
||||
# Plugin Bloganniv by Francis Trautmann
|
||||
# Contributor: Pierre Van Glabeke
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
if (!defined('DC_RC_PATH')) { return; }
|
||||
$this->registerModule(
|
||||
/* Name */ "Blog Anniv",
|
||||
/* Description*/ "Counting the number of days before and after a particular date",
|
||||
/* Author */ "Fran6t, Pierre Van Glabeke",
|
||||
/* Version */ '1.5.1',
|
||||
/* Properties */
|
||||
array(
|
||||
'permissions' => 'blogAnniv',
|
||||
'type' => 'plugin',
|
||||
'dc_min' => '2.7',
|
||||
'support' => 'http://www.myouaibe.com/index.php/post/2007/08/23/Plugin-BlogAnniv-pour-DOTCLEAR-2',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/bloganniv'
|
||||
)
|
||||
);
|
138
_public.php
Normal file
138
_public.php
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# This file is part of DotClear.
|
||||
#
|
||||
# Plugin Bloganniv by Francis Trautmann
|
||||
# Contributor: Pierre Van Glabeke
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
if (!defined('DC_RC_PATH')) { return; }
|
||||
|
||||
require dirname(__FILE__).'/_widgets.php';
|
||||
|
||||
$core->tpl->addValue('blogAnniv',array('tplBlogAnniv','blogAnniv'));
|
||||
|
||||
class tplBlogAnniv
|
||||
{
|
||||
|
||||
public static function blogAnniv($attr)
|
||||
{
|
||||
$output = '';
|
||||
|
||||
if (isset($attr['text']))
|
||||
{
|
||||
$author = isset($attr['author']) ? ' <cite>'.$attr['author'].'</cite>' : '';
|
||||
|
||||
$output = '<blockquote>'.$attr['text'].$author.'</blockquote>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function BlogAnnivWidget($w)
|
||||
{
|
||||
global $core;
|
||||
|
||||
if ($w->offline)
|
||||
return;
|
||||
|
||||
// Si nous sommes pas en page accueil et que c'est coché page accueil uniquement on fait rien
|
||||
|
||||
if (($w->homeonly == 1 && $core->url->type != 'default') ||
|
||||
($w->homeonly == 2 && $core->url->type == 'default')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$title = $w->title ? html::escapeHTML($w->title) : __('Subscribe');
|
||||
$ftdatecrea = $w->ftdatecrea;
|
||||
//Si la date est vide nous recherchons la date en base
|
||||
if (strlen(rtrim($ftdatecrea))==0){
|
||||
///////////////////////////////////////////////
|
||||
//ACCES BDD
|
||||
//je récupère la date du blog
|
||||
require_once dirname(__FILE__).'/class.dc.dateBlog.php';
|
||||
|
||||
$lc = new dateBlog($GLOBALS['core']->blog);
|
||||
try {
|
||||
$Posts = $lc->getdateBlog();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
foreach($Posts->rows() as $k => $v)
|
||||
{
|
||||
$ftdatecrea = html::clean($v['blog_creadt']);
|
||||
$ftdatecrea = substr($ftdatecrea,0,10);
|
||||
$ftdatecrea = str_replace("-","/",$ftdatecrea);
|
||||
list($annee, $mois, $jour) = explode('/', $ftdatecrea);
|
||||
// On remet la date en forme française
|
||||
$ftdatecrea=$jour."/".$mois."/".$annee;
|
||||
#printf($ftdatecrea);
|
||||
#printf(html::clean($v['blog_id']));
|
||||
}
|
||||
//FIN ACCES BDD
|
||||
///////////////////////////////////////////////
|
||||
} else {
|
||||
list($jour, $mois, $annee) = explode('/', $ftdatecrea);
|
||||
}
|
||||
$nbrejours=0;
|
||||
$nbreannee=0;
|
||||
// Test si la date est valide
|
||||
if(@checkdate($mois,$jour,$annee)){
|
||||
// Ok nous pouvons calculer la date anniversaire et le nombre de jours restant avant
|
||||
|
||||
//Extraction des données
|
||||
list($jour2, $mois2, $annee2) = explode('-', date('d-m-Y'));
|
||||
|
||||
//Calcul des timestamp
|
||||
$timestamp1 = mktime(0,0,0,$mois,$jour,$annee2); // La date anniversaire cette année
|
||||
$timestamp2 = mktime(0,0,0,$mois2,$jour2,$annee2);
|
||||
//Affichage du nombre de jour
|
||||
|
||||
//je regarde si la date anniv n'est pas passé
|
||||
if (($timestamp2 - $timestamp1)> 0)
|
||||
{
|
||||
$timestamp1 = mktime(0,0,0,$mois,$jour,$annee2 + 1);
|
||||
$nbrejours = round(abs(mktime(0,0,0,$mois2,$jour2,$annee2) - $timestamp1)/86400);
|
||||
$nbreannee = abs($annee2 - $annee);
|
||||
}
|
||||
else {
|
||||
$nbrejours = abs($timestamp2 - $timestamp1)/86400;
|
||||
$nbreannee = abs($annee2 - $annee - 1);
|
||||
}
|
||||
// abs($timestamp2 - $timestamp1)/(86400*7); //Affichage du nombre de semaine : 3.85
|
||||
} else {
|
||||
$ftdatecrea= '$ftdatecrea date invalide';
|
||||
}
|
||||
$dispyearborn = $dispyear = "";
|
||||
// Si je dois afficher la date de naissance
|
||||
if ($w->dispyearborn) {
|
||||
$dispyearborn = '<li>'.__('Born:').
|
||||
' <span class="annivne">'.$ftdatecrea.'</span></li>';
|
||||
}
|
||||
// Si je dois afficher l'age en année
|
||||
if ($w->dispyear) {
|
||||
$dispyear = '<li>'.__('Age:').
|
||||
' <span class="annivan">'.$nbreannee.'</span> '.
|
||||
__('year(s)').
|
||||
'</li>';
|
||||
}
|
||||
|
||||
$res =
|
||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
|
||||
'<ul>'.
|
||||
$dispyearborn.
|
||||
$dispyear.
|
||||
'<li>'.__('Birthday in').
|
||||
' <span class="annivjrs">'.$nbrejours.'</span> '.
|
||||
__('day(s)').'</li></ul>';
|
||||
|
||||
return $w->renderDiv($w->content_only,'bloganniv '.$w->class,'',$res);
|
||||
|
||||
}
|
||||
}
|
40
_widgets.php
Normal file
40
_widgets.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# This file is part of DotClear.
|
||||
#
|
||||
# Plugin Bloganniv by Francis Trautmann
|
||||
# Contributor: Pierre Van Glabeke
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
if (!defined('DC_RC_PATH')) { return; }
|
||||
|
||||
$core->addBehavior('initWidgets',array('blogAnnivWidgets','initWidgets'));
|
||||
|
||||
class blogAnnivWidgets
|
||||
{
|
||||
public static function initWidgets($w)
|
||||
{
|
||||
global $core;
|
||||
$w->create('blogAnniv',__('Blog Anniv'),array('tplBlogAnniv','BlogAnnivWidget'),
|
||||
null,
|
||||
__('Counting the number of days before and after a particular date'));
|
||||
$w->blogAnniv->setting('title',__('Title :'),'');
|
||||
$w->blogAnniv->setting('ftdatecrea',__('Born Date (dd/mm/yyyy) or blank:'),'');
|
||||
$w->blogAnniv->setting('dispyearborn',__('Display Born Date'),1,'check');
|
||||
$w->blogAnniv->setting('dispyear',__('Display Year(s) Old'),1,'check');
|
||||
$w->blogAnniv->setting('homeonly',__('Display on:'),0,'combo',
|
||||
array(
|
||||
__('All pages') => 0,
|
||||
__('Home page only') => 1,
|
||||
__('Except on home page') => 2
|
||||
)
|
||||
);
|
||||
$w->blogAnniv->setting('content_only',__('Content only'),0,'check');
|
||||
$w->blogAnniv->setting('class',__('CSS class:'),'');
|
||||
$w->blogAnniv->setting('offline',__('Offline'),0,'check');
|
||||
}
|
||||
}
|
41
class.dc.dateBlog.php
Normal file
41
class.dc.dateBlog.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# This file is part of DotClear.
|
||||
#
|
||||
# Plugin Bloganniv by Francis Trautmann
|
||||
# Contributor: Pierre Van Glabeke
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
if (!defined('DC_RC_PATH')) {return;}
|
||||
class dateBlog
|
||||
{
|
||||
private $blog;
|
||||
private $con;
|
||||
|
||||
public function __construct($blog)
|
||||
{
|
||||
$this->blog =& $blog;
|
||||
$this->con =& $blog->con;
|
||||
}
|
||||
|
||||
public function getdateBlog()
|
||||
{
|
||||
$req = "SELECT blog_creadt,blog_id ".
|
||||
"FROM ".$this->blog->prefix."blog ".
|
||||
"WHERE blog_id = '".$this->blog->con->escape($this->blog->id)."' and blog_status = 1";
|
||||
try {
|
||||
$rs = $this->con->select($req);
|
||||
$rs = $rs->toStatic();
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $rs;
|
||||
|
||||
}
|
||||
}
|
38
locales/fr/main.po
Normal file
38
locales/fr/main.po
Normal file
@ -0,0 +1,38 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: brol <contact@brol.info>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=iso-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.5.7\n"
|
||||
|
||||
msgid "Counting the number of days before and after a particular date"
|
||||
msgstr "Décompte du nombre de jours avant et après une date donnée"
|
||||
|
||||
msgid "Born Date (dd/mm/yyyy) or blank:"
|
||||
msgstr "Date de naissance (jj/mm/aaaa) ou vide :"
|
||||
|
||||
msgid "Display Born Date"
|
||||
msgstr "Affichage date de naissance"
|
||||
|
||||
msgid "Display Year(s) Old"
|
||||
msgstr "Affichage âge en année(s)"
|
||||
|
||||
msgid "Born:"
|
||||
msgstr "Né le :"
|
||||
|
||||
msgid "Age:"
|
||||
msgstr "Âge :"
|
||||
|
||||
msgid "year(s)"
|
||||
msgstr "an(s)"
|
||||
|
||||
msgid "Birthday in"
|
||||
msgstr "Anniversaire dans"
|
||||
|
||||
msgid "day(s)"
|
||||
msgstr "jour(s)"
|
Loading…
Reference in New Issue
Block a user