1<?php 2/** 3 * Webmaster Tools plugin. 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Mark C. Prins <mprins@users.sf.net> 7 * @author Marius Rieder <marius.rieder@durchmesser.ch> 8 */ 9 10class action_plugin_webmaster extends DokuWiki_Action_Plugin { 11 12 public function register(Doku_Event_Handler $controller) { 13 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'addVerifyHeaders', array()); 14 } 15 16 public function addVerifyHeaders(Doku_Event $event, $param) { 17 if(empty($event->data) || empty($event->data['meta'])) { 18 return; 19 } 20 21 /* Google */ 22 $g = $this->getConf('webmaster_google'); 23 if(!empty($g)) { 24 $g = array('name' => 'google-site-verification', 'content' => $g); 25 $event->data['meta'][] = $g; 26 } 27 28 /* bing */ 29 $b = $this->getConf('webmaster_bing'); 30 if(!empty($b)) { 31 $b = array('name' => 'msvalidate.01', 'content' => $b); 32 $event->data['meta'][] = $b; 33 } 34 35 /* Yandex */ 36 $y = $this->getConf('webmaster_yandexkey'); 37 if(!empty($y)) { 38 $y = array('name' => 'yandex-verification', 'content' => $y); 39 $event->data['meta'][] = $y; 40 } 41 42 /* Pinterest */ 43 $y = $this->getConf('webmaster_pinterestkey'); 44 if(!empty($y)) { 45 $y = array('name' => 'p:domain_verify', 'content' => $y); 46 $event->data['meta'][] = $y; 47 } 48 } 49} 50