Completed
Push — master ( d9d684...25c77a )
by Mark
14:29
created

action.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Webmaster Tools plugin.
4
 *
5
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6
 * @author     Mark C. Prins <[email protected]>
7
 * @author     Marius Rieder <[email protected]>
8
 */
9
10
if (!defined('DOKU_INC')) {
11
    die();
12
}
13
if (!defined('DOKU_PLUGIN')) {
14
    define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/');
15
}
16
require_once(DOKU_PLUGIN.'action.php');
17
18
class action_plugin_webmaster extends DokuWiki_Action_Plugin {
19
20
    function register(Doku_Event_Handler $controller) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'addVerifyHeaders', array());
22
    }   
23
24
    function addVerifyHeaders(&$event, $param) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
25
        if (empty($event->data)||empty($event->data['meta'])) {
26
            return;
27
        }
28
29
        /* Google */
30
        $g = $this->getConf('webmaster_google');
31
        if (!empty($g)) {
32
            $g = array('name' => 'google-site-verification', 'content' => $g);
33
            $event->data['meta'][] = $g;
34
        }
35
36
        /* bing */
37
        $b = $this->getConf('webmaster_bing');
38
        if (!empty($b)) {
39
            $b = array('name' => 'msvalidate.01', 'content' => $b);
40
            $event->data['meta'][] = $b;
41
        }
42
43
        /* Yandex */
44
        $y = $this->getConf('webmaster_yandexkey');
45
        if (!empty($y)) {
46
            $y = array('name' => 'yandex-verification', 'content' => $y); 
47
            $event->data['meta'][] = $y;
48
        }
49
    }
50
}
51