forked from franck-paul/googleTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_admin.php
executable file
·49 lines (46 loc) · 2.07 KB
/
_admin.php
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
<?php
/**
* @brief googleTools, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugins
*
* @author xave and contributors
*
* @copyright xave
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
// dead but useful code, in order to have translations
__('Google Tools') . __('Handles Google tools (Analytics & Webmaster Tools)');
dcCore::app()->addBehavior('adminBlogPreferencesForm', ['googlestuffAdminBehaviours', 'adminBlogPreferencesForm']);
dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', ['googlestuffAdminBehaviours', 'adminBeforeBlogSettingsUpdate']);
class googlestuffAdminBehaviours
{
public static function adminBlogPreferencesForm($core, $settings)
{
$settings->addNameSpace('googlestuff');
echo
'<div class="fieldset"><h4 id="google-tools">Google Stuff</h4>' .
'<p><label>' .
__('Google Analytics UACCT (ID):') . ' ' .
form::field('googlestuff_uacct', 25, 50, $settings->googlestuff->googlestuff_uacct) .
'</label></p>' .
'<p><label>' .
__('Google Webmaster Tools verification:') . ' ' .
form::field('googlestuff_verify', 50, 100, $settings->googlestuff->googlestuff_verify) .
'</label></p>' .
'<p>' . form::checkbox('cnil_cookies', 1, dcCore::app()->blog->settings->googlestuff->cnil_cookies) .
'<label class="classic" for="cnil_cookies">' . __('Includes CNIL consent for Google Analytics tracking cookies') . '</label>' . '</p>' .
'</div>';
}
public static function adminBeforeBlogSettingsUpdate($settings)
{
$settings->addNameSpace('googlestuff');
$settings->googlestuff->put('googlestuff_uacct', empty($_POST['googlestuff_uacct']) ? '' : $_POST['googlestuff_uacct'], 'string');
$settings->googlestuff->put('googlestuff_verify', empty($_POST['googlestuff_verify']) ? '' : $_POST['googlestuff_verify'], 'string');
$settings->googlestuff->put('cnil_cookies', empty($_POST['cnil_cookies']) ? '' : $_POST['cnil_cookies'], 'boolean');
}
}