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')) 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
|
|||
17 | $controller->register_hook('TPL_METAHEADER_OUTPUT','BEFORE',$this,'addVerifyHeaders',array()); |
||
18 | } |
||
19 | |||
20 | function addVerifyHeaders(&$event, $param) { |
||
0 ignored issues
–
show
|
|||
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 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.