Juin 02

Après avoir installé le b2evolution pour gérer les blogs de la famille, j’essaye de les personnaliser…

M’inspirant fortement d’un pluginW existant pour Google Analytics, je l’ai modifié pour écrire celui-ci :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
*
* This file implements the Piwik code plugin for {@link http://b2evolution.net/}.
*
* @copyright (c)2009 by Whiler - {@link https://blogs.wittwer.fr/whiler/}.
*
* @license GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
*
* @package plugins
*
* @author Whiler
*
* Inherit from:
* Google Analytics code plugin for {@link http://b2evolution.net/}.
* copyright (c)2008 by Foppe HEMMINGA - {@link http://www.blog.hemminga.net/}.
* license GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
* package plugins
* author Foppe Hemminga
*
*/

if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );

class piwik_plugin extends Plugin
{
var $name = 'Piwik code';
var $code = 'ADPiwik';
var $priority = 50;
var $version = '0.2';
var $author = 'Whiler';
var $help_url = 'https://blogs.wittwer.fr/whiler/index.php/misc/';
var $group = 'Amazing Discoveries';
var $apply_rendering = 'never';

function PluginInit( &amp; $params )
{
$this->short_desc = $this->T_('This plugin puts your Piwik code on every page.');
$this->long_desc = $this->T_('This plugin puts your Piwik code on every page allowing to track visits...');
}

function GetDefaultSettings()
{
return array(
'piwik_code' => array(
'label' => $this->T_('Code to insert'),
'type' => 'html_textarea',
'note' => $this->T_('Enter the code you obtained from Piwik. The code begins with &amp;lt;!-- Piwik --&amp;gt; and ends with &amp;lt;!-- End Piwik Tag --&amp;gt;')
),
'add_admin' => array(
'label' => $this->T_( 'Add script to admin pages' ),
'type' => 'checkbox',
'defaultvalue' => 0,
// 'note' => this->T_( ''),
),
);
}

function GetDefaultUserSettings()
{
return array(
);
}

/**
* Puts the Piwik code in the footer of every blog page
*
*/

function SkinEndHtmlBody()
{
// Get the DefaultSetting we created earlier
$piwikCode = $this->Settings->get( 'piwik_code' ); // Retrieve the user setting
if ( $piwikCode != '' ) // Skip if the variable is empty. You could do some basic checks on how the code is entered.
{
print $piwikCode;
} // End if
} // End function

function AdminAfterPageFooter( &amp;$params )
{
if( $this->Settings->get( 'add_admin' ) )
{
// Get the DefaultSetting we created earlier
$piwikCode = $this->Settings->get( 'piwik_code' ); // Retreive the user setting
if ( $piwikCode != '' ) // Skip if the variable is empty. You could do some basic checks on how the code is entered.
{
print $piwikCode;
} // End if
} // End if
} // End function

/**
* @version 0.2
* @date 2009-06-02
* @author Whiler
*/

}
?>

Bien sûr, ce plugin peut également être utilisé pour insérer tout autre bout de code en fonction de ce qui a été mis dans le champ code de l’administration de celui-ci depuis le back office…

Vous pouvez télécharger ce fichier à l’adresse suivante : _piwik.plugin

Share

Lien permanent vers Plugin pour inclure Piwik dans b2evolution Rédigé par Whiler \\ Tags : , , , , , ,

Une réponse pour “Plugin pour inclure Piwik dans b2evolution”

  1. Whiler a dit :

    Avec WordPress, je me suis contenté d’installer une extension existante via l’interface d’administration. (y)

    Répondre

Laisser une réponse

(requis)

(requis)

*

;) (lol) (y) |-( (hi) 8-) (angel) :s (clap) (bow) (tmi) (:| plus »

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.