Completed
Pull Request — master (#2)
by Mark
01:57
created

action_plugin_webmaster::addVerifyHeaders()   B

Complexity

Conditions 6
Paths 9

Size

Total Lines 24
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 24
rs 8.5125
cc 6
eloc 14
nc 9
nop 2
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')) die();
11
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
12
require_once(DOKU_PLUGIN.'action.php');
13
14
class action_plugin_webmaster extends DokuWiki_Action_Plugin {
15
16
    function register(Doku_Event_Handler $controller) {
0 ignored issues
show
Best Practice introduced by
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...
17
        $controller->register_hook('TPL_METAHEADER_OUTPUT','BEFORE',$this,'addVerifyHeaders',array());
18
    }   
19
20
    function addVerifyHeaders(&$event, $param) {
0 ignored issues
show
Best Practice introduced by
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
        if(empty($event->data)||empty($event->data['meta'])) return;
22
23
        /* Google */
24
        $g = $this->getConf('webmaster_google');
25
        if (!empty($g)) {
26
            $g = array('name' => 'google-site-verification', 'content' => $g);
27
            $event->data['meta'][] = $g;
28
        }
29
30
        /* bing */
31
        $b = $this->getConf('webmaster_bing');
32
        if (!empty($b)) {
33
            $b = array('name' => 'msvalidate.01', 'content' => $b);
34
            $event->data['meta'][] = $b;
35
        }
36
37
        /* Yandex */
38
        $y = $this->getConf('webmaster_yandexkey');
39
        if (!empty($y)) {
40
            $y = array('name' => 'yandex-verification', 'content' => $y); 
41
            $event->data['meta'][] = $y;
42
        }
43
    }
44
}
45