-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.php
55 lines (48 loc) · 1.63 KB
/
action.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
50
51
52
53
54
55
<?php
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\EventHandler;
use dokuwiki\Extension\Event;
/**
* Webmaster Tools plugin.
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Mark C. Prins <[email protected]>
* @author Marius Rieder <[email protected]>
*/
class action_plugin_webmaster extends ActionPlugin
{
public function register(EventHandler $controller)
{
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'addVerifyHeaders', []);
}
public function addVerifyHeaders(Event $event, $param)
{
if (empty($event->data) || empty($event->data['meta'])) {
return;
}
/* Google */
$g = $this->getConf('webmaster_google');
if (!empty($g)) {
$g = ['name' => 'google-site-verification', 'content' => $g];
$event->data['meta'][] = $g;
}
/* bing */
$b = $this->getConf('webmaster_bing');
if (!empty($b)) {
$b = ['name' => 'msvalidate.01', 'content' => $b];
$event->data['meta'][] = $b;
}
/* Yandex */
$y = $this->getConf('webmaster_yandexkey');
if (!empty($y)) {
$y = ['name' => 'yandex-verification', 'content' => $y];
$event->data['meta'][] = $y;
}
/* Pinterest */
$y = $this->getConf('webmaster_pinterestkey');
if (!empty($y)) {
$y = ['name' => 'p:domain_verify', 'content' => $y];
$event->data['meta'][] = $y;
}
}
}